Skip to content

Commit

Permalink
SecondScreen 2.8.1 (release 1)
Browse files Browse the repository at this point in the history
* Re-enable freeform mode on Android Pie devices with Taskbar installed
* Minor visual improvements and bug fixes
  • Loading branch information
farmerbb committed Aug 17, 2018
1 parent 3b5cd85 commit d850666
Show file tree
Hide file tree
Showing 11 changed files with 58 additions and 28 deletions.
6 changes: 3 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ repositories {
}

android {
compileSdkVersion 27
compileSdkVersion 28
buildToolsVersion "27.0.3"

defaultConfig {
Expand All @@ -23,8 +23,8 @@ android {
//noinspection OldTargetApi
targetSdkVersion 25

versionCode 178
versionName "2.8"
versionCode 179
versionName "2.8.1"

resConfigs "en", "es", "fr", "sk"
vectorDrawables.useSupportLibrary = true
Expand Down
6 changes: 2 additions & 4 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -244,16 +244,14 @@
</receiver>
<receiver
android:name="com.farmerbb.secondscreen.receiver.TaskerActionReceiver"
android:exported="true"
android:process=":background" >
android:exported="true" >
<intent-filter>
<action android:name="com.twofortyfouram.locale.intent.action.FIRE_SETTING" />
</intent-filter>
</receiver>
<receiver
android:name="com.farmerbb.secondscreen.receiver.TaskerConditionReceiver"
android:exported="true"
android:process=":background" >
android:exported="true" >
<intent-filter>
<action android:name="com.twofortyfouram.locale.intent.action.QUERY_CONDITION" />
</intent-filter>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -358,11 +358,18 @@ public void onResume() {
findPreference("overscan_settings").setSummary(getResources().getString(R.string.disabled));

String taskbarPackageName = U.getTaskbarPackageName(getActivity());
if(taskbarPackageName == null || !U.isPlayStoreRelease(getActivity()))
if(taskbarPackageName == null || !U.isPlayStoreRelease(getActivity())) {
disablePreference(prefNew, "taskbar", true);
else

if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.P)
disablePreference(prefNew, "freeform", true);
} else {
findPreference("taskbar").setEnabled(true);

if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.P)
findPreference("freeform").setEnabled(true);
}

if(taskbarSettingsPrefEnabled) {
findPreference("taskbar_settings").setTitle(
taskbarPackageName == null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
public final class TaskerActionReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
if(U.isTaskerDisabled(context)) return;
if(U.isExternalAccessDisabled(context)) return;

BundleScrubber.scrub(intent);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public final class TaskerConditionReceiver extends BroadcastReceiver {
@SuppressWarnings("deprecation")
@Override
public void onReceive(Context context, Intent intent) {
if(U.isTaskerDisabled(context)) return;
if(U.isExternalAccessDisabled(context)) return;

BundleScrubber.scrub(intent);

Expand Down
19 changes: 8 additions & 11 deletions app/src/main/java/com/farmerbb/secondscreen/util/U.java
Original file line number Diff line number Diff line change
Expand Up @@ -386,15 +386,11 @@ public static boolean runDensityCommand(Context context, String requestedDpi) {

// XML file containing the main application preferences; normally set to the MainActivity preferences file.
public static SharedPreferences getPrefMain(Context context) {
return getPrefMain(context, Context.MODE_PRIVATE);
}

private static SharedPreferences getPrefMain(Context context, int mode) {
SharedPreferences prefMain;
if(context.getPackageName().equals("com.farmerbb.secondscreen"))
prefMain = context.getSharedPreferences(MainActivity.class.getName().replace("com.farmerbb.secondscreen.", ""), mode);
prefMain = context.getSharedPreferences(MainActivity.class.getName().replace("com.farmerbb.secondscreen.", ""), Context.MODE_PRIVATE);
else
prefMain = context.getSharedPreferences(MainActivity.class.getName(), mode);
prefMain = context.getSharedPreferences(MainActivity.class.getName(), Context.MODE_PRIVATE);

return prefMain;
}
Expand Down Expand Up @@ -1373,8 +1369,9 @@ && isPlayStoreRelease(context)) {

public static boolean canEnableFreeform(Context context) {
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.N
&& (getCurrentApiVersion() <= 27.0f
|| context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_FREEFORM_WINDOW_MANAGEMENT));
&& (context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_FREEFORM_WINDOW_MANAGEMENT)
|| Build.VERSION.SDK_INT < Build.VERSION_CODES.P
|| (getTaskbarPackageName(context) != null && isPlayStoreRelease(context)));
}

@TargetApi(Build.VERSION_CODES.N)
Expand All @@ -1384,7 +1381,7 @@ public static boolean hasFreeformSupport(Context context) {
|| Settings.Global.getInt(context.getContentResolver(), "enable_freeform_support", 0) != 0
|| (Build.VERSION.SDK_INT <= Build.VERSION_CODES.N_MR1
&& Settings.Global.getInt(context.getContentResolver(), "force_resizable_activities", 0) != 0
&& getTaskbarPackageName(context) != null));
&& (getTaskbarPackageName(context) != null && isPlayStoreRelease(context))));
}

public static boolean isUntestedAndroidVersion(Context context) {
Expand Down Expand Up @@ -1418,8 +1415,8 @@ public static boolean isPlayStoreRelease(Context context) {
return false;
}

public static boolean isTaskerDisabled(Context context) {
SharedPreferences prefMain = getPrefMain(context, Context.MODE_MULTI_PROCESS);
public static boolean isExternalAccessDisabled(Context context) {
SharedPreferences prefMain = getPrefMain(context);
return !prefMain.getBoolean("tasker_enabled", true);
}

Expand Down
26 changes: 26 additions & 0 deletions app/src/main/res/values-v27/styles_secondscreen_2.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2018 Braden Farmer
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>

<style name="Theme.Secondscreen.2" parent="@style/Theme.Secondscreen">
<item name="android:windowLightStatusBar">true</item>
<item name="android:windowLightNavigationBar">true</item>
<item name="android:navigationBarColor">@color/navbar_color_light</item>
<item name="android:navigationBarDividerColor">@color/navbar_divider_color_light</item>
</style>

</resources>
2 changes: 2 additions & 0 deletions app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,6 @@
<color name="close_button">#009688</color>
<color name="light_gray">#25000000</color>
<color name="app_shortcut_bg">#F5F5F5</color>
<color name="navbar_color_light">#FFFFFF</color>
<color name="navbar_divider_color_light">#DCDCDC</color>
</resources>
8 changes: 4 additions & 4 deletions app/src/main/res/xml/overscan_preferences_expert.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<EditTextPreference
android:dependency="overscan"
android:defaultValue="0"
android:inputType="number"
android:inputType="numberSigned"
android:key="overscan_top_expert"
android:maxLines="1"
android:selectAllOnFocus="true"
Expand All @@ -35,7 +35,7 @@
<EditTextPreference
android:dependency="overscan"
android:defaultValue="0"
android:inputType="number"
android:inputType="numberSigned"
android:key="overscan_bottom_expert"
android:maxLines="1"
android:selectAllOnFocus="true"
Expand All @@ -44,7 +44,7 @@
<EditTextPreference
android:dependency="overscan"
android:defaultValue="0"
android:inputType="number"
android:inputType="numberSigned"
android:key="overscan_left_expert"
android:maxLines="1"
android:selectAllOnFocus="true"
Expand All @@ -53,7 +53,7 @@
<EditTextPreference
android:dependency="overscan"
android:defaultValue="0"
android:inputType="number"
android:inputType="numberSigned"
android:key="overscan_right_expert"
android:maxLines="1"
android:selectAllOnFocus="true"
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
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 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionSha256Sum=da9600da2a28a43f5f77364deecbb9b01c1ddb7d3ecafe1d5c93bcd8a8059ab1
distributionUrl=https\://services.gradle.org/distributions/gradle-4.8-all.zip
distributionSha256Sum=39e2d5803bbd5eaf6c8efe07067b0e5a00235e8c71318642b2ed262920b27721
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

0 comments on commit d850666

Please sign in to comment.