Exemplo n.º 1
0
 public PackageHelper() {
   pm = ApplicationBean.getApplication().getPackageManager();
   try {
     info = pm.getPackageInfo(ApplicationBean.getApplication().getPackageName(), 0);
   } catch (NameNotFoundException e) {
     e.printStackTrace();
   }
 }
Exemplo n.º 2
0
 /**
  * 根据分辨率设置透明按钮的大小
  *
  * @author [email protected] 2013-7-29 下午5:12:27
  * @param view
  * @return void
  */
 public static void resetFLBack(View... view) {
   float rote = Handler_System.getWidthRoate(ApplicationBean.getApplication().getMode_w());
   if (view == null || rote == 1) {
     return;
   }
   for (View view2 : view) {
     FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) view2.getLayoutParams();
     layoutParams.height = (int) (layoutParams.height * rote);
     layoutParams.width = (int) (layoutParams.width * rote);
     view2.setLayoutParams(layoutParams);
   }
 }
Exemplo n.º 3
0
 /**
  * 下载中 这个是不支持断点下载的 所以无法显示进度
  *
  * @author [email protected] 2014-3-2 下午11:33:43
  * @return Notification
  */
 public void downNotification(String text) {
   Notification notfi = new Notification();
   notfi.icon = android.R.drawable.stat_sys_download;
   notfi.flags |= Notification.FLAG_ONGOING_EVENT;
   Intent intent = null;
   if (clazz != null) {
     intent = new Intent(ApplicationBean.getApplication(), clazz);
   }
   PendingIntent pendingIntent =
       PendingIntent.getService(mContext, 0, intent == null ? new Intent() : intent, 0);
   notfi.setLatestEventInfo(mContext, mPackageHelper.getAppName(), text, pendingIntent);
   mContextNotificationManager.notify(id, notfi);
 }
Exemplo n.º 4
0
 public static void resetFL(View... view) {
   float rote = Handler_System.getWidthRoate(ApplicationBean.getApplication().getMode_w());
   if (view == null || rote == 1) {
     return;
   }
   for (View view2 : view) {
     FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) view2.getLayoutParams();
     layoutParams.leftMargin = (int) (layoutParams.leftMargin * rote);
     layoutParams.rightMargin = (int) (layoutParams.rightMargin * rote);
     layoutParams.topMargin = (int) (layoutParams.topMargin * rote);
     layoutParams.bottomMargin = (int) (layoutParams.bottomMargin * rote);
     view2.setLayoutParams(layoutParams);
   }
 }
Exemplo n.º 5
0
 /**
  * 下载成功或者失败以后 刷新顶部通知栏
  *
  * @author [email protected] 2014-3-2 下午11:33:43
  * @return Notification
  */
 public void downShowNotification(String text) {
   Intent intent = new Intent();
   if (clazz != null) {
     intent = new Intent(ApplicationBean.getApplication(), clazz);
     intent.addCategory(Intent.CATEGORY_LAUNCHER);
     intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
   }
   PendingIntent pendingIntent = PendingIntent.getActivity(mContext, 0, intent, 0);
   Notification noti = new Notification();
   noti.setLatestEventInfo(mContext, mPackageHelper.getAppName(), text, pendingIntent);
   noti.icon = android.R.drawable.stat_sys_download_done;
   noti.flags =
       Notification.FLAG_AUTO_CANCEL | Notification.DEFAULT_SOUND | Notification.DEFAULT_LIGHTS;
   mContextNotificationManager.notify(id, noti);
 }
Exemplo n.º 6
0
  public void initNotif() {
    mDownProgrNotif = new Notification();
    mDownProgrNotif.icon = android.R.drawable.stat_sys_download;
    mDownProgrNotif.flags |= Notification.FLAG_ONGOING_EVENT;

    mRemoteViews = new RemoteViews(mPackageHelper.getPackageName(), layout_id);
    mRemoteViews.setImageViewResource(icon_id, mPackageHelper.getAppIcon());

    mDownProgrNotif.contentView = mRemoteViews;
    Intent intent = null;
    if (clazz != null) {
      intent = new Intent(ApplicationBean.getApplication(), clazz);
    }
    mDownProgrNotif.contentIntent =
        PendingIntent.getService(mContext, 0, intent == null ? new Intent() : intent, 0);
    //		mContextNotificationManager.notify(id, mDownProgrNotif);
  }