Android Open Source - rights-alert Load Applications Handler






From Project

Back to project page rights-alert.

License

The source code is released under:

GNU General Public License

If you think the Android project rights-alert 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 fr.keuse.rightsalert.handler;
//from   www  .ja v  a2 s  .  c o m
import java.util.ArrayList;
import java.util.List;

import fr.keuse.rightsalert.activity.ApplistActivity;
import fr.keuse.rightsalert.entity.ApplicationEntity;
import android.app.ProgressDialog;
import android.os.Handler;
import android.os.Message;

public class LoadApplicationsHandler extends Handler {
  public final static int MSG_START_PROGRESS = 1;
  public final static int MSG_UPDATE_PROGRESS = 2;
  public final static int MSG_FINISH_PROGRESS = 3;
  
  private ProgressDialog progress;
  private ApplistActivity activity;
  private ArrayList<ApplicationEntity> applications;
  
  public LoadApplicationsHandler(ProgressDialog progress, ApplistActivity activity, ArrayList<ApplicationEntity> applications) {
    this.progress = progress;
    this.activity = activity;
    this.applications = applications;
  }
  
  @SuppressWarnings("unchecked")
  @Override
  public void handleMessage(Message msg) {
    switch(msg.arg1) {
    case MSG_START_PROGRESS:
      progress.setMax(msg.arg2);
      progress.show();
      break;
    case MSG_UPDATE_PROGRESS:
      progress.setProgress(msg.arg2);
      progress.setMessage((String) msg.obj);
      break;
    case MSG_FINISH_PROGRESS:
      applications.addAll((List<ApplicationEntity>) msg.obj);
      activity.refreshView();
      progress.dismiss();
    }
  }
  
  
}




Java Source Code List

fr.keuse.rightsalert.activity.ApplistActivity.java
fr.keuse.rightsalert.adapter.ApplistAdapter.java
fr.keuse.rightsalert.comparator.ApplicationEntityComparator.java
fr.keuse.rightsalert.entity.ApplicationEntity.java
fr.keuse.rightsalert.handler.LoadApplicationsHandler.java
fr.keuse.rightsalert.helper.Score.java
fr.keuse.rightsalert.preference.RightsalertPreference.java
fr.keuse.rightsalert.thread.LoadApplicationsThread.java