diff src/com/five_ten_sg/connectbot/HelpActivity.java @ 383:f7e09771172f

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:02 -0700
parents 071eccdff8ea
children b919cd3d6e2f
line wrap: on
line diff
--- a/src/com/five_ten_sg/connectbot/HelpActivity.java	Wed Aug 06 10:43:02 2014 -0700
+++ b/src/com/five_ten_sg/connectbot/HelpActivity.java	Wed Aug 06 11:34:02 2014 -0700
@@ -22,7 +22,6 @@
 import android.app.Activity;
 import android.content.Intent;
 import android.content.pm.PackageManager.NameNotFoundException;
-import android.content.res.AssetManager;
 import android.os.Bundle;
 import android.util.Log;
 import android.view.View;
@@ -38,9 +37,6 @@
 public class HelpActivity extends Activity {
     public final static String TAG = "ConnectBot.HelpActivity";
 
-    public final static String HELPDIR = "help";
-    public final static String SUFFIX = ".html";
-
     @Override
     public void onCreate(Bundle icicle) {
         super.onCreate(icicle);
@@ -48,24 +44,21 @@
         this.setTitle(String.format("%s: %s",
                                     getResources().getText(R.string.app_name),
                                     getResources().getText(R.string.title_help)));
-        AssetManager am = this.getAssets();
         LinearLayout content = (LinearLayout)this.findViewById(R.id.topics);
 
         try {
-            for (String name : am.list(HELPDIR)) {
-                if (name.endsWith(SUFFIX)) {
-                    Button button = new Button(this);
-                    final String topic = name.substring(0, name.length() - SUFFIX.length());
-                    button.setText(topic);
-                    button.setOnClickListener(new OnClickListener() {
-                        public void onClick(View v) {
-                            Intent intent = new Intent(HelpActivity.this, HelpTopicActivity.class);
-                            intent.putExtra(Intent.EXTRA_TITLE, topic);
-                            HelpActivity.this.startActivity(intent);
-                        }
-                    });
-                    content.addView(button);
-                }
+            String[] topics = getResources().getStringArray(R.array.list_wizard_topics);
+            for (String topic : topics)) {
+                Button button = new Button(this);
+                button.setText(topic);
+                button.setOnClickListener(new OnClickListener() {
+                    public void onClick(View v) {
+                        Intent intent = new Intent(HelpActivity.this, HelpTopicActivity.class);
+                        intent.putExtra(Intent.EXTRA_TITLE, topic);
+                        HelpActivity.this.startActivity(intent);
+                    }
+                });
+                content.addView(button);
             }
         }
         catch (IOException e) {