Commit be853ac0 by Kim Jinsung

First commit

parents
*.iml
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
/captures
.externalNativeBuild
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
</set>
</option>
<option name="resolveModulePerSourceSet" value="false" />
</GradleProjectSettings>
</option>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="NullableNotNullManager">
<option name="myDefaultNullable" value="android.support.annotation.Nullable" />
<option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
<option name="myNullables">
<value>
<list size="4">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
</list>
</value>
</option>
<option name="myNotNulls">
<value>
<list size="4">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" />
</list>
</value>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/ToiletSignage.iml" filepath="$PROJECT_DIR$/ToiletSignage.iml" />
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RunConfigurationProducerService">
<option name="ignoredProducers">
<set>
<option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
</set>
</option>
</component>
</project>
\ No newline at end of file
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "jp.odakyu.toiletsignage"
minSdkVersion 23
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:support-v4:26.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
package jp.odakyu.toiletsignage;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("jp.odakyu.toiletsignage", appContext.getPackageName());
}
}
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="jp.odakyu.toiletsignage">
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<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" />
<application
android:name=".application.ToiletApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:label="トイレ空室管理サイネージアプリ"
android:supportsRtl="true"
android:theme="@style/Theme.AppCompat.Light.NoActionBar.FullScreen"
android:screenOrientation="landscape">
<activity
android:name=".activity.MainActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:theme="@style/Theme.AppCompat.Light.NoActionBar.FullScreen">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<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"/>
</application>
</manifest>
\ No newline at end of file
package jp.odakyu.toiletsignage.activity;
import android.Manifest;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.support.annotation.NonNull;
import android.support.v4.app.ActivityCompat;
import android.os.Bundle;
import android.util.Log;
import android.widget.TextView;
import android.graphics.Typeface;
import android.widget.Toast;
import jp.odakyu.toiletsignage.R;
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.
* status bar and navigation/system bar) with user interaction.
*/
public class MainActivity extends ParentActivity {
private final String TAG = "MainActivity";
private TextView mMessageTextView;
private final int REQUEST_PERMISSION = 1000;
private final int REQUEST_CODE = 1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mMessageTextView = findViewById(R.id.fullscreen_content);
mMessageTextView.setTypeface(Typeface.createFromAsset(getAssets(), "meiryob.ttf"));
if (!toiletInfo.getUsbFileCopyComplete()) {
//外部ストレージの権限付与
if (checkPermission()) {
//USBからJSONデータ取得
getUsbFileInfo();
} else {
requestLocationPermission();
}
}
}
private void getUsbFileInfo() {
MainLogic mainLogic = new MainLogic();
try {
mainLogic.getToiletDefaultInfo(this);
if (!toiletInfo.getValidation()) {
mMessageTextView.setText(getString(R.string.initDisplayStringError, ToiletInfo.VALUE_DEFAULT_TOILET_VALIDATION_FAIL));
Log.e(TAG, "ToiletDefaultJson validation fail");
return;
}
if (toiletInfo.getToiletDefaultJsonArray() == null && toiletInfo.getToiletDefaultJsonArray().size() == 0) {
mMessageTextView.setText(getString(R.string.initDisplayStringError, ToiletInfo.VALUE_DEFAULT_TOILET_NULL));
Log.e(TAG, "ToiletDefaultArray NULL");
return;
}
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();
}
}
// permissionの確認
public boolean checkPermission() {
// 既に許可している
if (ActivityCompat.checkSelfPermission(this,
Manifest.permission.WRITE_EXTERNAL_STORAGE) ==
PackageManager.PERMISSION_GRANTED){
return TRUE;
}
return FALSE;
}
// 許可を求める
private void requestLocationPermission() {
if (ActivityCompat.shouldShowRequestPermissionRationale(this,
Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
ActivityCompat.requestPermissions(MainActivity.this,
new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, REQUEST_PERMISSION);
} else {
Toast toast =
Toast.makeText(getApplicationContext(), "アプリ実行に許可が必要です", Toast.LENGTH_SHORT);
toast.show();
ActivityCompat.requestPermissions(this,
new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},
REQUEST_PERMISSION);
}
}
// 結果の受け取り
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
if (requestCode == REQUEST_PERMISSION) {
// 使用が許可された
if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
getUsbFileInfo();
} else {
// それでも拒否された時の対応
Toast toast =
Toast.makeText(this, "許可しないと、正常に動作できないので、アプリを再起動してださい。", Toast.LENGTH_SHORT);
toast.show();
}
}
}
@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
public void reloadDisplayView() {
Log.d(TAG, "reloadDisplayView");
mHandler.post(new Runnable() {
@Override
public void run() {
if (toiletInfo.getConnectErrorCount() == 0) {
if (toiletInfo.getToiletDefaultJsonArray().size() > 0 && toiletInfo.getResultToiletJsonMapSize() > 0) {
//Move Signage View
Intent intent = new Intent(MainActivity.this, SignageActivity.class);
startActivity(intent);
finish();
} else {
mMessageTextView.setText(getString(R.string.initDisplayStringError, ToiletInfo.VALUE_TOILET_SERVER_CONNECT_FAIL));
}
} else {
if (toiletInfo.getNetworkConnect()) {
mMessageTextView.setText(getString(R.string.initDisplayStringError, ToiletInfo.VALUE_NETWORK_DIS_CONNECT));
} else {
mMessageTextView.setText(getString(R.string.initDisplayStringError, ToiletInfo.VALUE_TOILET_SERVER_CONNECT_FAIL));
}
}
}
});
}
}
package jp.odakyu.toiletsignage.activity;
import android.content.BroadcastReceiver;
import android.content.Context;
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.info.ToiletInfo;
/**
* Created by agentec on 2017/12/11.
*/
public class ParentActivity extends AppCompatActivity {
private final String TAG = "ParentActivity";
Handler mHandler;
ToiletInfo toiletInfo;
BroadcastReceiver broadcastReceiver;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//横画面
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
//ステータスバー非表示
Window window = getWindow();
View view = window.getDecorView();
view.setSystemUiVisibility(
View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY |
View.SYSTEM_UI_FLAG_HIDE_NAVIGATION |
View.SYSTEM_UI_FLAG_FULLSCREEN);
//BackgroundThreadからMainThread使用するため
mHandler = new Handler();
toiletInfo = ToiletInfo.getInstance();
//BroadcastReceiver設定
IntentFilter filter = new IntentFilter(ToiletInfo.NAME_CONNTENT_FINISH);
broadcastReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
reloadDisplayView();
}
};
registerReceiver(broadcastReceiver, filter);
}
@Override
protected void onResume() {
super.onResume();
}
@Override
protected void onDestroy() {
super.onDestroy();
unregisterReceiver(broadcastReceiver);
}
@Override
protected void onPause() {
super.onPause();
}
@Override
protected void onStop() {
ToiletApplication application = (ToiletApplication) getApplication();
//アプリがバックグラウンドのなった時のみタスクを停止
if (!application.isForegrdound(this)) {
Log.i(TAG, "Application Background");
application.stopTimer();
}
super.onStop();
}
@Override
protected void onStart() {
ToiletApplication application = (ToiletApplication) getApplication();
//初回起動時以外はタスク開始(バックグラウンドからフォアグラウンド対応)
if (toiletInfo.getToiletDefaultJsonArray() != null) {
application.startTimer();
}
super.onStart();
}
//Child Classから実装
public void reloadDisplayView() {}
}
package jp.odakyu.toiletsignage.activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import android.graphics.Typeface;
import java.util.ArrayList;
import jp.odakyu.toiletsignage.R;
import jp.odakyu.toiletsignage.info.ToiletInfo;
import jp.odakyu.toiletsignage.json.ResultToiletJson;
import jp.odakyu.toiletsignage.json.ToiletDefaultJson;
import static java.lang.Boolean.TRUE;
/**
* Created by agentec on 2017/11/30.
*/
public class SignageActivity extends ParentActivity {
private 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 {
setContentView(R.layout.activity_signage_1);
}
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);
if (toiletInfo.getToiletDefaultJsonArray() != null && toiletInfo.getToiletDefaultJsonArray().size() == 3) {
leftStatusIconImageView = (ImageView) findViewById(R.id.leftStatusIconImageView);
rightStatusIconImageView = (ImageView) findViewById(R.id.rightStatusIconImageView);
//お近くのトイレ情報設定
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);
for (ToiletDefaultJson toiletDefaultJson:
toiletInfo.getToiletDefaultJsonArray()) {
if (toiletDefaultJson.getPriority() == ToiletInfo.VALUE_PRIORITY_SUB_LEFT) {
leftGateNameJPTextView.setText(toiletDefaultJson.getToiletNameJP());
leftGateNameENTextView.setText(toiletDefaultJson.getToiletNameEN());
} else if (toiletDefaultJson.getPriority() == ToiletInfo.VALUE_PRIORITY_SUB_RIGHT) {
rightGateNameJPTextView.setText(toiletDefaultJson.getToiletNameJP());
rightGateNameENTextView.setText(toiletDefaultJson.getToiletNameEN());
}
}
}
int toiletSex = toiletInfo.getToiletSex();
if (toiletInfo.getToiletDefaultJsonArray() != null && toiletInfo.getToiletDefaultJsonArray().size() == 3) {
if (toiletSex == ToiletInfo.VALUE_SEX_MAN) {
sexualityIconImageView.setImageResource(R.drawable.icon_man_3);
} else {
sexualityIconImageView.setImageResource(R.drawable.icon_woman_3);
}
} else {
if (toiletSex == ToiletInfo.VALUE_SEX_MAN) {
sexualityIconImageView.setImageResource(R.drawable.icon_man_1);
} else {
sexualityIconImageView.setImageResource(R.drawable.icon_woman_1);
}
}
settingDisplay();
}
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"));
}
}
@Override
public void reloadDisplayView() {
Log.i(TAG, "reloadDisplayView");
//バックグラウンドスレッドからメーイン
mHandler.post(new Runnable() {
@Override
public void run() {
if (toiletInfo.getConnectErrorCount() > ToiletInfo.MAX_ERROR_COUNT) {
//サーバ側から取得したトイレ情報削除
toiletInfo.clearResultToiletJsonMap();
moveMainView();
} else {
settingDisplay();
}
}
});
}
private void moveMainView() {
Intent intent = new Intent(SignageActivity.this, MainActivity.class);
startActivity(intent);
finish();
}
private void settingDisplay() {
ArrayList<ToiletDefaultJson> toiletDefaultJsonArray = toiletInfo.getToiletDefaultJsonArray();
if (toiletDefaultJsonArray == null || toiletDefaultJsonArray.size() == 0) {
//MainActivity 移動
moveMainView();
}
for (ToiletDefaultJson toiletDefaultJson:
toiletDefaultJsonArray) {
ArrayList<ResultToiletJson> resultToiletJson = toiletInfo.getResultToiletJsonMap(toiletDefaultJson.getToiletId());
int vacantCount = toiletInfo.getVacantCount(toiletDefaultJson.getToiletId());
int 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) {
if (vacantCount == 0) {
statusIconImageView.setImageResource(R.drawable.icon_full_3);
} else {
statusIconImageView.setImageResource(R.drawable.icon_empty_3);
}
} else {
if (vacantCount == 0) {
statusIconImageView.setImageResource(R.drawable.icon_full_1);
} else {
statusIconImageView.setImageResource(R.drawable.icon_empty_1);
}
}
} else if (toiletDefaultJson.getPriority() == toiletInfo.VALUE_PRIORITY_SUB_LEFT) { //お近くトイレ(左側)
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) { //お近くトイレ(左側)
if (vacantCount == 0) {
rightStatusIconImageView.setImageResource(R.drawable.icon_full_sub);
} else {
rightStatusIconImageView.setImageResource(R.drawable.icon_empty_sub);
}
}
}
}
}
package jp.odakyu.toiletsignage.application;
import android.app.ActivityManager;
import android.app.Application;
import android.content.Context;
import android.util.Log;
import java.util.List;
import java.util.Timer;
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.
*/
public class ToiletApplication extends Application {
private final String TAG = "ToiletApplication";
private Timer updateToiletInfoTimer;
@Override
public void onCreate() {
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() {
Log.i(TAG, "stopTimer");
if (updateToiletInfoTimer != null) {
Log.i(TAG, "stopTimer STOP");
updateToiletInfoTimer.cancel();
updateToiletInfoTimer = null;
}
}
public void startTimer() {
settingToiletUpdateTimer();
}
public boolean isForegrdound(Context context) {
ActivityManager am = (ActivityManager)getSystemService(Context.ACTIVITY_SERVICE);
List<ActivityManager.RunningAppProcessInfo> processInfoList = am.getRunningAppProcesses();
boolean isForegrdound = FALSE;
for( ActivityManager.RunningAppProcessInfo info : processInfoList){
if(info.processName.equals(getPackageName())){
if( info.importance == ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREGROUND){
isForegrdound = TRUE;
break;
// ここにフォアグラウンドの場合の処理を実装
}
}
}
return isForegrdound;
}
}
package jp.odakyu.toiletsignage.connection;
import android.util.Base64;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
/**
* Created by agentec on 2017/12/11.
*/
public class ToiletServerConnection {
private final String TOILET_INFO_URL = "https://odakyu.api.toilet.mono-connect.jp/1/placements/%d/box_summaries_search ";
private final String LOGIN_ID = "nh2h2KntNPpgXcqEAtcJxwJd49jNcJ4J";
private final String PASSWORD = "jm2kCd6ZK2EZTzcMgxtge3AC4EeJ4ZqW";
private final int CONNECTION_TIMEOUT = 30 * 1000;
private final int READ_TIMEOUT = 30 * 1000;
public String connectionToiletServer(int toiletId) throws Exception {
URL url = new URL(String.format(TOILET_INFO_URL, toiletId));
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setConnectTimeout(CONNECTION_TIMEOUT);
conn.setReadTimeout(READ_TIMEOUT);
conn.setRequestProperty("Authorization", "Basic " + Base64.encodeToString((LOGIN_ID + ":" + PASSWORD).getBytes(), Base64.NO_WRAP));
conn.setRequestMethod("GET");
conn.connect();
int statusCode = conn.getResponseCode();
if(statusCode == HttpURLConnection.HTTP_OK){
StringBuffer result = new StringBuffer();
//responseの読み込み
final InputStream in = conn.getInputStream();
String encoding = conn.getContentEncoding();
if(null == encoding){
encoding = "UTF-8";
}
final InputStreamReader inReader = new InputStreamReader(in, encoding);
final BufferedReader bufferedReader = new BufferedReader(inReader);
String line = null;
while((line = bufferedReader.readLine()) != null) {
result.append(line);
}
bufferedReader.close();
inReader.close();
in.close();
return result.toString();
}
return null;
}
}
package jp.odakyu.toiletsignage.file;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
/**
* Created by agentec on 2017/12/08.
*/
public class FileUtil {
public static String convertStreamToString(InputStream is) throws Exception {
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
StringBuilder sb = new StringBuilder();
String line = null;
while ((line = reader.readLine()) != null) {
sb.append(line).append("\n");
}
reader.close();
return sb.toString();
}
public static String getStringFromFile (String filePath) throws Exception {
File fl = new File(filePath);
FileInputStream fin = new FileInputStream(fl);
String ret = convertStreamToString(fin);
//Make sure you close all streams.
fin.close();
return ret;
}
public static void fileCopy(String fromPath, String toPath) throws IOException {
//FileInputStreamのオブジェクトを生成する
FileInputStream fileIn = new FileInputStream(fromPath);
//FileOutputStreamのオブジェクトを生成する
FileOutputStream fileOut = new FileOutputStream(toPath);
// byte型の配列を宣言
byte[] buf = new byte[256];
int len;
// ファイルの終わりまで読み込む
while((len = fileIn.read(buf)) != -1){
fileOut.write(buf);
}
//ファイルに内容を書き込む
fileOut.flush();
//ファイルの終了処理
fileOut.close();
fileIn.close();
}
}
package jp.odakyu.toiletsignage.info;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import jp.odakyu.toiletsignage.json.ResultToiletJson;
import jp.odakyu.toiletsignage.json.ToiletDefaultJson;
/**
* Created by agentec on 2017/12/11.
*/
public class ToiletInfo {
static ToiletInfo instance = null;
public static final String NAME_CONNTENT_FINISH = "jp.odakyu.toiletsignage.CONNECT_FINISH";
public static final int VALUE_SEX_MAN = 0;
public static final int VALUE_SEX_WOMAN = 1;
public static final int VALUE_PRIORITY_MAIN = 0;
public static final int VALUE_PRIORITY_SUB_LEFT = 1;
public static final int VALUE_PRIORITY_SUB_RIGHT = 2;
public static final int VALUE_DEFAULT_TOILET_NULL = 0;
public static final int VALUE_DEFAULT_TOILET_VALIDATION_FAIL = 1;
public static final int VALUE_NETWORK_DIS_CONNECT = 2;
public static final int VALUE_TOILET_SERVER_CONNECT_FAIL = 3;
public static final int MAX_ERROR_COUNT = 6;
private ArrayList<ToiletDefaultJson> mToiletDefaultJsonArray;
private Map<Integer, ArrayList<ResultToiletJson>> mResultToiletJsonMap = new HashMap<Integer, ArrayList<ResultToiletJson>>();
private boolean isValidation;
private boolean isUsbFileCopyComplete;
private int mConnectErrorCount;
private boolean isNetworkConnect;
public static synchronized ToiletInfo getInstance() {
if (instance == null) {
instance = new ToiletInfo();
}
return instance;
}
public void setToiletDefaultJsonArray(ArrayList<ToiletDefaultJson> defaultToiletJsonArray) {
mToiletDefaultJsonArray = defaultToiletJsonArray;
}
public ArrayList<ToiletDefaultJson> getToiletDefaultJsonArray() {
return mToiletDefaultJsonArray;
}
public void setResultToiletJsonMap(int toiletId, ArrayList<ResultToiletJson> resultToiletJsonMap) {
mResultToiletJsonMap.put(toiletId, resultToiletJsonMap);
}
public ArrayList<ResultToiletJson> getResultToiletJsonMap(int toiletId) {
return mResultToiletJsonMap.get(toiletId);
}
public int getResultToiletJsonMapSize() {
return mResultToiletJsonMap.size();
}
public void clearResultToiletJsonMap() {
mResultToiletJsonMap.clear();
}
public int getToiletSex() {
if (mToiletDefaultJsonArray != null && mToiletDefaultJsonArray.size() > 0) {
ToiletDefaultJson toiletDefaultJson = mToiletDefaultJsonArray.get(0);
return toiletDefaultJson.getToiletSex();
}
return -1;
}
public int getVacantCount(int toiletId) {
if (mResultToiletJsonMap != null && mResultToiletJsonMap.size() > 0) {
ArrayList<ResultToiletJson> resultToiletJsonArray = getResultToiletJsonMap(toiletId);
int vacantCount = 0;
for (ResultToiletJson resultToiletJson:resultToiletJsonArray) {
if (resultToiletJson.getStatus().equals(ResultToiletJson.VALUE_STATUS_OPEN)) {
vacantCount++;
}
}
return vacantCount;
}
return -1;
}
public int getTotalCount(int toiletId) {
if (mResultToiletJsonMap != null && mResultToiletJsonMap.size() > 0) {
ArrayList<ResultToiletJson> resultToiletJsonArray = getResultToiletJsonMap(toiletId);
return resultToiletJsonArray.size();
}
return 0;
}
public void setValidation(boolean validation) {
isValidation = validation;
}
public boolean getValidation() {
return isValidation;
}
public void setUsbFileCopyComplete(boolean usbFileCopyComplete) {
isUsbFileCopyComplete = usbFileCopyComplete;
}
public boolean getUsbFileCopyComplete() {
return isUsbFileCopyComplete;
}
public void setConnectErrorCount(int connectErrorCount) {
mConnectErrorCount = connectErrorCount;
}
public int getConnectErrorCount() {
return mConnectErrorCount;
}
public void setNetworkConnect(boolean networkConnect) {
isNetworkConnect = networkConnect;
}
public boolean getNetworkConnect() {
return isNetworkConnect;
}
}
package jp.odakyu.toiletsignage.json;
import org.json.JSONException;
import org.json.JSONObject;
/**
* Created by agentec on 2017/12/08.
*/
public class ResultToiletJson {
/**
* JSON Param
*/
public static final String KEY_CODE = "code";
public static final String KEY_RESULT = "result";
public static final String VALUE_STATUS_OPEN = "open";
private final String KEY_ID = "id";
private final String KEY_NAME = "name";
private final String KEY_STATUS = "status";
private final String KEY_CHANGED_AT = "changed_at";
private final String KEY_ELAPSED_SECONDS = "elapsed_seconds";
private int id;
private String name;
private String status;
private String changed_at;
private int elapsed_seconds;
public int getId() {return id;}
public String getName() {
return name;
}
public String getStatus() {
return status;
}
public String getChangedAT() {
return changed_at;
}
public int getElapsedSeconds() {
return elapsed_seconds;
}
public ResultToiletJson(JSONObject jsonObject) throws JSONException {
id = jsonObject.getInt(KEY_ID);
name = jsonObject.getString(KEY_NAME);
status = jsonObject.getString(KEY_STATUS);
changed_at = jsonObject.getString(KEY_CHANGED_AT);
elapsed_seconds = jsonObject.getInt(KEY_ELAPSED_SECONDS);
}
}
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;
/**
* Created by agentec on 2017/12/08.
*/
public class ToiletDefaultJson {
/**
* JSON Param
*/
private final String KEY_PRIORITY = "priority";
private final String KEY_TOILET_ID = "toiletId";
private final String KEY_TOILET_SEX = "toiletSex";
private final String KEY_TOILET_NAME_EN = "toiletName_en";
private final String KEY_TOILET_NAME_JP = "toiletName_jp";
private int priority;
private int toiletId;
private int toiletSex;
private String toiletName_en;
private String toiletName_jp;
public int getPriority() {
return priority;
}
public int getToiletId() {
return toiletId;
}
public int getToiletSex() {return toiletSex;}
public String getToiletNameEN() {
return toiletName_en;
}
public String getToiletNameJP() {
return toiletName_jp;
}
public ToiletDefaultJson(JSONObject jsonObject) throws JSONException {
priority = jsonObject.getInt(KEY_PRIORITY);
toiletId = jsonObject.getInt(KEY_TOILET_ID);
toiletSex = jsonObject.getInt(KEY_TOILET_SEX);
if (jsonObject.has(KEY_TOILET_NAME_EN)) {
toiletName_en = jsonObject.getString(KEY_TOILET_NAME_EN);
}
if (jsonObject.has(KEY_TOILET_NAME_JP)) {
toiletName_jp = jsonObject.getString(KEY_TOILET_NAME_JP);
}
}
public boolean validation(JSONObject jsonObject) {
if (!jsonObject.has(KEY_PRIORITY)) {
return FALSE;
}
if (!jsonObject.has(KEY_TOILET_ID)) {
return FALSE;
}
if (!jsonObject.has(KEY_TOILET_SEX)) {
return FALSE;
}
if (getToiletId() < 0 || getToiletId() > 1000000) {
return FALSE;
}
if (getToiletSex() != 0 && getToiletSex() != 1) {
return FALSE;
}
if (getToiletSex() != 0 && getToiletSex() != 1) {
return FALSE;
}
if (getPriority() != 0 && getPriority() != 1 && getPriority() != 2) {
return FALSE;
}
return TRUE;
}
}
package jp.odakyu.toiletsignage.logic;
import android.content.Context;
import android.os.Environment;
import android.util.Log;
import org.json.JSONArray;
import org.json.JSONObject;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import jp.odakyu.toiletsignage.file.FileUtil;
import jp.odakyu.toiletsignage.info.ToiletInfo;
import jp.odakyu.toiletsignage.json.ToiletDefaultJson;
import static java.lang.Boolean.FALSE;
/**
* Created by agentec on 2017/12/08.
*/
public class MainLogic {
private static final String TOILET_INFO_JSON = "/toiletInfo.json";
private static final String KEY_TOILET_ARRAY = "toiletArray";
private static final String TAG = "MainLogic";
public void getToiletDefaultInfo(Context context) throws Exception {
String []rootStorageDirectory = getExtSdCardPathsForActivity(context);
File downloadFilePath = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);
String copyFilePath = downloadFilePath.getPath() + TOILET_INFO_JSON;
for(String directoryName:rootStorageDirectory) {
String jsonFilePath = directoryName + TOILET_INFO_JSON;
Log.d(TAG, jsonFilePath);
File uspJsonFile = new File(jsonFilePath);
if (uspJsonFile.exists() && uspJsonFile.isFile()) {
FileUtil.fileCopy(jsonFilePath, copyFilePath);
break;
} else {
Log.e(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;
for (int i = 0; i < jsonArray.length(); i++){
ToiletDefaultJson toiletDefaultJson = new ToiletDefaultJson(jsonArray.getJSONObject(i));
isValidation = toiletDefaultJson.validation(jsonArray.getJSONObject(i));
if (isValidation) {
toiletDefaultJsonArray.add(toiletDefaultJson);
} else {
break;
}
}
ToiletInfo.getInstance().setValidation(isValidation);
if (toiletDefaultJsonArray.size() != 0 && isValidation) {
ToiletInfo.getInstance().setToiletDefaultJsonArray(toiletDefaultJsonArray);
}
}
}
public static String[] getExtSdCardPathsForActivity(Context context) {
List<String> paths = new ArrayList<>();
for (File file : context.getExternalFilesDirs("external")) {
if (file != null) {
int index = file.getAbsolutePath().lastIndexOf("/Android/data");
if (index < 0) {
Log.w("AmazeFileUtils", "Unexpected external file dir: " + file.getAbsolutePath());
} else {
String path = file.getAbsolutePath().substring(0, index);
try {
path = new File(path).getCanonicalPath();
} catch (IOException e) {
// Keep non-canonical path.
}
paths.add(path);
}
}
}
if (paths.isEmpty()) paths.add("/storage/sdcard1");
return paths.toArray(new String[0]);
}
}
package jp.odakyu.toiletsignage.task;
import android.content.Context;
import android.content.Intent;
import android.net.ConnectivityManager;
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.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;
/**
* Created by agentec on 2017/12/11.
*/
public class UpdateToiletInfoTask extends TimerTask {
private static int mErrorCount = 0;
private final String TAG = "UpdateToiletInfoTask";
private Context applicationContext;
private ToiletInfo toiletInfo;
public UpdateToiletInfoTask(Context context){
applicationContext = context;
toiletInfo = ToiletInfo.getInstance();
}
@Override
public void run() {
Log.i(TAG, "Thread Start");
boolean isNetworkConnect = TRUE;
//インターネット接続チェック
if (isInternetAvailable() && isNetworkAvailable(applicationContext)) {
ArrayList<ToiletDefaultJson> toiletInfoArray = toiletInfo.getToiletDefaultJsonArray();
boolean isError = FALSE;
for (ToiletDefaultJson toiletDefaultJson:toiletInfoArray) {
ToiletServerConnection con = new ToiletServerConnection();
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;
break;
}
ArrayList<ResultToiletJson> resultToiletJsonArray = new ArrayList<ResultToiletJson>();
JSONArray jsonArray = jsonObject.getJSONArray(ResultToiletJson.KEY_RESULT);
for (int i = 0; i < jsonArray.length(); i++){
ResultToiletJson resultToiletJson = new ResultToiletJson((JSONObject) jsonArray.get(i));
resultToiletJsonArray.add(resultToiletJson);
}
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;
break;
}
}
if (isError) {
mErrorCount++;
} else {
mErrorCount = 0;
}
} else {
mErrorCount++;
isNetworkConnect = FALSE;
}
toiletInfo.setConnectErrorCount(mErrorCount);
toiletInfo.setNetworkConnect(isNetworkConnect);
//Broadcast送信
Intent intent = new Intent("jp.odakyu.toiletsignage.CONNECT_FINISH");
applicationContext.sendBroadcast(intent);
Log.d(TAG, "Thread End");
}
public boolean isNetworkAvailable(Context context) {
final ConnectivityManager connectivityManager = ((ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE));
return connectivityManager.getActiveNetworkInfo() != null && connectivityManager.getActiveNetworkInfo().isConnected();
}
public boolean isInternetAvailable() {
try {
final InetAddress address = InetAddress.getByName("google.com");
return !address.equals("");
} catch (UnknownHostException e) {
// Log error
e.printStackTrace();
}
return false;
}
}
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportHeight="108"
android:viewportWidth="108">
<path
android:fillType="evenOdd"
android:pathData="M32,64C32,64 38.39,52.99 44.13,50.95C51.37,48.37 70.14,49.57 70.14,49.57L108.26,87.69L108,109.01L75.97,107.97L32,64Z"
android:strokeColor="#00000000"
android:strokeWidth="1">
<aapt:attr name="android:fillColor">
<gradient
android:endX="78.5885"
android:endY="90.9159"
android:startX="48.7653"
android:startY="61.0927"
android:type="linear">
<item
android:color="#44000000"
android:offset="0.0" />
<item
android:color="#00000000"
android:offset="1.0" />
</gradient>
</aapt:attr>
</path>
<path
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:pathData="M66.94,46.02L66.94,46.02C72.44,50.07 76,56.61 76,64L32,64C32,56.61 35.56,50.11 40.98,46.06L36.18,41.19C35.45,40.45 35.45,39.3 36.18,38.56C36.91,37.81 38.05,37.81 38.78,38.56L44.25,44.05C47.18,42.57 50.48,41.71 54,41.71C57.48,41.71 60.78,42.57 63.68,44.05L69.11,38.56C69.84,37.81 70.98,37.81 71.71,38.56C72.44,39.3 72.44,40.45 71.71,41.19L66.94,46.02ZM62.94,56.92C64.08,56.92 65,56.01 65,54.88C65,53.76 64.08,52.85 62.94,52.85C61.8,52.85 60.88,53.76 60.88,54.88C60.88,56.01 61.8,56.92 62.94,56.92ZM45.06,56.92C46.2,56.92 47.13,56.01 47.13,54.88C47.13,53.76 46.2,52.85 45.06,52.85C43.92,52.85 43,53.76 43,54.88C43,56.01 43.92,56.92 45.06,56.92Z"
android:strokeColor="#00000000"
android:strokeWidth="1" />
</vector>
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#FFFFFF"/>
<stroke android:width="3dp" android:color="#746661" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#FFFFFF"/>
<stroke android:width="7dp" android:color="#746661" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportHeight="108"
android:viewportWidth="108">
<path
android:fillColor="#26A69A"
android:pathData="M0,0h108v108h-108z" />
<path
android:fillColor="#00000000"
android:pathData="M9,0L9,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,0L19,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M29,0L29,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M39,0L39,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M49,0L49,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M59,0L59,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M69,0L69,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M79,0L79,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M89,0L89,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M99,0L99,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,9L108,9"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,19L108,19"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,29L108,29"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,39L108,39"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,49L108,49"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,59L108,59"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,69L108,69"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,79L108,79"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,89L108,89"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,99L108,99"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,29L89,29"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,39L89,39"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,49L89,49"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,59L89,59"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,69L89,69"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,79L89,79"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M29,19L29,89"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M39,19L39,89"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M49,19L49,89"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M59,19L59,89"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M69,19L69,89"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M79,19L79,89"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
</vector>
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<!-- 背景色 -->
<solid android:color="#746661" />
<!-- 角の丸み -->
<corners android:radius="6dp" />
<!-- 枠線 width:線の幅、color:線の色 -->
<stroke
android:width="2dp"
android:color="#746661" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<!-- 背景色 -->
<solid android:color="#FFFFFF" />
<!-- 角の丸み -->
<corners android:radius="6dp" />
<!-- 枠線 width:線の幅、color:線の色 -->
<stroke
android:width="3dp"
android:color="#746661" />
</shape>
\ No newline at end of file
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#746661"
android:visibility="visible"
tools:context="jp.odakyu.toiletsignage.activity.MainActivity">
<!-- The primary full-screen view. This can be replaced with whatever view
is needed to present your content, e.g. VideoView, SurfaceView,
TextureView, etc. -->
<TextView
android:id="@+id/fullscreen_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:keepScreenOn="true"
android:text="@string/initDisplayString"
android:textColor="@android:color/white"
android:textSize="50sp"
android:textStyle="bold" />
<!-- This FrameLayout insets its children based on system windows using
android:fitsSystemWindows. -->
</FrameLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/bg_border_1"
android:orientation="vertical"
tools:context="jp.odakyu.toiletsignage.activity.SignageActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="10dp"
android:paddingTop="50dp"
android:orientation="horizontal">
<TextView
android:id="@+id/mainTitleJPTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="トイレの空き情報"
android:textAlignment="textEnd"
android:textColor="#746661"
android:textSize="53sp"
android:textStyle="bold" />
<TextView
android:id="@+id/mainTitleENTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1.07"
android:text=" Toilets Vacancy"
android:textAlignment="textStart"
android:textColor="#746661"
android:textSize="40sp" />
</LinearLayout>
<View
android:id="@+id/separator"
android:layout_width="match_parent"
android:layout_height="3dip"
android:layout_alignParentTop="true"
android:layout_centerVertical="true"
android:layout_marginEnd="50dp"
android:layout_marginStart="50dp"
android:background="#746661" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/statusIconImageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toLeftOf="@id/sexualityIconImageView"
android:layout_centerVertical="true"
app:srcCompat="@drawable/icon_empty_1" />
<ImageView
android:id="@+id/sexualityIconImageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_marginEnd="80dp"
android:layout_marginStart="130dp"
app:srcCompat="@drawable/icon_woman_1" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/sexualityIconImageView"
android:layout_centerVertical="true"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginTop="10dp"
android:orientation="vertical">
<TextView
android:id="@+id/vacantTitleJPTextView"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:text="空き"
android:textAlignment="center"
android:textColor="#746661"
android:textSize="50sp"
android:textStyle="bold" />
<TextView
android:id="@+id/vacantTitleENTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="VACANT"
android:textAlignment="center"
android:textColor="#746661"
android:textSize="30sp"
android:textStyle="bold" />
</LinearLayout>
<TextView
android:id="@+id/vacantCountTextView"
android:layout_width="135dp"
android:layout_height="135dp"
android:layout_marginEnd="40dp"
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" />
</LinearLayout>
<View
android:id="@+id/separator2"
android:layout_width="match_parent"
android:layout_height="3dip"
android:layout_marginBottom="20dp"
android:layout_marginEnd="20dp"
android:layout_marginStart="20dp"
android:layout_marginTop="20dp"
android:background="#FFFFFF" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginTop="10dp"
android:orientation="vertical">
<TextView
android:id="@+id/totalTitleJPTextView"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:text="総数"
android:textAlignment="center"
android:textColor="#746661"
android:textSize="50sp"
android:textStyle="bold" />
<TextView
android:id="@+id/totalTitleENTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="TOTAL"
android:textAlignment="center"
android:textColor="#746661"
android:textSize="30sp"
android:textStyle="bold" />
</LinearLayout>
<TextView
android:id="@+id/totalCountTextView"
android:layout_width="135dp"
android:layout_height="135dp"
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" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
</LinearLayout>
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/bg_border_3"
android:orientation="vertical"
tools:context="jp.odakyu.toiletsignage.activity.SignageActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<TextView
android:id="@+id/mainTitleJPTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingBottom="2dp"
android:paddingTop="20dp"
android:text="トイレの空き情報"
android:textAlignment="textEnd"
android:textColor="#746661"
android:textSize="52sp"
android:textStyle="bold" />
<TextView
android:id="@+id/mainTitleENTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1.05"
android:paddingBottom="2dp"
android:paddingTop="20dp"
android:text="  Toilets Vacancy"
android:textAlignment="viewStart"
android:textColor="#746661"
android:textSize="40sp" />
</LinearLayout>
<View
android:id="@+id/separator"
android:layout_width="match_parent"
android:layout_height="3dip"
android:layout_alignParentTop="true"
android:layout_centerVertical="true"
android:layout_marginEnd="50dp"
android:layout_marginStart="50dp"
android:background="#746661" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal">
<ImageView
android:id="@+id/statusIconImageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginEnd="150dp"
app:srcCompat="@drawable/icon_empty_3" />
<ImageView
android:id="@+id/sexualityIconImageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="75dp"
app:srcCompat="@drawable/icon_man_3" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="40dp"
android:layout_marginTop="40dp"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginTop="10dp"
android:orientation="vertical">
<TextView
android:id="@+id/vacantTitleJPTextView"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:text="空き"
android:textAlignment="center"
android:textColor="#746661"
android:textSize="50sp"
android:textStyle="bold" />
<TextView
android:id="@+id/vacantTitleENTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="VACANT"
android:textAlignment="center"
android:textColor="#746661"
android:textSize="30sp"
android:textStyle="bold" />
</LinearLayout>
<TextView
android:id="@+id/vacantCountTextView"
android:layout_width="135dp"
android:layout_height="135dp"
android:layout_marginStart="35dp"
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" />
</LinearLayout>
<View
android:id="@+id/separator2"
android:layout_width="match_parent"
android:layout_height="3dip"
android:layout_marginBottom="20dp"
android:layout_marginTop="20dp"
android:layout_marginStart="20dp"
android:layout_marginEnd="20dp"
android:background="#746661" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginTop="10dp"
android:orientation="vertical">
<TextView
android:id="@+id/totalTitleJPTextView"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:text="総数"
android:textAlignment="center"
android:textColor="#746661"
android:textSize="50sp"
android:textStyle="bold" />
<TextView
android:id="@+id/totalTitleENTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="TOTAL"
android:textAlignment="center"
android:textColor="#746661"
android:textSize="30sp"
android:textStyle="bold" />
</LinearLayout>
<TextView
android:id="@+id/totalCountTextView"
android:layout_width="135dp"
android:layout_height="135dp"
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" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#746661"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/subTitleJPTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="1dp"
android:layout_marginTop="20dp"
android:layout_weight="1"
android:text="お近くのトイレ情報 "
android:textAlignment="textEnd"
android:textColor="@android:color/white"
android:textSize="41sp"
android:textStyle="bold" />
<TextView
android:id="@+id/subTitleENTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="1dp"
android:layout_marginTop="20dp"
android:layout_weight="1"
android:text=" Other Toilets Nearby"
android:textAlignment="textStart"
android:textColor="@android:color/white"
android:textSize="35sp" />
</LinearLayout>
<View
android:id="@+id/separator3"
android:layout_width="match_parent"
android:layout_height="3dip"
android:layout_alignParentTop="true"
android:layout_centerVertical="true"
android:layout_marginEnd="50dp"
android:layout_marginStart="50dp"
android:background="#FFFFFF" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="50dp"
android:layout_weight="1"
android:orientation="horizontal">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginTop="15dp"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="@+id/leftGateNameJPTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="西口地下改札外"
android:textAlignment="center"
android:textColor="@android:color/white"
android:textSize="40sp"
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:textAlignment="center"
android:textColor="@android:color/white"
android:textSize="25sp" />
</LinearLayout>
<ImageView
android:id="@+id/leftStatusIconImageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:layout_marginTop="22dp"
app:srcCompat="@drawable/icon_empty_sub" />
<View
android:id="@+id/separator4"
android:layout_width="3dip"
android:layout_height="match_parent"
android:layout_marginStart="20dp"
android:layout_marginTop="15dp"
android:layout_marginBottom="15dp"
android:background="#FFFFFF" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="horizontal">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:layout_marginTop="15dp"
android:orientation="vertical">
<TextView
android:id="@+id/rightGateNameJPTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:text="南口改札内"
android:textAlignment="center"
android:textColor="@android:color/white"
android:textSize="40sp"
android:textStyle="bold" />
<TextView
android:id="@+id/rightGateNameENTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="The South Gate(Inside)"
android:textAlignment="center"
android:textColor="@android:color/white"
android:textSize="25sp" />
</LinearLayout>
<ImageView
android:id="@+id/rightStatusIconImageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="50dp"
android:layout_marginTop="22dp"
app:srcCompat="@drawable/icon_full_sub" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>
\ No newline at end of file
<resources>
<!-- Declare custom theme attributes that allow changing which styles are
used for button bars depending on the API level.
?android:attr/buttonBarStyle is new as of API 11 so this is
necessary to support previous API levels. -->
<declare-styleable name="ButtonBarContainerTheme">
<attr name="metaButtonBarStyle" format="reference" />
<attr name="metaButtonBarButtonStyle" format="reference" />
</declare-styleable>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<resources>
</resources>
<resources>
<string name="initDisplayString">ご利用ありがとうございます。\nThank you.</string>
<string name="initDisplayStringError">ご利用ありがとうございます。(%1$d)\nThank you.</string>
<string name="toilet_background_image">toilet background image</string>
</resources>
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
</style>
<style name="Theme.AppCompat.Light.NoActionBar.FullScreen" parent="@style/Theme.AppCompat.Light">
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowContentOverlay">@null</item>
</style>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<usb-device vendor-id="1234" product-id="5678" class="255" subclass="66" protocol="1" />
</resources>
\ No newline at end of file
package jp.odakyu.toiletsignage;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
}
\ No newline at end of file
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx1536m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
#Wed Nov 29 09:24:14 JST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
#!/usr/bin/env bash
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn ( ) {
echo "$*"
}
die ( ) {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
esac
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windowz variants
if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
include ':app'
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