Allow to customize split size for messages
This commit is contained in:
parent
d56ad78ff4
commit
d625837222
|
@ -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;
|
||||
|
|
|
@ -820,18 +820,27 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
|
|||
public void onRetrieveMissingFeeds(List<Status> 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"))
|
||||
switch (instanceType) {
|
||||
case "MASTODON":
|
||||
case "MISSKEY":
|
||||
case "GNU":
|
||||
statusListAdapter.notifyItemRangeChanged(0, this.statuses.size());
|
||||
else if( instanceType.equals("PIXELFED"))
|
||||
break;
|
||||
case "PIXELFED":
|
||||
pixelfedListAdapter.notifyItemRangeChanged(0, this.statuses.size());
|
||||
else if( instanceType.equals("ART"))
|
||||
break;
|
||||
case "ART":
|
||||
artListAdapter.notifyItemRangeChanged(0, this.statuses.size());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
isSwipped = false;
|
||||
|
||||
if( statuses != null && statuses.size() > 0) {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -350,7 +350,26 @@
|
|||
android:layout_marginBottom="@dimen/settings_checkbox_margin"
|
||||
android:text="@string/set_automatically_split_toot"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:id="@+id/set_split_container"
|
||||
android:layout_height="wrap_content">
|
||||
<TextView
|
||||
android:id="@+id/set_split_text"
|
||||
android:gravity="end"
|
||||
android:layout_width="50dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_height="wrap_content" />
|
||||
<SeekBar
|
||||
android:layout_gravity="center_vertical"
|
||||
android:id="@+id/set_split_size"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
</SeekBar>
|
||||
</LinearLayout>
|
||||
<CheckBox
|
||||
android:id="@+id/set_display_emoji"
|
||||
android:layout_width="wrap_content"
|
||||
|
|
|
@ -356,6 +356,26 @@
|
|||
android:layout_marginBottom="@dimen/settings_checkbox_margin"
|
||||
android:text="@string/set_automatically_split_toot"
|
||||
android:layout_height="wrap_content" />
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:id="@+id/set_split_container"
|
||||
android:layout_height="wrap_content">
|
||||
<TextView
|
||||
android:id="@+id/set_split_text"
|
||||
android:gravity="end"
|
||||
android:layout_width="50dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_height="wrap_content" />
|
||||
<SeekBar
|
||||
android:layout_gravity="center_vertical"
|
||||
android:id="@+id/set_split_size"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
</SeekBar>
|
||||
</LinearLayout>
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/set_display_emoji"
|
||||
|
|
|
@ -341,7 +341,7 @@
|
|||
<string name="set_save_changes">Save changes</string>
|
||||
<string name="set_header_picture_overlay">Choose a header picture</string>
|
||||
<string name="set_fit_preview">Fit preview images</string>
|
||||
<string name="set_automatically_split_toot">Automatically split toots over 500 chars in replies</string>
|
||||
<string name="set_automatically_split_toot">Automatically split toots in replies when chars are over:</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