at.bitfire.davdroid.syncadapter.AddAccountActivity.java Source code

Java tutorial

Introduction

Here is the source code for at.bitfire.davdroid.syncadapter.AddAccountActivity.java

Source

/*******************************************************************************
 * Copyright (c) 2014 Richard 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
 * 
 * Contributors:
 *     Richard Hirner (bitfire web engineering) - initial API and implementation
 ******************************************************************************/
package at.bitfire.davdroid.syncadapter;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import at.bitfire.davdroid.Constants;
import at.bitfire.davdroid.R;

public class AddAccountActivity extends FragmentActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.add_account);

        if (savedInstanceState == null) { // first call
            getSupportFragmentManager().beginTransaction()
                    .add(R.id.fragment_container, new EnterCredentialsFragment(), "enter_credentials").commit();
        }
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        MenuInflater inflater = getMenuInflater();
        inflater.inflate(R.menu.add_account, menu);
        return true;
    }

    public boolean showHelp(MenuItem item) {
        startActivityForResult(new Intent(Intent.ACTION_VIEW, Uri.parse(Constants.WEB_URL_HELP)), 0);
        return true;
    }

}