diff options
author | Luke Shumaker <shumakl@purdue.edu> | 2014-05-04 22:27:46 -0400 |
---|---|---|
committer | Luke Shumaker <shumakl@purdue.edu> | 2014-05-04 22:27:46 -0400 |
commit | 604905937c8d4a1db42a34a61973d4c4490c3403 (patch) | |
tree | 6cfa9c7bf563d23c45a1956bbbc7f4438689d0d0 | |
parent | 8001e3284e069dded37a1aa42b25c201102b9460 (diff) |
grr
-rw-r--r-- | res/drawable-hdpi/keyboard.png (renamed from res/icons/keyboard/drawable-hdpi/ic_launcher.png) | bin | 4615 -> 4615 bytes | |||
-rw-r--r-- | res/drawable-hdpi/minak.png (renamed from res/icons/minak/drawable-hdpi/ic_launcher.png) | bin | 6727 -> 6727 bytes | |||
-rw-r--r-- | res/drawable-mdpi/keyboard.png (renamed from res/icons/keyboard/drawable-mdpi/ic_launcher.png) | bin | 1994 -> 1994 bytes | |||
-rw-r--r-- | res/drawable-mdpi/minak.png (renamed from res/icons/minak/drawable-mdpi/ic_launcher.png) | bin | 4052 -> 4052 bytes | |||
-rw-r--r-- | res/drawable-xhdpi/keyboard.png (renamed from res/icons/keyboard/drawable-xhdpi/ic_launcher.png) | bin | 3912 -> 3912 bytes | |||
-rw-r--r-- | res/drawable-xhdpi/minak.png (renamed from res/icons/minak/drawable-xhdpi/ic_launcher.png) | bin | 15365 -> 15365 bytes | |||
-rw-r--r-- | res/drawable/emacs.svg | 182 | ||||
-rw-r--r-- | res/drawable/keyboard.png (renamed from res/icons/keyboard.png) | bin | 1977 -> 1977 bytes | |||
-rw-r--r-- | res/drawable/minak.svg (renamed from res/icons/minak.svg) | 0 | ||||
-rw-r--r-- | src/us/minak/CreateGestureActivity.java | 2 | ||||
-rw-r--r-- | src/us/minak/OnCharacterEnteredListener.java | 5 | ||||
-rw-r--r-- | src/us/minak/SettingsActivity.java | 37 | ||||
-rw-r--r-- | src/us/minak/SettingsUtil.java | 22 |
13 files changed, 225 insertions, 23 deletions
diff --git a/res/icons/keyboard/drawable-hdpi/ic_launcher.png b/res/drawable-hdpi/keyboard.png Binary files differindex 2494b61..2494b61 100644 --- a/res/icons/keyboard/drawable-hdpi/ic_launcher.png +++ b/res/drawable-hdpi/keyboard.png diff --git a/res/icons/minak/drawable-hdpi/ic_launcher.png b/res/drawable-hdpi/minak.png Binary files differindex 80f80a0..80f80a0 100644 --- a/res/icons/minak/drawable-hdpi/ic_launcher.png +++ b/res/drawable-hdpi/minak.png diff --git a/res/icons/keyboard/drawable-mdpi/ic_launcher.png b/res/drawable-mdpi/keyboard.png Binary files differindex deb71bc..deb71bc 100644 --- a/res/icons/keyboard/drawable-mdpi/ic_launcher.png +++ b/res/drawable-mdpi/keyboard.png diff --git a/res/icons/minak/drawable-mdpi/ic_launcher.png b/res/drawable-mdpi/minak.png Binary files differindex 9fce689..9fce689 100644 --- a/res/icons/minak/drawable-mdpi/ic_launcher.png +++ b/res/drawable-mdpi/minak.png diff --git a/res/icons/keyboard/drawable-xhdpi/ic_launcher.png b/res/drawable-xhdpi/keyboard.png Binary files differindex 8944a37..8944a37 100644 --- a/res/icons/keyboard/drawable-xhdpi/ic_launcher.png +++ b/res/drawable-xhdpi/keyboard.png diff --git a/res/icons/minak/drawable-xhdpi/ic_launcher.png b/res/drawable-xhdpi/minak.png Binary files differindex 7a86237..7a86237 100644 --- a/res/icons/minak/drawable-xhdpi/ic_launcher.png +++ b/res/drawable-xhdpi/minak.png diff --git a/res/drawable/emacs.svg b/res/drawable/emacs.svg new file mode 100644 index 0000000..9872a08 --- /dev/null +++ b/res/drawable/emacs.svg @@ -0,0 +1,182 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Gnu Emacs Icon + + Copyright (C) 2008, 2009 + Free Software Foundation, Inc. + + This file is part of GNU Emacs. + + GNU Emacs is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + GNU Emacs is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. + +--> +<!-- Created with Inkscape (http://www.inkscape.org/) --> +<!-- And cleaned up in Emacs --> +<svg + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:xlink="http://www.w3.org/1999/xlink" + version="1.0" + width="48" + height="48" + viewBox="0.171 0.201 512 512" + id="svg4768" + xml:space="preserve"> +<defs id="defs4770"> + <linearGradient id="pen_main_linearGradient"> + <stop id="stop3296" style="stop-color:#6376e6;stop-opacity:1" offset="0" /> + <stop id="stop3302" style="stop-color:#222989;stop-opacity:1" offset="0.50094414" /> + <stop id="stop3298" style="stop-color:#00003d;stop-opacity:1" offset="1" /> + </linearGradient> + <linearGradient id="pen_shadow_linearGradient"> + <stop id="stop3286" style="stop-color:#000000;stop-opacity:1" offset="0" /> + <stop id="stop3292" style="stop-color:#000000;stop-opacity:0.49803922" offset="0.84845906" /> + <stop id="stop3288" style="stop-color:#000000;stop-opacity:0" offset="1" /> + </linearGradient> + <linearGradient id="pen_clip_linearGradient"> + <stop id="stop3244" style="stop-color:#282828;stop-opacity:1" offset="0" /> + <stop id="stop3252" style="stop-color:#808080;stop-opacity:1" offset="0.39253417" /> + <stop id="stop3246" style="stop-color:#d9d9d9;stop-opacity:1" offset="1" /> + </linearGradient> + <linearGradient id="pen_ring_linearGradient"> + <stop id="stop3204" style="stop-color:#2b2b2b;stop-opacity:1" offset="0" /> + <stop id="stop3250" style="stop-color:#828383;stop-opacity:1" offset="0.5" /> + <stop id="stop3206" style="stop-color:#dadbdb;stop-opacity:1" offset="1" /> + </linearGradient> + <linearGradient id="ball_highlight_linearGradient"> + <stop id="stop4968" style="stop-color:#b6b3d8;stop-opacity:1" offset="0" /> + <stop id="stop4970" style="stop-color:#b6b3d8;stop-opacity:0" offset="1" /> + </linearGradient> + <linearGradient id="ball_shadow_linearGradient"> + <stop id="stop4940" style="stop-color:#000000;stop-opacity:1" offset="0" /> + <stop id="stop4942" style="stop-color:#000000;stop-opacity:0" offset="1" /> + </linearGradient> + <linearGradient id="ball_main_linearGradient"> + <stop + id="stop4900" style="stop-color:#bab8db;stop-opacity:1" offset="0" /> + <stop id="stop4902" style="stop-color:#5955a9;stop-opacity:0.99159664" offset="1" /> + </linearGradient> + <radialGradient id="ball_main_radialGradient" + cx="20.951529" + cy="-108.96888" + r="266.76535" + fx="20.951529" + fy="-108.96888" + xlink:href="#ball_main_linearGradient" + gradientUnits="userSpaceOnUse" + gradientTransform="matrix(0.6817439,0,0,0.5905355,-3.8523706,-28.935273)" /> + <radialGradient id="ball_shadow_radialGradient" + cx="233.8876" + cy="471.26172" + r="170.49393" + fx="233.8876" + fy="471.26172" + xlink:href="#ball_shadow_linearGradient" + gradientUnits="userSpaceOnUse" + gradientTransform="matrix(1,0,0,0.1854103,0,383.88493)" /> + <radialGradient id="ball_highlight_radialGradient" + cx="299.70135" + cy="371.76376" + r="76.696358" + fx="299.70135" + fy="371.76376" + xlink:href="#ball_highlight_linearGradient" + gradientUnits="userSpaceOnUse" + gradientTransform="matrix(1,0,0,0.9121621,0,32.654948)" /> + <radialGradient id="pen_ring_tip_main_radialGradient" + cx="289.44067" + cy="390.45248" + r="17.67668" + fx="289.44067" + fy="390.45248" + xlink:href="#pen_ring_linearGradient" + gradientUnits="userSpaceOnUse" + gradientTransform="matrix(0.414705,0.3300575,-0.5059004,0.6356454,346.95314,49.479585)" /> + <radialGradient id="pen_ring_clip_radialGradient" + cx="283.50717" + cy="382.14804" + r="17.67668" + fx="283.50717" + fy="382.14804" + xlink:href="#pen_ring_linearGradient" + gradientUnits="userSpaceOnUse" + gradientTransform="matrix(0.414705,0.3300575,-0.5059004,0.6356454,448.41009,-65.398074)" /> + <radialGradient id="pen_clip_radialGradient" + cx="418.45551" + cy="181.18982" + r="63.068935" + fx="418.45551" + fy="181.18982" + xlink:href="#pen_clip_linearGradient" + gradientUnits="userSpaceOnUse" + gradientTransform="matrix(-6.5565014e-2,-5.9721765e-2,1.6871024,-1.8521705,171.90774,540.51473)" /> + <radialGradient id="pen_shadow_radialGradient" + cx="284.4671" + cy="-158.17821" + r="110.2972" + fx="284.4671" + fy="-158.17821" + xlink:href="#pen_shadow_linearGradient" + gradientUnits="userSpaceOnUse" + gradientTransform="matrix(-1.2497569,1.3798305,-9.6289463e-2,-7.2974479e-2,674.3826,-70.590682)" /> + <radialGradient id="pen_main_radialGradient" + cx="425.51019" + cy="356.62274" + r="143.34167" + fx="425.51019" + fy="356.62274" + xlink:href="#pen_main_linearGradient" + gradientUnits="userSpaceOnUse" + gradientTransform="matrix(-0.1008165,-8.0872321e-2,1.0745309,-1.3395252,13.843287,784.79288)" /> +</defs> +<g id="ball"> + <path id="ball_shadow" + d="M 404.38153,471.26172 C 404.40061,488.72268 328.06229,502.87946 233.8876,502.87946 C 139.71291,502.87946 63.374595,488.72268 63.393677,471.26172 C 63.374595,453.80076 139.71291,439.64398 233.8876,439.64398 C 328.06229,439.64398 404.40061,453.80076 404.38153,471.26172 z" + transform="matrix(1.3434649,0,0,1.3934426,-81.886873,-193.70595)" + style="opacity:1;fill:url(#ball_shadow_radialGradient);fill-opacity:1;stroke:#7b0000;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + <path id="ball_main" + d="M 277.19656,7.985198 C 277.19656,165.02971 157.76164,292.33945 10.43121,292.33945 C -136.89922,292.33945 -256.33414,165.02971 -256.33414,7.985198 C -256.33414,-149.05932 -136.89922,-276.36905 10.43121,-276.36905 C 157.76164,-276.36905 277.19656,-149.05932 277.19656,7.985198 z" + transform="matrix(0.8855031,0,0,0.8392166,227.80221,232.6491)" + style="opacity:1;fill:url(#ball_main_radialGradient);fill-opacity:1;stroke:#7b0000;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + <path id="ball_highlight" + d="M 376.39771,371.76376 C 376.40956,410.40897 342.06796,441.74284 299.70135,441.74284 C 257.33475,441.74284 222.99315,410.40897 223.005,371.76376 C 222.99315,333.11855 257.33475,301.78468 299.70135,301.78468 C 342.06796,301.78468 376.40956,333.11855 376.39771,371.76376 L 376.39771,371.76376 z" + transform="matrix(1.4594595,0,0,1,-195.74111,-13.473684)" + style="opacity:1;fill:url(#ball_highlight_radialGradient);fill-opacity:1;stroke:#7b0000;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + <path id="ball_E" + d="M 120.52728,395.60181 C 120.52728,395.60181 141.53508,401.7017 169.49894,405.18885 C 180.82361,406.60106 223.91189,411.53703 256.94833,411.40748 C 256.94833,411.40748 297.18385,411.45315 319.39367,408.29817 C 342.63265,404.99699 355.79853,400.78399 363.12576,392.37646 C 363.31663,390.37182 366.66239,383.83735 357.62922,377.53581 C 334.53496,361.42524 304.67924,357.01539 246.68812,343.24332 C 182.56112,327.12062 163.39684,311.68183 153.82282,300.50869 C 144.74597,289.31078 155.52664,266.05486 207.19934,254.64634 C 233.36175,248.27975 330.80211,247.10994 330.80211,247.10994 C 302.84706,224.91525 250.36452,185.17927 239.63685,176.72892 C 230.22819,169.31758 215.0665,157.94409 213.43669,147.7805 C 211.23808,137.88672 226.81161,133.12305 235.05641,132.5734 C 261.62302,130.74122 297.90017,133.85593 330.14653,140.26856 C 346.35535,143.49191 349.20119,143.01683 349.20119,143.01683 C 372.28666,144.11614 390.24202,132.02376 389.32593,106.55645 C 389.14271,80.722724 363.3136,60.007847 334.72698,59.103006 C 307.8068,58.250912 241.46904,62.950582 241.46904,62.950582 C 318.78702,78.890545 331.42676,82.958326 335.45985,92.265455 C 337.84168,97.761995 331.48115,103.22697 310.17577,102.15922 C 286.98088,100.99677 239.45364,95.38016 239.45364,95.38016 C 194.19881,88.417878 162.68532,81.822031 148.94397,99.777391 C 139.96658,111.50786 150.2265,125.79434 154.25729,134.22236 C 172.21266,165.55264 203.26114,187.04759 222.96403,202.19623 C 230.37744,207.89605 253.01177,220.51802 253.01177,220.51802 C 182.65608,201.28013 126.59139,212.08999 91.047104,230.77822 C 50.1895,254.96299 57.178586,295.77502 122.01094,333.92994 C 160.30349,356.46574 179.36948,367.29179 242.06631,374.98916 C 278.71351,380.83258 284.17422,383.22354 283.8957,386.27387 C 283.50356,390.56845 240.52009,392.19591 228.70541,393.01072 C 198.64873,395.08359 120.91594,395.60181 120.52728,395.60181 z" + style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> +</g> +<g id="pen"> + <path id="pen_ring_tip_outline" + d="M 279.476,404.243 C 279.469,404.239 272.03,400.131 262.672,392.842 L 262.672,392.842 C 254.59,386.557 249.134,380.628 249.128,380.622 L 249.128,380.622 L 249.006,380.489 L 252.652,375.82 L 252.809,375.615 L 252.978,375.812 C 252.995,375.822 258.378,382.107 266.703,388.592 L 266.703,388.592 C 274.616,394.749 283.297,399.178 283.315,399.187 L 283.315,399.187 L 283.544,399.304 L 279.633,404.33 L 279.476,404.243 L 279.476,404.243 z M 262.934,392.506 C 271.479,399.162 278.403,403.15 279.523,403.781 L 279.523,403.781 L 282.895,399.447 C 281.472,398.704 273.642,394.528 266.442,388.926 L 266.442,388.926 C 258.938,383.081 253.805,377.393 252.828,376.281 L 252.828,376.281 L 249.564,380.465 C 250.413,381.37 255.574,386.785 262.934,392.506 L 262.934,392.506 z" + style="fill:#4d4d4d" /> + <rect id="pen_shadow" + width="378.89471" + height="389.88782" + x="129.8893" + y="112.05299" + style="opacity:1;fill:url(#pen_shadow_radialGradient);fill-opacity:1;stroke:#4a4a4a;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + <path id="pen_main" + d="M 279.41935,402.42925 C 279.41935,402.42925 332.64609,345.32574 384.74548,282.44569 L 387.0212,283.14836 C 387.0212,283.14836 495.06978,164.73541 468.64063,155.14837 C 468.64063,155.14837 455.42606,128.97833 351.78234,254.90545 L 351.58303,256.79518 C 303.76315,311.94378 250.62994,379.18477 250.62994,379.18477 C 209.58912,438.18094 185.22113,481.78682 187.23653,486.00083 C 189.97605,491.72893 279.57838,403.0031 279.41935,402.42925 z" + style="fill:url(#pen_main_radialGradient);fill-opacity:1;fill-rule:evenodd;stroke:#000030;stroke-width:0.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + <path id="pen_ring_tip_main" + d="M 248.88937,380.28407 C 260.52371,392.19325 279.48677,404.28563 279.48677,404.28563 L 283.24273,399.52196 C 270.37465,392.79686 252.46212,375.70363 252.46212,375.70363 L 248.88937,380.28407 z" + style="fill:url(#pen_ring_tip_main_radialGradient);fill-opacity:1;fill-rule:evenodd;stroke:#606060;stroke-width:0.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + <path id="pen_ring_clip" + d="M 349.52184,256.42873 C 370.04225,269.52883 386.16543,285.37718 386.16543,285.37718 L 388.91369,282.17086 C 377.9694,270.59048 352.22755,253.07064 352.22755,253.07064 L 349.52184,256.42873 z" + style="fill:url(#pen_ring_clip_radialGradient);fill-opacity:1;fill-rule:evenodd;stroke:#606060;stroke-width:0.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + <path id="pen_clip" + d="M 462.24667,151.81129 C 473.05653,152.72737 474.88872,162.25471 474.88872,162.25471 C 425.60308,213.55574 353.41521,288.12545 353.41521,288.12545 L 349.75085,285.01074 C 413.32748,208.79208 462.24667,151.81129 462.24667,151.81129" + style="fill:url(#pen_clip_radialGradient);fill-opacity:1;fill-rule:evenodd;stroke:#4a4a4a;stroke-width:0.60000002;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> +</g> +</svg> diff --git a/res/icons/keyboard.png b/res/drawable/keyboard.png Binary files differindex e2c3c74..e2c3c74 100644 --- a/res/icons/keyboard.png +++ b/res/drawable/keyboard.png diff --git a/res/icons/minak.svg b/res/drawable/minak.svg index bb9b9fc..bb9b9fc 100644 --- a/res/icons/minak.svg +++ b/res/drawable/minak.svg diff --git a/src/us/minak/CreateGestureActivity.java b/src/us/minak/CreateGestureActivity.java index 6844b36..19fbc83 100644 --- a/src/us/minak/CreateGestureActivity.java +++ b/src/us/minak/CreateGestureActivity.java @@ -83,7 +83,7 @@ public class CreateGestureActivity extends Activity { return; } - final GestureLibrary store = SettingsActivity.getStore(); + final GestureLibrary store = SettingsUtil.getGestureLibrary(this); store.addGesture(name.toString(), mGesture); store.save(); diff --git a/src/us/minak/OnCharacterEnteredListener.java b/src/us/minak/OnCharacterEnteredListener.java new file mode 100644 index 0000000..82226b6 --- /dev/null +++ b/src/us/minak/OnCharacterEnteredListener.java @@ -0,0 +1,5 @@ +package us.minak; + +public interface OnCharacterEnteredListener { + void characterEntered(String character); +}
\ No newline at end of file diff --git a/src/us/minak/SettingsActivity.java b/src/us/minak/SettingsActivity.java index b366826..30b1e7b 100644 --- a/src/us/minak/SettingsActivity.java +++ b/src/us/minak/SettingsActivity.java @@ -27,9 +27,8 @@ import android.view.ContextMenu; import android.view.MenuItem; import android.view.LayoutInflater; import android.view.ViewGroup; -import android.gesture.GestureLibrary; import android.gesture.Gesture; -import android.gesture.GestureLibraries; +import android.gesture.GestureLibrary; import android.widget.TextView; import android.widget.EditText; import android.widget.AdapterView; @@ -49,7 +48,6 @@ import java.util.Collections; import java.util.HashMap; import java.util.Comparator; import java.util.Set; -import java.io.File; public class SettingsActivity extends ListActivity { private static final int STATUS_SUCCESS = 0; @@ -67,16 +65,12 @@ public class SettingsActivity extends ListActivity { // Type: long (id) private static final String GESTURES_INFO_ID = "gestures.info_id"; - private final File mStoreFile = new File(Environment.getExternalStorageDirectory(), "gestures"); - private final Comparator<NamedGesture> mSorter = new Comparator<NamedGesture>() { public int compare(NamedGesture object1, NamedGesture object2) { return object1.name.compareTo(object2.name); } }; - private static GestureLibrary sStore; - private GesturesAdapter mAdapter; private GesturesLoadTask mTask; private TextView mEmpty; @@ -85,6 +79,12 @@ public class SettingsActivity extends ListActivity { private EditText mInput; private NamedGesture mCurrentRenameGesture; + private SettingsActivity mThis; + public SettingsActivity() { + super(); + mThis = this; + } + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -94,19 +94,12 @@ public class SettingsActivity extends ListActivity { mAdapter = new GesturesAdapter(this); setListAdapter(mAdapter); - if (sStore == null) { - sStore = GestureLibraries.fromFile(mStoreFile); - } mEmpty = (TextView) findViewById(android.R.id.empty); loadGestures(); registerForContextMenu(getListView()); } - static GestureLibrary getStore() { - return sStore; - } - public void reloadGestures(View v) { loadGestures(); } @@ -169,9 +162,9 @@ public class SettingsActivity extends ListActivity { long id = state.getLong(GESTURES_INFO_ID, -1); if (id != -1) { - final Set<String> entries = sStore.getGestureEntries(); + final Set<String> entries = SettingsUtil.getGestureLibrary(this).getGestureEntries(); out: for (String name : entries) { - for (Gesture gesture : sStore.getGestures(name)) { + for (Gesture gesture : SettingsUtil.getGestureLibrary(this).getGestures(name)) { if (gesture.getID() == id) { mCurrentRenameGesture = new NamedGesture(); mCurrentRenameGesture.name = name; @@ -279,9 +272,9 @@ out: for (String name : entries) { for (int i = 0; i < count; i++) { final NamedGesture gesture = adapter.getItem(i); if (gesture.gesture.getID() == renameGesture.gesture.getID()) { - sStore.removeGesture(gesture.name, gesture.gesture); + SettingsUtil.getGestureLibrary(this).removeGesture(gesture.name, gesture.gesture); gesture.name = mInput.getText().toString(); - sStore.addGesture(gesture.name, gesture.gesture); + SettingsUtil.getGestureLibrary(this).addGesture(gesture.name, gesture.gesture); break; } } @@ -300,8 +293,8 @@ out: for (String name : entries) { } private void deleteGesture(NamedGesture gesture) { - sStore.removeGesture(gesture.name, gesture.gesture); - sStore.save(); + SettingsUtil.getGestureLibrary(this).removeGesture(gesture.name, gesture.gesture); + SettingsUtil.getGestureLibrary(this).save(); final GesturesAdapter adapter = mAdapter; adapter.setNotifyOnChange(false); @@ -341,7 +334,7 @@ out: for (String name : entries) { return STATUS_NO_STORAGE; } - final GestureLibrary store = sStore; + final GestureLibrary store = SettingsUtil.getGestureLibrary(mThis); if (store.load()) { for (String name : store.getGestureEntries()) { @@ -388,7 +381,7 @@ out: for (String name : entries) { getListView().setVisibility(View.GONE); mEmpty.setVisibility(View.VISIBLE); mEmpty.setText(getString(R.string.gestures_error_loading, - mStoreFile.getAbsolutePath())); + SettingsUtil.getGestureFile(mThis).getAbsolutePath())); } else { findViewById(R.id.addButton).setEnabled(true); findViewById(R.id.reloadButton).setEnabled(true); diff --git a/src/us/minak/SettingsUtil.java b/src/us/minak/SettingsUtil.java new file mode 100644 index 0000000..c3c0603 --- /dev/null +++ b/src/us/minak/SettingsUtil.java @@ -0,0 +1,22 @@ +package us.minak; + +import android.content.ContextWrapper; +import android.gesture.GestureLibrary; +import android.gesture.GestureLibraries; +import java.io.File; + +public class SettingsUtil { + private static File sGestureFile = null; + private static GestureLibrary sGestureLibrary = null; + + public static File getGestureFile(ContextWrapper context) { + if (sGestureFile == null) + sGestureFile = new File(context.getExternalFilesDir(null), "gestures.ttf"); + return sGestureFile; + } + public static GestureLibrary getGestureLibrary(ContextWrapper context) { + if (sGestureLibrary == null) + sGestureLibrary = GestureLibraries.fromFile(getGestureFile(context)); + return sGestureLibrary; + } +} |