michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: package org.mozilla.gecko.sync.setup.activities; michael@0: michael@0: import org.mozilla.gecko.R; michael@0: import org.mozilla.gecko.sync.setup.Constants; michael@0: michael@0: import android.content.Context; michael@0: import android.content.Intent; michael@0: import android.os.Bundle; michael@0: import android.view.View; michael@0: import android.widget.TextView; michael@0: michael@0: public class SetupFailureActivity extends SyncActivity { michael@0: private Context mContext; michael@0: michael@0: @Override michael@0: public void onCreate(Bundle savedInstanceState) { michael@0: super.onCreate(savedInstanceState); michael@0: setContentView(R.layout.sync_setup_failure); michael@0: mContext = this.getApplicationContext(); michael@0: michael@0: // Modify general error message if necessary. michael@0: Bundle extras = this.getIntent().getExtras(); michael@0: if (extras != null) { michael@0: boolean isAccountError = extras.getBoolean(Constants.INTENT_EXTRA_IS_ACCOUNTERROR); michael@0: if (isAccountError) { michael@0: TextView subtitle1 = (TextView) findViewById(R.id.failure_subtitle1); michael@0: // Display error for multiple accounts. michael@0: // TODO: Remove when Bug 761206 is resolved (support for multiple versions). michael@0: TextView subtitle2 = (TextView) findViewById(R.id.failure_subtitle2); michael@0: subtitle1.setText(getString(R.string.sync_subtitle_failaccount)); michael@0: subtitle2.setVisibility(View.VISIBLE); michael@0: subtitle2.setText(getString(R.string.sync_subtitle_failmultiple)); michael@0: } michael@0: } michael@0: } michael@0: michael@0: public void manualClickHandler(View target) { michael@0: Intent intent = new Intent(mContext, AccountActivity.class); michael@0: intent.setFlags(Constants.FLAG_ACTIVITY_REORDER_TO_FRONT_NO_ANIMATION); michael@0: startActivity(intent); michael@0: overridePendingTransition(0, 0); michael@0: finish(); michael@0: } michael@0: michael@0: public void tryAgainClickHandler(View target) { michael@0: finish(); michael@0: } michael@0: michael@0: public void cancelClickHandler(View target) { michael@0: setResult(RESULT_CANCELED); michael@0: moveTaskToBack(true); michael@0: finish(); michael@0: } michael@0: }