Search in sources :

Example 1 with BackupListFragment

use of com.owncloud.android.ui.fragment.contactsbackup.BackupListFragment in project android by nextcloud.

the class ContactsPreferenceActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.contacts_preference);
    // setup toolbar
    setupToolbar();
    // setup drawer
    // setupDrawer(R.id.nav_contacts); // TODO needed?
    // show sidebar?
    boolean showSidebar = getIntent().getBooleanExtra(EXTRA_SHOW_SIDEBAR, true);
    if (!showSidebar) {
        setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
        if (getSupportActionBar() != null) {
            getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        }
        if (mDrawerToggle != null) {
            mDrawerToggle.setDrawerIndicatorEnabled(false);
        }
    }
    Intent intent = getIntent();
    if (savedInstanceState == null) {
        FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
        if (intent == null || intent.getParcelableExtra(EXTRA_FILE) == null || intent.getParcelableExtra(EXTRA_USER) == null) {
            BackupFragment fragment = BackupFragment.create(showSidebar);
            transaction.add(R.id.frame_container, fragment);
        } else {
            OCFile file = intent.getParcelableExtra(EXTRA_FILE);
            User user = intent.getParcelableExtra(EXTRA_USER);
            BackupListFragment contactListFragment = BackupListFragment.newInstance(file, user);
            transaction.add(R.id.frame_container, contactListFragment);
        }
        transaction.commit();
    }
}
Also used : OCFile(com.owncloud.android.datamodel.OCFile) FragmentTransaction(androidx.fragment.app.FragmentTransaction) User(com.nextcloud.client.account.User) BackupFragment(com.owncloud.android.ui.fragment.contactsbackup.BackupFragment) Intent(android.content.Intent) BackupListFragment(com.owncloud.android.ui.fragment.contactsbackup.BackupListFragment)

Aggregations

Intent (android.content.Intent)1 FragmentTransaction (androidx.fragment.app.FragmentTransaction)1 User (com.nextcloud.client.account.User)1 OCFile (com.owncloud.android.datamodel.OCFile)1 BackupFragment (com.owncloud.android.ui.fragment.contactsbackup.BackupFragment)1 BackupListFragment (com.owncloud.android.ui.fragment.contactsbackup.BackupListFragment)1