diff --git a/app/src/main/java/app/fedilab/android/activities/TootActivity.java b/app/src/main/java/app/fedilab/android/activities/TootActivity.java index 6f4cd7fac..270ee390f 100644 --- a/app/src/main/java/app/fedilab/android/activities/TootActivity.java +++ b/app/src/main/java/app/fedilab/android/activities/TootActivity.java @@ -1525,7 +1525,8 @@ public class TootActivity extends BaseActivity implements OnPostActionInterface, }*/ SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE); boolean split_toot = sharedpreferences.getBoolean(Helper.SET_AUTOMATICALLY_SPLIT_TOOTS, false); - int split_toot_size = sharedpreferences.getInt(Helper.SET_AUTOMATICALLY_SPLIT_TOOTS_SIZE, Helper.SPLIT_TOOT_SIZE); + int split_toot_size = sharedpreferences.getInt(Helper.SET_AUTOMATICALLY_SPLIT_TOOTS_SIZE+userId+instance, Helper.SPLIT_TOOT_SIZE); + String tootContent; if( toot_cw_content.getText() != null && toot_cw_content.getText().toString().trim().length() > 0 ) split_toot_size -= toot_cw_content.getText().toString().trim().length(); @@ -1987,7 +1988,7 @@ public class TootActivity extends BaseActivity implements OnPostActionInterface, } final SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE); boolean split_toot = sharedpreferences.getBoolean(Helper.SET_AUTOMATICALLY_SPLIT_TOOTS, false); - int split_toot_size = sharedpreferences.getInt(Helper.SET_AUTOMATICALLY_SPLIT_TOOTS_SIZE, Helper.SPLIT_TOOT_SIZE); + int split_toot_size = sharedpreferences.getInt(Helper.SET_AUTOMATICALLY_SPLIT_TOOTS_SIZE+userId+instance, Helper.SPLIT_TOOT_SIZE); int cwSize = toot_cw_content.getText().toString().trim().length(); int size = toot_content.getText().toString().trim().length() + cwSize; diff --git a/app/src/main/java/app/fedilab/android/fragments/DisplayStatusFragment.java b/app/src/main/java/app/fedilab/android/fragments/DisplayStatusFragment.java index efb5d187c..574fb2756 100644 --- a/app/src/main/java/app/fedilab/android/fragments/DisplayStatusFragment.java +++ b/app/src/main/java/app/fedilab/android/fragments/DisplayStatusFragment.java @@ -820,18 +820,27 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn public void onRetrieveMissingFeeds(List statuses) { if(swipeRefreshLayout == null) return; + //Clean label new swipeRefreshLayout.setRefreshing(false); if( isSwipped && this.statuses != null && this.statuses.size() > 0) { for (Status status : this.statuses) { status.setNew(false); } - if( instanceType.equals("MASTODON") || instanceType.equals("MISSKEY")|| instanceType.equals("GNU")) - statusListAdapter.notifyItemRangeChanged(0, this.statuses.size()); - else if( instanceType.equals("PIXELFED")) - pixelfedListAdapter.notifyItemRangeChanged(0, this.statuses.size()); - else if( instanceType.equals("ART")) - artListAdapter.notifyItemRangeChanged(0, this.statuses.size()); + switch (instanceType) { + case "MASTODON": + case "MISSKEY": + case "GNU": + statusListAdapter.notifyItemRangeChanged(0, this.statuses.size()); + break; + case "PIXELFED": + pixelfedListAdapter.notifyItemRangeChanged(0, this.statuses.size()); + break; + case "ART": + artListAdapter.notifyItemRangeChanged(0, this.statuses.size()); + break; + } } + isSwipped = false; if( statuses != null && statuses.size() > 0) { diff --git a/app/src/main/java/app/fedilab/android/fragments/SettingsFragment.java b/app/src/main/java/app/fedilab/android/fragments/SettingsFragment.java index 85cfcf864..8334eba48 100644 --- a/app/src/main/java/app/fedilab/android/fragments/SettingsFragment.java +++ b/app/src/main/java/app/fedilab/android/fragments/SettingsFragment.java @@ -1069,8 +1069,35 @@ public class SettingsFragment extends Fragment { } }); + int split_size_val = sharedpreferences.getInt(Helper.SET_AUTOMATICALLY_SPLIT_TOOTS_SIZE+userId+instance, Helper.SPLIT_TOOT_SIZE); + + LinearLayout set_split_container = rootView.findViewById(R.id.set_split_container); + //split size + SeekBar split_size = rootView.findViewById(R.id.set_split_size); + final TextView split_text = rootView.findViewById(R.id.set_split_text); + + split_size.setProgress(0); + split_text.setText(String.valueOf(split_size_val)); + split_size.setMax(5); + split_size.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { + @Override + public void onStopTrackingTouch(SeekBar seekBar) {} + @Override + public void onStartTrackingTouch(SeekBar seekBar) {} + @Override + public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { + int newProgress = (progress + 1) * Helper.SPLIT_TOOT_SIZE; + split_text.setText(String.valueOf(newProgress)); + SharedPreferences.Editor editor = sharedpreferences.edit(); + editor.putInt(Helper.SET_AUTOMATICALLY_SPLIT_TOOTS_SIZE+userId+instance, newProgress); + editor.apply(); + } + }); boolean split_toot = sharedpreferences.getBoolean(Helper.SET_AUTOMATICALLY_SPLIT_TOOTS, false); + if( !split_toot){ + set_split_container.setVisibility(View.GONE); + } final CheckBox set_split_toot = rootView.findViewById(R.id.set_automatically_split_toot); set_split_toot.setChecked(split_toot); set_split_toot.setOnClickListener(new View.OnClickListener() { @@ -1079,6 +1106,11 @@ public class SettingsFragment extends Fragment { SharedPreferences.Editor editor = sharedpreferences.edit(); editor.putBoolean(Helper.SET_AUTOMATICALLY_SPLIT_TOOTS, set_split_toot.isChecked()); editor.apply(); + if( set_split_toot.isChecked()){ + set_split_container.setVisibility(View.VISIBLE); + }else{ + set_split_container.setVisibility(View.GONE); + } } }); diff --git a/app/src/main/res/layout-sw600dp/fragment_settings.xml b/app/src/main/res/layout-sw600dp/fragment_settings.xml index 6cbe50ffb..b604630cb 100644 --- a/app/src/main/res/layout-sw600dp/fragment_settings.xml +++ b/app/src/main/res/layout-sw600dp/fragment_settings.xml @@ -350,7 +350,26 @@ android:layout_marginBottom="@dimen/settings_checkbox_margin" android:text="@string/set_automatically_split_toot" android:layout_height="wrap_content" /> - + + + + + + + + + + Save changes Choose a header picture Fit preview images - Automatically split toots over 500 chars in replies + Automatically split toots in replies when chars are over: You have reached the 160 characters allowed! You have reached the 30 characters allowed!