Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
openhab-android
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OpenLicht
openhab-android
Commits
e1afa8a9
Unverified
Commit
e1afa8a9
authored
Mar 11, 2019
by
mueller-ma
Committed by
GitHub
Mar 11, 2019
Browse files
Options
Downloads
Patches
Plain Diff
Add "Turn off" action to demo mode snackbar (#1258)
Signed-off-by:
mueller-ma
<
mueller-ma@users.noreply.github.com
>
parent
1255f284
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
mobile/src/main/java/org/openhab/habdroid/ui/MainActivity.java
+13
-1
13 additions, 1 deletion
...e/src/main/java/org/openhab/habdroid/ui/MainActivity.java
mobile/src/main/res/values/strings.xml
+2
-0
2 additions, 0 deletions
mobile/src/main/res/values/strings.xml
with
15 additions
and
1 deletion
mobile/src/main/java/org/openhab/habdroid/ui/MainActivity.java
+
13
−
1
View file @
e1afa8a9
...
@@ -277,7 +277,7 @@ public class MainActivity extends AppCompatActivity implements
...
@@ -277,7 +277,7 @@ public class MainActivity extends AppCompatActivity implements
private
void
handleConnectionChange
()
{
private
void
handleConnectionChange
()
{
if
(
mConnection
instanceof
DemoConnection
)
{
if
(
mConnection
instanceof
DemoConnection
)
{
show
Snackbar
(
R
.
string
.
info_demo_mode_short
);
show
DemoModeHintSnackbar
(
);
}
else
{
}
else
{
boolean
hasLocalAndRemote
=
boolean
hasLocalAndRemote
=
ConnectionFactory
.
getConnection
(
Connection
.
TYPE_LOCAL
)
!=
null
ConnectionFactory
.
getConnection
(
Connection
.
TYPE_LOCAL
)
!=
null
...
@@ -1033,6 +1033,18 @@ public class MainActivity extends AppCompatActivity implements
...
@@ -1033,6 +1033,18 @@ public class MainActivity extends AppCompatActivity implements
mLastSnackbar
.
show
();
mLastSnackbar
.
show
();
}
}
public
void
showDemoModeHintSnackbar
()
{
final
SharedPreferences
prefs
=
PreferenceManager
.
getDefaultSharedPreferences
(
this
);
mLastSnackbar
=
Snackbar
.
make
(
findViewById
(
android
.
R
.
id
.
content
),
R
.
string
.
info_demo_mode_short
,
Snackbar
.
LENGTH_LONG
);
mLastSnackbar
.
setAction
(
R
.
string
.
turn_off
,
v
->
{
prefs
.
edit
()
.
putBoolean
(
Constants
.
PREFERENCE_DEMOMODE
,
false
)
.
apply
();
});
mLastSnackbar
.
show
();
}
private
void
showSnackbar
(
@StringRes
int
messageResId
)
{
private
void
showSnackbar
(
@StringRes
int
messageResId
)
{
mLastSnackbar
=
Snackbar
.
make
(
findViewById
(
android
.
R
.
id
.
content
),
mLastSnackbar
=
Snackbar
.
make
(
findViewById
(
android
.
R
.
id
.
content
),
messageResId
,
Snackbar
.
LENGTH_LONG
);
messageResId
,
Snackbar
.
LENGTH_LONG
);
...
...
This diff is collapsed.
Click to expand it.
mobile/src/main/res/values/strings.xml
+
2
−
0
View file @
e1afa8a9
...
@@ -79,6 +79,8 @@
...
@@ -79,6 +79,8 @@
<string
name=
"info_voice_input"
>
openHAB, at your command!
</string>
<string
name=
"info_voice_input"
>
openHAB, at your command!
</string>
<string
name=
"info_voice_recognized_text"
>
Recognized command: %1$s
</string>
<string
name=
"info_voice_recognized_text"
>
Recognized command: %1$s
</string>
<string
name=
"info_demo_mode_short"
>
Running in demo mode
</string>
<string
name=
"info_demo_mode_short"
>
Running in demo mode
</string>
<!-- Please try to keep the string as short as possible -->
<string
name=
"turn_off"
>
Turn off
</string>
<string
name=
"info_conn_url"
>
Connecting to local URL
</string>
<string
name=
"info_conn_url"
>
Connecting to local URL
</string>
<string
name=
"info_conn_rem_url"
>
Connecting to remote URL
</string>
<string
name=
"info_conn_rem_url"
>
Connecting to remote URL
</string>
<string
name=
"app_shortcut_diabled_habpanel"
>
Your server doesn\'t have HABPanel installed
</string>
<string
name=
"app_shortcut_diabled_habpanel"
>
Your server doesn\'t have HABPanel installed
</string>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment