Skip to content

Commit

Permalink
Merge pull request #3 from alescdb/lock-icons
Browse files Browse the repository at this point in the history
Add a setting to lock icons (issue #1)
  • Loading branch information
alescdb committed Nov 16, 2017
2 parents 03e5b85 + 978dbba commit 8354958
Show file tree
Hide file tree
Showing 16 changed files with 90 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ android:
components:
- tools
- platform-tools
- build-tools-25.0.2
- build-tools-26.0.2
- android-25
- extra-google-m2repository
- extra-android-m2repository
Expand Down
2 changes: 1 addition & 1 deletion LauncherTV.iml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="jdk" jdkName="1.8" jdkType="JavaSDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
4 changes: 3 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0-beta2'
classpath 'com.android.tools.build:gradle:3.0.0'
classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.6.3'

// NOTE: Do not place your application dependencies here; they belong
Expand All @@ -16,5 +17,6 @@ buildscript {
allprojects {
repositories {
jcenter()
google()
}
}
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Wed Jan 11 17:19:30 CET 2017
#Thu Nov 16 13:05:28 CET 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
8 changes: 4 additions & 4 deletions launcher/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ task checkstyle(type: Checkstyle) {

android {
compileSdkVersion 25
buildToolsVersion '25.0.2'
buildToolsVersion '26.0.2'

lintOptions {
abortOnError true
Expand All @@ -52,8 +52,8 @@ android {
applicationId "org.cosinus.launchertv"
minSdkVersion 14
targetSdkVersion 25
versionCode 154
versionName "1.5.4-beta"
versionCode 155
versionName "1.5.5"
}

signingConfigs {
Expand Down Expand Up @@ -88,7 +88,7 @@ android {
}

dependencies {
compile 'com.android.support:appcompat-v7:25.1.0'
compile 'com.android.support:appcompat-v7:25.4.0'
}

coveralls {
Expand Down
3 changes: 2 additions & 1 deletion launcher/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?><!--
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Simple TV Launcher
~ Copyright 2017 Alexandre Del Bigio
~
Expand Down
9 changes: 9 additions & 0 deletions launcher/src/main/java/org/cosinus/launchertv/Setup.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,15 @@ public boolean keepScreenOn() {
return (false);
}

public boolean iconsLocked() {
try {
return (getPreferences().getBoolean(Preferences.PREFERENCE_LOCKED, false));
} catch (Exception e) {
e.printStackTrace();
}
return (false);
}

public boolean showDate() {
try {
return (getPreferences().getBoolean(Preferences.PREFERENCE_SHOW_DATE, true));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,7 @@ public class Preferences extends PreferenceActivity {
public static final String PREFERENCE_SHOW_NAME = "preference_show_name";
public static final String PREFERENCE_MARGIN_X = "preference_margin_x";
public static final String PREFERENCE_MARGIN_Y = "preference_margin_y";
//
// private static final String CATEGORY_GRID = "category_grid";
// private static final String CATEGORY_TRANSPARENCY = "category_transparency";
public static final String PREFERENCE_LOCKED = "preference_locked";
private static final String PREFERENCE_GOOGLE_PLUS = "preference_google_plus";
private static final String PREFERENCE_GITHUB = "preference_github";
private static final String PREFERENCE_ABOUT = "preference_about";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,11 @@ private void setClock() {
public boolean onLongClick(View v) {
if (v instanceof ApplicationView) {
ApplicationView appView = (ApplicationView) v;
openApplicationList(ApplicationList.VIEW_LIST, appView.getPosition(), appView.hasPackage(), REQUEST_CODE_APPLICATION_LIST);
if (appView.hasPackage() && mSetup.iconsLocked()) {
Toast.makeText(getActivity(), R.string.home_locked, Toast.LENGTH_SHORT).show();
} else {
openApplicationList(ApplicationList.VIEW_LIST, appView.getPosition(), appView.hasPackage(), REQUEST_CODE_APPLICATION_LIST);
}
return (true);
}
return (false);
Expand Down
4 changes: 4 additions & 0 deletions launcher/src/main/res/values-cs/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,8 @@
<string name="title_default_transparency">Použít starší dlažba průhlednost</string>
<string name="summary_default_transparency">Použít starší dlažba průhlednost</string>
<string name="title_transparency">Průhlednost pozadí</string>
<string name="error_opening_link">Error (%1$s) : %2$s</string>
<string name="home_locked">Icon is locked by settings</string>
<string name="summary_locked">Prevent icons to be accidentally removed</string>
<string name="title_locked">Lock icons</string>
</resources>
4 changes: 4 additions & 0 deletions launcher/src/main/res/values-fr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,8 @@
<string name="summary_default_transparency">Utiliser la transparence par défaut (en cas de problème)</string>
<string name="title_default_transparency">Transparence par défaut</string>
<string name="title_transparency">Transparence du fond</string>
<string name="error_opening_link">Error (%1$s) : %2$s</string>
<string name="home_locked">Icone verrouillée (cf. Préférences)</string>
<string name="summary_locked">Empêcher la suppression accidentelle des icones</string>
<string name="title_locked">Verrouiller les icones</string>
</resources>
4 changes: 4 additions & 0 deletions launcher/src/main/res/values-sk/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,8 @@
<string name="title_default_transparency">Predvolené priehľadná</string>
<string name="summary_default_transparency">Použiť staršie dlažba priehľadnosť</string>
<string name="title_transparency">Použiť staršie dlažba priehľadnosť</string>
<string name="error_opening_link">Error (%1$s) : %2$s</string>
<string name="home_locked">Icon is locked by settings</string>
<string name="summary_locked">Prevent icons to be accidentally removed</string>
<string name="title_locked">Lock icons</string>
</resources>
21 changes: 21 additions & 0 deletions launcher/src/main/res/values-w1080dp/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Simple TV Launcher
~ Copyright 2017 Alexandre Del Bigio
~
~ 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>
<string name="summary_locked">Prevent icons to be accidentally removed</string>
</resources>
21 changes: 21 additions & 0 deletions launcher/src/main/res/values-w720dp/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Simple TV Launcher
~ Copyright 2017 Alexandre Del Bigio
~
~ 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>
<string name="summary_locked">Lock icons</string>
</resources>
3 changes: 3 additions & 0 deletions launcher/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,7 @@
<string name="summary_default_transparency">Use legacy tiles transparency</string>
<string name="about">About</string>
<string name="error_opening_link">Error (%1$s) : %2$s</string>
<string name="home_locked">Icon is locked by settings</string>
<string name="summary_locked">Prevent icons to be accidentally removed</string>
<string name="title_locked">Lock icons</string>
</resources>
5 changes: 5 additions & 0 deletions launcher/src/main/res/xml/preferences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@
android:key="preference_show_name"
android:summary="@string/summary_show_name"
android:title="@string/title_show_name"/>
<CheckBoxPreference
android:defaultValue="false"
android:key="preference_locked"
android:summary="@string/summary_locked"
android:title="@string/title_locked"/>
</PreferenceCategory>
<PreferenceCategory
android:key="category_grid"
Expand Down

0 comments on commit 8354958

Please sign in to comment.