Permalink
Browse files

Add menu option to re-run the wizard. Fix the look of the custom sett…

…ings items to match the system default
  • Loading branch information...
1 parent 0bdd568 commit 2f312ae6ef20a67f14f0db8431ad806ba75575e4 @matburt committed Jan 9, 2012
View
@@ -1,66 +1,67 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" >
-
- <PreferenceCategory android:title="Synchronization" >
- <ListPreference
- android:defaultValue="webdav"
- android:entries="@array/fileSources"
- android:entryValues="@array/fileSourcesVals"
- android:key="syncSource"
- android:summary="Where to sync Org files from"
- android:title="Synchronization Mode" />
-
- <com.matburt.mobileorg.Settings.SynchronizerPreferences
- android:defaultValue="32"
- android:key="syncPref"
- android:title="Custom Preference" />
-
- <CheckBoxPreference
- android:key="doAutoSync"
- android:summary="@string/summary_do_auto_sync"
- android:title="@string/title_do_auto_sync" />
-
- <ListPreference
- android:dependency="doAutoSync"
- android:entries="@array/syncIntervals"
- android:entryValues="@array/syncIntervalsVals"
- android:key="autoSyncInterval"
- android:summary="@string/summary_auto_sync_interval"
- android:title="@string/title_auto_sync_interval" />
- </PreferenceCategory>
- <PreferenceCategory android:title="Viewing" >
- <CheckBoxPreference
- android:key="viewWrapLines"
- android:summary="@string/summary_view_wrap_lines"
- android:title="@string/title_view_wrap_lines" />
- <ListPreference
- android:defaultValue="0"
- android:entries="@array/viewRecursionLevels"
- android:entryValues="@array/viewRecursionLevelsVals"
- android:key="viewRecursionMax"
- android:summary="How many levels of child nodes to display on view"
- android:title="Recursion Level" />
- </PreferenceCategory>
- <PreferenceCategory android:title="Storage" >
- <ListPreference
- android:defaultValue="internal"
- android:entries="@array/storageModes"
- android:entryValues="@array/storageModesVals"
- android:key="storageMode"
- android:summary="Where to store the org files"
- android:title="Storage Mode" />
- </PreferenceCategory>
- <PreferenceCategory android:title="Other" >
- <PreferenceScreen
- android:key="Widget"
- android:summary="Preferences for a Widget"
- android:title="Widget Preferences" >
- </PreferenceScreen>
- <PreferenceScreen
- android:key="VersionDisp"
- android:summary="0.7.0"
- android:title="Version" >
- </PreferenceScreen>
- </PreferenceCategory>
-
+ <PreferenceCategory android:title="Synchronization" >
+ <com.matburt.mobileorg.Settings.WizardPreferences
+ android:key="wizardPref"
+ android:title="Wizard Preference"/>
+ <ListPreference
+ android:defaultValue="webdav"
+ android:entries="@array/fileSources"
+ android:entryValues="@array/fileSourcesVals"
+ android:key="syncSource"
+ android:summary="Where to sync Org files from"
+ android:title="Synchronization Mode" />
+
+ <com.matburt.mobileorg.Settings.SynchronizerPreferences
+ android:defaultValue="32"
+ android:key="syncPref"
+ android:title="Custom Preference" />
+
+ <CheckBoxPreference
+ android:key="doAutoSync"
+ android:summary="@string/summary_do_auto_sync"
+ android:title="@string/title_do_auto_sync" />
+
+ <ListPreference
+ android:dependency="doAutoSync"
+ android:entries="@array/syncIntervals"
+ android:entryValues="@array/syncIntervalsVals"
+ android:key="autoSyncInterval"
+ android:summary="@string/summary_auto_sync_interval"
+ android:title="@string/title_auto_sync_interval" />
+ </PreferenceCategory>
+ <PreferenceCategory android:title="Viewing" >
+ <CheckBoxPreference
+ android:key="viewWrapLines"
+ android:summary="@string/summary_view_wrap_lines"
+ android:title="@string/title_view_wrap_lines" />
+ <ListPreference
+ android:defaultValue="0"
+ android:entries="@array/viewRecursionLevels"
+ android:entryValues="@array/viewRecursionLevelsVals"
+ android:key="viewRecursionMax"
+ android:summary="How many levels of child nodes to display on view"
+ android:title="Recursion Level" />
+ </PreferenceCategory>
+ <PreferenceCategory android:title="Storage" >
+ <ListPreference
+ android:defaultValue="internal"
+ android:entries="@array/storageModes"
+ android:entryValues="@array/storageModesVals"
+ android:key="storageMode"
+ android:summary="Where to store the org files"
+ android:title="Storage Mode" />
+ </PreferenceCategory>
+ <PreferenceCategory android:title="Other" >
+ <PreferenceScreen
+ android:key="Widget"
+ android:summary="Preferences for a Widget"
+ android:title="Widget Preferences" >
+ </PreferenceScreen>
+ <PreferenceScreen
+ android:key="VersionDisp"
+ android:summary="0.7.0"
+ android:title="Version" >
+ </PreferenceScreen>
+ </PreferenceCategory>
</PreferenceScreen>
@@ -36,25 +36,13 @@ protected View onCreateView(ViewGroup parent){
LinearLayout.LayoutParams params1 = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.WRAP_CONTENT,
LinearLayout.LayoutParams.WRAP_CONTENT);
- params1.gravity = Gravity.LEFT;
params1.weight = 1.0f;
- LinearLayout.LayoutParams params2 = new LinearLayout.LayoutParams(
- 80,
- LinearLayout.LayoutParams.WRAP_CONTENT);
- params2.gravity = Gravity.RIGHT;
- LinearLayout.LayoutParams params3 = new LinearLayout.LayoutParams(
- 30,
- LinearLayout.LayoutParams.WRAP_CONTENT);
- params3.gravity = Gravity.CENTER;
- layout.setPadding(15, 10, 10, 10);
+ layout.setPadding(20, 10, 10, 10);
layout.setOrientation(LinearLayout.HORIZONTAL);
TextView view = new TextView(getContext());
- view.setText("Configure Synchronizer Settings...");
- view.setTextSize(18);
- view.setTypeface(Typeface.SANS_SERIF, Typeface.BOLD);
- view.setGravity(Gravity.LEFT);
+ view.setText("Configure Synchronizer Settings");
view.setLayoutParams(params1);
-
+ view.setTextAppearance(getContext(), android.R.style.TextAppearance_Large);
this.setOnPreferenceClickListener(new OnPreferenceClickListener() {
public boolean onPreferenceClick(Preference arg0) {
SharedPreferences appSettings = PreferenceManager.getDefaultSharedPreferences(getContext());
@@ -0,0 +1,61 @@
+package com.matburt.mobileorg.Settings;
+
+import android.content.Context;
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.graphics.Typeface;
+import android.preference.Preference;
+import android.preference.PreferenceManager;
+import android.util.AttributeSet;
+import android.view.Gravity;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+
+import com.matburt.mobileorg.Settings.WizardActivity;
+
+public class WizardPreferences extends Preference {
+ public WizardPreferences(Context context) {
+ super(context);
+ }
+
+ public WizardPreferences(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ public WizardPreferences(Context context, AttributeSet attrs, int defStyle) {
+ super(context, attrs, defStyle);
+ }
+
+ @Override
+ protected View onCreateView(ViewGroup parent){
+
+ LinearLayout layout = new LinearLayout(getContext());
+ LinearLayout.LayoutParams params1 = new LinearLayout.LayoutParams(
+ LinearLayout.LayoutParams.WRAP_CONTENT,
+ LinearLayout.LayoutParams.WRAP_CONTENT);
+ //params1.gravity = Gravity.LEFT;
+ params1.weight = 1.0f;
+ layout.setPadding(20, 10, 10, 10);
+ layout.setOrientation(LinearLayout.HORIZONTAL);
+ TextView view = new TextView(getContext());
+ view.setText("Re-run Setup Wizard");
+ // view.setTextSize(18);
+ // view.setTypeface(Typeface.SANS_SERIF, Typeface.BOLD);
+ view.setTextAppearance(getContext(), android.R.style.TextAppearance_Large);
+ //view.setGravity(Gravity.LEFT);
+ view.setLayoutParams(params1);
+
+ this.setOnPreferenceClickListener(new OnPreferenceClickListener() {
+ public boolean onPreferenceClick(Preference arg0) {
+ getContext().startActivity(new Intent(getContext(), WizardActivity.class));
+ return true;
+ }
+ });
+
+ layout.addView(view);
+ layout.setId(android.R.id.widget_frame);
+ return layout;
+ }
+}

0 comments on commit 2f312ae

Please sign in to comment.