Quick Action redesign

This commit is contained in:
Nazar-Kutz 2020-05-25 13:11:57 +03:00
parent 9ca1dbd9cf
commit 49d23b63b3
15 changed files with 1029 additions and 387 deletions

View file

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:paddingTop="@dimen/content_padding_small"
android:paddingBottom="@dimen/content_padding_small"
android:minHeight="@dimen/card_row_min_height"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:minHeight="@dimen/bottom_sheet_descr_height"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_desc_text_size"
android:linksClickable="true"
android:lineSpacingMultiplier="@dimen/bottom_sheet_text_spacing_multiplier"
tools:text="Some long description" />
</LinearLayout>

View file

@ -34,8 +34,9 @@
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/toolbar_title"
android:layout_width="wrap_content"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:maxLines="2"
@ -46,6 +47,20 @@
android:paddingEnd="@dimen/content_padding"
android:paddingStart="@dimen/content_padding" />
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/action_button"
style="@style/Widget.AppCompat.Toolbar.Button.Navigation"
android:layout_width="@dimen/standard_icon_size"
android:layout_height="@dimen/standard_icon_size"
android:layout_marginLeft="@dimen/content_padding"
android:layout_marginStart="@dimen/content_padding"
android:layout_marginRight="@dimen/content_padding"
android:layout_marginEnd="@dimen/content_padding"
android:contentDescription="@string/access_shared_string_navigate_up"
android:scaleType="fitCenter"
android:visibility="gone"
app:srcCompat="@drawable/ic_action_info_dark" />
</LinearLayout>
<include layout="@layout/preference_toolbar_switch" />

View file

@ -28,25 +28,37 @@
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:orientation="vertical"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:paddingEnd="@dimen/content_padding"
android:paddingStart="@dimen/content_padding">
android:layout_marginLeft="@dimen/content_padding"
android:layout_marginStart="@dimen/content_padding"
android:orientation="vertical">
<net.osmand.plus.widgets.TextViewEx
android:id="@android:id/title"
<net.osmand.plus.widgets.TextViewEx
android:id="@android:id/title"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:layout_gravity="center_vertical"
android:gravity="center_vertical"
android:ellipsize="marquee"
android:singleLine="true"
android:textColor="?colorAccent"
android:paddingStart="0dp"
android:paddingLeft="0dp"
android:paddingEnd="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:textSize="@dimen/default_list_text_size"
osmand:typeface="@string/font_roboto_medium"
tools:text="Button text" />
<View
android:id="@+id/divider"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:singleLine="true"
android:textColor="?colorAccent"
android:textSize="@dimen/default_list_text_size"
osmand:typeface="@string/font_roboto_medium"
tools:text="Button text" />
android:layout_height="1dp"
android:visibility="gone"
android:background="?attr/dashboard_divider" />
</LinearLayout>

