Commit cee93dce by SC.Jang

#27524 Analyzeの結果一部反映

parent be853ac0
......@@ -7,3 +7,6 @@
/build
/captures
.externalNativeBuild
.idea/modules.xml
.idea/misc.xml
.idea/vcs.xml
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="AndroidLintContentDescription" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="CanBeFinal" enabled="false" level="WARNING" enabled_by_default="false">
<option name="REPORT_CLASSES" value="false" />
<option name="REPORT_METHODS" value="false" />
<option name="REPORT_FIELDS" value="true" />
</inspection_tool>
</profile>
</component>
\ 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
......@@ -8,7 +8,7 @@
<application
android:name=".application.ToiletApplication"
android:allowBackup="true"
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:label="トイレ空室管理サイネージアプリ"
......
......@@ -76,7 +76,7 @@ public class MainActivity extends ParentActivity {
}
// permissionの確認
public boolean checkPermission() {
private boolean checkPermission() {
// 既に許可している
if (ActivityCompat.checkSelfPermission(this,
Manifest.permission.WRITE_EXTERNAL_STORAGE) ==
......@@ -148,7 +148,7 @@ public class MainActivity extends ParentActivity {
}
@Override
public void reloadDisplayView() {
protected void reloadDisplayView() {
Log.d(TAG, "reloadDisplayView");
mHandler.post(new Runnable() {
@Override
......
......@@ -20,12 +20,12 @@ import jp.odakyu.toiletsignage.info.ToiletInfo;
*/
public class ParentActivity extends AppCompatActivity {
private final String TAG = "ParentActivity";
private static final String TAG = "ParentActivity";
Handler mHandler;
ToiletInfo toiletInfo;
BroadcastReceiver broadcastReceiver;
private BroadcastReceiver broadcastReceiver;
@Override
protected void onCreate(Bundle savedInstanceState) {
......@@ -96,5 +96,5 @@ public class ParentActivity extends AppCompatActivity {
}
//Child Classから実装
public void reloadDisplayView() {}
protected void reloadDisplayView() {}
}
......@@ -22,7 +22,7 @@ import static java.lang.Boolean.TRUE;
*/
public class SignageActivity extends ParentActivity {
private final String TAG = "SignageActivity";
private static final String TAG = "SignageActivity";
private ImageView sexualityIconImageView;
private ImageView statusIconImageView;
private ImageView leftStatusIconImageView;
......@@ -162,7 +162,7 @@ public class SignageActivity extends ParentActivity {
}
@Override
public void reloadDisplayView() {
protected void reloadDisplayView() {
Log.i(TAG, "reloadDisplayView");
//バックグラウンドスレッドからメーイン
mHandler.post(new Runnable() {
......@@ -198,7 +198,7 @@ public class SignageActivity extends ParentActivity {
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 (toiletDefaultJson.getPriority() == ToiletInfo.VALUE_PRIORITY_MAIN) { //開設トイレ
if (vacantCount == -1) {
......@@ -221,13 +221,13 @@ public class SignageActivity extends ParentActivity {
}
}
} else if (toiletDefaultJson.getPriority() == toiletInfo.VALUE_PRIORITY_SUB_LEFT) { //お近くトイレ(左側)
} 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) { //お近くトイレ(左側)
} else if (toiletDefaultJson.getPriority() == ToiletInfo.VALUE_PRIORITY_SUB_RIGHT) { //お近くトイレ(左側)
if (vacantCount == 0) {
rightStatusIconImageView.setImageResource(R.drawable.icon_full_sub);
} else {
......
......@@ -13,11 +13,11 @@ import java.net.URL;
*/
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;
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;
public String connectionToiletServer(int toiletId) throws Exception {
URL url = new URL(String.format(TOILET_INFO_URL, toiletId));
......
......@@ -14,7 +14,7 @@ import java.io.InputStreamReader;
public class FileUtil {
public static String convertStreamToString(InputStream is) throws Exception {
private static String convertStreamToString(InputStream is) throws Exception {
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
StringBuilder sb = new StringBuilder();
String line = null;
......
......@@ -12,7 +12,7 @@ import jp.odakyu.toiletsignage.json.ToiletDefaultJson;
*/
public class ToiletInfo {
static ToiletInfo instance = null;
private static ToiletInfo instance = null;
public static final String NAME_CONNTENT_FINISH = "jp.odakyu.toiletsignage.CONNECT_FINISH";
public static final int VALUE_SEX_MAN = 0;
......@@ -31,10 +31,10 @@ public class ToiletInfo {
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;
private boolean isValidation = false;
private boolean isUsbFileCopyComplete = false;
private int mConnectErrorCount = 0;
private boolean isNetworkConnect = false;
public static synchronized ToiletInfo getInstance() {
......
......@@ -15,11 +15,11 @@ public class ResultToiletJson {
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 static final String KEY_ID = "id";
private static final String KEY_NAME = "name";
private static final String KEY_STATUS = "status";
private static final String KEY_CHANGED_AT = "changed_at";
private static final String KEY_ELAPSED_SECONDS = "elapsed_seconds";
private int id;
private String name;
......
......@@ -14,11 +14,11 @@ 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 static final String KEY_PRIORITY = "priority";
private static final String KEY_TOILET_ID = "toiletId";
private static final String KEY_TOILET_SEX = "toiletSex";
private static final String KEY_TOILET_NAME_EN = "toiletName_en";
private static final String KEY_TOILET_NAME_JP = "toiletName_jp";
private int priority;
private int toiletId;
......
......@@ -47,7 +47,7 @@ public class MainLogic {
}
if (new File(copyFilePath).exists()) {
JSONObject jsonObject = new JSONObject(FileUtil.getStringFromFile(copyFilePath));;
JSONObject jsonObject = new JSONObject(FileUtil.getStringFromFile(copyFilePath));
JSONArray jsonArray = jsonObject.getJSONArray(KEY_TOILET_ARRAY);
ArrayList<ToiletDefaultJson> toiletDefaultJsonArray = new ArrayList<ToiletDefaultJson>();
boolean isValidation = FALSE;
......@@ -68,7 +68,7 @@ public class MainLogic {
}
}
public static String[] getExtSdCardPathsForActivity(Context context) {
private static String[] getExtSdCardPathsForActivity(Context context) {
List<String> paths = new ArrayList<>();
for (File file : context.getExternalFilesDirs("external")) {
if (file != null) {
......
......@@ -26,8 +26,8 @@ import static java.lang.Boolean.TRUE;
*/
public class UpdateToiletInfoTask extends TimerTask {
private static int mErrorCount = 0;
private final String TAG = "UpdateToiletInfoTask";
private static final String TAG = "UpdateToiletInfoTask";
private int errorCount = 0;
private Context applicationContext;
private ToiletInfo toiletInfo;
......@@ -87,16 +87,16 @@ public class UpdateToiletInfoTask extends TimerTask {
}
}
if (isError) {
mErrorCount++;
errorCount++;
} else {
mErrorCount = 0;
errorCount = 0;
}
} else {
mErrorCount++;
errorCount++;
isNetworkConnect = FALSE;
}
toiletInfo.setConnectErrorCount(mErrorCount);
toiletInfo.setConnectErrorCount(errorCount);
toiletInfo.setNetworkConnect(isNetworkConnect);
//Broadcast送信
......@@ -106,12 +106,12 @@ public class UpdateToiletInfoTask extends TimerTask {
Log.d(TAG, "Thread End");
}
public boolean isNetworkAvailable(Context context) {
private boolean isNetworkAvailable(Context context) {
final ConnectivityManager connectivityManager = ((ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE));
return connectivityManager.getActiveNetworkInfo() != null && connectivityManager.getActiveNetworkInfo().isConnected();
}
public boolean isInternetAvailable() {
private boolean isInternetAvailable() {
try {
final InetAddress address = InetAddress.getByName("google.com");
return !address.equals("");
......
......@@ -48,8 +48,6 @@
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"
......@@ -145,56 +143,50 @@
android:background="#746661" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
android:orientation="horizontal">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
android:layout_marginStart="20dp"
android:layout_marginTop="10dp"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
<TextView
android:id="@+id/totalTitleJPTextView"
android:layout_width="150dp"
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>
android:text="総数"
android:textAlignment="center"
android:textColor="#746661"
android:textSize="50sp"
android:textStyle="bold" />
<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:id="@+id/totalTitleENTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="TOTAL"
android:textAlignment="center"
android:textColor="#746661"
android:textSize="50sp" />
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>
......@@ -242,8 +234,6 @@
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" />
......
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