Commit 6102c27f4c35968c471560cc1353922e2aa210ed

Authored by transpine
1 parent a3f3d964

- add custom rating bar

app/src/main/java/net/devfac/userstory/DialogAddBook.java 0 → 100644
  1 +package net.devfac.userstory;
  2 +
  3 +import android.app.Dialog;
  4 +import android.content.Context;
  5 +import android.view.WindowManager;
  6 +
  7 +/**
  8 + * Created by Onether on 15. 11. 7..
  9 + */
  10 +public class DialogAddBook extends Dialog {
  11 + public DialogAddBook(Context context) {
  12 + super(context);
  13 +
  14 + WindowManager.LayoutParams lpWindow = new WindowManager.LayoutParams();
  15 + lpWindow.flags = WindowManager.LayoutParams.FLAG_DIM_BEHIND;
  16 + lpWindow.dimAmount = 0.8f;
  17 + getWindow().setAttributes(lpWindow);
  18 +
  19 + setContentView(R.layout.dialog_add_book);
  20 + }
  21 +}
... ...
app/src/main/java/net/devfac/userstory/MainActivity.java
... ... @@ -67,7 +67,9 @@ public class MainActivity extends AppCompatActivity
67 67 Snackbar.make(view, "ADD BOOKS", Snackbar.LENGTH_LONG)
68 68 .setAction("Action", null).show();
69 69  
70   - fragmentReplace(Constants.FRAGMENT_SELECT.FRAG_ADD_BOOK);
  70 +// fragmentReplace(Constants.FRAGMENT_SELECT.FRAG_ADD_BOOK);
  71 + new DialogAddBook(MainActivity.this).show();
  72 +
71 73 }
72 74 });
73 75  
... ...
app/src/main/res/drawable/ratingbar.xml 0 → 100644
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
  3 + <item android:id="@+android:id/background"
  4 + android:drawable="@drawable/ratingbar_empty"/>
  5 + <item android:id="@+android:id/secondaryProgress"
  6 + android:drawable="@drawable/ratingbar_empty"/>
  7 + <item android:id="@+android:id/progress"
  8 + android:drawable="@drawable/ratingbar_filled"/>
  9 +</layer-list>
0 10 \ No newline at end of file
... ...
app/src/main/res/drawable/ratingbar_empty.xml 0 → 100644
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<selector xmlns:android="http://schemas.android.com/apk/res/android">
  3 +
  4 + <item android:state_pressed="true"
  5 + android:state_window_focused="true"
  6 + android:drawable="@drawable/star_off" />
  7 +
  8 + <item android:state_focused="true"
  9 + android:state_window_focused="true"
  10 + android:drawable="@drawable/star_off"/>
  11 +
  12 + <item android:state_selected="true"
  13 + android:state_window_focused="true"
  14 + android:drawable="@drawable/star_off"/>
  15 +
  16 + <item android:drawable="@drawable/star_off"/>
  17 +
  18 +</selector>
0 19 \ No newline at end of file
... ...
app/src/main/res/drawable/ratingbar_filled.xml 0 → 100644
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<selector xmlns:android="http://schemas.android.com/apk/res/android">
  3 +
  4 + <item android:state_pressed="true"
  5 + android:state_window_focused="true"
  6 + android:drawable="@drawable/star_on"/>
  7 +
  8 + <item android:state_focused="true"
  9 + android:state_window_focused="true"
  10 + android:drawable="@drawable/star_on"/>
  11 +
  12 + <item android:state_selected="true"
  13 + android:state_window_focused="true"
  14 + android:drawable="@drawable/star_on"/>
  15 +
  16 + <item android:drawable="@drawable/star_on"/>
  17 +
  18 +</selector>
0 19 \ No newline at end of file
... ...
app/src/main/res/drawable/star_off.png 0 → 100644

3.4 KB

app/src/main/res/drawable/star_off_big.png 0 → 100644

1.5 KB

app/src/main/res/drawable/star_on.png 0 → 100644

3.41 KB

app/src/main/res/drawable/star_on_big.png 0 → 100644

2.12 KB

