Skip to content

Commit ec8bbb2

Browse files
vanshikaaroraneslihanturan
authored andcommitted
removed swipe to delete (commons-app#2589)
1 parent 67d9afe commit ec8bbb2

File tree

4 files changed

+44
-102
lines changed

4 files changed

+44
-102
lines changed

app/build.gradle

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,6 @@ dependencies {
9494
implementation "androidx.cardview:cardview:1.0.0"
9595
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
9696
implementation "androidx.exifinterface:exifinterface:1.0.0"
97-
98-
//swipe_layout
99-
implementation 'com.daimajia.swipelayout:library:1.2.0@aar'
10097
//metadata extractor
10198
implementation 'com.drewnoakes:metadata-extractor:2.11.0'
10299
}

app/src/main/java/fr/free/nrw/commons/notification/NotificationActivity.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@ private void setAdapter(List<Notification> notificationList) {
227227
public void notificationClicked(Notification notification) {
228228
Timber.d("Notification clicked %s", notification.link);
229229
handleUrl(notification.link);
230+
removeNotification(notification);
230231
}
231232

232233
@Override

app/src/main/java/fr/free/nrw/commons/notification/NotificationRenderer.java

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import android.widget.RelativeLayout;
1010
import android.widget.TextView;
1111

12-
import com.daimajia.swipe.SwipeLayout;
1312
import com.google.android.material.animation.ArgbEvaluatorCompat;
1413
import com.pedrogomez.renderers.Renderer;
1514

@@ -32,12 +31,8 @@ public class NotificationRenderer extends Renderer<Notification> {
3231
TextView time;
3332
@BindView(R.id.icon)
3433
ImageView icon;
35-
@BindView(R.id.swipeLayout)
36-
SwipeLayout swipeLayout;
37-
@BindView(R.id.bottom)
38-
LinearLayout bottomLayout;
39-
@BindView(R.id.notification_view)
40-
RelativeLayout notificationView;
34+
/*@BindView(R.id.bottom)
35+
LinearLayout bottomLayout;*/
4136

4237
private NotificationClicked listener;
4338
private boolean isarchivedvisible = false;
@@ -53,13 +48,6 @@ void onNotificationClicked() {
5348
listener.notificationClicked(getContent());
5449
}
5550

56-
@OnClick(R.id.bottom)
57-
void onBottomLayoutClicked(){
58-
Notification notification = getContent();
59-
Timber.d("NotificationID: %s", notification.notificationId);
60-
listener.markNotificationAsRead(notification);
61-
}
62-
6351
@Override
6452
protected void setUpView(View rootView) {
6553

@@ -74,21 +62,6 @@ protected void hookListeners(View rootView) {
7462
protected View inflate(LayoutInflater layoutInflater, ViewGroup viewGroup) {
7563
View inflatedView = layoutInflater.inflate(R.layout.item_notification, viewGroup, false);
7664
ButterKnife.bind(this, inflatedView);
77-
if (isarchivedvisible) {
78-
swipeLayout.setSwipeEnabled(false);
79-
}else {
80-
swipeLayout.setSwipeEnabled(true);
81-
}
82-
swipeLayout.addDrag(SwipeLayout.DragEdge.Top, bottomLayout);
83-
swipeLayout.addRevealListener(R.id.bottom_wrapper_child1, (child, edge, fraction, distance) -> {
84-
View star = child.findViewById(R.id.star);
85-
float d = child.getHeight() / 2 - star.getHeight() / 2;
86-
star.setTranslationY(d * fraction);
87-
star.setScaleX(fraction + 0.6f);
88-
star.setScaleY(fraction + 0.6f);
89-
int c = ArgbEvaluatorCompat.getInstance().evaluate(fraction, Color.parseColor("#dddddd"), Color.parseColor("#90960a0a"));
90-
child.setBackgroundColor(c);
91-
});
9265
return inflatedView;
9366
}
9467

Lines changed: 41 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,51 @@
11
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
2+
xmlns:tools="http://schemas.android.com/tools"
23
android:layout_width="match_parent"
34
android:layout_height="wrap_content"
45
xmlns:app="http://schemas.android.com/apk/res-auto"
5-
xmlns:tools="http://schemas.android.com/tools"
6+
android:id="@+id/notification_view"
67
android:foreground="?selectableItemBackground"
78
android:minHeight="72dp">
8-
<com.daimajia.swipe.SwipeLayout android:layout_height="match_parent"
9-
android:layout_width="match_parent"
10-
android:id="@+id/swipeLayout"
11-
>
12-
13-
<LinearLayout
14-
android:id="@+id/bottom"
15-
android:layout_width="match_parent"
16-
android:layout_height="match_parent">
17-
<RelativeLayout
18-
android:id="@+id/bottom_wrapper_child1"
19-
android:background="@color/deleteRed"
20-
android:layout_width="match_parent"
21-
android:layout_height="match_parent">
22-
<ImageView
23-
android:id="@+id/star"
24-
android:layout_alignParentTop="true"
25-
android:layout_centerHorizontal="true"
26-
app:srcCompat="@drawable/ic_done_black_24dp"
27-
android:layout_width="20dp"
28-
android:layout_height="20dp" />
29-
</RelativeLayout>
30-
</LinearLayout>
31-
32-
<RelativeLayout
33-
android:id="@+id/notification_view"
34-
android:layout_width="match_parent"
35-
android:layout_height="match_parent">
369

37-
<androidx.appcompat.widget.AppCompatImageView
38-
android:id="@+id/icon"
39-
android:layout_width="40dp"
40-
android:layout_height="40dp"
41-
android:layout_marginStart="16dp"
42-
android:layout_marginLeft="16dp"
43-
android:layout_marginTop="16dp"
44-
android:background="@android:color/white"
45-
android:scaleType="centerCrop"
46-
app:srcCompat="@drawable/ic_message_black_24dp"
10+
<androidx.appcompat.widget.AppCompatImageView
11+
android:id="@+id/icon"
12+
android:layout_width="40dp"
13+
android:layout_height="40dp"
14+
android:layout_marginLeft="16dp"
15+
android:layout_marginStart="16dp"
16+
android:layout_marginTop="16dp"
17+
android:background="@android:color/white"
18+
android:scaleType="centerCrop"
19+
app:srcCompat="@drawable/ic_message_black_24dp"
20+
app:tint="@color/primaryDarkColor"
21+
/>
4722

48-
/>
23+
<TextView
24+
android:id="@+id/time"
25+
android:layout_width="wrap_content"
26+
android:layout_height="wrap_content"
27+
android:layout_alignParentEnd="true"
28+
android:layout_alignParentRight="true"
29+
android:layout_marginLeft="16dp"
30+
android:layout_marginRight="16dp"
31+
android:layout_marginTop="16dp"
32+
android:textAppearance="@style/TextAppearance.AppCompat.Caption"
33+
/>
4934

50-
<TextView
51-
android:id="@+id/time"
52-
android:layout_width="wrap_content"
53-
android:layout_height="wrap_content"
54-
android:layout_alignParentEnd="true"
55-
android:layout_alignParentRight="true"
56-
android:layout_marginLeft="16dp"
57-
android:layout_marginTop="16dp"
58-
android:layout_marginRight="16dp"
59-
android:textAppearance="@style/TextAppearance.AppCompat.Caption"
60-
tools:text="2 June" />
61-
62-
<TextView
63-
android:id="@+id/title"
64-
android:layout_width="match_parent"
65-
android:layout_height="wrap_content"
66-
android:layout_alignTop="@id/time"
67-
android:layout_alignParentTop="true"
68-
android:layout_marginStart="16dp"
69-
android:layout_marginLeft="16dp"
70-
android:layout_toStartOf="@id/time"
71-
android:layout_toLeftOf="@id/time"
72-
android:layout_toEndOf="@id/icon"
73-
android:layout_toRightOf="@id/icon"
74-
android:ellipsize="end"
75-
android:padding="12dp"
76-
android:textAppearance="@style/TextAppearance.AppCompat.Body2"
77-
tools:text="You just made your tenth edit" />
78-
</RelativeLayout>
79-
</com.daimajia.swipe.SwipeLayout>
35+
<TextView
36+
android:id="@+id/title"
37+
android:layout_width="match_parent"
38+
android:layout_height="wrap_content"
39+
android:layout_alignTop="@id/time"
40+
android:layout_marginLeft="16dp"
41+
android:layout_marginStart="16dp"
42+
android:layout_toEndOf="@id/icon"
43+
android:layout_toLeftOf="@id/time"
44+
android:layout_toRightOf="@id/icon"
45+
android:layout_toStartOf="@id/time"
46+
android:ellipsize="end"
47+
android:layout_alignParentTop="true"
48+
android:textAppearance="@style/TextAppearance.AppCompat.Body2"
49+
android:padding="12dp"
50+
/>
8051
</RelativeLayout>

0 commit comments

Comments
 (0)