Search in sources :

Example 1 with VolumeStreamItem

use of org.cyanogenmod.cmparts.profiles.actions.item.VolumeStreamItem in project android_packages_apps_CMParts by LineageOS.

the class SetupActionsFragment method generateVolumeStreamItem.

private VolumeStreamItem generateVolumeStreamItem(int stream) {
    StreamSettings settings = mProfile.getSettingsForStream(stream);
    if (settings == null) {
        settings = new StreamSettings(stream);
        mProfile.setStreamSettings(settings);
    }
    return new VolumeStreamItem(stream, settings);
}
Also used : StreamSettings(cyanogenmod.profiles.StreamSettings) VolumeStreamItem(org.cyanogenmod.cmparts.profiles.actions.item.VolumeStreamItem)

Example 2 with VolumeStreamItem

use of org.cyanogenmod.cmparts.profiles.actions.item.VolumeStreamItem 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);
        }
    }
}
Also used : AppGroupItem(org.cyanogenmod.cmparts.profiles.actions.item.AppGroupItem) AirplaneModeItem(org.cyanogenmod.cmparts.profiles.actions.item.AirplaneModeItem) TriggerItem(org.cyanogenmod.cmparts.profiles.actions.item.TriggerItem) ConnectionOverrideItem(org.cyanogenmod.cmparts.profiles.actions.item.ConnectionOverrideItem) VolumeStreamItem(org.cyanogenmod.cmparts.profiles.actions.item.VolumeStreamItem) ProfileNameItem(org.cyanogenmod.cmparts.profiles.actions.item.ProfileNameItem) Intent(android.content.Intent) LockModeItem(org.cyanogenmod.cmparts.profiles.actions.item.LockModeItem) BrightnessItem(org.cyanogenmod.cmparts.profiles.actions.item.BrightnessItem) NotificationLightModeItem(org.cyanogenmod.cmparts.profiles.actions.item.NotificationLightModeItem) LockModeItem(org.cyanogenmod.cmparts.profiles.actions.item.LockModeItem) TriggerItem(org.cyanogenmod.cmparts.profiles.actions.item.TriggerItem) DozeModeItem(org.cyanogenmod.cmparts.profiles.actions.item.DozeModeItem) AppGroupItem(org.cyanogenmod.cmparts.profiles.actions.item.AppGroupItem) AirplaneModeItem(org.cyanogenmod.cmparts.profiles.actions.item.AirplaneModeItem) VolumeStreamItem(org.cyanogenmod.cmparts.profiles.actions.item.VolumeStreamItem) Item(org.cyanogenmod.cmparts.profiles.actions.item.Item) BrightnessItem(org.cyanogenmod.cmparts.profiles.actions.item.BrightnessItem) ProfileNameItem(org.cyanogenmod.cmparts.profiles.actions.item.ProfileNameItem) MenuItem(android.view.MenuItem) ConnectionOverrideItem(org.cyanogenmod.cmparts.profiles.actions.item.ConnectionOverrideItem) DisabledItem(org.cyanogenmod.cmparts.profiles.actions.item.DisabledItem) RingModeItem(org.cyanogenmod.cmparts.profiles.actions.item.RingModeItem) DozeModeItem(org.cyanogenmod.cmparts.profiles.actions.item.DozeModeItem) NotificationLightModeItem(org.cyanogenmod.cmparts.profiles.actions.item.NotificationLightModeItem) RingModeItem(org.cyanogenmod.cmparts.profiles.actions.item.RingModeItem)

Aggregations

VolumeStreamItem (org.cyanogenmod.cmparts.profiles.actions.item.VolumeStreamItem)2 Intent (android.content.Intent)1 MenuItem (android.view.MenuItem)1 StreamSettings (cyanogenmod.profiles.StreamSettings)1 AirplaneModeItem (org.cyanogenmod.cmparts.profiles.actions.item.AirplaneModeItem)1 AppGroupItem (org.cyanogenmod.cmparts.profiles.actions.item.AppGroupItem)1 BrightnessItem (org.cyanogenmod.cmparts.profiles.actions.item.BrightnessItem)1 ConnectionOverrideItem (org.cyanogenmod.cmparts.profiles.actions.item.ConnectionOverrideItem)1 DisabledItem (org.cyanogenmod.cmparts.profiles.actions.item.DisabledItem)1 DozeModeItem (org.cyanogenmod.cmparts.profiles.actions.item.DozeModeItem)1 Item (org.cyanogenmod.cmparts.profiles.actions.item.Item)1 LockModeItem (org.cyanogenmod.cmparts.profiles.actions.item.LockModeItem)1 NotificationLightModeItem (org.cyanogenmod.cmparts.profiles.actions.item.NotificationLightModeItem)1 ProfileNameItem (org.cyanogenmod.cmparts.profiles.actions.item.ProfileNameItem)1 RingModeItem (org.cyanogenmod.cmparts.profiles.actions.item.RingModeItem)1 TriggerItem (org.cyanogenmod.cmparts.profiles.actions.item.TriggerItem)1