From fbc00b1cb9d2d813a0ea07123850633b0392b86d Mon Sep 17 00:00:00 2001
From: Docile-Alligator <25734209+Docile-Alligator@users.noreply.github.com>
Date: Tue, 10 Sep 2024 15:08:13 -0400
Subject: New UI design in CreateMultiRedditActivity.
---
.../activities/CreateMultiRedditActivity.java | 53 +++++---
.../res/layout/activity_create_multi_reddit.xml | 134 ++++++++++++++++-----
app/src/main/res/values/strings.xml | 1 +
3 files changed, 138 insertions(+), 50 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);
}
}
}
diff --git a/app/src/main/res/layout/activity_create_multi_reddit.xml b/app/src/main/res/layout/activity_create_multi_reddit.xml
index e1b3a3e1..de9a8145 100644
--- a/app/src/main/res/layout/activity_create_multi_reddit.xml
+++ b/app/src/main/res/layout/activity_create_multi_reddit.xml
@@ -43,46 +43,116 @@
android:layout_height="wrap_content"
android:orientation="vertical">
-
-
-
+ android:layout_marginTop="16dp"
+ android:layout_marginStart="16dp"
+ android:layout_marginEnd="16dp"
+ app:cardCornerRadius="12dp">
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ app:chipSpacingHorizontal="16dp">
-
+
-
+
+
+
+
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index ee33c49d..07952129 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -736,6 +736,7 @@
Device Default
Set by Battery Saver
+ The name should be unique.
Name (Max 50 Characters)
Description
Private
--
cgit v1.2.3