Mercurial > 510Connectbot
annotate src/com/five_ten_sg/connectbot/HelpActivity.java @ 384:b919cd3d6e2f
wizard and help present help pages in the same order
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Wed, 06 Aug 2014 11:34:32 -0700 |
parents | f7e09771172f |
children | b12705abba3e |
rev | line source |
---|---|
0 | 1 /* |
2 * ConnectBot: simple, powerful, open-source SSH client for Android | |
3 * Copyright 2007 Kenny Root, Jeffrey Sharkey | |
4 * | |
5 * Licensed under the Apache License, Version 2.0 (the "License"); | |
6 * you may not use this file except in compliance with the License. | |
7 * You may obtain a copy of the License at | |
8 * | |
9 * http://www.apache.org/licenses/LICENSE-2.0 | |
10 * | |
11 * Unless required by applicable law or agreed to in writing, software | |
12 * distributed under the License is distributed on an "AS IS" BASIS, | |
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
14 * See the License for the specific language governing permissions and | |
15 * limitations under the License. | |
16 */ | |
17 | |
18 package com.five_ten_sg.connectbot; | |
19 | |
20 import java.io.IOException; | |
21 | |
22 import android.app.Activity; | |
23 import android.content.Intent; | |
24 import android.content.pm.PackageManager.NameNotFoundException; | |
25 import android.os.Bundle; | |
26 import android.util.Log; | |
27 import android.view.View; | |
28 import android.view.View.OnClickListener; | |
29 import android.widget.Button; | |
30 import android.widget.LinearLayout; | |
31 import android.widget.TextView; | |
32 | |
33 /** | |
34 * @author Kenny Root | |
35 * | |
36 */ | |
37 public class HelpActivity extends Activity { | |
38 public final static String TAG = "ConnectBot.HelpActivity"; | |
39 | |
40 @Override | |
41 public void onCreate(Bundle icicle) { | |
42 super.onCreate(icicle); | |
43 setContentView(R.layout.act_help); | |
44 this.setTitle(String.format("%s: %s", | |
45 getResources().getText(R.string.app_name), | |
46 getResources().getText(R.string.title_help))); | |
47 LinearLayout content = (LinearLayout)this.findViewById(R.id.topics); | |
307 | 48 |
0 | 49 try { |
383
f7e09771172f
wizard and help present help pages in the same order
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
50 String[] topics = getResources().getStringArray(R.array.list_wizard_topics); |
384
b919cd3d6e2f
wizard and help present help pages in the same order
Carl Byington <carl@five-ten-sg.com>
parents:
383
diff
changeset
|
51 for (String topic : topics) { |
383
f7e09771172f
wizard and help present help pages in the same order
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
52 Button button = new Button(this); |
f7e09771172f
wizard and help present help pages in the same order
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
53 button.setText(topic); |
f7e09771172f
wizard and help present help pages in the same order
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
54 button.setOnClickListener(new OnClickListener() { |
f7e09771172f
wizard and help present help pages in the same order
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
55 public void onClick(View v) { |
f7e09771172f
wizard and help present help pages in the same order
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
56 Intent intent = new Intent(HelpActivity.this, HelpTopicActivity.class); |
f7e09771172f
wizard and help present help pages in the same order
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
57 intent.putExtra(Intent.EXTRA_TITLE, topic); |
f7e09771172f
wizard and help present help pages in the same order
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
58 HelpActivity.this.startActivity(intent); |
f7e09771172f
wizard and help present help pages in the same order
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
59 } |
f7e09771172f
wizard and help present help pages in the same order
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
60 }); |
f7e09771172f
wizard and help present help pages in the same order
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
61 content.addView(button); |
0 | 62 } |
63 } | |
64 catch (IOException e) { | |
65 // TODO Auto-generated catch block | |
66 Log.e(TAG, "couldn't get list of help assets", e); | |
67 } | |
68 } | |
69 } |