Selected Profile UI fixes and tweaks
This commit is contained in:
parent
7e98dd6d6e
commit
5a41dbb962
6 changed files with 180 additions and 39 deletions
17
OsmAnd/res/drawable/btn_round_profile_blue.xml
Normal file
17
OsmAnd/res/drawable/btn_round_profile_blue.xml
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<item android:state_pressed="true"><shape android:shape="rectangle">
|
||||||
|
<solid android:color="@color/map_widget_blue_pressed" />
|
||||||
|
<corners android:radius="@dimen/map_button_rect_rad" />
|
||||||
|
</shape></item>
|
||||||
|
<item android:state_enabled="false"><shape android:shape="rectangle">
|
||||||
|
<solid android:color="@color/searchbar_tab_inactive_light" />
|
||||||
|
<corners android:radius="@dimen/map_button_rect_rad" />
|
||||||
|
</shape></item>
|
||||||
|
<item><shape android:shape="rectangle">
|
||||||
|
<solid android:color="@color/active_buttons_and_links_light" />
|
||||||
|
<corners android:radius="@dimen/map_button_rect_rad" />
|
||||||
|
</shape></item>
|
||||||
|
|
||||||
|
</selector>
|
16
OsmAnd/res/drawable/btn_round_profile_gray.xml
Normal file
16
OsmAnd/res/drawable/btn_round_profile_gray.xml
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item android:state_pressed="true"><shape android:shape="rectangle">
|
||||||
|
<solid android:color="@color/profile_button_gray_pressed" />
|
||||||
|
<corners android:radius="@dimen/map_button_rect_rad" />
|
||||||
|
</shape></item>
|
||||||
|
<item android:state_enabled="false"><shape android:shape="rectangle">
|
||||||
|
<solid android:color="@color/searchbar_tab_inactive_light" />
|
||||||
|
<corners android:radius="@dimen/map_button_rect_rad" />
|
||||||
|
</shape></item>
|
||||||
|
<item><shape android:shape="rectangle">
|
||||||
|
<solid android:color="@color/profile_button_gray" />
|
||||||
|
<corners android:radius="@dimen/map_button_rect_rad" />
|
||||||
|
</shape></item>
|
||||||
|
|
||||||
|
</selector>
|
|
@ -13,6 +13,8 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="top"
|
android:layout_gravity="top"
|
||||||
|
android:focusable="true"
|
||||||
|
android:focusableInTouchMode="true"
|
||||||
android:layout_marginBottom="@dimen/setting_profile_item_height">
|
android:layout_marginBottom="@dimen/setting_profile_item_height">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
@ -64,7 +66,6 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
android:textAppearance="@style/TextAppearance.ListItemTitle"
|
|
||||||
android:text="Base Profile"/>
|
android:text="Base Profile"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
@ -73,7 +74,7 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
android:textSize="16sp"
|
android:textSize="18sp"
|
||||||
android:textColor="?attr/main_font_color_basic"
|
android:textColor="?attr/main_font_color_basic"
|
||||||
tools:text="Item additional desription"/>
|
tools:text="Item additional desription"/>
|
||||||
|
|
||||||
|
@ -137,7 +138,7 @@
|
||||||
<net.osmand.plus.widgets.OsmandTextFieldBoxes
|
<net.osmand.plus.widgets.OsmandTextFieldBoxes
|
||||||
android:id="@+id/profile_name_otfb"
|
android:id="@+id/profile_name_otfb"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="60dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:layout_marginTop="@dimen/list_content_padding"
|
android:layout_marginTop="@dimen/list_content_padding"
|
||||||
android:layout_marginBottom="@dimen/list_content_padding"
|
android:layout_marginBottom="@dimen/list_content_padding"
|
||||||
|
@ -160,8 +161,8 @@
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/profile_icon_layout"
|
android:id="@+id/profile_icon_layout"
|
||||||
android:layout_width="68dp"
|
android:layout_width="60dp"
|
||||||
android:layout_height="68dp"
|
android:layout_height="60dp"
|
||||||
android:layout_marginEnd="@dimen/list_content_padding"
|
android:layout_marginEnd="@dimen/list_content_padding"
|
||||||
android:layout_marginRight="@dimen/list_content_padding"
|
android:layout_marginRight="@dimen/list_content_padding"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
|
@ -174,7 +175,8 @@
|
||||||
android:id="@+id/select_icon_btn_txt"
|
android:id="@+id/select_icon_btn_txt"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:paddingBottom="8dp"
|
android:textSize="12sp"
|
||||||
|
android:paddingBottom="2dp"
|
||||||
android:text="Icon"/>
|
android:text="Icon"/>
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
|
@ -198,7 +200,7 @@
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginBottom="@dimen/list_content_padding"
|
android:layout_marginBottom="8dp"
|
||||||
android:layout_marginStart="@dimen/list_content_padding"
|
android:layout_marginStart="@dimen/list_content_padding"
|
||||||
android:layout_marginEnd="@dimen/list_content_padding"
|
android:layout_marginEnd="@dimen/list_content_padding"
|
||||||
android:layout_marginLeft="@dimen/list_content_padding"
|
android:layout_marginLeft="@dimen/list_content_padding"
|
||||||
|
@ -216,7 +218,7 @@
|
||||||
<net.osmand.plus.widgets.OsmandTextFieldBoxes
|
<net.osmand.plus.widgets.OsmandTextFieldBoxes
|
||||||
android:id="@+id/navigation_type_otfb"
|
android:id="@+id/navigation_type_otfb"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="60dp"
|
||||||
|
|
||||||
app:labelText="Navigation Type">
|
app:labelText="Navigation Type">
|
||||||
|
|
||||||
|
@ -228,7 +230,7 @@
|
||||||
android:drawableRight="@drawable/ic_action_arrow_drop_down"
|
android:drawableRight="@drawable/ic_action_arrow_drop_down"
|
||||||
android:focusable="false"
|
android:focusable="false"
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
android:textSize="@dimen/default_list_text_size"
|
|
||||||
tools:text="Car"/>
|
tools:text="Car"/>
|
||||||
|
|
||||||
</net.osmand.plus.widgets.OsmandTextFieldBoxes>
|
</net.osmand.plus.widgets.OsmandTextFieldBoxes>
|
||||||
|
@ -245,7 +247,7 @@
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginBottom="@dimen/list_content_padding"
|
android:layout_marginBottom="12dp"
|
||||||
android:layout_marginStart="@dimen/list_content_padding"
|
android:layout_marginStart="@dimen/list_content_padding"
|
||||||
android:layout_marginEnd="@dimen/list_content_padding"
|
android:layout_marginEnd="@dimen/list_content_padding"
|
||||||
android:layout_marginLeft="@dimen/list_content_padding"
|
android:layout_marginLeft="@dimen/list_content_padding"
|
||||||
|
@ -314,6 +316,7 @@
|
||||||
android:id="@+id/map_config_btn"
|
android:id="@+id/map_config_btn"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="65dp"
|
android:layout_height="65dp"
|
||||||
|
android:background="?android:attr/selectableItemBackground"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
@ -356,12 +359,13 @@
|
||||||
android:layout_height="1dp"
|
android:layout_height="1dp"
|
||||||
android:layout_marginStart="64dp"
|
android:layout_marginStart="64dp"
|
||||||
android:layout_marginLeft="64dp"
|
android:layout_marginLeft="64dp"
|
||||||
android:background="?android:attr/listDivider"/>
|
android:background="@color/divider_light"/>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/screen_config_btn"
|
android:id="@+id/screen_config_btn"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="64dp"
|
android:layout_height="64dp"
|
||||||
|
android:background="?android:attr/selectableItemBackground"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
@ -405,7 +409,7 @@
|
||||||
android:layout_height="1dp"
|
android:layout_height="1dp"
|
||||||
android:layout_marginStart="64dp"
|
android:layout_marginStart="64dp"
|
||||||
android:layout_marginLeft="64dp"
|
android:layout_marginLeft="64dp"
|
||||||
android:background="?android:attr/listDivider"
|
android:background="@color/divider_light"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
@ -413,6 +417,7 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="64dp"
|
android:layout_height="64dp"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
|
android:background="?android:attr/selectableItemBackground"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
|
@ -421,7 +426,7 @@
|
||||||
android:layout_height="24dp"
|
android:layout_height="24dp"
|
||||||
android:layout_marginStart="@dimen/list_content_padding"
|
android:layout_marginStart="@dimen/list_content_padding"
|
||||||
android:layout_marginLeft="@dimen/list_content_padding"
|
android:layout_marginLeft="@dimen/list_content_padding"
|
||||||
android:src="@drawable/ic_action_start_navigation"
|
android:src="@drawable/ic_action_gdirections_dark"
|
||||||
android:tint="?attr/primary_icon_color"/>
|
android:tint="?attr/primary_icon_color"/>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
@ -456,7 +461,48 @@
|
||||||
<include layout="@layout/list_shadow_footer"/>
|
<include layout="@layout/list_shadow_footer"/>
|
||||||
|
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/buttons_layout_sv"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="bottom"
|
||||||
|
android:background="?attr/bg_color"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:visibility="gone">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/cancel_button_sv"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="42dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:layout_marginTop="@dimen/list_content_padding"
|
||||||
|
android:layout_marginBottom="@dimen/list_content_padding"
|
||||||
|
android:layout_marginStart="@dimen/list_content_padding"
|
||||||
|
android:layout_marginEnd="8dp"
|
||||||
|
android:layout_marginLeft="@dimen/list_content_padding"
|
||||||
|
android:layout_marginRight="8dp"
|
||||||
|
android:background="@drawable/btn_round_profile_gray"
|
||||||
|
android:text="@string/shared_string_cancel"
|
||||||
|
android:textAllCaps="false"
|
||||||
|
android:textColor="@color/map_widget_blue"/>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/save_profile_btn_sv"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="42dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:layout_marginTop="@dimen/list_content_padding"
|
||||||
|
android:layout_marginBottom="@dimen/list_content_padding"
|
||||||
|
android:layout_marginStart="8dp"
|
||||||
|
android:layout_marginEnd="@dimen/list_content_padding"
|
||||||
|
android:layout_marginLeft="8dp"
|
||||||
|
android:layout_marginRight="@dimen/list_content_padding"
|
||||||
|
android:background="@drawable/btn_round_profile_blue"
|
||||||
|
android:text="@string/shared_string_save"
|
||||||
|
android:textAllCaps="false"
|
||||||
|
android:textColor="@color/color_white"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
@ -473,7 +519,7 @@
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/cancel_button"
|
android:id="@+id/cancel_button"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="42dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:layout_marginTop="@dimen/list_content_padding"
|
android:layout_marginTop="@dimen/list_content_padding"
|
||||||
android:layout_marginBottom="@dimen/list_content_padding"
|
android:layout_marginBottom="@dimen/list_content_padding"
|
||||||
|
@ -481,7 +527,7 @@
|
||||||
android:layout_marginEnd="8dp"
|
android:layout_marginEnd="8dp"
|
||||||
android:layout_marginLeft="@dimen/list_content_padding"
|
android:layout_marginLeft="@dimen/list_content_padding"
|
||||||
android:layout_marginRight="8dp"
|
android:layout_marginRight="8dp"
|
||||||
android:background="@drawable/btn_right_round"
|
android:background="@drawable/btn_round_profile_gray"
|
||||||
android:text="@string/shared_string_cancel"
|
android:text="@string/shared_string_cancel"
|
||||||
android:textAllCaps="false"
|
android:textAllCaps="false"
|
||||||
android:textColor="@color/map_widget_blue"/>
|
android:textColor="@color/map_widget_blue"/>
|
||||||
|
@ -489,7 +535,7 @@
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/save_profile_btn"
|
android:id="@+id/save_profile_btn"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="42dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:layout_marginTop="@dimen/list_content_padding"
|
android:layout_marginTop="@dimen/list_content_padding"
|
||||||
android:layout_marginBottom="@dimen/list_content_padding"
|
android:layout_marginBottom="@dimen/list_content_padding"
|
||||||
|
@ -497,7 +543,7 @@
|
||||||
android:layout_marginEnd="@dimen/list_content_padding"
|
android:layout_marginEnd="@dimen/list_content_padding"
|
||||||
android:layout_marginLeft="8dp"
|
android:layout_marginLeft="8dp"
|
||||||
android:layout_marginRight="@dimen/list_content_padding"
|
android:layout_marginRight="@dimen/list_content_padding"
|
||||||
android:background="@drawable/btn_round_blue"
|
android:background="@drawable/btn_round_profile_blue"
|
||||||
android:text="@string/shared_string_save"
|
android:text="@string/shared_string_save"
|
||||||
android:textAllCaps="false"
|
android:textAllCaps="false"
|
||||||
android:textColor="@color/color_white"/>
|
android:textColor="@color/color_white"/>
|
||||||
|
|
|
@ -481,6 +481,7 @@
|
||||||
<color name="active_buttons_and_links_trans_light">#66237bff</color>
|
<color name="active_buttons_and_links_trans_light">#66237bff</color>
|
||||||
<color name="active_buttons_and_links_trans_dark">#66d28521</color>
|
<color name="active_buttons_and_links_trans_dark">#66d28521</color>
|
||||||
<color name="settings_divider">#dcdcdc</color>
|
<color name="settings_divider">#dcdcdc</color>
|
||||||
|
<color name="profile_button_gray">#EFEFEF</color>
|
||||||
|
<color name="profile_button_gray_pressed">#ababab</color>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
|
@ -1,5 +1,6 @@
|
||||||
package net.osmand.plus.profiles;
|
package net.osmand.plus.profiles;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
|
|
||||||
|
@ -7,6 +8,8 @@ import android.support.v4.view.MenuItemCompat;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
|
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.inputmethod.InputMethodManager;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.OsmandActionBarActivity;
|
import net.osmand.plus.activities.OsmandActionBarActivity;
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
package net.osmand.plus.profiles;
|
package net.osmand.plus.profiles;
|
||||||
|
|
||||||
|
import static net.osmand.plus.activities.SettingsBaseActivity.getRoutingStringPropertyDescription;
|
||||||
import static net.osmand.plus.activities.SettingsNavigationActivity.INTENT_SKIP_DIALOG;
|
import static net.osmand.plus.activities.SettingsNavigationActivity.INTENT_SKIP_DIALOG;
|
||||||
import static net.osmand.plus.profiles.ProfileBottomSheetDialogFragment.TYPE_APP_PROFILE;
|
import static net.osmand.plus.profiles.ProfileBottomSheetDialogFragment.TYPE_APP_PROFILE;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.DialogInterface.OnDismissListener;
|
import android.content.DialogInterface.OnDismissListener;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
@ -23,12 +25,15 @@ import android.view.View.OnClickListener;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
import android.view.ViewTreeObserver.OnGlobalLayoutListener;
|
import android.view.ViewTreeObserver.OnGlobalLayoutListener;
|
||||||
|
import android.view.ViewTreeObserver.OnScrollChangedListener;
|
||||||
|
import android.view.inputmethod.InputMethodManager;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.ScrollView;
|
import android.widget.ScrollView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -92,6 +97,11 @@ public class EditProfileFragment extends BaseOsmAndFragment {
|
||||||
private ImageView baseModeIcon;
|
private ImageView baseModeIcon;
|
||||||
private TextView baseModeTitle;
|
private TextView baseModeTitle;
|
||||||
private ScrollView scrollContainer;
|
private ScrollView scrollContainer;
|
||||||
|
private LinearLayout buttonsLayoutSV;
|
||||||
|
private Button cancelBtnSV;
|
||||||
|
private Button saveButtonSV;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
|
@ -133,6 +143,9 @@ public class EditProfileFragment extends BaseOsmAndFragment {
|
||||||
baseModeIcon = view.findViewById(R.id.mode_icon);
|
baseModeIcon = view.findViewById(R.id.mode_icon);
|
||||||
baseModeTitle = view.findViewById(R.id.mode_title);
|
baseModeTitle = view.findViewById(R.id.mode_title);
|
||||||
scrollContainer = view.findViewById(R.id.scroll_view_container);
|
scrollContainer = view.findViewById(R.id.scroll_view_container);
|
||||||
|
buttonsLayoutSV = view.findViewById(R.id.buttons_layout_sv);
|
||||||
|
cancelBtnSV = view.findViewById(R.id.save_profile_btn_sv);
|
||||||
|
saveButtonSV = view.findViewById(R.id.cancel_button_sv);
|
||||||
|
|
||||||
profileNameEt.setFocusable(true);
|
profileNameEt.setFocusable(true);
|
||||||
profileNameEt.setSelectAllOnFocus(true);
|
profileNameEt.setSelectAllOnFocus(true);
|
||||||
|
@ -247,9 +260,16 @@ public class EditProfileFragment extends BaseOsmAndFragment {
|
||||||
((EditProfileActivity) getActivity()).getSupportActionBar().setElevation(5.0f);
|
((EditProfileActivity) getActivity()).getSupportActionBar().setElevation(5.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
profileIcon.setImageDrawable(app.getUIUtilities().getIcon(startIconId,
|
int iconColor;
|
||||||
isNightMode ? R.color.active_buttons_and_links_dark
|
if (!isUserProfile) {
|
||||||
: R.color.active_buttons_and_links_light));
|
iconColor = R.color.icon_color;
|
||||||
|
} else {
|
||||||
|
iconColor = isNightMode
|
||||||
|
? R.color.active_buttons_and_links_dark
|
||||||
|
: R.color.active_buttons_and_links_light;
|
||||||
|
}
|
||||||
|
|
||||||
|
profileIcon.setImageDrawable(app.getUIUtilities().getIcon(startIconId, iconColor));
|
||||||
|
|
||||||
profileTypeDialogListener = new ProfileTypeDialogListener() {
|
profileTypeDialogListener = new ProfileTypeDialogListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -336,7 +356,6 @@ public class EditProfileFragment extends BaseOsmAndFragment {
|
||||||
.add(iconSelectDialog, "select_icon")
|
.add(iconSelectDialog, "select_icon")
|
||||||
.commitAllowingStateLoss();
|
.commitAllowingStateLoss();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -398,6 +417,15 @@ public class EditProfileFragment extends BaseOsmAndFragment {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
cancelBtnSV.setOnClickListener(new OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
if (getActivity() != null) {
|
||||||
|
getActivity().onBackPressed();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
saveButton.setOnClickListener(new OnClickListener() {
|
saveButton.setOnClickListener(new OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
@ -407,11 +435,21 @@ public class EditProfileFragment extends BaseOsmAndFragment {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
saveButtonSV.setOnClickListener(new OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
if (saveNewProfile()) {
|
||||||
|
getActivity().onBackPressed();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
view.getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
|
view.getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onGlobalLayout() {
|
public void onGlobalLayout() {
|
||||||
int marginShow = 66;
|
int marginShow = 66;
|
||||||
int marginHide = 2;
|
int marginHide = 2;
|
||||||
|
|
||||||
float d = getResources().getDisplayMetrics().density;
|
float d = getResources().getDisplayMetrics().density;
|
||||||
Rect r = new Rect();
|
Rect r = new Rect();
|
||||||
view.getWindowVisibleDisplayFrame(r);
|
view.getWindowVisibleDisplayFrame(r);
|
||||||
|
@ -419,20 +457,35 @@ public class EditProfileFragment extends BaseOsmAndFragment {
|
||||||
int keypadHeight = screenHeight - r.bottom;
|
int keypadHeight = screenHeight - r.bottom;
|
||||||
if (keypadHeight > screenHeight * 0.15) {
|
if (keypadHeight > screenHeight * 0.15) {
|
||||||
buttonsLayout.setVisibility(View.GONE);
|
buttonsLayout.setVisibility(View.GONE);
|
||||||
|
buttonsLayoutSV.setVisibility(View.VISIBLE);
|
||||||
setMargins(scrollContainer, 0, 0, 0, (int) (marginHide * d));
|
setMargins(scrollContainer, 0, 0, 0, (int) (marginHide * d));
|
||||||
} else {
|
} else {
|
||||||
|
buttonsLayoutSV.setVisibility(View.GONE);
|
||||||
buttonsLayout.setVisibility(View.VISIBLE);
|
buttonsLayout.setVisibility(View.VISIBLE);
|
||||||
setMargins(scrollContainer, 0, 0, 0, (int) (marginShow * d));
|
setMargins(scrollContainer, 0, 0, 0, (int) (marginShow * d));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||||
|
super.onViewCreated(view, savedInstanceState);
|
||||||
if (!isUserProfile && !isNew) {
|
if (!isUserProfile && !isNew) {
|
||||||
profileNameEt.setFocusable(false);
|
profileNameEt.setFocusable(false);
|
||||||
navTypeEt.setFocusable(false);
|
navTypeEt.setFocusable(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
return view;
|
if (isNew) {
|
||||||
|
profileNameEt.requestFocus();
|
||||||
|
} else {
|
||||||
|
scrollContainer.requestFocus();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void activateMode(ApplicationMode mode) {
|
void activateMode(ApplicationMode mode) {
|
||||||
|
@ -573,23 +626,28 @@ public class EditProfileFragment extends BaseOsmAndFragment {
|
||||||
|
|
||||||
void onDeleteProfileClick() {
|
void onDeleteProfileClick() {
|
||||||
if (getActivity() != null) {
|
if (getActivity() != null) {
|
||||||
AlertDialog.Builder bld = new AlertDialog.Builder(getActivity());
|
if (isUserProfile) {
|
||||||
bld.setTitle("Delete Profile");
|
AlertDialog.Builder bld = new AlertDialog.Builder(getActivity());
|
||||||
bld.setMessage(String
|
bld.setTitle("Delete Profile");
|
||||||
.format("Are you sure you want to delete %s profile", profile.userProfileTitle));
|
bld.setMessage(String
|
||||||
bld.setPositiveButton(R.string.shared_string_delete,
|
.format("Are you sure you want to delete %s profile", profile.userProfileTitle));
|
||||||
new DialogInterface.OnClickListener() {
|
bld.setPositiveButton(R.string.shared_string_delete,
|
||||||
@Override
|
new DialogInterface.OnClickListener() {
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
@Override
|
||||||
ApplicationMode
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
.deleteCustomMode(profile.getUserProfileTitle(), getMyApplication());
|
ApplicationMode
|
||||||
if (getActivity() != null) {
|
.deleteCustomMode(profile.getUserProfileTitle(), getMyApplication());
|
||||||
getActivity().onBackPressed();
|
if (getActivity() != null) {
|
||||||
|
getActivity().onBackPressed();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
bld.setNegativeButton(R.string.shared_string_dismiss, null);
|
||||||
bld.setNegativeButton(R.string.shared_string_dismiss, null);
|
bld.show();
|
||||||
bld.show();
|
} else {
|
||||||
|
Toast.makeText(getActivity(), "You cannot delete OsmAnd base profiles", Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue