Search in sources :

Example 76 with FragmentManager

use of android.support.v4.app.FragmentManager in project android by owncloud.

the class ReceiveExternalFilesActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    prepareStreamsToUpload();
    if (savedInstanceState == null) {
        mParents = new Stack<>();
        mAccountSelected = false;
        mAccountSelectionShowing = false;
    } else {
        mParents = (Stack<String>) savedInstanceState.getSerializable(KEY_PARENTS);
        mFile = savedInstanceState.getParcelable(KEY_FILE);
        mAccountSelected = savedInstanceState.getBoolean(KEY_ACCOUNT_SELECTED);
        mAccountSelectionShowing = savedInstanceState.getBoolean(KEY_ACCOUNT_SELECTION_SHOWING);
    }
    super.onCreate(savedInstanceState);
    if (mAccountSelected) {
        setAccount((Account) savedInstanceState.getParcelable(FileActivity.EXTRA_ACCOUNT));
    }
    // Listen for sync messages
    IntentFilter syncIntentFilter = new IntentFilter(RefreshFolderOperation.EVENT_SINGLE_FOLDER_CONTENTS_SYNCED);
    syncIntentFilter.addAction(RefreshFolderOperation.EVENT_SINGLE_FOLDER_SHARES_SYNCED);
    mSyncBroadcastReceiver = new SyncBroadcastReceiver();
    registerReceiver(mSyncBroadcastReceiver, syncIntentFilter);
    // Init Fragment without UI to retain AsyncTask across configuration changes
    FragmentManager fm = getSupportFragmentManager();
    TaskRetainerFragment taskRetainerFragment = (TaskRetainerFragment) fm.findFragmentByTag(TaskRetainerFragment.FTAG_TASK_RETAINER_FRAGMENT);
    if (taskRetainerFragment == null) {
        taskRetainerFragment = new TaskRetainerFragment();
        fm.beginTransaction().add(taskRetainerFragment, TaskRetainerFragment.FTAG_TASK_RETAINER_FRAGMENT).commit();
    }
// else, Fragment already created and retained across configuration change
}
Also used : FragmentManager(android.support.v4.app.FragmentManager) IntentFilter(android.content.IntentFilter) TaskRetainerFragment(com.owncloud.android.ui.fragment.TaskRetainerFragment)

Example 77 with FragmentManager

use of android.support.v4.app.FragmentManager in project android by owncloud.

the class UriUploader method copyThenUpload.

/**
     *
     * @param sourceUris        Array of content:// URIs to the files to upload
     * @param remotePaths       Array of absolute paths to set to the uploaded files
     */
private void copyThenUpload(Uri[] sourceUris, String[] remotePaths) {
    if (mShowWaitingDialog) {
        mActivity.showLoadingDialog(R.string.wait_for_tmp_copy_from_private_storage);
    }
    CopyAndUploadContentUrisTask copyTask = new CopyAndUploadContentUrisTask(mCopyTmpTaskListener, mActivity);
    FragmentManager fm = mActivity.getSupportFragmentManager();
    // Init Fragment without UI to retain AsyncTask across configuration changes
    TaskRetainerFragment taskRetainerFragment = (TaskRetainerFragment) fm.findFragmentByTag(TaskRetainerFragment.FTAG_TASK_RETAINER_FRAGMENT);
    if (taskRetainerFragment != null) {
        taskRetainerFragment.setTask(copyTask);
    }
    copyTask.execute(CopyAndUploadContentUrisTask.makeParamsToExecute(mAccount, sourceUris, remotePaths, mBehaviour, mActivity.getContentResolver()));
}
Also used : FragmentManager(android.support.v4.app.FragmentManager) TaskRetainerFragment(com.owncloud.android.ui.fragment.TaskRetainerFragment) CopyAndUploadContentUrisTask(com.owncloud.android.ui.asynctasks.CopyAndUploadContentUrisTask)

Example 78 with FragmentManager

use of android.support.v4.app.FragmentManager in project scdl by passy.

the class ChangelogDialog method showDialogForActivity.