app/src/main/res/layout/dialog_add_book.xml 0 → 100644
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<!--<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"-->
  3 + <!--android:orientation="vertical" android:layout_width="match_parent"-->
  4 + <!--android:layout_height="match_parent"-->
  5 + <!--android:padding="10dp">-->
  6 +
  7 + <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
  8 + android:layout_width="fill_parent"
  9 + android:layout_height="fill_parent"
  10 + android:id="@+id/scrollView" >
  11 +
  12 + <LinearLayout
  13 + android:orientation="vertical"
  14 + android:layout_width="match_parent"
  15 + android:layout_height="match_parent"
  16 + android:padding="10dp">
  17 +
  18 + <LinearLayout
  19 + android:orientation="horizontal"
  20 + android:layout_width="match_parent"
  21 + android:layout_height="wrap_content"
  22 + android:weightSum="10">
  23 +
  24 + <LinearLayout
  25 + android:orientation="vertical"
  26 + android:layout_width="0dp"
  27 + android:layout_height="match_parent"
  28 + android:layout_weight="7">
  29 +
  30 + <TextView
  31 + android:layout_width="wrap_content"
  32 + android:layout_height="wrap_content"
  33 + android:textAppearance="?android:attr/textAppearanceMedium"
  34 + android:text="글쓰기 달인이 되려면 잘못된 문장부터 고쳐라"
  35 + android:id="@+id/textView5" />
  36 +
  37 + <TextView
  38 + android:layout_width="wrap_content"
  39 + android:layout_height="wrap_content"
  40 + android:text="박찬영 지음 | 리베르 | 20151031 국내도서>인문학>책읽기/글쓰기>글쓰기"
  41 + android:id="@+id/textView"
  42 + android:singleLine="false"
  43 + android:autoText="false"
  44 + android:textAppearance="?android:attr/textAppearanceSmall"
  45 + android:nestedScrollingEnabled="false" />
  46 +
  47 + </LinearLayout>
  48 +
  49 + <LinearLayout
  50 + android:orientation="horizontal"
  51 + android:layout_width="0dp"
  52 + android:layout_height="match_parent"
  53 + android:layout_weight="3"
  54 + android:gravity="right">
  55 +
  56 + <ImageView
  57 + android:layout_width="wrap_content"
  58 + android:layout_height="wrap_content"
  59 + android:id="@+id/imageView2"
  60 + android:layout_gravity="right" />
  61 + </LinearLayout>
  62 + </LinearLayout>
  63 +
  64 + <RadioGroup
  65 + android:layout_width="match_parent"
  66 + android:layout_height="wrap_content">
  67 +
  68 + <TextView
  69 + android:layout_width="wrap_content"
  70 + android:layout_height="wrap_content"
  71 + android:textAppearance="?android:attr/textAppearanceSmall"
  72 + android:text="읽은 상태"
  73 + android:id="@+id/textView3" />
  74 +
  75 + <RadioButton
  76 + android:layout_width="wrap_content"
  77 + android:layout_height="wrap_content"
  78 + android:text="New RadioButton"
  79 + android:id="@+id/radioButton" />
  80 +
  81 + <RadioButton
  82 + android:layout_width="wrap_content"
  83 + android:layout_height="wrap_content"
  84 + android:text="New RadioButton"
  85 + android:id="@+id/radioButton2" />
  86 +
  87 + <RadioButton
  88 + android:layout_width="wrap_content"
  89 + android:layout_height="wrap_content"
  90 + android:text="New RadioButton"
  91 + android:id="@+id/radioButton3" />
  92 +
  93 + </RadioGroup>
  94 +
  95 + <RadioGroup
  96 + android:layout_width="match_parent"
  97 + android:layout_height="wrap_content">
  98 +
  99 + <TextView
  100 + android:layout_width="wrap_content"
  101 + android:layout_height="wrap_content"
  102 + android:textAppearance="?android:attr/textAppearanceSmall"
  103 + android:text="소유 상태"
  104 + android:id="@+id/textView4" />
  105 +
  106 + <RadioButton
  107 + android:layout_width="wrap_content"
  108 + android:layout_height="wrap_content"
  109 + android:text="New RadioButton"
  110 + android:id="@+id/radioButton4" />
  111 +
  112 + <RadioButton
  113 + android:layout_width="wrap_content"
  114 + android:layout_height="wrap_content"
  115 + android:text="New RadioButton"
  116 + android:id="@+id/radioButton5" />
  117 +
  118 + <RadioButton
  119 + android:layout_width="wrap_content"
  120 + android:layout_height="wrap_content"
  121 + android:text="New RadioButton"
  122 + android:id="@+id/radioButton6" />
  123 +
  124 + </RadioGroup>
  125 +
  126 + <LinearLayout
  127 + android:orientation="horizontal"
  128 + android:layout_width="match_parent"
  129 + android:layout_height="wrap_content"
  130 + android:gravity="center_vertical">
  131 +
  132 + <TextView
  133 + android:layout_width="wrap_content"
  134 + android:layout_height="wrap_content"
  135 + android:textAppearance="?android:attr/textAppearanceSmall"
  136 + android:text="이 책에 대한 나의 평점"
  137 + android:id="@+id/textView6" />
  138 +
  139 + <RatingBar
  140 + android:layout_width="wrap_content"
  141 + android:layout_height="wrap_content"
  142 + android:id="@+id/ratingBar"
  143 + android:numStars="5"
  144 + style="@style/RatingBar"
  145 + android:stepSize="1" />
  146 +
  147 + <CheckBox
  148 + android:layout_width="wrap_content"
  149 + android:layout_height="wrap_content"
  150 + android:text="잘 모르겠어요"
  151 + android:id="@+id/checkBox" />
  152 +
  153 + </LinearLayout>
  154 +
  155 + <LinearLayout
  156 + android:orientation="horizontal"
  157 + android:layout_width="match_parent"
  158 + android:layout_height="wrap_content"
  159 + android:gravity="center_vertical" >
  160 +
  161 + <TextView
  162 + android:layout_width="wrap_content"
  163 + android:layout_height="wrap_content"
  164 + android:textAppearance="?android:attr/textAppearanceSmall"
  165 + android:text="다른 사람한테 빌려줄 수 있나요?"
  166 + android:id="@+id/textView7" />
  167 +
  168 + <CheckBox
  169 + android:layout_width="wrap_content"
  170 + android:layout_height="wrap_content"
  171 + android:id="@+id/checkBox2" />
  172 + </LinearLayout>
  173 +
  174 + <LinearLayout
  175 + android:orientation="vertical"
  176 + android:layout_width="match_parent"
  177 + android:layout_height="wrap_content">
  178 +
  179 + <TextView
  180 + android:layout_width="wrap_content"
  181 + android:layout_height="wrap_content"
  182 + android:textAppearance="?android:attr/textAppearanceSmall"
  183 + android:text="이 책에 메모하기"
  184 + android:id="@+id/textView8" />
  185 +
  186 + <EditText
  187 + android:layout_width="match_parent"
  188 + android:layout_height="wrap_content"
  189 + android:inputType="textMultiLine"
  190 + android:ems="10"
  191 + android:id="@+id/editText" />
  192 + </LinearLayout>
  193 +
  194 + <LinearLayout
  195 + android:orientation="horizontal"
  196 + android:layout_width="match_parent"
  197 + android:layout_height="wrap_content">
  198 +
  199 + <TextView
  200 + android:layout_width="wrap_content"
  201 + android:layout_height="wrap_content"
  202 + android:textAppearance="?android:attr/textAppearanceSmall"
  203 + android:text="구입 일자"
  204 + android:id="@+id/textView9"
  205 + android:singleLine="false" />
  206 +
  207 + <EditText
  208 + android:layout_width="wrap_content"
  209 + android:layout_height="wrap_content"
  210 + android:inputType="date"
  211 + android:ems="10"
  212 + android:id="@+id/editText2"
  213 + android:layout_weight="1"
  214 + android:text="2010.1.1" />
  215 +
  216 + </LinearLayout>
  217 +
  218 + <LinearLayout
  219 + android:orientation="horizontal"
  220 + android:layout_width="match_parent"
  221 + android:layout_height="wrap_content" >
  222 +
  223 + <TextView
  224 + android:layout_width="wrap_content"
  225 + android:layout_height="wrap_content"
  226 + android:textAppearance="?android:attr/textAppearanceSmall"
  227 + android:text="읽기 시작"
  228 + android:id="@+id/textView10"
  229 + android:singleLine="false" />
  230 +
  231 + <EditText
  232 + android:layout_width="wrap_content"
  233 + android:layout_height="wrap_content"
  234 + android:inputType="date"
  235 + android:ems="10"
  236 + android:id="@+id/editText3"
  237 + android:layout_weight="1"
  238 + android:text="2010.1.1" />
  239 +
  240 + <TextView
  241 + android:layout_width="wrap_content"
  242 + android:layout_height="wrap_content"
  243 + android:textAppearance="?android:attr/textAppearanceSmall"
  244 + android:text="읽기 완료"
  245 + android:id="@+id/textView11"
  246 + android:singleLine="false" />
  247 +
  248 + <EditText
  249 + android:layout_width="wrap_content"
  250 + android:layout_height="wrap_content"
  251 + android:inputType="date"
  252 + android:ems="10"
  253 + android:id="@+id/editText4"
  254 + android:layout_weight="1"
  255 + android:text="2010.1.1" />
  256 + </LinearLayout>
  257 +
  258 + <Button
  259 + android:layout_width="match_parent"
  260 + android:layout_height="wrap_content"
  261 + android:text="내 서재에 추가합니다"
  262 + android:id="@+id/button"
  263 + android:layout_gravity="center_horizontal" />
  264 + </LinearLayout>
  265 + </ScrollView>
  266 +
  267 +<!--</LinearLayout>-->
0 268 \ No newline at end of file
... ...
app/src/main/res/values/styles.xml
... ... @@ -14,4 +14,10 @@
14 14 <style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
15 15 <style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
16 16  
  17 + <style name="RatingBar" parent="@android:style/Widget.RatingBar">
  18 + <item name="android:progressDrawable">@drawable/ratingbar</item>
  19 + <item name="android:minHeight">16dip</item>
  20 + <item name="android:maxHeight">16dip</item>
  21 + </style>
  22 +
17 23 </resources>
... ...