code cleaninng

This commit is contained in:
madwasp79 2019-05-28 13:43:04 +03:00
parent 0975f81d0f
commit 7f0f207e7e
6 changed files with 28 additions and 91 deletions

View file

@ -40,23 +40,6 @@
android:layout_width="match_parent"
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
android:id="@+id/dismiss_button"
android:layout_width="0dp"

View file

@ -94,7 +94,6 @@
android:id="@+id/divider_bottom"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_weight="2"
android:background="@color/settings_divider"/>

View file

@ -142,17 +142,17 @@
<!-- ContextMenu -->
<dimen name="context_menu_top_shadow_h">20dp</dimen>
<dimen name="context_menu_icon_top_padding">17dp</dimen>
<dimen name="context_menu_first_line_top_margin">14dp</dimen>
<dimen name="context_menu_first_line_bottom_margin">16dp</dimen>
<dimen name="context_menu_second_line_top_margin">4dp</dimen>
<dimen name="context_menu_top_right_button_min_width">76dp</dimen>
<dimen name="context_menu_button_padding_x">10dp</dimen>
<dimen name="context_menu_buttons_top_margin">-16dp</dimen>
<dimen name="context_menu_buttons_padding_bottom">4dp</dimen>
<dimen name="context_menu_progress_min_height">54dp</dimen>
<dimen name="context_menu_progress_cancel_button_size">44dp</dimen>
<dimen name="context_menu_action_buttons_h">54dp</dimen>
<dimen name="context_menu_icon_top_padding">17dp</dimen>
<dimen name="context_menu_first_line_top_margin">14dp</dimen>
<dimen name="context_menu_first_line_bottom_margin">16dp</dimen>
<dimen name="context_menu_second_line_top_margin">4dp</dimen>
<dimen name="context_menu_top_right_button_min_width">76dp</dimen>
<dimen name="context_menu_button_padding_x">10dp</dimen>
<dimen name="context_menu_buttons_top_margin">-16dp</dimen>
<dimen name="context_menu_buttons_padding_bottom">4dp</dimen>
<dimen name="context_menu_progress_min_height">54dp</dimen>
<dimen name="context_menu_progress_cancel_button_size">44dp</dimen>
<dimen name="context_menu_action_buttons_h">54dp</dimen>
<dimen name="context_menu_sub_info_height">24dp</dimen>
<dimen name="context_menu_buttons_bottom_height">48dp</dimen>
<dimen name="context_menu_padding_margin_large">20dp</dimen>
@ -179,14 +179,14 @@
<dimen name="context_menu_big_icon_size">40dp</dimen>
<dimen name="fab_size_with_shadow">62dp</dimen>
<dimen name="fab_margin_right">12dp</dimen>
<dimen name="fab_margin_bottom_big">72dp</dimen>
<dimen name="fab_margin_right">12dp</dimen>
<dimen name="fab_margin_bottom_big">72dp</dimen>
<!-- TextSizes -->
<dimen name="default_list_text_size_large">19sp</dimen>
<dimen name="default_list_text_size">16sp</dimen>
<dimen name="default_desc_text_size">14sp</dimen>
<dimen name="default_sub_text_size">12sp</dimen>
<!-- TextSizes -->
<dimen name="default_list_text_size_large">19sp</dimen>
<dimen name="default_list_text_size">16sp</dimen>
<dimen name="default_desc_text_size">14sp</dimen>
<dimen name="default_sub_text_size">12sp</dimen>
<dimen name="default_sub_text_size_small">10sp</dimen>
<dimen name="welcome_header_text_size">23sp</dimen>
<dimen name="text_button_text_size">15sp</dimen>
@ -216,7 +216,7 @@
<dimen name="empty_state_text_button_padding_right">60dp</dimen>
<dimen name="empty_state_text_button_padding_top">64dp</dimen>
<dimen name="bottom_sheet_cancel_button_height">48dp</dimen>
<dimen name="bottom_sheet_cancel_button_height">48dp</dimen>
<dimen name="bottom_sheet_cancel_button_height_small">36dp</dimen>
<dimen name="landscape_bottom_sheet_dialog_fragment_width">360dp</dimen>
@ -302,9 +302,9 @@
<dimen name="multi_selection_menu_padding_top">13dp</dimen>
<dimen name="multi_selection_menu_padding_bottom">15dp</dimen>
<dimen name="grid_menu_item_width">120dp</dimen>
<dimen name="grid_menu_item_bottom_top_margin">16dp</dimen>
<dimen name="grid_menu_item_sides_margin">40dp</dimen>
<dimen name="grid_menu_item_width">120dp</dimen>
<dimen name="grid_menu_item_bottom_top_margin">16dp</dimen>
<dimen name="grid_menu_item_sides_margin">40dp</dimen>
<dimen name="bottom_sheet_menu_peek_height">300dp</dimen>

View file

@ -78,7 +78,7 @@ public class AppModesBottomSheetDialogFragment extends MenuBottomSheetDialogFrag
listener = new ProfileListener() {
@Override
public void changeProfileStatus(ApplicationMode item, boolean isSelected) {
if(isSelected) {
if (isSelected) {
selectedModes.add(item);
} else {
selectedModes.remove(item);
@ -99,7 +99,8 @@ public class AppModesBottomSheetDialogFragment extends MenuBottomSheetDialogFrag
adapter.setListener(listener);
allModes = ApplicationMode.allPossibleValues();
allModes.remove(ApplicationMode.DEFAULT);
adapter.updateItemsList(allModes, new LinkedHashSet<>(ApplicationMode.values(getMyApplication())));
adapter.updateItemsList(allModes,
new LinkedHashSet<>(ApplicationMode.values(getMyApplication())));
setupHeightAndBackground(getView());
}
@ -113,16 +114,12 @@ public class AppModesBottomSheetDialogFragment extends MenuBottomSheetDialogFrag
@Override
public void createMenuItems(Bundle savedInstanceState) {
final View textButtonView = View.inflate(new ContextThemeWrapper(getContext(), themeRes),
R.layout.bottom_sheet_item_simple, null);
TextView textView = (TextView) textButtonView.findViewById(R.id.title);
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.setTextColor(nightMode
? getResources().getColor(R.color.active_buttons_and_links_dark)
@ -137,9 +134,7 @@ public class AppModesBottomSheetDialogFragment extends MenuBottomSheetDialogFrag
public void onClick(View v) {
startActivity(new Intent(getContext(), SettingsProfileActivity.class));
}
})
.create());
}).create());
}
public void setUpdateMapRouteMenuListener(
@ -147,7 +142,7 @@ public class AppModesBottomSheetDialogFragment extends MenuBottomSheetDialogFrag
this.updateMapRouteMenuListener = updateMapRouteMenuListener;
}
public interface UpdateMapRouteMenuListener{
public interface UpdateMapRouteMenuListener {
void updateAppModeMenu();
}
}

View file

@ -213,8 +213,6 @@ public class SelectProfileBottomSheetDialogFragment extends MenuBottomSheetDialo
}
}
private void getListener() {
if (getActivity() != null && getActivity() instanceof EditProfileActivity) {
EditProfileFragment f = (EditProfileFragment) getActivity().getSupportFragmentManager()

View file

@ -732,10 +732,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
mainView.findViewById(R.id.app_modes_options).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
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();
}
// 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) {
MapActivity mapActivity = getMapActivity();
if (mapActivity != null) {