From c0fb6e3a507579bda68427b7ba697abd18c73542 Mon Sep 17 00:00:00 2001 From: Ammar Githam Date: Thu, 29 Apr 2021 00:14:12 +0900 Subject: [PATCH] Fix comments input color in dark black theme. Fixes austinhuang0131/barinsta#1062 --- .../fragments/CommentsViewerFragment.java | 21 ++++++------------- app/src/main/res/layout/fragment_comments.xml | 6 ++++-- app/src/main/res/values/styles.xml | 10 +++++++++ app/src/main/res/values/themes.xml | 1 + 4 files changed, 21 insertions(+), 17 deletions(-) diff --git a/app/src/main/java/awais/instagrabber/fragments/CommentsViewerFragment.java b/app/src/main/java/awais/instagrabber/fragments/CommentsViewerFragment.java index 6fa829a1..d8635892 100644 --- a/app/src/main/java/awais/instagrabber/fragments/CommentsViewerFragment.java +++ b/app/src/main/java/awais/instagrabber/fragments/CommentsViewerFragment.java @@ -20,7 +20,6 @@ import android.widget.Toast; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.app.AlertDialog; -import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.widget.LinearLayoutCompat; import androidx.lifecycle.ViewModelProvider; import androidx.navigation.NavController; @@ -61,14 +60,12 @@ public final class CommentsViewerFragment extends BottomSheetDialogFragment impl private CommentsAdapter commentsAdapter; private FragmentCommentsBinding binding; - private LinearLayoutManager layoutManager; private RecyclerLazyLoader lazyLoader; private String shortCode; private long authorUserId, userIdFromCookie; private String endCursor = null; private Resources resources; private InputMethodManager imm; - private AppCompatActivity fragmentActivity; private LinearLayoutCompat root; private boolean shouldRefresh = true, hasNextPage = false; private MediaService mediaService; @@ -167,7 +164,6 @@ public final class CommentsViewerFragment extends BottomSheetDialogFragment impl @Override public void onCreate(@Nullable final Bundle savedInstanceState) { super.onCreate(savedInstanceState); - fragmentActivity = (AppCompatActivity) getActivity(); final String deviceUuid = Utils.settingsHelper.getString(Constants.DEVICE_UUID); final String csrfToken = CookieUtils.getCsrfTokenFromCookie(cookie); userIdFromCookie = CookieUtils.getUserIdFromCookie(cookie); @@ -236,7 +232,7 @@ public final class CommentsViewerFragment extends BottomSheetDialogFragment impl binding.swipeRefreshLayout.setOnRefreshListener(this); binding.swipeRefreshLayout.setRefreshing(true); commentsViewModel = new ViewModelProvider(this).get(CommentsViewModel.class); - layoutManager = new LinearLayoutManager(getContext()); + final LinearLayoutManager layoutManager = new LinearLayoutManager(getContext()); binding.rvComments.setLayoutManager(layoutManager); commentsAdapter = new CommentsAdapter(commentCallback); binding.rvComments.setAdapter(commentsAdapter); @@ -368,8 +364,7 @@ public final class CommentsViewerFragment extends BottomSheetDialogFragment impl Log.e(TAG, "Error liking comment", t); try { Toast.makeText(context, t.getMessage(), Toast.LENGTH_SHORT).show(); - } - catch(final Throwable e) {} + } catch (final Throwable ignored) {} } }); return; @@ -389,8 +384,7 @@ public final class CommentsViewerFragment extends BottomSheetDialogFragment impl Log.e(TAG, "Error unliking comment", t); try { Toast.makeText(context, t.getMessage(), Toast.LENGTH_SHORT).show(); - } - catch(final Throwable e) {} + } catch (final Throwable ignored) {} } }); break; @@ -414,8 +408,7 @@ public final class CommentsViewerFragment extends BottomSheetDialogFragment impl Log.e(TAG, "Error translating comment", t); try { Toast.makeText(context, t.getMessage(), Toast.LENGTH_SHORT).show(); - } - catch(final Throwable e) {} + } catch (final Throwable ignored) {} } }); break; @@ -438,8 +431,7 @@ public final class CommentsViewerFragment extends BottomSheetDialogFragment impl Log.e(TAG, "Error deleting comment", t); try { Toast.makeText(context, t.getMessage(), Toast.LENGTH_SHORT).show(); - } - catch(final Throwable e) {} + } catch (final Throwable ignored) {} } }); break; @@ -469,8 +461,7 @@ public final class CommentsViewerFragment extends BottomSheetDialogFragment impl try { Toast.makeText(getContext(), t.getMessage(), Toast.LENGTH_SHORT).show(); binding.swipeRefreshLayout.setRefreshing(false); - } - catch(Throwable e) {} + } catch (Throwable ignored) {} } } diff --git a/app/src/main/res/layout/fragment_comments.xml b/app/src/main/res/layout/fragment_comments.xml index c88982c2..5ac646d6 100644 --- a/app/src/main/res/layout/fragment_comments.xml +++ b/app/src/main/res/layout/fragment_comments.xml @@ -31,7 +31,8 @@ app:counterMaxLength="2200" app:endIconDrawable="@drawable/ic_round_send_24" app:endIconMode="custom" - app:startIconDrawable="@drawable/ic_close_24"> + app:startIconDrawable="@drawable/ic_close_24" + tools:visibility="visible"> + android:scrollHorizontally="false" + tools:text="test" /> \ No newline at end of file diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 129f3875..d013e888 100755 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -260,4 +260,14 @@ + + + + diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml index cceca619..d781845f 100644 --- a/app/src/main/res/values/themes.xml +++ b/app/src/main/res/values/themes.xml @@ -146,6 +146,7 @@ @color/deep_purple_400 @color/deep_purple_600 @style/Widget.MaterialComponents.TabLayout.Dark.Black + @style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dark.Black