code cleaninng
This commit is contained in:
parent
0975f81d0f
commit
7f0f207e7e
6 changed files with 28 additions and 91 deletions
|
@ -40,23 +40,6 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="@dimen/bottom_sheet_cancel_button_height">
|
android:layout_height="@dimen/bottom_sheet_cancel_button_height">
|
||||||
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/dismiss_button_v2"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="@dimen/bottom_sheet_cancel_button_height_small"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:layout_marginStart="@dimen/content_padding_small"
|
|
||||||
android:layout_marginEnd="@dimen/list_content_padding"
|
|
||||||
android:layout_marginLeft="@dimen/content_padding_small"
|
|
||||||
android:layout_marginRight="@dimen/content_padding_small"
|
|
||||||
android:background="@drawable/btn_round_profile_gray"
|
|
||||||
android:text="@string/shared_string_cancel"
|
|
||||||
android:textAllCaps="false"
|
|
||||||
android:visibility="gone"
|
|
||||||
android:textColor="@color/map_widget_blue"/>
|
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:id="@+id/dismiss_button"
|
android:id="@+id/dismiss_button"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
|
|
|
@ -94,7 +94,6 @@
|
||||||
android:id="@+id/divider_bottom"
|
android:id="@+id/divider_bottom"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="1dp"
|
android:layout_height="1dp"
|
||||||
android:layout_weight="2"
|
|
||||||
android:background="@color/settings_divider"/>
|
android:background="@color/settings_divider"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -78,7 +78,7 @@ public class AppModesBottomSheetDialogFragment extends MenuBottomSheetDialogFrag
|
||||||
listener = new ProfileListener() {
|
listener = new ProfileListener() {
|
||||||
@Override
|
@Override
|
||||||
public void changeProfileStatus(ApplicationMode item, boolean isSelected) {
|
public void changeProfileStatus(ApplicationMode item, boolean isSelected) {
|
||||||
if(isSelected) {
|
if (isSelected) {
|
||||||
selectedModes.add(item);
|
selectedModes.add(item);
|
||||||
} else {
|
} else {
|
||||||
selectedModes.remove(item);
|
selectedModes.remove(item);
|
||||||
|
@ -99,7 +99,8 @@ public class AppModesBottomSheetDialogFragment extends MenuBottomSheetDialogFrag
|
||||||
adapter.setListener(listener);
|
adapter.setListener(listener);
|
||||||
allModes = ApplicationMode.allPossibleValues();
|
allModes = ApplicationMode.allPossibleValues();
|
||||||
allModes.remove(ApplicationMode.DEFAULT);
|
allModes.remove(ApplicationMode.DEFAULT);
|
||||||
adapter.updateItemsList(allModes, new LinkedHashSet<>(ApplicationMode.values(getMyApplication())));
|
adapter.updateItemsList(allModes,
|
||||||
|
new LinkedHashSet<>(ApplicationMode.values(getMyApplication())));
|
||||||
setupHeightAndBackground(getView());
|
setupHeightAndBackground(getView());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -113,16 +114,12 @@ public class AppModesBottomSheetDialogFragment extends MenuBottomSheetDialogFrag
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void createMenuItems(Bundle savedInstanceState) {
|
public void createMenuItems(Bundle savedInstanceState) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
final View textButtonView = View.inflate(new ContextThemeWrapper(getContext(), themeRes),
|
final View textButtonView = View.inflate(new ContextThemeWrapper(getContext(), themeRes),
|
||||||
R.layout.bottom_sheet_item_simple, null);
|
R.layout.bottom_sheet_item_simple, null);
|
||||||
TextView textView = (TextView) textButtonView.findViewById(R.id.title);
|
TextView textView = (TextView) textButtonView.findViewById(R.id.title);
|
||||||
|
|
||||||
int dpPadding = (int) (8 * getResources().getDisplayMetrics().density + 0.5f);
|
int dpPadding = (int) (8 * getResources().getDisplayMetrics().density + 0.5f);
|
||||||
textView.setPadding(dpPadding, 0,0,0);
|
textView.setPadding(dpPadding, 0, 0, 0);
|
||||||
textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 16.0f);
|
textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 16.0f);
|
||||||
textView.setTextColor(nightMode
|
textView.setTextColor(nightMode
|
||||||
? getResources().getColor(R.color.active_buttons_and_links_dark)
|
? getResources().getColor(R.color.active_buttons_and_links_dark)
|
||||||
|
@ -137,9 +134,7 @@ public class AppModesBottomSheetDialogFragment extends MenuBottomSheetDialogFrag
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
startActivity(new Intent(getContext(), SettingsProfileActivity.class));
|
startActivity(new Intent(getContext(), SettingsProfileActivity.class));
|
||||||
}
|
}
|
||||||
})
|
}).create());
|
||||||
.create());
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUpdateMapRouteMenuListener(
|
public void setUpdateMapRouteMenuListener(
|
||||||
|
@ -147,7 +142,7 @@ public class AppModesBottomSheetDialogFragment extends MenuBottomSheetDialogFrag
|
||||||
this.updateMapRouteMenuListener = updateMapRouteMenuListener;
|
this.updateMapRouteMenuListener = updateMapRouteMenuListener;
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface UpdateMapRouteMenuListener{
|
public interface UpdateMapRouteMenuListener {
|
||||||
void updateAppModeMenu();
|
void updateAppModeMenu();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -213,8 +213,6 @@ public class SelectProfileBottomSheetDialogFragment extends MenuBottomSheetDialo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void getListener() {
|
private void getListener() {
|
||||||
if (getActivity() != null && getActivity() instanceof EditProfileActivity) {
|
if (getActivity() != null && getActivity() instanceof EditProfileActivity) {
|
||||||
EditProfileFragment f = (EditProfileFragment) getActivity().getSupportFragmentManager()
|
EditProfileFragment f = (EditProfileFragment) getActivity().getSupportFragmentManager()
|
||||||
|
|
|
@ -732,10 +732,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
||||||
mainView.findViewById(R.id.app_modes_options).setOnClickListener(new OnClickListener() {
|
mainView.findViewById(R.id.app_modes_options).setOnClickListener(new OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
|
||||||
showProfileBottomSheetDialog();
|
showProfileBottomSheetDialog();
|
||||||
//todo clear (+ method's body) before final commit
|
|
||||||
//availableProfileDialog();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -762,41 +759,6 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
||||||
.add(fragment, "app_profile_settings").commitAllowingStateLoss();
|
.add(fragment, "app_profile_settings").commitAllowingStateLoss();
|
||||||
}
|
}
|
||||||
|
|
||||||
// private void availableProfileDialog() {
|
|
||||||
// MapActivity mapActivity = getMapActivity();
|
|
||||||
// if (mapActivity != null) {
|
|
||||||
// AlertDialog.Builder b = new AlertDialog.Builder(mapActivity);
|
|
||||||
// final OsmandSettings settings = mapActivity.getMyApplication().getSettings();
|
|
||||||
// final List<ApplicationMode> modes = ApplicationMode.allPossibleValues();
|
|
||||||
// modes.remove(ApplicationMode.DEFAULT);
|
|
||||||
// final Set<ApplicationMode> selected = new LinkedHashSet<>(ApplicationMode.values(mapActivity.getMyApplication()));
|
|
||||||
// selected.remove(ApplicationMode.DEFAULT);
|
|
||||||
// View v = AppModeDialog.prepareAppModeView(mapActivity, modes, selected, null, false, true, false,
|
|
||||||
// new OnClickListener() {
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void onClick(View v) {
|
|
||||||
// StringBuilder vls = new StringBuilder(ApplicationMode.DEFAULT.getStringKey() + ",");
|
|
||||||
// for (ApplicationMode mode : modes) {
|
|
||||||
// if (selected.contains(mode)) {
|
|
||||||
// vls.append(mode.getStringKey()).append(",");
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// settings.AVAILABLE_APP_MODES.set(vls.toString());
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// b.setTitle(R.string.profile_settings);
|
|
||||||
// b.setPositiveButton(R.string.shared_string_ok, new DialogInterface.OnClickListener() {
|
|
||||||
// @Override
|
|
||||||
// public void onClick(DialogInterface dialog, int which) {
|
|
||||||
// updateApplicationModes();
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// b.setView(v);
|
|
||||||
// b.show();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
private void updateApplicationMode(ApplicationMode mode, ApplicationMode next) {
|
private void updateApplicationMode(ApplicationMode mode, ApplicationMode next) {
|
||||||
MapActivity mapActivity = getMapActivity();
|
MapActivity mapActivity = getMapActivity();
|
||||||
if (mapActivity != null) {
|
if (mapActivity != null) {
|
||||||
|
|
Loading…
Reference in a new issue