View file

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
@ -12,66 +11,99 @@
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.appcompat.widget.Toolbar
android:id="@+id/custom_toolbar"
android:layout_width="match_parent"
android:layout_height="@dimen/dashboard_map_toolbar"/>
<include layout="@layout/global_preferences_toolbar_with_switch" />
</com.google.android.material.appbar.AppBarLayout>
<LinearLayout
android:id="@+id/top_divider"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/appbar"
android:orientation="vertical">
<View
android:layout_width="match_parent"
android:layout_height="4dp"/>
<include layout="@layout/card_top_divider"/>
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/top_divider"
android:clipToPadding="false"/>
<LinearLayout
android:id="@+id/bottomShadowView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/recycler_view"
android:background="?attr/activity_background_color"
android:orientation="vertical">
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scaleType="fitXY"
app:srcCompat="@drawable/bg_shadow_list_bottom"/>
<View
android:id="@+id/bottomMarginView"
android:layout_width="match_parent"
android:layout_height="16dp"/>
</LinearLayout>
android:layout_height="match_parent"
android:layout_below="@id/appbar"
android:clipToPadding="false" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fabButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_margin="16dp"
app:srcCompat="@drawable/ic_action_plus"
android:layout_alignParentBottom="true"
android:layout_margin="@dimen/content_padding"
android:contentDescription="@string/quick_action_new_action"
app:backgroundTint="?attr/color_dialog_buttons"
android:layout_alignParentEnd="true" />
app:srcCompat="@drawable/ic_action_plus" />
<LinearLayout
android:id="@+id/bottom_panel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="vertical">
<include layout="@layout/card_top_divider" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/bg_color"
android:minHeight="@dimen/bottom_sheet_list_item_height"
android:orientation="horizontal">
<FrameLayout
android:id="@+id/select_all"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|start"
android:layout_margin="@dimen/content_padding_half"
android:background="?attr/selectableItemBackground"
android:padding="@dimen/content_padding_half">
<net.osmand.plus.widgets.TextViewEx
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/shared_string_select_all"
android:textColor="?attr/active_color_basic"
android:textSize="@dimen/default_desc_text_size"
app:typeface="@string/font_roboto_medium" />
</FrameLayout>
<FrameLayout
android:id="@+id/delete"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/content_padding_half"
android:layout_gravity="center_vertical|end">
<FrameLayout
android:id="@+id/button_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="@dimen/content_padding_half"
android:background="?attr/selectableItemBackground">
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/button_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:drawablePadding="@dimen/content_padding_half"
android:gravity="center_vertical"
android:text="@string/shared_string_delete"
android:textColor="?attr/active_color_basic"
android:textSize="@dimen/default_desc_text_size"
app:drawableLeftCompat="@drawable/ic_action_delete_dark"
app:drawableTint="?attr/active_color_basic"
app:typeface="@string/font_roboto_medium" />
</FrameLayout>
</FrameLayout>
</FrameLayout>
</LinearLayout>
</RelativeLayout>

View file

@ -1,21 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="40dp"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:background="?attr/bg_color"
android:paddingStart="16dp"
android:paddingEnd="16dp">
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_list_item_height"
android:background="?attr/bg_color"
android:paddingStart="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingEnd="@dimen/content_padding"
android:paddingRight="@dimen/content_padding">
<TextView
android:id="@+id/header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_sub_text_size"
tools:text="Screen 1"/>
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_list_text_size"
app:typeface="@string/font_roboto_medium"
tools:text="Screen 1" />
</FrameLayout>

View file

