Browse Source

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

renovate/org.robolectric-robolectric-4.x
Ammar Githam 4 years ago
parent
commit
c0fb6e3a50
  1. 21
      app/src/main/java/awais/instagrabber/fragments/CommentsViewerFragment.java
  2. 6
      app/src/main/res/layout/fragment_comments.xml
  3. 10
      app/src/main/res/values/styles.xml
  4. 1
      app/src/main/res/values/themes.xml

21
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) {}
}
}

6
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">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/commentText"
@ -41,7 +42,8 @@
android:inputType="textMultiLine"
android:maxLength="2200"
android:maxLines="10"
android:scrollHorizontally="false" />
android:scrollHorizontally="false"
tools:text="test" />
</com.google.android.material.textfield.TextInputLayout>
</androidx.appcompat.widget.LinearLayoutCompat>

10
app/src/main/res/values/styles.xml

@ -260,4 +260,14 @@
<style name="ThemeOverlay.MaterialComponents.TextInputEditText.OutlinedBox.Light.Barinsta" parent="ThemeOverlay.MaterialComponents.TextInputEditText.OutlinedBox">
<item name="colorPrimary">@color/white</item>
</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>

1
app/src/main/res/values/themes.xml

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

Loading…
Cancel
Save