Merge remote-tracking branch 'origin/master' into exp_imp_profile_with_features
This commit is contained in:
commit
5f4285fe26
25 changed files with 202 additions and 48 deletions
10
OsmAnd/res/drawable/ic_checkbox_indeterminate.xml
Normal file
10
OsmAnd/res/drawable/ic_checkbox_indeterminate.xml
Normal file
|
@ -0,0 +1,10 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M5,3H19C20.1,3 21,3.9 21,5V19C21,20.1 20.1,21 19,21H5C3.9,21 3,20.1 3,19V5C3,3.9 3.9,3 5,3ZM7,11C6.4477,11 6,11.4477 6,12C6,12.5523 6.4477,13 7,13H17C17.5523,13 18,12.5523 18,12C18,11.4477 17.5523,11 17,11H7Z"
|
||||
android:fillColor="#727272"
|
||||
android:fillType="evenOdd"/>
|
||||
</vector>
|
|
@ -35,6 +35,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:letterSpacing="@dimen/text_button_letter_spacing"
|
||||
android:maxLines="2"
|
||||
android:textColor="?attr/app_bar_primary_item_color"
|
||||
android:textSize="@dimen/dialog_header_text_size"
|
||||
|
@ -46,6 +47,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:letterSpacing="@dimen/description_letter_spacing"
|
||||
android:maxLines="2"
|
||||
android:textColor="?attr/pstsInactiveTextColor"
|
||||
android:textSize="@dimen/default_desc_text_size"
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
android:id="@android:id/title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:letterSpacing="@dimen/description_letter_spacing"
|
||||
android:paddingLeft="@dimen/content_padding"
|
||||
android:paddingTop="@dimen/content_padding_small"
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/content_padding_half"
|
||||
android:layout_marginRight="@dimen/content_padding_half"
|
||||
android:background="?attr/list_background_color">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/selectable_list_item"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/content_padding_half"
|
||||
android:layout_marginRight="@dimen/content_padding_half"
|
||||
android:minHeight="@dimen/bottom_sheet_list_item_height"
|
||||
android:orientation="horizontal">
|
||||
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:ellipsize="marquee"
|
||||
android:singleLine="true"
|
||||
android:letterSpacing="@dimen/text_button_letter_spacing"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
osmand:typeface="@string/font_roboto_regular" />
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:ellipsize="marquee"
|
||||
android:fadingEdge="horizontal"
|
||||
android:letterSpacing="@dimen/text_button_letter_spacing"
|
||||
android:maxLines="2"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
|
|
|
@ -72,7 +72,7 @@
|
|||
<string name="poi_music">Музыкальный магазин</string>
|
||||
<string name="poi_newsagent">Газеты и журналы</string>
|
||||
<string name="poi_optician">Оптика</string>
|
||||
<string name="poi_organic">Биопродукты;Экологически чистые продукты;Органическая пища</string>
|
||||
<string name="poi_organic">Биопродукты;Экологически чистые продукты;Органические продукты</string>
|
||||
<string name="poi_outdoor">Товары для активного отдыха</string>
|
||||
<string name="poi_paint">Магазин красок</string>
|
||||
<string name="poi_pet">Зоомагазин;Товары для животных</string>
|
||||
|
|
|
@ -422,8 +422,8 @@
|
|||
<color name="app_bar_main_light">#ff8800</color>
|
||||
<color name="status_bar_main_dark">#101112</color>
|
||||
<color name="status_bar_main_light">#E68200</color>
|
||||
<color name="navigation_bar_bg_light">#CCCCCC</color>
|
||||
<color name="navigation_bar_bg_dark">#2B2E31</color>
|
||||
<color name="navigation_bar_bg_light">#000000</color>
|
||||
<color name="navigation_bar_bg_dark">#000000</color>
|
||||
|
||||
<color name="activity_background_dark">#17181a</color>
|
||||
<color name="activity_background_light">#f0f0f0</color>
|
||||
|
|
|
@ -260,7 +260,7 @@
|
|||
<string name="poi_musical_instrument">Musical instruments</string>
|
||||
<string name="poi_newsagent">Newsagent</string>
|
||||
<string name="poi_optician">Optometrist</string>
|
||||
<string name="poi_organic">Organic food</string>
|
||||
<string name="poi_organic">Organic products</string>
|
||||
<string name="poi_outdoor">Outdoor store</string>
|
||||
<string name="poi_paint">Paint store</string>
|
||||
<string name="poi_pet">Pet store</string>
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
Thx - Hardy
|
||||
|
||||
-->
|
||||
<string name="accessibility_mode_disabled">Accessibility mode disabled in your system.</string>
|
||||
<string name="rearrange_categories">Rearrange categories</string>
|
||||
<string name="create_custom_categories_list_promo">You can add custom categories hide categories that you don’t find necessary and change the sort order of the list. The list can be imported and exported with profiles.</string>
|
||||
<string name="add_new_custom_category_button_promo">You can add a new custom category by selecting one or a few needed categories.</string>
|
||||
|
|
|
@ -3,6 +3,14 @@
|
|||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:title="@string/shared_string_accessibility">
|
||||
|
||||
<Preference
|
||||
android:icon="@drawable/ic_action_android"
|
||||
android:key="accessibility_options"
|
||||
android:layout="@layout/preference_permission"
|
||||
android:persistent="false"
|
||||
android:summary="@string/shared_string_enable"
|
||||
android:title="@string/accessibility_mode_disabled" />
|
||||
|
||||
<net.osmand.plus.settings.preferences.ListPreferenceEx
|
||||
android:icon="@drawable/ic_action_android"
|
||||
android:key="accessibility_mode"
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
<Preference
|
||||
android:key="osm_editing_info"
|
||||
android:layout="@layout/preference_with_descr"
|
||||
android:layout="@layout/preference_info"
|
||||
android:persistent="false"
|
||||
android:selectable="false"
|
||||
android:title="@string/plugin_global_prefs_info"
|
||||
|
@ -21,12 +21,12 @@
|
|||
tools:summary="@string/open_street_map_login_descr" />
|
||||
|
||||
<net.osmand.plus.settings.preferences.SwitchPreferenceEx
|
||||
android:icon="@drawable/ic_action_offline"
|
||||
android:key="offline_osm_editing"
|
||||
android:layout="@layout/preference_with_descr_dialog_and_switch"
|
||||
android:summaryOff="@string/shared_string_disabled"
|
||||
android:summaryOn="@string/shared_string_enabled"
|
||||
android:title="@string/offline_edition" />
|
||||
android:title="@string/offline_edition"
|
||||
tools:icon="@drawable/ic_action_offline" />
|
||||
|
||||
<Preference
|
||||
android:layout="@layout/simple_divider_item"
|
||||
|
|
|
@ -1,12 +1,26 @@
|
|||
package net.osmand.access;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.LayerDrawable;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.provider.Settings;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.support.v7.preference.Preference;
|
||||
import android.support.v7.preference.PreferenceScreen;
|
||||
import android.support.v7.preference.PreferenceViewHolder;
|
||||
import android.view.View;
|
||||
import android.view.accessibility.AccessibilityManager;
|
||||
import android.view.accessibility.AccessibilityManager.AccessibilityStateChangeListener;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.plus.ApplicationMode;
|
||||
import net.osmand.plus.OsmandPlugin;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.access.AccessibilityMode;
|
||||
import net.osmand.plus.access.RelativeDirectionStyle;
|
||||
import net.osmand.plus.monitoring.OsmandMonitoringPlugin;
|
||||
|
@ -21,11 +35,28 @@ import net.osmand.plus.settings.preferences.SwitchPreferenceEx;
|
|||
|
||||
public class AccessibilitySettingsFragment extends BaseSettingsFragment implements OnPreferenceChanged, CopyAppModePrefsListener, ResetAppModePrefsListener {
|
||||
|
||||
private static final String ACCESSIBILITY_OPTIONS = "accessibility_options";
|
||||
private static final String COPY_PLUGIN_SETTINGS = "copy_plugin_settings";
|
||||
private static final String RESET_TO_DEFAULT = "reset_to_default";
|
||||
|
||||
private AccessibilityStateChangeListener accessibilityListener;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
accessibilityListener = new AccessibilityStateChangeListener() {
|
||||
@Override
|
||||
public void onAccessibilityStateChanged(boolean b) {
|
||||
if (isResumed() && useSystemAccessibility()) {
|
||||
updateAllSettings();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setupPreferences() {
|
||||
setupAccessibilityPermissionPref();
|
||||
setupAccessibilityModePref();
|
||||
setupSpeechRatePref();
|
||||
|
||||
|
@ -45,6 +76,43 @@ public class AccessibilitySettingsFragment extends BaseSettingsFragment implemen
|
|||
updateAccessibilityOptions();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
Preference accessibilityPrefs = findPreference(ACCESSIBILITY_OPTIONS);
|
||||
if (useSystemAccessibility() && accessibilityPrefs.isVisible() == app.systemAccessibilityEnabled()) {
|
||||
updateAllSettings();
|
||||
}
|
||||
AccessibilityManager accessibilityManager = (AccessibilityManager) app.getSystemService(Context.ACCESSIBILITY_SERVICE);
|
||||
accessibilityManager.addAccessibilityStateChangeListener(accessibilityListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
AccessibilityManager accessibilityManager = (AccessibilityManager) app.getSystemService(Context.ACCESSIBILITY_SERVICE);
|
||||
accessibilityManager.removeAccessibilityStateChangeListener(accessibilityListener);
|
||||
}
|
||||
|
||||
private void setupAccessibilityPermissionPref() {
|
||||
Preference accessibilityPrefs = findPreference(ACCESSIBILITY_OPTIONS);
|
||||
if (!useSystemAccessibility() || app.systemAccessibilityEnabled()) {
|
||||
accessibilityPrefs.setVisible(false);
|
||||
} else {
|
||||
Intent accessibilitySettings = new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS);
|
||||
accessibilityPrefs.setVisible(true);
|
||||
if (accessibilitySettings.resolveActivity(app.getPackageManager()) != null) {
|
||||
accessibilityPrefs.setIntent(accessibilitySettings);
|
||||
} else {
|
||||
accessibilityPrefs.setSummary(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean useSystemAccessibility() {
|
||||
return AccessibilityMode.DEFAULT == settings.ACCESSIBILITY_MODE.getModeValue(getSelectedAppMode());
|
||||
}
|
||||
|
||||
private void setupAccessibilityModePref() {
|
||||
AccessibilityMode[] accessibilityModes = AccessibilityMode.values();
|
||||
String[] entries = new String[accessibilityModes.length];
|
||||
|
@ -151,10 +219,34 @@ public class AccessibilitySettingsFragment extends BaseSettingsFragment implemen
|
|||
resetToDefault.setIcon(getActiveIcon(R.drawable.ic_action_reset_to_default_dark));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onBindPreferenceViewHolder(Preference preference, PreferenceViewHolder holder) {
|
||||
super.onBindPreferenceViewHolder(preference, holder);
|
||||
if (ACCESSIBILITY_OPTIONS.equals(preference.getKey())) {
|
||||
View selectableView = holder.itemView.findViewById(R.id.selectable_list_item);
|
||||
if (selectableView != null) {
|
||||
int color = AndroidUtils.getColorFromAttr(app, R.attr.activity_background_color);
|
||||
int selectedColor = UiUtilities.getColorWithAlpha(getActiveProfileColor(), 0.3f);
|
||||
|
||||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) {
|
||||
Drawable bgDrawable = getPaintedIcon(R.drawable.rectangle_rounded, color);
|
||||
Drawable selectable = getPaintedIcon(R.drawable.ripple_rectangle_rounded, selectedColor);
|
||||
Drawable[] layers = {bgDrawable, selectable};
|
||||
AndroidUtils.setBackground(selectableView, new LayerDrawable(layers));
|
||||
} else {
|
||||
Drawable bgDrawable = getPaintedIcon(R.drawable.rectangle_rounded, color);
|
||||
AndroidUtils.setBackground(selectableView, bgDrawable);
|
||||
}
|
||||
LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) selectableView.getLayoutParams();
|
||||
params.setMargins(params.leftMargin, AndroidUtils.dpToPx(app, 6), params.rightMargin, params.bottomMargin);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPreferenceChanged(String prefId) {
|
||||
if (settings.ACCESSIBILITY_MODE.getId().equals(prefId)) {
|
||||
updateAccessibilityOptions();
|
||||
updateAllSettings();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -202,8 +294,11 @@ public class AccessibilitySettingsFragment extends BaseSettingsFragment implemen
|
|||
for (int i = 0; i < screen.getPreferenceCount(); i++) {
|
||||
Preference preference = screen.getPreference(i);
|
||||
String prefId = preference.getKey();
|
||||
if (!settings.ACCESSIBILITY_MODE.getId().equals(prefId) && !settings.SPEECH_RATE.getId().equals(prefId)
|
||||
&& !RESET_TO_DEFAULT.equals(prefId) && !COPY_PLUGIN_SETTINGS.equals(prefId))
|
||||
if (!settings.ACCESSIBILITY_MODE.getId().equals(prefId)
|
||||
&& !settings.SPEECH_RATE.getId().equals(prefId)
|
||||
&& !RESET_TO_DEFAULT.equals(prefId)
|
||||
&& !COPY_PLUGIN_SETTINGS.equals(prefId)
|
||||
&& !ACCESSIBILITY_OPTIONS.equals(prefId))
|
||||
preference.setEnabled(accessibilityEnabled);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -886,6 +886,10 @@ public class OsmandApplication extends MultiDexApplication {
|
|||
} else if (mode == AccessibilityMode.OFF) {
|
||||
return false;
|
||||
}
|
||||
return systemAccessibilityEnabled();
|
||||
}
|
||||
|
||||
public boolean systemAccessibilityEnabled() {
|
||||
return ((AccessibilityManager) getSystemService(Context.ACCESSIBILITY_SERVICE)).isEnabled();
|
||||
}
|
||||
|
||||
|
|
|
@ -1784,7 +1784,7 @@ public class OsmandSettings {
|
|||
|
||||
public static final Integer REC_DIRECTORY = 0;
|
||||
public static final Integer MONTHLY_DIRECTORY = 1;
|
||||
public static final Integer DAILY_DIRECTORY = 2;
|
||||
// public static final Integer DAILY_DIRECTORY = 2;
|
||||
|
||||
public final CommonPreference<Boolean> DISABLE_RECORDING_ONCE_APP_KILLED = new BooleanPreference("disable_recording_once_app_killed", false).makeProfile();
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@ package net.osmand.plus.activities;
|
|||
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.support.annotation.DrawableRes;
|
||||
import android.support.annotation.StringRes;
|
||||
|
||||
|
@ -75,9 +74,8 @@ public class LocalIndexHelper {
|
|||
return;
|
||||
}
|
||||
String descr = "";
|
||||
descr += app.getString(R.string.local_index_tile_data_name, template.getName());
|
||||
if (template.getExpirationTimeMinutes() >= 0) {
|
||||
descr += "\n" + app.getString(R.string.local_index_tile_data_expire, template.getExpirationTimeMinutes());
|
||||
descr += app.getString(R.string.local_index_tile_data_expire, String.valueOf(template.getExpirationTimeMinutes()));
|
||||
}
|
||||
info.setAttachedObject(template);
|
||||
info.setDescription(descr);
|
||||
|
|
|
@ -216,9 +216,9 @@ public class SavingTrackHelper extends SQLiteOpenHelper {
|
|||
Integer track_storage_directory = ctx.getSettings().TRACK_STORAGE_DIRECTORY.get();
|
||||
if (track_storage_directory != OsmandSettings.REC_DIRECTORY) {
|
||||
SimpleDateFormat dateDirFormat = new SimpleDateFormat("yyyy-MM");
|
||||
if (track_storage_directory == OsmandSettings.DAILY_DIRECTORY) {
|
||||
dateDirFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
}
|
||||
// if (track_storage_directory == OsmandSettings.DAILY_DIRECTORY) {
|
||||
// dateDirFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
// }
|
||||
String dateDirName = dateDirFormat.format(new Date(pt.time));
|
||||
File dateDir = new File(dir, dateDirName);
|
||||
dateDir.mkdirs();
|
||||
|
|
|
@ -1236,8 +1236,8 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment implement
|
|||
return true;
|
||||
}
|
||||
});
|
||||
if (info.getType() == LocalIndexType.TILES_DATA && (info.getAttachedObject() instanceof ITileSource) &&
|
||||
((ITileSource) info.getAttachedObject()).couldBeDownloadedFromInternet()) {
|
||||
if (info.getType() == LocalIndexType.TILES_DATA
|
||||
&& (info.getAttachedObject() instanceof TileSourceManager.TileSourceTemplate)) {
|
||||
item = optionsMenu.getMenu().add(R.string.shared_string_edit)
|
||||
.setIcon(iconsCache.getThemedIcon(R.drawable.ic_action_edit_dark));
|
||||
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||
|
@ -1248,8 +1248,8 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment implement
|
|||
}
|
||||
});
|
||||
}
|
||||
if (info.getType() == LocalIndexType.TILES_DATA && (info.getAttachedObject() instanceof ITileSource) &&
|
||||
((ITileSource)info.getAttachedObject()).couldBeDownloadedFromInternet()) {
|
||||
if (info.getType() == LocalIndexType.TILES_DATA && (info.getAttachedObject() instanceof ITileSource)
|
||||
&& ((ITileSource) info.getAttachedObject()).couldBeDownloadedFromInternet()) {
|
||||
item = optionsMenu.getMenu().add(R.string.clear_tile_data)
|
||||
.setIcon(iconsCache.getThemedIcon(R.drawable.ic_action_remove_dark));
|
||||
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||
|
|
|
@ -29,7 +29,6 @@ import java.io.Serializable;
|
|||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
import static net.osmand.plus.OsmandSettings.DAILY_DIRECTORY;
|
||||
import static net.osmand.plus.OsmandSettings.MONTHLY_DIRECTORY;
|
||||
import static net.osmand.plus.OsmandSettings.REC_DIRECTORY;
|
||||
import static net.osmand.plus.monitoring.OsmandMonitoringPlugin.MINUTES;
|
||||
|
@ -195,11 +194,11 @@ public class MonitoringSettingsFragment extends BaseSettingsFragment implements
|
|||
}
|
||||
|
||||
private void setupTrackStorageDirectoryPref() {
|
||||
Integer[] entryValues = new Integer[] {REC_DIRECTORY, MONTHLY_DIRECTORY, DAILY_DIRECTORY};
|
||||
Integer[] entryValues = new Integer[] {REC_DIRECTORY, MONTHLY_DIRECTORY};
|
||||
String[] entries = new String[entryValues.length];
|
||||
entries[0] = getString(R.string.store_tracks_in_rec_directory);
|
||||
entries[1] = getString(R.string.store_tracks_in_monthly_directories);
|
||||
entries[2] = getString(R.string.store_tracks_in_daily_directories);
|
||||
// entries[2] = getString(R.string.store_tracks_in_daily_directories);
|
||||
|
||||
ListPreferenceEx trackStorageDirectory = (ListPreferenceEx) findPreference(settings.TRACK_STORAGE_DIRECTORY.getId());
|
||||
trackStorageDirectory.setEntries(entries);
|
||||
|
|
|
@ -37,7 +37,6 @@ import net.osmand.plus.activities.SettingsBaseActivity;
|
|||
|
||||
import java.util.Map;
|
||||
|
||||
import static net.osmand.plus.OsmandSettings.DAILY_DIRECTORY;
|
||||
import static net.osmand.plus.OsmandSettings.MONTHLY_DIRECTORY;
|
||||
import static net.osmand.plus.OsmandSettings.REC_DIRECTORY;
|
||||
|
||||
|
@ -156,11 +155,11 @@ public class SettingsMonitoringActivity extends SettingsBaseActivity {
|
|||
cat.addPreference(createCheckBoxPreference(settings.SAVE_HEADING_TO_GPX, R.string.save_heading,
|
||||
R.string.save_heading_descr));
|
||||
|
||||
Integer[] intValues = new Integer[]{REC_DIRECTORY, MONTHLY_DIRECTORY, DAILY_DIRECTORY};
|
||||
Integer[] intValues = new Integer[]{REC_DIRECTORY, MONTHLY_DIRECTORY};
|
||||
names = new String[intValues.length];
|
||||
names[0] = getString(R.string.store_tracks_in_rec_directory);
|
||||
names[1] = getString(R.string.store_tracks_in_monthly_directories);
|
||||
names[2] = getString(R.string.store_tracks_in_daily_directories);
|
||||
// names[2] = getString(R.string.store_tracks_in_daily_directories);
|
||||
cat.addPreference(createListPreference(settings.TRACK_STORAGE_DIRECTORY, names, intValues,
|
||||
R.string.track_storage_directory, R.string.track_storage_directory_descrp));
|
||||
}
|
||||
|
|
|
@ -2,8 +2,10 @@ package net.osmand.plus.osmedit;
|
|||
|
||||
import android.content.Intent;
|
||||
import android.graphics.Typeface;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.support.v7.preference.Preference;
|
||||
import android.support.v7.preference.PreferenceViewHolder;
|
||||
import android.text.SpannableString;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
@ -21,12 +23,13 @@ import net.osmand.plus.widgets.style.CustomTypefaceSpan;
|
|||
|
||||
public class OsmEditingFragment extends BaseSettingsFragment implements OnPreferenceChanged {
|
||||
|
||||
private static final String OSM_EDITING_INFO = "osm_editing_info";
|
||||
private static final String OPEN_OSM_EDITS = "open_osm_edits";
|
||||
private static final String OSM_LOGIN_DATA = "osm_login_data";
|
||||
|
||||
@Override
|
||||
protected void setupPreferences() {
|
||||
Preference osmEditingInfo = findPreference("osm_editing_info");
|
||||
Preference osmEditingInfo = findPreference(OSM_EDITING_INFO);
|
||||
osmEditingInfo.setIcon(getContentIcon(R.drawable.ic_action_info_dark));
|
||||
|
||||
setupNameAndPasswordPref();
|
||||
|
@ -44,6 +47,15 @@ public class OsmEditingFragment extends BaseSettingsFragment implements OnPrefer
|
|||
AndroidUiHelper.updateVisibility(toolbarSubtitle, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onBindPreferenceViewHolder(Preference preference, PreferenceViewHolder holder) {
|
||||
super.onBindPreferenceViewHolder(preference, holder);
|
||||
if (OSM_EDITING_INFO.equals(preference.getKey())) {
|
||||
TextView titleView = (TextView) holder.findViewById(android.R.id.title);
|
||||
titleView.setTextSize(16);
|
||||
}
|
||||
}
|
||||
|
||||
private void setupNameAndPasswordPref() {
|
||||
Preference nameAndPasswordPref = findPreference(OSM_LOGIN_DATA);
|
||||
nameAndPasswordPref.setSummary(settings.USER_NAME.get());
|
||||
|
@ -53,6 +65,11 @@ public class OsmEditingFragment extends BaseSettingsFragment implements OnPrefer
|
|||
private void setupOfflineEditingPref() {
|
||||
SwitchPreferenceEx offlineEditingPref = (SwitchPreferenceEx) findPreference(settings.OFFLINE_EDITION.getId());
|
||||
offlineEditingPref.setDescription(getString(R.string.offline_edition_descr));
|
||||
offlineEditingPref.setIcon(getOfflineEditingIcon(settings.OFFLINE_EDITION.get()));
|
||||
}
|
||||
|
||||
private Drawable getOfflineEditingIcon(boolean enabled) {
|
||||
return enabled ? getActiveIcon(R.drawable.ic_world_globe_dark) : getContentIcon(R.drawable.ic_action_offline);
|
||||
}
|
||||
|
||||
private void setupOsmEditsDescrPref() {
|
||||
|
@ -92,6 +109,14 @@ public class OsmEditingFragment extends BaseSettingsFragment implements OnPrefer
|
|||
return super.onPreferenceClick(preference);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
if (settings.OFFLINE_EDITION.getId().equals(preference.getKey()) && newValue instanceof Boolean) {
|
||||
preference.setIcon(getOfflineEditingIcon((Boolean) newValue));
|
||||
}
|
||||
return super.onPreferenceChange(preference, newValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPreferenceChanged(String prefId) {
|
||||
if (OSM_LOGIN_DATA.equals(prefId)) {
|
||||
|
|
|
@ -38,6 +38,7 @@ import net.osmand.plus.SettingsHelper;
|
|||
import net.osmand.plus.SettingsHelper.ProfileSettingsItem;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||
import net.osmand.plus.helpers.FontCache;
|
||||
import net.osmand.plus.openseamapsplugin.NauticalMapsPlugin;
|
||||
import net.osmand.plus.profiles.ExportImportProfileBottomSheet;
|
||||
|
@ -101,20 +102,16 @@ public class ConfigureProfileFragment extends BaseSettingsFragment implements Co
|
|||
toolbarSubtitle.setText(R.string.configure_profile);
|
||||
toolbarSubtitle.setVisibility(View.VISIBLE);
|
||||
|
||||
if (!getSelectedAppMode().equals(ApplicationMode.DEFAULT)) {
|
||||
view.findViewById(R.id.toolbar_switch_container).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
ApplicationMode selectedMode = getSelectedAppMode();
|
||||
List<ApplicationMode> availableAppModes = ApplicationMode.values(getMyApplication());
|
||||
boolean isChecked = availableAppModes.contains(selectedMode);
|
||||
ApplicationMode.changeProfileAvailability(selectedMode, !isChecked, getMyApplication());
|
||||
updateToolbarSwitch();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
view.findViewById(R.id.switchWidget).setVisibility(View.GONE);
|
||||
}
|
||||
view.findViewById(R.id.toolbar_switch_container).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
ApplicationMode selectedMode = getSelectedAppMode();
|
||||
List<ApplicationMode> availableAppModes = ApplicationMode.values(getMyApplication());
|
||||
boolean isChecked = availableAppModes.contains(selectedMode);
|
||||
ApplicationMode.changeProfileAvailability(selectedMode, !isChecked, getMyApplication());
|
||||
updateToolbarSwitch();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -149,6 +146,9 @@ public class ConfigureProfileFragment extends BaseSettingsFragment implements Co
|
|||
updateToolbarSwitch();
|
||||
TextView toolbarTitle = view.findViewById(R.id.toolbar_title);
|
||||
toolbarTitle.setText(getSelectedAppMode().toHumanString());
|
||||
|
||||
boolean visible = !getSelectedAppMode().equals(ApplicationMode.DEFAULT);
|
||||
AndroidUiHelper.updateVisibility(view.findViewById(R.id.switchWidget), visible);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ import net.osmand.plus.R;
|
|||
import net.osmand.plus.SettingsHelper.*;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||
import net.osmand.plus.profiles.SelectProfileBottomSheetDialogFragment;
|
||||
import net.osmand.plus.profiles.SelectProfileBottomSheetDialogFragment.SelectProfileListener;
|
||||
import net.osmand.plus.settings.preferences.SwitchPreferenceEx;
|
||||
|
@ -88,9 +89,8 @@ public class MainSettingsFragment extends BaseSettingsFragment {
|
|||
AndroidUtils.setBackground(selectedProfile, backgroundDrawable);
|
||||
}
|
||||
}
|
||||
if (ApplicationMode.DEFAULT.getStringKey().equals(preference.getKey())) {
|
||||
holder.findViewById(R.id.switchWidget).setVisibility(View.GONE);
|
||||
}
|
||||
boolean visible = !ApplicationMode.DEFAULT.getStringKey().equals(key);
|
||||
AndroidUiHelper.updateVisibility(holder.findViewById(R.id.switchWidget), visible);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -17,6 +17,7 @@ public abstract class BasePreferenceBottomSheet extends MenuBottomSheetDialogFra
|
|||
|
||||
public static final String PREFERENCE_ID = "preference_id";
|
||||
private static final String APP_MODE_KEY = "app_mode_key";
|
||||
private static final String PROFILE_DEPENDENT = "profile_dependent";
|
||||
|
||||
private String prefId;
|
||||
private Preference preference;
|
||||
|
@ -36,12 +37,14 @@ public abstract class BasePreferenceBottomSheet extends MenuBottomSheetDialogFra
|
|||
super.onCreate(savedInstanceState);
|
||||
if (savedInstanceState != null) {
|
||||
appMode = ApplicationMode.valueOfStringKey(savedInstanceState.getString(APP_MODE_KEY), null);
|
||||
profileDependent = savedInstanceState.getBoolean(PROFILE_DEPENDENT, false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState(Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
outState.putBoolean(PROFILE_DEPENDENT, profileDependent);
|
||||
if (appMode != null) {
|
||||
outState.putString(APP_MODE_KEY, appMode.getStringKey());
|
||||
}
|
||||
|
|
|
@ -8,7 +8,9 @@ import android.support.v4.app.Fragment;
|
|||
import android.support.v4.app.FragmentManager;
|
||||
import android.view.View;
|
||||
import android.widget.EditText;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.plus.ApplicationMode;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
|
@ -47,6 +49,13 @@ public class EditTextPreferenceBottomSheet extends BasePreferenceBottomSheet {
|
|||
View view = UiUtilities.getInflater(ctx, nightMode).inflate(R.layout.preference_edit_text_box, null);
|
||||
editText = view.findViewById(R.id.edit_text);
|
||||
editText.setText(text);
|
||||
|
||||
RelativeLayout editTextLayout = view.findViewById(R.id.text_field_boxes_editTextLayout);
|
||||
if (editTextLayout != null && editTextLayout.getLayoutParams() instanceof RelativeLayout.LayoutParams) {
|
||||
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) editTextLayout.getLayoutParams();
|
||||
params.setMargins(params.leftMargin, AndroidUtils.dpToPx(ctx, 19), params.rightMargin, params.bottomMargin);
|
||||
}
|
||||
|
||||
items.add(new SimpleBottomSheetItem.Builder().setCustomView(view).create());
|
||||
|
||||
String description = editTextPreference.getDescription();
|
||||
|
|
Loading…
Reference in a new issue