@ -1,92 +1,138 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:osmand="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/bg_color"
android:orientation="vertical">
xmlns:osmand="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/bg_color"
android:orientation="vertical">
<LinearLayout
android:id="@+id/searchListItemLayout"
android:layout_width="match_parent"
android:clickable="true"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:minHeight="60dp"
android:clickable="true"
android:focusable="true"
android:orientation="horizontal">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/handle_view"
android:layout_width="56dp"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:layout_marginRight="4dp"
android:focusable="false"
android:scaleType="centerInside"
android:tint="?attr/secondary_icon_color"
osmand:srcCompat="@drawable/ic_action_item_move"
android:layout_marginEnd="4dp" />
<FrameLayout
android:layout_width="@dimen/acceptable_touch_radius"
android:layout_height="@dimen/acceptable_touch_radius"
android:layout_gravity="center">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/imageView"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="center_vertical"
android:layout_marginRight="8dp"
android:scaleType="centerInside"
android:tint="?attr/default_icon_color"
osmand:srcCompat="@drawable/ic_action_flag"
android:layout_marginEnd="8dp" />
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/action_icon"
style="@style/Widget.AppCompat.ActionButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
tools:src="@drawable/ic_action_remove"
tools:tint="@color/icon_color_default_light" />
<androidx.appcompat.widget.AppCompatCheckBox
android:id="@+id/checkbox"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center"
tools:tint="@color/icon_color_default_light" />
</FrameLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="8dp"
android:layout_weight="1"
android:orientation="vertical"
android:paddingBottom="8dp"
android:paddingTop="8dp"
android:layout_marginStart="8dp">
android:layout_marginLeft="@dimen/content_padding"
android:layout_marginStart="@dimen/content_padding"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/title"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingRight="16dp"
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size"
tools:text="Add marker"
android:paddingEnd="16dp" />
android:minHeight="@dimen/setting_profile_item_height"
android:orientation="horizontal">
<TextView
android:id="@+id/subtitle"
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/imageView"
android:layout_width="@dimen/standard_icon_size"
android:layout_height="@dimen/standard_icon_size"
android:layout_gravity="center_vertical"
android:layout_marginEnd="@dimen/content_padding_half"
android:layout_marginRight="@dimen/content_padding_half"
android:scaleType="centerInside"
android:tint="?attr/default_icon_color"
osmand:srcCompat="@drawable/ic_action_flag" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="@dimen/content_padding_half"
android:layout_marginLeft="@dimen/content_padding_half"
android:layout_weight="1"
android:orientation="vertical"
android:paddingTop="@dimen/content_padding_half"
android:paddingBottom="@dimen/content_padding_half">
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="0dp"
android:paddingLeft="0dp"
android:paddingEnd="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size"
osmand:typeface="@string/font_roboto_regular"
tools:text="Add marker" />
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/subtitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_desc_text_size"
osmand:typeface="@string/font_roboto_regular"
tools:text="Action 1" />
</LinearLayout>
<FrameLayout
android:id="@+id/move_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginEnd="@dimen/content_padding_half"
android:layout_marginRight="@dimen/content_padding_half"
android:padding="@dimen/content_padding_small">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/move_icon"
android:layout_width="@dimen/standard_icon_size"
android:layout_height="@dimen/standard_icon_size"
android:tint="?attr/secondary_icon_color"
osmand:srcCompat="@drawable/ic_action_item_move" />
</FrameLayout>
</LinearLayout>
<View
android:id="@+id/item_divider"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_sub_text_size"
tools:text="Action 1"/>
android:layout_height="1dp"
android:background="?attr/dashboard_divider" />
</LinearLayout>
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/closeImageButton"
android:layout_width="56dp"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:background="?attr/selectableItemBackground"
android:scaleType="centerInside"
android:tint="?attr/secondary_icon_color"
android:contentDescription="@string/action_delete"
osmand:srcCompat="@drawable/ic_action_remove_dark"/>
</LinearLayout>
<View
android:id="@+id/divider"
android:id="@+id/long_divider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/dashboard_divider"/>
android:background="?attr/dashboard_divider" />
</LinearLayout>

View file

@ -2107,8 +2107,7 @@
<string name="quick_action_add_favorite">إضافة للمفضلة</string>
<string name="dialog_add_action_title">إضافة إجراء</string>
<string name="quick_actions_delete">حذف إجراء</string>
<string name="quick_actions_delete_text">هل تريد حذف الإجراء
\n \"%s\" ؟</string>
<string name="quick_actions_delete_text">هل تريد حذف الإجراء\n \"%s\" ؟</string>
<string name="shared_string_action_name">اسم الإجراء</string>
<string name="quick_action_add_osm_bug">إضافة خطأ إلى OSM</string>
<string name="quick_favorites_show_favorites_dialog">عرض مربع حوار الأماكن المفضلة</string>

View file

