|
|
|
|
/*
|
|
|
|
|
* Copyright © 2013 – 2016 Ricki Hirner (bitfire web engineering).
|
|
|
|
|
* All rights reserved. This program and the accompanying materials
|
|
|
|
|
* are made available under the terms of the GNU Public License v3.0
|
|
|
|
|
* which accompanies this distribution, and is available at
|
|
|
|
|
* http://www.gnu.org/licenses/gpl.html
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
package at.bitfire.davdroid.ui;
|
|
|
|
|
|
|
|
|
|
import android.accounts.Account;
|
|
|
|
|
import android.content.Intent;
|
|
|
|
|
import android.os.Bundle;
|
|
|
|
|
import android.support.v4.app.NavUtils;
|
|
|
|
|
import android.support.v7.app.AppCompatActivity;
|
|
|
|
|
import android.view.MenuItem;
|
|
|
|
|
|
|
|
|
|
import at.bitfire.davdroid.R;
|
|
|
|
|
|
|
|
|
|
public class AccountSettingsActivity extends AppCompatActivity {
|
|
|
|
|
public final static String EXTRA_ACCOUNT = "account";
|
|
|
|
|
|
|
|
|
|
private Account account;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
|
|
super.onCreate(savedInstanceState);
|
|
|
|
|
setContentView(R.layout.activity_account_settings);
|
|
|
|
|
|
|
|
|
|
account = getIntent().getParcelableExtra(EXTRA_ACCOUNT);
|
|
|
|
|
setTitle(getString(R.string.settings_title, account.name));
|
|
|
|
|
|
|
|
|
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
|
|
|
|
|
|
|
|
|
if (savedInstanceState == null)
|
|
|
|
|
getSupportFragmentManager().beginTransaction()
|
|
|
|
|
.add(R.id.fragment, AccountSettingsFragment.instantiate(this, AccountSettingsFragment.class.getName(), getIntent().getExtras()))
|
|
|
|
|
.commit();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean onOptionsItemSelected(MenuItem item) {
|
|
|
|
|
if (item.getItemId() == android.R.id.home) {
|
|
|
|
|
Intent intent = new Intent(this, AccountActivity.class);
|
|
|
|
|
intent.putExtra(AccountActivity.EXTRA_ACCOUNT, account);
|
|
|
|
|
NavUtils.navigateUpTo(this, intent);
|
|
|
|
|
return true;
|
|
|
|
|
} else
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|