Use MaterialButton in PostXXXActivity.

This commit is contained in:
Alex Ning 2021-07-14 22:54:20 +08:00
parent 04624a1f13
commit 212a91d73b
8 changed files with 18 additions and 21 deletions

View File

@ -2,7 +2,6 @@ package ml.docilealligator.infinityforreddit.activities;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.res.ColorStateList;
import android.content.res.Resources; import android.content.res.Resources;
import android.net.Uri; import android.net.Uri;
import android.os.Build; import android.os.Build;
@ -13,7 +12,6 @@ import android.provider.MediaStore;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.widget.Button;
import android.widget.EditText; import android.widget.EditText;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
@ -31,6 +29,7 @@ import com.bumptech.glide.Glide;
import com.bumptech.glide.RequestManager; import com.bumptech.glide.RequestManager;
import com.bumptech.glide.request.RequestOptions; import com.bumptech.glide.request.RequestOptions;
import com.google.android.material.appbar.AppBarLayout; import com.google.android.material.appbar.AppBarLayout;
import com.google.android.material.button.MaterialButton;
import com.google.android.material.dialog.MaterialAlertDialogBuilder; import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.google.android.material.floatingactionbutton.FloatingActionButton; import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.snackbar.Snackbar; import com.google.android.material.snackbar.Snackbar;
@ -95,7 +94,7 @@ public class PostImageActivity extends BaseActivity implements FlairBottomSheetF
@BindView(R.id.subreddit_name_text_view_post_image_activity) @BindView(R.id.subreddit_name_text_view_post_image_activity)
TextView subredditNameTextView; TextView subredditNameTextView;
@BindView(R.id.rules_button_post_image_activity) @BindView(R.id.rules_button_post_image_activity)
Button rulesButton; MaterialButton rulesButton;
@BindView(R.id.divider_1_post_image_activity) @BindView(R.id.divider_1_post_image_activity)
View divider1; View divider1;
@BindView(R.id.flair_custom_text_view_post_image_activity) @BindView(R.id.flair_custom_text_view_post_image_activity)
@ -394,7 +393,7 @@ public class PostImageActivity extends BaseActivity implements FlairBottomSheetF
int secondaryTextColor = mCustomThemeWrapper.getSecondaryTextColor(); int secondaryTextColor = mCustomThemeWrapper.getSecondaryTextColor();
subredditNameTextView.setTextColor(secondaryTextColor); subredditNameTextView.setTextColor(secondaryTextColor);
rulesButton.setTextColor(mCustomThemeWrapper.getButtonTextColor()); rulesButton.setTextColor(mCustomThemeWrapper.getButtonTextColor());
rulesButton.setBackgroundTintList(ColorStateList.valueOf(mCustomThemeWrapper.getColorPrimaryLightTheme())); rulesButton.setBackgroundColor(mCustomThemeWrapper.getColorPrimaryLightTheme());
primaryTextColor = mCustomThemeWrapper.getPrimaryTextColor(); primaryTextColor = mCustomThemeWrapper.getPrimaryTextColor();
receivePostReplyNotificationsTextView.setTextColor(primaryTextColor); receivePostReplyNotificationsTextView.setTextColor(primaryTextColor);
int dividerColor = mCustomThemeWrapper.getDividerColor(); int dividerColor = mCustomThemeWrapper.getDividerColor();

View File

@ -2,7 +2,6 @@ package ml.docilealligator.infinityforreddit.activities;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.res.ColorStateList;
import android.content.res.Resources; import android.content.res.Resources;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
@ -10,7 +9,6 @@ import android.os.Handler;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.widget.Button;
import android.widget.EditText; import android.widget.EditText;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
@ -91,7 +89,7 @@ public class PostLinkActivity extends BaseActivity implements FlairBottomSheetFr
@BindView(R.id.subreddit_name_text_view_post_link_activity) @BindView(R.id.subreddit_name_text_view_post_link_activity)
TextView subredditNameTextView; TextView subredditNameTextView;
@BindView(R.id.rules_button_post_link_activity) @BindView(R.id.rules_button_post_link_activity)
Button rulesButton; MaterialButton rulesButton;
@BindView(R.id.divider_1_post_link_activity) @BindView(R.id.divider_1_post_link_activity)
View divider1; View divider1;
@BindView(R.id.divider_2_post_link_activity) @BindView(R.id.divider_2_post_link_activity)
@ -368,7 +366,7 @@ public class PostLinkActivity extends BaseActivity implements FlairBottomSheetFr
int secondaryTextColor = mCustomThemeWrapper.getSecondaryTextColor(); int secondaryTextColor = mCustomThemeWrapper.getSecondaryTextColor();
subredditNameTextView.setTextColor(secondaryTextColor); subredditNameTextView.setTextColor(secondaryTextColor);
rulesButton.setTextColor(mCustomThemeWrapper.getButtonTextColor()); rulesButton.setTextColor(mCustomThemeWrapper.getButtonTextColor());
rulesButton.setBackgroundTintList(ColorStateList.valueOf(mCustomThemeWrapper.getColorPrimaryLightTheme())); rulesButton.setBackgroundColor(mCustomThemeWrapper.getColorPrimaryLightTheme());
primaryTextColor = mCustomThemeWrapper.getPrimaryTextColor(); primaryTextColor = mCustomThemeWrapper.getPrimaryTextColor();
receivePostReplyNotificationsTextView.setTextColor(primaryTextColor); receivePostReplyNotificationsTextView.setTextColor(primaryTextColor);
int dividerColor = mCustomThemeWrapper.getDividerColor(); int dividerColor = mCustomThemeWrapper.getDividerColor();

