edit profile screen ui changes

This commit is contained in:
madwasp79 2019-05-03 15:59:20 +03:00
parent 6c500b6c11
commit 15703a4c90
2 changed files with 61 additions and 38 deletions

View file

@ -34,19 +34,43 @@
android:gravity="center_vertical" android:gravity="center_vertical"
android:orientation="horizontal"> android:orientation="horizontal">
<net.osmand.plus.widgets.OsmandTextFieldBoxes
android:id="@+id/profile_name_otfb"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/list_content_padding"
android:layout_marginBottom="@dimen/list_content_padding"
android:layout_marginStart="@dimen/list_content_padding"
android:layout_marginEnd="@dimen/list_content_padding"
android:layout_marginLeft="@dimen/list_content_padding"
android:layout_marginRight="@dimen/list_content_padding"
android:layout_weight="1"
app:labelText="Name">
<studio.carbonylgroup.textfieldboxes.ExtendedEditText
android:id="@+id/profile_name_et"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLines="1"
tools:text="@string/lorem_ipsum"/>
</net.osmand.plus.widgets.OsmandTextFieldBoxes>
<LinearLayout <LinearLayout
android:id="@+id/profile_icon_layout" android:id="@+id/profile_icon_layout"
android:layout_width="68dp" android:layout_width="68dp"
android:layout_height="68dp" android:layout_height="68dp"
android:layout_marginStart="@dimen/list_content_padding" android:layout_marginEnd="@dimen/list_content_padding"
android:layout_marginLeft="@dimen/list_content_padding" android:layout_marginRight="@dimen/list_content_padding"
android:clickable="true" android:clickable="true"
android:focusable="true" android:focusable="true"
android:gravity="center" android:gravity="center"
android:orientation="vertical" android:orientation="vertical"
> >
<TextView <TextView
android:id="@+id/select_icon_btn_txt" android:id="@+id/select_icon_btn_txt"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -64,28 +88,6 @@
</LinearLayout> </LinearLayout>
<net.osmand.plus.widgets.OsmandTextFieldBoxes
android:id="@+id/profile_name_otfb"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/list_content_padding"
android:layout_marginBottom="@dimen/list_content_padding"
android:layout_marginStart="@dimen/list_content_padding"
android:layout_marginEnd="@dimen/list_content_padding"
android:layout_marginLeft="@dimen/list_content_padding"
android:layout_marginRight="@dimen/list_content_padding"
app:labelText="Name">
<studio.carbonylgroup.textfieldboxes.ExtendedEditText
android:id="@+id/profile_name_et"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLines="1"
tools:text="@string/lorem_ipsum"/>
</net.osmand.plus.widgets.OsmandTextFieldBoxes>
</LinearLayout> </LinearLayout>
<FrameLayout <FrameLayout
@ -341,6 +343,7 @@
</ScrollView> </ScrollView>
<LinearLayout <LinearLayout
android:id="@+id/buttons_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="bottom" android:layout_gravity="bottom"

View file

@ -3,6 +3,7 @@ package net.osmand.plus.profiles;
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;
import android.graphics.Rect;
import android.graphics.drawable.GradientDrawable; import android.graphics.drawable.GradientDrawable;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
@ -17,6 +18,7 @@ import android.view.View;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.ViewTreeObserver.OnGlobalLayoutListener;
import android.widget.Button; import android.widget.Button;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import android.widget.ImageView; import android.widget.ImageView;
@ -66,18 +68,19 @@ public class EditProfileFragment extends BaseOsmAndFragment {
private ProfileTypeDialogListener profileTypeDialogListener = null; private ProfileTypeDialogListener profileTypeDialogListener = null;
private IconIdListener iconIdListener = null; private IconIdListener iconIdListener = null;
ImageView profileIcon; private ImageView profileIcon;
LinearLayout profileIconBtn; private LinearLayout profileIconBtn;
ExtendedEditText profileNameEt; private ExtendedEditText profileNameEt;
OsmandTextFieldBoxes profileNameTextBox; private OsmandTextFieldBoxes profileNameTextBox;
ExtendedEditText navTypeEt; private ExtendedEditText navTypeEt;
OsmandTextFieldBoxes navTypeTextBox; private OsmandTextFieldBoxes navTypeTextBox;
FrameLayout selectNavTypeBtn; private FrameLayout selectNavTypeBtn;
Button cancelBtn; private Button cancelBtn;
Button saveButton; private Button saveButton;
View mapConfigBtn; private View mapConfigBtn;
View screenConfigBtn; private View screenConfigBtn;
View navConfigBtn; private View navConfigBtn;
private LinearLayout buttonsLayout;
@Override @Override
public void onCreate(@Nullable Bundle savedInstanceState) { public void onCreate(@Nullable Bundle savedInstanceState) {
@ -99,7 +102,7 @@ public class EditProfileFragment extends BaseOsmAndFragment {
@Nullable Bundle savedInstanceState) { @Nullable Bundle savedInstanceState) {
final boolean isNightMode = !app.getSettings().isLightContent(); final boolean isNightMode = !app.getSettings().isLightContent();
View view = inflater.inflate(R.layout.fragment_selected_profile, container, false); final View view = inflater.inflate(R.layout.fragment_selected_profile, container, false);
profileIcon = view.findViewById(R.id.select_icon_btn_img); profileIcon = view.findViewById(R.id.select_icon_btn_img);
profileIconBtn = view.findViewById(R.id.profile_icon_layout); profileIconBtn = view.findViewById(R.id.profile_icon_layout);
@ -113,6 +116,8 @@ public class EditProfileFragment extends BaseOsmAndFragment {
mapConfigBtn = view.findViewById(R.id.map_config_btn); mapConfigBtn = view.findViewById(R.id.map_config_btn);
screenConfigBtn = view.findViewById(R.id.screen_config_btn); screenConfigBtn = view.findViewById(R.id.screen_config_btn);
navConfigBtn = view.findViewById(R.id.nav_settings_btn); navConfigBtn = view.findViewById(R.id.nav_settings_btn);
buttonsLayout = view.findViewById(R.id.buttons_layout);
profileNameEt.setFocusable(true); profileNameEt.setFocusable(true);
profileNameEt.setSelectAllOnFocus(true); profileNameEt.setSelectAllOnFocus(true);
profileIconBtn.setBackgroundResource(R.drawable.rounded_background_3dp); profileIconBtn.setBackgroundResource(R.drawable.rounded_background_3dp);
@ -345,6 +350,21 @@ public class EditProfileFragment extends BaseOsmAndFragment {
} }
}); });
view.getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
Rect r = new Rect();
view.getWindowVisibleDisplayFrame(r);
int screenHeight = view.getRootView().getHeight();
int keypadHeight = screenHeight - r.bottom;
if (keypadHeight > screenHeight * 0.15) {
buttonsLayout.setVisibility(View.GONE);
} else {
buttonsLayout.setVisibility(View.VISIBLE);
}
}
});
return view; return view;
} }