Fix wrong app theme initial commit
This commit is contained in:
parent
76bdc8ac3f
commit
6d62c90555
23 changed files with 202 additions and 178 deletions
|
@ -34,6 +34,7 @@
|
|||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:textAppearance="@style/TextAppearance.ListItemTitle"
|
||||
android:textColor="?attr/active_color_basic"
|
||||
osmand:typeface="@string/font_roboto_medium"
|
||||
tools:text="Some Title" />
|
||||
|
||||
|
@ -54,6 +55,7 @@
|
|||
<View
|
||||
android:id="@+id/bottom_divider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp" />
|
||||
android:layout_height="1dp"
|
||||
android:background="?attr/divider_color_basic" />
|
||||
|
||||
</LinearLayout>
|
||||
|
|
|
@ -108,6 +108,7 @@
|
|||
android:id="@+id/bottom_divider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginTop="8dp" />
|
||||
android:layout_marginTop="8dp"
|
||||
android:background="?attr/divider_color_basic" />
|
||||
|
||||
</LinearLayout>
|
||||
|
|
|
@ -17,7 +17,8 @@
|
|||
<View
|
||||
android:id="@+id/top_divider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp" />
|
||||
android:layout_height="1dp"
|
||||
android:background="?attr/divider_color_basic" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
@ -44,6 +45,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:text="@string/search_radius_proximity"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="@dimen/default_desc_text_size" />
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
|
@ -82,6 +84,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:text="@string/shared_string_type"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="@dimen/default_desc_text_size" />
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
|
@ -104,7 +107,8 @@
|
|||
<View
|
||||
android:id="@+id/divider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp" />
|
||||
android:layout_height="1dp"
|
||||
android:background="?attr/divider_color_basic" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
@ -112,6 +116,7 @@
|
|||
android:id="@+id/bottom_divider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginTop="8dp" />
|
||||
android:layout_marginTop="8dp"
|
||||
android:background="?attr/divider_color_basic" />
|
||||
|
||||
</LinearLayout>
|
|
@ -23,6 +23,7 @@
|
|||
android:layout_marginStart="64dp"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/search_radius_proximity"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="@dimen/default_desc_text_size" />
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
|
@ -43,6 +44,7 @@
|
|||
android:id="@+id/bottom_divider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginTop="8dp" />
|
||||
android:layout_marginTop="8dp"
|
||||
android:background="?attr/divider_color_basic" />
|
||||
|
||||
</LinearLayout>
|
|
@ -24,6 +24,7 @@
|
|||
android:id="@+id/bottom_divider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginTop="8dp" />
|
||||
android:layout_marginTop="8dp"
|
||||
android:background="?attr/divider_color_basic" />
|
||||
|
||||
</LinearLayout>
|
|
@ -454,9 +454,10 @@ public class OsmandApplication extends MultiDexApplication {
|
|||
String voiceProvider = osmandSettings.VOICE_PROVIDER.getModeValue(applicationMode);
|
||||
if (voiceProvider == null || OsmandSettings.VOICE_PROVIDER_NOT_USE.equals(voiceProvider)) {
|
||||
if (warningNoneProvider && voiceProvider == null) {
|
||||
final AlertDialog.Builder builder = new AlertDialog.Builder(uiContext);
|
||||
boolean nightMode = daynightHelper.isNightModeForMapControls();
|
||||
final AlertDialog.Builder builder = new AlertDialog.Builder(UiUtilities.getThemedContext(uiContext, nightMode));
|
||||
|
||||
View view = uiContext.getLayoutInflater().inflate(R.layout.select_voice_first, null);
|
||||
View view = UiUtilities.getInflater(uiContext, nightMode).inflate(R.layout.select_voice_first, null);
|
||||
|
||||
((ImageView) view.findViewById(R.id.icon))
|
||||
.setImageDrawable(getUIUtilities().getIcon(R.drawable.ic_action_volume_up, getSettings().isLightContent()));
|
||||
|
|
|
@ -370,11 +370,15 @@ public class UiUtilities {
|
|||
}
|
||||
}
|
||||
|
||||
public static Context getThemedContext(Context context, boolean nightMode) {
|
||||
return new ContextThemeWrapper(context, !nightMode ? R.style.OsmandLightTheme : R.style.OsmandDarkTheme);
|
||||
}
|
||||
|
||||
public static LayoutInflater getInflater(Context ctx, boolean nightMode) {
|
||||
return LayoutInflater.from(getThemedContext(ctx, nightMode));
|
||||
}
|
||||
}
|
||||
|
||||
public static Context getThemedContext(Context context, boolean nightMode) {
|
||||
return getThemedContext(context, nightMode, R.style.OsmandLightTheme, R.style.OsmandDarkTheme);
|
||||
}
|
||||
|
||||
public static Context getThemedContext(Context context, boolean nightMode, int lightStyle, int darkStyle) {
|
||||
return new ContextThemeWrapper(context, nightMode ? darkStyle : lightStyle);
|
||||
}
|
||||
}
|
|
@ -9,21 +9,23 @@ import android.view.View;
|
|||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
import java.text.MessageFormat;
|
||||
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.base.BottomSheetDialogFragment;
|
||||
import net.osmand.plus.helpers.FontCache;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
|
||||
public class OsmandRestoreOrExitDialog extends BottomSheetDialogFragment {
|
||||
|
||||
private String clientAppTitle = "";
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
View view = getActivity().getLayoutInflater()
|
||||
.inflate(R.layout.dash_restore_osmand_fragment, container, false);
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
boolean nightMode = getMyApplication().getDaynightHelper().isNightModeForMapControls();
|
||||
View view = UiUtilities.getInflater(getActivity(), nightMode).inflate(R.layout.dash_restore_osmand_fragment, container, false);
|
||||
try {
|
||||
clientAppTitle = getMyApplication().getAppCustomization().getNavFooterAppName();
|
||||
} catch (Exception e) {
|
||||
|
|
|
@ -56,6 +56,7 @@ import net.osmand.plus.OsmandSettings;
|
|||
import net.osmand.plus.OsmandSettings.CommonPreference;
|
||||
import net.osmand.plus.OsmandSettings.OsmandPreference;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.activities.SavingTrackHelper;
|
||||
import net.osmand.plus.activities.TabActivity.TabItem;
|
||||
|
@ -786,9 +787,10 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
|
|||
}
|
||||
|
||||
private void chooseDefaultAction(final double lat, final double lon, final MapActivity mapActivity) {
|
||||
AlertDialog.Builder ab = new AlertDialog.Builder(mapActivity);
|
||||
boolean nightMode = app.getDaynightHelper().isNightModeForMapControls();
|
||||
AlertDialog.Builder ab = new AlertDialog.Builder(UiUtilities.getThemedContext(mapActivity, nightMode));
|
||||
ab.setItems(
|
||||
new String[]{mapActivity.getString(R.string.recording_context_menu_arecord),
|
||||
new String[] {mapActivity.getString(R.string.recording_context_menu_arecord),
|
||||
mapActivity.getString(R.string.recording_context_menu_vrecord),
|
||||
mapActivity.getString(R.string.recording_context_menu_precord),}, new OnClickListener() {
|
||||
@Override
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package net.osmand.plus.helpers;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.support.annotation.DrawableRes;
|
||||
|
@ -7,6 +8,7 @@ import android.support.annotation.NonNull;
|
|||
import android.support.annotation.Nullable;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.text.TextUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ArrayAdapter;
|
||||
|
@ -25,6 +27,7 @@ import net.osmand.plus.ApplicationMode;
|
|||
import net.osmand.plus.OsmAndFormatter;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.mapcontextmenu.MapContextMenu;
|
||||
import net.osmand.plus.routing.RoutingHelper;
|
||||
|
@ -58,16 +61,19 @@ public class AvoidSpecificRoads {
|
|||
}
|
||||
}
|
||||
|
||||
private ArrayAdapter<LatLon> createAdapter(final MapActivity ctx) {
|
||||
private ArrayAdapter<LatLon> createAdapter(MapActivity mapActivity, boolean nightMode) {
|
||||
final ArrayList<LatLon> points = new ArrayList<>(impassableRoads.keySet());
|
||||
final LatLon mapLocation = ctx.getMapLocation();
|
||||
return new ArrayAdapter<LatLon>(ctx, R.layout.waypoint_reached, R.id.title, points) {
|
||||
final LatLon mapLocation = mapActivity.getMapLocation();
|
||||
final LayoutInflater inflater = UiUtilities.getInflater(mapActivity, nightMode);
|
||||
Context themedContext = UiUtilities.getThemedContext(mapActivity, nightMode);
|
||||
|
||||
return new ArrayAdapter<LatLon>(themedContext, R.layout.waypoint_reached, R.id.title, points) {
|
||||
@NonNull
|
||||
@Override
|
||||
public View getView(final int position, View convertView, @NonNull ViewGroup parent) {
|
||||
View v = convertView;
|
||||
if (v == null || v.findViewById(R.id.info_close) == null) {
|
||||
v = ctx.getLayoutInflater().inflate(R.layout.waypoint_reached, parent, false);
|
||||
v = inflater.inflate(R.layout.waypoint_reached, parent, false);
|
||||
}
|
||||
final LatLon item = getItem(position);
|
||||
v.findViewById(R.id.all_points).setVisibility(View.GONE);
|
||||
|
@ -158,12 +164,15 @@ public class AvoidSpecificRoads {
|
|||
}
|
||||
|
||||
public void showDialog(@NonNull final MapActivity mapActivity) {
|
||||
AlertDialog.Builder bld = new AlertDialog.Builder(mapActivity);
|
||||
boolean nightMode = app.getDaynightHelper().isNightModeForMapControls();
|
||||
Context themedContext = UiUtilities.getThemedContext(mapActivity, nightMode);
|
||||
|
||||
AlertDialog.Builder bld = new AlertDialog.Builder(themedContext);
|
||||
bld.setTitle(R.string.impassable_road);
|
||||
if (impassableRoads.isEmpty()) {
|
||||
bld.setMessage(R.string.avoid_roads_msg);
|
||||
} else {
|
||||
final ArrayAdapter<LatLon> listAdapter = createAdapter(mapActivity);
|
||||
final ArrayAdapter<LatLon> listAdapter = createAdapter(mapActivity, nightMode);
|
||||
bld.setAdapter(listAdapter, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
|
|
|
@ -6,11 +6,9 @@ import android.os.Bundle;
|
|||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.app.DialogFragment;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
|
||||
import net.osmand.osm.PoiCategory;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
|
||||
public class MapillaryInstallDialogFragment extends DialogFragment {
|
||||
|
@ -22,8 +20,9 @@ public class MapillaryInstallDialogFragment extends DialogFragment {
|
|||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
|
||||
final MapActivity mapActivity = (MapActivity) getActivity();
|
||||
boolean nightMode = mapActivity.getMyApplication().getDaynightHelper().isNightModeForMapControls();
|
||||
|
||||
final AlertDialog.Builder builder = new AlertDialog.Builder(mapActivity);
|
||||
final AlertDialog.Builder builder = new AlertDialog.Builder(UiUtilities.getThemedContext(mapActivity, nightMode));
|
||||
builder.setCancelable(true);
|
||||
builder.setNegativeButton(mapActivity.getString(R.string.shared_string_cancel), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
|
@ -39,7 +38,7 @@ public class MapillaryInstallDialogFragment extends DialogFragment {
|
|||
}
|
||||
});
|
||||
|
||||
builder.setView(mapActivity.getLayoutInflater().inflate(R.layout.mapillary_install_dialog, null));
|
||||
builder.setView(UiUtilities.getInflater(mapActivity, nightMode).inflate(R.layout.mapillary_install_dialog, null));
|
||||
return builder.create();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,25 +1,5 @@
|
|||
package net.osmand.plus.mapmarkers;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.Location;
|
||||
import net.osmand.data.Amenity;
|
||||
import net.osmand.data.FavouritePoint;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.GPXUtilities.WptPt;
|
||||
import net.osmand.data.WptLocationPoint;
|
||||
import net.osmand.plus.MapMarkersHelper.MapMarker;
|
||||
import net.osmand.plus.OsmAndLocationProvider.OsmAndCompassListener;
|
||||
import net.osmand.plus.OsmAndLocationProvider.OsmAndLocationListener;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.mapmarkers.SelectionMarkersGroupBottomSheetDialogFragment.AddMarkersGroupFragmentListener;
|
||||
import net.osmand.plus.mapmarkers.adapters.MapMarkerItemViewHolder;
|
||||
import net.osmand.plus.mapmarkers.adapters.MapMarkersGroupsAdapter;
|
||||
import net.osmand.plus.widgets.EmptyStateRecyclerView;
|
||||
import net.osmand.util.MapUtils;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Canvas;
|
||||
|
@ -42,6 +22,27 @@ import android.view.View;
|
|||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.GPXUtilities.WptPt;
|
||||
import net.osmand.Location;
|
||||
import net.osmand.data.Amenity;
|
||||
import net.osmand.data.FavouritePoint;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.data.WptLocationPoint;
|
||||
import net.osmand.plus.MapMarkersHelper.MapMarker;
|
||||
import net.osmand.plus.OsmAndLocationProvider.OsmAndCompassListener;
|
||||
import net.osmand.plus.OsmAndLocationProvider.OsmAndLocationListener;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.mapmarkers.SelectionMarkersGroupBottomSheetDialogFragment.AddMarkersGroupFragmentListener;
|
||||
import net.osmand.plus.mapmarkers.adapters.MapMarkerItemViewHolder;
|
||||
import net.osmand.plus.mapmarkers.adapters.MapMarkersGroupsAdapter;
|
||||
import net.osmand.plus.widgets.EmptyStateRecyclerView;
|
||||
import net.osmand.util.MapUtils;
|
||||
|
||||
public class MapMarkersGroupsFragment extends Fragment implements OsmAndCompassListener, OsmAndLocationListener {
|
||||
|
||||
public static final String TAG = "MapMarkersGroupsFragment";
|
||||
|
@ -63,7 +64,7 @@ public class MapMarkersGroupsFragment extends Fragment implements OsmAndCompassL
|
|||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
final MapActivity mapActivity = (MapActivity) getActivity();
|
||||
final boolean night = !mapActivity.getMyApplication().getSettings().isLightContent();
|
||||
mainView = inflater.inflate(R.layout.fragment_map_markers_groups, container, false);
|
||||
mainView = UiUtilities.getInflater(mapActivity, night).inflate(R.layout.fragment_map_markers_groups, container, false);
|
||||
|
||||
Fragment selectionMarkersGroupFragment = getChildFragmentManager().findFragmentByTag(SelectionMarkersGroupBottomSheetDialogFragment.TAG);
|
||||
if (selectionMarkersGroupFragment != null) {
|
||||
|
|
|
@ -26,6 +26,7 @@ import net.osmand.plus.MapMarkersHelper;
|
|||
import net.osmand.plus.MapMarkersHelper.MapMarker;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.mapmarkers.adapters.MapMarkerHeaderViewHolder;
|
||||
import net.osmand.plus.mapmarkers.adapters.MapMarkerItemViewHolder;
|
||||
|
@ -76,7 +77,7 @@ public class MapMarkersHistoryFragment extends Fragment implements MapMarkersHel
|
|||
((HistoryMarkerMenuBottomSheetDialogFragment) historyMarkerMenuFragment).setListener(createHistoryMarkerMenuListener());
|
||||
}
|
||||
|
||||
final View mainView = inflater.inflate(R.layout.fragment_map_markers_history, container, false);
|
||||
final View mainView = UiUtilities.getInflater(mapActivity, night).inflate(R.layout.fragment_map_markers_history, container, false);
|
||||
final EmptyStateRecyclerView recyclerView = (EmptyStateRecyclerView) mainView.findViewById(R.id.list);
|
||||
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@ import android.support.v7.widget.helper.ItemTouchHelper;
|
|||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.util.TypedValue;
|
||||
import android.view.ContextThemeWrapper;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -37,19 +36,20 @@ import android.widget.Toast;
|
|||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.CallbackWithObject;
|
||||
import net.osmand.IndexConstants;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.plus.ApplicationMode;
|
||||
import net.osmand.GPXUtilities;
|
||||
import net.osmand.GPXUtilities.GPXFile;
|
||||
import net.osmand.GPXUtilities.Route;
|
||||
import net.osmand.GPXUtilities.Track;
|
||||
import net.osmand.GPXUtilities.TrkSegment;
|
||||
import net.osmand.GPXUtilities.WptPt;
|
||||
import net.osmand.IndexConstants;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.plus.ApplicationMode;
|
||||
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
|
||||
import net.osmand.plus.OsmAndFormatter;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.Version;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.activities.TrackActivity;
|
||||
|
@ -190,21 +190,19 @@ public class MeasurementToolFragment extends BaseOsmAndFragment {
|
|||
|
||||
editingCtx.getCommandManager().resetMeasurementLayer(measurementLayer);
|
||||
nightMode = mapActivity.getMyApplication().getDaynightHelper().isNightModeForMapControls();
|
||||
final int themeRes = nightMode ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme;
|
||||
final int backgroundColor = ContextCompat.getColor(getActivity(),
|
||||
nightMode ? R.color.activity_background_color_dark : R.color.activity_background_color_light);
|
||||
portrait = AndroidUiHelper.isOrientationPortrait(getActivity());
|
||||
portrait = AndroidUiHelper.isOrientationPortrait(mapActivity);
|
||||
|
||||
upIcon = getContentIcon(R.drawable.ic_action_arrow_up);
|
||||
downIcon = getContentIcon(R.drawable.ic_action_arrow_down);
|
||||
pointsSt = getString(R.string.shared_string_gpx_points).toLowerCase();
|
||||
|
||||
View view = View.inflate(new ContextThemeWrapper(getContext(), themeRes), R.layout.fragment_measurement_tool, null);
|
||||
View view = UiUtilities.getInflater(getContext(), nightMode).inflate(R.layout.fragment_measurement_tool, null);
|
||||
|
||||
mainView = view.findViewById(R.id.main_view);
|
||||
AndroidUtils.setBackground(mapActivity, mainView, nightMode, R.drawable.bg_bottom_menu_light, R.drawable.bg_bottom_menu_dark);
|
||||
pointsListContainer = view.findViewById(R.id.points_list_container);
|
||||
if (portrait && pointsListContainer != null) {
|
||||
final int backgroundColor = ContextCompat.getColor(mapActivity, nightMode ? R.color.activity_background_color_dark : R.color.activity_background_color_light);
|
||||
pointsListContainer.setBackgroundColor(backgroundColor);
|
||||
}
|
||||
|
||||
|
@ -367,7 +365,7 @@ public class MeasurementToolFragment extends BaseOsmAndFragment {
|
|||
String azimuthStr = OsmAndFormatter.getFormattedAzimuth(bearing, getMyApplication());
|
||||
distanceToCenterTv.setText(String.format(" – %1$s • %2$s", distStr, azimuthStr));
|
||||
TextViewCompat.setAutoSizeTextTypeUniformWithConfiguration(
|
||||
distanceToCenterTv, 12, 18, 2, TypedValue.COMPLEX_UNIT_SP
|
||||
distanceToCenterTv, 12, 18, 2, TypedValue.COMPLEX_UNIT_SP
|
||||
);
|
||||
}
|
||||
});
|
||||
|
@ -421,7 +419,7 @@ public class MeasurementToolFragment extends BaseOsmAndFragment {
|
|||
public void onClick(View v) {
|
||||
if (editingCtx.getPointsCount() > 0) {
|
||||
if (newGpxData != null && newGpxData.getActionType() == NewGpxData.ActionType.EDIT_SEGMENT
|
||||
&& editingCtx.isInSnapToRoadMode()) {
|
||||
&& editingCtx.isInSnapToRoadMode()) {
|
||||
if (mapActivity != null && measurementLayer != null) {
|
||||
if (editingCtx.getPointsCount() > 0) {
|
||||
openSaveAsNewTrackMenu(mapActivity);
|
||||
|
@ -1156,8 +1154,7 @@ public class MeasurementToolFragment extends BaseOsmAndFragment {
|
|||
MapActivity mapActivity = getMapActivity();
|
||||
if (mapActivity != null) {
|
||||
final File dir = mapActivity.getMyApplication().getAppPath(IndexConstants.GPX_INDEX_DIR);
|
||||
final LayoutInflater inflater = mapActivity.getLayoutInflater();
|
||||
final View view = inflater.inflate(R.layout.save_gpx_dialog, null);
|
||||
final View view = UiUtilities.getInflater(mapActivity, nightMode).inflate(R.layout.save_gpx_dialog, null);
|
||||
final EditText nameEt = (EditText) view.findViewById(R.id.gpx_name_et);
|
||||
final TextView warningTextView = (TextView) view.findViewById(R.id.file_exists_text_view);
|
||||
final SwitchCompat showOnMapToggle = (SwitchCompat) view.findViewById(R.id.toggle_show_on_map);
|
||||
|
@ -1175,7 +1172,7 @@ public class MeasurementToolFragment extends BaseOsmAndFragment {
|
|||
nameEt.setSelection(displayedName.length());
|
||||
final boolean[] textChanged = new boolean[1];
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(mapActivity)
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(UiUtilities.getThemedContext(mapActivity, nightMode))
|
||||
.setTitle(R.string.enter_gpx_name)
|
||||
.setView(view)
|
||||
.setPositiveButton(R.string.shared_string_save, new DialogInterface.OnClickListener() {
|
||||
|
@ -1271,7 +1268,7 @@ public class MeasurementToolFragment extends BaseOsmAndFragment {
|
|||
TrkSegment after = editingCtx.getAfterTrkSegmentLine();
|
||||
if (gpx == null) {
|
||||
toSave = new File(dir, fileName);
|
||||
String trackName = fileName.substring(0,fileName.length()-GPX_SUFFIX.length());
|
||||
String trackName = fileName.substring(0, fileName.length() - GPX_SUFFIX.length());
|
||||
GPXFile gpx = new GPXFile(Version.getFullVersion(activity.getMyApplication()));
|
||||
if (measurementLayer != null) {
|
||||
if (saveType == SaveType.LINE) {
|
||||
|
@ -1509,11 +1506,10 @@ public class MeasurementToolFragment extends BaseOsmAndFragment {
|
|||
dismiss(mapActivity);
|
||||
return;
|
||||
}
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(mapActivity);
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(UiUtilities.getThemedContext(mapActivity, nightMode));
|
||||
if (editingCtx.getNewGpxData() == null) {
|
||||
final File dir = mapActivity.getMyApplication().getAppPath(IndexConstants.GPX_INDEX_DIR);
|
||||
final LayoutInflater inflater = mapActivity.getLayoutInflater();
|
||||
final View view = inflater.inflate(R.layout.close_measurement_tool_dialog, null);
|
||||
final View view = UiUtilities.getInflater(mapActivity, nightMode).inflate(R.layout.close_measurement_tool_dialog, null);
|
||||
final SwitchCompat showOnMapToggle = (SwitchCompat) view.findViewById(R.id.toggle_show_on_map);
|
||||
|
||||
builder.setView(view);
|
||||
|
|
|
@ -7,9 +7,7 @@ import android.content.DialogInterface.OnClickListener;
|
|||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.CompoundButton.OnCheckedChangeListener;
|
||||
|
@ -30,6 +28,7 @@ import net.osmand.plus.OsmandApplication;
|
|||
import net.osmand.plus.OsmandPlugin;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.activities.SavingTrackHelper;
|
||||
import net.osmand.plus.activities.SavingTrackHelper.SaveGpxResult;
|
||||
|
@ -264,8 +263,13 @@ public class OsmandMonitoringPlugin extends OsmandPlugin {
|
|||
|
||||
public void controlDialog(final Activity activity, final boolean showTrackSelection) {
|
||||
final boolean wasTrackMonitored = settings.SAVE_GLOBAL_TRACK_TO_GPX.get();
|
||||
|
||||
AlertDialog.Builder bld = new AlertDialog.Builder(activity);
|
||||
boolean nightMode;
|
||||
if (activity instanceof MapActivity) {
|
||||
nightMode = app.getDaynightHelper().isNightModeForMapControls();
|
||||
} else {
|
||||
nightMode = !app.getSettings().isLightContent();
|
||||
}
|
||||
AlertDialog.Builder bld = new AlertDialog.Builder(UiUtilities.getThemedContext(activity, nightMode));
|
||||
final TIntArrayList items = new TIntArrayList();
|
||||
if (wasTrackMonitored) {
|
||||
items.add(R.string.gpx_monitoring_stop);
|
||||
|
@ -435,14 +439,18 @@ public class OsmandMonitoringPlugin extends OsmandPlugin {
|
|||
public static void showIntervalChooseDialog(final Context uiCtx, final String patternMsg,
|
||||
String title, final int[] seconds, final int[] minutes,
|
||||
final ValueHolder<Boolean> choice, final ValueHolder<Integer> v,
|
||||
final boolean showTrackSelection, OnClickListener onclick){
|
||||
AlertDialog.Builder dlg = new AlertDialog.Builder(uiCtx);
|
||||
final boolean showTrackSelection, OnClickListener onclick) {
|
||||
final OsmandApplication app = (OsmandApplication) uiCtx.getApplicationContext();
|
||||
boolean nightMode;
|
||||
if (uiCtx instanceof MapActivity) {
|
||||
nightMode = app.getDaynightHelper().isNightModeForMapControls();
|
||||
} else {
|
||||
nightMode = !app.getSettings().isLightContent();
|
||||
}
|
||||
Context themedContext = UiUtilities.getThemedContext(uiCtx, nightMode);
|
||||
AlertDialog.Builder dlg = new AlertDialog.Builder(themedContext);
|
||||
dlg.setTitle(title);
|
||||
WindowManager mgr = (WindowManager) uiCtx.getSystemService(Context.WINDOW_SERVICE);
|
||||
DisplayMetrics dm = new DisplayMetrics();
|
||||
mgr.getDefaultDisplay().getMetrics(dm);
|
||||
LinearLayout ll = createIntervalChooseLayout(uiCtx, patternMsg, seconds, minutes,
|
||||
choice, v, showTrackSelection, dm);
|
||||
LinearLayout ll = createIntervalChooseLayout(themedContext, patternMsg, seconds, minutes, choice, v, showTrackSelection, nightMode);
|
||||
dlg.setView(ll);
|
||||
dlg.setPositiveButton(R.string.shared_string_ok, onclick);
|
||||
dlg.setNegativeButton(R.string.shared_string_cancel, null);
|
||||
|
@ -453,7 +461,7 @@ public class OsmandMonitoringPlugin extends OsmandPlugin {
|
|||
final String patternMsg, final int[] seconds,
|
||||
final int[] minutes, final ValueHolder<Boolean> choice,
|
||||
final ValueHolder<Integer> v,
|
||||
final boolean showTrackSelection, DisplayMetrics dm) {
|
||||
final boolean showTrackSelection, boolean nightMode) {
|
||||
LinearLayout ll = new LinearLayout(uiCtx);
|
||||
final int dp24 = AndroidUtils.dpToPx(uiCtx, 24f);
|
||||
final int dp8 = AndroidUtils.dpToPx(uiCtx, 8f);
|
||||
|
@ -531,14 +539,11 @@ public class OsmandMonitoringPlugin extends OsmandPlugin {
|
|||
|
||||
if (showTrackSelection) {
|
||||
final OsmandApplication app = (OsmandApplication) uiCtx.getApplicationContext();
|
||||
boolean light = app.getSettings().isLightContent();
|
||||
View divider = new View(uiCtx);
|
||||
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT,
|
||||
AndroidUtils.dpToPx(uiCtx, 1f));
|
||||
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, AndroidUtils.dpToPx(uiCtx, 1f));
|
||||
lp.setMargins(0, dp8 * 2, 0, 0);
|
||||
divider.setLayoutParams(lp);
|
||||
divider.setBackgroundColor(uiCtx.getResources().getColor(
|
||||
light ? R.color.divider_color_light : R.color.divider_color_dark));
|
||||
divider.setBackgroundColor(uiCtx.getResources().getColor(nightMode ? R.color.divider_color_dark : R.color.divider_color_light));
|
||||
ll.addView(divider);
|
||||
|
||||
final CheckBox cb = new CheckBox(uiCtx);
|
||||
|
|
|
@ -6,11 +6,14 @@ import android.content.DialogInterface.OnClickListener;
|
|||
import android.content.Intent;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
|
||||
import net.osmand.IndexConstants;
|
||||
import net.osmand.plus.ApplicationMode;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandPlugin;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.download.DownloadActivity;
|
||||
import net.osmand.plus.download.DownloadResources;
|
||||
import net.osmand.plus.render.RendererRegistry;
|
||||
|
@ -57,14 +60,20 @@ public class NauticalMapsPlugin extends OsmandPlugin {
|
|||
|
||||
@Override
|
||||
public boolean init(@NonNull final OsmandApplication app, final Activity activity) {
|
||||
if(activity != null) {
|
||||
if (activity != null) {
|
||||
addBoatProfile(true);
|
||||
// called from UI
|
||||
previousRenderer = app.getSettings().RENDERER.get();
|
||||
previousRenderer = app.getSettings().RENDERER.get();
|
||||
app.getSettings().RENDERER.set(RendererRegistry.NAUTICAL_RENDER);
|
||||
if(!app.getResourceManager().getIndexFileNames().containsKey(DownloadResources.WORLD_SEAMARKS_NAME+
|
||||
IndexConstants.BINARY_MAP_INDEX_EXT)){
|
||||
AlertDialog.Builder dlg = new AlertDialog.Builder(activity);
|
||||
if (!app.getResourceManager().getIndexFileNames().containsKey(DownloadResources.WORLD_SEAMARKS_NAME +
|
||||
IndexConstants.BINARY_MAP_INDEX_EXT)) {
|
||||
boolean nightMode;
|
||||
if (activity instanceof MapActivity) {
|
||||
nightMode = app.getDaynightHelper().isNightModeForMapControls();
|
||||
} else {
|
||||
nightMode = !app.getSettings().isLightContent();
|
||||
}
|
||||
AlertDialog.Builder dlg = new AlertDialog.Builder(UiUtilities.getThemedContext(activity, nightMode));
|
||||
dlg.setMessage(net.osmand.plus.R.string.nautical_maps_missing);
|
||||
dlg.setPositiveButton(R.string.shared_string_ok, new OnClickListener() {
|
||||
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
package net.osmand.plus.parkingpoint;
|
||||
|
||||
|
||||
import static net.osmand.aidlapi.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_MARK_AS_PARKING_LOC;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
|
@ -28,6 +26,7 @@ import net.osmand.plus.OsmandPlugin;
|
|||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.OsmandSettings.CommonPreference;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.dashboard.tools.DashFragmentData;
|
||||
import net.osmand.plus.mapcontextmenu.MapContextMenu;
|
||||
|
@ -39,6 +38,8 @@ import net.osmand.plus.views.mapwidgets.TextInfoWidget;
|
|||
|
||||
import java.util.Calendar;
|
||||
|
||||
import static net.osmand.aidlapi.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_MARK_AS_PARKING_LOC;
|
||||
|
||||
/**
|
||||
*
|
||||
* The plugin facilitates a storage of the location of a parked car.
|
||||
|
@ -298,7 +299,8 @@ public class ParkingPositionPlugin extends OsmandPlugin {
|
|||
* @param choose
|
||||
*/
|
||||
void showSetTimeLimitDialog(final MapActivity mapActivity, final DialogInterface choose) {
|
||||
final View setTimeParking = mapActivity.getLayoutInflater().inflate(R.layout.parking_set_time_limit, null);
|
||||
boolean nightMode = mapActivity.getMyApplication().getDaynightHelper().isNightModeForMapControls();
|
||||
final View setTimeParking = UiUtilities.getInflater(mapActivity, nightMode).inflate(R.layout.parking_set_time_limit, null);
|
||||
AlertDialog.Builder setTime = new AlertDialog.Builder(mapActivity);
|
||||
setTime.setView(setTimeParking);
|
||||
setTime.setTitle(mapActivity.getString(R.string.osmand_parking_time_limit_title));
|
||||
|
|
|
@ -6,7 +6,6 @@ import android.support.annotation.NonNull;
|
|||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.DialogFragment;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v7.view.ContextThemeWrapper;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
@ -18,6 +17,7 @@ import android.widget.TextView;
|
|||
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -39,9 +39,7 @@ public class AddQuickActionDialog extends DialogFragment {
|
|||
OsmandApplication application = (OsmandApplication) getActivity().getApplication();
|
||||
isLightContent = application.getSettings().isLightContent() && !application.getDaynightHelper().isNightMode();
|
||||
|
||||
return new Dialog(new ContextThemeWrapper(getActivity(), isLightContent
|
||||
? R.style.Dialog90Light
|
||||
: R.style.Dialog90Dark), getTheme());
|
||||
return new Dialog(UiUtilities.getThemedContext(getActivity(), !isLightContent, R.style.Dialog90Light, R.style.Dialog90Dark), getTheme());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
|
|
@ -9,7 +9,6 @@ import android.support.annotation.Nullable;
|
|||
import android.support.v4.app.DialogFragment;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.support.v7.view.ContextThemeWrapper;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
|
@ -21,9 +20,9 @@ import android.widget.EditText;
|
|||
import android.widget.ImageView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
|
||||
/**
|
||||
|
@ -72,9 +71,7 @@ public class CreateEditActionDialog extends DialogFragment {
|
|||
OsmandApplication application = (OsmandApplication) getActivity().getApplication();
|
||||
isLightContent = application.getSettings().isLightContent() && !application.getDaynightHelper().isNightMode();
|
||||
|
||||
Dialog dialog = new Dialog(new ContextThemeWrapper(getActivity(), isLightContent
|
||||
? R.style.Dialog90Light
|
||||
: R.style.Dialog90Dark), getTheme());
|
||||
Dialog dialog = new Dialog(UiUtilities.getThemedContext(getActivity(), !isLightContent, R.style.Dialog90Light, R.style.Dialog90Dark), getTheme());
|
||||
|
||||
dialog.getWindow().requestFeature(Window.FEATURE_NO_TITLE);
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@ package net.osmand.plus.quickaction;
|
|||
|
||||
import android.content.DialogInterface;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
|
@ -11,7 +10,6 @@ import android.support.design.widget.FloatingActionButton;
|
|||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v4.view.MotionEventCompat;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.support.v7.view.ContextThemeWrapper;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
|
@ -27,6 +25,7 @@ import android.widget.LinearLayout;
|
|||
import android.widget.TextView;
|
||||
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.base.BaseOsmAndFragment;
|
||||
|
||||
|
@ -40,27 +39,26 @@ import static android.util.TypedValue.COMPLEX_UNIT_DIP;
|
|||
* Created by okorsun on 20.12.16.
|
||||
*/
|
||||
|
||||
public class QuickActionListFragment extends BaseOsmAndFragment implements QuickActionRegistry.QuickActionUpdatesListener{
|
||||
public class QuickActionListFragment extends BaseOsmAndFragment implements QuickActionRegistry.QuickActionUpdatesListener {
|
||||
|
||||
public static final String TAG = QuickActionListFragment.class.getSimpleName();
|
||||
|
||||
RecyclerView quickActionRV;
|
||||
FloatingActionButton fab;
|
||||
private RecyclerView quickActionRV;
|
||||
private FloatingActionButton fab;
|
||||
|
||||
private QuickActionAdapter adapter;
|
||||
private ItemTouchHelper touchHelper;
|
||||
private QuickActionRegistry quickActionRegistry;
|
||||
|
||||
QuickActionAdapter adapter;
|
||||
ItemTouchHelper touchHelper;
|
||||
QuickActionRegistry quickActionRegistry;
|
||||
|
||||
private boolean isLightContent;
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
|
||||
View view = inflater.inflate(R.layout.quick_action_list, container, false);
|
||||
|
||||
isLightContent = getMyApplication().getSettings().isLightContent();
|
||||
|
||||
|
||||
View view = UiUtilities.getInflater(getContext(), !isLightContent).inflate(R.layout.quick_action_list, container, false);
|
||||
|
||||
quickActionRV = (RecyclerView) view.findViewById(R.id.recycler_view);
|
||||
fab = (FloatingActionButton) view.findViewById(R.id.fabButton);
|
||||
|
||||
|
@ -112,8 +110,8 @@ public class QuickActionListFragment extends BaseOsmAndFragment implements Quick
|
|||
}
|
||||
|
||||
private void setUpToolbar(View view) {
|
||||
Toolbar toolbar = (Toolbar) view.findViewById(R.id.custom_toolbar);
|
||||
Drawable back = getMyApplication().getUIUtilities().getIcon(R.drawable.ic_arrow_back,
|
||||
Toolbar toolbar = (Toolbar) view.findViewById(R.id.custom_toolbar);
|
||||
Drawable back = getMyApplication().getUIUtilities().getIcon(R.drawable.ic_arrow_back,
|
||||
isLightContent ? R.color.active_buttons_and_links_text_light : R.color.active_buttons_and_links_text_dark);
|
||||
toolbar.setNavigationIcon(back);
|
||||
toolbar.setNavigationContentDescription(R.string.access_shared_string_navigate_up);
|
||||
|
@ -124,7 +122,7 @@ public class QuickActionListFragment extends BaseOsmAndFragment implements Quick
|
|||
}
|
||||
});
|
||||
toolbar.setTitle(R.string.configure_screen_quick_action);
|
||||
toolbar.setTitleTextColor(ContextCompat.getColor(getContext(),
|
||||
toolbar.setTitleTextColor(ContextCompat.getColor(getContext(),
|
||||
isLightContent ? R.color.color_white : R.color.text_color_primary_dark));
|
||||
}
|
||||
|
||||
|
@ -144,28 +142,26 @@ public class QuickActionListFragment extends BaseOsmAndFragment implements Quick
|
|||
quickActionRegistry.setUpdatesListener(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isFullScreenAllowed() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
protected boolean isFullScreenAllowed() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStatusBarColorId() {
|
||||
return getSettings().isLightContent() ? R.color.status_bar_color_light : R.color.status_bar_color_dark;
|
||||
}
|
||||
@Override
|
||||
public int getStatusBarColorId() {
|
||||
return isLightContent ? R.color.status_bar_color_light : R.color.status_bar_color_dark;
|
||||
}
|
||||
|
||||
private MapActivity getMapActivity() {
|
||||
private MapActivity getMapActivity() {
|
||||
return (MapActivity) getActivity();
|
||||
}
|
||||
|
||||
private void saveQuickActions(){
|
||||
private void saveQuickActions() {
|
||||
quickActionRegistry.updateQuickActions(adapter.getQuickActions());
|
||||
}
|
||||
|
||||
void createAndShowDeleteDialog(final int itemPosition, final String itemName) {
|
||||
boolean isLightContent = getMyApplication().getSettings().isLightContent();
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(new ContextThemeWrapper(getContext(),
|
||||
isLightContent ? R.style.OsmandLightTheme : R.style.OsmandDarkTheme));
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(UiUtilities.getThemedContext(getContext(), !isLightContent));
|
||||
builder.setTitle(R.string.quick_actions_delete);
|
||||
builder.setMessage(getResources().getString(R.string.quick_actions_delete_text, itemName));
|
||||
builder.setIcon(getMyApplication().getUIUtilities().getThemedIcon(R.drawable.ic_action_delete_dark));
|
||||
|
@ -192,7 +188,7 @@ public class QuickActionListFragment extends BaseOsmAndFragment implements Quick
|
|||
}
|
||||
|
||||
public class QuickActionAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> implements QuickActionItemTouchHelperCallback.OnItemMoveCallback {
|
||||
public static final int SCREEN_ITEM_TYPE = 1;
|
||||
public static final int SCREEN_ITEM_TYPE = 1;
|
||||
public static final int SCREEN_HEADER_TYPE = 2;
|
||||
|
||||
private static final int ITEMS_IN_GROUP = 6;
|
||||
|
@ -206,7 +202,7 @@ public class QuickActionListFragment extends BaseOsmAndFragment implements Quick
|
|||
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
LayoutInflater inflater = LayoutInflater.from(parent.getContext());
|
||||
LayoutInflater inflater = UiUtilities.getInflater(parent.getContext(), isLightContent);
|
||||
if (viewType == SCREEN_ITEM_TYPE)
|
||||
return new QuickActionItemVH(inflater.inflate(R.layout.quick_action_list_item, parent, false));
|
||||
else
|
||||
|
@ -215,8 +211,8 @@ public class QuickActionListFragment extends BaseOsmAndFragment implements Quick
|
|||
|
||||
@Override
|
||||
public void onBindViewHolder(final RecyclerView.ViewHolder holder, int position) {
|
||||
int viewType = getItemViewType(position);
|
||||
final QuickAction item = QuickActionFactory.produceAction(itemsList.get(position));
|
||||
int viewType = getItemViewType(position);
|
||||
final QuickAction item = QuickActionFactory.produceAction(itemsList.get(position));
|
||||
|
||||
if (viewType == SCREEN_ITEM_TYPE) {
|
||||
final QuickActionItemVH itemVH = (QuickActionItemVH) holder;
|
||||
|
@ -298,15 +294,15 @@ public class QuickActionListFragment extends BaseOsmAndFragment implements Quick
|
|||
notifyItemRangeChanged(position, itemsList.size() - position);
|
||||
|
||||
int lastPosition = itemsList.size() - 1;
|
||||
if (getItemViewType(lastPosition) == SCREEN_HEADER_TYPE){
|
||||
if (getItemViewType(lastPosition) == SCREEN_HEADER_TYPE) {
|
||||
itemsList.remove(lastPosition);
|
||||
notifyItemRemoved(lastPosition);
|
||||
}
|
||||
}
|
||||
|
||||
private void showFABIfNotScrollable() {
|
||||
LinearLayoutManager layoutManager = (LinearLayoutManager) quickActionRV.getLayoutManager();
|
||||
int lastVisibleItemPosition = layoutManager.findLastVisibleItemPosition();
|
||||
LinearLayoutManager layoutManager = (LinearLayoutManager) quickActionRV.getLayoutManager();
|
||||
int lastVisibleItemPosition = layoutManager.findLastVisibleItemPosition();
|
||||
if ((lastVisibleItemPosition == itemsList.size() - 1 || lastVisibleItemPosition == itemsList.size()) &&
|
||||
layoutManager.findFirstVisibleItemPosition() == 0 &&
|
||||
fab.getVisibility() != View.VISIBLE ||
|
||||
|
@ -372,7 +368,7 @@ public class QuickActionListFragment extends BaseOsmAndFragment implements Quick
|
|||
return false;
|
||||
else {
|
||||
int selectedPosition = viewHolder.getAdapterPosition();
|
||||
int targetPosition = target.getAdapterPosition();
|
||||
int targetPosition = target.getAdapterPosition();
|
||||
Log.v(TAG, "selected: " + selectedPosition + ", target: " + targetPosition);
|
||||
|
||||
if (selectedPosition < 0 || targetPosition < 0)
|
||||
|
@ -400,10 +396,10 @@ public class QuickActionListFragment extends BaseOsmAndFragment implements Quick
|
|||
}
|
||||
|
||||
public class QuickActionItemVH extends RecyclerView.ViewHolder {
|
||||
public TextView title;
|
||||
public TextView subTitle;
|
||||
public TextView title;
|
||||
public TextView subTitle;
|
||||
public ImageView icon;
|
||||
public View divider;
|
||||
public View divider;
|
||||
public ImageView handleView;
|
||||
public ImageView closeBtn;
|
||||
public View container;
|
||||
|
|
|
@ -25,6 +25,7 @@ import net.osmand.plus.OsmandApplication;
|
|||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.TargetPointsHelper;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.activities.SettingsBaseActivity;
|
||||
import net.osmand.plus.activities.SettingsNavigationActivity;
|
||||
|
@ -306,17 +307,20 @@ public class RoutingOptionsHelper {
|
|||
if (selectedIndex == -1) {
|
||||
selectedIndex = 0;
|
||||
}
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(mapActivity);
|
||||
|
||||
final boolean nightMode = app.getDaynightHelper().isNightModeForMapControls();
|
||||
Context themedContext = UiUtilities.getThemedContext(mapActivity, nightMode);
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(themedContext);
|
||||
final int layout = R.layout.list_menu_item_native_singlechoice;
|
||||
|
||||
final ArrayAdapter<String> listAdapter = new ArrayAdapter<String>(mapActivity, layout, R.id.text1, adapter.getItemNames()) {
|
||||
final ArrayAdapter<String> listAdapter = new ArrayAdapter<String>(themedContext, layout, R.id.text1, adapter.getItemNames()) {
|
||||
@NonNull
|
||||
@Override
|
||||
public View getView(final int position, View convertView, ViewGroup parent) {
|
||||
public View getView(final int position, View convertView, @NonNull ViewGroup parent) {
|
||||
// User super class to create the View
|
||||
View v = convertView;
|
||||
if (v == null) {
|
||||
v = mapActivity.getLayoutInflater().inflate(layout, null);
|
||||
v = UiUtilities.getInflater(mapActivity, nightMode).inflate(layout, parent, false);
|
||||
}
|
||||
final ContextMenuItem item = adapter.getItem(position);
|
||||
TextView tv = (TextView) v.findViewById(R.id.text1);
|
||||
|
|
|
@ -20,11 +20,11 @@ import android.widget.ImageView;
|
|||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.ValueHolder;
|
||||
import net.osmand.plus.OsmAndFormatter;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.activities.MapActivityLayers;
|
||||
import net.osmand.plus.activities.OsmandBaseExpandableListAdapter;
|
||||
|
@ -236,16 +236,18 @@ public class ShowAlongTheRouteBottomSheet extends MenuBottomSheetDialogFragment
|
|||
@Override
|
||||
public View getChildView(int groupPosition, final int childPosition,
|
||||
boolean isLastChild, View convertView, ViewGroup parent) {
|
||||
LayoutInflater themedInflater = UiUtilities.getInflater(mapActivity, nightMode);
|
||||
|
||||
final ContentItem group = contentItem.getSubItems().get(groupPosition);
|
||||
final ContentItem child = group.getSubItems().get(childPosition);
|
||||
|
||||
if (child instanceof RadiusItem) {
|
||||
convertView = createItemForRadiusProximity(group.type, nightMode);
|
||||
convertView = createItemForRadiusProximity(themedInflater, group.type);
|
||||
} else if (child instanceof InfoItem) {
|
||||
convertView = createInfoItem();
|
||||
convertView = createInfoItem(themedInflater);
|
||||
} else if (child instanceof PointItem) {
|
||||
final PointItem item = (PointItem) child;
|
||||
convertView = LayoutInflater.from(context).inflate(R.layout.along_the_route_point_item, parent, false);
|
||||
convertView = themedInflater.inflate(R.layout.along_the_route_point_item, parent, false);
|
||||
WaypointDialogHelper.updatePointInfoView(app, mapActivity, convertView, item.point, true, nightMode, true, false);
|
||||
|
||||
convertView.findViewById(R.id.waypoint_container).setOnClickListener(new View.OnClickListener() {
|
||||
|
@ -275,7 +277,6 @@ public class ShowAlongTheRouteBottomSheet extends MenuBottomSheetDialogFragment
|
|||
View bottomDivider = convertView.findViewById(R.id.bottom_divider);
|
||||
if (bottomDivider != null) {
|
||||
bottomDivider.setVisibility(isLastChild ? View.VISIBLE : View.GONE);
|
||||
AndroidUtils.setBackground(app, bottomDivider, nightMode, R.color.divider_color_light, R.color.divider_color_dark);
|
||||
}
|
||||
|
||||
if (child instanceof RadiusItem && group.type == WaypointHelper.POI) {
|
||||
|
@ -313,12 +314,10 @@ public class ShowAlongTheRouteBottomSheet extends MenuBottomSheetDialogFragment
|
|||
final boolean enabled = waypointHelper.isTypeEnabled(type);
|
||||
|
||||
if (convertView == null) {
|
||||
convertView = LayoutInflater.from(context)
|
||||
.inflate(R.layout.along_the_route_category_item, parent, false);
|
||||
convertView = UiUtilities.getInflater(context, nightMode).inflate(R.layout.along_the_route_category_item, parent, false);
|
||||
}
|
||||
TextView lblListHeader = (TextView) convertView.findViewById(R.id.title);
|
||||
lblListHeader.setText(getHeader(group.type, mapActivity));
|
||||
lblListHeader.setTextColor(ContextCompat.getColor(context, nightMode ? R.color.active_color_primary_dark : R.color.active_color_primary_light));
|
||||
|
||||
adjustIndicator(app, groupPosition, isExpanded, convertView, !nightMode);
|
||||
|
||||
|
@ -355,10 +354,7 @@ public class ShowAlongTheRouteBottomSheet extends MenuBottomSheetDialogFragment
|
|||
}
|
||||
});
|
||||
|
||||
View bottomDivider = convertView.findViewById(R.id.bottom_divider);
|
||||
|
||||
bottomDivider.setVisibility(isExpanded ? View.GONE : View.VISIBLE);
|
||||
AndroidUtils.setBackground(app, bottomDivider, nightMode, R.color.divider_color_light, R.color.divider_color_dark);
|
||||
convertView.findViewById(R.id.bottom_divider).setVisibility(isExpanded ? View.GONE : View.VISIBLE);
|
||||
|
||||
return convertView;
|
||||
}
|
||||
|
@ -407,19 +403,18 @@ public class ShowAlongTheRouteBottomSheet extends MenuBottomSheetDialogFragment
|
|||
return str;
|
||||
}
|
||||
|
||||
private View createInfoItem() {
|
||||
View view = mapActivity.getLayoutInflater().inflate(R.layout.show_along_the_route_info_item, null);
|
||||
private View createInfoItem(LayoutInflater themedInflater) {
|
||||
View view = themedInflater.inflate(R.layout.show_along_the_route_info_item, null);
|
||||
TextView titleTv = (TextView) view.findViewById(R.id.title);
|
||||
titleTv.setText(getText(R.string.waiting_for_route_calculation));
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
private View createItemForRadiusProximity(final int type, boolean nightMode) {
|
||||
private View createItemForRadiusProximity(LayoutInflater themedInflater, final int type) {
|
||||
View v;
|
||||
if (type == WaypointHelper.POI) {
|
||||
v = mapActivity.getLayoutInflater().inflate(R.layout.along_the_route_radius_poi, null);
|
||||
AndroidUtils.setTextSecondaryColor(mapActivity, (TextView) v.findViewById(R.id.titleEx), nightMode);
|
||||
v = themedInflater.inflate(R.layout.along_the_route_radius_poi, null);
|
||||
String descEx = !app.getPoiFilters().isShowingAnyPoi() ? getString(R.string.poi) : app.getPoiFilters().getSelectedPoiFiltersName();
|
||||
((TextView) v.findViewById(R.id.title)).setText(getString(R.string.search_radius_proximity) + ":");
|
||||
((TextView) v.findViewById(R.id.titleEx)).setText(getString(R.string.shared_string_type) + ":");
|
||||
|
@ -437,7 +432,6 @@ public class ShowAlongTheRouteBottomSheet extends MenuBottomSheetDialogFragment
|
|||
});
|
||||
}
|
||||
});
|
||||
AndroidUtils.setTextSecondaryColor(mapActivity, (TextView) v.findViewById(R.id.title), nightMode);
|
||||
final TextView radius = (TextView) v.findViewById(R.id.description);
|
||||
radius.setText(OsmAndFormatter.getFormattedDistance(waypointHelper.getSearchDeviationRadius(type), app));
|
||||
v.findViewById(R.id.firstCellContainer).setOnClickListener(new View.OnClickListener() {
|
||||
|
@ -447,14 +441,9 @@ public class ShowAlongTheRouteBottomSheet extends MenuBottomSheetDialogFragment
|
|||
selectDifferentRadius(type);
|
||||
}
|
||||
});
|
||||
AndroidUtils.setBackground(app, v.findViewById(R.id.top_divider), nightMode,
|
||||
R.color.divider_color_light, R.color.divider_color_dark);
|
||||
AndroidUtils.setBackground(app, v.findViewById(R.id.divider), nightMode,
|
||||
R.color.divider_color_light, R.color.divider_color_dark);
|
||||
} else {
|
||||
v = mapActivity.getLayoutInflater().inflate(R.layout.along_the_route_radius_simple, null);
|
||||
v = themedInflater.inflate(R.layout.along_the_route_radius_simple, null);
|
||||
((TextView) v.findViewById(R.id.title)).setText(getString(R.string.search_radius_proximity));
|
||||
AndroidUtils.setTextPrimaryColor(mapActivity, (TextView) v.findViewById(R.id.title), nightMode);
|
||||
final TextView radius = (TextView) v.findViewById(R.id.description);
|
||||
radius.setText(OsmAndFormatter.getFormattedDistance(waypointHelper.getSearchDeviationRadius(type), app));
|
||||
v.setOnClickListener(new View.OnClickListener() {
|
||||
|
|
|
@ -147,8 +147,7 @@ public abstract class BaseSettingsFragment extends PreferenceFragmentCompat impl
|
|||
|
||||
@Override
|
||||
public RecyclerView onCreateRecyclerView(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState) {
|
||||
Context themedContext = new ContextThemeWrapper(getActivity(), themeRes);
|
||||
LayoutInflater themedInflater = inflater.cloneInContext(themedContext);
|
||||
LayoutInflater themedInflater = UiUtilities.getInflater(getActivity(), nightMode);
|
||||
|
||||
RecyclerView recyclerView = super.onCreateRecyclerView(themedInflater, parent, savedInstanceState);
|
||||
recyclerView.setPadding(0, 0, 0, AndroidUtils.dpToPx(app, 80));
|
||||
|
@ -302,8 +301,7 @@ public abstract class BaseSettingsFragment extends PreferenceFragmentCompat impl
|
|||
AppBarLayout appBarLayout = (AppBarLayout) view.findViewById(R.id.appbar);
|
||||
ViewCompat.setElevation(appBarLayout, 5.0f);
|
||||
|
||||
Context themedContext = new ContextThemeWrapper(getActivity(), themeRes);
|
||||
View toolbarContainer = inflater.cloneInContext(themedContext).inflate(currentScreenType.toolbarResId, appBarLayout);
|
||||
View toolbarContainer = UiUtilities.getInflater(getActivity(), nightMode).inflate(currentScreenType.toolbarResId, appBarLayout);
|
||||
|
||||
TextView toolbarTitle = (TextView) view.findViewById(R.id.toolbar_title);
|
||||
toolbarTitle.setText(getPreferenceScreen().getTitle());
|
||||
|
|
Loading…
Reference in a new issue