use of org.cyanogenmod.cmparts.profiles.actions.item.TriggerItem in project android_packages_apps_CMParts by LineageOS.
the class SetupActionsFragment method onItemClick.
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
final Item itemAtPosition = (Item) parent.getItemAtPosition(position);
mSelectedItem = itemAtPosition;
mLastSelectedPosition = mAdapter.getPosition(itemAtPosition);
if (itemAtPosition instanceof AirplaneModeItem) {
showDialog(DIALOG_AIRPLANE_MODE);
} else if (itemAtPosition instanceof BrightnessItem) {
showDialog(DIALOG_BRIGHTNESS);
} else if (itemAtPosition instanceof LockModeItem) {
showDialog(DIALOG_LOCK_MODE);
} else if (itemAtPosition instanceof DozeModeItem) {
showDialog(DIALOG_DOZE_MODE);
} else if (itemAtPosition instanceof NotificationLightModeItem) {
showDialog(DIALOG_NOTIFICATION_LIGHT_MODE);
} else if (itemAtPosition instanceof RingModeItem) {
showDialog(DIALOG_RING_MODE);
} else if (itemAtPosition instanceof ConnectionOverrideItem) {
ConnectionOverrideItem connItem = (ConnectionOverrideItem) mSelectedItem;
if (connItem.getConnectionType() == ConnectionSettings.PROFILE_CONNECTION_2G3G4G) {
final Intent intent = new Intent(TelephonyUtils.ACTION_PICK_NETWORK_MODE);
intent.putExtra(TelephonyUtils.EXTRA_NONE_TEXT, getString(R.string.profile_action_none));
intent.putExtra(TelephonyUtils.EXTRA_SHOW_NONE, true);
intent.putExtra(TelephonyUtils.EXTRA_SUBID, connItem.getSettings().getSubId());
intent.putExtra(TelephonyUtils.EXTRA_INITIAL_NETWORK_VALUE, connItem.getSettings().isOverride() ? connItem.getSettings().getValue() : -1);
startActivityForResult(intent, SET_NETWORK_MODE_REQUEST_CODE);
} else {
showDialog(DIALOG_CONNECTION_OVERRIDE);
}
} else if (itemAtPosition instanceof VolumeStreamItem) {
showDialog(DIALOG_VOLUME_STREAM);
} else if (itemAtPosition instanceof ProfileNameItem) {
showDialog(DIALOG_PROFILE_NAME);
} else if (itemAtPosition instanceof TriggerItem) {
TriggerItem item = (TriggerItem) itemAtPosition;
openTriggersFragment(item.getTriggerType());
} else if (itemAtPosition instanceof AppGroupItem) {
AppGroupItem item = (AppGroupItem) itemAtPosition;
if (item.getGroupUuid() == null) {
requestActiveAppGroupsDialog();
} else {
startProfileGroupActivity(item);
}
}
}
Aggregations