Android Open Source - garageoPIner-androidApp Notification Update Runnable






From Project

Back to project page garageoPIner-androidApp.

License

The source code is released under:

Apache License

If you think the Android project garageoPIner-androidApp listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.wirthual.garageopiner.utils;
//from w  w  w .  jav a 2s  .  c om
import android.app.NotificationManager;
import android.support.v4.app.NotificationCompat;

public class NotificationUpdateRunnable implements Runnable{
  
  NotificationCompat.Builder mBuilder;
  NotificationManager mNotifyManager;
  
  String contentText;
  String s;
  
  int maxtime;
  
  public NotificationUpdateRunnable(NotificationCompat.Builder builder, NotificationManager man, int seconds,String content, String second) {
    this.mBuilder = builder;
    this.maxtime = seconds;
    mNotifyManager = man;
    
    contentText = content;
    s = second;
  }
  
  @Override
  public void run() {
        int incr;
        
        for (incr = 0; incr <= maxtime; incr+=1) {
            int diff = maxtime - incr;
                String contentString = contentText +" " + String.valueOf(diff) +" " + s;
                mBuilder.setProgress(maxtime, incr, false);
                
                mBuilder.setContentText( contentString);
                mNotifyManager.notify(0, mBuilder.build());

                    try {
                        Thread.sleep(960);
                    } catch (InterruptedException e) {
                      mNotifyManager.cancel(0);
                        return;
                    }
        }
       
        mNotifyManager.cancel(0);
       
    }


    
  }




Java Source Code List

com.wirthual.garageopiner.activities.MainActivity.java
com.wirthual.garageopiner.activities.SettingsActivity.java
com.wirthual.garageopiner.activities.TimeTableActivity.java
com.wirthual.garageopiner.communication.CommunicationService.java
com.wirthual.garageopiner.communication.DisplayToast.java
com.wirthual.garageopiner.communication.GarageoPInerHTTPClient.java
com.wirthual.garageopiner.fragments.MainFragment.java
com.wirthual.garageopiner.fragments.TimeTableFragment.java
com.wirthual.garageopiner.utils.ExpandableListAdapter.java
com.wirthual.garageopiner.utils.MyTimeTriggerWidgetProvider.java
com.wirthual.garageopiner.utils.MyTriggerWidgetProvider.java
com.wirthual.garageopiner.utils.NotificationUpdateRunnable.java
com.wirthual.garageopiner.utils.WifiChangedReceiver.java