aboutsummaryrefslogtreecommitdiff
path: root/app/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/CreateMultiRedditActivity.java53
-rw-r--r--app/src/main/res/layout/activity_create_multi_reddit.xml134
-rw-r--r--app/src/main/res/values/strings.xml1
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">
- <EditText
- android:id="@+id/multi_reddit_name_edit_text_create_multi_reddit_activity"
+ <com.google.android.material.card.MaterialCardView
+ android:id="@+id/input_card_view_create_multi_reddit_activity"
+ style="?attr/materialCardViewFilledStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:padding="16dp"
- android:hint="@string/multi_reddit_name_hint"
- android:inputType="textMultiLine"
- android:textSize="?attr/font_default"
- android:background="#00000000"
- android:textColor="?attr/primaryTextColor"
- android:fontFamily="?attr/font_family"
- android:maxLength="50" />
-
- <View
- android:id="@+id/divider_1_create_multi_reddit_activity"
- android:layout_width="match_parent"
- android:layout_height="1dp" />
+ android:layout_marginTop="16dp"
+ android:layout_marginStart="16dp"
+ android:layout_marginEnd="16dp"
+ app:cardCornerRadius="12dp">
- <EditText
- android:id="@+id/description_edit_text_create_multi_reddit_activity"
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
+
+ <TextView
+ android:id="@+id/multi_reddit_name_explanation_text_input_layout_create_multi_reddit_activity"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingTop="16dp"
+ android:paddingBottom="8dp"
+ android:paddingStart="16dp"
+ android:paddingEnd="16dp"
+ android:text="@string/multi_reddit_name_explanation"
+ android:textSize="?attr/font_default"
+ android:textColor="?attr/primaryTextColor"
+ android:fontFamily="?attr/font_family" />
+
+ <com.google.android.material.textfield.TextInputLayout
+ android:id="@+id/multi_reddit_name_text_input_layout_create_multi_reddit_activity"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingTop="8dp"
+ android:paddingBottom="8dp"
+ android:paddingStart="16dp"
+ android:paddingEnd="16dp"
+ style="@style/Widget.Material3.TextInputLayout.OutlinedBox">
+
+ <com.google.android.material.textfield.TextInputEditText
+ android:id="@+id/multi_reddit_name_edit_text_create_multi_reddit_activity"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:padding="16dp"
+ android:hint="@string/multi_reddit_name_hint"
+ android:inputType="textMultiLine"
+ android:textSize="?attr/font_default"
+ android:fontFamily="?attr/font_family"
+ android:maxLength="50" />
+
+ </com.google.android.material.textfield.TextInputLayout>
+
+ <com.google.android.material.textfield.TextInputLayout
+ android:id="@+id/description_text_input_layout_create_multi_reddit_activity"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingTop="8dp"
+ android:paddingBottom="16dp"
+ android:paddingStart="16dp"
+ android:paddingEnd="16dp"
+ style="@style/Widget.Material3.TextInputLayout.OutlinedBox">
+
+ <com.google.android.material.textfield.TextInputEditText
+ android:id="@+id/description_edit_text_create_multi_reddit_activity"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:padding="16dp"
+ android:hint="@string/multi_reddit_description_hint"
+ android:inputType="textMultiLine"
+ android:textSize="?attr/font_default"
+ android:fontFamily="?attr/font_family" />
+
+ </com.google.android.material.textfield.TextInputLayout>
+
+ </LinearLayout>
+
+ </com.google.android.material.card.MaterialCardView>
+
+ <com.google.android.material.chip.ChipGroup
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp"
- android:hint="@string/multi_reddit_description_hint"
- android:inputType="textMultiLine"
- android:textSize="?attr/font_default"
- android:background="#00000000"
- android:textColor="?attr/primaryTextColor"
- android:fontFamily="?attr/font_family" />
+ app:chipSpacingHorizontal="16dp">
- <View
- android:id="@+id/divider_2_create_multi_reddit_activity"
- android:layout_width="match_parent"
- android:layout_height="1dp"/>
+ <com.google.android.material.chip.Chip
+ android:id="@+id/select_subreddit_chip_create_multi_reddit_activity"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/select_subreddits_and_users"
+ android:textSize="?attr/font_default"
+ android:fontFamily="?attr/font_family"
+ style="@style/Widget.Material3.Chip.Assist" />
- <LinearLayout
+ <com.google.android.material.chip.Chip
+ android:id="@+id/visibility_chip_create_multi_reddit_activity"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/private_multi_reddit"
+ android:textSize="?attr/font_default"
+ android:fontFamily="?attr/font_family"
+ android:checked="true"
+ style="@style/Widget.Material3.Chip.Filter" />
+
+ </com.google.android.material.chip.ChipGroup>
+
+ <!--<LinearLayout
android:id="@+id/visibility_wrapper_linear_layout_create_multi_reddit_activity"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:padding="16dp"
+ android:paddingStart="16dp"
+ android:paddingEnd="16dp"
android:clickable="true"
android:focusable="true"
android:background="?attr/selectableItemBackground">
@@ -94,10 +164,9 @@
android:layout_weight="1"
android:text="@string/private_multi_reddit"
android:textSize="?attr/font_default"
- android:textColor="?attr/primaryTextColor"
android:fontFamily="?attr/font_family" />
- <Switch
+ <com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/visibility_switch_create_multi_reddit_activity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@@ -112,11 +181,10 @@
android:padding="16dp"
android:text="@string/select_subreddits_and_users"
android:textSize="?attr/font_default"
- android:textColor="?attr/primaryTextColor"
android:fontFamily="?attr/font_family"
android:clickable="true"
android:focusable="true"
- android:background="?attr/selectableItemBackground" />
+ android:background="?attr/selectableItemBackground" />-->
</LinearLayout>
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 @@
<string name="device_default">Device Default</string>
<string name="set_by_battery_saver">Set by Battery Saver</string>
+ <string name="multi_reddit_name_explanation">The name should be unique.</string>
<string name="multi_reddit_name_hint">Name (Max 50 Characters)</string>
<string name="multi_reddit_description_hint">Description</string>
<string name="private_multi_reddit">Private</string>