mirror of
				https://github.com/commons-app/apps-android-commons.git
				synced 2025-10-30 22:34:02 +01:00 
			
		
		
		
	Fix notification click (#2474)
This commit is contained in:
		
							parent
							
								
									628998e841
								
							
						
					
					
						commit
						083a7a80f0
					
				
					 3 changed files with 65 additions and 55 deletions
				
			
		|  | @ -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<Notification> adapter; | ||||
|     private List<Notification> 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); | ||||
| 
 | ||||
|         } | ||||
|     } | ||||
|  |  | |||
|  | @ -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<Notification> { | |||
|     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<Notification> { | |||
|         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 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Vivek Maskara
						Vivek Maskara