Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
LatinIME
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
keyboard
LatinIME
Commits
5b8ffad2
Commit
5b8ffad2
authored
11 years ago
by
Tadashi G. Takaoka
Browse files
Options
Downloads
Patches
Plain Diff
Move important notice version to resource
Bug: 10587358 Change-Id: Ie24fc6c53b15880f4ace991a25223056f03f5eda
parent
776d46a7
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
java/res/values/strings-config-important-notice.xml
+24
-0
24 additions, 0 deletions
java/res/values/strings-config-important-notice.xml
java/src/com/android/inputmethod/latin/utils/ImportantNoticeUtils.java
+8
-6
8 additions, 6 deletions
...android/inputmethod/latin/utils/ImportantNoticeUtils.java
with
32 additions
and
6 deletions
java/res/values/strings-config-important-notice.xml
0 → 100644
+
24
−
0
View file @
5b8ffad2
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
**
** Copyright 2014, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
-->
<resources>
<integer
name=
"config_important_notice_version"
>
0
</integer>
<!-- TODO: Add important notice title and description string resources. -->
</resources>
This diff is collapsed.
Click to expand it.
java/src/com/android/inputmethod/latin/utils/ImportantNoticeUtils.java
+
8
−
6
View file @
5b8ffad2
...
...
@@ -22,13 +22,11 @@ import android.provider.Settings;
import
android.provider.Settings.SettingNotFoundException
;
import
android.util.Log
;
import
com.android.inputmethod.latin.R
;
public
final
class
ImportantNoticeUtils
{
private
static
final
String
TAG
=
ImportantNoticeUtils
.
class
.
getSimpleName
();
// The current version number of an important notice.
// This number must be incremented whenever users should see a new important notice.
private
static
final
int
CURRENT_IMPORTANT_NOTICE_VERSION
=
0
;
// {@link SharedPreferences} name to save the last important notice version that has been
// displayed to users.
private
static
final
String
PREFERENCE_NAME
=
"important_notice"
;
...
...
@@ -60,16 +58,20 @@ public final class ImportantNoticeUtils {
return
context
.
getSharedPreferences
(
PREFERENCE_NAME
,
Context
.
MODE_PRIVATE
);
}
private
static
int
getCurrentImportantNoticeVersion
(
final
Context
context
)
{
return
context
.
getResources
().
getInteger
(
R
.
integer
.
config_important_notice_version
);
}
public
static
boolean
hasNewImportantNotice
(
final
Context
context
)
{
final
SharedPreferences
prefs
=
getImportantNoticePreferences
(
context
);
final
int
lastVersion
=
prefs
.
getInt
(
KEY_IMPORTANT_NOTICE_VERSION
,
0
);
return
CURRENT_IMPORTANT_NOTICE_VERSION
>
lastVersion
;
return
getCurrentImportantNoticeVersion
(
context
)
>
lastVersion
;
}
public
static
void
updateLastImportantNoticeVersion
(
final
Context
context
)
{
final
SharedPreferences
prefs
=
getImportantNoticePreferences
(
context
);
prefs
.
edit
()
.
putInt
(
KEY_IMPORTANT_NOTICE_VERSION
,
CURRENT_IMPORTANT_NOTICE_VERSION
)
.
putInt
(
KEY_IMPORTANT_NOTICE_VERSION
,
getCurrentImportantNoticeVersion
(
context
)
)
.
apply
();
}
}
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