Takahiro Yoshimura (@alterakey)           22.10.2011
Twitter   →@alterakey
https://github.com/taky/effy
…
Effy ZIP
EclipseAndroid SDKEffy
Eclipse Effy
DrawActivity                 DA.plotPaint   Canvas
DrawActivity.javaprivate void initialSetup(){    ...! this.setPenColor(color);! this.paint.setStrokeWidth(5.0f);}      →
…
res/xml/config.xml:ConfigActivity:ConfigKey:
<ListPreference>  res/values/arrays.xml
res/xml/config.xml<ListPreference       android:key="pen_width"       android:title="         "      android:defaultValue="...
res/values/arrays.xml (1)<string-array name="entries_pen_width">    <item>    </item>   <item>   </item>   <item>     </it...
res/values/arrays.xml (2)<string-array name="entry_values_pen_width">    <item>2</item>    <item>3</item>    <item>5</item...
CK PEN_WIDTH
ConfigKey.javapublic class ConfigKey{! public static final String DROP_ALPHA = "drop_alpha";! public static final String PEN_A...
→private        CA.onCreateCA.onResume   CA.updateSummary
ConfigActivity.java (1)public class ConfigActivity extends PreferenceActivity ...{! private ListPreference drop_alpha;! priv...
ConfigActivity.java (2)@Overrideprotected void onCreate(Bundle savedInstanceState) {    ...    this.pen_alpha = (ListPrefer...
ConfigActivity.java (3)@Overrideprotected void onResume() {   ...   this.updateSummary(sharedPreferences, ConfigKey.PEN_ALPH...
ConfigActivity.java (4)private void updateSummary(SharedPreferences ...{    ...    if (key.equals(ConfigKey.PEN_ALPHA))     ...
…
SharedPreferences
DA.initialSetup → DA.restyle  SharedPreferences                     (DROP_ALPHA)                                    …
DrawActivity.javaprivate void initialSetup(){    ...    this.paint.setStrokeWidth(5.0f);}
DrawActivity.javaprivate void restyle(){    ...    this.setPenColor(this.paint.getColor());   float pen_width = (float)Integ...
…
DA.restyle():“drop_alpha” → ConfigKey.DROP_ALPHA
Paint   Canvas
github   (GPL-3)
#5Android 3.1https://github.com/taky/effy/issues/5         Activity                    : 3.2→OK 3.0/3.1→NG
アプリを弄ってみる #1 #antama_ws
アプリを弄ってみる #1 #antama_ws
Upcoming SlideShare
Loading in …5
×

アプリを弄ってみる #1 #antama_ws

1,291 views

Published on

タブレット描画アプリに線幅変更を付けてみるハンズオンです。

Published in: Technology, Business
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,291
On SlideShare
0
From Embeds
0
Number of Embeds
7
Actions
Shares
0
Downloads
3
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

アプリを弄ってみる #1 #antama_ws

  1. 1. Takahiro Yoshimura (@alterakey) 22.10.2011
  2. 2. Twitter →@alterakey
  3. 3. https://github.com/taky/effy
  4. 4.
  5. 5. Effy ZIP
  6. 6. EclipseAndroid SDKEffy
  7. 7. Eclipse Effy
  8. 8. DrawActivity DA.plotPaint Canvas
  9. 9. DrawActivity.javaprivate void initialSetup(){ ...! this.setPenColor(color);! this.paint.setStrokeWidth(5.0f);} →
  10. 10.
  11. 11. res/xml/config.xml:ConfigActivity:ConfigKey:
  12. 12. <ListPreference> res/values/arrays.xml
  13. 13. res/xml/config.xml<ListPreference android:key="pen_width" android:title=" " android:defaultValue="5" android:entries="@array/entries_pen_width" android:entryValues="@array/entry_values_pen_width" />
  14. 14. res/values/arrays.xml (1)<string-array name="entries_pen_width"> <item> </item> <item> </item> <item> </item> <item> </item> <item> </item></string-array>
  15. 15. res/values/arrays.xml (2)<string-array name="entry_values_pen_width"> <item>2</item> <item>3</item> <item>5</item> <item>8</item> <item>13</item></string-array>
  16. 16. CK PEN_WIDTH
  17. 17. ConfigKey.javapublic class ConfigKey{! public static final String DROP_ALPHA = "drop_alpha";! public static final String PEN_ALPHA = "pen_alpha"; public static final String PEN_WIDTH = "pen_width";}
  18. 18. →private CA.onCreateCA.onResume CA.updateSummary
  19. 19. ConfigActivity.java (1)public class ConfigActivity extends PreferenceActivity ...{! private ListPreference drop_alpha;! private ListPreference pen_alpha; private ListPreference pen_width; @Override protected void onCreate(Bundle savedInstanceState) {
  20. 20. ConfigActivity.java (2)@Overrideprotected void onCreate(Bundle savedInstanceState) { ... this.pen_alpha = (ListPreference)getPreferenceScreen().findPreference(ConfigKey.PEN_ALPHA); this.pen_width = (ListPreference)getPreferenceScreen().findPreference(ConfigKey.PEN_WIDTH);}
  21. 21. ConfigActivity.java (3)@Overrideprotected void onResume() { ... this.updateSummary(sharedPreferences, ConfigKey.PEN_ALPHA); this.updateSummary(sharedPreferences, ConfigKey.PEN_WIDTH); ...}
  22. 22. ConfigActivity.java (4)private void updateSummary(SharedPreferences ...{ ... if (key.equals(ConfigKey.PEN_ALPHA)) this.setSummary(this.pen_alpha, this.pen_alpha.getEntry()); if (key.equals(ConfigKey.PEN_WIDTH)) this.setSummary(this.pen_width, this.pen_width.getEntry());}
  23. 23.
  24. 24. SharedPreferences
  25. 25. DA.initialSetup → DA.restyle SharedPreferences (DROP_ALPHA) …
  26. 26. DrawActivity.javaprivate void initialSetup(){ ... this.paint.setStrokeWidth(5.0f);}
  27. 27. DrawActivity.javaprivate void restyle(){ ... this.setPenColor(this.paint.getColor()); float pen_width = (float)Integer.parseInt(pref.getString(ConfigKey.PEN_WIDTH, "5")); this.paint.setStrokeWidth(pen_width);}
  28. 28.
  29. 29. DA.restyle():“drop_alpha” → ConfigKey.DROP_ALPHA
  30. 30. Paint Canvas
  31. 31. github (GPL-3)
  32. 32. #5Android 3.1https://github.com/taky/effy/issues/5 Activity : 3.2→OK 3.0/3.1→NG

×