Editing flair is now available.

This commit is contained in:
Alex Ning 2019-08-14 13:53:08 +08:00
parent a62f47aacb
commit eaef58037c
15 changed files with 149 additions and 48 deletions

View File

@ -35,9 +35,9 @@
<map> <map>
<entry key="assetSourceType" value="FILE" /> <entry key="assetSourceType" value="FILE" />
<entry key="color" value="ffffff" /> <entry key="color" value="ffffff" />
<entry key="outputName" value="ic_outline_more_vert_24px" /> <entry key="outputName" value="ic_outline_edit_24px" />
<entry key="overrideSize" value="true" /> <entry key="overrideSize" value="true" />
<entry key="sourceFile" value="$USER_HOME$/Downloads/outline-more_vert-24px.svg" /> <entry key="sourceFile" value="$USER_HOME$/Downloads/outline-edit-24px.svg" />
</map> </map>
</option> </option>
</PersistentState> </PersistentState>

Binary file not shown.

Binary file not shown.

View File

@ -34,7 +34,7 @@ repositories {
dependencies { dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs') implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.appcompat:appcompat:1.1.0-rc01' implementation 'androidx.appcompat:appcompat:1.1.0-rc01'
implementation 'com.google.android.material:material:1.1.0-alpha08' implementation 'com.google.android.material:material:1.1.0-alpha09'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3' implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.legacy:legacy-support-v4:1.0.0' implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.legacy:legacy-support-v13:1.0.0' implementation 'androidx.legacy:legacy-support-v13:1.0.0'

View File

@ -2,8 +2,6 @@ package ml.docilealligator.infinityforreddit;
import android.app.Activity; import android.app.Activity;
import android.content.res.Configuration;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
@ -47,7 +45,7 @@ public class FlairBottomSheetFragment extends BottomSheetDialogFragment {
private String mAccessToken; private String mAccessToken;
private String mSubredditName; private String mSubredditName;
private Activity mAcitivity; private Activity mActivity;
private FlairBottomSheetRecyclerViewAdapter mAdapter; private FlairBottomSheetRecyclerViewAdapter mAdapter;
@Inject @Inject
@ -70,17 +68,17 @@ public class FlairBottomSheetFragment extends BottomSheetDialogFragment {
ButterKnife.bind(this, rootView); ButterKnife.bind(this, rootView);
mAcitivity = getActivity(); mActivity = getActivity();
((Infinity) mAcitivity.getApplication()).getAppComponent().inject(this); ((Infinity) mActivity.getApplication()).getAppComponent().inject(this);
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O /*if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O
&& (getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) != Configuration.UI_MODE_NIGHT_YES) { && (getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) != Configuration.UI_MODE_NIGHT_YES) {
rootView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR); rootView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
} }*/
mAdapter = new FlairBottomSheetRecyclerViewAdapter(flair -> { mAdapter = new FlairBottomSheetRecyclerViewAdapter(mActivity, flair -> {
((FlairSelectionCallback) mAcitivity).flairSelected(flair); ((FlairSelectionCallback) mActivity).flairSelected(flair);
dismiss(); dismiss();
}); });

View File

@ -1,13 +1,20 @@
package ml.docilealligator.infinityforreddit; package ml.docilealligator.infinityforreddit;
import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import java.util.ArrayList; import java.util.ArrayList;
import butterknife.BindView; import butterknife.BindView;
@ -18,10 +25,12 @@ class FlairBottomSheetRecyclerViewAdapter extends RecyclerView.Adapter<FlairBott
void onClick(Flair flair); void onClick(Flair flair);
} }
private Context context;
private ArrayList<Flair> flairs; private ArrayList<Flair> flairs;
private ItemClickListener itemClickListener; private ItemClickListener itemClickListener;
FlairBottomSheetRecyclerViewAdapter(ItemClickListener itemClickListener) { FlairBottomSheetRecyclerViewAdapter(Context context, ItemClickListener itemClickListener) {
this.context = context;
this.itemClickListener = itemClickListener; this.itemClickListener = itemClickListener;
} }
@ -33,6 +42,36 @@ class FlairBottomSheetRecyclerViewAdapter extends RecyclerView.Adapter<FlairBott
@Override @Override
public void onBindViewHolder(@NonNull FlairViewHolder holder, int position) { public void onBindViewHolder(@NonNull FlairViewHolder holder, int position) {
if(flairs.get(holder.getAdapterPosition()).isEditable()) {
holder.editFlairImageView.setVisibility(View.VISIBLE);
holder.editFlairImageView.setOnClickListener(view -> {
View dialogView = ((Activity) context).getLayoutInflater().inflate(R.layout.dialog_edit_flair, null);
EditText flairEditText = dialogView.findViewById(R.id.flair_edit_text_edit_flair_dialog);
flairEditText.requestFocus();
InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
if(imm != null) {
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);
}
new MaterialAlertDialogBuilder(context, R.style.MaterialAlertDialogTheme)
.setTitle(R.string.edit_flair)
.setView(dialogView)
.setPositiveButton(R.string.ok, (dialogInterface, i)
-> {
Flair flair = flairs.get(holder.getAdapterPosition());
flair.setText(flairEditText.getText().toString());
itemClickListener.onClick(flair);
})
.setNegativeButton(R.string.cancel, null)
.show();
});
}
if(flairs.get(holder.getAdapterPosition()).isEditable() && flairs.get(holder.getAdapterPosition()).getText().equals("")) {
holder.itemView.setOnClickListener(view -> holder.editFlairImageView.performClick());
} else {
holder.itemView.setOnClickListener(view -> itemClickListener.onClick(flairs.get(holder.getAdapterPosition())));
}
holder.flairTextView.setText(flairs.get(holder.getAdapterPosition()).getText()); holder.flairTextView.setText(flairs.get(holder.getAdapterPosition()).getText());
} }
@ -41,19 +80,26 @@ class FlairBottomSheetRecyclerViewAdapter extends RecyclerView.Adapter<FlairBott
return flairs == null ? 0 : flairs.size(); return flairs == null ? 0 : flairs.size();
} }
@Override
public void onViewRecycled(@NonNull FlairViewHolder holder) {
super.onViewRecycled(holder);
holder.editFlairImageView.setVisibility(View.GONE);
}
void changeDataset(ArrayList<Flair> flairs) { void changeDataset(ArrayList<Flair> flairs) {
this.flairs = flairs; this.flairs = flairs;
notifyDataSetChanged(); notifyDataSetChanged();
} }
class FlairViewHolder extends RecyclerView.ViewHolder { class FlairViewHolder extends RecyclerView.ViewHolder {
View itemView;
@BindView(R.id.flair_text_view_item_flair) TextView flairTextView; @BindView(R.id.flair_text_view_item_flair) TextView flairTextView;
@BindView(R.id.edit_flair_image_view_item_flair) ImageView editFlairImageView;
FlairViewHolder(@NonNull View itemView) { FlairViewHolder(@NonNull View itemView) {
super(itemView); super(itemView);
ButterKnife.bind(this, itemView); ButterKnife.bind(this, itemView);
this.itemView = itemView;
flairTextView.setOnClickListener(view -> itemClickListener.onClick(flairs.get(getAdapterPosition())));
} }
} }
} }