View File

@ -3,7 +3,6 @@ package ml.docilealligator.infinityforreddit.activities;
import android.content.ActivityNotFoundException; import android.content.ActivityNotFoundException;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.res.ColorStateList;
import android.content.res.Resources; import android.content.res.Resources;
import android.net.Uri; import android.net.Uri;
import android.os.Build; import android.os.Build;
@ -14,7 +13,6 @@ import android.provider.MediaStore;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.widget.Button;
import android.widget.EditText; import android.widget.EditText;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
@ -33,6 +31,7 @@ import com.bumptech.glide.Glide;
import com.bumptech.glide.RequestManager; import com.bumptech.glide.RequestManager;
import com.bumptech.glide.request.RequestOptions; import com.bumptech.glide.request.RequestOptions;
import com.google.android.material.appbar.AppBarLayout; import com.google.android.material.appbar.AppBarLayout;
import com.google.android.material.button.MaterialButton;
import com.google.android.material.dialog.MaterialAlertDialogBuilder; import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.google.android.material.snackbar.Snackbar; import com.google.android.material.snackbar.Snackbar;
import com.google.android.material.switchmaterial.SwitchMaterial; import com.google.android.material.switchmaterial.SwitchMaterial;
@ -104,7 +103,7 @@ public class PostTextActivity extends BaseActivity implements FlairBottomSheetFr
@BindView(R.id.subreddit_name_text_view_post_text_activity) @BindView(R.id.subreddit_name_text_view_post_text_activity)
TextView subredditNameTextView; TextView subredditNameTextView;
@BindView(R.id.rules_button_post_text_activity) @BindView(R.id.rules_button_post_text_activity)
Button rulesButton; MaterialButton rulesButton;
@BindView(R.id.divider_1_post_text_activity) @BindView(R.id.divider_1_post_text_activity)
View divider1; View divider1;
@BindView(R.id.flair_custom_text_view_post_text_activity) @BindView(R.id.flair_custom_text_view_post_text_activity)
@ -389,7 +388,7 @@ public class PostTextActivity extends BaseActivity implements FlairBottomSheetFr
int secondaryTextColor = mCustomThemeWrapper.getSecondaryTextColor(); int secondaryTextColor = mCustomThemeWrapper.getSecondaryTextColor();
subredditNameTextView.setTextColor(secondaryTextColor); subredditNameTextView.setTextColor(secondaryTextColor);
rulesButton.setTextColor(mCustomThemeWrapper.getButtonTextColor()); rulesButton.setTextColor(mCustomThemeWrapper.getButtonTextColor());
rulesButton.setBackgroundTintList(ColorStateList.valueOf(mCustomThemeWrapper.getColorPrimaryLightTheme())); rulesButton.setBackgroundColor(mCustomThemeWrapper.getColorPrimaryLightTheme());
primaryTextColor = mCustomThemeWrapper.getPrimaryTextColor(); primaryTextColor = mCustomThemeWrapper.getPrimaryTextColor();
receivePostReplyNotificationsTextView.setTextColor(primaryTextColor); receivePostReplyNotificationsTextView.setTextColor(primaryTextColor);
int dividerColor = mCustomThemeWrapper.getDividerColor(); int dividerColor = mCustomThemeWrapper.getDividerColor();

View File

