Adds the possibility to remove profile pictures for replies
This commit is contained in:
parent
fe024fa833
commit
fd6fe5bf9e
|
@ -235,16 +235,12 @@ public class MainActivity extends AppCompatActivity
|
|||
}
|
||||
}
|
||||
});
|
||||
|
||||
//Scroll to top when top bar is clicked (THEME_MENU only)
|
||||
if (Helper.THEME_MENU == sharedpreferences.getInt(Helper.SET_TABS, Helper.THEME_TABS)) {
|
||||
|
||||
toolbarTitle.setOnClickListener(new View.OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
|
||||
int pos = tabLayout.getSelectedTabPosition();
|
||||
|
||||
Fragment fragment = (Fragment) viewPager.getAdapter().instantiateItem(viewPager, pos);
|
||||
|
||||
switch (pos) {
|
||||
case 0:
|
||||
case 2:
|
||||
|
@ -261,9 +257,7 @@ public class MainActivity extends AppCompatActivity
|
|||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
else {
|
||||
} else {
|
||||
toolbarTitle.setOnClickListener(null);
|
||||
toolbar.setClickable(false);
|
||||
}
|
||||
|
|
|
@ -209,30 +209,33 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
|
|||
if( type == RetrieveFeedsAsyncTask.Type.HOME ) {
|
||||
boolean showPreview = sharedpreferences.getBoolean(Helper.SET_PREVIEW_REPLIES, true);
|
||||
if( showPreview){
|
||||
boolean showPreviewPP = sharedpreferences.getBoolean(Helper.SET_PREVIEW_REPLIES_PP, true);
|
||||
if( status.getReplies() == null){
|
||||
holder.loader_replies.setVisibility(View.VISIBLE);
|
||||
}else if(status.getReplies().size() == 0){
|
||||
holder.status_replies.setVisibility(View.GONE);
|
||||
holder.loader_replies.setVisibility(View.GONE);
|
||||
}else if(status.getReplies().size() > 0 ){
|
||||
ArrayList<String> addedPictures = new ArrayList<>();
|
||||
holder.status_replies_profile_pictures.removeAllViews();
|
||||
int i = 0;
|
||||
for(Status replies: status.getReplies()){
|
||||
if( i > 4 )
|
||||
break;
|
||||
if( !addedPictures.contains(replies.getAccount().getAcct())){
|
||||
ImageView imageView = new ImageView(context);
|
||||
imageView.setMaxHeight((int) Helper.convertDpToPixel(40, context));
|
||||
imageView.setMaxWidth((int) Helper.convertDpToPixel(40, context));
|
||||
imageLoader.displayImage(replies.getAccount().getAvatar(), imageView, options);
|
||||
LinearLayout.LayoutParams imParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
|
||||
imParams.setMargins(10, 5, 10, 5);
|
||||
imParams.height = (int) Helper.convertDpToPixel(40, context);
|
||||
imParams.width = (int) Helper.convertDpToPixel(40, context);
|
||||
holder.status_replies_profile_pictures.addView(imageView, imParams);
|
||||
i++;
|
||||
addedPictures.add(replies.getAccount().getAcct());
|
||||
if(showPreviewPP) {
|
||||
ArrayList<String> addedPictures = new ArrayList<>();
|
||||
holder.status_replies_profile_pictures.removeAllViews();
|
||||
int i = 0;
|
||||
for (Status replies : status.getReplies()) {
|
||||
if (i > 4)
|
||||
break;
|
||||
if (!addedPictures.contains(replies.getAccount().getAcct())) {
|
||||
ImageView imageView = new ImageView(context);
|
||||
imageView.setMaxHeight((int) Helper.convertDpToPixel(40, context));
|
||||
imageView.setMaxWidth((int) Helper.convertDpToPixel(40, context));
|
||||
imageLoader.displayImage(replies.getAccount().getAvatar(), imageView, options);
|
||||
LinearLayout.LayoutParams imParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
|
||||
imParams.setMargins(10, 5, 10, 5);
|
||||
imParams.height = (int) Helper.convertDpToPixel(40, context);
|
||||
imParams.width = (int) Helper.convertDpToPixel(40, context);
|
||||
holder.status_replies_profile_pictures.addView(imageView, imParams);
|
||||
i++;
|
||||
addedPictures.add(replies.getAccount().getAcct());
|
||||
}
|
||||
}
|
||||
}
|
||||
holder.status_replies_text.setText(context.getResources().getQuantityString(R.plurals.preview_replies, status.getReplies().size(), status.getReplies().size()));
|
||||
|
|
|
@ -122,6 +122,8 @@ public class SettingsFragment extends Fragment {
|
|||
|
||||
boolean preview_reply = sharedpreferences.getBoolean(Helper.SET_PREVIEW_REPLIES, true);
|
||||
final CheckBox set_preview_reply = (CheckBox) rootView.findViewById(R.id.set_preview_reply);
|
||||
final LinearLayout set_preview_reply_pp_container = (LinearLayout) rootView.findViewById(R.id.set_preview_reply_pp_container);
|
||||
final SwitchCompat set_preview_reply_pp = (SwitchCompat) rootView.findViewById(R.id.set_preview_reply_pp);
|
||||
set_preview_reply.setChecked(preview_reply);
|
||||
|
||||
set_preview_reply.setOnClickListener(new View.OnClickListener() {
|
||||
|
@ -130,9 +132,29 @@ public class SettingsFragment extends Fragment {
|
|||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||
editor.putBoolean(Helper.SET_PREVIEW_REPLIES, set_preview_reply.isChecked());
|
||||
editor.apply();
|
||||
if( !set_preview_reply.isChecked()){
|
||||
set_preview_reply_pp_container.setVisibility(View.GONE);
|
||||
}else{
|
||||
set_preview_reply_pp_container.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if( !preview_reply){
|
||||
set_preview_reply_pp_container.setVisibility(View.GONE);
|
||||
}else{
|
||||
set_preview_reply_pp_container.setVisibility(View.VISIBLE);
|
||||
}
|
||||
boolean preview_reply_pp = sharedpreferences.getBoolean(Helper.SET_PREVIEW_REPLIES_PP, true);
|
||||
set_preview_reply_pp.setChecked(preview_reply_pp);
|
||||
set_preview_reply_pp.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||
editor.putBoolean(Helper.SET_PREVIEW_REPLIES_PP, isChecked);
|
||||
editor.apply();
|
||||
}
|
||||
});
|
||||
|
||||
boolean notif_validation = sharedpreferences.getBoolean(Helper.SET_NOTIF_VALIDATION, true);
|
||||
final CheckBox set_share_validation = (CheckBox) rootView.findViewById(R.id.set_share_validation);
|
||||
set_share_validation.setChecked(notif_validation);
|
||||
|
|
|
@ -197,6 +197,7 @@ public class Helper {
|
|||
public static final String SET_TEXT_SIZE = "set_text_size";
|
||||
public static final String SET_ICON_SIZE = "set_icon_size";
|
||||
public static final String SET_PREVIEW_REPLIES = "set_preview_replies";
|
||||
public static final String SET_PREVIEW_REPLIES_PP = "set_preview_replies_pp";
|
||||
public static final int ATTACHMENT_ALWAYS = 1;
|
||||
public static final int ATTACHMENT_WIFI = 2;
|
||||
public static final int ATTACHMENT_ASK = 3;
|
||||
|
|
|
@ -64,6 +64,31 @@
|
|||
android:text="@string/set_preview_reply"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/set_preview_reply_pp_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="30dp"
|
||||
android:layout_marginStart="30dp"
|
||||
android:orientation="horizontal">
|
||||
<TextView
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/set_preview_reply_pp"/>
|
||||
<android.support.v7.widget.SwitchCompat
|
||||
android:id="@+id/set_preview_reply_pp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:gravity="center"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
|
@ -63,6 +63,32 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:text="@string/set_preview_reply"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/set_preview_reply_pp_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_marginStart="20dp"
|
||||
android:orientation="horizontal">
|
||||
<TextView
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/set_preview_reply_pp"/>
|
||||
<android.support.v7.widget.SwitchCompat
|
||||
android:id="@+id/set_preview_reply_pp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:gravity="center"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
|
@ -298,6 +298,7 @@
|
|||
<string name="set_save_changes">Enregistrer les modifications</string>
|
||||
<string name="set_header_picture_overlay">Choisissez une image d\'entête</string>
|
||||
<string name="set_preview_reply">Afficher le nombre de réponses sur la page d\'accueil</string>
|
||||
<string name="set_preview_reply_pp">Afficher les images de profil ?</string>
|
||||
<string name="note_no_space">Vous avez atteint les 160 caractères autorisés !</string>
|
||||
<string name="username_no_space">Vous avez atteint les 30 caractères autorisés !</string>
|
||||
<string name="settings_title_hour">Plage horaire pour les notifications :</string>
|
||||
|
|
|
@ -304,6 +304,7 @@
|
|||
<string name="set_save_changes">Save changes</string>
|
||||
<string name="set_header_picture_overlay">Choose a header picture</string>
|
||||
<string name="set_preview_reply">Display the number of replies in home timeline</string>
|
||||
<string name="set_preview_reply_pp">Display profile pictures?</string>
|
||||
<string name="note_no_space">You have reached the 160 characters allowed!</string>
|
||||
<string name="username_no_space">You have reached the 30 characters allowed!</string>
|
||||
|
||||
|
|
Loading…
Reference in New Issue