コード例 #1
0
 public static void updateFromMessage(StatusMessage s, Message m) {
   Bundle b = m.getData();
   if (b.containsKey(SSID_KEY)
       && b.getString(SSID_KEY) != null
       && b.getString(SSID_KEY).length() > 1)
     if (!b.equals(s.getSSID())) s.setSSID(b.getString(SSID_KEY));
   if (b.containsKey(STATUS_KEY)
       && b.getString(STATUS_KEY) != null
       && b.getString(STATUS_KEY).length() > 1)
     if (!b.equals(s.getStatus())) s.setStatus(b.getString(STATUS_KEY));
   if (b.containsKey(SIGNAL_KEY) && b.getInt(SIGNAL_KEY) != s.getSignal())
     s.setSignal(b.getInt(SIGNAL_KEY));
   if (b.containsKey(SHOW_KEY) && b.getInt(SHOW_KEY) != 0)
     if (b.getInt(SHOW_KEY) != s.getShow()) s.setShow(b.getInt(SHOW_KEY));
   if (b.containsKey(LINK_KEY)) {
     String ls = b.getString(LINK_KEY);
     if (ls != null && !ls.contains(MB)) s.setLinkSpeed(ls.concat(MB));
   }
 }
コード例 #2
0
  @Override
  public void vaddStatNotif(final Context ctxt, final StatusMessage in) {
    StatusMessage m = validateStrings(in);

    if (m.getShow() != 1) {
      vcancel(ctxt, STAT_TAG, NotifUtil.STATNOTIFID);
      return;
    }

    if (NotifUtil.ssidStatus == NotifUtil.SSID_STATUS_UNMANAGED) {
      m.setStatus(
          new StringBuilder(ctxt.getString(R.string.unmanaged)).append(m.getStatus()).toString());
    }

    NotificationCompat.Builder statbuilder = new NotificationCompat.Builder(ctxt);
    Intent intent =
        new Intent(ctxt, WifiFixerActivity.class)
            .setAction(Intent.ACTION_MAIN)
            .setFlags(Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
    statbuilder.setContentIntent(PendingIntent.getActivity(ctxt, 0, intent, 0));
    statbuilder.setOnlyAlertOnce(true);
    statbuilder.setOngoing(true);
    statbuilder.setWhen(0);
    statbuilder.setPriority(NotificationCompat.PRIORITY_MIN);
    statbuilder.setSmallIcon(getIconfromSignal(m.getSignal(), ICON_SET_SMALL));
    statbuilder.setLargeIcon(
        BitmapFactory.decodeResource(
            ctxt.getResources(), getIconfromSignal(m.getSignal(), ICON_SET_LARGE)));
    statbuilder.setContentText(m.getStatus());
    statbuilder.setSubText(ctxt.getString(R.string.network_status));
    statbuilder.setContentTitle(m.getSSID());
    /*
     * Fire the notification
     */
    notify(ctxt, NotifUtil.STATNOTIFID, STAT_TAG, statbuilder.build());
  }