diff --git a/app/app.iml b/app/app.iml index a0f9ba9..219a04b 100644 --- a/app/app.iml +++ b/app/app.iml @@ -61,7 +61,6 @@ - diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index cf1aba4..a2d3054 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -28,6 +28,11 @@ android:name=".EntriesActivity" android:label="@string/title_activity_entries" > + + diff --git a/app/src/main/java/info/nerull7/mysqlbrowser/MainActivity.java b/app/src/main/java/info/nerull7/mysqlbrowser/MainActivity.java index 402375b..8f74811 100644 --- a/app/src/main/java/info/nerull7/mysqlbrowser/MainActivity.java +++ b/app/src/main/java/info/nerull7/mysqlbrowser/MainActivity.java @@ -1,6 +1,7 @@ package info.nerull7.mysqlbrowser; import android.app.Activity; +import android.content.Intent; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; @@ -35,6 +36,8 @@ public class MainActivity extends Activity { //TODO Handling menu int id = item.getItemId(); if (id == R.id.action_settings) { + Intent intent = new Intent(this, SettingsActivity.class); + startActivity(intent); return true; } return super.onOptionsItemSelected(item); diff --git a/app/src/main/java/info/nerull7/mysqlbrowser/SettingsActivity.java b/app/src/main/java/info/nerull7/mysqlbrowser/SettingsActivity.java new file mode 100644 index 0000000..eeaa4c1 --- /dev/null +++ b/app/src/main/java/info/nerull7/mysqlbrowser/SettingsActivity.java @@ -0,0 +1,24 @@ +package info.nerull7.mysqlbrowser; + +import android.app.FragmentManager; +import android.app.FragmentTransaction; +import android.os.Bundle; +import android.preference.PreferenceActivity; + +/** + * Created by nerull7 on 18.07.14. + */ +public class SettingsActivity extends PreferenceActivity { + + @Override + public void onCreate(Bundle savedInstanceState){ + super.onCreate(savedInstanceState); + + if (savedInstanceState == null) { + getFragmentManager().beginTransaction() + .add(android.R.id.content, new SettingsFragment()) + .commit(); + } + } + +} diff --git a/app/src/main/java/info/nerull7/mysqlbrowser/SettingsFragment.java b/app/src/main/java/info/nerull7/mysqlbrowser/SettingsFragment.java new file mode 100644 index 0000000..8112398 --- /dev/null +++ b/app/src/main/java/info/nerull7/mysqlbrowser/SettingsFragment.java @@ -0,0 +1,36 @@ +package info.nerull7.mysqlbrowser; + +import android.os.Bundle; +import android.preference.Preference; +import android.preference.PreferenceFragment; +import android.preference.PreferenceScreen; + +/** + * Created by nerull7 on 18.07.14. + */ +public class SettingsFragment extends PreferenceFragment{ + public final static String ENTRIES_PAGE_LIMIT = "entries_limit"; + + Preference mEntriesLimit; + + @Override + public void onCreate(Bundle savedInstanceState){ + super.onCreate(savedInstanceState); + loadPrefs(); + } + + private void loadPrefs(){ + addPreferencesFromResource(R.xml.settings); + + mEntriesLimit = findPreference(ENTRIES_PAGE_LIMIT); + } + + @Override + public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) { + if(preference == mEntriesLimit){ + new NumberPickerDialog + } + + return super.onPreferenceTreeClick(preferenceScreen, preference); + } +} diff --git a/app/src/main/res/drawable-hdpi/ic_action_settings.png b/app/src/main/res/drawable-hdpi/ic_action_settings.png new file mode 100644 index 0000000..6668635 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_action_settings.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_action_settings.png b/app/src/main/res/drawable-mdpi/ic_action_settings.png new file mode 100644 index 0000000..356f419 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_action_settings.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_action_settings.png b/app/src/main/res/drawable-xhdpi/ic_action_settings.png new file mode 100644 index 0000000..42165b3 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_action_settings.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_action_settings.png b/app/src/main/res/drawable-xxhdpi/ic_action_settings.png new file mode 100644 index 0000000..38ebea9 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_action_settings.png differ diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml new file mode 100644 index 0000000..0601f1d --- /dev/null +++ b/app/src/main/res/layout/activity_settings.xml @@ -0,0 +1,7 @@ + diff --git a/app/src/main/res/layout/fragment_settings.xml b/app/src/main/res/layout/fragment_settings.xml new file mode 100644 index 0000000..c5d327e --- /dev/null +++ b/app/src/main/res/layout/fragment_settings.xml @@ -0,0 +1,11 @@ + + + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 3d56b95..de5fd21 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -15,5 +15,9 @@ Error TableActivity EntriesActivity + General + Entries per page limit + 20 FIXME entries per page + Settings diff --git a/app/src/main/res/xml/settings.xml b/app/src/main/res/xml/settings.xml new file mode 100644 index 0000000..d25f802 --- /dev/null +++ b/app/src/main/res/xml/settings.xml @@ -0,0 +1,13 @@ + + + + + + + + \ No newline at end of file