1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/mobile/android/base/sync/setup/activities/SetupFailureActivity.java Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,58 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 +package org.mozilla.gecko.sync.setup.activities; 1.9 + 1.10 +import org.mozilla.gecko.R; 1.11 +import org.mozilla.gecko.sync.setup.Constants; 1.12 + 1.13 +import android.content.Context; 1.14 +import android.content.Intent; 1.15 +import android.os.Bundle; 1.16 +import android.view.View; 1.17 +import android.widget.TextView; 1.18 + 1.19 +public class SetupFailureActivity extends SyncActivity { 1.20 + private Context mContext; 1.21 + 1.22 + @Override 1.23 + public void onCreate(Bundle savedInstanceState) { 1.24 + super.onCreate(savedInstanceState); 1.25 + setContentView(R.layout.sync_setup_failure); 1.26 + mContext = this.getApplicationContext(); 1.27 + 1.28 + // Modify general error message if necessary. 1.29 + Bundle extras = this.getIntent().getExtras(); 1.30 + if (extras != null) { 1.31 + boolean isAccountError = extras.getBoolean(Constants.INTENT_EXTRA_IS_ACCOUNTERROR); 1.32 + if (isAccountError) { 1.33 + TextView subtitle1 = (TextView) findViewById(R.id.failure_subtitle1); 1.34 + // Display error for multiple accounts. 1.35 + // TODO: Remove when Bug 761206 is resolved (support for multiple versions). 1.36 + TextView subtitle2 = (TextView) findViewById(R.id.failure_subtitle2); 1.37 + subtitle1.setText(getString(R.string.sync_subtitle_failaccount)); 1.38 + subtitle2.setVisibility(View.VISIBLE); 1.39 + subtitle2.setText(getString(R.string.sync_subtitle_failmultiple)); 1.40 + } 1.41 + } 1.42 + } 1.43 + 1.44 + public void manualClickHandler(View target) { 1.45 + Intent intent = new Intent(mContext, AccountActivity.class); 1.46 + intent.setFlags(Constants.FLAG_ACTIVITY_REORDER_TO_FRONT_NO_ANIMATION); 1.47 + startActivity(intent); 1.48 + overridePendingTransition(0, 0); 1.49 + finish(); 1.50 + } 1.51 + 1.52 + public void tryAgainClickHandler(View target) { 1.53 + finish(); 1.54 + } 1.55 + 1.56 + public void cancelClickHandler(View target) { 1.57 + setResult(RESULT_CANCELED); 1.58 + moveTaskToBack(true); 1.59 + finish(); 1.60 + } 1.61 +}