@ -1054,12 +1054,10 @@
<string name="quick_action_poi_show">Sken %1$S</string>
<string name="quick_action_favorites_hide">Inurifen</string>
<string name="quick_action_favorites_show">Sken inurifen</string>
<string name="quick_actions_delete_text">Tebɣiḍ ad tekseḍ tigawt-agi\?</string>
<string name="quick_actions_delete">Kkes tigawt</string>
<string name="quick_action_edit_action">Tigawt</string>
<string name="quick_action_navigation_voice_on">Taɣect:</string>
<string name="quick_action_add_poi">Rnu</string>
<string name="quick_action_item_screen">Agdil</string>
<string name="upload_poi">Ali</string>
<string name="rendering_value_fine_name">Ṣeggem akken iwat anadi-ik</string>
<string name="gpx_add_track">Rnu ugar...</string>

View file

@ -11,6 +11,10 @@
Thx - Hardy
-->
<string name="shared_string_selected_n_with_colon">Selected: %d</string>
<string name="delete_all_actions_message_q">Are you sure you want to irrevocably delete %d quick actions?</string>
<string name="shared_string_delete_all_q">Delete all?</string>
<string name="export_import_quick_actions_with_profiles_promo">You can Export or Import quick actions with application profiles.</string>
<string name="unsupported_type_error">Unsupported type</string>
<string name="index_item_world_basemap_detailed">World overview map (detailed)</string>
<string name="profiles_for_action_not_found">Could not find any such profiles.</string>

View file

@ -730,13 +730,15 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
prevActivityIntent = null;
return;
}
if (getMapView().getLayerByClass(MapQuickActionLayer.class).onBackPressed()) {
return;
}
QuickActionListFragment quickActionListFragment = getQuickActionListFragment();
if (quickActionListFragment != null && quickActionListFragment.isVisible()
&& quickActionListFragment.fromDashboard()) {
this.getDashboard().setDashboardVisibility(true, DashboardType.CONFIGURE_SCREEN, null);
if (quickActionListFragment != null && quickActionListFragment.isVisible()) {
if (quickActionListFragment.fromDashboard()) {
this.getDashboard().setDashboardVisibility(true, DashboardType.CONFIGURE_SCREEN, null);
} else {
getMapView().getLayerByClass(MapQuickActionLayer.class).onBackPressed();
}
} else if (getMapView().getLayerByClass(MapQuickActionLayer.class).onBackPressed()) {
return;
}
ImportSettingsFragment importSettingsFragment = getImportSettingsFragment();
if (importSettingsFragment != null) {

View file

@ -0,0 +1,101 @@
package net.osmand.plus.quickaction;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.UiUtilities;
import net.osmand.plus.base.MenuBottomSheetDialogFragment;
import net.osmand.plus.base.bottomsheetmenu.BottomSheetItemWithDescription;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem;
public class ConfirmationBottomSheet extends MenuBottomSheetDialogFragment {
private static final String TITLE_KEY = "title";
private static final String MESSAGE_KEY = "message";
private static final String RIGHT_BUTTON_TITLE_KEY = "right_button_title";
private String title;
private CharSequence message;
private int rightButtonTitle;
public static final String TAG = ConfirmationBottomSheet.class.getSimpleName();
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState) {
OsmandApplication app = requiredMyApplication();
if (savedInstanceState != null) {
title = savedInstanceState.getString(TITLE_KEY);
message = savedInstanceState.getCharSequence(MESSAGE_KEY);
rightButtonTitle = savedInstanceState.getInt(RIGHT_BUTTON_TITLE_KEY);
}
View view = super.onCreateView(inflater, parent, savedInstanceState);
UiUtilities.setupDialogButton(nightMode, rightButton,
UiUtilities.DialogButtonType.SECONDARY, rightButtonTitle);
TextView tvRightButton = rightButton.findViewById(R.id.button_text);
int colorDelete = ContextCompat.getColor(app, R.color.color_osm_edit_delete);
tvRightButton.setTextColor(colorDelete);
return view;
}
@Override
public void createMenuItems(Bundle savedInstanceState) {
items.add(new TitleItem(title));
items.add(new BottomSheetItemWithDescription.Builder()
.setDescription(message)
.setLayoutId(R.layout.bottom_sheet_item_preference_descr)
.create());
}
@Override
protected void onRightBottomButtonClick() {
Fragment target = getTargetFragment();
if (target instanceof OnConfirmButtonClickListener) {
((OnConfirmButtonClickListener) target).onConfirmButtonClick();
}
dismiss();
}
@Override
protected int getRightBottomButtonTextId() {
return rightButtonTitle;
}
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putString(TITLE_KEY, title);
outState.putCharSequence(MESSAGE_KEY, message);
outState.putInt(RIGHT_BUTTON_TITLE_KEY, rightButtonTitle);
}
public static void showInstance(@NonNull FragmentManager fm,
Fragment targetFragment,
@NonNull String title,
@NonNull CharSequence message,
int rightButtonTitle,
boolean usedOnMap) {
ConfirmationBottomSheet f = new ConfirmationBottomSheet();
f.title = title;
f.message = message;
f.rightButtonTitle = rightButtonTitle;
f.setTargetFragment(targetFragment, 0);
f.setUsedOnMap(usedOnMap);
f.show(fm, ConfirmationBottomSheet.TAG);
}
public interface OnConfirmButtonClickListener {
void onConfirmButtonClick();
}
}

