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