Fix reviewed UI

This commit is contained in:
cepprice 2021-01-24 18:27:26 +05:00
parent d4514cefaa
commit 5254e7f1c8
5 changed files with 49 additions and 18 deletions

View file

@ -1,19 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:id="@android:id/background">
<item android:id="@+id/background">
<shape android:shape="rectangle" >
<solid
android:color="#4d007eb3" />
<corners android:radius="30dp" />
</shape>
</item>
<item android:id="@android:id/progress">
<clip>
<shape android:shape="rectangle" >
<solid
android:color="@color/profile_icon_color_blue_light" />
<corners android:radius="30dp" />
</shape>
</clip>
<item android:id="@+id/progress">
<shape android:shape="rectangle" >
<solid
android:color="@color/color_white" />
<corners android:radius="30dp" />
</shape>
</item>
</layer-list>

View file

@ -1,7 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<item>
<item android:id="@+id/thump">
<shape android:shape="oval">
<size
android:height="12dp"

View file

@ -27,6 +27,7 @@
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/content_padding"
android:layout_marginLeft="@dimen/content_padding"
android:layout_marginTop="@dimen/content_padding_half"
android:layout_marginEnd="@dimen/content_padding"
android:layout_marginRight="@dimen/content_padding"
android:lineSpacingMultiplier="1.1"
@ -70,8 +71,6 @@
android:maxHeight="2dp"
android:paddingTop="11dp"
android:paddingBottom="11dp"
android:progressDrawable="@drawable/seekbar_progress_announcement_time"
android:thumb="@drawable/seekbar_thumb_announcement_time"
osmand:tickMark="@drawable/seekbar_tickmark_announcement_time"
tools:max="3"
tools:progress="1" />

View file

@ -89,7 +89,7 @@
<net.osmand.plus.settings.preferences.ListPreferenceEx
android:key="arrival_distance_factor"
android:layout="@layout/preference_with_descr"
android:title="@string/arrival_distance" />
android:title="@string/announcement_time_title" />
<Preference
android:layout="@layout/simple_divider_item"

View file

@ -1,15 +1,15 @@
package net.osmand.plus.settings.bottomsheets;
import android.graphics.drawable.ClipDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable;
import android.graphics.drawable.LayerDrawable;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.widget.ImageView;
import android.widget.SeekBar;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import net.osmand.PlatformUtil;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
@ -24,6 +24,12 @@ import net.osmand.plus.widgets.TextViewEx;
import org.apache.commons.logging.Log;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import static net.osmand.plus.settings.bottomsheets.SingleSelectPreferenceBottomSheet.SELECTED_ENTRY_INDEX_KEY;
@ -133,6 +139,7 @@ public class AnnouncementTimeBottomSheet extends BasePreferenceBottomSheet
ivArrow = rootView.findViewById(R.id.iv_arrow);
tvIntervalsDescr = rootView.findViewById(R.id.tv_interval_descr);
setProfileColorToSeekBar();
seekBarArrival.setOnSeekBarChangeListener(this);
seekBarArrival.setProgress(selectedEntryIndex);
seekBarArrival.setMax(listPreference.getEntries().length - 1);
@ -163,6 +170,32 @@ public class AnnouncementTimeBottomSheet extends BasePreferenceBottomSheet
AndroidUiHelper.updateVisibility(tvIntervalsDescr, !collapsed);
}
private void setProfileColorToSeekBar() {
int color = ContextCompat.getColor(app, getAppMode().getIconColorInfo().getColor(nightMode));
int alpha = 70;
LayerDrawable seekBarProgressLayer =
(LayerDrawable) ContextCompat.getDrawable(app, R.drawable.seekbar_progress_announcement_time);
GradientDrawable background = (GradientDrawable) seekBarProgressLayer.findDrawableByLayerId(R.id.background);
background.setColor(color);
background.setAlpha(alpha);
GradientDrawable progress = (GradientDrawable) seekBarProgressLayer.findDrawableByLayerId(R.id.progress);
progress.setColor(color);
Drawable clippedProgress = new ClipDrawable(progress, Gravity.CENTER_VERTICAL | Gravity.START, 1);
seekBarArrival.setProgressDrawable(new LayerDrawable(new Drawable[]{
background, clippedProgress
}));
LayerDrawable seekBarThumpLayer =
(LayerDrawable) ContextCompat.getDrawable(app, R.drawable.seekbar_thumb_announcement_time);
GradientDrawable thump = (GradientDrawable) seekBarThumpLayer.findDrawableByLayerId(R.id.thump);
thump.setColor(color);
seekBarArrival.setThumb(thump);
}
public static void showInstance(@NonNull FragmentManager fm, String prefKey, Fragment target,
@Nullable ApplicationMode appMode, boolean usedOnMap) {
try {