Allow custom values for auto split

This commit is contained in:
Kasun 2020-12-30 20:31:16 +05:30
parent d64e1fb668
commit 8a3e8d5092
4 changed files with 49 additions and 5 deletions

View File

@ -574,10 +574,31 @@ public class SettingsActivity extends BaseActivity {
LinearLayout set_split_container = findViewById(R.id.set_split_container);
//split size
SeekBar split_size = findViewById(R.id.set_split_size);
final TextView split_text = findViewById(R.id.set_split_text);
final EditText split_text = findViewById(R.id.set_split_text);
split_size.setProgress(0);
split_text.setText(String.valueOf(split_size_val));
split_text.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) { }
@Override
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
if (charSequence != null && charSequence.length() > 0) {
int newValue = Integer.parseInt(charSequence.toString());
if (newValue > 0) {
SharedPreferences.Editor editor = sharedpreferences.edit();
editor.putInt(Helper.SET_AUTOMATICALLY_SPLIT_TOOTS_SIZE + userId + instance, newValue);
editor.apply();
}
}
}
@Override
public void afterTextChanged(Editable editable) {
}
});
split_size.setMax(5);
split_size.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override

View File

@ -527,11 +527,12 @@
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
<EditText
android:id="@+id/set_split_text"
android:layout_width="40dp"
android:layout_height="wrap_content"
android:layout_marginEnd="10dp"
android:inputType="number"
android:textSize="16sp" />
<SeekBar

View File

@ -1735,10 +1735,31 @@ public class ContentSettingsFragment extends Fragment implements OnRetrieveRemot
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);
final EditText split_text = rootView.findViewById(R.id.set_split_text);
split_size.setProgress(0);
split_text.setText(String.valueOf(split_size_val));
split_text.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) { }
@Override
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
if (charSequence != null && charSequence.length() > 0) {
int newValue = Integer.parseInt(charSequence.toString());
if (newValue > 0) {
SharedPreferences.Editor editor = sharedpreferences.edit();
editor.putInt(Helper.SET_AUTOMATICALLY_SPLIT_TOOTS_SIZE + userId + instance, newValue);
editor.apply();
}
}
}
@Override
public void afterTextChanged(Editable editable) {
}
});
split_size.setMax(5);
split_size.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override

View File

@ -311,11 +311,12 @@
android:layout_gravity="center_vertical"
android:orientation="horizontal">
<TextView
<EditText
android:id="@+id/set_split_text"
android:layout_width="50dp"
android:layout_height="wrap_content"
android:layout_marginEnd="10dp" />
android:layout_marginEnd="10dp"
android:inputType="number" />
<SeekBar
android:id="@+id/set_split_size"