From 06af5ba55a167f0acec524cdf442c13cfd0407c1 Mon Sep 17 00:00:00 2001 From: perry.werneck@gmail.com Date: Tue, 7 Aug 2012 19:56:10 +0000 Subject: [PATCH] Android: Iniciando implementação do diálogo de configuração --- android/AndroidManifest.xml | 6 ++++-- android/res/xml/preferences.xml | 36 ++++++++++++++++++++++++++++++++++++ android/src/br/com/bb/pw3270/PW3270Activity.java | 7 +++---- android/src/br/com/bb/pw3270/SettingsActivity.java | 35 +++++++++++++++++++++++++++++++++++ 4 files changed, 78 insertions(+), 6 deletions(-) create mode 100644 android/res/xml/preferences.xml create mode 100644 android/src/br/com/bb/pw3270/SettingsActivity.java diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml index 772d49a..e6c2620 100644 --- a/android/AndroidManifest.xml +++ b/android/AndroidManifest.xml @@ -19,6 +19,8 @@ - + - \ No newline at end of file + + + diff --git a/android/res/xml/preferences.xml b/android/res/xml/preferences.xml new file mode 100644 index 0000000..ad7ab08 --- /dev/null +++ b/android/res/xml/preferences.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + diff --git a/android/src/br/com/bb/pw3270/PW3270Activity.java b/android/src/br/com/bb/pw3270/PW3270Activity.java index 098a36b..257d64c 100644 --- a/android/src/br/com/bb/pw3270/PW3270Activity.java +++ b/android/src/br/com/bb/pw3270/PW3270Activity.java @@ -2,11 +2,8 @@ package br.com.bb.pw3270; import android.app.Activity; import android.os.Bundle; -// import android.widget.TextView; -// import android.widget.Button; -// import android.widget.EditText; import android.util.Log; -// import android.view.View; +import android.content.Intent; import android.content.SharedPreferences; import android.content.res.*; import android.app.AlertDialog; @@ -214,6 +211,8 @@ public class PW3270Activity extends Activity break; case R.id.settings: + Intent myIntent = new Intent(view.getContext(), SettingsActivity.class); + startActivityForResult(myIntent, 0); break; default: diff --git a/android/src/br/com/bb/pw3270/SettingsActivity.java b/android/src/br/com/bb/pw3270/SettingsActivity.java new file mode 100644 index 0000000..e405afb --- /dev/null +++ b/android/src/br/com/bb/pw3270/SettingsActivity.java @@ -0,0 +1,35 @@ +package br.com.bb.pw3270; + +import android.os.Bundle; +import android.preference.PreferenceFragment; +import android.app.Activity; + +public class SettingsActivity extends Activity +{ + public static class SettingsFragment extends PreferenceFragment + { + @Override + public void onCreate(Bundle savedInstanceState) + { + super.onCreate(savedInstanceState); + + // Load the preferences from an XML resource + addPreferencesFromResource(R.xml.preferences); + } + } + + @Override + protected void onCreate(Bundle savedInstanceState) + { + super.onCreate(savedInstanceState); + + // Display the fragment as the main content. + getFragmentManager().beginTransaction() + .replace(android.R.id.content, new SettingsFragment()) + .commit(); + } + +} + + + -- libgit2 0.21.2