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

@ -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) {