View file

@ -1,7 +1,6 @@
package net.osmand.plus.quickaction;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
@ -34,13 +33,14 @@ import net.osmand.plus.activities.MapActivity;
import java.util.List;
import static net.osmand.plus.quickaction.QuickActionListFragment.showConfirmActionDeleteDialog;
import static net.osmand.plus.quickaction.QuickActionListFragment.showConfirmDeleteAnActionBottomSheet;
/**
* Created by rosty on 12/27/16.
*/
public class CreateEditActionDialog extends DialogFragment implements CallbackWithObject<Object> {
public class CreateEditActionDialog extends DialogFragment
implements CallbackWithObject<Object>, ConfirmationBottomSheet.OnConfirmButtonClickListener {
public static final String TAG = CreateEditActionDialog.class.getSimpleName();
@ -181,19 +181,9 @@ public class CreateEditActionDialog extends DialogFragment implements CallbackWi
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
Context ctx = getContext();
if (ctx != null) {
DialogInterface.OnClickListener listener = new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
quickActionRegistry.deleteQuickAction(action);
quickActionRegistry.notifyUpdates();
dialog.dismiss();
dismiss();
}
};
showConfirmActionDeleteDialog(ctx, action, !isLightContent, listener);
}
showConfirmDeleteAnActionBottomSheet(
getActivity(), CreateEditActionDialog.this,
action, false);
return true;
}
});
@ -296,4 +286,11 @@ public class CreateEditActionDialog extends DialogFragment implements CallbackWi
}
return false;
}
@Override
public void onConfirmButtonClick() {
quickActionRegistry.deleteQuickAction(action);
quickActionRegistry.notifyUpdates();
dismiss();
}
}

View file

@ -14,7 +14,7 @@ import androidx.appcompat.text.AllCapsTransformationMethod;
import net.osmand.plus.R;
import net.osmand.plus.helpers.FontCache;
public class TextViewEx extends TextView {
public class TextViewEx extends androidx.appcompat.widget.AppCompatTextView {
public TextViewEx(Context context) {
super(context);
}
@ -31,13 +31,6 @@ public class TextViewEx extends TextView {
parseAttributes(this, attrs, defStyleAttr, 0);
}
@TargetApi(21)
public TextViewEx(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
parseAttributes(this, attrs, defStyleAttr, defStyleRes);
}
/*internal*/ static void parseAttributes(TextView target, AttributeSet attrs, int defStyleAttr,
int defStyleRes) {
if (attrs == null) {

View file

@ -27,11 +27,6 @@ public class TextViewExProgress extends TextViewEx {
initPaint();
}
public TextViewExProgress(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
initPaint();
}
@Override
public void onDraw(Canvas canvas) {
super.onDraw(canvas);