public static void showDialogForActivity(FragmentActivity activity) {
    FragmentManager fm = activity.getSupportFragmentManager();
    FragmentTransaction ft = fm.beginTransaction();
    Fragment prev = fm.findFragmentByTag(FRAGMENT_TAG);
    if (prev != null) {
        ft.remove(prev);
    }
    ft.addToBackStack(null);
    new ChangelogDialog().show(ft, FRAGMENT_TAG);
}
Also used : FragmentManager(android.support.v4.app.FragmentManager) FragmentTransaction(android.support.v4.app.FragmentTransaction) Fragment(android.support.v4.app.Fragment) DialogFragment(android.support.v4.app.DialogFragment)

Example 79 with FragmentManager

use of android.support.v4.app.FragmentManager in project Pokemap by omkarmoghe.

the class MainActivity method onCreate.

//region Lifecycle Methods
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    sharedPref = this.getSharedPreferences(getString(R.string.pref_file_key), Context.MODE_PRIVATE);
    themeId = sharedPref.getInt(getString(R.string.pref_theme_no_action_bar), R.style.AppTheme_NoActionBar);
    setTheme(themeId);
    setContentView(R.layout.activity_main);
    pref = new PokemapSharedPreferences(this);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    FragmentManager fragmentManager = getSupportFragmentManager();
    MapWrapperFragment mapWrapperFragment = (MapWrapperFragment) fragmentManager.findFragmentByTag(MAP_FRAGMENT_TAG);
    if (mapWrapperFragment == null) {
        mapWrapperFragment = MapWrapperFragment.newInstance();
    }
    fragmentManager.beginTransaction().replace(R.id.main_container, mapWrapperFragment, MAP_FRAGMENT_TAG).commit();
    if (pref.isServiceEnabled()) {
        startNotificationService();
    }
}
Also used : FragmentManager(android.support.v4.app.FragmentManager) MapWrapperFragment(com.omkarmoghe.pokemap.views.map.MapWrapperFragment) PokemapSharedPreferences(com.omkarmoghe.pokemap.controllers.app_preferences.PokemapSharedPreferences) Toolbar(android.support.v7.widget.Toolbar)

Example 80 with FragmentManager

use of android.support.v4.app.FragmentManager in project Timber by naman14.

the class NowPlayingActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_nowplaying);
    SharedPreferences prefs = getSharedPreferences(Constants.FRAGMENT_ID, Context.MODE_PRIVATE);
    String fragmentID = prefs.getString(Constants.NOWPLAYING_FRAGMENT_ID, Constants.TIMBER3);
    Fragment fragment = NavigationUtils.getFragmentForNowplayingID(fragmentID);
    FragmentManager fragmentManager = getSupportFragmentManager();
    fragmentManager.beginTransaction().replace(R.id.container, fragment).commit();
}
Also used : FragmentManager(android.support.v4.app.FragmentManager) SharedPreferences(android.content.SharedPreferences) Fragment(android.support.v4.app.Fragment)

Aggregations

FragmentManager (android.support.v4.app.FragmentManager)293 FragmentTransaction (android.support.v4.app.FragmentTransaction)106 Fragment (android.support.v4.app.Fragment)99 View (android.view.View)53 TextView (android.widget.TextView)35 Bundle (android.os.Bundle)31 OnClickListener (android.view.View.OnClickListener)24 DialogFragment (android.support.v4.app.DialogFragment)23 Intent (android.content.Intent)20 ImageView (android.widget.ImageView)16 ScrollView (android.widget.ScrollView)14 ListFragment (android.support.v4.app.ListFragment)12 Button (android.widget.Button)11 ArrayList (java.util.ArrayList)9 FrontPageFragment (ingage.ingage20.fragments.FrontPageFragment)8 SearchResultFragment (ingage.ingage20.fragments.SearchResultFragment)8 ViewPager (android.support.v4.view.ViewPager)7 ActionBar (android.support.v7.app.ActionBar)7 RecyclerView (android.support.v7.widget.RecyclerView)7 CategoriesPageFragment (ingage.ingage20.fragments.CategoriesPageFragment)7