Esempio n. 1
1
 @Override
 public void onReceive(Context context, Intent intent) {
   String action = intent.getAction();
   if (Intent.ACTION_BATTERY_CHANGED.equals(action)) {
     mBatteryLevel.setSummary(Utils.getBatteryPercentage(intent));
     mBatteryStatus.setSummary(Utils.getBatteryStatus(getResources(), intent));
   } else if (SPN_STRINGS_UPDATED_ACTION.equals(action)) {
     String operatorName = null;
     String plmn = null;
     String spn = null;
     if (intent.getBooleanExtra(EXTRA_SHOW_PLMN, false)) {
       plmn = intent.getStringExtra(EXTRA_PLMN);
       if (plmn != null) {
         operatorName = plmn;
       }
     }
     if (intent.getBooleanExtra(EXTRA_SHOW_SPN, false)) {
       spn = intent.getStringExtra(EXTRA_SPN);
       if (spn != null) {
         operatorName = spn;
       }
     }
     Preference p = findPreference(KEY_OPERATOR_NAME);
     if (p != null) {
       mExt.updateOpNameFromRec(p, operatorName);
     }
   }
 }