@ -2,7 +2,6 @@ package ml.docilealligator.infinityforreddit.activities;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.res.ColorStateList;
import android.content.res.Resources; import android.content.res.Resources;
import android.net.Uri; import android.net.Uri;
import android.os.Build; import android.os.Build;
@ -12,7 +11,6 @@ import android.provider.MediaStore;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.widget.Button;
import android.widget.EditText; import android.widget.EditText;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
@ -36,6 +34,7 @@ import com.google.android.exoplayer2.upstream.DataSource;
import com.google.android.exoplayer2.upstream.DefaultDataSourceFactory; import com.google.android.exoplayer2.upstream.DefaultDataSourceFactory;
import com.google.android.exoplayer2.util.Util; import com.google.android.exoplayer2.util.Util;
import com.google.android.material.appbar.AppBarLayout; import com.google.android.material.appbar.AppBarLayout;
import com.google.android.material.button.MaterialButton;
import com.google.android.material.dialog.MaterialAlertDialogBuilder; import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.google.android.material.floatingactionbutton.FloatingActionButton; import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.snackbar.Snackbar; import com.google.android.material.snackbar.Snackbar;
@ -97,7 +96,7 @@ public class PostVideoActivity extends BaseActivity implements FlairBottomSheetF
@BindView(R.id.subreddit_name_text_view_post_video_activity) @BindView(R.id.subreddit_name_text_view_post_video_activity)
TextView subredditNameTextView; TextView subredditNameTextView;
@BindView(R.id.rules_button_post_video_activity) @BindView(R.id.rules_button_post_video_activity)
Button rulesButton; MaterialButton rulesButton;
@BindView(R.id.divider_1_post_video_activity) @BindView(R.id.divider_1_post_video_activity)
View divider1; View divider1;
@BindView(R.id.flair_custom_text_view_post_video_activity) @BindView(R.id.flair_custom_text_view_post_video_activity)
@ -400,7 +399,7 @@ public class PostVideoActivity extends BaseActivity implements FlairBottomSheetF
int secondaryTextColor = mCustomThemeWrapper.getSecondaryTextColor(); int secondaryTextColor = mCustomThemeWrapper.getSecondaryTextColor();
subredditNameTextView.setTextColor(secondaryTextColor); subredditNameTextView.setTextColor(secondaryTextColor);
rulesButton.setTextColor(mCustomThemeWrapper.getButtonTextColor()); rulesButton.setTextColor(mCustomThemeWrapper.getButtonTextColor());
rulesButton.setBackgroundTintList(ColorStateList.valueOf(mCustomThemeWrapper.getColorPrimaryLightTheme())); rulesButton.setBackgroundColor(mCustomThemeWrapper.getColorPrimaryLightTheme());
primaryTextColor = mCustomThemeWrapper.getPrimaryTextColor(); primaryTextColor = mCustomThemeWrapper.getPrimaryTextColor();
receivePostReplyNotificationsTextView.setTextColor(primaryTextColor); receivePostReplyNotificationsTextView.setTextColor(primaryTextColor);
int dividerColor = mCustomThemeWrapper.getDividerColor(); int dividerColor = mCustomThemeWrapper.getDividerColor();

View File

@ -61,7 +61,7 @@
android:textSize="?attr/font_default" android:textSize="?attr/font_default"
android:fontFamily="?attr/font_family" /> android:fontFamily="?attr/font_family" />
<Button <com.google.android.material.button.MaterialButton
android:id="@+id/rules_button_post_image_activity" android:id="@+id/rules_button_post_image_activity"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View File

@ -61,7 +61,7 @@
android:textSize="?attr/font_default" android:textSize="?attr/font_default"
android:fontFamily="?attr/font_family" /> android:fontFamily="?attr/font_family" />
<Button <com.google.android.material.button.MaterialButton
android:id="@+id/rules_button_post_link_activity" android:id="@+id/rules_button_post_link_activity"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -195,7 +195,9 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:text="@string/suggest_title" /> android:text="@string/suggest_title"
android:textSize="?attr/font_default"
android:fontFamily="?attr/font_family" />
</LinearLayout> </LinearLayout>

View File

@ -67,7 +67,7 @@
android:textSize="?attr/font_default" android:textSize="?attr/font_default"
android:fontFamily="?attr/font_family" /> android:fontFamily="?attr/font_family" />
<Button <com.google.android.material.button.MaterialButton
android:id="@+id/rules_button_post_text_activity" android:id="@+id/rules_button_post_text_activity"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View File

@ -61,7 +61,7 @@
android:textSize="?attr/font_default" android:textSize="?attr/font_default"
android:fontFamily="?attr/font_family" /> android:fontFamily="?attr/font_family" />
<Button <com.google.android.material.button.MaterialButton
android:id="@+id/rules_button_post_video_activity" android:id="@+id/rules_button_post_video_activity"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"