mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
removed swipe to delete (#2589)
This commit is contained in:
parent
67d9afe77e
commit
ec8bbb2782
4 changed files with 46 additions and 104 deletions
|
|
@ -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'
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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<Notification> {
|
|||
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<Notification> {
|
|||
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<Notification> {
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,50 +1,23 @@
|
|||
<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"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/notification_view"
|
||||
android:foreground="?selectableItemBackground"
|
||||
android:minHeight="72dp">
|
||||
<com.daimajia.swipe.SwipeLayout android:layout_height="match_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:id="@+id/swipeLayout"
|
||||
>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/bottom"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<RelativeLayout
|
||||
android:id="@+id/bottom_wrapper_child1"
|
||||
android:background="@color/deleteRed"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<ImageView
|
||||
android:id="@+id/star"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
app:srcCompat="@drawable/ic_done_black_24dp"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp" />
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/notification_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/icon"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:background="@android:color/white"
|
||||
android:scaleType="centerCrop"
|
||||
app:srcCompat="@drawable/ic_message_black_24dp"
|
||||
|
||||
app:tint="@color/primaryDarkColor"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
|
|
@ -54,27 +27,25 @@
|
|||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Caption"
|
||||
tools:text="2 June" />
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@id/time"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_toStartOf="@id/time"
|
||||
android:layout_toLeftOf="@id/time"
|
||||
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:padding="12dp"
|
||||
android:layout_alignParentTop="true"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Body2"
|
||||
tools:text="You just made your tenth edit" />
|
||||
</RelativeLayout>
|
||||
</com.daimajia.swipe.SwipeLayout>
|
||||
android:padding="12dp"
|
||||
/>
|
||||
</RelativeLayout>
|
||||
Loading…
Add table
Add a link
Reference in a new issue