diff options
Diffstat (limited to 'app/src/main/java/ml/docilealligator/infinityforreddit')
-rw-r--r-- | app/src/main/java/ml/docilealligator/infinityforreddit/activities/CreateMultiRedditActivity.java | 53 |
1 files changed, 36 insertions, 17 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CreateMultiRedditActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CreateMultiRedditActivity.java index 6e398871..fb9b1a47 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CreateMultiRedditActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CreateMultiRedditActivity.java @@ -2,12 +2,14 @@ package ml.docilealligator.infinityforreddit.activities; import android.content.Intent; import android.content.SharedPreferences; +import android.content.res.ColorStateList; import android.os.Build; import android.os.Bundle; import android.os.Handler; import android.view.Menu; import android.view.MenuItem; import android.view.View; +import android.widget.CompoundButton; import androidx.annotation.NonNull; import androidx.annotation.Nullable; @@ -26,11 +28,9 @@ import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; import ml.docilealligator.infinityforreddit.account.Account; import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; -import ml.docilealligator.infinityforreddit.customviews.slidr.Slidr; import ml.docilealligator.infinityforreddit.databinding.ActivityCreateMultiRedditBinding; import ml.docilealligator.infinityforreddit.multireddit.CreateMultiReddit; import ml.docilealligator.infinityforreddit.multireddit.MultiRedditJSONModel; -import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils; import ml.docilealligator.infinityforreddit.utils.Utils; import retrofit2.Retrofit; @@ -68,10 +68,6 @@ public class CreateMultiRedditActivity extends BaseActivity { applyCustomTheme(); - if (mSharedPreferences.getBoolean(SharedPreferencesUtils.SWIPE_RIGHT_TO_GO_BACK, true)) { - Slidr.attach(this); - } - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && isChangeStatusBarIconColor()) { addOnOffsetChangedListener(binding.appbarLayoutCreateMultiRedditActivity); } @@ -80,7 +76,7 @@ public class CreateMultiRedditActivity extends BaseActivity { getSupportActionBar().setDisplayHomeAsUpEnabled(true); if (accountName.equals(Account.ANONYMOUS_ACCOUNT)) { - binding.visibilityWrapperLinearLayoutCreateMultiRedditActivity.setVisibility(View.GONE); + binding.visibilityChipCreateMultiRedditActivity.setVisibility(View.GONE); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { binding.multiRedditNameEditTextCreateMultiRedditActivity.setImeOptions(binding.multiRedditNameEditTextCreateMultiRedditActivity.getImeOptions() | EditorInfoCompat.IME_FLAG_NO_PERSONALIZED_LEARNING); binding.descriptionEditTextCreateMultiRedditActivity.setImeOptions(binding.descriptionEditTextCreateMultiRedditActivity.getImeOptions() | EditorInfoCompat.IME_FLAG_NO_PERSONALIZED_LEARNING); @@ -96,11 +92,23 @@ public class CreateMultiRedditActivity extends BaseActivity { } private void bindView() { - binding.selectSubredditTextViewCreateMultiRedditActivity.setOnClickListener(view -> { + binding.selectSubredditChipCreateMultiRedditActivity.setOnClickListener(view -> { Intent intent = new Intent(CreateMultiRedditActivity.this, SelectedSubredditsAndUsersActivity.class); intent.putStringArrayListExtra(SelectedSubredditsAndUsersActivity.EXTRA_SELECTED_SUBREDDITS, mSubreddits); startActivityForResult(intent, SUBREDDIT_SELECTION_REQUEST_CODE); }); + + binding.visibilityChipCreateMultiRedditActivity.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { + if (isChecked) { + binding.visibilityChipCreateMultiRedditActivity.setChipBackgroundColor(ColorStateList.valueOf(mCustomThemeWrapper.getFilledCardViewBackgroundColor())); + } else { + //Match the background color + binding.visibilityChipCreateMultiRedditActivity.setChipBackgroundColor(ColorStateList.valueOf(mCustomThemeWrapper.getBackgroundColor())); + } + } + }); } @Override @@ -124,7 +132,7 @@ public class CreateMultiRedditActivity extends BaseActivity { if (!accountName.equals(Account.ANONYMOUS_ACCOUNT)) { String jsonModel = new MultiRedditJSONModel(binding.multiRedditNameEditTextCreateMultiRedditActivity.getText().toString(), binding.descriptionEditTextCreateMultiRedditActivity.getText().toString(), - binding.visibilitySwitchCreateMultiRedditActivity.isChecked(), mSubreddits).createJSONModel(); + binding.visibilityChipCreateMultiRedditActivity.isChecked(), mSubreddits).createJSONModel(); CreateMultiReddit.createMultiReddit(mOauthRetrofit, mRedditDataRoomDatabase, accessToken, "/user/" + accountName + "/m/" + binding.multiRedditNameEditTextCreateMultiRedditActivity.getText().toString(), jsonModel, new CreateMultiReddit.CreateMultiRedditListener() { @@ -200,19 +208,30 @@ public class CreateMultiRedditActivity extends BaseActivity { applyAppBarLayoutAndCollapsingToolbarLayoutAndToolbarTheme(binding.appbarLayoutCreateMultiRedditActivity, binding.collapsingToolbarLayoutCreateMultiRedditActivity, binding.toolbarCreateMultiRedditActivity); int primaryTextColor = mCustomThemeWrapper.getPrimaryTextColor(); - int secondaryTextColor = mCustomThemeWrapper.getSecondaryTextColor(); + binding.inputCardViewCreateMultiRedditActivity.setCardBackgroundColor(mCustomThemeWrapper.getFilledCardViewBackgroundColor()); + + binding.multiRedditNameExplanationTextInputLayoutCreateMultiRedditActivity.setTextColor(primaryTextColor); + binding.multiRedditNameTextInputLayoutCreateMultiRedditActivity.setBoxStrokeColor(primaryTextColor); + binding.multiRedditNameTextInputLayoutCreateMultiRedditActivity.setDefaultHintTextColor(ColorStateList.valueOf(primaryTextColor)); binding.multiRedditNameEditTextCreateMultiRedditActivity.setTextColor(primaryTextColor); - binding.multiRedditNameEditTextCreateMultiRedditActivity.setHintTextColor(secondaryTextColor); - int dividerColor = mCustomThemeWrapper.getDividerColor(); - binding.divider1CreateMultiRedditActivity.setBackgroundColor(dividerColor); - binding.divider2CreateMultiRedditActivity.setBackgroundColor(dividerColor); + + binding.descriptionTextInputLayoutCreateMultiRedditActivity.setBoxStrokeColor(primaryTextColor); + binding.descriptionTextInputLayoutCreateMultiRedditActivity.setDefaultHintTextColor(ColorStateList.valueOf(primaryTextColor)); binding.descriptionEditTextCreateMultiRedditActivity.setTextColor(primaryTextColor); - binding.descriptionEditTextCreateMultiRedditActivity.setHintTextColor(secondaryTextColor); - binding.visibilityTextViewCreateMultiRedditActivity.setTextColor(primaryTextColor); - binding.selectSubredditTextViewCreateMultiRedditActivity.setTextColor(primaryTextColor); + + + binding.selectSubredditChipCreateMultiRedditActivity.setTextColor(primaryTextColor); + binding.selectSubredditChipCreateMultiRedditActivity.setChipBackgroundColor(ColorStateList.valueOf(mCustomThemeWrapper.getFilledCardViewBackgroundColor())); + binding.selectSubredditChipCreateMultiRedditActivity.setChipStrokeColor(ColorStateList.valueOf(mCustomThemeWrapper.getFilledCardViewBackgroundColor())); + + binding.visibilityChipCreateMultiRedditActivity.setTextColor(primaryTextColor); + binding.visibilityChipCreateMultiRedditActivity.setChipBackgroundColor(ColorStateList.valueOf(mCustomThemeWrapper.getFilledCardViewBackgroundColor())); + binding.visibilityChipCreateMultiRedditActivity.setChipStrokeColor(ColorStateList.valueOf(mCustomThemeWrapper.getFilledCardViewBackgroundColor())); if (typeface != null) { Utils.setFontToAllTextViews(binding.coordinatorLayoutCreateMultiRedditActivity, typeface); + binding.selectSubredditChipCreateMultiRedditActivity.setTypeface(typeface); + binding.visibilityChipCreateMultiRedditActivity.setTypeface(typeface); } } } |