Merge pull request #10651 from osmandapp/fix_announcement_time_ui
Fix UI of Announcement time bottom sheet
This commit is contained in:
commit
5bf7dd6b8a
5 changed files with 58 additions and 30 deletions
|
@ -1,19 +1,15 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
<item android:id="@android: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>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:id="@+id/background">
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="#4d007eb3" />
|
||||
<corners android:radius="30dp" />
|
||||
</shape>
|
||||
</item>
|
||||
<item android:id="@+id/progress">
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="@color/color_white" />
|
||||
<corners android:radius="30dp" />
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
|
@ -1,12 +1,13 @@
|
|||
<?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>
|
||||
<shape android:shape="oval">
|
||||
<size
|
||||
android:height="12dp"
|
||||
android:width="12dp" />
|
||||
<solid android:color="@color/profile_icon_color_blue_light" />
|
||||
</shape>
|
||||
</item>
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<item android:id="@+id/thump">
|
||||
<shape android:shape="oval">
|
||||
<size
|
||||
android:width="12dp"
|
||||
android:height="12dp" />
|
||||
<solid android:color="@color/profile_icon_color_blue_light" />
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
|
@ -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" />
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -1,12 +1,18 @@
|
|||
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.core.content.ContextCompat;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
|
||||
|
@ -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,31 @@ public class AnnouncementTimeBottomSheet extends BasePreferenceBottomSheet
|
|||
AndroidUiHelper.updateVisibility(tvIntervalsDescr, !collapsed);
|
||||
}
|
||||
|
||||
private void setProfileColorToSeekBar() {
|
||||
int color = ContextCompat.getColor(app, getAppMode().getIconColorInfo().getColor(nightMode));
|
||||
|
||||
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(70);
|
||||
|
||||
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 {
|
||||
|
|
Loading…
Reference in a new issue