|
1 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
2 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
4 |
|
5 package org.mozilla.gecko.sync.setup.activities; |
|
6 |
|
7 import org.mozilla.gecko.R; |
|
8 import org.mozilla.gecko.sync.setup.Constants; |
|
9 |
|
10 import android.content.Context; |
|
11 import android.content.Intent; |
|
12 import android.os.Bundle; |
|
13 import android.view.View; |
|
14 import android.widget.TextView; |
|
15 |
|
16 public class SetupFailureActivity extends SyncActivity { |
|
17 private Context mContext; |
|
18 |
|
19 @Override |
|
20 public void onCreate(Bundle savedInstanceState) { |
|
21 super.onCreate(savedInstanceState); |
|
22 setContentView(R.layout.sync_setup_failure); |
|
23 mContext = this.getApplicationContext(); |
|
24 |
|
25 // Modify general error message if necessary. |
|
26 Bundle extras = this.getIntent().getExtras(); |
|
27 if (extras != null) { |
|
28 boolean isAccountError = extras.getBoolean(Constants.INTENT_EXTRA_IS_ACCOUNTERROR); |
|
29 if (isAccountError) { |
|
30 TextView subtitle1 = (TextView) findViewById(R.id.failure_subtitle1); |
|
31 // Display error for multiple accounts. |
|
32 // TODO: Remove when Bug 761206 is resolved (support for multiple versions). |
|
33 TextView subtitle2 = (TextView) findViewById(R.id.failure_subtitle2); |
|
34 subtitle1.setText(getString(R.string.sync_subtitle_failaccount)); |
|
35 subtitle2.setVisibility(View.VISIBLE); |
|
36 subtitle2.setText(getString(R.string.sync_subtitle_failmultiple)); |
|
37 } |
|
38 } |
|
39 } |
|
40 |
|
41 public void manualClickHandler(View target) { |
|
42 Intent intent = new Intent(mContext, AccountActivity.class); |
|
43 intent.setFlags(Constants.FLAG_ACTIVITY_REORDER_TO_FRONT_NO_ANIMATION); |
|
44 startActivity(intent); |
|
45 overridePendingTransition(0, 0); |
|
46 finish(); |
|
47 } |
|
48 |
|
49 public void tryAgainClickHandler(View target) { |
|
50 finish(); |
|
51 } |
|
52 |
|
53 public void cancelClickHandler(View target) { |
|
54 setResult(RESULT_CANCELED); |
|
55 moveTaskToBack(true); |
|
56 finish(); |
|
57 } |
|
58 } |