Search in sources :

Example 1 with NotificationManager

use of ca.etsmtl.applets.etsmobile.util.NotificationManager in project ETSMobile-Android2 by ApplETS.

the class NotificationActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_notifications);
    securePreferences = new SecurePreferences(this);
    progressBar = (ProgressBar) findViewById(R.id.progressBar_notifications);
    listView = (ListView) findViewById(R.id.listView_notifications);
    progressBar.getIndeterminateDrawable().setColorFilter(getResources().getColor(R.color.ets_red_fonce), PorterDuff.Mode.MULTIPLY);
    progressBar.setVisibility(View.VISIBLE);
    notificationsAdapter = new NotificationsAdapter(this, R.layout.row_notification, new ArrayList<>());
    listView.setAdapter(notificationsAdapter);
    listView.setOnItemClickListener((parent, view, position, id) -> {
        MonETSNotification item = notificationsAdapter.getItem(position);
        String url = item.getUrl();
        if (URLUtil.isValidUrl(url)) {
            Utility.openChromeCustomTabs(NotificationActivity.this, url);
        }
    });
    syncAdapterWithDB();
    DataManager datamanager = DataManager.getInstance(this);
    NotificationManager manager = new NotificationManager(this, datamanager.getMonETSService(), this);
    manager.updateNotifications();
}
Also used : NotificationsAdapter(ca.etsmtl.applets.etsmobile.ui.adapter.NotificationsAdapter) MonETSNotification(ca.etsmtl.applets.etsmobile.model.MonETSNotification) NotificationManager(ca.etsmtl.applets.etsmobile.util.NotificationManager) ArrayList(java.util.ArrayList) DataManager(ca.etsmtl.applets.etsmobile.http.DataManager) SecurePreferences(ca.etsmtl.applets.etsmobile.util.SecurePreferences)

Aggregations

DataManager (ca.etsmtl.applets.etsmobile.http.DataManager)1 MonETSNotification (ca.etsmtl.applets.etsmobile.model.MonETSNotification)1 NotificationsAdapter (ca.etsmtl.applets.etsmobile.ui.adapter.NotificationsAdapter)1 NotificationManager (ca.etsmtl.applets.etsmobile.util.NotificationManager)1 SecurePreferences (ca.etsmtl.applets.etsmobile.util.SecurePreferences)1 ArrayList (java.util.ArrayList)1