Added option to enable seekbar

This commit is contained in:
M66B 2019-09-09 18:41:04 +02:00
parent 1753603bdb
commit 9336b67e61
6 changed files with 43 additions and 19 deletions

View File

@ -163,7 +163,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
private TextView tvNoEmail;
private FixedRecyclerView rvMessage;
private View vwAnchor;
private SeekBar seekBar;
private SeekBar sbThread;
private ImageButton ibDown;
private ImageButton ibUp;
private ImageButton ibSeen;
@ -201,6 +201,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
private boolean threading;
private boolean swipenav;
private boolean autoscroll;
private boolean seekbar;
private boolean actionbar;
private boolean autoexpand;
private boolean autoclose;
@ -312,6 +313,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
cards = prefs.getBoolean("cards", true);
date = prefs.getBoolean("date", true);
threading = prefs.getBoolean("threading", true);
seekbar = prefs.getBoolean("seekbar", false);
actionbar = prefs.getBoolean("actionbar", true);
autoexpand = prefs.getBoolean("autoexpand", true);
autoclose = prefs.getBoolean("autoclose", true);
@ -358,7 +360,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
tvNoEmail = view.findViewById(R.id.tvNoEmail);
rvMessage = view.findViewById(R.id.rvMessage);
vwAnchor = view.findViewById(R.id.vwAnchor);
seekBar = view.findViewById(R.id.seekBar);
sbThread = view.findViewById(R.id.sbThread);
ibDown = view.findViewById(R.id.ibDown);
ibUp = view.findViewById(R.id.ibUp);
ibSeen = view.findViewById(R.id.ibSeen);
@ -595,7 +597,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
adapter = new AdapterMessage(this, type, viewType, compact, zoom, sort, ascending, filter_duplicates, iProperties);
rvMessage.setAdapter(adapter);
seekBar.setOnTouchListener(new View.OnTouchListener() {
sbThread.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
return true;
@ -883,7 +885,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
view.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.lightColorBackground_cards));
tvNoEmail.setVisibility(View.GONE);
seekBar.setVisibility(View.GONE);
sbThread.setVisibility(View.GONE);
ibDown.setVisibility(View.GONE);
ibUp.setVisibility(View.GONE);
ibSeen.setVisibility(View.GONE);
@ -927,14 +929,14 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
@Override
public void onFound(int position, int size) {
if (actionbar) {
seekBar.setMax(size - 1);
seekBar.setProgress(size - 1 - position);
seekBar.getProgressDrawable().setAlpha(0);
seekBar.getThumb().setColorFilter(
if (seekbar) {
sbThread.setMax(size - 1);
sbThread.setProgress(size - 1 - position);
sbThread.getProgressDrawable().setAlpha(0);
sbThread.getThumb().setColorFilter(
position == 0 || position == size - 1 ? colorAccent : colorPrimary,
PorterDuff.Mode.SRC_IN);
seekBar.setVisibility(size > 1 ? View.VISIBLE : View.GONE);
sbThread.setVisibility(size > 1 ? View.VISIBLE : View.GONE);
}
}
});

View File

