small refactor
This commit is contained in:
parent
6be3458ad3
commit
2151028d2d
5 changed files with 43 additions and 44 deletions
|
@ -16,16 +16,18 @@
|
||||||
app:title="@string/edit_online_source"
|
app:title="@string/edit_online_source"
|
||||||
osmand:titleTextColor="?android:textColorPrimary">
|
osmand:titleTextColor="?android:textColorPrimary">
|
||||||
|
|
||||||
<ImageView
|
<ImageButton
|
||||||
android:id="@+id/toolbar_action"
|
android:id="@+id/toolbar_action"
|
||||||
android:layout_width="@dimen/standard_icon_size"
|
style="@style/Widget.AppCompat.Toolbar.Button.Navigation"
|
||||||
android:layout_height="@dimen/standard_icon_size"
|
android:layout_width="@dimen/acceptable_touch_radius"
|
||||||
|
android:layout_height="@dimen/acceptable_touch_radius"
|
||||||
android:layout_gravity="end"
|
android:layout_gravity="end"
|
||||||
android:layout_marginStart="@dimen/content_padding"
|
android:layout_marginStart="@dimen/list_item_button_padding"
|
||||||
android:layout_marginLeft="@dimen/content_padding"
|
android:layout_marginLeft="@dimen/list_item_button_padding"
|
||||||
android:layout_marginEnd="@dimen/content_padding"
|
android:layout_marginEnd="@dimen/list_item_button_padding"
|
||||||
android:layout_marginRight="@dimen/content_padding"
|
android:layout_marginRight="@dimen/list_item_button_padding"
|
||||||
tools:src="@drawable/ic_action_help" />
|
android:contentDescription="@string/back_to_map"
|
||||||
|
app:srcCompat="@drawable/ic_action_help" />
|
||||||
|
|
||||||
</androidx.appcompat.widget.Toolbar>
|
</androidx.appcompat.widget.Toolbar>
|
||||||
|
|
||||||
|
@ -94,7 +96,7 @@
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="?attr/bg_color"
|
android:background="?attr/list_background_color"
|
||||||
android:minHeight="@dimen/dialog_button_ex_height"
|
android:minHeight="@dimen/dialog_button_ex_height"
|
||||||
android:paddingStart="@dimen/content_padding"
|
android:paddingStart="@dimen/content_padding"
|
||||||
android:paddingTop="@dimen/content_padding_small"
|
android:paddingTop="@dimen/content_padding_small"
|
||||||
|
|
|
@ -41,7 +41,6 @@ import net.osmand.AndroidUtils;
|
||||||
import net.osmand.Collator;
|
import net.osmand.Collator;
|
||||||
import net.osmand.IndexConstants;
|
import net.osmand.IndexConstants;
|
||||||
import net.osmand.OsmAndCollator;
|
import net.osmand.OsmAndCollator;
|
||||||
import net.osmand.ResultMatcher;
|
|
||||||
import net.osmand.map.ITileSource;
|
import net.osmand.map.ITileSource;
|
||||||
import net.osmand.map.TileSourceManager;
|
import net.osmand.map.TileSourceManager;
|
||||||
import net.osmand.plus.ContextMenuAdapter;
|
import net.osmand.plus.ContextMenuAdapter;
|
||||||
|
@ -63,7 +62,7 @@ import net.osmand.plus.download.DownloadIndexesThread.DownloadEvents;
|
||||||
import net.osmand.plus.download.IndexItem;
|
import net.osmand.plus.download.IndexItem;
|
||||||
import net.osmand.plus.helpers.FileNameTranslationHelper;
|
import net.osmand.plus.helpers.FileNameTranslationHelper;
|
||||||
import net.osmand.plus.inapp.InAppPurchaseHelper;
|
import net.osmand.plus.inapp.InAppPurchaseHelper;
|
||||||
import net.osmand.plus.mapsource.EditMapSourceDialogFragment;
|
import net.osmand.plus.mapsource.EditMapSourceDialogFragment.OnMapSourceUpdateListener;
|
||||||
import net.osmand.plus.rastermaps.OsmandRasterMapsPlugin;
|
import net.osmand.plus.rastermaps.OsmandRasterMapsPlugin;
|
||||||
import net.osmand.plus.resources.IncrementalChangesManager;
|
import net.osmand.plus.resources.IncrementalChangesManager;
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
|
@ -82,7 +81,8 @@ import java.util.Set;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
|
||||||
public class LocalIndexesFragment extends OsmandExpandableListFragment implements DownloadEvents, EditMapSourceDialogFragment.OnMapSourceUpdateListener {
|
public class LocalIndexesFragment extends OsmandExpandableListFragment implements DownloadEvents,
|
||||||
|
OnMapSourceUpdateListener {
|
||||||
public static final Pattern ILLEGAL_FILE_NAME_CHARACTERS = Pattern.compile("[?:\"*|/<>]");
|
public static final Pattern ILLEGAL_FILE_NAME_CHARACTERS = Pattern.compile("[?:\"*|/<>]");
|
||||||
public static final Pattern ILLEGAL_PATH_NAME_CHARACTERS = Pattern.compile("[?:\"*|<>]");
|
public static final Pattern ILLEGAL_PATH_NAME_CHARACTERS = Pattern.compile("[?:\"*|<>]");
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@ import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
|
import android.widget.ImageButton;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
@ -24,6 +25,7 @@ import androidx.annotation.Nullable;
|
||||||
import androidx.annotation.StringRes;
|
import androidx.annotation.StringRes;
|
||||||
import androidx.appcompat.app.AlertDialog;
|
import androidx.appcompat.app.AlertDialog;
|
||||||
import androidx.appcompat.widget.Toolbar;
|
import androidx.appcompat.widget.Toolbar;
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import androidx.fragment.app.FragmentManager;
|
import androidx.fragment.app.FragmentManager;
|
||||||
|
|
||||||
|
@ -52,12 +54,11 @@ import org.apache.commons.logging.Log;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static net.osmand.plus.download.ui.LocalIndexesFragment.ILLEGAL_FILE_NAME_CHARACTERS;
|
|
||||||
import static net.osmand.plus.download.ui.LocalIndexesFragment.renameSQLiteFile;
|
import static net.osmand.plus.download.ui.LocalIndexesFragment.renameSQLiteFile;
|
||||||
|
|
||||||
public class EditMapSourceDialogFragment extends BaseOsmAndDialogFragment
|
public class EditMapSourceDialogFragment extends BaseOsmAndDialogFragment
|
||||||
implements OnZoomSetListener, OnExpireValueSetListener, OnMercatorSelectedListener,
|
implements OnZoomSetListener, OnExpireValueSetListener, OnMercatorSelectedListener,
|
||||||
OnTileStorageFormatSelectedListener, View.OnClickListener {
|
OnTileStorageFormatSelectedListener {
|
||||||
|
|
||||||
public static final String TAG = EditMapSourceDialogFragment.class.getName();
|
public static final String TAG = EditMapSourceDialogFragment.class.getName();
|
||||||
static final int EXPIRE_TIME_NEVER = -1;
|
static final int EXPIRE_TIME_NEVER = -1;
|
||||||
|
@ -118,10 +119,10 @@ public class EditMapSourceDialogFragment extends BaseOsmAndDialogFragment
|
||||||
elliptic = savedInstanceState.getBoolean(ELLIPTIC_KEY);
|
elliptic = savedInstanceState.getBoolean(ELLIPTIC_KEY);
|
||||||
sqliteDB = savedInstanceState.getBoolean(SQLITE_DB_KEY);
|
sqliteDB = savedInstanceState.getBoolean(SQLITE_DB_KEY);
|
||||||
}
|
}
|
||||||
View root = UiUtilities.getMaterialInflater(getContext(), nightMode).inflate(R.layout.fragment_edit_map_source, container, false);
|
View root = UiUtilities.getMaterialInflater(app, nightMode).inflate(R.layout.fragment_edit_map_source, container, false);
|
||||||
Toolbar toolbar = root.findViewById(R.id.toolbar);
|
Toolbar toolbar = root.findViewById(R.id.toolbar);
|
||||||
ImageView iconHelp = root.findViewById(R.id.toolbar_action);
|
ImageButton iconHelp = root.findViewById(R.id.toolbar_action);
|
||||||
Drawable closeDrawable = app.getUIUtilities().getIcon(R.drawable.ic_arrow_back,
|
Drawable closeDrawable = app.getUIUtilities().getIcon(AndroidUtils.getNavigationIconResId(app),
|
||||||
nightMode ? R.color.active_buttons_and_links_text_dark : R.color.active_buttons_and_links_text_light);
|
nightMode ? R.color.active_buttons_and_links_text_dark : R.color.active_buttons_and_links_text_light);
|
||||||
Drawable helpDrawable = app.getUIUtilities().getIcon(R.drawable.ic_action_help,
|
Drawable helpDrawable = app.getUIUtilities().getIcon(R.drawable.ic_action_help,
|
||||||
nightMode ? R.color.active_buttons_and_links_text_dark : R.color.active_buttons_and_links_text_light);
|
nightMode ? R.color.active_buttons_and_links_text_dark : R.color.active_buttons_and_links_text_light);
|
||||||
|
@ -141,8 +142,8 @@ public class EditMapSourceDialogFragment extends BaseOsmAndDialogFragment
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
int boxStrokeColor = nightMode
|
int boxStrokeColor = nightMode
|
||||||
? getResources().getColor(R.color.app_bar_color_light)
|
? ContextCompat.getColor(app, R.color.app_bar_color_light)
|
||||||
: getResources().getColor(R.color.active_buttons_and_links_bg_pressed_dark);
|
: ContextCompat.getColor(app, R.color.active_buttons_and_links_bg_pressed_dark);
|
||||||
TextInputLayout nameInputLayout = root.findViewById(R.id.name_input_layout);
|
TextInputLayout nameInputLayout = root.findViewById(R.id.name_input_layout);
|
||||||
nameInputLayout.setBoxStrokeColor(boxStrokeColor);
|
nameInputLayout.setBoxStrokeColor(boxStrokeColor);
|
||||||
nameEditText = root.findViewById(R.id.name_edit_text);
|
nameEditText = root.findViewById(R.id.name_edit_text);
|
||||||
|
@ -154,7 +155,13 @@ public class EditMapSourceDialogFragment extends BaseOsmAndDialogFragment
|
||||||
contentContainer = root.findViewById(R.id.content_container);
|
contentContainer = root.findViewById(R.id.content_container);
|
||||||
saveBtn = root.findViewById(R.id.save_button);
|
saveBtn = root.findViewById(R.id.save_button);
|
||||||
saveBtnTitle = root.findViewById(R.id.save_button_title);
|
saveBtnTitle = root.findViewById(R.id.save_button_title);
|
||||||
saveBtn.setOnClickListener(this);
|
saveBtn.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
saveTemplate();
|
||||||
|
dismiss();
|
||||||
|
}
|
||||||
|
});
|
||||||
template = new TileSourceManager.TileSourceTemplate("", "", PNG_EXT, MAX_ZOOM, MIN_ZOOM, TILE_SIZE, BIT_DENSITY, AVG_SIZE);
|
template = new TileSourceManager.TileSourceTemplate("", "", PNG_EXT, MAX_ZOOM, MIN_ZOOM, TILE_SIZE, BIT_DENSITY, AVG_SIZE);
|
||||||
if (editedLayerName != null) {
|
if (editedLayerName != null) {
|
||||||
if (!editedLayerName.endsWith(IndexConstants.SQLITE_EXT)) {
|
if (!editedLayerName.endsWith(IndexConstants.SQLITE_EXT)) {
|
||||||
|
@ -222,20 +229,16 @@ public class EditMapSourceDialogFragment extends BaseOsmAndDialogFragment
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onZoomSet(int min, int max) {
|
public void onZoomSet(int min, int max) {
|
||||||
if (isAdded()) {
|
|
||||||
minZoom = min;
|
minZoom = min;
|
||||||
maxZoom = max;
|
maxZoom = max;
|
||||||
updateDescription(ConfigurationItem.ZOOM_LEVELS);
|
updateDescription(ConfigurationItem.ZOOM_LEVELS);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onExpireValueSet(int expireValue) {
|
public void onExpireValueSet(int expireValue) {
|
||||||
if (isAdded()) {
|
|
||||||
expireTimeMinutes = expireValue;
|
expireTimeMinutes = expireValue;
|
||||||
updateDescription(ConfigurationItem.EXPIRE_TIME);
|
updateDescription(ConfigurationItem.EXPIRE_TIME);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onMercatorSelected(boolean elliptic) {
|
public void onMercatorSelected(boolean elliptic) {
|
||||||
|
@ -253,14 +256,6 @@ public class EditMapSourceDialogFragment extends BaseOsmAndDialogFragment
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onClick(View view) {
|
|
||||||
if (view.getId() == R.id.save_button) {
|
|
||||||
saveTemplate();
|
|
||||||
dismiss();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private TextWatcher getTextWatcher() {
|
private TextWatcher getTextWatcher() {
|
||||||
return new TextWatcher() {
|
return new TextWatcher() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -390,7 +385,7 @@ public class EditMapSourceDialogFragment extends BaseOsmAndDialogFragment
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
FragmentManager fm = getFragmentManager();
|
FragmentManager fm = getFragmentManager();
|
||||||
if (fm != null) {
|
if (fm != null && !fm.isStateSaved()) {
|
||||||
switch (item) {
|
switch (item) {
|
||||||
case ZOOM_LEVELS:
|
case ZOOM_LEVELS:
|
||||||
InputZoomLevelsBottomSheet.showInstance(
|
InputZoomLevelsBottomSheet.showInstance(
|
||||||
|
@ -415,7 +410,7 @@ public class EditMapSourceDialogFragment extends BaseOsmAndDialogFragment
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addConfigurationItems(ConfigurationItem... items) {
|
private void addConfigurationItems(ConfigurationItem... items) {
|
||||||
LayoutInflater inflater = UiUtilities.getMaterialInflater(getContext(), nightMode);
|
LayoutInflater inflater = UiUtilities.getMaterialInflater(app, nightMode);
|
||||||
for (ConfigurationItem item : items) {
|
for (ConfigurationItem item : items) {
|
||||||
View view = inflater.inflate(R.layout.list_item_ui_customization, null);
|
View view = inflater.inflate(R.layout.list_item_ui_customization, null);
|
||||||
((ImageView) view.findViewById(R.id.icon)).setImageDrawable(app.getUIUtilities().getIcon(item.iconRes, nightMode));
|
((ImageView) view.findViewById(R.id.icon)).setImageDrawable(app.getUIUtilities().getIcon(item.iconRes, nightMode));
|
||||||
|
|
|
@ -7,7 +7,7 @@ import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.annotation.StringRes;
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import androidx.fragment.app.FragmentManager;
|
import androidx.fragment.app.FragmentManager;
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@ import com.google.android.material.textfield.TextInputEditText;
|
||||||
import com.google.android.material.textfield.TextInputLayout;
|
import com.google.android.material.textfield.TextInputLayout;
|
||||||
|
|
||||||
import net.osmand.PlatformUtil;
|
import net.osmand.PlatformUtil;
|
||||||
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.UiUtilities;
|
import net.osmand.plus.UiUtilities;
|
||||||
import net.osmand.plus.base.MenuBottomSheetDialogFragment;
|
import net.osmand.plus.base.MenuBottomSheetDialogFragment;
|
||||||
|
@ -45,6 +46,7 @@ public class ExpireTimeBottomSheet extends MenuBottomSheetDialogFragment {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void createMenuItems(Bundle savedInstanceState) {
|
public void createMenuItems(Bundle savedInstanceState) {
|
||||||
|
OsmandApplication app = requiredMyApplication();
|
||||||
if (savedInstanceState != null) {
|
if (savedInstanceState != null) {
|
||||||
expireValue = savedInstanceState.getInt(EXPIRE_VALUE_KEY, EXPIRE_TIME_NEVER);
|
expireValue = savedInstanceState.getInt(EXPIRE_VALUE_KEY, EXPIRE_TIME_NEVER);
|
||||||
}
|
}
|
||||||
|
@ -58,8 +60,8 @@ public class ExpireTimeBottomSheet extends MenuBottomSheetDialogFragment {
|
||||||
editText.setText(String.valueOf(expireValue));
|
editText.setText(String.valueOf(expireValue));
|
||||||
}
|
}
|
||||||
int boxStrokeColor = nightMode
|
int boxStrokeColor = nightMode
|
||||||
? getResources().getColor(R.color.app_bar_color_light)
|
? ContextCompat.getColor(app, R.color.app_bar_color_light)
|
||||||
: getResources().getColor(R.color.active_buttons_and_links_bg_pressed_dark);
|
: ContextCompat.getColor(app, R.color.active_buttons_and_links_bg_pressed_dark);
|
||||||
TextInputLayout textInputLayout = inputValueLayout.findViewById(R.id.value_input_layout);
|
TextInputLayout textInputLayout = inputValueLayout.findViewById(R.id.value_input_layout);
|
||||||
textInputLayout.setBoxStrokeColor(boxStrokeColor);
|
textInputLayout.setBoxStrokeColor(boxStrokeColor);
|
||||||
final SimpleBottomSheetItem editTextItem = (SimpleBottomSheetItem) new SimpleBottomSheetItem.Builder()
|
final SimpleBottomSheetItem editTextItem = (SimpleBottomSheetItem) new SimpleBottomSheetItem.Builder()
|
||||||
|
@ -70,13 +72,12 @@ public class ExpireTimeBottomSheet extends MenuBottomSheetDialogFragment {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSaveInstanceState(Bundle outState) {
|
public void onSaveInstanceState(Bundle outState) {
|
||||||
outState.putLong(EXPIRE_VALUE_KEY, getExpireValue());
|
outState.putInt(EXPIRE_VALUE_KEY, getExpireValue());
|
||||||
super.onSaveInstanceState(outState);
|
super.onSaveInstanceState(outState);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onRightBottomButtonClick() {
|
protected void onRightBottomButtonClick() {
|
||||||
super.onRightBottomButtonClick();
|
|
||||||
Fragment fragment = getTargetFragment();
|
Fragment fragment = getTargetFragment();
|
||||||
if (fragment instanceof OnExpireValueSetListener) {
|
if (fragment instanceof OnExpireValueSetListener) {
|
||||||
((OnExpireValueSetListener) fragment).onExpireValueSet(getExpireValue());
|
((OnExpireValueSetListener) fragment).onExpireValueSet(getExpireValue());
|
||||||
|
|
|
@ -17,6 +17,7 @@ import androidx.fragment.app.FragmentManager;
|
||||||
import com.google.android.material.slider.Slider;
|
import com.google.android.material.slider.Slider;
|
||||||
|
|
||||||
import net.osmand.PlatformUtil;
|
import net.osmand.PlatformUtil;
|
||||||
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.UiUtilities;
|
import net.osmand.plus.UiUtilities;
|
||||||
import net.osmand.plus.base.MenuBottomSheetDialogFragment;
|
import net.osmand.plus.base.MenuBottomSheetDialogFragment;
|
||||||
|
@ -38,7 +39,7 @@ public class InputZoomLevelsBottomSheet extends MenuBottomSheetDialogFragment {
|
||||||
private static final String SLIDER_DESCR_RES_KEY = "slider_descr_key";
|
private static final String SLIDER_DESCR_RES_KEY = "slider_descr_key";
|
||||||
private static final String DIALOG_DESCR_RES_KEY = "dialog_descr_key";
|
private static final String DIALOG_DESCR_RES_KEY = "dialog_descr_key";
|
||||||
private static final int SLIDER_FROM = 1;
|
private static final int SLIDER_FROM = 1;
|
||||||
private static final int SLIDER_TO = 20;
|
private static final int SLIDER_TO = 22;
|
||||||
@StringRes
|
@StringRes
|
||||||
private int sliderDescrRes;
|
private int sliderDescrRes;
|
||||||
@StringRes
|
@StringRes
|
||||||
|
@ -63,13 +64,14 @@ public class InputZoomLevelsBottomSheet extends MenuBottomSheetDialogFragment {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void createMenuItems(Bundle savedInstanceState) {
|
public void createMenuItems(Bundle savedInstanceState) {
|
||||||
|
OsmandApplication app = requiredMyApplication();
|
||||||
if (savedInstanceState != null) {
|
if (savedInstanceState != null) {
|
||||||
minZoom = savedInstanceState.getInt(MIN_ZOOM_KEY);
|
minZoom = savedInstanceState.getInt(MIN_ZOOM_KEY);
|
||||||
maxZoom = savedInstanceState.getInt(MAX_ZOOM_KEY);
|
maxZoom = savedInstanceState.getInt(MAX_ZOOM_KEY);
|
||||||
dialogDescrRes = savedInstanceState.getInt(DIALOG_DESCR_RES_KEY);
|
dialogDescrRes = savedInstanceState.getInt(DIALOG_DESCR_RES_KEY);
|
||||||
sliderDescrRes = savedInstanceState.getInt(SLIDER_DESCR_RES_KEY);
|
sliderDescrRes = savedInstanceState.getInt(SLIDER_DESCR_RES_KEY);
|
||||||
}
|
}
|
||||||
LayoutInflater inflater = UiUtilities.getInflater(requiredMyApplication(), nightMode);
|
LayoutInflater inflater = UiUtilities.getInflater(app, nightMode);
|
||||||
TitleItem titleItem = new TitleItem(getString(R.string.shared_string_zoom_levels));
|
TitleItem titleItem = new TitleItem(getString(R.string.shared_string_zoom_levels));
|
||||||
items.add(titleItem);
|
items.add(titleItem);
|
||||||
final View sliderView = inflater.inflate(R.layout.zoom_levels_with_descr, null);
|
final View sliderView = inflater.inflate(R.layout.zoom_levels_with_descr, null);
|
||||||
|
@ -88,8 +90,8 @@ public class InputZoomLevelsBottomSheet extends MenuBottomSheetDialogFragment {
|
||||||
final TextView maxZoomValue = sliderView.findViewById(R.id.zoom_value_max);
|
final TextView maxZoomValue = sliderView.findViewById(R.id.zoom_value_max);
|
||||||
maxZoomValue.setText(String.valueOf(maxZoom));
|
maxZoomValue.setText(String.valueOf(maxZoom));
|
||||||
Slider slider = sliderView.findViewById(R.id.zoom_slider);
|
Slider slider = sliderView.findViewById(R.id.zoom_slider);
|
||||||
int colorProfileRes = requiredMyApplication().getSettings().getApplicationMode().getIconColorInfo().getColor(nightMode);
|
int colorProfileRes = app.getSettings().getApplicationMode().getIconColorInfo().getColor(nightMode);
|
||||||
int colorProfile = ContextCompat.getColor(requiredMyApplication(), colorProfileRes);
|
int colorProfile = ContextCompat.getColor(app, colorProfileRes);
|
||||||
UiUtilities.setupSlider(slider, nightMode, colorProfile, true);
|
UiUtilities.setupSlider(slider, nightMode, colorProfile, true);
|
||||||
slider.setValueFrom(SLIDER_FROM);
|
slider.setValueFrom(SLIDER_FROM);
|
||||||
slider.setValueTo(SLIDER_TO);
|
slider.setValueTo(SLIDER_TO);
|
||||||
|
@ -136,7 +138,6 @@ public class InputZoomLevelsBottomSheet extends MenuBottomSheetDialogFragment {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onRightBottomButtonClick() {
|
protected void onRightBottomButtonClick() {
|
||||||
super.onRightBottomButtonClick();
|
|
||||||
Fragment fragment = getTargetFragment();
|
Fragment fragment = getTargetFragment();
|
||||||
if (fragment instanceof OnZoomSetListener) {
|
if (fragment instanceof OnZoomSetListener) {
|
||||||
((OnZoomSetListener) fragment).onZoomSet(minZoom, maxZoom);
|
((OnZoomSetListener) fragment).onZoomSet(minZoom, maxZoom);
|
||||||
|
|
Loading…
Reference in a new issue