mirror of
https://github.com/nextcloud/android.git
synced 2024-11-27 17:46:37 +03:00
Notification list action button customized.
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
parent
5f3b0efbff
commit
86383b3fd6
4 changed files with 33 additions and 15 deletions
|
@ -23,7 +23,6 @@ import android.content.Context;
|
|||
import android.content.Intent;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.Typeface;
|
||||
import android.graphics.drawable.Drawable;
|
||||
|
@ -68,6 +67,7 @@ import java.util.List;
|
|||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.widget.PopupMenu;
|
||||
import androidx.core.content.res.ResourcesCompat;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
/**
|
||||
|
@ -151,9 +151,13 @@ public class NotificationListAdapter extends RecyclerView.Adapter<NotificationLi
|
|||
notificationsActivity.getResources().getConfiguration().uiMode
|
||||
& Configuration.UI_MODE_NIGHT_MASK;
|
||||
if (Configuration.UI_MODE_NIGHT_YES == nightModeFlag) {
|
||||
holder.binding.icon.setColorFilter(Color.WHITE, PorterDuff.Mode.SRC_IN);
|
||||
holder.binding.icon.setColorFilter(ResourcesCompat.getColor(notificationsActivity.getResources(),
|
||||
R.color.grey_30, null),
|
||||
PorterDuff.Mode.SRC_IN);
|
||||
} else {
|
||||
holder.binding.icon.setColorFilter(Color.BLACK, PorterDuff.Mode.SRC_IN);
|
||||
holder.binding.icon.setColorFilter(ResourcesCompat.getColor(notificationsActivity.getResources(),
|
||||
R.color.text_color, null),
|
||||
PorterDuff.Mode.SRC_IN);
|
||||
}
|
||||
|
||||
setButtons(holder, notification);
|
||||
|
@ -172,7 +176,7 @@ public class NotificationListAdapter extends RecyclerView.Adapter<NotificationLi
|
|||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,
|
||||
LinearLayout.LayoutParams.WRAP_CONTENT);
|
||||
params.setMargins(
|
||||
resources.getDimensionPixelOffset(R.dimen.standard_half_margin),
|
||||
resources.getDimensionPixelOffset(R.dimen.standard_quarter_margin),
|
||||
0,
|
||||
resources.getDimensionPixelOffset(R.dimen.standard_half_margin),
|
||||
0);
|
||||
|
@ -260,9 +264,15 @@ public class NotificationListAdapter extends RecyclerView.Adapter<NotificationLi
|
|||
final MaterialButton button = new MaterialButton(notificationsActivity);
|
||||
|
||||
if (action.primary) {
|
||||
viewThemeUtils.material.colorMaterialButtonPrimaryFilled(button);
|
||||
button.setBackgroundColor(ResourcesCompat.getColor(resources,
|
||||
R.color.notification_action_btn_color, null));
|
||||
button.setTextColor(ResourcesCompat.getColor(resources,
|
||||
R.color.white, null));
|
||||
} else {
|
||||
viewThemeUtils.material.colorMaterialButtonPrimaryTonal(button);
|
||||
button.setBackgroundColor(ResourcesCompat.getColor(resources,
|
||||
android.R.color.transparent, null));
|
||||
button.setTextColor(ResourcesCompat.getColor(resources,
|
||||
R.color.notification_action_btn_color, null));
|
||||
}
|
||||
|
||||
button.setAllCaps(false);
|
||||
|
@ -271,7 +281,6 @@ public class NotificationListAdapter extends RecyclerView.Adapter<NotificationLi
|
|||
button.setCornerRadiusResource(R.dimen.button_corner_radius);
|
||||
|
||||
button.setLayoutParams(params);
|
||||
button.setGravity(Gravity.CENTER);
|
||||
|
||||
button.setOnClickListener(v -> {
|
||||
setButtonEnabled(holder, false);
|
||||
|
|
|
@ -22,7 +22,8 @@
|
|||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="@dimen/notification_row_item_height"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:orientation="horizontal"
|
||||
android:paddingTop="@dimen/standard_padding"
|
||||
android:paddingRight="@dimen/standard_padding"
|
||||
|
@ -36,8 +37,6 @@
|
|||
android:layout_height="@dimen/notification_icon_height"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginEnd="@dimen/notification_icon_layout_right_end_margin"
|
||||
android:padding="2dp"
|
||||
android:alpha="0.5"
|
||||
android:contentDescription="@string/notification_icon"
|
||||
android:src="@drawable/ic_notification" />
|
||||
|
||||
|
@ -58,7 +57,9 @@
|
|||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:textSize="@dimen/txt_size_16sp"
|
||||
android:ellipsize="end"
|
||||
android:textColor="@color/text_color"
|
||||
android:textAppearance="?android:attr/textAppearanceListItem"
|
||||
tools:text="@string/placeholder_filename" />
|
||||
|
||||
|
@ -66,6 +67,7 @@
|
|||
android:id="@+id/dismiss"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:tint="@color/notification_sublime_color"
|
||||
android:src="@drawable/ic_close"
|
||||
android:contentDescription="@string/dismiss_notification_description" />
|
||||
</LinearLayout>
|
||||
|
@ -75,8 +77,9 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:textColor="@color/notification_sublime_color"
|
||||
android:textSize="@dimen/txt_size_14sp"
|
||||
tools:text="@string/placeholder_sentence"
|
||||
android:alpha="0.57"
|
||||
android:textAppearance="?android:attr/textAppearanceListItem"/>
|
||||
|
||||
<LinearLayout
|
||||
|
@ -94,9 +97,9 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end"
|
||||
android:ellipsize="end"
|
||||
android:textSize="@dimen/text_size_13sp"
|
||||
tools:text="@string/placeholder_sentence"
|
||||
android:alpha="0.5"
|
||||
android:textColor="?android:attr/textColorSecondary"/>
|
||||
android:textColor="@color/notification_sublime_color"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
|
|
@ -33,6 +33,8 @@
|
|||
<color name="transparent">#00000000</color>
|
||||
<color name="secondary_text_color">#666666</color>
|
||||
<color name="highlight_textColor_Warning">#e53935</color>
|
||||
<color name="notification_action_btn_color">#0099ff</color>
|
||||
<color name="notification_sublime_color">#666666</color>
|
||||
|
||||
<!-- Colors -->
|
||||
<color name="standard_grey">#757575</color>
|
||||
|
@ -40,6 +42,7 @@
|
|||
<color name="grey_200">#EEEEEE</color>
|
||||
<color name="grey_400">#BDBDBD</color>
|
||||
<color name="grey_600">#666666</color>
|
||||
<color name="grey_30">#B2B2B2</color>
|
||||
|
||||
<!-- standard material color definitions -->
|
||||
|
||||
|
|
|
@ -98,8 +98,8 @@
|
|||
<dimen name="activity_list_item_title_header_text_size">16sp</dimen>
|
||||
<dimen name="activity_list_layout_recycler_view_margin">-3dp</dimen>
|
||||
<dimen name="activity_row_layout_height">48dp</dimen>
|
||||
<dimen name="notification_icon_width">32dp</dimen>
|
||||
<dimen name="notification_icon_height">32dp</dimen>
|
||||
<dimen name="notification_icon_width">24dp</dimen>
|
||||
<dimen name="notification_icon_height">24dp</dimen>
|
||||
<dimen name="notification_icon_layout_right_end_margin">24dp</dimen>
|
||||
<dimen name="notification_list_item_grid_layout_left_start_margin">-3dp</dimen>
|
||||
<dimen name="uploader_list_separator_height">1dp</dimen>
|
||||
|
@ -148,6 +148,9 @@
|
|||
<dimen name="dialog_padding">24dp</dimen>
|
||||
<integer name="small_margin">5</integer>
|
||||
<integer name="zero">0</integer>
|
||||
<dimen name="notification_row_item_height">145dp</dimen>
|
||||
<dimen name="txt_size_16sp">16sp</dimen>
|
||||
<dimen name="txt_size_14sp">14sp</dimen>
|
||||
<!--Adaptive Icon size specified here: https://developer.android.com/develop/ui/views/launch/icon_design_adaptive -->
|
||||
<dimen name="adaptive_icon_size">108dp</dimen>
|
||||
<dimen name="adaptive_icon_padding">18dp</dimen>
|
||||
|
|
Loading…
Reference in a new issue