2016-01-15 00:07:56 +00:00
|
|
|
|
/*
|
|
|
|
|
* 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.content.Intent;
|
2016-03-23 21:01:52 +00:00
|
|
|
|
import android.net.Uri;
|
2016-01-15 00:07:56 +00:00
|
|
|
|
import android.os.Bundle;
|
|
|
|
|
import android.support.design.widget.FloatingActionButton;
|
|
|
|
|
import android.support.design.widget.NavigationView;
|
|
|
|
|
import android.support.v4.view.GravityCompat;
|
|
|
|
|
import android.support.v4.widget.DrawerLayout;
|
|
|
|
|
import android.support.v7.app.ActionBarDrawerToggle;
|
|
|
|
|
import android.support.v7.app.AppCompatActivity;
|
|
|
|
|
import android.support.v7.widget.Toolbar;
|
|
|
|
|
import android.view.MenuItem;
|
|
|
|
|
import android.view.View;
|
|
|
|
|
|
|
|
|
|
import at.bitfire.davdroid.Constants;
|
|
|
|
|
import at.bitfire.davdroid.R;
|
2016-01-15 23:53:05 +00:00
|
|
|
|
import at.bitfire.davdroid.ui.setup.LoginActivity;
|
2016-01-15 00:07:56 +00:00
|
|
|
|
|
|
|
|
|
public class AccountsActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
|
|
super.onCreate(savedInstanceState);
|
|
|
|
|
setContentView(R.layout.activity_accounts);
|
|
|
|
|
|
|
|
|
|
Toolbar toolbar = (Toolbar)findViewById(R.id.toolbar);
|
|
|
|
|
setSupportActionBar(toolbar);
|
|
|
|
|
|
|
|
|
|
FloatingActionButton fab = (FloatingActionButton)findViewById(R.id.fab);
|
|
|
|
|
fab.setOnClickListener(new View.OnClickListener() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onClick(View view) {
|
2016-01-15 23:53:05 +00:00
|
|
|
|
startActivity(new Intent(AccountsActivity.this, LoginActivity.class));
|
2016-01-15 00:07:56 +00:00
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
DrawerLayout drawer = (DrawerLayout)findViewById(R.id.drawer_layout);
|
|
|
|
|
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
|
|
|
|
|
this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
|
|
|
|
|
drawer.setDrawerListener(toggle);
|
|
|
|
|
toggle.syncState();
|
|
|
|
|
|
|
|
|
|
NavigationView navigationView = (NavigationView)findViewById(R.id.nav_view);
|
|
|
|
|
navigationView.setNavigationItemSelectedListener(this);
|
2016-03-23 21:01:52 +00:00
|
|
|
|
navigationView.setItemIconTintList(null);
|
2016-01-15 00:07:56 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onBackPressed() {
|
|
|
|
|
DrawerLayout drawer = (DrawerLayout)findViewById(R.id.drawer_layout);
|
|
|
|
|
if (drawer.isDrawerOpen(GravityCompat.START))
|
|
|
|
|
drawer.closeDrawer(GravityCompat.START);
|
|
|
|
|
else
|
|
|
|
|
super.onBackPressed();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean onNavigationItemSelected(MenuItem item) {
|
|
|
|
|
switch (item.getItemId()) {
|
2016-03-24 12:23:28 +00:00
|
|
|
|
case R.id.nav_about:
|
|
|
|
|
startActivity(new Intent(this, AboutActivity.class));
|
|
|
|
|
break;
|
2016-03-23 21:01:52 +00:00
|
|
|
|
case R.id.nav_app_settings:
|
|
|
|
|
startActivity(new Intent(this, AppSettingsActivity.class));
|
|
|
|
|
break;
|
2016-01-15 00:07:56 +00:00
|
|
|
|
case R.id.nav_website:
|
|
|
|
|
startActivity(new Intent(Intent.ACTION_VIEW, Constants.webUri));
|
|
|
|
|
break;
|
2016-03-20 16:41:05 +00:00
|
|
|
|
case R.id.nav_faq:
|
2017-01-02 19:39:10 +00:00
|
|
|
|
startActivity(new Intent(Intent.ACTION_VIEW, Constants.faqUri));
|
2016-03-20 16:41:05 +00:00
|
|
|
|
break;
|
2017-01-02 19:39:10 +00:00
|
|
|
|
case R.id.nav_report_issue:
|
|
|
|
|
startActivity(new Intent(Intent.ACTION_VIEW, Constants.reportIssueUri));
|
2016-03-20 16:41:05 +00:00
|
|
|
|
break;
|
2017-01-02 19:39:10 +00:00
|
|
|
|
case R.id.nav_contact:
|
|
|
|
|
startActivity(new Intent(Intent.ACTION_VIEW, Constants.contactUri));
|
2016-01-15 00:07:56 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DrawerLayout drawer = (DrawerLayout)findViewById(R.id.drawer_layout);
|
|
|
|
|
drawer.closeDrawer(GravityCompat.START);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2016-03-18 18:02:27 +00:00
|
|
|
|
|
2016-01-15 00:07:56 +00:00
|
|
|
|
}
|