Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
odakyuToiletSignage
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
kddi
odakyuToiletSignage
Commits
95cef713
Commit
95cef713
authored
Jan 23, 2018
by
Kim Jinsung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.ホームアプリとしての使用するように仕様変更
2.ログ出力判断処理変更 3.アプリ自動起動(BroadcastReceiver)処理変更
parent
1040d40c
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
41 additions
and
31 deletions
+41
-31
app/src/main/AndroidManifest.xml
+6
-4
app/src/main/java/jp/odakyu/toiletsignage/application/ToiletApplication.java
+7
-6
app/src/main/java/jp/odakyu/toiletsignage/log/Logger.java
+16
-16
app/src/main/java/jp/odakyu/toiletsignage/receiver/OnBootReceiver.java
+12
-5
No files found.
app/src/main/AndroidManifest.xml
View file @
95cef713
...
@@ -21,22 +21,24 @@
...
@@ -21,22 +21,24 @@
android:theme=
"@style/Theme.AppCompat.Light.NoActionBar.FullScreen"
>
android:theme=
"@style/Theme.AppCompat.Light.NoActionBar.FullScreen"
>
<intent-filter>
<intent-filter>
<action
android:name=
"android.intent.action.MAIN"
/>
<action
android:name=
"android.intent.action.MAIN"
/>
<category
android:name=
"android.intent.category.HOME"
/>
<category
android:name=
"android.intent.category.DEFAULT"
/>
<!-- The following two intent-filters are the key to set homescreen -->
<!-- The following two intent-filters are the key to set homescreen -->
<category
android:name=
"android.intent.category.LAUNCHER"
/>
<category
android:name=
"android.intent.category.LAUNCHER"
/>
</intent-filter>
</intent-filter>
</activity>
</activity>
<activity
android:name=
".activity.SignageActivity"
<activity
android:name=
".activity.SignageActivity"
android:configChanges=
"orientation|keyboardHidden|screenSize"
android:configChanges=
"orientation|keyboardHidden|screenSize"
android:theme=
"@style/Theme.AppCompat.Light.NoActionBar.FullScreen"
/>
android:theme=
"@style/Theme.AppCompat.Light.NoActionBar.FullScreen"
/>
<activity
android:name=
".activity.ParentActivity"
<activity
android:name=
".activity.ParentActivity"
android:configChanges=
"orientation|keyboardHidden|screenSize"
android:configChanges=
"orientation|keyboardHidden|screenSize"
android:theme=
"@style/Theme.AppCompat.Light.NoActionBar.FullScreen"
/>
android:theme=
"@style/Theme.AppCompat.Light.NoActionBar.FullScreen"
/>
<receiver
android:name=
".receiver.OnBootReceiver"
>
<receiver
android:
enabled=
"true"
android:
name=
".receiver.OnBootReceiver"
>
<intent-filter>
<intent-filter>
<action
android:name=
"android.intent.action.BOOT_COMPLETED"
/>
<action
android:name=
"android.intent.action.BOOT_COMPLETED"
/>
<category
android:name=
"android.intent.category.DEFAULT"
/>
</intent-filter>
</intent-filter>
</receiver>
</receiver>
</application>
</application>
...
...
app/src/main/java/jp/odakyu/toiletsignage/application/ToiletApplication.java
View file @
95cef713
...
@@ -27,12 +27,10 @@ public class ToiletApplication extends Application {
...
@@ -27,12 +27,10 @@ public class ToiletApplication extends Application {
@Override
@Override
public
void
onCreate
()
{
public
void
onCreate
()
{
super
.
onCreate
();
super
.
onCreate
();
// Logger logger = new Logger();
Logger
logger
=
new
Logger
();
// File downloadFilePath = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);
File
downloadFilePath
=
Environment
.
getExternalStoragePublicDirectory
(
Environment
.
DIRECTORY_DOWNLOADS
);
// String logPath = downloadFilePath.getPath() + "/" + APP_LOG_PATH;
String
logPath
=
downloadFilePath
.
getPath
()
+
"/"
+
APP_LOG_PATH
;
// logger.setLogPathFormat(logPath);
logger
.
setLogPathFormat
(
logPath
);
// FileUtil.createParentDirectory(logPath);
Logger
.
i
(
TAG
,
"onCreate"
);
Logger
.
i
(
TAG
,
"onCreate"
);
}
}
...
@@ -56,6 +54,9 @@ public class ToiletApplication extends Application {
...
@@ -56,6 +54,9 @@ public class ToiletApplication extends Application {
}
}
}
}
public
Timer
getUpdateToiletInfoTimer
()
{
return
updateToiletInfoTimer
;
}
public
boolean
isForeground
(
Context
context
)
{
public
boolean
isForeground
(
Context
context
)
{
ActivityManager
am
=
(
ActivityManager
)
getSystemService
(
Context
.
ACTIVITY_SERVICE
);
ActivityManager
am
=
(
ActivityManager
)
getSystemService
(
Context
.
ACTIVITY_SERVICE
);
assert
am
!=
null
;
assert
am
!=
null
;
...
...
app/src/main/java/jp/odakyu/toiletsignage/log/Logger.java
View file @
95cef713
...
@@ -17,6 +17,7 @@ public class Logger extends AbstractLogger {
...
@@ -17,6 +17,7 @@ public class Logger extends AbstractLogger {
private
static
String
logPathFormat
;
private
static
String
logPathFormat
;
private
String
currentDay
;
private
String
currentDay
;
private
int
retentionPeriod
=
1
;
private
int
retentionPeriod
=
1
;
private
static
boolean
isLog
=
false
;
public
Logger
()
{
public
Logger
()
{
}
}
...
@@ -27,6 +28,7 @@ public class Logger extends AbstractLogger {
...
@@ -27,6 +28,7 @@ public class Logger extends AbstractLogger {
public
void
setLogPathFormat
(
String
logPathFormat
)
{
public
void
setLogPathFormat
(
String
logPathFormat
)
{
this
.
logPathFormat
=
logPathFormat
;
this
.
logPathFormat
=
logPathFormat
;
if
(
isLog
)
FileUtil
.
createParentDirectory
(
logPathFormat
);
}
}
public
static
void
setLogger
(
AbstractLogger
abstractLogger
)
{
public
static
void
setLogger
(
AbstractLogger
abstractLogger
)
{
...
@@ -68,6 +70,7 @@ public class Logger extends AbstractLogger {
...
@@ -68,6 +70,7 @@ public class Logger extends AbstractLogger {
// }
// }
public
static
void
d
(
String
tag
,
String
log
)
{
public
static
void
d
(
String
tag
,
String
log
)
{
Log
.
d
(
tag
,
log
);
if
(
isDebugEnabled
())
{
if
(
isDebugEnabled
())
{
logger
.
debug
(
tag
,
log
);
logger
.
debug
(
tag
,
log
);
}
}
...
@@ -84,6 +87,7 @@ public class Logger extends AbstractLogger {
...
@@ -84,6 +87,7 @@ public class Logger extends AbstractLogger {
// }
// }
public
static
void
d
(
String
tag
,
String
log
,
Throwable
t
)
{
public
static
void
d
(
String
tag
,
String
log
,
Throwable
t
)
{
Log
.
d
(
tag
,
log
,
t
);
if
(
isDebugEnabled
())
{
if
(
isDebugEnabled
())
{
logger
.
debug
(
tag
,
log
,
t
);
logger
.
debug
(
tag
,
log
,
t
);
}
}
...
@@ -94,6 +98,7 @@ public class Logger extends AbstractLogger {
...
@@ -94,6 +98,7 @@ public class Logger extends AbstractLogger {
// }
// }
public
static
void
i
(
String
tag
,
String
log
)
{
public
static
void
i
(
String
tag
,
String
log
)
{
Log
.
i
(
tag
,
log
);
if
(
isInfoEnabled
())
{
if
(
isInfoEnabled
())
{
logger
.
info
(
tag
,
log
);
logger
.
info
(
tag
,
log
);
}
}
...
@@ -110,6 +115,7 @@ public class Logger extends AbstractLogger {
...
@@ -110,6 +115,7 @@ public class Logger extends AbstractLogger {
// }
// }
public
static
void
i
(
String
tag
,
String
log
,
Throwable
t
)
{
public
static
void
i
(
String
tag
,
String
log
,
Throwable
t
)
{
Log
.
i
(
tag
,
log
,
t
);
if
(
isInfoEnabled
())
{
if
(
isInfoEnabled
())
{
logger
.
info
(
tag
,
log
,
t
);
logger
.
info
(
tag
,
log
,
t
);
}
}
...
@@ -120,6 +126,7 @@ public class Logger extends AbstractLogger {
...
@@ -120,6 +126,7 @@ public class Logger extends AbstractLogger {
// }
// }
public
static
void
w
(
String
tag
,
String
log
)
{
public
static
void
w
(
String
tag
,
String
log
)
{
Log
.
w
(
tag
,
log
);
if
(
isWarnEnabled
())
{
if
(
isWarnEnabled
())
{
logger
.
warn
(
tag
,
log
);
logger
.
warn
(
tag
,
log
);
}
}
...
@@ -136,6 +143,7 @@ public class Logger extends AbstractLogger {
...
@@ -136,6 +143,7 @@ public class Logger extends AbstractLogger {
// }
// }
public
static
void
w
(
String
tag
,
String
log
,
Throwable
t
)
{
public
static
void
w
(
String
tag
,
String
log
,
Throwable
t
)
{
Log
.
w
(
tag
,
log
);
if
(
isWarnEnabled
())
{
if
(
isWarnEnabled
())
{
logger
.
warn
(
tag
,
log
,
t
);
logger
.
warn
(
tag
,
log
,
t
);
}
}
...
@@ -146,6 +154,7 @@ public class Logger extends AbstractLogger {
...
@@ -146,6 +154,7 @@ public class Logger extends AbstractLogger {
// }
// }
public
static
void
e
(
String
tag
,
String
log
)
{
public
static
void
e
(
String
tag
,
String
log
)
{
Log
.
e
(
tag
,
log
);
if
(
isErrorEnabled
())
{
if
(
isErrorEnabled
())
{
logger
.
error
(
tag
,
log
);
logger
.
error
(
tag
,
log
);
}
}
...
@@ -162,6 +171,7 @@ public class Logger extends AbstractLogger {
...
@@ -162,6 +171,7 @@ public class Logger extends AbstractLogger {
// }
// }
public
static
void
e
(
String
tag
,
String
log
,
Throwable
t
)
{
public
static
void
e
(
String
tag
,
String
log
,
Throwable
t
)
{
Log
.
e
(
tag
,
log
,
t
);
if
(
isErrorEnabled
())
{
if
(
isErrorEnabled
())
{
logger
.
error
(
tag
,
log
,
t
);
logger
.
error
(
tag
,
log
,
t
);
}
}
...
@@ -224,85 +234,75 @@ public class Logger extends AbstractLogger {
...
@@ -224,85 +234,75 @@ public class Logger extends AbstractLogger {
@Override
@Override
protected
void
verbose
(
String
tag
,
String
log
)
{
protected
void
verbose
(
String
tag
,
String
log
)
{
log
(
"VERBOSE"
,
tag
,
log
);
log
(
"VERBOSE"
,
tag
,
log
);
Log
.
w
(
tag
,
log
);
}
}
@Override
@Override
protected
void
verbose
(
String
tag
,
String
log
,
Throwable
t
)
{
protected
void
verbose
(
String
tag
,
String
log
,
Throwable
t
)
{
log
(
"VERBOSE"
,
tag
,
log
,
t
);
log
(
"VERBOSE"
,
tag
,
log
,
t
);
Log
.
w
(
tag
,
log
,
t
);
}
}
@Override
@Override
protected
void
debug
(
String
tag
,
String
log
)
{
protected
void
debug
(
String
tag
,
String
log
)
{
log
(
"DEBUG"
,
tag
,
log
);
log
(
"DEBUG"
,
tag
,
log
);
Log
.
d
(
tag
,
log
);
}
}
@Override
@Override
protected
void
debug
(
String
tag
,
String
log
,
Throwable
t
)
{
protected
void
debug
(
String
tag
,
String
log
,
Throwable
t
)
{
log
(
"DEBUG"
,
tag
,
log
,
t
);
log
(
"DEBUG"
,
tag
,
log
,
t
);
Log
.
d
(
tag
,
log
,
t
);
}
}
@Override
@Override
protected
void
info
(
String
tag
,
String
log
)
{
protected
void
info
(
String
tag
,
String
log
)
{
log
(
"INFO"
,
tag
,
log
);
log
(
"INFO"
,
tag
,
log
);
Log
.
i
(
tag
,
log
);
}
}
@Override
@Override
protected
void
info
(
String
tag
,
String
log
,
Throwable
t
)
{
protected
void
info
(
String
tag
,
String
log
,
Throwable
t
)
{
log
(
"INFO"
,
tag
,
log
,
t
);
log
(
"INFO"
,
tag
,
log
,
t
);
Log
.
i
(
tag
,
log
,
t
);
}
}
@Override
@Override
protected
void
warn
(
String
tag
,
String
log
)
{
protected
void
warn
(
String
tag
,
String
log
)
{
log
(
"WARN"
,
tag
,
log
);
log
(
"WARN"
,
tag
,
log
);
Log
.
w
(
tag
,
log
);
}
}
@Override
@Override
protected
void
warn
(
String
tag
,
String
log
,
Throwable
t
)
{
protected
void
warn
(
String
tag
,
String
log
,
Throwable
t
)
{
log
(
"WARN"
,
tag
,
log
,
t
);
log
(
"WARN"
,
tag
,
log
,
t
);
Log
.
w
(
tag
,
log
,
t
);
}
}
@Override
@Override
protected
void
error
(
String
tag
,
String
log
)
{
protected
void
error
(
String
tag
,
String
log
)
{
log
(
"ERROR"
,
tag
,
log
);
log
(
"ERROR"
,
tag
,
log
);
Log
.
e
(
tag
,
log
);
}
}
@Override
@Override
protected
void
error
(
String
tag
,
String
log
,
Throwable
t
)
{
protected
void
error
(
String
tag
,
String
log
,
Throwable
t
)
{
log
(
"ERROR"
,
tag
,
log
,
t
);
log
(
"ERROR"
,
tag
,
log
,
t
);
Log
.
e
(
tag
,
log
,
t
);
}
}
private
static
boolean
isLoggable
(
int
level
)
{
private
static
boolean
isLoggable
(
int
level
)
{
return
false
;
return
isLog
;
}
}
public
static
boolean
isVerboseEnabled
()
{
public
static
boolean
isVerboseEnabled
()
{
return
false
;
return
isLog
;
}
}
public
static
boolean
isDebugEnabled
()
{
public
static
boolean
isDebugEnabled
()
{
return
false
;
return
isLog
;
}
}
public
static
boolean
isInfoEnabled
()
{
public
static
boolean
isInfoEnabled
()
{
return
false
;
return
isLog
;
}
}
public
static
boolean
isWarnEnabled
()
{
public
static
boolean
isWarnEnabled
()
{
return
false
;
return
isLog
;
}
}
public
static
boolean
isErrorEnabled
()
{
public
static
boolean
isErrorEnabled
()
{
return
false
;
return
isLog
;
}
}
}
}
app/src/main/java/jp/odakyu/toiletsignage/receiver/OnBootReceiver.java
View file @
95cef713
...
@@ -3,9 +3,10 @@ package jp.odakyu.toiletsignage.receiver;
...
@@ -3,9 +3,10 @@ package jp.odakyu.toiletsignage.receiver;
import
android.content.BroadcastReceiver
;
import
android.content.BroadcastReceiver
;
import
android.content.Context
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.util.Log
;
import
jp.odakyu.toiletsignage.activity.MainActivity
;
import
jp.odakyu.toiletsignage.activity.MainActivity
;
import
jp.odakyu.toiletsignage.
log.Logger
;
import
jp.odakyu.toiletsignage.
application.ToiletApplication
;
/**
/**
* 端末の電源がONしたときに自動的にアプリを起動させるレシーバー
* 端末の電源がONしたときに自動的にアプリを起動させるレシーバー
...
@@ -16,9 +17,15 @@ public class OnBootReceiver extends BroadcastReceiver {
...
@@ -16,9 +17,15 @@ public class OnBootReceiver extends BroadcastReceiver {
public
static
final
String
TAG
=
"OnBootReceiver"
;
public
static
final
String
TAG
=
"OnBootReceiver"
;
@Override
@Override
public
void
onReceive
(
Context
context
,
Intent
intent
)
{
public
void
onReceive
(
Context
context
,
Intent
intent
)
{
Logger
.
i
(
TAG
,
"Power ON"
);
Log
.
i
(
TAG
,
"Power ON"
);
Intent
i
=
new
Intent
(
context
,
MainActivity
.
class
);
ToiletApplication
application
=
(
ToiletApplication
)
context
.
getApplicationContext
();
i
.
setFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
);
Log
.
i
(
TAG
,
"application = "
+
application
+
"application.getUpdateToiletInfoTimer() = "
+
application
.
getUpdateToiletInfoTimer
());
context
.
startActivity
(
i
);
if
(
application
==
null
||
application
.
getUpdateToiletInfoTimer
()
==
null
)
{
Intent
i
=
new
Intent
(
context
,
MainActivity
.
class
);
i
.
setFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
);
context
.
startActivity
(
i
);
}
else
{
Log
.
i
(
TAG
,
"Starting Application"
);
}
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment