1
0
mirror of https://github.com/KokaKiwi/BarInsta synced 2024-11-26 00:27:30 +00:00

Fix comments input color in dark black theme. Fixes austinhuang0131/barinsta#1062

This commit is contained in:
Ammar Githam 2021-04-29 00:14:12 +09:00
parent 6df5bc056c
commit c0fb6e3a50
4 changed files with 21 additions and 17 deletions

View File

@ -20,7 +20,6 @@ import android.widget.Toast;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.LinearLayoutCompat; import androidx.appcompat.widget.LinearLayoutCompat;
import androidx.lifecycle.ViewModelProvider; import androidx.lifecycle.ViewModelProvider;
import androidx.navigation.NavController; import androidx.navigation.NavController;
@ -61,14 +60,12 @@ public final class CommentsViewerFragment extends BottomSheetDialogFragment impl
private CommentsAdapter commentsAdapter; private CommentsAdapter commentsAdapter;
private FragmentCommentsBinding binding; private FragmentCommentsBinding binding;
private LinearLayoutManager layoutManager;
private RecyclerLazyLoader lazyLoader; private RecyclerLazyLoader lazyLoader;
private String shortCode; private String shortCode;
private long authorUserId, userIdFromCookie; private long authorUserId, userIdFromCookie;
private String endCursor = null; private String endCursor = null;
private Resources resources; private Resources resources;
private InputMethodManager imm; private InputMethodManager imm;
private AppCompatActivity fragmentActivity;
private LinearLayoutCompat root; private LinearLayoutCompat root;
private boolean shouldRefresh = true, hasNextPage = false; private boolean shouldRefresh = true, hasNextPage = false;
private MediaService mediaService; private MediaService mediaService;
@ -167,7 +164,6 @@ public final class CommentsViewerFragment extends BottomSheetDialogFragment impl
@Override @Override
public void onCreate(@Nullable final Bundle savedInstanceState) { public void onCreate(@Nullable final Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
fragmentActivity = (AppCompatActivity) getActivity();
final String deviceUuid = Utils.settingsHelper.getString(Constants.DEVICE_UUID); final String deviceUuid = Utils.settingsHelper.getString(Constants.DEVICE_UUID);
final String csrfToken = CookieUtils.getCsrfTokenFromCookie(cookie); final String csrfToken = CookieUtils.getCsrfTokenFromCookie(cookie);
userIdFromCookie = CookieUtils.getUserIdFromCookie(cookie); userIdFromCookie = CookieUtils.getUserIdFromCookie(cookie);
@ -236,7 +232,7 @@ public final class CommentsViewerFragment extends BottomSheetDialogFragment impl
binding.swipeRefreshLayout.setOnRefreshListener(this); binding.swipeRefreshLayout.setOnRefreshListener(this);
binding.swipeRefreshLayout.setRefreshing(true); binding.swipeRefreshLayout.setRefreshing(true);
commentsViewModel = new ViewModelProvider(this).get(CommentsViewModel.class); commentsViewModel = new ViewModelProvider(this).get(CommentsViewModel.class);
layoutManager = new LinearLayoutManager(getContext()); final LinearLayoutManager layoutManager = new LinearLayoutManager(getContext());
binding.rvComments.setLayoutManager(layoutManager); binding.rvComments.setLayoutManager(layoutManager);
commentsAdapter = new CommentsAdapter(commentCallback); commentsAdapter = new CommentsAdapter(commentCallback);
binding.rvComments.setAdapter(commentsAdapter); binding.rvComments.setAdapter(commentsAdapter);
@ -368,8 +364,7 @@ public final class CommentsViewerFragment extends BottomSheetDialogFragment impl
Log.e(TAG, "Error liking comment", t); Log.e(TAG, "Error liking comment", t);
try { try {
Toast.makeText(context, t.getMessage(), Toast.LENGTH_SHORT).show(); Toast.makeText(context, t.getMessage(), Toast.LENGTH_SHORT).show();
} } catch (final Throwable ignored) {}
catch(final Throwable e) {}
} }
}); });
return; return;
@ -389,8 +384,7 @@ public final class CommentsViewerFragment extends BottomSheetDialogFragment impl
Log.e(TAG, "Error unliking comment", t); Log.e(TAG, "Error unliking comment", t);
try { try {
Toast.makeText(context, t.getMessage(), Toast.LENGTH_SHORT).show(); Toast.makeText(context, t.getMessage(), Toast.LENGTH_SHORT).show();
} } catch (final Throwable ignored) {}
catch(final Throwable e) {}
} }
}); });
break; break;
@ -414,8 +408,7 @@ public final class CommentsViewerFragment extends BottomSheetDialogFragment impl
Log.e(TAG, "Error translating comment", t); Log.e(TAG, "Error translating comment", t);
try { try {
Toast.makeText(context, t.getMessage(), Toast.LENGTH_SHORT).show(); Toast.makeText(context, t.getMessage(), Toast.LENGTH_SHORT).show();
} } catch (final Throwable ignored) {}
catch(final Throwable e) {}
} }
}); });
break; break;
@ -438,8 +431,7 @@ public final class CommentsViewerFragment extends BottomSheetDialogFragment impl
Log.e(TAG, "Error deleting comment", t); Log.e(TAG, "Error deleting comment", t);
try { try {
Toast.makeText(context, t.getMessage(), Toast.LENGTH_SHORT).show(); Toast.makeText(context, t.getMessage(), Toast.LENGTH_SHORT).show();
} } catch (final Throwable ignored) {}
catch(final Throwable e) {}
} }
}); });
break; break;
@ -469,8 +461,7 @@ public final class CommentsViewerFragment extends BottomSheetDialogFragment impl
try { try {
Toast.makeText(getContext(), t.getMessage(), Toast.LENGTH_SHORT).show(); Toast.makeText(getContext(), t.getMessage(), Toast.LENGTH_SHORT).show();
binding.swipeRefreshLayout.setRefreshing(false); binding.swipeRefreshLayout.setRefreshing(false);
} } catch (Throwable ignored) {}
catch(Throwable e) {}
} }
} }

