Commit e2ddc8a9 by Kim Jinsung

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

端末電源ONの時自動起動処理追加
parent cee93dce
......@@ -10,3 +10,4 @@
.idea/modules.xml
.idea/misc.xml
.idea/vcs.xml
.idea/dictionaries/agentec.xml
......@@ -5,7 +5,7 @@
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<application
android:name=".application.ToiletApplication"
android:allowBackup="false"
......@@ -21,12 +21,25 @@
android:theme="@style/Theme.AppCompat.Light.NoActionBar.FullScreen">
<intent-filter>
<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" />
</intent-filter>
</activity>
<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: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>
</manifest>
\ No newline at end of file
......@@ -11,11 +11,10 @@ import android.widget.TextView;
import android.graphics.Typeface;
import android.widget.Toast;
import jp.odakyu.toiletsignage.R;
import jp.odakyu.toiletsignage.constants.ToiletConstants;
import jp.odakyu.toiletsignage.info.ToiletInfo;
import jp.odakyu.toiletsignage.logic.MainLogic;
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.
......@@ -26,7 +25,6 @@ public class MainActivity extends ParentActivity {
private TextView mMessageTextView;
private final int REQUEST_PERMISSION = 1000;
private final int REQUEST_CODE = 1;
@Override
protected void onCreate(Bundle savedInstanceState) {
......@@ -48,30 +46,26 @@ public class MainActivity extends ParentActivity {
}
private void getUsbFileInfo() {
MainLogic mainLogic = new MainLogic();
try {
mainLogic.getToiletDefaultInfo(this);
if (!toiletInfo.getValidation()) {
int result = MainLogic.getToiletDefaultInfo(getApplicationContext());
if (result == ToiletConstants.VALUE_GET_USB_INFO_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;
}
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));
Log.e(TAG, "ToiletDefaultArray NULL");
Log.w(TAG, "ToiletDefaultArray NULL");
return;
}
toiletInfo.setUsbFileCopyComplete(TRUE);
toiletInfo.setUsbFileCopyComplete(true);
ToiletApplication application = (ToiletApplication)this.getApplication();
application.startTimer();
} catch (Exception e) {
mMessageTextView.setText(getString(R.string.initDisplayStringError, ToiletInfo.VALUE_DEFAULT_TOILET_NULL));
String stackTrace = Log.getStackTraceString(e);
Log.e(TAG, stackTrace);
e.printStackTrace();
Log.e(TAG, e.getLocalizedMessage(), e);
}
}
......@@ -81,9 +75,9 @@ public class MainActivity extends ParentActivity {
if (ActivityCompat.checkSelfPermission(this,
Manifest.permission.WRITE_EXTERNAL_STORAGE) ==
PackageManager.PERMISSION_GRANTED){
return TRUE;
return true;
}
return FALSE;
return false;
}
// 許可を求める
......@@ -120,40 +114,12 @@ public class MainActivity extends ParentActivity {
}
@Override
protected void onResume() {
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() {
protected void reloadDisplayView(final int errorCount, final boolean isNetworkConnect) {
Log.d(TAG, "reloadDisplayView");
mHandler.post(new Runnable() {
runOnUiThread(new Runnable() {
@Override
public void run() {
if (toiletInfo.getConnectErrorCount() == 0) {
if (errorCount == 0) {
if (toiletInfo.getToiletDefaultJsonArray().size() > 0 && toiletInfo.getResultToiletJsonMapSize() > 0) {
//Move Signage View
Intent intent = new Intent(MainActivity.this, SignageActivity.class);
......@@ -163,7 +129,7 @@ public class MainActivity extends ParentActivity {
mMessageTextView.setText(getString(R.string.initDisplayStringError, ToiletInfo.VALUE_TOILET_SERVER_CONNECT_FAIL));
}
} else {
if (toiletInfo.getNetworkConnect()) {
if (isNetworkConnect) {
mMessageTextView.setText(getString(R.string.initDisplayStringError, ToiletInfo.VALUE_NETWORK_DIS_CONNECT));
} else {
mMessageTextView.setText(getString(R.string.initDisplayStringError, ToiletInfo.VALUE_TOILET_SERVER_CONNECT_FAIL));
......
......@@ -6,13 +6,13 @@ import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.view.Window;
import jp.odakyu.toiletsignage.application.ToiletApplication;
import jp.odakyu.toiletsignage.constants.ToiletConstants;
import jp.odakyu.toiletsignage.info.ToiletInfo;
/**
......@@ -22,10 +22,9 @@ import jp.odakyu.toiletsignage.info.ToiletInfo;
public class ParentActivity extends AppCompatActivity {
private static final String TAG = "ParentActivity";
Handler mHandler;
ToiletInfo toiletInfo;
private BroadcastReceiver broadcastReceiver;
private boolean isRunning;
@Override
protected void onCreate(Bundle savedInstanceState) {
......@@ -41,9 +40,6 @@ public class ParentActivity extends AppCompatActivity {
View.SYSTEM_UI_FLAG_HIDE_NAVIGATION |
View.SYSTEM_UI_FLAG_FULLSCREEN);
//BackgroundThreadからMainThread使用するため
mHandler = new Handler();
toiletInfo = ToiletInfo.getInstance();
//BroadcastReceiver設定
......@@ -51,50 +47,57 @@ public class ParentActivity extends AppCompatActivity {
broadcastReceiver = new BroadcastReceiver() {
@Override
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);
}
@Override
protected void onResume() {
super.onResume();
}
@Override
protected void onDestroy() {
super.onDestroy();
public void finish() {
super.finish();
unregisterReceiver(broadcastReceiver);
}
@Override
protected void onPause() {
super.onPause();
}
@Override
protected void onStop() {
super.onStop();
ToiletApplication application = (ToiletApplication) getApplication();
//アプリがバックグラウンドのなった時のみタスクを停止
if (!application.isForegrdound(this)) {
if (!application.isForeground(this)) {
Log.i(TAG, "Application Background");
application.stopTimer();
}
super.onStop();
}
@Override
protected void onStart() {
super.onStart();
ToiletApplication application = (ToiletApplication) getApplication();
//初回起動時以外はタスク開始(バックグラウンドからフォアグラウンド対応)
if (toiletInfo.getToiletDefaultJsonArray() != null) {
application.startTimer();
}
super.onStart();
}
@Override
protected void onResume() {
isRunning = true;
super.onResume();
}
@Override
protected void onPause() {
isRunning = false;
super.onPause();
}
//Child Classから実装
protected void reloadDisplayView() {}
protected void reloadDisplayView(final int errorCount, final boolean isNetworkConnect) {}
}
......@@ -3,19 +3,20 @@ package jp.odakyu.toiletsignage.activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.Gravity;
import android.widget.ImageView;
import android.widget.TextView;
import android.graphics.Typeface;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import jp.odakyu.toiletsignage.R;
import jp.odakyu.toiletsignage.constants.ToiletConstants;
import jp.odakyu.toiletsignage.info.ToiletInfo;
import jp.odakyu.toiletsignage.json.ResultToiletJson;
import jp.odakyu.toiletsignage.json.ToiletDefaultJson;
import static java.lang.Boolean.TRUE;
import jp.odakyu.toiletsignage.json.USBToiletDefaultJson;
/**
* Created by agentec on 2017/11/30.
......@@ -23,80 +24,40 @@ import static java.lang.Boolean.TRUE;
public class SignageActivity extends ParentActivity {
private static final String TAG = "SignageActivity";
private ImageView sexualityIconImageView;
private ImageView statusIconImageView;
private ImageView leftStatusIconImageView;
private ImageView rightStatusIconImageView;
private TextView vacantCountTextView;
private TextView totalCountTextView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (toiletInfo.getToiletDefaultJsonArray() != null && toiletInfo.getToiletDefaultJsonArray().size() == 3) {
setContentView(R.layout.activity_signage_3);
} else {
if (toiletInfo.getToiletGateType() == ToiletConstants.VALUE_TOILET_GATE_TYPE_1) {
setContentView(R.layout.activity_signage_1);
} else if (toiletInfo.getToiletGateType() == ToiletConstants.VALUE_TOILET_GATE_TYPE_3) {
setContentView(R.layout.activity_signage_3);
} else { //USBから取得したトイレ情報がない場合
moveMainView();
return;
}
findViewById(R.id.statusIconImageView);
settingInitDisplay();
settingFontFamily();
}
@Override
protected void onResume() {
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();
}
private void settingInitDisplay() {
sexualityIconImageView = (ImageView) findViewById(R.id.sexualityIconImageView);
sexualityIconImageView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// クリック時の処理
moveMainView();
}
});
statusIconImageView = (ImageView) findViewById(R.id.statusIconImageView);
vacantCountTextView = (TextView) findViewById(R.id.vacantCountTextView);
totalCountTextView = (TextView) findViewById(R.id.totalCountTextView);
ImageView sexualityIconImageView = findViewById(R.id.sexualityIconImageView);
vacantCountTextView = findViewById(R.id.vacantCountTextView);
totalCountTextView = findViewById(R.id.totalCountTextView);
if (toiletInfo.getToiletDefaultJsonArray() != null && toiletInfo.getToiletDefaultJsonArray().size() == 3) {
leftStatusIconImageView = (ImageView) findViewById(R.id.leftStatusIconImageView);
rightStatusIconImageView = (ImageView) findViewById(R.id.rightStatusIconImageView);
if (toiletInfo.getToiletGateType() == ToiletConstants.VALUE_TOILET_GATE_TYPE_3) {
//お近くのトイレ情報設定
TextView leftGateNameJPTextView = (TextView) findViewById(R.id.leftGateNameJPTextView);
TextView leftGateNameENTextView = (TextView) findViewById(R.id.leftGateNameENTextView);
TextView rightGateNameJPTextView = (TextView) findViewById(R.id.rightGateNameJPTextView);
TextView rightGateNameENTextView = (TextView) findViewById(R.id.rightGateNameENTextView);
TextView leftGateNameJPTextView = findViewById(R.id.leftGateNameJPTextView);
TextView leftGateNameENTextView = findViewById(R.id.leftGateNameENTextView);
TextView rightGateNameJPTextView = findViewById(R.id.rightGateNameJPTextView);
TextView rightGateNameENTextView = findViewById(R.id.rightGateNameENTextView);
for (ToiletDefaultJson toiletDefaultJson:
for (USBToiletDefaultJson toiletDefaultJson:
toiletInfo.getToiletDefaultJsonArray()) {
if (toiletDefaultJson.getPriority() == ToiletInfo.VALUE_PRIORITY_SUB_LEFT) {
leftGateNameJPTextView.setText(toiletDefaultJson.getToiletNameJP());
......@@ -110,7 +71,7 @@ public class SignageActivity extends ParentActivity {
int toiletSex = toiletInfo.getToiletSex();
if (toiletInfo.getToiletDefaultJsonArray() != null && toiletInfo.getToiletDefaultJsonArray().size() == 3) {
if (toiletInfo.getToiletGateType() == ToiletConstants.VALUE_TOILET_GATE_TYPE_3) {
if (toiletSex == ToiletInfo.VALUE_SEX_MAN) {
sexualityIconImageView.setImageResource(R.drawable.icon_man_3);
} else {
......@@ -126,46 +87,51 @@ public class SignageActivity extends ParentActivity {
settingDisplay();
}
/**
* ビューで表示するすべてのTextViewのフォント情報を変更
*/
private void settingFontFamily() {
TextView mainTitleJPTextView = (TextView) findViewById(R.id.mainTitleJPTextView);
TextView mainTitleENTextView = (TextView) findViewById(R.id.mainTitleENTextView);
TextView vacantTitleJPTextView = (TextView) findViewById(R.id.vacantTitleJPTextView);
TextView vacantTitleENTextView = (TextView) findViewById(R.id.vacantTitleENTextView);
TextView vacantCountTextView = (TextView) findViewById(R.id.vacantCountTextView);
TextView totalTitleJPTextView = (TextView) findViewById(R.id.totalTitleJPTextView);
TextView totalTitleENTextView = (TextView) findViewById(R.id.totalTitleENTextView);
TextView totalCountTextView = (TextView) findViewById(R.id.totalCountTextView);
mainTitleJPTextView.setTypeface(Typeface.createFromAsset(getAssets(), "meiryob.ttf"));
mainTitleENTextView.setTypeface(Typeface.createFromAsset(getAssets(), "meiryo.ttf"));
vacantTitleJPTextView.setTypeface(Typeface.createFromAsset(getAssets(), "meiryob.ttf"));
vacantTitleENTextView.setTypeface(Typeface.createFromAsset(getAssets(), "meiryob.ttf"));
vacantCountTextView.setTypeface(Typeface.createFromAsset(getAssets(), "meiryob.ttf"));
totalTitleJPTextView.setTypeface(Typeface.createFromAsset(getAssets(), "meiryob.ttf"));
totalTitleENTextView.setTypeface(Typeface.createFromAsset(getAssets(), "meiryob.ttf"));
totalCountTextView.setTypeface(Typeface.createFromAsset(getAssets(), "meiryob.ttf"));
if (toiletInfo.getToiletDefaultJsonArray() != null && toiletInfo.getToiletDefaultJsonArray().size() == 3) {
TextView subTitleJPTextView = (TextView) findViewById(R.id.subTitleJPTextView);
TextView subTitleENTextView = (TextView) findViewById(R.id.subTitleENTextView);
TextView leftGateNameJPTextView = (TextView) findViewById(R.id.leftGateNameJPTextView);
TextView leftGateNameENTextView = (TextView) findViewById(R.id.leftGateNameENTextView);
TextView rightGateNameJPTextView = (TextView) findViewById(R.id.rightGateNameJPTextView);
TextView rightGateNameENTextView = (TextView) findViewById(R.id.rightGateNameENTextView);
subTitleJPTextView.setTypeface(Typeface.createFromAsset(getAssets(), "meiryob.ttf"));
subTitleENTextView.setTypeface(Typeface.createFromAsset(getAssets(), "meiryo.ttf"));
leftGateNameJPTextView.setTypeface(Typeface.createFromAsset(getAssets(), "meiryob.ttf"));
leftGateNameENTextView.setTypeface(Typeface.createFromAsset(getAssets(), "meiryo.ttf"));
rightGateNameJPTextView.setTypeface(Typeface.createFromAsset(getAssets(), "meiryob.ttf"));
rightGateNameENTextView.setTypeface(Typeface.createFromAsset(getAssets(), "meiryo.ttf"));
Map<Integer, String> textViewFontInfoMap = new HashMap<>();
textViewFontInfoMap.put(R.id.mainTitleJPTextView, ToiletConstants.MEIRIO_BOLD_FONT_NAME);
textViewFontInfoMap.put(R.id.mainTitleENTextView, ToiletConstants.MEIRIO_FONT_NAME);
textViewFontInfoMap.put(R.id.vacantTitleJPTextView, ToiletConstants.MEIRIO_BOLD_FONT_NAME);
textViewFontInfoMap.put(R.id.vacantTitleENTextView, ToiletConstants.MEIRIO_BOLD_FONT_NAME);
textViewFontInfoMap.put(R.id.vacantCountTextView, ToiletConstants.MEIRIO_BOLD_FONT_NAME);
textViewFontInfoMap.put(R.id.totalTitleJPTextView, ToiletConstants.MEIRIO_BOLD_FONT_NAME);
textViewFontInfoMap.put(R.id.totalTitleENTextView, ToiletConstants.MEIRIO_BOLD_FONT_NAME);
textViewFontInfoMap.put(R.id.totalCountTextView, ToiletConstants.MEIRIO_BOLD_FONT_NAME);
if (toiletInfo.getToiletGateType() == ToiletConstants.VALUE_TOILET_GATE_TYPE_3) {
textViewFontInfoMap.put(R.id.subTitleJPTextView, ToiletConstants.MEIRIO_BOLD_FONT_NAME);
textViewFontInfoMap.put(R.id.subTitleENTextView, ToiletConstants.MEIRIO_FONT_NAME);
textViewFontInfoMap.put(R.id.leftGateNameJPTextView, ToiletConstants.MEIRIO_BOLD_FONT_NAME);
textViewFontInfoMap.put(R.id.leftGateNameENTextView, ToiletConstants.MEIRIO_FONT_NAME);
textViewFontInfoMap.put(R.id.rightGateNameJPTextView, ToiletConstants.MEIRIO_BOLD_FONT_NAME);
textViewFontInfoMap.put(R.id.rightGateNameENTextView, ToiletConstants.MEIRIO_FONT_NAME);
}
for(Map.Entry<Integer, String> entry : textViewFontInfoMap.entrySet()) {
TextView textView = findViewById(entry.getKey());
//空き数と総数の数字表示が真ん中ではないので調整
if (entry.getKey() == R.id.vacantCountTextView || entry.getKey() == R.id.totalCountTextView) {
textView.setPadding(0, 10, 0, 0);
textView.setGravity(Gravity.CENTER);
}
textView.setTypeface(Typeface.createFromAsset(getAssets(), entry.getValue()));
}
}
/**
* 10秒ごとに実行するトイレ情報取得タスクから、結果を送信する
* @param errorCount サーバ通信タスクからの情報で、取得失敗カウント
* @param isNetworkConnect インターネット接続情報
*/
@Override
protected void reloadDisplayView() {
protected void reloadDisplayView(final int errorCount, final boolean isNetworkConnect) {
Log.i(TAG, "reloadDisplayView");
//バックグラウンドスレッドからメーイン
mHandler.post(new Runnable() {
runOnUiThread(new Runnable() {
@Override
public void run() {
if (toiletInfo.getConnectErrorCount() > ToiletInfo.MAX_ERROR_COUNT) {
......@@ -186,28 +152,29 @@ public class SignageActivity extends ParentActivity {
}
private void settingDisplay() {
ArrayList<ToiletDefaultJson> toiletDefaultJsonArray = toiletInfo.getToiletDefaultJsonArray();
ArrayList<USBToiletDefaultJson> toiletDefaultJsonArray = toiletInfo.getToiletDefaultJsonArray();
if (toiletDefaultJsonArray == null || toiletDefaultJsonArray.size() == 0) {
//MainActivity 移動
moveMainView();
}
for (ToiletDefaultJson toiletDefaultJson:
int vacantCount = 0;
int totalCount = 0;
for (USBToiletDefaultJson toiletDefaultJson:
toiletDefaultJsonArray) {
ArrayList<ResultToiletJson> resultToiletJson = toiletInfo.getResultToiletJsonMap(toiletDefaultJson.getToiletId());
int vacantCount = toiletInfo.getVacantCount(toiletDefaultJson.getToiletId());
int totalCount = toiletInfo.getTotalCount(toiletDefaultJson.getToiletId());
vacantCount = toiletInfo.getVacantCount(toiletDefaultJson.getToiletId());
totalCount = toiletInfo.getTotalCount(toiletDefaultJson.getToiletId());
if (toiletDefaultJson.getPriority() == ToiletInfo.VALUE_PRIORITY_MAIN) { //開設トイレ
if (vacantCount == -1) {
//取得失敗
continue;
}
vacantCountTextView.setText(String.valueOf(vacantCount));
totalCountTextView.setText(String.valueOf(totalCount));
if (toiletInfo.getToiletDefaultJsonArray() != null && toiletInfo.getToiletDefaultJsonArray().size() == 3) {
ImageView statusIconImageView = findViewById(R.id.statusIconImageView);
if (toiletInfo.getToiletGateType() == ToiletConstants.VALUE_TOILET_GATE_TYPE_3) {
if (vacantCount == 0) {
statusIconImageView.setImageResource(R.drawable.icon_full_3);
} else {
......@@ -222,12 +189,14 @@ public class SignageActivity extends ParentActivity {
}
}
} else if (toiletDefaultJson.getPriority() == ToiletInfo.VALUE_PRIORITY_SUB_LEFT) { //お近くトイレ(左側)
ImageView leftStatusIconImageView = findViewById(R.id.leftStatusIconImageView);
if (vacantCount == 0) {
leftStatusIconImageView.setImageResource(R.drawable.icon_full_sub);
} else {
leftStatusIconImageView.setImageResource(R.drawable.icon_empty_sub);
}
} else if (toiletDefaultJson.getPriority() == ToiletInfo.VALUE_PRIORITY_SUB_RIGHT) { //お近くトイレ(左側)
ImageView rightStatusIconImageView = findViewById(R.id.rightStatusIconImageView);
if (vacantCount == 0) {
rightStatusIconImageView.setImageResource(R.drawable.icon_full_sub);
} else {
......@@ -235,5 +204,10 @@ public class SignageActivity extends ParentActivity {
}
}
}
//サーバから取得したデータが不正なのでMainに遷移
if (vacantCount == -1 || totalCount == -1) {
moveMainView();
}
}
}
......@@ -2,13 +2,16 @@ package jp.odakyu.toiletsignage.application;
import android.app.ActivityManager;
import android.app.Application;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.util.Log;
import java.util.List;
import java.util.Timer;
import jp.odakyu.toiletsignage.activity.MainActivity;
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.
......@@ -24,18 +27,7 @@ public class ToiletApplication extends Application {
super.onCreate();
}
private synchronized void settingToiletUpdateTimer() {
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() {
public synchronized void stopTimer() {
Log.i(TAG, "stopTimer");
if (updateToiletInfoTimer != null) {
Log.i(TAG, "stopTimer STOP");
......@@ -44,23 +36,31 @@ public class ToiletApplication extends Application {
}
}
public void startTimer() {
settingToiletUpdateTimer();
public synchronized void startTimer() {
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);
assert am != null;
List<ActivityManager.RunningAppProcessInfo> processInfoList = am.getRunningAppProcesses();
boolean isForegrdound = FALSE;
boolean isForeground = false;
for( ActivityManager.RunningAppProcessInfo info : processInfoList){
if(info.processName.equals(getPackageName())){
if( info.importance == ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREGROUND){
isForegrdound = TRUE;
isForeground = true;
break;
// ここにフォアグラウンドの場合の処理を実装
}
}
}
return isForegrdound;
return isForeground;
}
}
......@@ -3,6 +3,7 @@ package jp.odakyu.toiletsignage.connection;
import android.util.Base64;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
......@@ -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 LOGIN_ID = "nh2h2KntNPpgXcqEAtcJxwJd49jNcJ4J";
private static final String PASSWORD = "jm2kCd6ZK2EZTzcMgxtge3AC4EeJ4ZqW";
private static final int CONNECTION_TIMEOUT = 30 * 1000;
private static final int READ_TIMEOUT = 30 * 1000;
private static final int CONNECTION_TIMEOUT = 5 * 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));
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setConnectTimeout(CONNECTION_TIMEOUT);
......@@ -39,7 +40,7 @@ public class ToiletServerConnection {
}
final InputStreamReader inReader = new InputStreamReader(in, encoding);
final BufferedReader bufferedReader = new BufferedReader(inReader);
String line = null;
String line;
while((line = bufferedReader.readLine()) != null) {
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;
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));
StringBuilder sb = new StringBuilder();
String line = null;
String line;
while ((line = reader.readLine()) != null) {
sb.append(line).append("\n");
}
......@@ -25,7 +25,7 @@ public class FileUtil {
return sb.toString();
}
public static String getStringFromFile (String filePath) throws Exception {
public static String getStringFromFile (String filePath) throws IOException {
File fl = new File(filePath);
FileInputStream fin = new FileInputStream(fl);
String ret = convertStreamToString(fin);
......
......@@ -4,8 +4,9 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import jp.odakyu.toiletsignage.constants.ToiletConstants;
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.
......@@ -29,14 +30,13 @@ public class ToiletInfo {
public static final int MAX_ERROR_COUNT = 6;
private ArrayList<ToiletDefaultJson> mToiletDefaultJsonArray;
private Map<Integer, ArrayList<ResultToiletJson>> mResultToiletJsonMap = new HashMap<Integer, ArrayList<ResultToiletJson>>();
private ArrayList<USBToiletDefaultJson> mToiletDefaultJsonArray;
private Map<Integer, ArrayList<ResultToiletJson>> mResultToiletJsonMap = new HashMap<>();
private boolean isValidation = false;
private boolean isUsbFileCopyComplete = false;
private int mConnectErrorCount = 0;
private boolean isNetworkConnect = false;
public static synchronized ToiletInfo getInstance() {
if (instance == null) {
instance = new ToiletInfo();
......@@ -44,11 +44,11 @@ public class ToiletInfo {
return instance;
}
public void setToiletDefaultJsonArray(ArrayList<ToiletDefaultJson> defaultToiletJsonArray) {
public void setToiletDefaultJsonArray(ArrayList<USBToiletDefaultJson> defaultToiletJsonArray) {
mToiletDefaultJsonArray = defaultToiletJsonArray;
}
public ArrayList<ToiletDefaultJson> getToiletDefaultJsonArray() {
public ArrayList<USBToiletDefaultJson> getToiletDefaultJsonArray() {
return mToiletDefaultJsonArray;
}
......@@ -70,14 +70,14 @@ public class ToiletInfo {
public int getToiletSex() {
if (mToiletDefaultJsonArray != null && mToiletDefaultJsonArray.size() > 0) {
ToiletDefaultJson toiletDefaultJson = mToiletDefaultJsonArray.get(0);
USBToiletDefaultJson toiletDefaultJson = mToiletDefaultJsonArray.get(0);
return toiletDefaultJson.getToiletSex();
}
return -1;
}
public int getVacantCount(int toiletId) {
if (mResultToiletJsonMap != null && mResultToiletJsonMap.size() > 0) {
if (mResultToiletJsonMap.size() > 0) {
ArrayList<ResultToiletJson> resultToiletJsonArray = getResultToiletJsonMap(toiletId);
int vacantCount = 0;
for (ResultToiletJson resultToiletJson:resultToiletJsonArray) {
......@@ -91,11 +91,11 @@ public class ToiletInfo {
}
public int getTotalCount(int toiletId) {
if (mResultToiletJsonMap != null && mResultToiletJsonMap.size() > 0) {
if (mResultToiletJsonMap.size() > 0) {
ArrayList<ResultToiletJson> resultToiletJsonArray = getResultToiletJsonMap(toiletId);
return resultToiletJsonArray.size();
}
return 0;
return -1;
}
public void setValidation(boolean validation) {
......@@ -129,4 +129,11 @@ public class ToiletInfo {
public boolean getNetworkConnect() {
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;
import org.json.JSONException;
import org.json.JSONObject;
import static java.lang.Boolean.FALSE;
import static java.lang.Boolean.TRUE;
import jp.odakyu.toiletsignage.info.ToiletInfo;
/**
* Created by agentec on 2017/12/08.
*/
public class ToiletDefaultJson {
public class USBToiletDefaultJson {
/**
* JSON Param
*/
......@@ -41,7 +40,7 @@ public class ToiletDefaultJson {
}
public ToiletDefaultJson(JSONObject jsonObject) throws JSONException {
public USBToiletDefaultJson(JSONObject jsonObject) throws JSONException {
priority = jsonObject.getInt(KEY_PRIORITY);
toiletId = jsonObject.getInt(KEY_TOILET_ID);
toiletSex = jsonObject.getInt(KEY_TOILET_SEX);
......@@ -57,33 +56,27 @@ public class ToiletDefaultJson {
public boolean validation(JSONObject jsonObject) {
if (!jsonObject.has(KEY_PRIORITY)) {
return FALSE;
return false;
}
if (!jsonObject.has(KEY_TOILET_ID)) {
return FALSE;
return false;
}
if (!jsonObject.has(KEY_TOILET_SEX)) {
return FALSE;
return false;
}
if (getToiletId() < 0 || getToiletId() > 1000000) {
return FALSE;
return false;
}
if (getToiletSex() != 0 && getToiletSex() != 1) {
return FALSE;
if (getToiletSex() != ToiletInfo.VALUE_SEX_MAN && getToiletSex() != ToiletInfo.VALUE_SEX_WOMAN) {
return false;
}
if (getToiletSex() != 0 && getToiletSex() != 1) {
return FALSE;
}
if (getPriority() != 0 && getPriority() != 1 && getPriority() != 2) {
return FALSE;
}
return TRUE;
return !(getPriority() != ToiletInfo.VALUE_PRIORITY_MAIN &&
getPriority() != ToiletInfo.VALUE_PRIORITY_SUB_LEFT &&
getPriority() != ToiletInfo.VALUE_PRIORITY_SUB_RIGHT);
}
}
......@@ -5,6 +5,7 @@ import android.os.Environment;
import android.util.Log;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.File;
......@@ -12,11 +13,10 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import jp.odakyu.toiletsignage.constants.ToiletConstants;
import jp.odakyu.toiletsignage.file.FileUtil;
import jp.odakyu.toiletsignage.info.ToiletInfo;
import jp.odakyu.toiletsignage.json.ToiletDefaultJson;
import static java.lang.Boolean.FALSE;
import jp.odakyu.toiletsignage.json.USBToiletDefaultJson;
/**
* Created by agentec on 2017/12/08.
......@@ -27,7 +27,18 @@ public class MainLogic {
private static final String KEY_TOILET_ARRAY = "toiletArray";
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);
File downloadFilePath = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);
......@@ -42,17 +53,17 @@ public class MainLogic {
FileUtil.fileCopy(jsonFilePath, copyFilePath);
break;
} else {
Log.e(TAG, "usb json file not exists = " + jsonFilePath);
Log.w(TAG, "usb json file not exists = " + jsonFilePath);
}
}
if (new File(copyFilePath).exists()) {
JSONObject jsonObject = new JSONObject(FileUtil.getStringFromFile(copyFilePath));
JSONArray jsonArray = jsonObject.getJSONArray(KEY_TOILET_ARRAY);
ArrayList<ToiletDefaultJson> toiletDefaultJsonArray = new ArrayList<ToiletDefaultJson>();
boolean isValidation = FALSE;
ArrayList<USBToiletDefaultJson> toiletDefaultJsonArray = new ArrayList<>();
boolean isValidation = false;
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));
if (isValidation) {
......@@ -61,15 +72,25 @@ public class MainLogic {
break;
}
}
ToiletInfo.getInstance().setValidation(isValidation);
if (toiletDefaultJsonArray.size() != 0 && isValidation) {
if (!isValidation) {
return ToiletConstants.VALUE_GET_USB_INFO_VALIDATION_FAIL;
}
if (toiletDefaultJsonArray.size() != 0) {
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) {
List<String> paths = new ArrayList<>();
List<String> pathList = new ArrayList<>();
for (File file : context.getExternalFilesDirs("external")) {
if (file != null) {
int index = file.getAbsolutePath().lastIndexOf("/Android/data");
......@@ -78,15 +99,17 @@ public class MainLogic {
} else {
String path = file.getAbsolutePath().substring(0, index);
try {
path = new File(path).getCanonicalPath();
String canonicalPath = new File(path).getCanonicalPath();
pathList.add(canonicalPath);
} catch (IOException e) {
// Keep non-canonical path.
Log.e(TAG, e.getLocalizedMessage(), e);
}
paths.add(path);
}
}
}
if (paths.isEmpty()) paths.add("/storage/sdcard1");
return paths.toArray(new String[0]);
if (pathList.isEmpty()) pathList.add("/storage/sdcard1");
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;
import org.json.JSONArray;
import org.json.JSONObject;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.TimerTask;
import jp.odakyu.toiletsignage.connection.ToiletServerConnection;
import jp.odakyu.toiletsignage.constants.ToiletConstants;
import jp.odakyu.toiletsignage.info.ToiletInfo;
import jp.odakyu.toiletsignage.json.ResultToiletJson;
import jp.odakyu.toiletsignage.json.ToiletDefaultJson;
import static java.lang.Boolean.FALSE;
import static java.lang.Boolean.TRUE;
import jp.odakyu.toiletsignage.json.USBToiletDefaultJson;
/**
* Created by agentec on 2017/12/11.
......@@ -36,33 +32,29 @@ public class UpdateToiletInfoTask extends TimerTask {
toiletInfo = ToiletInfo.getInstance();
}
/**
* 実際トイレサーバから10秒ごとに情報を取得するタスク実行
*/
@Override
public void run() {
Log.i(TAG, "Thread Start");
boolean isNetworkConnect = TRUE;
boolean isNetworkConnect = true;
//インターネット接続チェック
if (isInternetAvailable() && isNetworkAvailable(applicationContext)) {
ArrayList<ToiletDefaultJson> toiletInfoArray = toiletInfo.getToiletDefaultJsonArray();
boolean isError = FALSE;
for (ToiletDefaultJson toiletDefaultJson:toiletInfoArray) {
ToiletServerConnection con = new ToiletServerConnection();
if (isNetworkAvailable(applicationContext)) {
ArrayList<USBToiletDefaultJson> toiletInfoArray = toiletInfo.getToiletDefaultJsonArray();
boolean isError = false;
for (USBToiletDefaultJson toiletDefaultJson:toiletInfoArray) {
try {
String jsonString = con.connectionToiletServer(toiletDefaultJson.getToiletId());
JSONObject jsonObject = new JSONObject(jsonString);
if (jsonObject == null) {
Log.e(TAG,"json object null jsonString = " + jsonString);
isError = TRUE;
break;
}
int code = jsonObject.getInt(ResultToiletJson.KEY_CODE);
if (code != 200000) {
Log.e(TAG,"response code error = " + code);
isError = TRUE;
String jsonString = ToiletServerConnection.connectionToiletServer(toiletDefaultJson.getToiletId());
if (jsonString == null) {
Log.w(TAG,"json object null jsonString");
isError = true;
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);
for (int i = 0; i < jsonArray.length(); i++){
ResultToiletJson resultToiletJson = new ResultToiletJson((JSONObject) jsonArray.get(i));
......@@ -70,19 +62,9 @@ public class UpdateToiletInfoTask extends TimerTask {
}
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) {
e.printStackTrace();
String stackTrace = Log.getStackTraceString(e);
Log.e(TAG, stackTrace);
isError = TRUE;
Log.e(TAG, e.getLocalizedMessage(), e);
isError = true;
break;
}
}
......@@ -93,24 +75,30 @@ public class UpdateToiletInfoTask extends TimerTask {
}
} else {
errorCount++;
isNetworkConnect = FALSE;
isNetworkConnect = false;
}
toiletInfo.setConnectErrorCount(errorCount);
toiletInfo.setNetworkConnect(isNetworkConnect);
//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);
Log.d(TAG, "Thread End");
}
/**
* インターネット(Wifi)チェック
* @param context Application Context
* @return internet check
*/
private boolean isNetworkAvailable(Context context) {
final ConnectivityManager connectivityManager = ((ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE));
return connectivityManager.getActiveNetworkInfo() != null && connectivityManager.getActiveNetworkInfo().isConnected();
}
/*
//実際「google.com」に影響があるが確認が取れてないので未使用
private boolean isInternetAvailable() {
try {
final InetAddress address = InetAddress.getByName("google.com");
......@@ -121,4 +109,5 @@ public class UpdateToiletInfoTask extends TimerTask {
}
return false;
}
*/
}
......@@ -25,7 +25,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="トイレの空き情報"
android:text="@string/toilet_vacant_info_jp"
android:textAlignment="textEnd"
android:textColor="#746661"
android:textSize="53sp"
......@@ -36,7 +36,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1.07"
android:text=" Toilets Vacancy"
android:text="@string/toilet_vacant_info_en"
android:textAlignment="textStart"
android:textColor="#746661"
android:textSize="40sp" />
......@@ -59,7 +59,7 @@
android:id="@+id/statusIconImageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toLeftOf="@id/sexualityIconImageView"
android:layout_toStartOf="@id/sexualityIconImageView"
android:layout_centerVertical="true"
app:srcCompat="@drawable/icon_empty_1" />
......@@ -75,7 +75,7 @@
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/sexualityIconImageView"
android:layout_toEndOf="@id/sexualityIconImageView"
android:layout_centerVertical="true"
android:orientation="vertical">
......@@ -95,7 +95,7 @@
android:id="@+id/vacantTitleJPTextView"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:text="空き"
android:text="@string/vacant_jp"
android:textAlignment="center"
android:textColor="#746661"
android:textSize="50sp"
......@@ -105,7 +105,7 @@
android:id="@+id/vacantTitleENTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="VACANT"
android:text="@string/total_en"
android:textAlignment="center"
android:textColor="#746661"
android:textSize="30sp"
......@@ -121,7 +121,6 @@
android:layout_marginStart="35dp"
android:background="@drawable/textview_count_border"
android:gravity="center"
android:text="1"
android:textAlignment="center"
android:textColor="#746661"
android:textSize="50sp" />
......@@ -159,7 +158,7 @@
android:id="@+id/totalTitleJPTextView"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:text="総数"
android:text="@string/total_jp"
android:textAlignment="center"
android:textColor="#746661"
android:textSize="50sp"
......@@ -169,7 +168,7 @@
android:id="@+id/totalTitleENTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="TOTAL"
android:text="@string/total_en"
android:textAlignment="center"
android:textColor="#746661"
android:textSize="30sp"
......@@ -183,7 +182,6 @@
android:layout_marginStart="35dp"
android:background="@drawable/textview_count_border"
android:gravity="center"
android:text="11"
android:textAlignment="center"
android:textColor="#746661"
android:textSize="50sp" />
......
......@@ -25,7 +25,7 @@
android:layout_weight="1"
android:paddingBottom="2dp"
android:paddingTop="20dp"
android:text="トイレの空き情報"
android:text="@string/toilet_vacant_info_jp"
android:textAlignment="textEnd"
android:textColor="#746661"
android:textSize="52sp"
......@@ -38,7 +38,7 @@
android:layout_weight="1.05"
android:paddingBottom="2dp"
android:paddingTop="20dp"
android:text="  Toilets Vacancy"
android:text="@string/toilet_vacant_info_en"
android:textAlignment="viewStart"
android:textColor="#746661"
android:textSize="40sp" />
......@@ -99,7 +99,7 @@
android:id="@+id/vacantTitleJPTextView"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:text="空き"
android:text="@string/vacant_jp"
android:textAlignment="center"
android:textColor="#746661"
android:textSize="50sp"
......@@ -109,7 +109,7 @@
android:id="@+id/vacantTitleENTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="VACANT"
android:text="@string/vacant_en"
android:textAlignment="center"
android:textColor="#746661"
android:textSize="30sp"
......@@ -125,7 +125,6 @@
android:layout_marginEnd="40dp"
android:background="@drawable/textview_count_border"
android:gravity="center"
android:text="1"
android:textColor="#746661"
android:textAlignment="center"
android:textSize="50sp" />
......@@ -159,7 +158,7 @@
android:id="@+id/totalTitleJPTextView"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:text="総数"
android:text="@string/total_jp"
android:textAlignment="center"
android:textColor="#746661"
android:textSize="50sp"
......@@ -169,7 +168,7 @@
android:id="@+id/totalTitleENTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="TOTAL"
android:text="@string/total_en"
android:textAlignment="center"
android:textColor="#746661"
android:textSize="30sp"
......@@ -183,7 +182,6 @@
android:layout_marginStart="35dp"
android:background="@drawable/textview_count_border"
android:gravity="center"
android:text="11"
android:textAlignment="center"
android:textColor="#746661"
android:textSize="50sp" />
......@@ -211,7 +209,7 @@
android:layout_marginBottom="1dp"
android:layout_marginTop="20dp"
android:layout_weight="1"
android:text="お近くのトイレ情報 "
android:text="@string/near_toilet_info_jp"
android:textAlignment="textEnd"
android:textColor="@android:color/white"
android:textSize="41sp"
......@@ -224,7 +222,7 @@
android:layout_marginBottom="1dp"
android:layout_marginTop="20dp"
android:layout_weight="1"
android:text=" Other Toilets Nearby"
android:text="@string/near_toilet_info_en"
android:textAlignment="textStart"
android:textColor="@android:color/white"
android:textSize="35sp" />
......@@ -261,17 +259,22 @@
android:id="@+id/leftGateNameJPTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="西口地下改札外"
android:ellipsize="end"
android:singleLine="true"
android:text="@string/left_toilet_info_jp"
android:textAlignment="center"
android:textColor="@android:color/white"
android:textSize="40sp"
android:textStyle="bold" />
android:textStyle="bold"
/>
<TextView
android:id="@+id/leftGateNameENTextView"
android:layout_width="match_parent"
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:textColor="@android:color/white"
android:textSize="25sp" />
......@@ -290,7 +293,7 @@
android:id="@+id/separator4"
android:layout_width="3dip"
android:layout_height="match_parent"
android:layout_marginStart="20dp"
android:layout_marginStart="10dp"
android:layout_marginTop="15dp"
android:layout_marginBottom="15dp"
android:background="#FFFFFF" />
......@@ -315,8 +318,9 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:singleLine="true"
android:maxLines="1"
android:text="南口改札内"
android:text="@string/right_toilet_info_jp"
android:textAlignment="center"
android:textColor="@android:color/white"
android:textSize="40sp"
......@@ -326,7 +330,9 @@
android:id="@+id/rightGateNameENTextView"
android:layout_width="match_parent"
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:textColor="@android:color/white"
android:textSize="25sp" />
......
......@@ -2,4 +2,19 @@
<string name="initDisplayString">ご利用ありがとうございます。\nThank you.</string>
<string name="initDisplayStringError">ご利用ありがとうございます。(%1$d)\nThank you.</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>
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