From ec8bbb27823ca9c4c435b29e1d7ca14a42e45834 Mon Sep 17 00:00:00 2001 From: Vanshika Arora Date: Mon, 5 Aug 2019 16:55:33 +0530 Subject: [PATCH] removed swipe to delete (#2589) --- app/build.gradle | 3 - .../notification/NotificationActivity.java | 1 + .../notification/NotificationRenderer.java | 31 +---- app/src/main/res/layout/item_notification.xml | 115 +++++++----------- 4 files changed, 46 insertions(+), 104 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index bc9833416..fe2900dac 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -94,9 +94,6 @@ dependencies { implementation "androidx.cardview:cardview:1.0.0" implementation 'androidx.constraintlayout:constraintlayout:1.1.3' implementation "androidx.exifinterface:exifinterface:1.0.0" - - //swipe_layout - implementation 'com.daimajia.swipelayout:library:1.2.0@aar' //metadata extractor implementation 'com.drewnoakes:metadata-extractor:2.11.0' } diff --git a/app/src/main/java/fr/free/nrw/commons/notification/NotificationActivity.java b/app/src/main/java/fr/free/nrw/commons/notification/NotificationActivity.java index bb2078d24..e29ab2595 100644 --- a/app/src/main/java/fr/free/nrw/commons/notification/NotificationActivity.java +++ b/app/src/main/java/fr/free/nrw/commons/notification/NotificationActivity.java @@ -227,6 +227,7 @@ public class NotificationActivity extends NavigationBaseActivity { public void notificationClicked(Notification notification) { Timber.d("Notification clicked %s", notification.link); handleUrl(notification.link); + removeNotification(notification); } @Override diff --git a/app/src/main/java/fr/free/nrw/commons/notification/NotificationRenderer.java b/app/src/main/java/fr/free/nrw/commons/notification/NotificationRenderer.java index f891306b9..df8388cee 100644 --- a/app/src/main/java/fr/free/nrw/commons/notification/NotificationRenderer.java +++ b/app/src/main/java/fr/free/nrw/commons/notification/NotificationRenderer.java @@ -9,7 +9,6 @@ import android.widget.LinearLayout; import android.widget.RelativeLayout; import android.widget.TextView; -import com.daimajia.swipe.SwipeLayout; import com.google.android.material.animation.ArgbEvaluatorCompat; import com.pedrogomez.renderers.Renderer; @@ -32,12 +31,8 @@ public class NotificationRenderer extends Renderer { TextView time; @BindView(R.id.icon) ImageView icon; - @BindView(R.id.swipeLayout) - SwipeLayout swipeLayout; - @BindView(R.id.bottom) - LinearLayout bottomLayout; - @BindView(R.id.notification_view) - RelativeLayout notificationView; + /*@BindView(R.id.bottom) + LinearLayout bottomLayout;*/ private NotificationClicked listener; private boolean isarchivedvisible = false; @@ -53,13 +48,6 @@ public class NotificationRenderer extends Renderer { listener.notificationClicked(getContent()); } - @OnClick(R.id.bottom) - void onBottomLayoutClicked(){ - Notification notification = getContent(); - Timber.d("NotificationID: %s", notification.notificationId); - listener.markNotificationAsRead(notification); - } - @Override protected void setUpView(View rootView) { @@ -74,21 +62,6 @@ public class NotificationRenderer extends Renderer { protected View inflate(LayoutInflater layoutInflater, ViewGroup viewGroup) { View inflatedView = layoutInflater.inflate(R.layout.item_notification, viewGroup, false); ButterKnife.bind(this, inflatedView); - if (isarchivedvisible) { - swipeLayout.setSwipeEnabled(false); - }else { - swipeLayout.setSwipeEnabled(true); - } - swipeLayout.addDrag(SwipeLayout.DragEdge.Top, bottomLayout); - swipeLayout.addRevealListener(R.id.bottom_wrapper_child1, (child, edge, fraction, distance) -> { - View star = child.findViewById(R.id.star); - float d = child.getHeight() / 2 - star.getHeight() / 2; - star.setTranslationY(d * fraction); - star.setScaleX(fraction + 0.6f); - star.setScaleY(fraction + 0.6f); - int c = ArgbEvaluatorCompat.getInstance().evaluate(fraction, Color.parseColor("#dddddd"), Color.parseColor("#90960a0a")); - child.setBackgroundColor(c); - }); return inflatedView; } diff --git a/app/src/main/res/layout/item_notification.xml b/app/src/main/res/layout/item_notification.xml index 92e7e8bff..4c7cbbd38 100644 --- a/app/src/main/res/layout/item_notification.xml +++ b/app/src/main/res/layout/item_notification.xml @@ -1,80 +1,51 @@ - + + + + - - - - - - - - - - - - - - - - + android:layout_height="wrap_content" + android:layout_alignTop="@id/time" + android:layout_marginLeft="16dp" + android:layout_marginStart="16dp" + android:layout_toEndOf="@id/icon" + android:layout_toLeftOf="@id/time" + android:layout_toRightOf="@id/icon" + android:layout_toStartOf="@id/time" + android:ellipsize="end" + android:layout_alignParentTop="true" + android:textAppearance="@style/TextAppearance.AppCompat.Body2" + android:padding="12dp" + /> \ No newline at end of file