Search in sources :

Example 6 with PreferenceFragment

use of android.support.v14.preference.PreferenceFragment in project android_frameworks_base by DirtyUnicorns.

the class TunerActivity method onPreferenceStartFragment.

@Override
public boolean onPreferenceStartFragment(PreferenceFragment caller, Preference pref) {
    try {
        Class<?> cls = Class.forName(pref.getFragment());
        Fragment fragment = (Fragment) cls.newInstance();
        FragmentTransaction transaction = getFragmentManager().beginTransaction();
        setTitle(pref.getTitle());
        transaction.replace(R.id.content_frame, fragment);
        transaction.addToBackStack("PreferenceFragment");
        transaction.commit();
        return true;
    } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) {
        Log.d("TunerActivity", "Problem launching fragment", e);
        return false;
    }
}
Also used : FragmentTransaction(android.app.FragmentTransaction) Fragment(android.app.Fragment) PreferenceFragment(android.support.v14.preference.PreferenceFragment)

Example 7 with PreferenceFragment

use of android.support.v14.preference.PreferenceFragment in project android_frameworks_base by ResurrectionRemix.

the class TunerActivity method onCreate.

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (getFragmentManager().findFragmentByTag(TAG_TUNER) == null) {
        final String action = getIntent().getAction();
        final Fragment fragment;
        if ("com.android.settings.action.DEMO_MODE".equals(action)) {
            fragment = new DemoModeFragment();
        } else if ("com.android.settings.action.POWER_NOTIF_CONTROLS".equals(action)) {
            fragment = new PowerNotificationControlsFragment();
        } else {
            fragment = new TunerFragment();
        }
        getFragmentManager().beginTransaction().replace(R.id.content_frame, fragment, TAG_TUNER).commit();
        mInitialTitle = String.valueOf(getActionBar().getTitle());
        String extra = getIntent().getStringExtra(TAG_TUNER);
        if (extra != null) {
            startPreferenceScreen((PreferenceFragment) fragment, extra, false);
        }
    }
}
Also used : Fragment(android.app.Fragment) PreferenceFragment(android.support.v14.preference.PreferenceFragment)

Example 8 with PreferenceFragment

use of android.support.v14.preference.PreferenceFragment in project android_frameworks_base by ResurrectionRemix.

the class TunerActivity method onPreferenceStartFragment.

@Override
public boolean onPreferenceStartFragment(PreferenceFragment caller, Preference pref) {
    try {
        Class<?> cls = Class.forName(pref.getFragment());
        Fragment fragment = (Fragment) cls.newInstance();
        FragmentTransaction transaction = getFragmentManager().beginTransaction();
        getActionBar().setTitle(pref.getTitle());
        transaction.replace(R.id.content_frame, fragment);
        transaction.addToBackStack("PreferenceFragment");
        transaction.commit();
        return true;
    } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) {
        Log.d("TunerActivity", "Problem launching fragment", e);
        return false;
    }
}
Also used : FragmentTransaction(android.app.FragmentTransaction) Fragment(android.app.Fragment) PreferenceFragment(android.support.v14.preference.PreferenceFragment)

Example 9 with PreferenceFragment

use of android.support.v14.preference.PreferenceFragment in project android_frameworks_base by crdroidandroid.

the class TunerActivity method onPreferenceStartFragment.

@Override
public boolean onPreferenceStartFragment(PreferenceFragment caller, Preference pref) {
    try {
        Class<?> cls = Class.forName(pref.getFragment());
        Fragment fragment = (Fragment) cls.newInstance();
        FragmentTransaction transaction = getFragmentManager().beginTransaction();
        setTitle(pref.getTitle());
        transaction.replace(R.id.content_frame, fragment);
        transaction.addToBackStack("PreferenceFragment");
        transaction.commit();
        return true;
    } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) {
        Log.d("TunerActivity", "Problem launching fragment", e);
        return false;
    }
}
Also used : FragmentTransaction(android.app.FragmentTransaction) Fragment(android.app.Fragment) PreferenceFragment(android.support.v14.preference.PreferenceFragment)

Aggregations

PreferenceFragment (android.support.v14.preference.PreferenceFragment)9 Fragment (android.app.Fragment)7 FragmentTransaction (android.app.FragmentTransaction)6