Search in sources :

Example 1 with PartsActivity

use of org.cyanogenmod.cmparts.PartsActivity in project android_packages_apps_CMParts by LineageOS.

the class ProfilesPreference method startProfileConfigActivity.

// utility method used to start sub activity
private void startProfileConfigActivity() {
    PartsActivity pa = (PartsActivity) mFragment.getActivity();
    pa.startPreferencePanel(SetupActionsFragment.class.getCanonicalName(), mSettingsBundle, R.string.profile_profile_manage, null, null, PROFILE_DETAILS);
}
Also used : PartsActivity(org.cyanogenmod.cmparts.PartsActivity)

Example 2 with PartsActivity

use of org.cyanogenmod.cmparts.PartsActivity in project android_packages_apps_CMParts by LineageOS.

the class ProfilesSettings method addProfile.

private void addProfile() {
    Bundle args = new Bundle();
    args.putBoolean(EXTRA_NEW_PROFILE, true);
    args.putParcelable(EXTRA_PROFILE, new Profile(getString(R.string.new_profile_name)));
    PartsActivity pa = (PartsActivity) getActivity();
    pa.startPreferencePanel(SetupTriggersFragment.class.getCanonicalName(), args, 0, null, this, 0);
}
Also used : Bundle(android.os.Bundle) PartsActivity(org.cyanogenmod.cmparts.PartsActivity) Profile(cyanogenmod.app.Profile)

Example 3 with PartsActivity

use of org.cyanogenmod.cmparts.PartsActivity in project android_packages_apps_CMParts by LineageOS.

the class ProfilesSettings method onStart.

@Override
public void onStart() {
    super.onStart();
    final PartsActivity activity = (PartsActivity) getActivity();
    mProfileEnabler = new CMBaseSystemSettingSwitchBar(activity, activity.getSwitchBar(), CMSettings.System.SYSTEM_PROFILES_ENABLED, true, this);
}
Also used : CMBaseSystemSettingSwitchBar(org.cyanogenmod.cmparts.widget.CMBaseSystemSettingSwitchBar) PartsActivity(org.cyanogenmod.cmparts.PartsActivity)

Example 4 with PartsActivity

use of org.cyanogenmod.cmparts.PartsActivity in project android_packages_apps_CMParts by LineageOS.

the class SetupActionsFragment method openTriggersFragment.

private void openTriggersFragment(int openTo) {
    Bundle args = new Bundle();
    args.putParcelable(ProfilesSettings.EXTRA_PROFILE, mProfile);
    args.putBoolean(ProfilesSettings.EXTRA_NEW_PROFILE, false);
    args.putInt(SetupTriggersFragment.EXTRA_INITIAL_PAGE, openTo);
    PartsActivity pa = (PartsActivity) getActivity();
    pa.startPreferencePanel(SetupTriggersFragment.class.getCanonicalName(), args, R.string.profile_profile_manage, null, this, NEW_TRIGGER_REQUEST_CODE);
}
Also used : Bundle(android.os.Bundle) PartsActivity(org.cyanogenmod.cmparts.PartsActivity)

Example 5 with PartsActivity

use of org.cyanogenmod.cmparts.PartsActivity in project android_packages_apps_CMParts by LineageOS.

the class SetupTriggersFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View root = inflater.inflate(R.layout.fragment_setup_triggers, container, false);
    mPager = (ViewPager) root.findViewById(R.id.view_pager);
    mAdapter = new TriggerPagerAdapter(getActivity(), getChildFragmentManager());
    Bundle profileArgs = new Bundle();
    profileArgs.putParcelable(ProfilesSettings.EXTRA_PROFILE, mProfile);
    final TriggerPagerAdapter.TriggerFragments[] fragments = TriggerPagerAdapter.TriggerFragments.values();
    for (final TriggerPagerAdapter.TriggerFragments fragment : fragments) {
        if (fragment.getFragmentClass() == NfcTriggerFragment.class) {
            if (!getActivity().getPackageManager().hasSystemFeature(PackageManager.FEATURE_NFC)) {
                // device doesn't have NFC
                continue;
            }
        }
        mAdapter.add(fragment.getFragmentClass(), profileArgs, fragment.getTitleRes());
    }
    mPager.setAdapter(mAdapter);
    PagerTabStrip tabs = (PagerTabStrip) root.findViewById(R.id.tabs);
    tabs.setTabIndicatorColorResource(R.color.theme_accent);
    if (mNewProfileMode) {
        showButtonBar(true);
        getNextButton().setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View view) {
                Bundle args = new Bundle();
                args.putParcelable(ProfilesSettings.EXTRA_PROFILE, mProfile);
                args.putBoolean(ProfilesSettings.EXTRA_NEW_PROFILE, mNewProfileMode);
                PartsActivity pa = (PartsActivity) getActivity();
                pa.startPreferencePanel(SetupActionsFragment.class.getCanonicalName(), args, R.string.profile_profile_manage, null, SetupTriggersFragment.this, REQUEST_SETUP_ACTIONS);
            }
        });
        // back button
        getBackButton().setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View view) {
                finishPreferencePanel(SetupTriggersFragment.this, Activity.RESULT_CANCELED, null);
            }
        });
    }
    return root;
}
Also used : Bundle(android.os.Bundle) PartsActivity(org.cyanogenmod.cmparts.PartsActivity) PagerTabStrip(android.support.v4.view.PagerTabStrip) View(android.view.View)

Aggregations

PartsActivity (org.cyanogenmod.cmparts.PartsActivity)5 Bundle (android.os.Bundle)3 PagerTabStrip (android.support.v4.view.PagerTabStrip)1 View (android.view.View)1 Profile (cyanogenmod.app.Profile)1 CMBaseSystemSettingSwitchBar (org.cyanogenmod.cmparts.widget.CMBaseSystemSettingSwitchBar)1