From 5ee78e68ba874b3668d4f1d495b01d7af1cb7a81 Mon Sep 17 00:00:00 2001 From: Konrad Pozniak Date: Tue, 26 Feb 2019 18:28:20 +0100 Subject: [PATCH] remove unnecessary divider styling (#1057) --- .../java/com/keylesspalace/tusky/ReportActivity.java | 5 ----- .../com/keylesspalace/tusky/SavedTootActivity.java | 5 ----- .../components/conversation/ConversationsFragment.kt | 6 +----- .../tusky/fragment/AccountListFragment.kt | 7 ++----- .../tusky/fragment/NotificationsFragment.java | 10 ++-------- .../keylesspalace/tusky/fragment/TimelineFragment.java | 5 ----- .../tusky/fragment/ViewThreadFragment.java | 3 --- .../main/res/drawable/report_status_divider_dark.xml | 6 ------ .../main/res/drawable/report_status_divider_light.xml | 6 ------ app/src/main/res/layout/item_status_detailed.xml | 4 ++-- app/src/main/res/values-night/styles.xml | 3 +-- app/src/main/res/values/attrs.xml | 2 -- app/src/main/res/values/colors.xml | 2 -- app/src/main/res/values/styles.xml | 3 +-- 14 files changed, 9 insertions(+), 58 deletions(-) delete mode 100644 app/src/main/res/drawable/report_status_divider_dark.xml delete mode 100644 app/src/main/res/drawable/report_status_divider_light.xml diff --git a/app/src/main/java/com/keylesspalace/tusky/ReportActivity.java b/app/src/main/java/com/keylesspalace/tusky/ReportActivity.java index fa62bbe2..31911212 100644 --- a/app/src/main/java/com/keylesspalace/tusky/ReportActivity.java +++ b/app/src/main/java/com/keylesspalace/tusky/ReportActivity.java @@ -16,7 +16,6 @@ package com.keylesspalace.tusky; import android.content.Intent; -import android.graphics.drawable.Drawable; import android.os.Bundle; import android.util.Log; import android.view.Menu; @@ -30,7 +29,6 @@ import com.keylesspalace.tusky.di.Injectable; import com.keylesspalace.tusky.entity.Status; import com.keylesspalace.tusky.network.MastodonApi; import com.keylesspalace.tusky.util.HtmlUtils; -import com.keylesspalace.tusky.util.ThemeUtils; import java.util.ArrayList; import java.util.Arrays; @@ -93,9 +91,6 @@ public class ReportActivity extends BaseActivity implements Injectable { DividerItemDecoration divider = new DividerItemDecoration( this, layoutManager.getOrientation()); - Drawable drawable = ThemeUtils.getDrawable(this, R.attr.report_status_divider_drawable, - R.drawable.report_status_divider_dark); - divider.setDrawable(drawable); recyclerView.addItemDecoration(divider); ReportAdapter.ReportStatus reportStatus = new ReportAdapter.ReportStatus(statusId, diff --git a/app/src/main/java/com/keylesspalace/tusky/SavedTootActivity.java b/app/src/main/java/com/keylesspalace/tusky/SavedTootActivity.java index 1cd14416..bed3ec86 100644 --- a/app/src/main/java/com/keylesspalace/tusky/SavedTootActivity.java +++ b/app/src/main/java/com/keylesspalace/tusky/SavedTootActivity.java @@ -16,7 +16,6 @@ package com.keylesspalace.tusky; import android.content.Intent; -import android.graphics.drawable.Drawable; import android.os.AsyncTask; import android.os.Bundle; import android.view.MenuItem; @@ -31,7 +30,6 @@ import com.keylesspalace.tusky.db.TootDao; import com.keylesspalace.tusky.db.TootEntity; import com.keylesspalace.tusky.di.Injectable; import com.keylesspalace.tusky.util.SaveTootHelper; -import com.keylesspalace.tusky.util.ThemeUtils; import java.lang.ref.WeakReference; import java.util.ArrayList; @@ -99,9 +97,6 @@ public final class SavedTootActivity extends BaseActivity implements SavedTootAd recyclerView.setLayoutManager(layoutManager); DividerItemDecoration divider = new DividerItemDecoration( this, layoutManager.getOrientation()); - Drawable drawable = ThemeUtils.getDrawable(this, R.attr.status_divider_drawable, - R.drawable.status_divider_dark); - divider.setDrawable(drawable); recyclerView.addItemDecoration(divider); adapter = new SavedTootAdapter(this); recyclerView.setAdapter(adapter); diff --git a/app/src/main/java/com/keylesspalace/tusky/components/conversation/ConversationsFragment.kt b/app/src/main/java/com/keylesspalace/tusky/components/conversation/ConversationsFragment.kt index 040e2936..edbf4a3f 100644 --- a/app/src/main/java/com/keylesspalace/tusky/components/conversation/ConversationsFragment.kt +++ b/app/src/main/java/com/keylesspalace/tusky/components/conversation/ConversationsFragment.kt @@ -39,7 +39,6 @@ import com.keylesspalace.tusky.network.TimelineCases import com.keylesspalace.tusky.util.NetworkState import com.keylesspalace.tusky.util.ThemeUtils import com.keylesspalace.tusky.util.hide -import com.keylesspalace.tusky.util.show import kotlinx.android.synthetic.main.fragment_timeline.* import javax.inject.Inject @@ -73,10 +72,7 @@ class ConversationsFragment : SFragment(), StatusActionListener, Injectable { adapter = ConversationAdapter(useAbsoluteTime, mediaPreviewEnabled,this, ::onTopLoaded, viewModel::retry) - val divider = DividerItemDecoration(view.context, DividerItemDecoration.VERTICAL) - val drawable = ThemeUtils.getDrawable(view.context, R.attr.status_divider_drawable, R.drawable.status_divider_dark) - divider.setDrawable(drawable) - recyclerView.addItemDecoration(divider) + recyclerView.addItemDecoration(DividerItemDecoration(view.context, DividerItemDecoration.VERTICAL)) recyclerView.layoutManager = LinearLayoutManager(view.context) recyclerView.adapter = adapter (recyclerView.itemAnimator as SimpleItemAnimator).supportsChangeAnimations = false diff --git a/app/src/main/java/com/keylesspalace/tusky/fragment/AccountListFragment.kt b/app/src/main/java/com/keylesspalace/tusky/fragment/AccountListFragment.kt index 36d5b4aa..dcc7a7ba 100644 --- a/app/src/main/java/com/keylesspalace/tusky/fragment/AccountListFragment.kt +++ b/app/src/main/java/com/keylesspalace/tusky/fragment/AccountListFragment.kt @@ -36,7 +36,6 @@ import com.keylesspalace.tusky.entity.Relationship import com.keylesspalace.tusky.interfaces.AccountActionListener import com.keylesspalace.tusky.network.MastodonApi import com.keylesspalace.tusky.util.HttpHeaderLink -import com.keylesspalace.tusky.util.ThemeUtils import com.keylesspalace.tusky.util.hide import com.keylesspalace.tusky.util.show import com.keylesspalace.tusky.view.EndlessOnScrollListener @@ -80,10 +79,8 @@ class AccountListFragment : BaseFragment(), AccountActionListener, Injectable { recyclerView.setHasFixedSize(true) val layoutManager = LinearLayoutManager(view.context) recyclerView.layoutManager = layoutManager - val divider = DividerItemDecoration(view.context, layoutManager.orientation) - val drawable = ThemeUtils.getDrawable(view.context, R.attr.status_divider_drawable, R.drawable.status_divider_dark) - divider.setDrawable(drawable) - recyclerView.addItemDecoration(divider) + + recyclerView.addItemDecoration(DividerItemDecoration(view.context, DividerItemDecoration.VERTICAL)) adapter = when (type) { Type.BLOCKS -> BlocksAdapter(this) diff --git a/app/src/main/java/com/keylesspalace/tusky/fragment/NotificationsFragment.java b/app/src/main/java/com/keylesspalace/tusky/fragment/NotificationsFragment.java index 185f9ded..2e8f7674 100644 --- a/app/src/main/java/com/keylesspalace/tusky/fragment/NotificationsFragment.java +++ b/app/src/main/java/com/keylesspalace/tusky/fragment/NotificationsFragment.java @@ -18,7 +18,6 @@ package com.keylesspalace.tusky.fragment; import android.app.Activity; import android.content.Context; import android.content.SharedPreferences; -import android.graphics.drawable.Drawable; import android.os.Bundle; import android.preference.PreferenceManager; import android.util.Log; @@ -58,7 +57,6 @@ import com.keylesspalace.tusky.viewdata.NotificationViewData; import com.keylesspalace.tusky.viewdata.StatusViewData; import java.io.IOException; -import java.math.BigInteger; import java.util.Collections; import java.util.Iterator; import java.util.List; @@ -188,12 +186,8 @@ public class NotificationsFragment extends SFragment implements recyclerView.setHasFixedSize(true); layoutManager = new LinearLayoutManager(context); recyclerView.setLayoutManager(layoutManager); - DividerItemDecoration divider = new DividerItemDecoration( - context, layoutManager.getOrientation()); - Drawable drawable = ThemeUtils.getDrawable(context, R.attr.status_divider_drawable, - R.drawable.status_divider_dark); - divider.setDrawable(drawable); - recyclerView.addItemDecoration(divider); + + recyclerView.addItemDecoration(new DividerItemDecoration(context, DividerItemDecoration.VERTICAL)); adapter = new NotificationsAdapter(this, this); SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(getActivity()); diff --git a/app/src/main/java/com/keylesspalace/tusky/fragment/TimelineFragment.java b/app/src/main/java/com/keylesspalace/tusky/fragment/TimelineFragment.java index a5214c80..4951f2c3 100644 --- a/app/src/main/java/com/keylesspalace/tusky/fragment/TimelineFragment.java +++ b/app/src/main/java/com/keylesspalace/tusky/fragment/TimelineFragment.java @@ -17,7 +17,6 @@ package com.keylesspalace.tusky.fragment; import android.content.Context; import android.content.SharedPreferences; -import android.graphics.drawable.Drawable; import android.os.Bundle; import android.preference.PreferenceManager; import android.util.Log; @@ -61,7 +60,6 @@ import com.keylesspalace.tusky.view.EndlessOnScrollListener; import com.keylesspalace.tusky.viewdata.StatusViewData; import java.io.IOException; -import java.math.BigInteger; import java.util.Iterator; import java.util.List; import java.util.ListIterator; @@ -355,9 +353,6 @@ public class TimelineFragment extends SFragment implements recyclerView.setLayoutManager(layoutManager); DividerItemDecoration divider = new DividerItemDecoration( context, layoutManager.getOrientation()); - Drawable drawable = ThemeUtils.getDrawable(context, R.attr.status_divider_drawable, - R.drawable.status_divider_dark); - divider.setDrawable(drawable); recyclerView.addItemDecoration(divider); // CWs are expanded without animation, buttons animate itself, we don't need it basically diff --git a/app/src/main/java/com/keylesspalace/tusky/fragment/ViewThreadFragment.java b/app/src/main/java/com/keylesspalace/tusky/fragment/ViewThreadFragment.java index c7b9fddd..500530c8 100644 --- a/app/src/main/java/com/keylesspalace/tusky/fragment/ViewThreadFragment.java +++ b/app/src/main/java/com/keylesspalace/tusky/fragment/ViewThreadFragment.java @@ -149,9 +149,6 @@ public final class ViewThreadFragment extends SFragment implements recyclerView.setLayoutManager(layoutManager); DividerItemDecoration divider = new DividerItemDecoration( context, layoutManager.getOrientation()); - Drawable dividerDrawable = ThemeUtils.getDrawable(context, R.attr.status_divider_drawable, - R.drawable.status_divider_dark); - divider.setDrawable(dividerDrawable); recyclerView.addItemDecoration(divider); Drawable threadLineDrawable = ThemeUtils.getDrawable(context, R.attr.conversation_thread_line_drawable, diff --git a/app/src/main/res/drawable/report_status_divider_dark.xml b/app/src/main/res/drawable/report_status_divider_dark.xml deleted file mode 100644 index ebfe2646..00000000 --- a/app/src/main/res/drawable/report_status_divider_dark.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - \ No newline at end of file diff --git a/app/src/main/res/drawable/report_status_divider_light.xml b/app/src/main/res/drawable/report_status_divider_light.xml deleted file mode 100644 index 033c2448..00000000 --- a/app/src/main/res/drawable/report_status_divider_light.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/item_status_detailed.xml b/app/src/main/res/layout/item_status_detailed.xml index 47ff6b24..43fe6b9e 100644 --- a/app/src/main/res/layout/item_status_detailed.xml +++ b/app/src/main/res/layout/item_status_detailed.xml @@ -339,7 +339,7 @@ android:layout_height="1dp" android:layout_below="@id/status_timestamp_info" android:layout_marginTop="6dp" - android:background="?attr/status_divider_drawable" + android:background="?android:attr/listDivider" android:paddingStart="16dp" android:paddingEnd="16dp" app:layout_constraintTop_toBottomOf="@id/status_timestamp_info" /> @@ -384,7 +384,7 @@ android:layout_width="match_parent" android:layout_height="1dp" android:layout_marginTop="6dp" - android:background="?attr/status_divider_drawable" + android:background="?android:attr/listDivider" android:paddingStart="16dp" android:paddingEnd="16dp" app:layout_constraintTop_toBottomOf="@id/status_counters_barrier" /> diff --git a/app/src/main/res/values-night/styles.xml b/app/src/main/res/values-night/styles.xml index e48e9b97..44f6a85b 100644 --- a/app/src/main/res/values-night/styles.xml +++ b/app/src/main/res/values-night/styles.xml @@ -39,7 +39,7 @@ @drawable/toggle_small @color/color_background_dark @drawable/media_preview_unloaded_dark - @drawable/status_divider_dark + @drawable/status_divider_dark @drawable/conversation_thread_line_dark @color/tusky_blue @drawable/tab_page_margin_dark @@ -53,7 +53,6 @@ @color/compose_reply_content_background_dark @color/color_background_dark - @drawable/status_divider_dark @color/window_background_dark @color/text_color_primary_dark diff --git a/app/src/main/res/values/attrs.xml b/app/src/main/res/values/attrs.xml index c04202e6..1ba57ba9 100644 --- a/app/src/main/res/values/attrs.xml +++ b/app/src/main/res/values/attrs.xml @@ -24,7 +24,6 @@ - @@ -36,7 +35,6 @@ - diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 9e58a7f3..a8f9e72f 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -26,7 +26,6 @@ #1a1c23 #ffffff #586173 - #2F2F2F #313543 #373c4b @@ -57,7 +56,6 @@ #DE000000 #a3a5ab #EFEFEF - #9F9F9F #ffffff #e0e1e6 diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 8d5ea586..d96db010 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -84,7 +84,7 @@ @drawable/toggle_small_light @color/sensitive_media_warning_background_light @drawable/media_preview_unloaded_light - @drawable/status_divider_light + @drawable/status_divider_light @drawable/conversation_thread_line_light @color/tusky_blue @drawable/tab_page_margin_light @@ -99,7 +99,6 @@ @color/compose_reply_content_background_light @color/report_status_background_light - @drawable/report_status_divider_light @color/window_background_light @color/text_color_primary_light