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 f02bd8072..1111fe93f 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 @@ -17,7 +17,6 @@ import android.widget.ProgressBar; import android.widget.RelativeLayout; import android.widget.TextView; import android.widget.Toast; -import android.support.v7.widget.Toolbar; import com.pedrogomez.renderers.RVRendererAdapter; @@ -52,10 +51,9 @@ public class NotificationActivity extends NavigationBaseActivity { RelativeLayout relativeLayout; @BindView(R.id.no_notification_background) RelativeLayout no_notification; - @BindView(R.id.toolbar) - Toolbar toolbar; - /* @BindView(R.id.swipe_bg) - TextView swipe_bg;*/ + @BindView(R.id.no_notification_text) + TextView noNotificationText; + @Inject NotificationController controller; @@ -63,8 +61,7 @@ public class NotificationActivity extends NavigationBaseActivity { private NotificationWorkerFragment mNotificationWorkerFragment; private RVRendererAdapter adapter; private List notificationList; - MenuItem notificationmenuitem; - TextView nonotificationtext; + MenuItem notificationMenuItem; @Override protected void onCreate(Bundle savedInstanceState) { @@ -75,7 +72,6 @@ public class NotificationActivity extends NavigationBaseActivity { .findFragmentByTag(TAG_NOTIFICATION_WORKER_FRAGMENT); initListView(); initDrawer(); - nonotificationtext = (TextView)this.findViewById(R.id.no_notification_text); setPageTitle(); } @@ -160,7 +156,7 @@ public class NotificationActivity extends NavigationBaseActivity { no_notification.setVisibility(View.VISIBLE); } else { setAdapter(notificationList); - } if (notificationmenuitem != null) { + } if (notificationMenuItem != null) { } progressBar.setVisibility(View.GONE); }, throwable -> { @@ -178,7 +174,7 @@ public class NotificationActivity extends NavigationBaseActivity { public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.menu_notifications, menu); - notificationmenuitem = menu.findItem(R.id.archived); + notificationMenuItem = menu.findItem(R.id.archived); setMenuItemTitle(); return true; } @@ -262,18 +258,18 @@ public class NotificationActivity extends NavigationBaseActivity { private void setEmptyView() { if (getIntent().getStringExtra("title").equals("read")) { - nonotificationtext.setText(R.string.no_archived_notification); + noNotificationText.setText(R.string.no_archived_notification); }else { - nonotificationtext.setText(R.string.no_notification); + noNotificationText.setText(R.string.no_notification); } } private void setMenuItemTitle() { if (getIntent().getStringExtra("title").equals("read")) { - notificationmenuitem.setTitle(R.string.menu_option_unread); + notificationMenuItem.setTitle(R.string.menu_option_unread); }else { - notificationmenuitem.setTitle(R.string.menu_option_archived); + notificationMenuItem.setTitle(R.string.menu_option_archived); } } 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 6443528b9..4033a005c 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 @@ -7,11 +7,13 @@ import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.LinearLayout; +import android.widget.RelativeLayout; import android.widget.TextView; +import com.daimajia.swipe.SwipeLayout; import com.nineoldandroids.view.ViewHelper; import com.pedrogomez.renderers.Renderer; -import com.daimajia.swipe.SwipeLayout; + import butterknife.BindView; import butterknife.ButterKnife; import butterknife.OnClick; @@ -33,6 +35,8 @@ public class NotificationRenderer extends Renderer { SwipeLayout swipeLayout; @BindView(R.id.bottom) LinearLayout bottomLayout; + @BindView(R.id.notification_view) + RelativeLayout notificationView; private NotificationClicked listener; private boolean isarchivedvisible = false; @@ -42,19 +46,27 @@ public class NotificationRenderer extends Renderer { this.listener = listener; this.isarchivedvisible = isarchivedvisible; } + + @OnClick(R.id.notification_view) + void onNotificationClicked() { + 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) { } + @Override protected void hookListeners(View rootView) { - rootView.setOnClickListener(v -> listener.notificationClicked(getContent())); + } @Override diff --git a/app/src/main/res/layout/item_notification.xml b/app/src/main/res/layout/item_notification.xml index c8d766945..cc69d1aa6 100644 --- a/app/src/main/res/layout/item_notification.xml +++ b/app/src/main/res/layout/item_notification.xml @@ -2,6 +2,7 @@ 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:foreground="?selectableItemBackground" android:minHeight="72dp"> + + - /> - - + - + \ No newline at end of file