added cancel button to profile's bottomsheets

This commit is contained in:
madwasp79 2019-05-24 14:35:24 +03:00
parent 5a1343de49
commit 634205cac6
3 changed files with 40 additions and 0 deletions

View file

@ -40,6 +40,22 @@
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:textColor="@color/map_widget_blue"/>
<FrameLayout
android:id="@+id/dismiss_button"
android:layout_width="0dp"

View file

@ -217,6 +217,7 @@
<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_small">36dp</dimen>
<dimen name="landscape_bottom_sheet_dialog_fragment_width">360dp</dimen>
<dimen name="measurement_tool_select_radius">20dp</dimen>

View file

@ -5,8 +5,16 @@ import static net.osmand.plus.profiles.EditProfileFragment.SELECTED_ICON;
import android.content.res.ColorStateList;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
import java.util.ArrayList;
import java.util.List;
import net.osmand.PlatformUtil;
@ -62,6 +70,21 @@ public class SelectProfileBottomSheetDialogFragment extends MenuBottomSheetDialo
}
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
view.findViewById(R.id.dismiss_button).setVisibility(View.GONE);
Button cancelBtn = view.findViewById(R.id.dismiss_button_v2);
cancelBtn.setVisibility(View.VISIBLE);
view.findViewById(R.id.dismiss_button_v2).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
onDismissButtonClickAction();
dismiss();
}
});
}
@Override
public void createMenuItems(Bundle savedInstanceState) {