From 5aa28e4477e3cd5ae88b14795c3437d042168138 Mon Sep 17 00:00:00 2001 From: Andy Scherzinger Date: Tue, 20 Apr 2021 00:46:09 +0200 Subject: [PATCH] Make sound choice icons simple radio buttons Signed-off-by: Andy Scherzinger --- .../adapters/items/NotificationSoundItem.java | 44 +++++-------------- .../ic_play_circle_outline_white_24dp.xml | 25 ----------- .../main/res/drawable/ic_stop_white_24dp.xml | 25 ----------- .../res/layout/rv_item_notification_sound.xml | 27 ++---------- 4 files changed, 14 insertions(+), 107 deletions(-) delete mode 100644 app/src/main/res/drawable/ic_play_circle_outline_white_24dp.xml delete mode 100644 app/src/main/res/drawable/ic_stop_white_24dp.xml diff --git a/app/src/main/java/com/nextcloud/talk/adapters/items/NotificationSoundItem.java b/app/src/main/java/com/nextcloud/talk/adapters/items/NotificationSoundItem.java index ffa33fbcc..f4bfb199c 100644 --- a/app/src/main/java/com/nextcloud/talk/adapters/items/NotificationSoundItem.java +++ b/app/src/main/java/com/nextcloud/talk/adapters/items/NotificationSoundItem.java @@ -20,27 +20,24 @@ package com.nextcloud.talk.adapters.items; -import android.content.res.Resources; -import android.graphics.drawable.ColorDrawable; import android.view.View; -import android.widget.ImageView; -import android.widget.TextView; + +import com.google.android.material.radiobutton.MaterialRadioButton; +import com.nextcloud.talk.R; + +import java.util.List; + import butterknife.BindView; import butterknife.ButterKnife; -import com.facebook.drawee.view.SimpleDraweeView; -import com.nextcloud.talk.R; -import com.nextcloud.talk.application.NextcloudTalkApplication; import eu.davidea.flexibleadapter.FlexibleAdapter; import eu.davidea.flexibleadapter.items.AbstractFlexibleItem; import eu.davidea.flexibleadapter.items.IFlexible; import eu.davidea.viewholders.FlexibleViewHolder; -import java.util.List; - public class NotificationSoundItem extends AbstractFlexibleItem { - private String notificationSoundName; - private String notificationSoundUri; + private final String notificationSoundName; + private final String notificationSoundUri; public NotificationSoundItem(String notificationSoundName, String notificationSoundUri) { this.notificationSoundName = notificationSoundName; @@ -73,31 +70,12 @@ public class NotificationSoundItem extends AbstractFlexibleItem adapter, NotificationSoundItemViewHolder holder, int position, List payloads) { holder.notificationName.setText(notificationSoundName); - - if (adapter.isSelected(position)) { - holder.checkedImageView.setVisibility(View.VISIBLE); - } else { - holder.checkedImageView.setVisibility(View.GONE); - } - - Resources resources = NextcloudTalkApplication.Companion.getSharedApplication().getResources(); - holder.simpleDraweeView.getHierarchy().setBackgroundImage(new ColorDrawable(resources.getColor(R.color.colorPrimary))); - if (position == 0) { - holder.simpleDraweeView.getHierarchy().setImage(resources.getDrawable(R.drawable.ic_stop_white_24dp), 100, - true); - } else { - holder.simpleDraweeView.getHierarchy().setImage(resources.getDrawable(R.drawable.ic_play_circle_outline_white_24dp), 100, - true); - } + holder.notificationName.setChecked(adapter.isSelected(position)); } static class NotificationSoundItemViewHolder extends FlexibleViewHolder { @BindView(R.id.notificationNameTextView) - public TextView notificationName; - @BindView(R.id.simpleDraweeView) - SimpleDraweeView simpleDraweeView; - @BindView(R.id.checkedImageView) - ImageView checkedImageView; + public MaterialRadioButton notificationName; /** * Default constructor. @@ -107,6 +85,4 @@ public class NotificationSoundItem extends AbstractFlexibleItem - ~ - ~ This program is free software: you can redistribute it and/or modify - ~ it under the terms of the GNU General Public License as published by - ~ the Free Software Foundation, either version 3 of the License, or - ~ at your option) any later version. - ~ - ~ This program is distributed in the hope that it will be useful, - ~ but WITHOUT ANY WARRANTY; without even the implied warranty of - ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - ~ GNU General Public License for more details. - ~ - ~ You should have received a copy of the GNU General Public License - ~ along with this program. If not, see . - --> - - - - diff --git a/app/src/main/res/drawable/ic_stop_white_24dp.xml b/app/src/main/res/drawable/ic_stop_white_24dp.xml deleted file mode 100644 index fd64c8e55..000000000 --- a/app/src/main/res/drawable/ic_stop_white_24dp.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - diff --git a/app/src/main/res/layout/rv_item_notification_sound.xml b/app/src/main/res/layout/rv_item_notification_sound.xml index e3c9a4d8a..ac709ae46 100644 --- a/app/src/main/res/layout/rv_item_notification_sound.xml +++ b/app/src/main/res/layout/rv_item_notification_sound.xml @@ -21,7 +21,6 @@ --> - - - - -