use of com.android.internal.telephony.SmsApplication.SmsApplicationData in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class SmsDefaultDialog method buildDialog.
private boolean buildDialog(String packageName) {
TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
if (!tm.isSmsCapable()) {
// No phone, no SMS
return false;
}
final AlertController.AlertParams p = mAlertParams;
p.mTitle = getString(R.string.sms_change_default_dialog_title);
mNewSmsApplicationData = SmsApplication.getSmsApplicationData(packageName, this);
if (mNewSmsApplicationData != null) {
// New default SMS app specified, change to that directly after the confirmation
// dialog.
SmsApplicationData oldSmsApplicationData = null;
ComponentName oldSmsComponent = SmsApplication.getDefaultSmsApplication(this, true);
if (oldSmsComponent != null) {
oldSmsApplicationData = SmsApplication.getSmsApplicationData(oldSmsComponent.getPackageName(), this);
if (oldSmsApplicationData.mPackageName.equals(mNewSmsApplicationData.mPackageName)) {
return false;
}
}
// Compose dialog; get
if (oldSmsApplicationData != null) {
p.mMessage = getString(R.string.sms_change_default_dialog_text, mNewSmsApplicationData.getApplicationName(this), oldSmsApplicationData.getApplicationName(this));
} else {
p.mMessage = getString(R.string.sms_change_default_no_previous_dialog_text, mNewSmsApplicationData.getApplicationName(this));
}
p.mPositiveButtonText = getString(R.string.yes);
p.mNegativeButtonText = getString(R.string.no);
p.mPositiveButtonListener = this;
p.mNegativeButtonListener = this;
} else {
// No new default SMS app specified, show a list of all SMS apps and let user to pick
p.mAdapter = new AppListAdapter();
p.mOnClickListener = this;
p.mNegativeButtonText = getString(R.string.cancel);
p.mNegativeButtonListener = this;
}
setupAlert();
return true;
}
use of com.android.internal.telephony.SmsApplication.SmsApplicationData in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class DefaultSmsPreference method loadSmsApps.
private void loadSmsApps() {
Collection<SmsApplicationData> smsApplications = SmsApplication.getApplicationCollection(getContext());
int count = smsApplications.size();
String[] packageNames = new String[count];
int i = 0;
for (SmsApplicationData smsApplicationData : smsApplications) {
packageNames[i++] = smsApplicationData.mPackageName;
}
setPackageNames(packageNames, getDefaultPackage());
}
Aggregations