Style seek bar

This commit is contained in:
M66B 2019-05-07 22:18:30 +02:00
parent cc268a655a
commit 683c8d250e
2 changed files with 22 additions and 5 deletions

View File

@ -26,6 +26,7 @@ import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.PorterDuff;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.net.ConnectivityManager;
@ -138,6 +139,7 @@ public class FragmentMessages extends FragmentBase {
private boolean date;
private boolean threading;
private boolean pull;
private boolean swipenav;
private boolean autoscroll;
private boolean actionbar;
private boolean autoexpand;
@ -145,6 +147,9 @@ public class FragmentMessages extends FragmentBase {
private boolean autonext;
private boolean addresses;
private int colorPrimary;
private int colorAccent;
private long primary;
private boolean outbox = false;
private boolean connected;
@ -237,6 +242,7 @@ public class FragmentMessages extends FragmentBase {
else
pull = false;
swipenav = prefs.getBoolean("swipenav", true);
autoscroll = prefs.getBoolean("autoscroll", false);
date = prefs.getBoolean("date", true);
threading = prefs.getBoolean("threading", true);
@ -245,6 +251,9 @@ public class FragmentMessages extends FragmentBase {
autoclose = prefs.getBoolean("autoclose", true);
autonext = (!autoclose && prefs.getBoolean("autonext", false));
addresses = prefs.getBoolean("addresses", false);
colorPrimary = Helper.resolveColor(getContext(), R.attr.colorPrimary);
colorAccent = Helper.resolveColor(getContext(), R.attr.colorAccent);
}
@Override
@ -278,7 +287,6 @@ public class FragmentMessages extends FragmentBase {
// Wire controls
int colorPrimary = Helper.resolveColor(getContext(), R.attr.colorPrimary);
swipeRefresh.setColorSchemeColors(Color.WHITE, Color.WHITE, Color.WHITE);
swipeRefresh.setProgressBackgroundColorSchemeColor(colorPrimary);
@ -438,6 +446,13 @@ public class FragmentMessages extends FragmentBase {
rvMessage.setAdapter(adapter);
seekBar.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
return false;
}
});
bottom_navigation.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem menuItem) {
@ -534,7 +549,6 @@ public class FragmentMessages extends FragmentBase {
// Initialize
swipeRefresh.setEnabled(pull);
tvNoEmail.setVisibility(View.GONE);
seekBar.setEnabled(false);
seekBar.setVisibility(View.GONE);
bottom_navigation.getMenu().findItem(R.id.action_prev).setEnabled(false);
bottom_navigation.getMenu().findItem(R.id.action_next).setEnabled(false);
@ -566,12 +580,15 @@ public class FragmentMessages extends FragmentBase {
if (actionbar) {
seekBar.setMax(size - 1);
seekBar.setProgress(size - 1 - position);
seekBar.getProgressDrawable().setAlpha(0);
seekBar.getThumb().setColorFilter(
position == 0 || position == size - 1 ? colorAccent : colorPrimary,
PorterDuff.Mode.SRC_IN);
seekBar.setVisibility(size > 1 ? View.VISIBLE : View.GONE);
}
}
});
boolean swipenav = prefs.getBoolean("swipenav", true);
if (swipenav) {
Log.i("Swipe navigation");

View File

@ -149,7 +149,7 @@
android:layout_height="0dp"
android:scrollbarStyle="outsideOverlay"
android:scrollbars="vertical"
app:layout_constraintBottom_toTopOf="@+id/seekBar"
app:layout_constraintBottom_toTopOf="@+id/bottom_navigation"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/vSeparatorHintSelect" />
@ -160,7 +160,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:indeterminate="true"
app:layout_constraintBottom_toTopOf="@+id/seekBar"
app:layout_constraintBottom_toTopOf="@+id/bottom_navigation"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/vSeparatorHintSelect" />