Search in sources :

Example 91 with Fragment

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

the class PrintActivity method showFragment.

private void showFragment(Fragment newFragment) {
    FragmentTransaction transaction = getFragmentManager().beginTransaction();
    Fragment oldFragment = getFragmentManager().findFragmentByTag(FRAGMENT_TAG);
    if (oldFragment != null) {
        transaction.remove(oldFragment);
    }
    if (newFragment != null) {
        transaction.add(R.id.embedded_content_container, newFragment, FRAGMENT_TAG);
    }
    transaction.commitAllowingStateLoss();
    getFragmentManager().executePendingTransactions();
}
Also used : FragmentTransaction(android.app.FragmentTransaction) DialogFragment(android.app.DialogFragment) Fragment(android.app.Fragment)

Example 92 with Fragment

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

the class PNCActivity method onCreate.

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (getFragmentManager().findFragmentByTag(TAG_TUNER) == null) {
        final String action = getIntent().getAction();
        final Fragment fragment;
        fragment = new PowerNotificationControlsFragment();
        getFragmentManager().beginTransaction().replace(R.id.content_frame, fragment, TAG_TUNER).commit();
    }
}
Also used : Fragment(android.app.Fragment) PreferenceFragment(android.support.v14.preference.PreferenceFragment)

Example 93 with Fragment

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

the class PreferenceActivity method switchToHeaderInner.

private void switchToHeaderInner(String fragmentName, Bundle args) {
    getFragmentManager().popBackStack(BACK_STACK_PREFS, FragmentManager.POP_BACK_STACK_INCLUSIVE);
    if (!isValidFragment(fragmentName)) {
        throw new IllegalArgumentException("Invalid fragment for this activity: " + fragmentName);
    }
    Fragment f = Fragment.instantiate(this, fragmentName, args);
    FragmentTransaction transaction = getFragmentManager().beginTransaction();
    transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
    transaction.replace(com.android.internal.R.id.prefs, f);
    transaction.commitAllowingStateLoss();
}
Also used : FragmentTransaction(android.app.FragmentTransaction) Fragment(android.app.Fragment)

Example 94 with Fragment

use of android.app.Fragment in project Talon-for-Twitter by klinker24.

the class TimelinePagerAdapter method getFrag.

public Fragment getFrag(int type, long listId) {
    switch(type) {
        case AppSettings.PAGE_TYPE_LIST:
            Fragment f = new ListFragment();
            Bundle b = new Bundle();
            b.putLong("list_id", listId);
            f.setArguments(b);
            return f;
        case AppSettings.PAGE_TYPE_LINKS:
            return new LinksFragment();
        case AppSettings.PAGE_TYPE_PICS:
            return new PicFragment();
        case AppSettings.PAGE_TYPE_FAV_USERS:
            return new FavUsersFragment();
        case AppSettings.PAGE_TYPE_SAVED_TWEET:
            return new SavedTweetsFragment();
    }
    return null;
}
Also used : PicFragment(com.klinker.android.twitter.activities.main_fragments.home_fragments.extentions.PicFragment) FavUsersFragment(com.klinker.android.twitter.activities.main_fragments.home_fragments.extentions.FavUsersFragment) Bundle(android.os.Bundle) Fragment(android.app.Fragment) PicFragment(com.klinker.android.twitter.activities.main_fragments.home_fragments.extentions.PicFragment) WorldTrendsFragment(com.klinker.android.twitter.activities.main_fragments.other_fragments.trends.WorldTrendsFragment) FavUsersFragment(com.klinker.android.twitter.activities.main_fragments.home_fragments.extentions.FavUsersFragment) LinksFragment(com.klinker.android.twitter.activities.main_fragments.home_fragments.extentions.LinksFragment) LocalTrendsFragment(com.klinker.android.twitter.activities.main_fragments.other_fragments.trends.LocalTrendsFragment) HomeFragment(com.klinker.android.twitter.activities.main_fragments.home_fragments.HomeFragment) LinksFragment(com.klinker.android.twitter.activities.main_fragments.home_fragments.extentions.LinksFragment)

Example 95 with Fragment

use of android.app.Fragment in project xabber-android by redsolution.

the class AccountActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    final Intent intent = getIntent();
    account = getAccount(intent);
    if (account == null) {
        LogManager.i(LOG_TAG, "Account is null, finishing!");
        finish();
        return;
    }
    accountItem = AccountManager.getInstance().getAccount(account);
    if (accountItem == null) {
        Application.getInstance().onError(R.string.NO_SUCH_ACCOUNT);
        finish();
        return;
    }
    if (ACTION_CONNECTION_SETTINGS.equals(intent.getAction())) {
        isConnectionSettingsAction = true;
        startAccountSettingsActivity();
        setIntent(null);
    }
    setContentView(R.layout.activity_account);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar_default);
    toolbar.setNavigationIcon(R.drawable.ic_arrow_left_white_24dp);
    toolbar.setNavigationOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            NavUtils.navigateUpFromSameTask(AccountActivity.this);
        }
    });
    toolbar.setTitle(R.string.contact_account);
    toolbar.inflateMenu(R.menu.toolbar_account);
    MenuItem item = toolbar.getMenu().findItem(R.id.action_account_switch);
    switchCompat = (SwitchCompat) item.getActionView().findViewById(R.id.account_switch_view);
    switchCompat.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            AccountManager.getInstance().setEnabled(accountItem.getAccount(), isChecked);
        }
    });
    barPainter = new BarPainter(this, toolbar);
    UserJid fakeAccountUser;
    try {
        fakeAccountUser = UserJid.from(account.getFullJid().asBareJid());
    } catch (UserJid.UserJidCreateException e) {
        throw new IllegalStateException();
    }
    bestContact = RosterManager.getInstance().getBestContact(account, fakeAccountUser);
    contactTitleView = findViewById(R.id.contact_title_expanded);
    statusIcon = findViewById(R.id.ivStatus);
    statusText = (TextView) findViewById(R.id.status_text);
    RecyclerView recyclerView = (RecyclerView) findViewById(R.id.account_options_recycler_view);
    accountOptionsAdapter = new AccountOptionsAdapter(AccountOption.values(), this, accountItem);
    recyclerView.setLayoutManager(new LinearLayoutManager(this));
    recyclerView.setAdapter(accountOptionsAdapter);
    recyclerView.setNestedScrollingEnabled(false);
    Fragment fragmentById = getFragmentManager().findFragmentById(R.id.account_fragment_container);
    if (fragmentById == null) {
        getFragmentManager().beginTransaction().add(R.id.account_fragment_container, ContactVcardViewerFragment.newInstance(account)).commit();
    }
}
Also used : UserJid(com.xabber.android.data.entity.UserJid) Intent(android.content.Intent) MenuItem(android.view.MenuItem) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) ContactVcardViewerFragment(com.xabber.android.ui.fragment.ContactVcardViewerFragment) Fragment(android.app.Fragment) BarPainter(com.xabber.android.ui.color.BarPainter) AccountOptionsAdapter(com.xabber.android.ui.adapter.accountoptions.AccountOptionsAdapter) RecyclerView(android.support.v7.widget.RecyclerView) CompoundButton(android.widget.CompoundButton) Toolbar(android.support.v7.widget.Toolbar)

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