Search in sources :

Example 86 with Fragment

use of android.app.Fragment in project android_frameworks_base by crdroidandroid.

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.NAV_BAR_TUNER".equals(action)) {
            fragment = new NavBarTuner();
        } 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();
    }
}
Also used : Fragment(android.app.Fragment) PreferenceFragment(android.support.v14.preference.PreferenceFragment)

Example 87 with Fragment

use of android.app.Fragment in project double-espresso by JakeWharton.

the class FragmentStack method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.fragment_stack);
    // Watch for button clicks.
    Button button = (Button) findViewById(R.id.new_fragment);
    button.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            addFragmentToStack();
        }
    });
    if (savedInstanceState == null) {
        // Do first time initialization -- add initial fragment.
        Fragment newFragment = CountingFragment.newInstance(stackLevel);
        FragmentTransaction ft = getFragmentManager().beginTransaction();
        ft.add(R.id.simple_fragment, newFragment).commit();
    } else {
        stackLevel = savedInstanceState.getInt("level");
    }
}
Also used : FragmentTransaction(android.app.FragmentTransaction) Button(android.widget.Button) OnClickListener(android.view.View.OnClickListener) TextView(android.widget.TextView) View(android.view.View) Fragment(android.app.Fragment)

Example 88 with Fragment

use of android.app.Fragment in project double-espresso by JakeWharton.

the class FragmentStack method addFragmentToStack.

void addFragmentToStack() {
    stackLevel++;
    // Instantiate a new fragment.
    Fragment newFragment = CountingFragment.newInstance(stackLevel);
    // Add the fragment to the activity, pushing this transaction
    // on to the back stack.
    FragmentTransaction ft = getFragmentManager().beginTransaction();
    ft.replace(R.id.simple_fragment, newFragment);
    ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
    ft.addToBackStack(null);
    ft.commit();
}
Also used : FragmentTransaction(android.app.FragmentTransaction) Fragment(android.app.Fragment)

Example 89 with Fragment

use of android.app.Fragment in project android_frameworks_base by AOSPA.

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 90 with Fragment

use of android.app.Fragment in project android_frameworks_base by AOSPA.

the class PrintActivity method ensureErrorUiShown.

private void ensureErrorUiShown(CharSequence message, int action) {
    if (isFinishing() || isDestroyed()) {
        return;
    }
    if (mUiState != UI_STATE_ERROR) {
        mUiState = UI_STATE_ERROR;
        mPrintPreviewController.setUiShown(false);
        Fragment fragment = PrintErrorFragment.newInstance(message, action);
        showFragment(fragment);
    }
}
Also used : DialogFragment(android.app.DialogFragment) Fragment(android.app.Fragment)

Aggregations

Fragment (android.app.Fragment)209 FragmentTransaction (android.app.FragmentTransaction)82 FragmentManager (android.app.FragmentManager)51 DialogFragment (android.app.DialogFragment)44 Bundle (android.os.Bundle)22 Intent (android.content.Intent)13 View (android.view.View)13 PreferenceFragment (android.support.v14.preference.PreferenceFragment)12 TextView (android.widget.TextView)8 BizFragment (org.aisen.weibo.sina.ui.fragment.base.BizFragment)8 Uri (android.net.Uri)6 ABaseFragment (org.aisen.android.ui.fragment.ABaseFragment)6 Activity (android.app.Activity)5 PreferenceFragment (android.preference.PreferenceFragment)4 HashMap (java.util.HashMap)4 Map (java.util.Map)4 ViewGroup (android.view.ViewGroup)3 FrameLayout (android.widget.FrameLayout)3 ContactVcardViewerFragment (com.xabber.android.ui.fragment.ContactVcardViewerFragment)3 Method (java.lang.reflect.Method)3