@ -41,7 +41,7 @@ public class FragmentOptions extends FragmentBase {
"subscriptions",
"startup", "cards", "date", "threading", "highlight_unread", "avatars", "generated_icons", "identicons", "circular",
"name_email", "subject_top", "subject_italic", "subject_ellipsize", "flags", "preview", "preview_italic",
"addresses", "attachments_alt", "contrast", "monospaced", "inline_images", "collapse_quotes", "autocontent", "actionbar",
"addresses", "attachments_alt", "contrast", "monospaced", "inline_images", "collapse_quotes", "autocontent", "seekbar", "actionbar",
"autoscroll", "swipenav", "autoexpand", "autoclose", "onclose",
"experiments", "debug",
"biometrics"

View File

@ -67,13 +67,14 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
private SwitchCompat swImagesInline;
private SwitchCompat swCollapseQuotes;
private SwitchCompat swRemoteContent;
private SwitchCompat swSeekbar;
private SwitchCompat swActionbar;
private final static String[] RESET_OPTIONS = new String[]{
"theme", "startup", "cards", "date", "threading", "highlight_unread",
"avatars", "generated_icons", "identicons", "circular", "name_email", "subject_top", "subject_italic", "subject_ellipsize",
"flags", "preview", "preview_italic", "addresses", "attachments_alt",
"contrast", "monospaced", "inline_images", "collapse_quotes", "autocontent", "actionbar",
"contrast", "monospaced", "inline_images", "collapse_quotes", "autocontent", "seekbar", "actionbar",
};
@Override
@ -110,6 +111,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
swImagesInline = view.findViewById(R.id.swImagesInline);
swCollapseQuotes = view.findViewById(R.id.swCollapseQuotes);
swRemoteContent = view.findViewById(R.id.swRemoteContent);
swSeekbar = view.findViewById(R.id.swSeekbar);
swActionbar = view.findViewById(R.id.swActionbar);
setOptions();
@ -304,6 +306,13 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
}
});
swSeekbar.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("seekbar", checked).apply();
}
});
swActionbar.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@ -396,6 +405,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
swImagesInline.setChecked(prefs.getBoolean("inline_images", false));
swCollapseQuotes.setChecked(prefs.getBoolean("collapse_quotes", false));
swRemoteContent.setChecked(prefs.getBoolean("autocontent", false));
swSeekbar.setChecked(prefs.getBoolean("seekbar", false));
swActionbar.setChecked(prefs.getBoolean("actionbar", true));
}

View File

@ -153,7 +153,7 @@
app:fastScrollHorizontalTrackDrawable="@drawable/scroll_track"
app:fastScrollVerticalThumbDrawable="@drawable/scroll_thumb"
app:fastScrollVerticalTrackDrawable="@drawable/scroll_track"
app:layout_constraintBottom_toTopOf="@+id/seekBar"
app:layout_constraintBottom_toTopOf="@+id/sbThread"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/vSeparatorHintSelect" />
@ -183,7 +183,7 @@
android:layout_gravity="end|bottom"
android:layout_margin="@dimen/fab_padding"
android:tint="@color/colorActionForeground"
app:layout_constraintBottom_toTopOf="@+id/seekBar"
app:layout_constraintBottom_toTopOf="@+id/sbThread"
app:layout_constraintEnd_toEndOf="parent"
app:srcCompat="@drawable/baseline_reply_24" />
@ -194,7 +194,7 @@
android:background="?attr/selectableItemBackground"
android:padding="12dp"
android:tint="?attr/colorSeparator"
app:layout_constraintBottom_toTopOf="@+id/seekBar"
app:layout_constraintBottom_toTopOf="@+id/sbThread"
app:layout_constraintEnd_toStartOf="@+id/ibUp"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintStart_toStartOf="parent"
@ -207,7 +207,7 @@
android:background="?attr/selectableItemBackground"
android:padding="12dp"
android:tint="?attr/colorSeparator"
app:layout_constraintBottom_toTopOf="@+id/seekBar"
app:layout_constraintBottom_toTopOf="@+id/sbThread"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintStart_toEndOf="@+id/ibDown"
@ -251,7 +251,7 @@
app:srcCompat="@drawable/baseline_timelapse_24" />
<SeekBar
android:id="@+id/seekBar"
android:id="@+id/sbThread"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintBottom_toTopOf="@+id/bottom_navigation"

View File

@ -374,6 +374,17 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swRemoteContent" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swSeekbar"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_advanced_seekbar"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvRemoteContentHint"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swActionbar"
android:layout_width="0dp"
@ -383,7 +394,7 @@
android:text="@string/title_advanced_actionbar"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvRemoteContentHint"
app:layout_constraintTop_toBottomOf="@id/swSeekbar"
app:switchPadding="12dp" />
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>

View File

@ -254,7 +254,8 @@
<string name="title_advanced_images_inline">Automatically show inline images</string>
<string name="title_advanced_collapse_quotes">Collapse quoted text</string>
<string name="title_advanced_remote_content">Automatically show remote content when viewing original messages</string>
<string name="title_advanced_actionbar">Conversation action bar</string>
<string name="title_advanced_seekbar">Show relative conversation position with a dot</string>
<string name="title_advanced_actionbar">Show conversation action bar</string>
<string name="title_advanced_pull_refresh">Pull down to refresh</string>
<string name="title_advanced_autoscroll">Scroll to top on receiving new messages</string>