public static final int simple_list_item_2=0x7f030008;
}
public static final class string {
- public static final int action_settings=0x7f060032;
- public static final int add=0x7f06000a;
- public static final int andmode=0x7f060008;
+ public static final int action_settings=0x7f060033;
+ public static final int add=0x7f06000b;
+ public static final int andmode=0x7f060009;
public static final int app_name=0x7f060001;
- public static final int bheight=0x7f06001c;
- public static final int calculating=0x7f060017;
- public static final int cancel=0x7f06000d;
- public static final int close=0x7f06000e;
- public static final int common_settings=0x7f060014;
- public static final int create=0x7f060016;
- public static final int delete=0x7f06000c;
- public static final int error_unexpected=0x7f060027;
- public static final int generate=0x7f06001f;
- public static final int handling=0x7f060011;
- public static final int height=0x7f060012;
- public static final int hello_world=0x7f060033;
- public static final int help=0x7f060006;
+ public static final int bheight=0x7f06001d;
+ public static final int calculating=0x7f060018;
+ public static final int cancel=0x7f06000e;
+ public static final int close=0x7f06000f;
+ public static final int common_settings=0x7f060015;
+ public static final int create=0x7f060017;
+ public static final int delete=0x7f06000d;
+ public static final int error_unexpected=0x7f060028;
+ public static final int generate=0x7f060020;
+ public static final int handling=0x7f060012;
+ public static final int height=0x7f060013;
+ public static final int hello_world=0x7f060034;
+ public static final int help=0x7f060007;
public static final int help1=0x7f060002;
public static final int help2=0x7f060003;
public static final int help3=0x7f060004;
public static final int help4=0x7f060005;
- public static final int hold=0x7f060013;
+ public static final int help5=0x7f060006;
+ public static final int hold=0x7f060014;
public static final int lang=0x7f060000;
- public static final int list0_1=0x7f060029;
- public static final int list0_2=0x7f06002a;
- public static final int list0_3=0x7f06002b;
- public static final int list0_4=0x7f06002c;
- public static final int list0_5=0x7f06002d;
- public static final int list0_6=0x7f06002e;
- public static final int list0_7=0x7f06002f;
- public static final int list0_8=0x7f060030;
- public static final int load=0x7f060009;
- public static final int message_delete_pattern=0x7f060023;
- public static final int message_delete_patternfile=0x7f060024;
- public static final int message_nopattern=0x7f060026;
- public static final int normal=0x7f060019;
- public static final int number=0x7f06001b;
- public static final int orgmode=0x7f060007;
- public static final int patternFileTitle=0x7f060025;
- public static final int patternMax=0x7f06001e;
- public static final int patternTypes=0x7f060018;
- public static final int pattern_name=0x7f06000f;
- public static final int period=0x7f06001d;
- public static final int save=0x7f06000b;
- public static final int siteswap=0x7f060010;
- public static final int siteswap_error=0x7f060028;
- public static final int speed=0x7f060015;
- public static final int synchronization=0x7f06001a;
- public static final int title_activity_pattern_list=0x7f060031;
- public static final int title_delete=0x7f060022;
- public static final int title_system_error=0x7f060021;
- public static final int update=0x7f060020;
+ public static final int list0_1=0x7f06002a;
+ public static final int list0_2=0x7f06002b;
+ public static final int list0_3=0x7f06002c;
+ public static final int list0_4=0x7f06002d;
+ public static final int list0_5=0x7f06002e;
+ public static final int list0_6=0x7f06002f;
+ public static final int list0_7=0x7f060030;
+ public static final int list0_8=0x7f060031;
+ public static final int load=0x7f06000a;
+ public static final int message_delete_pattern=0x7f060024;
+ public static final int message_delete_patternfile=0x7f060025;
+ public static final int message_nopattern=0x7f060027;
+ public static final int normal=0x7f06001a;
+ public static final int number=0x7f06001c;
+ public static final int orgmode=0x7f060008;
+ public static final int patternFileTitle=0x7f060026;
+ public static final int patternMax=0x7f06001f;
+ public static final int patternTypes=0x7f060019;
+ public static final int pattern_name=0x7f060010;
+ public static final int period=0x7f06001e;
+ public static final int save=0x7f06000c;
+ public static final int siteswap=0x7f060011;
+ public static final int siteswap_error=0x7f060029;
+ public static final int speed=0x7f060016;
+ public static final int synchronization=0x7f06001b;
+ public static final int title_activity_pattern_list=0x7f060032;
+ public static final int title_delete=0x7f060023;
+ public static final int title_system_error=0x7f060022;
+ public static final int update=0x7f060021;
}
}
android:id="@+id/textView91"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:layout_margin="5dp"
- android:textSize="14dp"
+ android:textSize="14sp"
>
</TextView>
<TextView
android:id="@+id/textView92"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:layout_margin="5dp"
- android:textSize="14dp"
+ android:textSize="14sp"
>
</TextView>
<TextView
android:id="@+id/textView93"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:layout_margin="5dp"
- android:textSize="14dp"
+ android:textSize="14sp"
>
</TextView>
<TextView
android:id="@+id/textView94"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:layout_margin="5dp"
- android:textSize="14dp"
- android:layout_weight="1"
+ android:textSize="14sp"
>
</TextView>
<TextView
android:text=""
android:id="@+id/textView95"
- android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:layout_width="fill_parent"
+ android:layout_height="0dp"
android:layout_margin="5dp"
- android:textSize="14dp"
+ android:textSize="14sp"
android:layout_weight="1"
>
</TextView>
<ListView
android:id="@+id/patternList"
android:layout_width="wrap_content"
- android:layout_height="wrap_content"
+ android:layout_height="0dp"
android:layout_weight="1" >
</ListView>
<string name="help2">●You can create a new figure by going into the menu [7] My patterns</string>
<string name="help3">●You can generate patterns by going to the menu [8] generator patterns</string>
<string name="help4">●You can change your point of view by draging the juggler</string>
+ <string name="help5">●メニューから「オリジナルモード」を選択後、「パターンファイル選択」を選択する事で、パターンファイルの変更、追加ができます。</string>
<string name="help">Help</string>
<string name="orgmode">オリジナルモード</string>
<string name="andmode">Androidモード</string>
getString(R.string.help2),\r
getString(R.string.help3),\r
getString(R.string.help4),\r
- ""\r
+ getString(R.string.help5)\r
};\r
int i = 0;\r
if (DaoFactory.getInstance().getMode() == DaoFactory.Mode.ORIGINAL){\r
textViews[i++].setText(messages[1]);\r
textViews[i++].setText(messages[2]);\r
textViews[i++].setText(messages[3]); \r
+ textViews[i++].setText(messages[4]); \r
}\r
\r
textView1.setText(getString(R.string.help1));\r
import com.jm.db.IDao;\r
import com.jm.opengl.JuggleDrawer;\r
import com.jm.opengl.OpenGLActivityBase;\r
+import com.jm.utility.Debug;\r
import com.jm.utility.JmException;\r
import com.jm.utility.Resource;\r
\r
drawer = new JuggleDrawer(this, jp);\r
drawer.clear();\r
} catch (JmException e) {\r
- showDialog(this, e);\r
+ Debug.d(this, e.getMessage());\r
+ finish();\r
} catch (Exception e) {\r
- showDialog(this, e);\r
+ Debug.d(this, e.getMessage());\r
+ finish();\r
}\r
}\r
\r
private JuggleDrawer drawer;\r
private Body body;\r
private JugglingBalls balls;\r
- private SiteswapWriter siteswap;\r
+ //private SiteswapWriter siteswap;\r
\r
private SiteSwap site;\r
\r
throw new JmPatternException();\r
}\r
site = jp.getSiteSwap();\r
- siteswap = new SiteswapWriter(site);\r
+ //siteswap = new SiteswapWriter(site);\r
+ new SiteswapWriter(site);\r
}\r
\r
public void updateJuggler(){\r
AsyncTaskCommand command = new AsyncTaskCommand(this, idb,\r
getString(R.string.update), false);\r
command.execute((String[]) null);\r
- } else {\r
+ }\r
+ else {\r
JmDao jdao = JmDao.getInstance();\r
jdao.init(null, this);\r
}\r
\r
@Override\r
public boolean onCreateOptionsMenu(Menu menu) {\r
- menu.add(0, Menu.FIRST + 1, Menu.NONE, R.string.orgmode);\r
- menu.add(0, Menu.FIRST + 2, Menu.NONE, R.string.andmode);\r
- menu.add(0, Menu.FIRST + 3, Menu.NONE, R.string.load);\r
+ menu.add(0, Menu.FIRST + 1, Menu.NONE, R.string.orgmode).setIcon(\r
+ android.R.drawable.ic_menu_more);\r
+ menu.add(0, Menu.FIRST + 2, Menu.NONE, R.string.andmode).setIcon(\r
+ android.R.drawable.ic_menu_more);\r
+ menu.add(0, Menu.FIRST + 3, Menu.NONE, R.string.load).setIcon(\r
+ android.R.drawable.ic_menu_manage);\r
boolean ret = super.onCreateOptionsMenu(menu);\r
\r
return ret;\r
\r
public class SiteswapWriter {\r
\r
- private String[] siteswap;\r
- private int[] posX;\r
- private int counter;\r
+ //private String[] siteswap;\r
+ //private int[] posX;\r
+ //private int counter;\r
\r
public SiteswapWriter(SiteSwap siteswap)\r
{\r
- this.siteswap = siteswap.getStrings();\r
- this.counter = -1;\r
- this.posX = new int[this.siteswap.length];\r
+ //this.siteswap = siteswap.getStrings();\r
+ //this.counter = -1;\r
+ //this.posX = new int[this.siteswap.length];\r
}\r
- \r
-// private void initialize(JugglerCanvas jc) {\r
-// int l = 0;\r
-// for(int i = 0; i < siteswap.length; i++) {\r
-// posX[i] = l;\r
-// l += siteswap[i].length();\r
-// }\r
-// int width = jc.getWidth() / l;\r
-// if (width > Resource.charWidth()) width = Resource.charWidth();\r
-// int x = -width * l / 2;\r
-// for(counter = 0; counter < siteswap.length; counter++) {\r
-// posX[counter] = posX[counter] * width + x;\r
-// drawString(jc, Color.BLACK);\r
-// }\r
-// counter--;\r
-// }\r
-\r
-// public void drawSiteswap(JugglerCanvas jc) {\r
-// if (counter < 0) {\r
-// initialize(jc);\r
-// }\r
-//// edit {\r
-//// drawString(jc);\r
-// int counterBak = counter;\r
-// for(int i = 0; i < siteswap.length; i++) {\r
-// counter = i;\r
-// drawString(jc, Color.BLACK);\r
-// }\r
-// counter = counterBak;\r
-//// }\r
-// jc.setEmphasisColor();\r
-// counter = (counter + 1) % siteswap.length;\r
-// drawString(jc, Color.RED);\r
-// jc.setForegroundColor();\r
-// }\r
- \r
-// private void drawString(JugglerCanvas jc, int color) {\r
-//// edit {\r
-//// jc.drawString(siteswap[counter], posX[counter], 1, Graphics.TOP|Graphics.LEFT);\r
-// jc.drawString(siteswap[counter], posX[counter], Resource.charHeight() + 2, 0, color);\r
-//// }\r
-// }\r
}
\ No newline at end of file
public boolean getConvFlag1to2() {\r
return convFlag1to2;\r
}\r
+\r
+ public boolean getConvFlag2to3() {\r
+ return convFlag2to3;\r
+ }\r
+\r
public void setLangId(int id) {\r
langId = id;\r
}\r
import com.jm.PatternList;
import com.jm.utility.AsyncTaskIF;
+import com.jm.utility.Debug;
import com.jm.utility.JmException;
public class InitDB implements AsyncTaskIF {
+ private Context context;
+
public InitDB(Context context) {
- //this.context = context;
+ this.context = context;
}
@Override
public void doExecute() {
DatabaseHelper helper = DatabaseHelper.getInstance();
PatternList p = new PatternList();
- SQLiteDatabase db = helper.getWritableDatabase();
+ boolean convFlag1to2 = helper.getConvFlag1to2();
+ //boolean convFlag2to3 = helper.getConvFlag2to3();
+
+ SQLiteDatabase db = helper.getWritableDatabase();
try {
helper.setLangId(DatabaseHelper.NONE_ID);
int langId = helper.getLangId();
db.beginTransaction();
- boolean convFlag1to2 = helper.getConvFlag1to2();
+ Dao dao = Dao.getInstance();
+ int count = dao.countAll();
+
+// if (helper.getConvFlag()){
+// // 1to2 or 2to3
+// helper.convert(db, langId);
+// Dao.getInstance().start(db);
+//
+// // 1to2
+// helper.setLangId(DatabaseHelper.JAPANEASE_ID);
+// p.update();
+// }
+// else {
+// // 0件 and 2
+// helper.setLangId(DatabaseHelper.JAPANEASE_ID);
+// p.create(DatabaseHelper.JAPANEASE_ID);
+// }
+
if (helper.getConvFlag()){
+ // 1to2 or 2to3
helper.convert(db, langId);
Dao.getInstance().start(db);
}
-
if (convFlag1to2){
- if (helper.getConvFlag()){
- helper.setLangId(DatabaseHelper.JAPANEASE_ID);
- p.update();
- }
- else {
+ // 1to2
+ helper.setLangId(DatabaseHelper.JAPANEASE_ID);
+ p.update();
+ }
+
+ if (count <= 0 || convFlag1to2){
+ if (count <= 0){
+ // 0件 and 2
helper.setLangId(DatabaseHelper.JAPANEASE_ID);
p.create(DatabaseHelper.JAPANEASE_ID);
}
-
+
+ // (0件 and 2) or 1to2
helper.setLangId(DatabaseHelper.ENGLISH_ID);
p.create(DatabaseHelper.ENGLISH_ID);
db.setTransactionSuccessful();
} catch (JmException e) {
// 失敗
+ Debug.d(this, null, e);
+ return;
} finally {
db.endTransaction();
}
- helper.setLangId(DatabaseHelper.NONE_ID);
+ helper.setLangId(DatabaseHelper.NONE_ID);
+
+ JmDao jdao = JmDao.getInstance();
+ jdao.init(null, context);
}
@Override
list = new ArrayList<String>();\r
char[] p = StdLib.stoc(period);\r
\r
- int count = GetSiteswap(gs, list, balls, p);\r
+ //int count = GetSiteswap(gs, list, balls, p);\r
+ GetSiteswap(gs, list, balls, p);\r
return list;\r
}\r
\r
toArray(motionBuffer));
pattern.add(p);
break;
+ default:
+ break;
}
break;
case CALL_STYLE:
break;
}
break;
+ default:
+ break;
}
// System.out.println(status + " " + t + "\t" + line + "\t" + sSkip);
}
\r
public class BaseActivity extends Activity {\r
@Override\r
- public void onCreate(Bundle savedInstanceState) {\r
- super.onCreate(savedInstanceState);\r
+ public void onCreate(Bundle savedInstanceState) {\r
+ super.onCreate(savedInstanceState);\r
Debug.d(this, Debug.ON_CREATE);\r
\r
- try {\r
+ try {\r
DatabaseHelper.init(getApplicationContext());\r
} catch (JmException e) {\r
terminate(e);\r
}\r
- }\r
- \r
- @Override\r
+ }\r
+\r
+ @Override\r
protected void onActivityResult(int requestCode, int resultCode, Intent data) {\r
- super.onActivityResult(requestCode, resultCode, data);\r
+ super.onActivityResult(requestCode, resultCode, data);\r
}\r
- \r
- @Override\r
+\r
+ @Override\r
protected void onRestart() {\r
super.onRestart();\r
Debug.d(this, Debug.ON_RESTART);\r
Debug.d(this, Debug.ON_STOP);\r
}\r
\r
- @Override\r
+ @Override\r
protected void onDestroy() {\r
super.onDestroy();\r
Debug.d(this, Debug.ON_DESTROY);\r
@Override\r
public boolean onCreateOptionsMenu(Menu menu) {\r
boolean ret = super.onCreateOptionsMenu(menu);\r
- menu.add(0, Menu.FIRST, Menu.NONE, R.string.help);\r
+ menu.add(0, Menu.FIRST, Menu.NONE, R.string.help).setIcon(\r
+ android.R.drawable.ic_menu_help);\r
return ret;\r
}\r
- \r
- @Override\r
- public boolean onOptionsItemSelected(MenuItem item) {\r
- try {\r
- Intent intent = new Intent(this, (Class<?>)Help.class);\r
+\r
+ @Override\r
+ public boolean onOptionsItemSelected(MenuItem item) {\r
+ try {\r
+ Intent intent = new Intent(this, (Class<?>) Help.class);\r
startActivity(intent);\r
- }\r
- catch (Exception e){\r
+ } catch (Exception e) {\r
terminate(e);\r
- }\r
+ }\r
return super.onOptionsItemSelected(item);\r
- }\r
+ }\r
\r
@Override\r
public boolean dispatchKeyEvent(KeyEvent event) {\r
}\r
return super.dispatchKeyEvent(event);\r
}\r
- \r
+\r
protected void setFullscreen() {\r
- requestWindowFeature(Window.FEATURE_NO_TITLE);\r
- getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,\r
- WindowManager.LayoutParams.FLAG_FULLSCREEN);\r
- }\r
- \r
+ requestWindowFeature(Window.FEATURE_NO_TITLE);\r
+ getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,\r
+ WindowManager.LayoutParams.FLAG_FULLSCREEN);\r
+ }\r
+\r
protected void showDialog(String title, String msg, final boolean isFinish) {\r
- new AlertDialog.Builder(this).setTitle(title).setMessage(msg)\r
- .setNeutralButton(android.R.string.ok, new DialogInterface.OnClickListener() {\r
- public void onClick(DialogInterface dialog, int whichButton) {\r
- if (isFinish){\r
- finish();\r
- }\r
- }\r
- }).show();\r
+ new AlertDialog.Builder(this)\r
+ .setTitle(title)\r
+ .setMessage(msg)\r
+ .setNeutralButton(android.R.string.ok,\r
+ new DialogInterface.OnClickListener() {\r
+ public void onClick(DialogInterface dialog,\r
+ int whichButton) {\r
+ if (isFinish) {\r
+ finish();\r
+ }\r
+ }\r
+ }).show();\r
}\r
\r
protected void showDialog(String title, String msg) {\r
}\r
\r
protected void showDialog(Object target, Throwable t) {\r
- if (t != null){\r
- Debug.d(target, null, t);\r
- }\r
+ if (t != null) {\r
+ Debug.d(target, null, t);\r
+ }\r
showDialog(getString(R.string.title_system_error),\r
getString(R.string.error_unexpected));\r
}\r
\r
- public void terminate(Throwable t){\r
- if (t != null){\r
- Debug.d(this, null, t);\r
- }\r
- moveTaskToBack(true);\r
- }\r
+ public void terminate(Throwable t) {\r
+ if (t != null) {\r
+ Debug.d(this, null, t);\r
+ }\r
+ moveTaskToBack(true);\r
+ }\r
}\r