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: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
android:id="@+id/profile_icon_layout"
android:layout_width="68dp"
android:layout_height="68dp"
android:layout_marginStart="@dimen/list_content_padding"
android:layout_marginLeft="@dimen/list_content_padding"
android:layout_marginEnd="@dimen/list_content_padding"
android:layout_marginRight="@dimen/list_content_padding"
android:clickable="true"
android:focusable="true"
android:gravity="center"
android:orientation="vertical"
>
<TextView
android:id="@+id/select_icon_btn_txt"
android:layout_width="wrap_content"
@ -64,28 +88,6 @@
</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>
<FrameLayout
@ -341,6 +343,7 @@
</ScrollView>
<LinearLayout
android:id="@+id/buttons_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"

View file

@ -3,6 +3,7 @@ package net.osmand.plus.profiles;
import android.content.DialogInterface;
import android.content.DialogInterface.OnDismissListener;
import android.content.Intent;
import android.graphics.Rect;
import android.graphics.drawable.GradientDrawable;
import android.os.Bundle;
import android.support.annotation.NonNull;
@ -17,6 +18,7 @@ import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.ViewTreeObserver.OnGlobalLayoutListener;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.ImageView;
@ -66,18 +68,19 @@ public class EditProfileFragment extends BaseOsmAndFragment {
private ProfileTypeDialogListener profileTypeDialogListener = null;
private IconIdListener iconIdListener = null;
ImageView profileIcon;
LinearLayout profileIconBtn;
ExtendedEditText profileNameEt;
OsmandTextFieldBoxes profileNameTextBox;
ExtendedEditText navTypeEt;
OsmandTextFieldBoxes navTypeTextBox;
FrameLayout selectNavTypeBtn;
Button cancelBtn;
Button saveButton;
View mapConfigBtn;
View screenConfigBtn;
View navConfigBtn;
private ImageView profileIcon;
private LinearLayout profileIconBtn;
private ExtendedEditText profileNameEt;
private OsmandTextFieldBoxes profileNameTextBox;
private ExtendedEditText navTypeEt;
private OsmandTextFieldBoxes navTypeTextBox;
private FrameLayout selectNavTypeBtn;
private Button cancelBtn;
private Button saveButton;
private View mapConfigBtn;
private View screenConfigBtn;
private View navConfigBtn;
private LinearLayout buttonsLayout;
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
@ -99,7 +102,7 @@ public class EditProfileFragment extends BaseOsmAndFragment {
@Nullable Bundle savedInstanceState) {
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);
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);
screenConfigBtn = view.findViewById(R.id.screen_config_btn);
navConfigBtn = view.findViewById(R.id.nav_settings_btn);
buttonsLayout = view.findViewById(R.id.buttons_layout);
profileNameEt.setFocusable(true);
profileNameEt.setSelectAllOnFocus(true);
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;
}