Crash analytics with Firebase
Conversation line visual
This commit is contained in:
parent
4fd941febd
commit
5d1a86d472
6 changed files with 54 additions and 1 deletions
|
@ -43,9 +43,11 @@ dependencies {
|
|||
compile 'com.github.arimorty:floatingsearchview:2.0.3'
|
||||
compile 'com.jakewharton:butterknife:8.4.0'
|
||||
compile 'com.google.firebase:firebase-messaging:10.0.1'
|
||||
compile 'com.google.firebase:firebase-crash:10.0.1'
|
||||
testCompile 'junit:junit:4.12'
|
||||
annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0'
|
||||
}
|
||||
|
||||
|
||||
|
||||
apply plugin: 'com.google.gms.google-services'
|
|
@ -0,0 +1,41 @@
|
|||
package com.keylesspalace.tusky;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.util.TypedValue;
|
||||
import android.view.View;
|
||||
|
||||
import static android.util.TypedValue.COMPLEX_UNIT_DIP;
|
||||
|
||||
class ConversationLineItemDecoration extends RecyclerView.ItemDecoration {
|
||||
private final Context mContext;
|
||||
private final Drawable mDivider;
|
||||
|
||||
public ConversationLineItemDecoration(Context context, Drawable divider) {
|
||||
mContext = context;
|
||||
mDivider = divider;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDraw(Canvas c, RecyclerView parent, RecyclerView.State state) {
|
||||
// Fun fact: this method draws in pixels, but all layouts are in DP, so I'm using the divider's
|
||||
// own 2dp width to calculate what I want
|
||||
int dividerLeft = parent.getPaddingLeft() + mContext.getResources().getDimensionPixelSize(R.dimen.status_left_line_margin);
|
||||
int dividerRight = dividerLeft + mDivider.getIntrinsicWidth();
|
||||
|
||||
int childCount = parent.getChildCount();
|
||||
|
||||
for (int i = 0; i < childCount - 1; i++) {
|
||||
View child = parent.getChildAt(i);
|
||||
|
||||
int dividerTop = child.getTop() + (i == 0 ? mContext.getResources().getDimensionPixelSize(R.dimen.account_avatar_margin) : 0);
|
||||
int dividerBottom = (i == childCount - 2 ? dividerTop + mContext.getResources().getDimensionPixelSize(R.dimen.account_avatar_margin) : child.getBottom());
|
||||
|
||||
mDivider.setBounds(dividerLeft, dividerTop, dividerRight, dividerBottom);
|
||||
mDivider.draw(c);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -36,7 +36,7 @@ public class SplashActivity extends Activity {
|
|||
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||
|
||||
setContentView(R.layout.activity_splash);
|
||||
|
||||
|
||||
/* Determine whether the user is currently logged in, and if so go ahead and load the
|
||||
* timeline. Otherwise, start the activity_login screen. */
|
||||
SharedPreferences preferences = getSharedPreferences(
|
||||
|
|
|
@ -20,6 +20,7 @@ import android.graphics.drawable.Drawable;
|
|||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.design.widget.Snackbar;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v7.widget.DividerItemDecoration;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
|
@ -63,6 +64,7 @@ public class ViewThreadFragment extends SFragment implements StatusActionListene
|
|||
R.drawable.status_divider_dark);
|
||||
divider.setDrawable(drawable);
|
||||
recyclerView.addItemDecoration(divider);
|
||||
recyclerView.addItemDecoration(new ConversationLineItemDecoration(context, ContextCompat.getDrawable(context, R.drawable.conversation_divider_dark)));
|
||||
adapter = new ThreadAdapter(this);
|
||||
recyclerView.setAdapter(adapter);
|
||||
|
||||
|
|
7
app/src/main/res/drawable/conversation_divider_dark.xml
Normal file
7
app/src/main/res/drawable/conversation_divider_dark.xml
Normal file
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<size android:width="2dp" />
|
||||
<solid android:color="@color/color_primary_dark_dark" />
|
||||
</shape>
|
|
@ -20,4 +20,5 @@
|
|||
<dimen name="account_note_margin">8dp</dimen>
|
||||
<dimen name="account_avatar_margin">8dp</dimen>
|
||||
<dimen name="tab_page_margin">8dp</dimen>
|
||||
<dimen name="status_left_line_margin">38dp</dimen>
|
||||
</resources>
|
||||
|
|
Loading…
Reference in a new issue