use of cyanogenmod.app.Profile in project android_packages_apps_CMParts by LineageOS.
the class SetupDefaultProfileReceiver method onReceive.
@Override
public void onReceive(Context context, Intent intent) {
if (CMSettings.System.getInt(context.getContentResolver(), CMSettings.System.SYSTEM_PROFILES_ENABLED, 1) == 1) {
ProfileManager profileManager = ProfileManager.getInstance(context);
Profile defaultProfile = profileManager.getProfile(UUID.fromString("0230226d-0d05-494a-a9bd-d222a1117655"));
if (defaultProfile != null) {
SetupActionsFragment.fillProfileWithCurrentSettings(context, defaultProfile);
profileManager.updateProfile(defaultProfile);
}
}
}
use of cyanogenmod.app.Profile in project android_packages_apps_CMParts by LineageOS.
the class NFCProfile method getPreviouslySelectedProfile.
private Profile getPreviouslySelectedProfile() {
Profile previous = null;
SharedPreferences prefs = getSharedPreferences(PREFS_NAME, 0);
String uuid = prefs.getString(PREFS_PREVIOUS_PROFILE, null);
if (uuid != null) {
previous = mProfileManager.getProfile(UUID.fromString(uuid));
}
return previous;
}
use of cyanogenmod.app.Profile in project android_packages_apps_CMParts by LineageOS.
the class NFCProfile method switchTo.
private void switchTo(UUID uuid) {
Profile p = mProfileManager.getProfile(uuid);
if (p != null) {
mProfileManager.setActiveProfile(uuid);
Toast.makeText(this, getString(R.string.profile_selected, p.getName()), Toast.LENGTH_LONG).show();
NFCProfileUtils.vibrate(this);
}
}
use of cyanogenmod.app.Profile in project android_packages_apps_CMParts by LineageOS.
the class NFCProfileSelect method showProfileSelectionDialog.
void showProfileSelectionDialog() {
final Profile[] profiles = mProfileManager.getProfiles();
final String[] profileNames = new String[profiles.length];
for (int i = 0; i < profiles.length; i++) {
profileNames[i] = profiles[i].getName();
}
Builder builder = new Builder(this);
builder.setTitle(R.string.profile_settings_title);
builder.setSingleChoiceItems(profileNames, currentChoice, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
currentChoice = which;
}
});
builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (currentChoice != defaultChoice) {
Profile profile = profiles[currentChoice];
profile.addSecondaryUuid(mProfileUuid);
mProfileManager.updateProfile(profile);
Toast.makeText(NFCProfileSelect.this, R.string.profile_write_success, Toast.LENGTH_LONG).show();
}
finish();
}
});
builder.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
finish();
}
});
builder.show();
}
Aggregations