Skip to content
Snippets Groups Projects
Commit c5e4f075 authored by Janne Mareike Koschinski's avatar Janne Mareike Koschinski
Browse files

Added bugreporting and refined the backlog load UI

parent f3e61f9c
Branches
Tags
No related merge requests found
......@@ -166,6 +166,9 @@ dependencies {
compile 'com.android.support:preference-v14:24.0.0'
compile 'com.android.support:cardview-v7:24.0.0'
// Crashreports
compile 'ch.acra:acra:4.9.0'
// UI autobinding
compile 'com.jakewharton:butterknife:7.0.1'
}
......@@ -18,14 +18,12 @@
-dontobfuscate
-dontwarn javax.annotation.**
-dontwarn javax.lang.model.**
-dontwarn javax.tools.**
-dontwarn com.google.j2objc.annotations.**
-dontwarn java.lang.ClassValue
-dontwarn sun.misc.Unsafe
-dontwarn javax.**
-dontwarn com.google.**
-dontwarn sndroid.**
-dontwarn java.**
-dontwarn sun.**
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
-dontwarn javax.annotation.processing.ProcessingEnvironment
-dontwarn com.nineoldandroids.view.animation.AnimatorProxy
-keepclasseswithmembernames class de.kuschku.** {
......@@ -38,6 +36,11 @@
<fields>;
}
-keepclasses class de.kuschku.** {
<methods>;
<fields>;
}
#########################################
## Bufferknife ##
......@@ -69,4 +72,10 @@
#########################################
## RetroLambda ##
#########################################
-dontwarn java.lang.invoke.*
\ No newline at end of file
-dontwarn java.lang.invoke.*
#########################################
## DBFlow ##
#########################################
-keep class * extends com.raizlabs.android.dbflow.config.DatabaseHolder { *; }
\ No newline at end of file
......@@ -27,10 +27,30 @@ import android.content.Context;
import com.raizlabs.android.dbflow.config.FlowConfig;
import com.raizlabs.android.dbflow.config.FlowManager;
import org.acra.ACRA;
import org.acra.ReportField;
import org.acra.ReportingInteractionMode;
import org.acra.annotation.ReportsCrashes;
import de.kuschku.libquassel.localtypes.orm.ConnectedDatabase;
@ReportsCrashes(
formUri = "https://reports.kuschku.de/report/2/",
reportType = org.acra.sender.HttpSender.Type.JSON,
httpMethod = org.acra.sender.HttpSender.Method.POST,
customReportContent = {
ReportField.APP_VERSION_CODE,
ReportField.APP_VERSION_NAME,
ReportField.ANDROID_VERSION,
ReportField.PACKAGE_NAME,
ReportField.REPORT_ID,
ReportField.BUILD,
ReportField.STACK_TRACE
},
mode = ReportingInteractionMode.TOAST,
resToastText = R.string.notification_report_crash
)
public class QuasselDroidNG extends Application {
private static Context applicationContext;
public static Context context() {
......@@ -40,7 +60,11 @@ public class QuasselDroidNG extends Application {
@Override
public void onCreate() {
super.onCreate();
ACRA.init(this);
applicationContext = getApplicationContext();
FlowManager.init(new FlowConfig.Builder(this).build());
FlowManager.getDatabase(ConnectedDatabase.class).getWritableDatabase();
}
......
......@@ -30,6 +30,7 @@ import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AbsListView;
import com.sothree.slidinguppanel.SlidingUpPanelLayout;
......@@ -56,13 +57,13 @@ public class ChatFragment extends BoundFragment {
*/
@Bind(R.id.messages)
RecyclerView messages;
@Bind(R.id.swipe_view)
SwipeRefreshLayout swipeView;
@Bind(R.id.sliding_layout)
SlidingUpPanelLayout sliderMain;
private MessageAdapter messageAdapter;
private LinearLayoutManager layoutManager;
private boolean loading = false;
@Nullable
@Override
......@@ -79,14 +80,18 @@ public class ChatFragment extends BoundFragment {
messageAdapter = new MessageAdapter(getActivity(), context, new AutoScroller(messages));
messages.setAdapter(messageAdapter);
swipeView.setColorSchemeColors(context.themeUtil().res.colorPrimary);
swipeView.setEnabled(false);
swipeView.setOnRefreshListener(() -> {
Client client = context.client();
assertNotNull(client);
QBacklogManager<? extends QBacklogManager> backlogManager = client.backlogManager();
assertNotNull(backlogManager);
backlogManager.requestMoreBacklog(client.backlogManager().open(), 20);
messages.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
if (!loading && !recyclerView.canScrollVertically(-1)) {
Client client = context.client();
assertNotNull(client);
QBacklogManager<? extends QBacklogManager> backlogManager = client.backlogManager();
assertNotNull(backlogManager);
backlogManager.requestMoreBacklog(client.backlogManager().open(), 20);
loading = true;
}
}
});
return view;
......@@ -101,11 +106,7 @@ public class ChatFragment extends BoundFragment {
int id = backlogManager.open();
ObservableComparableSortedList<Message> messageList = backlogManager.filtered(id);
messageAdapter.setMessageList(messageList);
swipeView.setEnabled(id != -1);
// Load markerline
} else {
swipeView.setEnabled(false);
}
}
......@@ -127,7 +128,7 @@ public class ChatFragment extends BoundFragment {
public void onEventMainThread(BacklogReceivedEvent event) {
Client client = context.client();
if (client != null && client.backlogManager().open() == event.bufferId) {
swipeView.setRefreshing(false);
loading = false;
}
}
}
......@@ -34,17 +34,11 @@
app:umanoShadowHeight="4dp"
tools:showIn="@layout/activity_chat">
<de.kuschku.quasseldroid_ng.ui.chat.util.ScrollRefreshLayout
android:id="@+id/swipe_view"
<android.support.v7.widget.RecyclerView
android:id="@+id/messages"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
android:id="@+id/messages"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="true" />
</de.kuschku.quasseldroid_ng.ui.chat.util.ScrollRefreshLayout>
android:layout_height="match_parent"
android:clickable="true" />
<include layout="@layout/widget_slider" />
......
......@@ -80,4 +80,5 @@
<string name="statusConnected">Connected</string>
<string name="statusWelcome">Welcome!</string>
<string name="statusDisconnected">Connection lost</string>
<string name="notification_report_crash">Reporting Crashes</string>
</resources>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment