Commit e2ddc8a9 by Kim Jinsung

ソースコードレビュー指摘事項修正

端末電源ONの時自動起動処理追加
parent cee93dce
...@@ -10,3 +10,4 @@ ...@@ -10,3 +10,4 @@
.idea/modules.xml .idea/modules.xml
.idea/misc.xml .idea/misc.xml
.idea/vcs.xml .idea/vcs.xml
.idea/dictionaries/agentec.xml
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<application <application
android:name=".application.ToiletApplication" android:name=".application.ToiletApplication"
android:allowBackup="false" android:allowBackup="false"
...@@ -21,12 +21,25 @@ ...@@ -21,12 +21,25 @@
android:theme="@style/Theme.AppCompat.Light.NoActionBar.FullScreen"> android:theme="@style/Theme.AppCompat.Light.NoActionBar.FullScreen">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
<!-- The following two intent-filters are the key to set homescreen -->
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity android:name=".activity.SignageActivity" <activity android:name=".activity.SignageActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:theme="@style/Theme.AppCompat.Light.NoActionBar.FullScreen"/>
<activity android:name=".activity.ParentActivity"
android:configChanges="orientation|keyboardHidden|screenSize" android:configChanges="orientation|keyboardHidden|screenSize"
android:theme="@style/Theme.AppCompat.Light.NoActionBar.FullScreen"/> android:theme="@style/Theme.AppCompat.Light.NoActionBar.FullScreen"/>
<receiver android:name=".receiver.OnBootReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
</application> </application>
</manifest> </manifest>
\ No newline at end of file
...@@ -11,11 +11,10 @@ import android.widget.TextView; ...@@ -11,11 +11,10 @@ import android.widget.TextView;
import android.graphics.Typeface; import android.graphics.Typeface;
import android.widget.Toast; import android.widget.Toast;
import jp.odakyu.toiletsignage.R; import jp.odakyu.toiletsignage.R;
import jp.odakyu.toiletsignage.constants.ToiletConstants;
import jp.odakyu.toiletsignage.info.ToiletInfo; import jp.odakyu.toiletsignage.info.ToiletInfo;
import jp.odakyu.toiletsignage.logic.MainLogic; import jp.odakyu.toiletsignage.logic.MainLogic;
import jp.odakyu.toiletsignage.application.ToiletApplication; import jp.odakyu.toiletsignage.application.ToiletApplication;
import static java.lang.Boolean.FALSE;
import static java.lang.Boolean.TRUE;
/** /**
* An example full-screen activity that shows and hides the system UI (i.e. * An example full-screen activity that shows and hides the system UI (i.e.
...@@ -26,7 +25,6 @@ public class MainActivity extends ParentActivity { ...@@ -26,7 +25,6 @@ public class MainActivity extends ParentActivity {
private TextView mMessageTextView; private TextView mMessageTextView;
private final int REQUEST_PERMISSION = 1000; private final int REQUEST_PERMISSION = 1000;
private final int REQUEST_CODE = 1;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
...@@ -48,30 +46,26 @@ public class MainActivity extends ParentActivity { ...@@ -48,30 +46,26 @@ public class MainActivity extends ParentActivity {
} }
private void getUsbFileInfo() { private void getUsbFileInfo() {
MainLogic mainLogic = new MainLogic();
try { try {
mainLogic.getToiletDefaultInfo(this); int result = MainLogic.getToiletDefaultInfo(getApplicationContext());
if (!toiletInfo.getValidation()) { if (result == ToiletConstants.VALUE_GET_USB_INFO_VALIDATION_FAIL) {
mMessageTextView.setText(getString(R.string.initDisplayStringError, ToiletInfo.VALUE_DEFAULT_TOILET_VALIDATION_FAIL)); mMessageTextView.setText(getString(R.string.initDisplayStringError, ToiletInfo.VALUE_DEFAULT_TOILET_VALIDATION_FAIL));
Log.e(TAG, "ToiletDefaultJson validation fail"); Log.w(TAG, "USBToiletDefaultJson validation fail");
return; return;
} }
if (toiletInfo.getToiletDefaultJsonArray() == null && toiletInfo.getToiletDefaultJsonArray().size() == 0) { if (result == ToiletConstants.VALUE_GET_USB_INFO_FAIL) {
mMessageTextView.setText(getString(R.string.initDisplayStringError, ToiletInfo.VALUE_DEFAULT_TOILET_NULL)); mMessageTextView.setText(getString(R.string.initDisplayStringError, ToiletInfo.VALUE_DEFAULT_TOILET_NULL));
Log.e(TAG, "ToiletDefaultArray NULL"); Log.w(TAG, "ToiletDefaultArray NULL");
return; return;
} }
toiletInfo.setUsbFileCopyComplete(TRUE);
toiletInfo.setUsbFileCopyComplete(true);
ToiletApplication application = (ToiletApplication)this.getApplication(); ToiletApplication application = (ToiletApplication)this.getApplication();
application.startTimer(); application.startTimer();
} catch (Exception e) { } catch (Exception e) {
mMessageTextView.setText(getString(R.string.initDisplayStringError, ToiletInfo.VALUE_DEFAULT_TOILET_NULL)); mMessageTextView.setText(getString(R.string.initDisplayStringError, ToiletInfo.VALUE_DEFAULT_TOILET_NULL));
String stackTrace = Log.getStackTraceString(e); Log.e(TAG, e.getLocalizedMessage(), e);
Log.e(TAG, stackTrace);
e.printStackTrace();
} }
} }
...@@ -81,9 +75,9 @@ public class MainActivity extends ParentActivity { ...@@ -81,9 +75,9 @@ public class MainActivity extends ParentActivity {
if (ActivityCompat.checkSelfPermission(this, if (ActivityCompat.checkSelfPermission(this,
Manifest.permission.WRITE_EXTERNAL_STORAGE) == Manifest.permission.WRITE_EXTERNAL_STORAGE) ==
PackageManager.PERMISSION_GRANTED){ PackageManager.PERMISSION_GRANTED){
return TRUE; return true;
} }
return FALSE; return false;
} }
// 許可を求める // 許可を求める
...@@ -120,40 +114,12 @@ public class MainActivity extends ParentActivity { ...@@ -120,40 +114,12 @@ public class MainActivity extends ParentActivity {
} }
@Override @Override
protected void onResume() { protected void reloadDisplayView(final int errorCount, final boolean isNetworkConnect) {
Log.i(TAG, "onResume");
super.onResume();
}
@Override
protected void onPause() {
Log.i(TAG, "onPause");
super.onPause();
}
@Override
protected void onDestroy() {
Log.i(TAG, "onDestroy");
super.onDestroy();
}
@Override
protected void onStop() {
Log.i(TAG, "onStop");
super.onStop();
}
@Override
protected void onStart() {
Log.i(TAG, "onStart");
super.onStart();
}
@Override
protected void reloadDisplayView() {
Log.d(TAG, "reloadDisplayView"); Log.d(TAG, "reloadDisplayView");
mHandler.post(new Runnable() { runOnUiThread(new Runnable() {
@Override @Override
public void run() { public void run() {
if (toiletInfo.getConnectErrorCount() == 0) { if (errorCount == 0) {
if (toiletInfo.getToiletDefaultJsonArray().size() > 0 && toiletInfo.getResultToiletJsonMapSize() > 0) { if (toiletInfo.getToiletDefaultJsonArray().size() > 0 && toiletInfo.getResultToiletJsonMapSize() > 0) {
//Move Signage View //Move Signage View
Intent intent = new Intent(MainActivity.this, SignageActivity.class); Intent intent = new Intent(MainActivity.this, SignageActivity.class);
...@@ -163,7 +129,7 @@ public class MainActivity extends ParentActivity { ...@@ -163,7 +129,7 @@ public class MainActivity extends ParentActivity {
mMessageTextView.setText(getString(R.string.initDisplayStringError, ToiletInfo.VALUE_TOILET_SERVER_CONNECT_FAIL)); mMessageTextView.setText(getString(R.string.initDisplayStringError, ToiletInfo.VALUE_TOILET_SERVER_CONNECT_FAIL));
} }
} else { } else {
if (toiletInfo.getNetworkConnect()) { if (isNetworkConnect) {
mMessageTextView.setText(getString(R.string.initDisplayStringError, ToiletInfo.VALUE_NETWORK_DIS_CONNECT)); mMessageTextView.setText(getString(R.string.initDisplayStringError, ToiletInfo.VALUE_NETWORK_DIS_CONNECT));
} else { } else {
mMessageTextView.setText(getString(R.string.initDisplayStringError, ToiletInfo.VALUE_TOILET_SERVER_CONNECT_FAIL)); mMessageTextView.setText(getString(R.string.initDisplayStringError, ToiletInfo.VALUE_TOILET_SERVER_CONNECT_FAIL));
......
...@@ -6,13 +6,13 @@ import android.content.Intent; ...@@ -6,13 +6,13 @@ import android.content.Intent;
import android.content.IntentFilter; import android.content.IntentFilter;
import android.content.pm.ActivityInfo; import android.content.pm.ActivityInfo;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
import android.util.Log; import android.util.Log;
import android.view.View; import android.view.View;
import android.view.Window; import android.view.Window;
import jp.odakyu.toiletsignage.application.ToiletApplication; import jp.odakyu.toiletsignage.application.ToiletApplication;
import jp.odakyu.toiletsignage.constants.ToiletConstants;
import jp.odakyu.toiletsignage.info.ToiletInfo; import jp.odakyu.toiletsignage.info.ToiletInfo;
/** /**
...@@ -22,10 +22,9 @@ import jp.odakyu.toiletsignage.info.ToiletInfo; ...@@ -22,10 +22,9 @@ import jp.odakyu.toiletsignage.info.ToiletInfo;
public class ParentActivity extends AppCompatActivity { public class ParentActivity extends AppCompatActivity {
private static final String TAG = "ParentActivity"; private static final String TAG = "ParentActivity";
Handler mHandler;
ToiletInfo toiletInfo; ToiletInfo toiletInfo;
private BroadcastReceiver broadcastReceiver; private BroadcastReceiver broadcastReceiver;
private boolean isRunning;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
...@@ -41,9 +40,6 @@ public class ParentActivity extends AppCompatActivity { ...@@ -41,9 +40,6 @@ public class ParentActivity extends AppCompatActivity {
View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION |
View.SYSTEM_UI_FLAG_FULLSCREEN); View.SYSTEM_UI_FLAG_FULLSCREEN);
//BackgroundThreadからMainThread使用するため
mHandler = new Handler();
toiletInfo = ToiletInfo.getInstance(); toiletInfo = ToiletInfo.getInstance();
//BroadcastReceiver設定 //BroadcastReceiver設定
...@@ -51,50 +47,57 @@ public class ParentActivity extends AppCompatActivity { ...@@ -51,50 +47,57 @@ public class ParentActivity extends AppCompatActivity {
broadcastReceiver = new BroadcastReceiver() { broadcastReceiver = new BroadcastReceiver() {
@Override @Override
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {
reloadDisplayView(); //Main ActivityとSignage Activityが両方生きている時の対策で表示しているActivityのみ実行
if (isRunning) {
boolean isNetworkConnect = intent.getBooleanExtra(ToiletConstants.KEY_NETWORK_CONNECT,false);
int errorCount = intent.getIntExtra(ToiletConstants.KEY_ERROR_COUNT, -1);
reloadDisplayView(errorCount, isNetworkConnect);
}
} }
}; };
registerReceiver(broadcastReceiver, filter); registerReceiver(broadcastReceiver, filter);
} }
@Override @Override
protected void onResume() { public void finish() {
super.onResume(); super.finish();
}
@Override
protected void onDestroy() {
super.onDestroy();
unregisterReceiver(broadcastReceiver); unregisterReceiver(broadcastReceiver);
} }
@Override @Override
protected void onPause() {
super.onPause();
}
@Override
protected void onStop() { protected void onStop() {
super.onStop();
ToiletApplication application = (ToiletApplication) getApplication(); ToiletApplication application = (ToiletApplication) getApplication();
//アプリがバックグラウンドのなった時のみタスクを停止 //アプリがバックグラウンドのなった時のみタスクを停止
if (!application.isForegrdound(this)) { if (!application.isForeground(this)) {
Log.i(TAG, "Application Background"); Log.i(TAG, "Application Background");
application.stopTimer(); application.stopTimer();
} }
super.onStop();
} }
@Override @Override
protected void onStart() { protected void onStart() {
super.onStart();
ToiletApplication application = (ToiletApplication) getApplication(); ToiletApplication application = (ToiletApplication) getApplication();
//初回起動時以外はタスク開始(バックグラウンドからフォアグラウンド対応) //初回起動時以外はタスク開始(バックグラウンドからフォアグラウンド対応)
if (toiletInfo.getToiletDefaultJsonArray() != null) { if (toiletInfo.getToiletDefaultJsonArray() != null) {
application.startTimer(); application.startTimer();
} }
super.onStart(); }
@Override
protected void onResume() {
isRunning = true;
super.onResume();
}
@Override
protected void onPause() {
isRunning = false;
super.onPause();
} }
//Child Classから実装 //Child Classから実装
protected void reloadDisplayView() {} protected void reloadDisplayView(final int errorCount, final boolean isNetworkConnect) {}
} }
...@@ -2,13 +2,16 @@ package jp.odakyu.toiletsignage.application; ...@@ -2,13 +2,16 @@ package jp.odakyu.toiletsignage.application;
import android.app.ActivityManager; import android.app.ActivityManager;
import android.app.Application; import android.app.Application;
import android.content.ComponentName;
import android.content.Context; import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.util.Log; import android.util.Log;
import java.util.List; import java.util.List;
import java.util.Timer; import java.util.Timer;
import jp.odakyu.toiletsignage.activity.MainActivity;
import jp.odakyu.toiletsignage.task.UpdateToiletInfoTask; import jp.odakyu.toiletsignage.task.UpdateToiletInfoTask;
import static java.lang.Boolean.FALSE;
import static java.lang.Boolean.TRUE;
/** /**
* Created by agentec on 2017/12/13. * Created by agentec on 2017/12/13.
...@@ -24,18 +27,7 @@ public class ToiletApplication extends Application { ...@@ -24,18 +27,7 @@ public class ToiletApplication extends Application {
super.onCreate(); super.onCreate();
} }
private synchronized void settingToiletUpdateTimer() { public synchronized void stopTimer() {
Log.i(TAG, "settingToiletUpdateTimer");
if (updateToiletInfoTimer == null) {
Log.i(TAG, "settingToiletUpdateTimer Start");
updateToiletInfoTimer = new Timer();
// スケジュール開始と同時にすぐ新着更新を開始する
int interval = 10000; //10秒
updateToiletInfoTimer.schedule(new UpdateToiletInfoTask(this), 0, interval);
}
}
public void stopTimer() {
Log.i(TAG, "stopTimer"); Log.i(TAG, "stopTimer");
if (updateToiletInfoTimer != null) { if (updateToiletInfoTimer != null) {
Log.i(TAG, "stopTimer STOP"); Log.i(TAG, "stopTimer STOP");
...@@ -44,23 +36,31 @@ public class ToiletApplication extends Application { ...@@ -44,23 +36,31 @@ public class ToiletApplication extends Application {
} }
} }
public void startTimer() { public synchronized void startTimer() {
settingToiletUpdateTimer(); Log.i(TAG, "startTimer");
if (updateToiletInfoTimer == null) {
Log.i(TAG, "startTimer Start");
updateToiletInfoTimer = new Timer();
// スケジュール開始と同時にすぐ新着更新を開始する
int interval = 10000; //10秒
updateToiletInfoTimer.schedule(new UpdateToiletInfoTask(this), 0, interval);
}
} }
public boolean isForegrdound(Context context) { public boolean isForeground(Context context) {
ActivityManager am = (ActivityManager)getSystemService(Context.ACTIVITY_SERVICE); ActivityManager am = (ActivityManager)getSystemService(Context.ACTIVITY_SERVICE);
assert am != null;
List<ActivityManager.RunningAppProcessInfo> processInfoList = am.getRunningAppProcesses(); List<ActivityManager.RunningAppProcessInfo> processInfoList = am.getRunningAppProcesses();
boolean isForegrdound = FALSE; boolean isForeground = false;
for( ActivityManager.RunningAppProcessInfo info : processInfoList){ for( ActivityManager.RunningAppProcessInfo info : processInfoList){
if(info.processName.equals(getPackageName())){ if(info.processName.equals(getPackageName())){
if( info.importance == ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREGROUND){ if( info.importance == ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREGROUND){
isForegrdound = TRUE; isForeground = true;
break; break;
// ここにフォアグラウンドの場合の処理を実装 // ここにフォアグラウンドの場合の処理を実装
} }
} }
} }
return isForegrdound; return isForeground;
} }
} }
...@@ -3,6 +3,7 @@ package jp.odakyu.toiletsignage.connection; ...@@ -3,6 +3,7 @@ package jp.odakyu.toiletsignage.connection;
import android.util.Base64; import android.util.Base64;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.net.HttpURLConnection; import java.net.HttpURLConnection;
...@@ -16,10 +17,10 @@ public class ToiletServerConnection { ...@@ -16,10 +17,10 @@ public class ToiletServerConnection {
private static final String TOILET_INFO_URL = "https://odakyu.api.toilet.mono-connect.jp/1/placements/%d/box_summaries_search"; private static final String TOILET_INFO_URL = "https://odakyu.api.toilet.mono-connect.jp/1/placements/%d/box_summaries_search";
private static final String LOGIN_ID = "nh2h2KntNPpgXcqEAtcJxwJd49jNcJ4J"; private static final String LOGIN_ID = "nh2h2KntNPpgXcqEAtcJxwJd49jNcJ4J";
private static final String PASSWORD = "jm2kCd6ZK2EZTzcMgxtge3AC4EeJ4ZqW"; private static final String PASSWORD = "jm2kCd6ZK2EZTzcMgxtge3AC4EeJ4ZqW";
private static final int CONNECTION_TIMEOUT = 30 * 1000; private static final int CONNECTION_TIMEOUT = 5 * 1000;
private static final int READ_TIMEOUT = 30 * 1000; private static final int READ_TIMEOUT = 5 * 1000;
public String connectionToiletServer(int toiletId) throws Exception { public static String connectionToiletServer(int toiletId) throws IOException {
URL url = new URL(String.format(TOILET_INFO_URL, toiletId)); URL url = new URL(String.format(TOILET_INFO_URL, toiletId));
HttpURLConnection conn = (HttpURLConnection) url.openConnection(); HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setConnectTimeout(CONNECTION_TIMEOUT); conn.setConnectTimeout(CONNECTION_TIMEOUT);
...@@ -39,7 +40,7 @@ public class ToiletServerConnection { ...@@ -39,7 +40,7 @@ public class ToiletServerConnection {
} }
final InputStreamReader inReader = new InputStreamReader(in, encoding); final InputStreamReader inReader = new InputStreamReader(in, encoding);
final BufferedReader bufferedReader = new BufferedReader(inReader); final BufferedReader bufferedReader = new BufferedReader(inReader);
String line = null; String line;
while((line = bufferedReader.readLine()) != null) { while((line = bufferedReader.readLine()) != null) {
result.append(line); result.append(line);
} }
......
package jp.odakyu.toiletsignage.constants;
/**
* Created by agentec on 2017/12/14.
*/
public interface ToiletConstants {
String KEY_ERROR_COUNT = "error_count";
String KEY_NETWORK_CONNECT = "network_connect";
int VALUE_GET_USB_INFO_SUCCESS = 0;
int VALUE_GET_USB_INFO_VALIDATION_FAIL = -1;
int VALUE_GET_USB_INFO_FAIL = -2;
int VALUE_TOILET_GATE_TYPE_0 = 0;
int VALUE_TOILET_GATE_TYPE_1 = 1;
int VALUE_TOILET_GATE_TYPE_3 = 3;
String MEIRIO_FONT_NAME = "meiryo.ttf";
String MEIRIO_BOLD_FONT_NAME = "meiryob.ttf";
}
...@@ -14,10 +14,10 @@ import java.io.InputStreamReader; ...@@ -14,10 +14,10 @@ import java.io.InputStreamReader;
public class FileUtil { public class FileUtil {
private static String convertStreamToString(InputStream is) throws Exception { private static String convertStreamToString(InputStream is) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(is)); BufferedReader reader = new BufferedReader(new InputStreamReader(is));
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
String line = null; String line;
while ((line = reader.readLine()) != null) { while ((line = reader.readLine()) != null) {
sb.append(line).append("\n"); sb.append(line).append("\n");
} }
...@@ -25,7 +25,7 @@ public class FileUtil { ...@@ -25,7 +25,7 @@ public class FileUtil {
return sb.toString(); return sb.toString();
} }
public static String getStringFromFile (String filePath) throws Exception { public static String getStringFromFile (String filePath) throws IOException {
File fl = new File(filePath); File fl = new File(filePath);
FileInputStream fin = new FileInputStream(fl); FileInputStream fin = new FileInputStream(fl);
String ret = convertStreamToString(fin); String ret = convertStreamToString(fin);
......
...@@ -4,8 +4,9 @@ import java.util.ArrayList; ...@@ -4,8 +4,9 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import jp.odakyu.toiletsignage.constants.ToiletConstants;
import jp.odakyu.toiletsignage.json.ResultToiletJson; import jp.odakyu.toiletsignage.json.ResultToiletJson;
import jp.odakyu.toiletsignage.json.ToiletDefaultJson; import jp.odakyu.toiletsignage.json.USBToiletDefaultJson;
/** /**
* Created by agentec on 2017/12/11. * Created by agentec on 2017/12/11.
...@@ -29,14 +30,13 @@ public class ToiletInfo { ...@@ -29,14 +30,13 @@ public class ToiletInfo {
public static final int MAX_ERROR_COUNT = 6; public static final int MAX_ERROR_COUNT = 6;
private ArrayList<ToiletDefaultJson> mToiletDefaultJsonArray; private ArrayList<USBToiletDefaultJson> mToiletDefaultJsonArray;
private Map<Integer, ArrayList<ResultToiletJson>> mResultToiletJsonMap = new HashMap<Integer, ArrayList<ResultToiletJson>>(); private Map<Integer, ArrayList<ResultToiletJson>> mResultToiletJsonMap = new HashMap<>();
private boolean isValidation = false; private boolean isValidation = false;
private boolean isUsbFileCopyComplete = false; private boolean isUsbFileCopyComplete = false;
private int mConnectErrorCount = 0; private int mConnectErrorCount = 0;
private boolean isNetworkConnect = false; private boolean isNetworkConnect = false;
public static synchronized ToiletInfo getInstance() { public static synchronized ToiletInfo getInstance() {
if (instance == null) { if (instance == null) {
instance = new ToiletInfo(); instance = new ToiletInfo();
...@@ -44,11 +44,11 @@ public class ToiletInfo { ...@@ -44,11 +44,11 @@ public class ToiletInfo {
return instance; return instance;
} }
public void setToiletDefaultJsonArray(ArrayList<ToiletDefaultJson> defaultToiletJsonArray) { public void setToiletDefaultJsonArray(ArrayList<USBToiletDefaultJson> defaultToiletJsonArray) {
mToiletDefaultJsonArray = defaultToiletJsonArray; mToiletDefaultJsonArray = defaultToiletJsonArray;
} }
public ArrayList<ToiletDefaultJson> getToiletDefaultJsonArray() { public ArrayList<USBToiletDefaultJson> getToiletDefaultJsonArray() {
return mToiletDefaultJsonArray; return mToiletDefaultJsonArray;
} }
...@@ -70,14 +70,14 @@ public class ToiletInfo { ...@@ -70,14 +70,14 @@ public class ToiletInfo {
public int getToiletSex() { public int getToiletSex() {
if (mToiletDefaultJsonArray != null && mToiletDefaultJsonArray.size() > 0) { if (mToiletDefaultJsonArray != null && mToiletDefaultJsonArray.size() > 0) {
ToiletDefaultJson toiletDefaultJson = mToiletDefaultJsonArray.get(0); USBToiletDefaultJson toiletDefaultJson = mToiletDefaultJsonArray.get(0);
return toiletDefaultJson.getToiletSex(); return toiletDefaultJson.getToiletSex();
} }
return -1; return -1;
} }
public int getVacantCount(int toiletId) { public int getVacantCount(int toiletId) {
if (mResultToiletJsonMap != null && mResultToiletJsonMap.size() > 0) { if (mResultToiletJsonMap.size() > 0) {
ArrayList<ResultToiletJson> resultToiletJsonArray = getResultToiletJsonMap(toiletId); ArrayList<ResultToiletJson> resultToiletJsonArray = getResultToiletJsonMap(toiletId);
int vacantCount = 0; int vacantCount = 0;
for (ResultToiletJson resultToiletJson:resultToiletJsonArray) { for (ResultToiletJson resultToiletJson:resultToiletJsonArray) {
...@@ -91,11 +91,11 @@ public class ToiletInfo { ...@@ -91,11 +91,11 @@ public class ToiletInfo {
} }
public int getTotalCount(int toiletId) { public int getTotalCount(int toiletId) {
if (mResultToiletJsonMap != null && mResultToiletJsonMap.size() > 0) { if (mResultToiletJsonMap.size() > 0) {
ArrayList<ResultToiletJson> resultToiletJsonArray = getResultToiletJsonMap(toiletId); ArrayList<ResultToiletJson> resultToiletJsonArray = getResultToiletJsonMap(toiletId);
return resultToiletJsonArray.size(); return resultToiletJsonArray.size();
} }
return 0; return -1;
} }
public void setValidation(boolean validation) { public void setValidation(boolean validation) {
...@@ -129,4 +129,11 @@ public class ToiletInfo { ...@@ -129,4 +129,11 @@ public class ToiletInfo {
public boolean getNetworkConnect() { public boolean getNetworkConnect() {
return isNetworkConnect; return isNetworkConnect;
} }
public int getToiletGateType() {
if (mToiletDefaultJsonArray == null) {
return ToiletConstants.VALUE_TOILET_GATE_TYPE_0;
}
return mToiletDefaultJsonArray.size();
}
} }
...@@ -3,14 +3,13 @@ package jp.odakyu.toiletsignage.json; ...@@ -3,14 +3,13 @@ package jp.odakyu.toiletsignage.json;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
import static java.lang.Boolean.FALSE; import jp.odakyu.toiletsignage.info.ToiletInfo;
import static java.lang.Boolean.TRUE;
/** /**
* Created by agentec on 2017/12/08. * Created by agentec on 2017/12/08.
*/ */
public class ToiletDefaultJson { public class USBToiletDefaultJson {
/** /**
* JSON Param * JSON Param
*/ */
...@@ -41,7 +40,7 @@ public class ToiletDefaultJson { ...@@ -41,7 +40,7 @@ public class ToiletDefaultJson {
} }
public ToiletDefaultJson(JSONObject jsonObject) throws JSONException { public USBToiletDefaultJson(JSONObject jsonObject) throws JSONException {
priority = jsonObject.getInt(KEY_PRIORITY); priority = jsonObject.getInt(KEY_PRIORITY);
toiletId = jsonObject.getInt(KEY_TOILET_ID); toiletId = jsonObject.getInt(KEY_TOILET_ID);
toiletSex = jsonObject.getInt(KEY_TOILET_SEX); toiletSex = jsonObject.getInt(KEY_TOILET_SEX);
...@@ -57,33 +56,27 @@ public class ToiletDefaultJson { ...@@ -57,33 +56,27 @@ public class ToiletDefaultJson {
public boolean validation(JSONObject jsonObject) { public boolean validation(JSONObject jsonObject) {
if (!jsonObject.has(KEY_PRIORITY)) { if (!jsonObject.has(KEY_PRIORITY)) {
return FALSE; return false;
} }
if (!jsonObject.has(KEY_TOILET_ID)) { if (!jsonObject.has(KEY_TOILET_ID)) {
return FALSE; return false;
} }
if (!jsonObject.has(KEY_TOILET_SEX)) { if (!jsonObject.has(KEY_TOILET_SEX)) {
return FALSE; return false;
} }
if (getToiletId() < 0 || getToiletId() > 1000000) { if (getToiletId() < 0 || getToiletId() > 1000000) {
return FALSE; return false;
} }
if (getToiletSex() != 0 && getToiletSex() != 1) { if (getToiletSex() != ToiletInfo.VALUE_SEX_MAN && getToiletSex() != ToiletInfo.VALUE_SEX_WOMAN) {
return FALSE; return false;
} }
if (getToiletSex() != 0 && getToiletSex() != 1) { return !(getPriority() != ToiletInfo.VALUE_PRIORITY_MAIN &&
return FALSE; getPriority() != ToiletInfo.VALUE_PRIORITY_SUB_LEFT &&
} getPriority() != ToiletInfo.VALUE_PRIORITY_SUB_RIGHT);
if (getPriority() != 0 && getPriority() != 1 && getPriority() != 2) {
return FALSE;
}
return TRUE;
} }
} }
...@@ -5,6 +5,7 @@ import android.os.Environment; ...@@ -5,6 +5,7 @@ import android.os.Environment;
import android.util.Log; import android.util.Log;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
import java.io.File; import java.io.File;
...@@ -12,11 +13,10 @@ import java.io.IOException; ...@@ -12,11 +13,10 @@ import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import jp.odakyu.toiletsignage.constants.ToiletConstants;
import jp.odakyu.toiletsignage.file.FileUtil; import jp.odakyu.toiletsignage.file.FileUtil;
import jp.odakyu.toiletsignage.info.ToiletInfo; import jp.odakyu.toiletsignage.info.ToiletInfo;
import jp.odakyu.toiletsignage.json.ToiletDefaultJson; import jp.odakyu.toiletsignage.json.USBToiletDefaultJson;
import static java.lang.Boolean.FALSE;
/** /**
* Created by agentec on 2017/12/08. * Created by agentec on 2017/12/08.
...@@ -27,7 +27,18 @@ public class MainLogic { ...@@ -27,7 +27,18 @@ public class MainLogic {
private static final String KEY_TOILET_ARRAY = "toiletArray"; private static final String KEY_TOILET_ARRAY = "toiletArray";
private static final String TAG = "MainLogic"; private static final String TAG = "MainLogic";
public void getToiletDefaultInfo(Context context) throws Exception { /**
* USBドライブからトイレ情報ファイルを外部ストレージ「Download」フォルダにコピー
* @param context ToiletApplication Context
* @return VALUE_GET_USB_INFO_SUCCESS:成功、
* VALUE_GET_USB_INFO_VALIDATION_FAIL:バリデーションチェック失敗
* VALUE_GET_USB_INFO_FAIL:トイレ情報ファイル取得失敗
*
* @throws IOException Fileオブジェクト取得及びコピー時の例外
* @throws JSONException Json情報取得からの例外
*
*/
public static int getToiletDefaultInfo(Context context) throws IOException, JSONException {
String []rootStorageDirectory = getExtSdCardPathsForActivity(context); String []rootStorageDirectory = getExtSdCardPathsForActivity(context);
File downloadFilePath = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS); File downloadFilePath = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);
...@@ -42,17 +53,17 @@ public class MainLogic { ...@@ -42,17 +53,17 @@ public class MainLogic {
FileUtil.fileCopy(jsonFilePath, copyFilePath); FileUtil.fileCopy(jsonFilePath, copyFilePath);
break; break;
} else { } else {
Log.e(TAG, "usb json file not exists = " + jsonFilePath); Log.w(TAG, "usb json file not exists = " + jsonFilePath);
} }
} }
if (new File(copyFilePath).exists()) { if (new File(copyFilePath).exists()) {
JSONObject jsonObject = new JSONObject(FileUtil.getStringFromFile(copyFilePath)); JSONObject jsonObject = new JSONObject(FileUtil.getStringFromFile(copyFilePath));
JSONArray jsonArray = jsonObject.getJSONArray(KEY_TOILET_ARRAY); JSONArray jsonArray = jsonObject.getJSONArray(KEY_TOILET_ARRAY);
ArrayList<ToiletDefaultJson> toiletDefaultJsonArray = new ArrayList<ToiletDefaultJson>(); ArrayList<USBToiletDefaultJson> toiletDefaultJsonArray = new ArrayList<>();
boolean isValidation = FALSE; boolean isValidation = false;
for (int i = 0; i < jsonArray.length(); i++){ for (int i = 0; i < jsonArray.length(); i++){
ToiletDefaultJson toiletDefaultJson = new ToiletDefaultJson(jsonArray.getJSONObject(i)); USBToiletDefaultJson toiletDefaultJson = new USBToiletDefaultJson(jsonArray.getJSONObject(i));
isValidation = toiletDefaultJson.validation(jsonArray.getJSONObject(i)); isValidation = toiletDefaultJson.validation(jsonArray.getJSONObject(i));
if (isValidation) { if (isValidation) {
...@@ -61,15 +72,25 @@ public class MainLogic { ...@@ -61,15 +72,25 @@ public class MainLogic {
break; break;
} }
} }
ToiletInfo.getInstance().setValidation(isValidation); if (!isValidation) {
if (toiletDefaultJsonArray.size() != 0 && isValidation) { return ToiletConstants.VALUE_GET_USB_INFO_VALIDATION_FAIL;
}
if (toiletDefaultJsonArray.size() != 0) {
ToiletInfo.getInstance().setToiletDefaultJsonArray(toiletDefaultJsonArray); ToiletInfo.getInstance().setToiletDefaultJsonArray(toiletDefaultJsonArray);
} else {
return ToiletConstants.VALUE_GET_USB_INFO_FAIL;
} }
} }
return ToiletConstants.VALUE_GET_USB_INFO_SUCCESS;
} }
/**
* 外部ストレージのパス情報を取得
* @param context ToiletApplication Context
* @return Storage直下のPath List
*/
private static String[] getExtSdCardPathsForActivity(Context context) { private static String[] getExtSdCardPathsForActivity(Context context) {
List<String> paths = new ArrayList<>(); List<String> pathList = new ArrayList<>();
for (File file : context.getExternalFilesDirs("external")) { for (File file : context.getExternalFilesDirs("external")) {
if (file != null) { if (file != null) {
int index = file.getAbsolutePath().lastIndexOf("/Android/data"); int index = file.getAbsolutePath().lastIndexOf("/Android/data");
...@@ -78,15 +99,17 @@ public class MainLogic { ...@@ -78,15 +99,17 @@ public class MainLogic {
} else { } else {
String path = file.getAbsolutePath().substring(0, index); String path = file.getAbsolutePath().substring(0, index);
try { try {
path = new File(path).getCanonicalPath(); String canonicalPath = new File(path).getCanonicalPath();
pathList.add(canonicalPath);
} catch (IOException e) { } catch (IOException e) {
// Keep non-canonical path. // Keep non-canonical path.
Log.e(TAG, e.getLocalizedMessage(), e);
} }
paths.add(path);
} }
} }
} }
if (paths.isEmpty()) paths.add("/storage/sdcard1"); if (pathList.isEmpty()) pathList.add("/storage/sdcard1");
return paths.toArray(new String[0]); return pathList.toArray(new String[0]);
} }
} }
package jp.odakyu.toiletsignage.receiver;
import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.util.Log;
import java.util.Calendar;
import jp.odakyu.toiletsignage.activity.MainActivity;
/**
* 端末の電源がONしたときに自動的にアプリを起動させるレシーバー
* Created by agentec on 2017/12/18.
*/
public class OnBootReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED)) {
if (intent != null) {
Intent i = new Intent(context, MainActivity.class);
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(i);
}
}
}
}
...@@ -8,18 +8,14 @@ import android.util.Log; ...@@ -8,18 +8,14 @@ import android.util.Log;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONObject; import org.json.JSONObject;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.TimerTask; import java.util.TimerTask;
import jp.odakyu.toiletsignage.connection.ToiletServerConnection; import jp.odakyu.toiletsignage.connection.ToiletServerConnection;
import jp.odakyu.toiletsignage.constants.ToiletConstants;
import jp.odakyu.toiletsignage.info.ToiletInfo; import jp.odakyu.toiletsignage.info.ToiletInfo;
import jp.odakyu.toiletsignage.json.ResultToiletJson; import jp.odakyu.toiletsignage.json.ResultToiletJson;
import jp.odakyu.toiletsignage.json.ToiletDefaultJson; import jp.odakyu.toiletsignage.json.USBToiletDefaultJson;
import static java.lang.Boolean.FALSE;
import static java.lang.Boolean.TRUE;
/** /**
* Created by agentec on 2017/12/11. * Created by agentec on 2017/12/11.
...@@ -36,33 +32,29 @@ public class UpdateToiletInfoTask extends TimerTask { ...@@ -36,33 +32,29 @@ public class UpdateToiletInfoTask extends TimerTask {
toiletInfo = ToiletInfo.getInstance(); toiletInfo = ToiletInfo.getInstance();
} }
/**
* 実際トイレサーバから10秒ごとに情報を取得するタスク実行
*/
@Override @Override
public void run() { public void run() {
Log.i(TAG, "Thread Start"); Log.i(TAG, "Thread Start");
boolean isNetworkConnect = TRUE; boolean isNetworkConnect = true;
//インターネット接続チェック //インターネット接続チェック
if (isInternetAvailable() && isNetworkAvailable(applicationContext)) { if (isNetworkAvailable(applicationContext)) {
ArrayList<ToiletDefaultJson> toiletInfoArray = toiletInfo.getToiletDefaultJsonArray(); ArrayList<USBToiletDefaultJson> toiletInfoArray = toiletInfo.getToiletDefaultJsonArray();
boolean isError = FALSE; boolean isError = false;
for (ToiletDefaultJson toiletDefaultJson:toiletInfoArray) { for (USBToiletDefaultJson toiletDefaultJson:toiletInfoArray) {
ToiletServerConnection con = new ToiletServerConnection();
try { try {
String jsonString = con.connectionToiletServer(toiletDefaultJson.getToiletId()); String jsonString = ToiletServerConnection.connectionToiletServer(toiletDefaultJson.getToiletId());
JSONObject jsonObject = new JSONObject(jsonString); if (jsonString == null) {
if (jsonObject == null) { Log.w(TAG,"json object null jsonString");
Log.e(TAG,"json object null jsonString = " + jsonString); isError = true;
isError = TRUE;
break;
}
int code = jsonObject.getInt(ResultToiletJson.KEY_CODE);
if (code != 200000) {
Log.e(TAG,"response code error = " + code);
isError = TRUE;
break; break;
} }
Log.d(TAG,"jsonString = " + jsonString);
JSONObject jsonObject = new JSONObject(jsonString);
ArrayList<ResultToiletJson> resultToiletJsonArray = new ArrayList<ResultToiletJson>(); ArrayList<ResultToiletJson> resultToiletJsonArray = new ArrayList<>();
JSONArray jsonArray = jsonObject.getJSONArray(ResultToiletJson.KEY_RESULT); JSONArray jsonArray = jsonObject.getJSONArray(ResultToiletJson.KEY_RESULT);
for (int i = 0; i < jsonArray.length(); i++){ for (int i = 0; i < jsonArray.length(); i++){
ResultToiletJson resultToiletJson = new ResultToiletJson((JSONObject) jsonArray.get(i)); ResultToiletJson resultToiletJson = new ResultToiletJson((JSONObject) jsonArray.get(i));
...@@ -70,19 +62,9 @@ public class UpdateToiletInfoTask extends TimerTask { ...@@ -70,19 +62,9 @@ public class UpdateToiletInfoTask extends TimerTask {
} }
ToiletInfo.getInstance().setResultToiletJsonMap(toiletDefaultJson.getToiletId(), resultToiletJsonArray); ToiletInfo.getInstance().setResultToiletJsonMap(toiletDefaultJson.getToiletId(), resultToiletJsonArray);
if (jsonString == null) {
Log.e(TAG,"response json String null");
isError = TRUE;
break;
}
Log.d(TAG,"jsonString = " + jsonString);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); Log.e(TAG, e.getLocalizedMessage(), e);
String stackTrace = Log.getStackTraceString(e); isError = true;
Log.e(TAG, stackTrace);
isError = TRUE;
break; break;
} }
} }
...@@ -93,24 +75,30 @@ public class UpdateToiletInfoTask extends TimerTask { ...@@ -93,24 +75,30 @@ public class UpdateToiletInfoTask extends TimerTask {
} }
} else { } else {
errorCount++; errorCount++;
isNetworkConnect = FALSE; isNetworkConnect = false;
} }
toiletInfo.setConnectErrorCount(errorCount);
toiletInfo.setNetworkConnect(isNetworkConnect);
//Broadcast送信 //Broadcast送信
Intent intent = new Intent("jp.odakyu.toiletsignage.CONNECT_FINISH"); Intent intent = new Intent(ToiletInfo.NAME_CONNTENT_FINISH);
intent.putExtra(ToiletConstants.KEY_ERROR_COUNT, errorCount);
intent.putExtra(ToiletConstants.KEY_NETWORK_CONNECT, isNetworkConnect);
applicationContext.sendBroadcast(intent); applicationContext.sendBroadcast(intent);
Log.d(TAG, "Thread End"); Log.d(TAG, "Thread End");
} }
/**
* インターネット(Wifi)チェック
* @param context Application Context
* @return internet check
*/
private boolean isNetworkAvailable(Context context) { private boolean isNetworkAvailable(Context context) {
final ConnectivityManager connectivityManager = ((ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE)); final ConnectivityManager connectivityManager = ((ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE));
return connectivityManager.getActiveNetworkInfo() != null && connectivityManager.getActiveNetworkInfo().isConnected(); return connectivityManager.getActiveNetworkInfo() != null && connectivityManager.getActiveNetworkInfo().isConnected();
} }
/*
//実際「google.com」に影響があるが確認が取れてないので未使用
private boolean isInternetAvailable() { private boolean isInternetAvailable() {
try { try {
final InetAddress address = InetAddress.getByName("google.com"); final InetAddress address = InetAddress.getByName("google.com");
...@@ -121,4 +109,5 @@ public class UpdateToiletInfoTask extends TimerTask { ...@@ -121,4 +109,5 @@ public class UpdateToiletInfoTask extends TimerTask {
} }
return false; return false;
} }
*/
} }
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:text="トイレの空き情報" android:text="@string/toilet_vacant_info_jp"
android:textAlignment="textEnd" android:textAlignment="textEnd"
android:textColor="#746661" android:textColor="#746661"
android:textSize="53sp" android:textSize="53sp"
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1.07" android:layout_weight="1.07"
android:text=" Toilets Vacancy" android:text="@string/toilet_vacant_info_en"
android:textAlignment="textStart" android:textAlignment="textStart"
android:textColor="#746661" android:textColor="#746661"
android:textSize="40sp" /> android:textSize="40sp" />
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
android:id="@+id/statusIconImageView" android:id="@+id/statusIconImageView"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_toLeftOf="@id/sexualityIconImageView" android:layout_toStartOf="@id/sexualityIconImageView"
android:layout_centerVertical="true" android:layout_centerVertical="true"
app:srcCompat="@drawable/icon_empty_1" /> app:srcCompat="@drawable/icon_empty_1" />
...@@ -75,7 +75,7 @@ ...@@ -75,7 +75,7 @@
<LinearLayout <LinearLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_toRightOf="@id/sexualityIconImageView" android:layout_toEndOf="@id/sexualityIconImageView"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:orientation="vertical"> android:orientation="vertical">
...@@ -95,7 +95,7 @@ ...@@ -95,7 +95,7 @@
android:id="@+id/vacantTitleJPTextView" android:id="@+id/vacantTitleJPTextView"
android:layout_width="150dp" android:layout_width="150dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="空き" android:text="@string/vacant_jp"
android:textAlignment="center" android:textAlignment="center"
android:textColor="#746661" android:textColor="#746661"
android:textSize="50sp" android:textSize="50sp"
...@@ -105,7 +105,7 @@ ...@@ -105,7 +105,7 @@
android:id="@+id/vacantTitleENTextView" android:id="@+id/vacantTitleENTextView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="VACANT" android:text="@string/total_en"
android:textAlignment="center" android:textAlignment="center"
android:textColor="#746661" android:textColor="#746661"
android:textSize="30sp" android:textSize="30sp"
...@@ -121,7 +121,6 @@ ...@@ -121,7 +121,6 @@
android:layout_marginStart="35dp" android:layout_marginStart="35dp"
android:background="@drawable/textview_count_border" android:background="@drawable/textview_count_border"
android:gravity="center" android:gravity="center"
android:text="1"
android:textAlignment="center" android:textAlignment="center"
android:textColor="#746661" android:textColor="#746661"
android:textSize="50sp" /> android:textSize="50sp" />
...@@ -159,7 +158,7 @@ ...@@ -159,7 +158,7 @@
android:id="@+id/totalTitleJPTextView" android:id="@+id/totalTitleJPTextView"
android:layout_width="150dp" android:layout_width="150dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="総数" android:text="@string/total_jp"
android:textAlignment="center" android:textAlignment="center"
android:textColor="#746661" android:textColor="#746661"
android:textSize="50sp" android:textSize="50sp"
...@@ -169,7 +168,7 @@ ...@@ -169,7 +168,7 @@
android:id="@+id/totalTitleENTextView" android:id="@+id/totalTitleENTextView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="TOTAL" android:text="@string/total_en"
android:textAlignment="center" android:textAlignment="center"
android:textColor="#746661" android:textColor="#746661"
android:textSize="30sp" android:textSize="30sp"
...@@ -183,7 +182,6 @@ ...@@ -183,7 +182,6 @@
android:layout_marginStart="35dp" android:layout_marginStart="35dp"
android:background="@drawable/textview_count_border" android:background="@drawable/textview_count_border"
android:gravity="center" android:gravity="center"
android:text="11"
android:textAlignment="center" android:textAlignment="center"
android:textColor="#746661" android:textColor="#746661"
android:textSize="50sp" /> android:textSize="50sp" />
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
android:layout_weight="1" android:layout_weight="1"
android:paddingBottom="2dp" android:paddingBottom="2dp"
android:paddingTop="20dp" android:paddingTop="20dp"
android:text="トイレの空き情報" android:text="@string/toilet_vacant_info_jp"
android:textAlignment="textEnd" android:textAlignment="textEnd"
android:textColor="#746661" android:textColor="#746661"
android:textSize="52sp" android:textSize="52sp"
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
android:layout_weight="1.05" android:layout_weight="1.05"
android:paddingBottom="2dp" android:paddingBottom="2dp"
android:paddingTop="20dp" android:paddingTop="20dp"
android:text="  Toilets Vacancy" android:text="@string/toilet_vacant_info_en"
android:textAlignment="viewStart" android:textAlignment="viewStart"
android:textColor="#746661" android:textColor="#746661"
android:textSize="40sp" /> android:textSize="40sp" />
...@@ -99,7 +99,7 @@ ...@@ -99,7 +99,7 @@
android:id="@+id/vacantTitleJPTextView" android:id="@+id/vacantTitleJPTextView"
android:layout_width="150dp" android:layout_width="150dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="空き" android:text="@string/vacant_jp"
android:textAlignment="center" android:textAlignment="center"
android:textColor="#746661" android:textColor="#746661"
android:textSize="50sp" android:textSize="50sp"
...@@ -109,7 +109,7 @@ ...@@ -109,7 +109,7 @@
android:id="@+id/vacantTitleENTextView" android:id="@+id/vacantTitleENTextView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="VACANT" android:text="@string/vacant_en"
android:textAlignment="center" android:textAlignment="center"
android:textColor="#746661" android:textColor="#746661"
android:textSize="30sp" android:textSize="30sp"
...@@ -125,7 +125,6 @@ ...@@ -125,7 +125,6 @@
android:layout_marginEnd="40dp" android:layout_marginEnd="40dp"
android:background="@drawable/textview_count_border" android:background="@drawable/textview_count_border"
android:gravity="center" android:gravity="center"
android:text="1"
android:textColor="#746661" android:textColor="#746661"
android:textAlignment="center" android:textAlignment="center"
android:textSize="50sp" /> android:textSize="50sp" />
...@@ -159,7 +158,7 @@ ...@@ -159,7 +158,7 @@
android:id="@+id/totalTitleJPTextView" android:id="@+id/totalTitleJPTextView"
android:layout_width="150dp" android:layout_width="150dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="総数" android:text="@string/total_jp"
android:textAlignment="center" android:textAlignment="center"
android:textColor="#746661" android:textColor="#746661"
android:textSize="50sp" android:textSize="50sp"
...@@ -169,7 +168,7 @@ ...@@ -169,7 +168,7 @@
android:id="@+id/totalTitleENTextView" android:id="@+id/totalTitleENTextView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="TOTAL" android:text="@string/total_en"
android:textAlignment="center" android:textAlignment="center"
android:textColor="#746661" android:textColor="#746661"
android:textSize="30sp" android:textSize="30sp"
...@@ -183,7 +182,6 @@ ...@@ -183,7 +182,6 @@
android:layout_marginStart="35dp" android:layout_marginStart="35dp"
android:background="@drawable/textview_count_border" android:background="@drawable/textview_count_border"
android:gravity="center" android:gravity="center"
android:text="11"
android:textAlignment="center" android:textAlignment="center"
android:textColor="#746661" android:textColor="#746661"
android:textSize="50sp" /> android:textSize="50sp" />
...@@ -211,7 +209,7 @@ ...@@ -211,7 +209,7 @@
android:layout_marginBottom="1dp" android:layout_marginBottom="1dp"
android:layout_marginTop="20dp" android:layout_marginTop="20dp"
android:layout_weight="1" android:layout_weight="1"
android:text="お近くのトイレ情報 " android:text="@string/near_toilet_info_jp"
android:textAlignment="textEnd" android:textAlignment="textEnd"
android:textColor="@android:color/white" android:textColor="@android:color/white"
android:textSize="41sp" android:textSize="41sp"
...@@ -224,7 +222,7 @@ ...@@ -224,7 +222,7 @@
android:layout_marginBottom="1dp" android:layout_marginBottom="1dp"
android:layout_marginTop="20dp" android:layout_marginTop="20dp"
android:layout_weight="1" android:layout_weight="1"
android:text=" Other Toilets Nearby" android:text="@string/near_toilet_info_en"
android:textAlignment="textStart" android:textAlignment="textStart"
android:textColor="@android:color/white" android:textColor="@android:color/white"
android:textSize="35sp" /> android:textSize="35sp" />
...@@ -261,17 +259,22 @@ ...@@ -261,17 +259,22 @@
android:id="@+id/leftGateNameJPTextView" android:id="@+id/leftGateNameJPTextView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="西口地下改札外" android:ellipsize="end"
android:singleLine="true"
android:text="@string/left_toilet_info_jp"
android:textAlignment="center" android:textAlignment="center"
android:textColor="@android:color/white" android:textColor="@android:color/white"
android:textSize="40sp" android:textSize="40sp"
android:textStyle="bold" /> android:textStyle="bold"
/>
<TextView <TextView
android:id="@+id/leftGateNameENTextView" android:id="@+id/leftGateNameENTextView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="The West Underground Gate(Outside)" android:ellipsize="end"
android:singleLine="true"
android:text="@string/left_toilet_info_en"
android:textAlignment="center" android:textAlignment="center"
android:textColor="@android:color/white" android:textColor="@android:color/white"
android:textSize="25sp" /> android:textSize="25sp" />
...@@ -290,7 +293,7 @@ ...@@ -290,7 +293,7 @@
android:id="@+id/separator4" android:id="@+id/separator4"
android:layout_width="3dip" android:layout_width="3dip"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginStart="20dp" android:layout_marginStart="10dp"
android:layout_marginTop="15dp" android:layout_marginTop="15dp"
android:layout_marginBottom="15dp" android:layout_marginBottom="15dp"
android:background="#FFFFFF" /> android:background="#FFFFFF" />
...@@ -315,8 +318,9 @@ ...@@ -315,8 +318,9 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:ellipsize="end" android:ellipsize="end"
android:singleLine="true"
android:maxLines="1" android:maxLines="1"
android:text="南口改札内" android:text="@string/right_toilet_info_jp"
android:textAlignment="center" android:textAlignment="center"
android:textColor="@android:color/white" android:textColor="@android:color/white"
android:textSize="40sp" android:textSize="40sp"
...@@ -326,7 +330,9 @@ ...@@ -326,7 +330,9 @@
android:id="@+id/rightGateNameENTextView" android:id="@+id/rightGateNameENTextView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="The South Gate(Inside)" android:ellipsize="end"
android:singleLine="true"
android:text="@string/right_toilet_info_en"
android:textAlignment="center" android:textAlignment="center"
android:textColor="@android:color/white" android:textColor="@android:color/white"
android:textSize="25sp" /> android:textSize="25sp" />
......
...@@ -2,4 +2,19 @@ ...@@ -2,4 +2,19 @@
<string name="initDisplayString">ご利用ありがとうございます。\nThank you.</string> <string name="initDisplayString">ご利用ありがとうございます。\nThank you.</string>
<string name="initDisplayStringError">ご利用ありがとうございます。(%1$d)\nThank you.</string> <string name="initDisplayStringError">ご利用ありがとうございます。(%1$d)\nThank you.</string>
<string name="toilet_background_image">toilet background image</string> <string name="toilet_background_image">toilet background image</string>
<string name="toilet_vacant_info_jp">トイレの空き情報</string>
<string name="toilet_vacant_info_en"> Toilets Vacancy</string>
<string name="vacant_jp">空き</string>
<string name="vacant_en">VACANT</string>
<string name="total_jp">総数</string>
<string name="total_en">TOTAL</string>
<string name="near_toilet_info_jp">お近くのトイレ情報</string>
<string name="near_toilet_info_en"> Other Toilets Nearby</string>
<string name="left_toilet_info_jp">西口地下改札外</string>
<string name="left_toilet_info_en">The West Underground Gate(Outside)</string>
<string name="right_toilet_info_jp">南口改札内</string>
<string name="right_toilet_info_en">The South Gate(Inside)</string>
</resources> </resources>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment