Commit 0d82ce7d6a137ae15b7db05f5ae35a1f7e900f65
1 parent
6102c27f
- webView delay 3 -> 1sec
- display BookSearchResult at DialogAddBook
Showing
5 changed files
with
48 additions
and
38 deletions
app/src/main/java/net/devfac/userstory/DialogAddBook.java
... | ... | @@ -3,19 +3,41 @@ package net.devfac.userstory; |
3 | 3 | import android.app.Dialog; |
4 | 4 | import android.content.Context; |
5 | 5 | import android.view.WindowManager; |
6 | +import android.widget.TextView; | |
6 | 7 | |
7 | 8 | /** |
8 | 9 | * Created by Onether on 15. 11. 7.. |
9 | 10 | */ |
10 | 11 | public class DialogAddBook extends Dialog { |
12 | + private TextView mTextBookAddTitle; | |
13 | + private TextView mTextBookAddDetails; | |
14 | + | |
11 | 15 | public DialogAddBook(Context context) { |
12 | 16 | super(context); |
17 | + windowDimBehind(); | |
18 | + | |
19 | + setContentView(R.layout.dialog_add_book); | |
20 | + } | |
21 | + | |
22 | + public DialogAddBook(Context context, FragmentAddBook.BookSearchResult selectedBook) { | |
23 | + super(context); | |
24 | + windowDimBehind(); | |
25 | + | |
26 | + setContentView(R.layout.dialog_add_book); | |
27 | + | |
28 | + mTextBookAddTitle = (TextView)findViewById(R.id.text_book_add_title); | |
29 | + mTextBookAddDetails = (TextView)findViewById(R.id.text_book_add_details); | |
30 | + | |
31 | + mTextBookAddTitle.setText(selectedBook.title); | |
32 | + String details = selectedBook.desc + "|" + selectedBook.genre.replace(">", ">"); | |
33 | + mTextBookAddDetails.setText(details); | |
34 | + } | |
13 | 35 | |
36 | + private void windowDimBehind(){ | |
14 | 37 | WindowManager.LayoutParams lpWindow = new WindowManager.LayoutParams(); |
15 | 38 | lpWindow.flags = WindowManager.LayoutParams.FLAG_DIM_BEHIND; |
16 | 39 | lpWindow.dimAmount = 0.8f; |
17 | 40 | getWindow().setAttributes(lpWindow); |
18 | - | |
19 | - setContentView(R.layout.dialog_add_book); | |
20 | 41 | } |
42 | + | |
21 | 43 | } | ... | ... |
app/src/main/java/net/devfac/userstory/FSM/StateContext.java
... | ... | @@ -223,20 +223,6 @@ public class StateContext { |
223 | 223 | String submit = "javascript:go_find();"; |
224 | 224 | runJavaScript(view, submit); |
225 | 225 | |
226 | -// view.loadUrl("javascript:$(document).ajaxStart(go_find);"); | |
227 | -// view.loadUrl("javascript:$(document).ajaxComplete(function (event, request, settings) { " + | |
228 | -//// "ajaxHandler.ajaxDone(); " + // Event called when an AJAX call ends | |
229 | -// "window.UserstoryScripter.parseBookSearchResult" | |
230 | -// + "('<html>'+document.getElementsByTagName('html')[0].innerHTML+'</html>');"+ | |
231 | -// "});"); | |
232 | - | |
233 | -// view.loadUrl("javascript:$(document).ajaxStart(go_find(){ " + | |
234 | -// "ajaxHandler.ajaxBegin(); " + // Event called when an AJAX call begins | |
235 | -// "});"); | |
236 | -// view.loadUrl("javascript:$(document).ajaxComplete(function (event, request, settings) { " + | |
237 | -// "ajaxHandler.ajaxDone(); " + // Event called when an AJAX call ends | |
238 | -// "});"); | |
239 | - | |
240 | 226 | final WebView finalWebView = view; |
241 | 227 | |
242 | 228 | Handler mHandler = new Handler(); |
... | ... | @@ -245,14 +231,7 @@ public class StateContext { |
245 | 231 | public void run() { |
246 | 232 | getDelayedWebViewContents(); |
247 | 233 | } |
248 | - }, 3000); | |
249 | - | |
250 | - | |
251 | - | |
252 | -// view.loadUrl("javascript:window.UserstoryScripter.parseBookSearchResult" | |
253 | -// + "('<html>'+document.getElementsByTagName('html')[0].innerHTML+'</html>');"); | |
254 | - | |
255 | -// view.loadUrl("javascript:window.UserstoryScripter.showHTML" + "('<html>'+document.getElementsByTagName('html')[0].innerHTML+'</html>');"); | |
234 | + }, 1000); | |
256 | 235 | |
257 | 236 | } |
258 | 237 | ... | ... |
app/src/main/java/net/devfac/userstory/FragmentAddBook.java
... | ... | @@ -279,6 +279,10 @@ public class FragmentAddBook extends Fragment implements View.OnClickListener, S |
279 | 279 | StateContext.getInstance(getActivity()).processEvent(Action.REQ_INPUT_INFO_TO_ADD, |
280 | 280 | parent.getItemAtPosition(position)); |
281 | 281 | |
282 | + DialogAddBook mDialogAddBook = new DialogAddBook(getActivity(), (BookSearchResult)parent.getItemAtPosition(position)); | |
283 | + mDialogAddBook.setTitle("책 추가하기"); | |
284 | + mDialogAddBook.show(); | |
285 | + | |
282 | 286 | return false; |
283 | 287 | } |
284 | 288 | } | ... | ... |
app/src/main/java/net/devfac/userstory/MainActivity.java
1 | 1 | package net.devfac.userstory; |
2 | 2 | |
3 | +import android.app.Dialog; | |
3 | 4 | import android.app.Fragment; |
4 | 5 | import android.app.FragmentTransaction; |
5 | 6 | import android.os.Bundle; |
... | ... | @@ -67,9 +68,7 @@ public class MainActivity extends AppCompatActivity |
67 | 68 | Snackbar.make(view, "ADD BOOKS", Snackbar.LENGTH_LONG) |
68 | 69 | .setAction("Action", null).show(); |
69 | 70 | |
70 | -// fragmentReplace(Constants.FRAGMENT_SELECT.FRAG_ADD_BOOK); | |
71 | - new DialogAddBook(MainActivity.this).show(); | |
72 | - | |
71 | + fragmentReplace(Constants.FRAGMENT_SELECT.FRAG_ADD_BOOK); | |
73 | 72 | } |
74 | 73 | }); |
75 | 74 | ... | ... |
app/src/main/res/layout/dialog_add_book.xml
... | ... | @@ -32,13 +32,13 @@ |
32 | 32 | android:layout_height="wrap_content" |
33 | 33 | android:textAppearance="?android:attr/textAppearanceMedium" |
34 | 34 | android:text="글쓰기 달인이 되려면 잘못된 문장부터 고쳐라" |
35 | - android:id="@+id/textView5" /> | |
35 | + android:id="@+id/text_book_add_title" /> | |
36 | 36 | |
37 | 37 | <TextView |
38 | 38 | android:layout_width="wrap_content" |
39 | 39 | android:layout_height="wrap_content" |
40 | 40 | android:text="박찬영 지음 | 리베르 | 20151031 국내도서>인문학>책읽기/글쓰기>글쓰기" |
41 | - android:id="@+id/textView" | |
41 | + android:id="@+id/text_book_add_details" | |
42 | 42 | android:singleLine="false" |
43 | 43 | android:autoText="false" |
44 | 44 | android:textAppearance="?android:attr/textAppearanceSmall" |
... | ... | @@ -75,19 +75,19 @@ |
75 | 75 | <RadioButton |
76 | 76 | android:layout_width="wrap_content" |
77 | 77 | android:layout_height="wrap_content" |
78 | - android:text="New RadioButton" | |
78 | + android:text="읽고 있는 책" | |
79 | 79 | android:id="@+id/radioButton" /> |
80 | 80 | |
81 | 81 | <RadioButton |
82 | 82 | android:layout_width="wrap_content" |
83 | 83 | android:layout_height="wrap_content" |
84 | - android:text="New RadioButton" | |
84 | + android:text="읽은 책" | |
85 | 85 | android:id="@+id/radioButton2" /> |
86 | 86 | |
87 | 87 | <RadioButton |
88 | 88 | android:layout_width="wrap_content" |
89 | 89 | android:layout_height="wrap_content" |
90 | - android:text="New RadioButton" | |
90 | + android:text="읽을 책" | |
91 | 91 | android:id="@+id/radioButton3" /> |
92 | 92 | |
93 | 93 | </RadioGroup> |
... | ... | @@ -106,21 +106,27 @@ |
106 | 106 | <RadioButton |
107 | 107 | android:layout_width="wrap_content" |
108 | 108 | android:layout_height="wrap_content" |
109 | - android:text="New RadioButton" | |
109 | + android:text="가지고 있는 책" | |
110 | 110 | android:id="@+id/radioButton4" /> |
111 | 111 | |
112 | 112 | <RadioButton |
113 | 113 | android:layout_width="wrap_content" |
114 | 114 | android:layout_height="wrap_content" |
115 | - android:text="New RadioButton" | |
115 | + android:text="빌린 책" | |
116 | 116 | android:id="@+id/radioButton5" /> |
117 | 117 | |
118 | 118 | <RadioButton |
119 | 119 | android:layout_width="wrap_content" |
120 | 120 | android:layout_height="wrap_content" |
121 | - android:text="New RadioButton" | |
121 | + android:text="갖고 싶은 책" | |
122 | 122 | android:id="@+id/radioButton6" /> |
123 | 123 | |
124 | + <RadioButton | |
125 | + android:layout_width="wrap_content" | |
126 | + android:layout_height="wrap_content" | |
127 | + android:text="빌려준 책" | |
128 | + android:id="@+id/radioButton7" /> | |
129 | + | |
124 | 130 | </RadioGroup> |
125 | 131 | |
126 | 132 | <LinearLayout |
... | ... | @@ -211,7 +217,7 @@ |
211 | 217 | android:ems="10" |
212 | 218 | android:id="@+id/editText2" |
213 | 219 | android:layout_weight="1" |
214 | - android:text="2010.1.1" /> | |
220 | + android:text="" /> | |
215 | 221 | |
216 | 222 | </LinearLayout> |
217 | 223 | |
... | ... | @@ -235,7 +241,7 @@ |
235 | 241 | android:ems="10" |
236 | 242 | android:id="@+id/editText3" |
237 | 243 | android:layout_weight="1" |
238 | - android:text="2010.1.1" /> | |
244 | + android:text="" /> | |
239 | 245 | |
240 | 246 | <TextView |
241 | 247 | android:layout_width="wrap_content" |
... | ... | @@ -252,7 +258,7 @@ |
252 | 258 | android:ems="10" |
253 | 259 | android:id="@+id/editText4" |
254 | 260 | android:layout_weight="1" |
255 | - android:text="2010.1.1" /> | |
261 | + android:text="" /> | |
256 | 262 | </LinearLayout> |
257 | 263 | |
258 | 264 | <Button | ... | ... |