diff --git a/app/build.gradle b/app/build.gradle index 9e976658c..a71f3b4dc 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -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' \ No newline at end of file diff --git a/app/src/main/java/com/keylesspalace/tusky/ConversationLineItemDecoration.java b/app/src/main/java/com/keylesspalace/tusky/ConversationLineItemDecoration.java new file mode 100644 index 000000000..6532bdd61 --- /dev/null +++ b/app/src/main/java/com/keylesspalace/tusky/ConversationLineItemDecoration.java @@ -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); + } + } +} diff --git a/app/src/main/java/com/keylesspalace/tusky/SplashActivity.java b/app/src/main/java/com/keylesspalace/tusky/SplashActivity.java index 11111e221..dcb35fdd2 100644 --- a/app/src/main/java/com/keylesspalace/tusky/SplashActivity.java +++ b/app/src/main/java/com/keylesspalace/tusky/SplashActivity.java @@ -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( diff --git a/app/src/main/java/com/keylesspalace/tusky/ViewThreadFragment.java b/app/src/main/java/com/keylesspalace/tusky/ViewThreadFragment.java index a83c35e2d..de535035b 100644 --- a/app/src/main/java/com/keylesspalace/tusky/ViewThreadFragment.java +++ b/app/src/main/java/com/keylesspalace/tusky/ViewThreadFragment.java @@ -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); diff --git a/app/src/main/res/drawable/conversation_divider_dark.xml b/app/src/main/res/drawable/conversation_divider_dark.xml new file mode 100644 index 000000000..42034487b --- /dev/null +++ b/app/src/main/res/drawable/conversation_divider_dark.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index c01d532cf..c2babd783 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -20,4 +20,5 @@ 8dp 8dp 8dp + 38dp