View File

@ -31,7 +31,8 @@
app:counterMaxLength="2200" app:counterMaxLength="2200"
app:endIconDrawable="@drawable/ic_round_send_24" app:endIconDrawable="@drawable/ic_round_send_24"
app:endIconMode="custom" app:endIconMode="custom"
app:startIconDrawable="@drawable/ic_close_24"> app:startIconDrawable="@drawable/ic_close_24"
tools:visibility="visible">
<com.google.android.material.textfield.TextInputEditText <com.google.android.material.textfield.TextInputEditText
android:id="@+id/commentText" android:id="@+id/commentText"
@ -41,7 +42,8 @@
android:inputType="textMultiLine" android:inputType="textMultiLine"
android:maxLength="2200" android:maxLength="2200"
android:maxLines="10" android:maxLines="10"
android:scrollHorizontally="false" /> android:scrollHorizontally="false"
tools:text="test" />
</com.google.android.material.textfield.TextInputLayout> </com.google.android.material.textfield.TextInputLayout>
</androidx.appcompat.widget.LinearLayoutCompat> </androidx.appcompat.widget.LinearLayoutCompat>

View File

@ -260,4 +260,14 @@
<style name="ThemeOverlay.MaterialComponents.TextInputEditText.OutlinedBox.Light.Barinsta" parent="ThemeOverlay.MaterialComponents.TextInputEditText.OutlinedBox"> <style name="ThemeOverlay.MaterialComponents.TextInputEditText.OutlinedBox.Light.Barinsta" parent="ThemeOverlay.MaterialComponents.TextInputEditText.OutlinedBox">
<item name="colorPrimary">@color/white</item> <item name="colorPrimary">@color/white</item>
</style> </style>
<style name="Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dark.Black" parent="Widget.MaterialComponents.TextInputLayout.OutlinedBox">
<item name="materialThemeOverlay">@style/ThemeOverlay.MaterialComponents.TextInputEditText.OutlinedBox.Dark.Black</item>
<item name="hintTextColor">@color/white</item>
<item name="boxStrokeColor">@color/white</item>
</style>
<style name="ThemeOverlay.MaterialComponents.TextInputEditText.OutlinedBox.Dark.Black" parent="ThemeOverlay.MaterialComponents.TextInputEditText.OutlinedBox">
<item name="colorPrimary">@color/white</item>
</style>
</resources> </resources>

View File

@ -146,6 +146,7 @@
<item name="dmOutgoingBgColor">@color/deep_purple_400</item> <item name="dmOutgoingBgColor">@color/deep_purple_400</item>
<item name="dmDateHeaderBgColor">@color/deep_purple_600</item> <item name="dmDateHeaderBgColor">@color/deep_purple_600</item>
<item name="tabStyle">@style/Widget.MaterialComponents.TabLayout.Dark.Black</item> <item name="tabStyle">@style/Widget.MaterialComponents.TabLayout.Dark.Black</item>
<item name="textInputStyle">@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dark.Black</item>
</style> </style>
<style name="AppTheme.Dark.MaterialDark" parent="AppTheme.Dark"> <style name="AppTheme.Dark.MaterialDark" parent="AppTheme.Dark">