Commit 4f00ecfd0c0be2b1e0f60688ff74bb5a98021228
1 parent
39a32f62
Exists in
master
and in
5 other branches
Android - Incluindo diálogo de about e opção temporária no menu para forçar o reload do terminal
Showing
3 changed files
with
54 additions
and
6 deletions
Show diff stats
@@ -0,0 +1,18 @@ | @@ -0,0 +1,18 @@ | ||
1 | +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
2 | + android:id="@+id/layout_root" | ||
3 | + android:orientation="horizontal" | ||
4 | + android:layout_width="fill_parent" | ||
5 | + android:layout_height="fill_parent" | ||
6 | + android:padding="10dp" | ||
7 | + > | ||
8 | + <ImageView android:id="@+id/image" | ||
9 | + android:layout_width="wrap_content" | ||
10 | + android:layout_height="fill_parent" | ||
11 | + android:layout_marginRight="10dp" | ||
12 | + /> | ||
13 | + <TextView android:id="@+id/text" | ||
14 | + android:layout_width="wrap_content" | ||
15 | + android:layout_height="fill_parent" | ||
16 | + android:textColor="#FFF" | ||
17 | + /> | ||
18 | +</LinearLayout> |
android/res/layout/menu.xml
@@ -11,4 +11,6 @@ | @@ -11,4 +11,6 @@ | ||
11 | android:title="Recarregar" /> | 11 | android:title="Recarregar" /> |
12 | <item android:id="@+id/settings" | 12 | <item android:id="@+id/settings" |
13 | android:title="Configurar" /> | 13 | android:title="Configurar" /> |
14 | + <item android:id="@+id/about" | ||
15 | + android:title="Versão" /> | ||
14 | </menu> | 16 | </menu> |
android/src/br/com/bb/pw3270/PW3270Activity.java
@@ -31,21 +31,22 @@ | @@ -31,21 +31,22 @@ | ||
31 | package br.com.bb.pw3270; | 31 | package br.com.bb.pw3270; |
32 | 32 | ||
33 | import android.app.Activity; | 33 | import android.app.Activity; |
34 | +import android.app.AlertDialog; | ||
34 | import android.os.Bundle; | 35 | import android.os.Bundle; |
35 | -// import android.preference.PreferenceManager; | ||
36 | import android.util.Log; | 36 | import android.util.Log; |
37 | import android.content.Intent; | 37 | import android.content.Intent; |
38 | -//import android.content.SharedPreferences; | ||
39 | import android.content.res.*; | 38 | import android.content.res.*; |
40 | -// import android.app.AlertDialog; | ||
41 | import android.webkit.WebView; | 39 | import android.webkit.WebView; |
42 | -// import android.webkit.WebViewClient; | ||
43 | -// import android.webkit.WebResourceResponse; | ||
44 | -// import android.webkit.WebChromeClient; | ||
45 | import android.app.ProgressDialog; | 40 | import android.app.ProgressDialog; |
46 | import android.view.Menu; | 41 | import android.view.Menu; |
47 | import android.view.MenuInflater; | 42 | import android.view.MenuInflater; |
48 | import android.view.MenuItem; | 43 | import android.view.MenuItem; |
44 | +import android.widget.ImageView; | ||
45 | +import android.widget.TextView; | ||
46 | +import android.content.Context; | ||
47 | +import android.view.LayoutInflater; | ||
48 | +import android.view.View; | ||
49 | +import android.view.ViewGroup; | ||
49 | 50 | ||
50 | // import java.io.InputStream; | 51 | // import java.io.InputStream; |
51 | 52 | ||
@@ -127,6 +128,10 @@ public class PW3270Activity extends Activity | @@ -127,6 +128,10 @@ public class PW3270Activity extends Activity | ||
127 | host.view.reload(); | 128 | host.view.reload(); |
128 | break; | 129 | break; |
129 | 130 | ||
131 | + case R.id.about: | ||
132 | + showAboutDialog(); | ||
133 | + break; | ||
134 | + | ||
130 | default: | 135 | default: |
131 | return super.onOptionsItemSelected(item); | 136 | return super.onOptionsItemSelected(item); |
132 | } | 137 | } |
@@ -134,6 +139,29 @@ public class PW3270Activity extends Activity | @@ -134,6 +139,29 @@ public class PW3270Activity extends Activity | ||
134 | 139 | ||
135 | } | 140 | } |
136 | 141 | ||
142 | + private void showAboutDialog() | ||
143 | + { | ||
144 | + AlertDialog.Builder builder; | ||
145 | + AlertDialog alertDialog; | ||
146 | + Context mContext = getApplicationContext(); | ||
147 | + | ||
148 | + LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(LAYOUT_INFLATER_SERVICE); | ||
149 | + | ||
150 | + View layout = inflater.inflate(R.layout.about, (ViewGroup) findViewById(R.id.layout_root)); | ||
151 | + | ||
152 | + TextView text = (TextView) layout.findViewById(R.id.text); | ||
153 | + text.setText(host.res.getString(R.string.app_name) + " Vrs " + host.getVersion() + "-" + host.getRevision()); | ||
154 | + | ||
155 | + ImageView image = (ImageView) layout.findViewById(R.id.image); | ||
156 | + image.setImageResource(R.drawable.ic_launcher); | ||
157 | + | ||
158 | + builder = new AlertDialog.Builder(this); | ||
159 | + builder.setView(layout); | ||
160 | + alertDialog = builder.create(); | ||
161 | + | ||
162 | + alertDialog.show(); | ||
163 | + } | ||
164 | + | ||
137 | @Override | 165 | @Override |
138 | public void onConfigurationChanged(Configuration newConfig) | 166 | public void onConfigurationChanged(Configuration newConfig) |
139 | { | 167 | { |