/*
 * Copyright (C) 2012 Brian Muramatsu
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.btmura.android.reddit.accounts;

import android.app.FragmentTransaction;
import android.os.Bundle;

import com.btmura.android.reddit.R;
import com.btmura.android.reddit.fragment.AddAccountFragment;
import com.btmura.android.reddit.fragment.AddAccountFragment.OnAccountAddedListener;

public class AccountAuthenticatorActivity extends android.accounts.AccountAuthenticatorActivity
        implements OnAccountAddedListener {

    public static final String TAG = "AccountAuthenticatorActivity";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.account_authenticator);

        FragmentTransaction ft = getFragmentManager().beginTransaction();
        ft.replace(R.id.single_container, AddAccountFragment.newInstance());
        ft.commit();
    }

    public void onAccountAdded(Bundle result) {
        setAccountAuthenticatorResult(result);
        setResult(RESULT_OK);
        finish();
    }

    public void onAccountCancelled() {
        finish();
    }
}

@@ -1277,16 +1277,62 @@
 ator);%0A%0A
+        if (savedInstanceState == null) %7B%0A    
         
@@ -1405,16 +1405,20 @@
         
+  
+  
 ft.repla
@@ -1486,16 +1486,20 @@
         
+    
 ft.commi
@@ -1499,24 +1499,34 @@
 t.commit();%0A
+        %7D%0A
     %7D%0A%0A    p

Fix config change causing dialog state to be lost