Simple Notepad Application for Android OS
Revision | 7e4c2c8e759f7e44224d4bc3d5dece5bfc9443e9 (tree) |
---|---|
Time | 2012-09-04 14:47:54 |
Author | Masahiko, SAWAI <say@user...> |
Commiter | Masahiko, SAWAI |
Dialog 用のテーマを作成
* Theme.Notepad.Dark.Dialog
* Theme.Notepad.Light.Dialog
@@ -20,10 +20,6 @@ Title, Content, Focus | ||
20 | 20 | ############################# |
21 | 21 | !! notepad-app |
22 | 22 | |
23 | -* Dialog 用のテーマを作成 | |
24 | -** Theme.Notepad.Dark.Dialog | |
25 | -** Theme.Notepad.Light.Dialog | |
26 | - | |
27 | 23 | * テンプレートの書式を変更 |
28 | 24 | ** '#{date}' '#{time}' など? |
29 | 25 |
@@ -43,10 +39,6 @@ Title, Content, Focus | ||
43 | 39 | ############################# |
44 | 40 | !! notepad-app-level-11 |
45 | 41 | |
46 | -* Dialog 用のテーマを作成 | |
47 | -** Theme.Notepad.Dark.Dialog | |
48 | -** Theme.Notepad.Light.Dialog | |
49 | - | |
50 | 42 | * 各種 ListView の layout_margin を修正 |
51 | 43 | ** layout_margin を減らしてリスト項目の layout_margin で調整する |
52 | 44 | ** ListView 用のスタイルを用意 |
@@ -106,6 +98,10 @@ Title, Content, Focus | ||
106 | 98 | |
107 | 99 | !! notepad-app |
108 | 100 | |
101 | +#* Dialog 用のテーマを作成 | |
102 | +#** Theme.Notepad.Dark.Dialog | |
103 | +#** Theme.Notepad.Light.Dialog | |
104 | + | |
109 | 105 | #* AddNewNoteActivity をリファクタリング |
110 | 106 | #** NoteUtils のメソッドを呼ぶように修正 |
111 | 107 | #** 不要になったメソッドの削除 |
@@ -116,6 +112,7 @@ Title, Content, Focus | ||
116 | 112 | # -> NoteTemplatePickerDialog を実装 |
117 | 113 | |
118 | 114 | |
115 | +############################# | |
119 | 116 | !! notepad-app-level-11 |
120 | 117 | |
121 | 118 | #* 新規ノート作成時にテンプレートを選ぶ処理を変更 |
@@ -135,6 +132,7 @@ Title, Content, Focus | ||
135 | 132 | #* NoteListItemViewBinder を NoteCursorAdapter に変更 |
136 | 133 | |
137 | 134 | |
135 | +############################# | |
138 | 136 | !! notepad-common |
139 | 137 | |
140 | 138 | #* 定数定義用インターフェースを notepad-comon に移動 |
@@ -1,6 +1,7 @@ | ||
1 | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | 2 | <FrameLayout |
3 | 3 | xmlns:android="http://schemas.android.com/apk/res/android" |
4 | + style="@style/body" | |
4 | 5 | android:layout_width="fill_parent" |
5 | 6 | android:layout_height="fill_parent" |
6 | 7 | > |
@@ -47,23 +47,36 @@ | ||
47 | 47 | <item name="ic_unlock">@drawable/ic_unlock_light</item> |
48 | 48 | </style> |
49 | 49 | |
50 | - <!-- Dark Theme Dialog --> | |
51 | - <!-- | |
52 | - <style name="Theme.Notepad.Dark.Dialog" parent="@style/Theme.Notepad.Dark" > | |
53 | - <item name="android:windowFrame">@drawable/dialog_window_frame</item> | |
50 | + <!-- Dialog Theme --> | |
51 | + <style name="DialogWindowTitle" > | |
52 | + <item name="android:maxLines">1</item> | |
53 | + <item name="android:scrollHorizontally">true</item> | |
54 | + <item name="android:background">@drawable/dialog_title_bg</item> | |
55 | + <item name="android:gravity">center_vertical</item> | |
56 | + <item name="android:textAppearance">?android:textAppearance</item> | |
57 | + <item name="android:textSize">20sp</item> | |
58 | + <item name="android:textColor">#FF00C99B</item> | |
59 | + <item name="android:textStyle">bold</item> | |
60 | + <item name="android:paddingLeft">8dip</item> | |
61 | + </style> | |
62 | + | |
63 | + <!-- Dark Dialog --> | |
64 | + <style name="Theme.Notepad.Dark.Dialog" > | |
65 | + <item name="android:windowFrame">@null</item> | |
66 | + <item name="android:windowBackground">@drawable/dialog_bg_holo_dark</item> | |
67 | + <item name="android:windowIsFloating">true</item> | |
54 | 68 | <item name="android:windowContentOverlay">@null</item> |
55 | 69 | <item name="android:windowNoTitle">false</item> |
56 | - <item name="android:windowIsFloating">true</item> | |
70 | + <item name="android:windowTitleStyle">@style/DialogWindowTitle</item> | |
57 | 71 | </style> |
58 | - --> | |
59 | 72 | |
60 | - <!-- Light Theme Dialog --> | |
61 | - <!-- | |
62 | - <style name="Theme.Notepad.Light.Dialog" parent="@style/Theme.Notepad.Light" > | |
63 | - <item name="android:windowFrame">@drawable/dialog_window_frame</item> | |
73 | + <!-- Light Dialog --> | |
74 | + <style name="Theme.Notepad.Light.Dialog" > | |
75 | + <item name="android:windowFrame">@null</item> | |
76 | + <item name="android:windowBackground">@drawable/dialog_bg_holo_light</item> | |
77 | + <item name="android:windowIsFloating">true</item> | |
64 | 78 | <item name="android:windowContentOverlay">@null</item> |
65 | 79 | <item name="android:windowNoTitle">false</item> |
66 | - <item name="android:windowIsFloating">true</item> | |
80 | + <item name="android:windowTitleStyle">@style/DialogWindowTitle</item> | |
67 | 81 | </style> |
68 | - --> | |
69 | 82 | </resources> |
@@ -64,6 +64,30 @@ public class NotepadPreferenceUtils | ||
64 | 64 | return themeId; |
65 | 65 | } |
66 | 66 | |
67 | + public static int getDialogTheme(Context context) | |
68 | + { | |
69 | + int themeId = R.style.Theme_Notepad_Dark_Dialog; | |
70 | + | |
71 | + String preferenceName = context.getPackageName() + "_preferences"; | |
72 | + SharedPreferences sharedPreferences = context.getSharedPreferences(preferenceName, Context.MODE_PRIVATE); | |
73 | + String key = context.getString(R.string.notepad_theme_key); | |
74 | + String defaultValue = context.getString(R.string.notepad_theme_default_value); | |
75 | + String themeValue = sharedPreferences.getString(key, defaultValue); | |
76 | + | |
77 | + final String themeDark = context.getString(R.string.notepad_theme_dark_value); | |
78 | + final String themeLight = context.getString(R.string.notepad_theme_light_value); | |
79 | + if (themeDark.equals(themeValue)) | |
80 | + { | |
81 | + themeId = R.style.Theme_Notepad_Dark_Dialog; | |
82 | + } | |
83 | + else if (themeLight.equals(themeValue)) | |
84 | + { | |
85 | + themeId = R.style.Theme_Notepad_Light_Dialog; | |
86 | + } | |
87 | + | |
88 | + return themeId; | |
89 | + } | |
90 | + | |
67 | 91 | public static boolean getActionBarAutoHide(Context context) |
68 | 92 | { |
69 | 93 | boolean actionBarAutoHide; |
@@ -34,6 +34,7 @@ import android.widget.AdapterView.OnItemClickListener; | ||
34 | 34 | import android.widget.ListView; |
35 | 35 | import android.widget.SimpleCursorAdapter; |
36 | 36 | import org.routine_work.notepad.R; |
37 | +import org.routine_work.notepad.prefs.NotepadPreferenceUtils; | |
37 | 38 | import org.routine_work.notepad.provider.NoteStore; |
38 | 39 | import org.routine_work.notepad.utils.NoteTemplateConstants; |
39 | 40 | import org.routine_work.notepad.utils.NoteUtils; |
@@ -57,7 +58,8 @@ public class NoteTemplatePickerDialog extends Dialog | ||
57 | 58 | |
58 | 59 | public NoteTemplatePickerDialog(Context context) |
59 | 60 | { |
60 | - super(context); | |
61 | + super(context, NotepadPreferenceUtils.getDialogTheme(context)); | |
62 | +// super(context); | |
61 | 63 | } |
62 | 64 | |
63 | 65 | public OnItemClickListener getOnItemClickListener() |