View File

@ -72,7 +72,7 @@ public class PostImageActivity extends AppCompatActivity implements FlairBottomS
@BindView(R.id.coordinator_layout_post_image_activity) CoordinatorLayout coordinatorLayout; @BindView(R.id.coordinator_layout_post_image_activity) CoordinatorLayout coordinatorLayout;
@BindView(R.id.toolbar_post_image_activity) Toolbar toolbar; @BindView(R.id.toolbar_post_image_activity) Toolbar toolbar;
@BindView(R.id.subreddit_icon_gif_image_view_post_image_activity) GifImageView iconGifImageView; @BindView(R.id.subreddit_icon_gif_image_view_post_image_activity) GifImageView iconGifImageView;
@BindView(R.id.subreddit_name_text_view_post_image_activity) TextView subreditNameTextView; @BindView(R.id.subreddit_name_text_view_post_image_activity) TextView subredditNameTextView;
@BindView(R.id.rules_button_post_image_activity) Button rulesButton; @BindView(R.id.rules_button_post_image_activity) Button rulesButton;
@BindView(R.id.flair_custom_text_view_post_image_activity) CustomTextView flairTextView; @BindView(R.id.flair_custom_text_view_post_image_activity) CustomTextView flairTextView;
@BindView(R.id.spoiler_custom_text_view_post_image_activity) CustomTextView spoilerTextView; @BindView(R.id.spoiler_custom_text_view_post_image_activity) CustomTextView spoilerTextView;
@ -168,7 +168,8 @@ public class PostImageActivity extends AppCompatActivity implements FlairBottomS
} }
if(subredditName != null) { if(subredditName != null) {
subreditNameTextView.setText(subredditName); subredditNameTextView.setTextColor(getResources().getColor(R.color.primaryTextColor));
subredditNameTextView.setText(subredditName);
flairTextView.setVisibility(View.VISIBLE); flairTextView.setVisibility(View.VISIBLE);
if(!loadSubredditIconSuccessful) { if(!loadSubredditIconSuccessful) {
loadSubredditIcon(); loadSubredditIcon();
@ -198,7 +199,8 @@ public class PostImageActivity extends AppCompatActivity implements FlairBottomS
if(getIntent().hasExtra(EXTRA_SUBREDDIT_NAME)) { if(getIntent().hasExtra(EXTRA_SUBREDDIT_NAME)) {
subredditName = getIntent().getExtras().getString(EXTRA_SUBREDDIT_NAME); subredditName = getIntent().getExtras().getString(EXTRA_SUBREDDIT_NAME);
subreditNameTextView.setText(subredditName); subredditNameTextView.setTextColor(getResources().getColor(R.color.primaryTextColor));
subredditNameTextView.setText(subredditName);
loadSubredditIcon(); loadSubredditIcon();
} else { } else {
mGlide.load(R.drawable.subreddit_default_icon) mGlide.load(R.drawable.subreddit_default_icon)
@ -212,7 +214,7 @@ public class PostImageActivity extends AppCompatActivity implements FlairBottomS
startActivityForResult(intent, SUBREDDIT_SELECTION_REQUEST_CODE); startActivityForResult(intent, SUBREDDIT_SELECTION_REQUEST_CODE);
}); });
subreditNameTextView.setOnClickListener(view -> { subredditNameTextView.setOnClickListener(view -> {
Intent intent = new Intent(this, SubredditSelectionActivity.class); Intent intent = new Intent(this, SubredditSelectionActivity.class);
startActivityForResult(intent, SUBREDDIT_SELECTION_REQUEST_CODE); startActivityForResult(intent, SUBREDDIT_SELECTION_REQUEST_CODE);
}); });
@ -376,9 +378,9 @@ public class PostImageActivity extends AppCompatActivity implements FlairBottomS
String subredditName; String subredditName;
if(subredditIsUser) { if(subredditIsUser) {
subredditName = "u_" + subreditNameTextView.getText().toString(); subredditName = "u_" + subredditNameTextView.getText().toString();
} else { } else {
subredditName = subreditNameTextView.getText().toString(); subredditName = subredditNameTextView.getText().toString();
} }
Intent intent = new Intent(this, SubmitPostService.class); Intent intent = new Intent(this, SubmitPostService.class);
@ -433,8 +435,8 @@ public class PostImageActivity extends AppCompatActivity implements FlairBottomS
subredditSelected = true; subredditSelected = true;
subredditIsUser = data.getExtras().getBoolean(SubredditSelectionActivity.EXTRA_RETURN_SUBREDDIT_IS_USER); subredditIsUser = data.getExtras().getBoolean(SubredditSelectionActivity.EXTRA_RETURN_SUBREDDIT_IS_USER);
subreditNameTextView.setTextColor(getResources().getColor(R.color.primaryTextColor)); subredditNameTextView.setTextColor(getResources().getColor(R.color.primaryTextColor));
subreditNameTextView.setText(subredditName); subredditNameTextView.setText(subredditName);
displaySubredditIcon(); displaySubredditIcon();
flairTextView.setVisibility(View.VISIBLE); flairTextView.setVisibility(View.VISIBLE);

View File

@ -138,6 +138,7 @@ public class PostLinkActivity extends AppCompatActivity implements FlairBottomSh
isNSFW = savedInstanceState.getBoolean(IS_NSFW_STATE); isNSFW = savedInstanceState.getBoolean(IS_NSFW_STATE);
if(subredditName != null) { if(subredditName != null) {
subredditNameTextView.setTextColor(getResources().getColor(R.color.primaryTextColor));
subredditNameTextView.setText(subredditName); subredditNameTextView.setText(subredditName);
flairTextView.setVisibility(View.VISIBLE); flairTextView.setVisibility(View.VISIBLE);
if(!loadSubredditIconSuccessful) { if(!loadSubredditIconSuccessful) {
@ -168,6 +169,7 @@ public class PostLinkActivity extends AppCompatActivity implements FlairBottomSh
if(getIntent().hasExtra(EXTRA_SUBREDDIT_NAME)) { if(getIntent().hasExtra(EXTRA_SUBREDDIT_NAME)) {
subredditName = getIntent().getExtras().getString(EXTRA_SUBREDDIT_NAME); subredditName = getIntent().getExtras().getString(EXTRA_SUBREDDIT_NAME);
subredditNameTextView.setTextColor(getResources().getColor(R.color.primaryTextColor));
subredditNameTextView.setText(subredditName); subredditNameTextView.setText(subredditName);
flairTextView.setVisibility(View.VISIBLE); flairTextView.setVisibility(View.VISIBLE);
loadSubredditIcon(); loadSubredditIcon();

View File

@ -58,7 +58,7 @@ public class PostTextActivity extends AppCompatActivity implements FlairBottomSh
@BindView(R.id.coordinator_layout_post_text_activity) CoordinatorLayout coordinatorLayout; @BindView(R.id.coordinator_layout_post_text_activity) CoordinatorLayout coordinatorLayout;
@BindView(R.id.toolbar_post_text_activity) Toolbar toolbar; @BindView(R.id.toolbar_post_text_activity) Toolbar toolbar;
@BindView(R.id.subreddit_icon_gif_image_view_search_activity) GifImageView iconGifImageView; @BindView(R.id.subreddit_icon_gif_image_view_search_activity) GifImageView iconGifImageView;
@BindView(R.id.subreddit_name_text_view_search_activity) TextView subreditNameTextView; @BindView(R.id.subreddit_name_text_view_search_activity) TextView subredditNameTextView;
@BindView(R.id.rules_button_post_text_activity) Button rulesButton; @BindView(R.id.rules_button_post_text_activity) Button rulesButton;
@BindView(R.id.flair_custom_text_view_post_text_activity) CustomTextView flairTextView; @BindView(R.id.flair_custom_text_view_post_text_activity) CustomTextView flairTextView;
@BindView(R.id.spoiler_custom_text_view_post_text_activity) CustomTextView spoilerTextView; @BindView(R.id.spoiler_custom_text_view_post_text_activity) CustomTextView spoilerTextView;
@ -131,7 +131,8 @@ public class PostTextActivity extends AppCompatActivity implements FlairBottomSh
isNSFW = savedInstanceState.getBoolean(IS_NSFW_STATE); isNSFW = savedInstanceState.getBoolean(IS_NSFW_STATE);
if(subredditName != null) { if(subredditName != null) {
subreditNameTextView.setText(subredditName); subredditNameTextView.setTextColor(getResources().getColor(R.color.primaryTextColor));
subredditNameTextView.setText(subredditName);
flairTextView.setVisibility(View.VISIBLE); flairTextView.setVisibility(View.VISIBLE);
if(!loadSubredditIconSuccessful) { if(!loadSubredditIconSuccessful) {
loadSubredditIcon(); loadSubredditIcon();
@ -160,7 +161,8 @@ public class PostTextActivity extends AppCompatActivity implements FlairBottomSh
if(getIntent().hasExtra(EXTRA_SUBREDDIT_NAME)) { if(getIntent().hasExtra(EXTRA_SUBREDDIT_NAME)) {
loadSubredditIconSuccessful = false; loadSubredditIconSuccessful = false;
subredditName = getIntent().getExtras().getString(EXTRA_SUBREDDIT_NAME); subredditName = getIntent().getExtras().getString(EXTRA_SUBREDDIT_NAME);
subreditNameTextView.setText(subredditName); subredditNameTextView.setTextColor(getResources().getColor(R.color.primaryTextColor));
subredditNameTextView.setText(subredditName);
flairTextView.setVisibility(View.VISIBLE); flairTextView.setVisibility(View.VISIBLE);
loadSubredditIcon(); loadSubredditIcon();
} else { } else {
@ -175,7 +177,7 @@ public class PostTextActivity extends AppCompatActivity implements FlairBottomSh
startActivityForResult(intent, SUBREDDIT_SELECTION_REQUEST_CODE); startActivityForResult(intent, SUBREDDIT_SELECTION_REQUEST_CODE);
}); });
subreditNameTextView.setOnClickListener(view -> { subredditNameTextView.setOnClickListener(view -> {
Intent intent = new Intent(this, SubredditSelectionActivity.class); Intent intent = new Intent(this, SubredditSelectionActivity.class);
startActivityForResult(intent, SUBREDDIT_SELECTION_REQUEST_CODE); startActivityForResult(intent, SUBREDDIT_SELECTION_REQUEST_CODE);
}); });
@ -299,9 +301,9 @@ public class PostTextActivity extends AppCompatActivity implements FlairBottomSh
String subredditName; String subredditName;
if(subredditIsUser) { if(subredditIsUser) {
subredditName = "u_" + subreditNameTextView.getText().toString(); subredditName = "u_" + subredditNameTextView.getText().toString();
} else { } else {
subredditName = subreditNameTextView.getText().toString(); subredditName = subredditNameTextView.getText().toString();
} }
Intent intent = new Intent(this, SubmitPostService.class); Intent intent = new Intent(this, SubmitPostService.class);
@ -348,8 +350,8 @@ public class PostTextActivity extends AppCompatActivity implements FlairBottomSh
subredditSelected = true; subredditSelected = true;
subredditIsUser = data.getExtras().getBoolean(SubredditSelectionActivity.EXTRA_RETURN_SUBREDDIT_IS_USER); subredditIsUser = data.getExtras().getBoolean(SubredditSelectionActivity.EXTRA_RETURN_SUBREDDIT_IS_USER);
subreditNameTextView.setTextColor(getResources().getColor(R.color.primaryTextColor)); subredditNameTextView.setTextColor(getResources().getColor(R.color.primaryTextColor));
subreditNameTextView.setText(subredditName); subredditNameTextView.setText(subredditName);
displaySubredditIcon(); displaySubredditIcon();
flairTextView.setVisibility(View.VISIBLE); flairTextView.setVisibility(View.VISIBLE);

View File

@ -67,7 +67,7 @@ public class PostVideoActivity extends AppCompatActivity implements FlairBottomS
@BindView(R.id.coordinator_layout_post_video_activity) CoordinatorLayout coordinatorLayout; @BindView(R.id.coordinator_layout_post_video_activity) CoordinatorLayout coordinatorLayout;
@BindView(R.id.toolbar_post_video_activity) Toolbar toolbar; @BindView(R.id.toolbar_post_video_activity) Toolbar toolbar;
@BindView(R.id.subreddit_icon_gif_image_view_post_video_activity) GifImageView iconGifImageView; @BindView(R.id.subreddit_icon_gif_image_view_post_video_activity) GifImageView iconGifImageView;
@BindView(R.id.subreddit_name_text_view_post_video_activity) TextView subreditNameTextView; @BindView(R.id.subreddit_name_text_view_post_video_activity) TextView subredditNameTextView;
@BindView(R.id.rules_button_post_video_activity) Button rulesButton; @BindView(R.id.rules_button_post_video_activity) Button rulesButton;
@BindView(R.id.flair_custom_text_view_post_video_activity) CustomTextView flairTextView; @BindView(R.id.flair_custom_text_view_post_video_activity) CustomTextView flairTextView;
@BindView(R.id.spoiler_custom_text_view_post_video_activity) CustomTextView spoilerTextView; @BindView(R.id.spoiler_custom_text_view_post_video_activity) CustomTextView spoilerTextView;
@ -166,7 +166,8 @@ public class PostVideoActivity extends AppCompatActivity implements FlairBottomS
} }
if(subredditName != null) { if(subredditName != null) {
subreditNameTextView.setText(subredditName); subredditNameTextView.setTextColor(getResources().getColor(R.color.primaryTextColor));
subredditNameTextView.setText(subredditName);
flairTextView.setVisibility(View.VISIBLE); flairTextView.setVisibility(View.VISIBLE);
if(!loadSubredditIconSuccessful) { if(!loadSubredditIconSuccessful) {
loadSubredditIcon(); loadSubredditIcon();
@ -196,7 +197,8 @@ public class PostVideoActivity extends AppCompatActivity implements FlairBottomS
if(getIntent().hasExtra(EXTRA_SUBREDDIT_NAME)) { if(getIntent().hasExtra(EXTRA_SUBREDDIT_NAME)) {
subredditName = getIntent().getExtras().getString(EXTRA_SUBREDDIT_NAME); subredditName = getIntent().getExtras().getString(EXTRA_SUBREDDIT_NAME);
subreditNameTextView.setText(subredditName); subredditNameTextView.setTextColor(getResources().getColor(R.color.primaryTextColor));
subredditNameTextView.setText(subredditName);
loadSubredditIcon(); loadSubredditIcon();
} else { } else {
mGlide.load(R.drawable.subreddit_default_icon) mGlide.load(R.drawable.subreddit_default_icon)
@ -210,7 +212,7 @@ public class PostVideoActivity extends AppCompatActivity implements FlairBottomS
startActivityForResult(intent, SUBREDDIT_SELECTION_REQUEST_CODE); startActivityForResult(intent, SUBREDDIT_SELECTION_REQUEST_CODE);
}); });
subreditNameTextView.setOnClickListener(view -> { subredditNameTextView.setOnClickListener(view -> {
Intent intent = new Intent(this, SubredditSelectionActivity.class); Intent intent = new Intent(this, SubredditSelectionActivity.class);
startActivityForResult(intent, SUBREDDIT_SELECTION_REQUEST_CODE); startActivityForResult(intent, SUBREDDIT_SELECTION_REQUEST_CODE);
}); });
@ -371,9 +373,9 @@ public class PostVideoActivity extends AppCompatActivity implements FlairBottomS
String subredditName; String subredditName;
if(subredditIsUser) { if(subredditIsUser) {
subredditName = "u_" + subreditNameTextView.getText().toString(); subredditName = "u_" + subredditNameTextView.getText().toString();
} else { } else {
subredditName = subreditNameTextView.getText().toString(); subredditName = subredditNameTextView.getText().toString();
} }
Intent intent = new Intent(this, SubmitPostService.class); Intent intent = new Intent(this, SubmitPostService.class);
@ -434,8 +436,8 @@ public class PostVideoActivity extends AppCompatActivity implements FlairBottomS
subredditSelected = true; subredditSelected = true;
subredditIsUser = data.getExtras().getBoolean(SubredditSelectionActivity.EXTRA_RETURN_SUBREDDIT_IS_USER); subredditIsUser = data.getExtras().getBoolean(SubredditSelectionActivity.EXTRA_RETURN_SUBREDDIT_IS_USER);
subreditNameTextView.setTextColor(getResources().getColor(R.color.primaryTextColor)); subredditNameTextView.setTextColor(getResources().getColor(R.color.primaryTextColor));
subreditNameTextView.setText(subredditName); subredditNameTextView.setText(subredditName);
displaySubredditIcon(); displaySubredditIcon();
flairTextView.setVisibility(View.VISIBLE); flairTextView.setVisibility(View.VISIBLE);

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FF000000"
android:pathData="M14.06,9.02l0.92,0.92L5.92,19L5,19v-0.92l9.06,-9.06M17.66,3c-0.25,0 -0.51,0.1 -0.7,0.29l-1.83,1.83 3.75,3.75 1.83,-1.83c0.39,-0.39 0.39,-1.02 0,-1.41l-2.34,-2.34c-0.2,-0.2 -0.45,-0.29 -0.71,-0.29zM14.06,6.19L3,17.25L3,21h3.75L17.81,9.94l-3.75,-3.75z"/>
</vector>

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<EditText
android:id="@+id/flair_edit_text_edit_flair_dialog"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="24dp"
android:background="#00000000"
android:textColor="@color/primaryTextColor"
android:hint="@string/flair"
android:maxLength="64" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginEnd="24dp"
android:text="@string/only_allow_64_chars"
android:textColor="@color/colorAccent"/>
</LinearLayout>

View File

@ -1,16 +1,28 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content"
android:clickable="true"
android:focusable="true"
android:background="?attr/selectableItemBackground">
<TextView <TextView
android:id="@+id/flair_text_view_item_flair" android:id="@+id/flair_text_view_item_flair"
android:layout_width="match_parent" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:padding="16dp" android:padding="16dp"
android:textColor="@color/primaryTextColor" android:textColor="@color/primaryTextColor" />
android:clickable="true"
android:focusable="true"
android:background="?attr/selectableItemBackground" />
<ImageView
android:id="@+id/edit_flair_image_view_item_flair"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="center_vertical|end"
android:layout_marginStart="32dp"
android:src="@drawable/ic_outline_edit_24px"
android:visibility="gone"
android:tint="@color/primaryTextColor"
android:background="?actionBarItemBackground"
android:clickable="true"
android:focusable="true" />
</LinearLayout> </LinearLayout>

View File

@ -194,6 +194,7 @@
<string name="edit">Edit</string> <string name="edit">Edit</string>
<string name="delete">Delete</string> <string name="delete">Delete</string>
<string name="cancel">Cancel</string> <string name="cancel">Cancel</string>
<string name="ok">OK</string>
<string name="edit_success">Edit successful</string> <string name="edit_success">Edit successful</string>
<string name="delete_post_success">Delete successfully</string> <string name="delete_post_success">Delete successfully</string>
<string name="delete_post_failed">Delete failed</string> <string name="delete_post_failed">Delete failed</string>
@ -207,4 +208,7 @@
<string name="unmark_spoiler_failed">Unmark spoiler failed</string> <string name="unmark_spoiler_failed">Unmark spoiler failed</string>
<string name="update_flair_success">Update flair successful</string> <string name="update_flair_success">Update flair successful</string>
<string name="update_flair_failed">Update flair failed</string> <string name="update_flair_failed">Update flair failed</string>
<string name="edit_flair">Edit Flair</string>
<string name="only_allow_64_chars">Only allow less than 64 characters</string>
</resources> </resources>

View File

@ -31,6 +31,6 @@ task clean(type: Delete) {
} }
ext { ext {
roomVersion = '2.2.0-alpha01' roomVersion = '2.2.0-alpha02'
archLifecycleVersion = '2.2.0-alpha02' archLifecycleVersion = '2.2.0-alpha03'
} }