Increased minsdk (14->26) and targetSdk (28->33)

- Removed obsolete sdk checks
This commit is contained in:
SVolf 2023-09-23 00:11:00 +07:00 committed by TrianguloY
parent d683be0812
commit 836d879a4f
31 changed files with 186 additions and 394 deletions

View file

@ -42,7 +42,7 @@ if(project.hasProperty("signing.properties") && new File(project.property("signi
} }
android { android {
compileSdkVersion 28 compileSdk 33
defaultConfig { defaultConfig {
versionCode 330 versionCode 330
@ -50,8 +50,8 @@ android {
buildConfigField "boolean", "IS_BETA", "false" // change in core too buildConfigField "boolean", "IS_BETA", "false" // change in core too
buildConfigField "boolean", "HAS_UEC", "false" buildConfigField "boolean", "HAS_UEC", "false"
minSdkVersion 14 minSdk 26
targetSdkVersion 28 targetSdk 33
} }
// dexOptions { // dexOptions {

View file

@ -18,6 +18,7 @@
android:configChanges="keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" /> android:configChanges="keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
<service <service
android:exported="true"
android:name="net.pierrox.lightning_launcher.util.LightningLWPService" android:name="net.pierrox.lightning_launcher.util.LightningLWPService"
android:enabled="true" android:enabled="true"
android:label="@string/lwp" android:label="@string/lwp"

View file

@ -2,6 +2,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:sharedUserId="net.pierrox.lightning_launcher" > android:sharedUserId="net.pierrox.lightning_launcher" >
<uses-permission android:name="android.permission.BROADCAST_STICKY" />
<uses-permission android:name="android.permission.EXPAND_STATUS_BAR" /> <uses-permission android:name="android.permission.EXPAND_STATUS_BAR" />
<uses-permission android:name="android.permission.SET_WALLPAPER"/> <uses-permission android:name="android.permission.SET_WALLPAPER"/>
<uses-permission android:name="android.permission.SET_WALLPAPER_HINTS"/> <uses-permission android:name="android.permission.SET_WALLPAPER_HINTS"/>
@ -48,6 +49,7 @@
android:label="@string/app_name"> android:label="@string/app_name">
<activity <activity
android:exported="true"
android:name="net.pierrox.lightning_launcher.activities.Dashboard" android:name="net.pierrox.lightning_launcher.activities.Dashboard"
android:label="@string/app_name" android:label="@string/app_name"
android:launchMode="singleTask" android:launchMode="singleTask"
@ -85,7 +87,8 @@
android:theme="@style/AppLightNoActionBarWallpaper" android:theme="@style/AppLightNoActionBarWallpaper"
android:excludeFromRecents="true" android:excludeFromRecents="true"
android:windowSoftInputMode="adjustNothing" android:windowSoftInputMode="adjustNothing"
android:configChanges="keyboardHidden|orientation|screenSize|mcc|mnc"> android:configChanges="keyboardHidden|orientation|screenSize|mcc|mnc"
android:exported="true">
<intent-filter> <intent-filter>
<action android:name="net.pierrox.lightning_launcher.ALL_APPS" /> <action android:name="net.pierrox.lightning_launcher.ALL_APPS" />
@ -121,7 +124,8 @@
<activity <activity
android:name="net.pierrox.lightning_launcher.activities.BackupRestore" android:name="net.pierrox.lightning_launcher.activities.BackupRestore"
android:excludeFromRecents="true" android:excludeFromRecents="true"
android:configChanges="keyboardHidden|orientation|screenSize"> android:configChanges="keyboardHidden|orientation|screenSize"
android:exported="true">
<!--requires com.google.android.gm.permission.READ_GMAIL--> <!--requires com.google.android.gm.permission.READ_GMAIL-->
<!--<intent-filter>--> <!--<intent-filter>-->
@ -181,7 +185,8 @@
android:configChanges="keyboardHidden|orientation|screenSize" android:configChanges="keyboardHidden|orientation|screenSize"
android:screenOrientation="user" android:screenOrientation="user"
android:finishOnCloseSystemDialogs="true" android:finishOnCloseSystemDialogs="true"
android:windowSoftInputMode="adjustResize|stateHidden"> android:windowSoftInputMode="adjustResize|stateHidden"
android:exported="true">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
@ -195,7 +200,8 @@
android:configChanges="keyboardHidden|orientation|screenSize"/> android:configChanges="keyboardHidden|orientation|screenSize"/>
<activity android:name="net.pierrox.lightning_launcher.activities.Shortcuts" <activity android:name="net.pierrox.lightning_launcher.activities.Shortcuts"
android:label="@string/shortcut_settings"> android:label="@string/shortcut_settings"
android:exported="true">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.CREATE_SHORTCUT" /> <action android:name="android.intent.action.CREATE_SHORTCUT" />
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
@ -211,6 +217,7 @@
android:configChanges="keyboardHidden|orientation|screenSize"/> android:configChanges="keyboardHidden|orientation|screenSize"/>
<activity-alias <activity-alias
android:exported="true"
android:name="net.pierrox.lightning_launcher.activities.ShortcutsA" android:name="net.pierrox.lightning_launcher.activities.ShortcutsA"
android:targetActivity="net.pierrox.lightning_launcher.activities.EventActionSetup" android:targetActivity="net.pierrox.lightning_launcher.activities.EventActionSetup"
android:label="@string/shortcut_actions"> android:label="@string/shortcut_actions">
@ -221,6 +228,7 @@
</activity-alias> </activity-alias>
<activity-alias <activity-alias
android:exported="true"
android:name="net.pierrox.lightning_launcher.activities.ShortcutsT" android:name="net.pierrox.lightning_launcher.activities.ShortcutsT"
android:targetActivity="net.pierrox.lightning_launcher.activities.EventActionSetup" android:targetActivity="net.pierrox.lightning_launcher.activities.EventActionSetup"
android:label="@string/shortcut_actions"> android:label="@string/shortcut_actions">
@ -230,6 +238,7 @@
</activity-alias> </activity-alias>
<activity-alias <activity-alias
android:exported="true"
android:name="net.pierrox.lightning_launcher.activities.ShortcutsTS" android:name="net.pierrox.lightning_launcher.activities.ShortcutsTS"
android:targetActivity="net.pierrox.lightning_launcher.activities.Shortcuts" android:targetActivity="net.pierrox.lightning_launcher.activities.Shortcuts"
android:label="@string/tss"> android:label="@string/tss">
@ -239,6 +248,7 @@
</activity-alias> </activity-alias>
<activity-alias <activity-alias
android:exported="true"
android:name="net.pierrox.lightning_launcher.activities.ShortcutsTV" android:name="net.pierrox.lightning_launcher.activities.ShortcutsTV"
android:targetActivity="net.pierrox.lightning_launcher.activities.Shortcuts" android:targetActivity="net.pierrox.lightning_launcher.activities.Shortcuts"
android:label="@string/tsv"> android:label="@string/tsv">
@ -248,6 +258,7 @@
</activity-alias> </activity-alias>
<activity-alias <activity-alias
android:exported="true"
android:name="net.pierrox.lightning_launcher.activities.ShortcutsS" android:name="net.pierrox.lightning_launcher.activities.ShortcutsS"
android:targetActivity="net.pierrox.lightning_launcher.activities.ScreenManager" android:targetActivity="net.pierrox.lightning_launcher.activities.ScreenManager"
android:label="@string/shortcut_screen"> android:label="@string/shortcut_screen">
@ -258,6 +269,7 @@
</activity-alias> </activity-alias>
<activity <activity
android:exported="true"
android:name="net.pierrox.lightning_launcher.activities.ApplyTemplate" android:name="net.pierrox.lightning_launcher.activities.ApplyTemplate"
android:excludeFromRecents="true" android:excludeFromRecents="true"
android:configChanges="keyboardHidden|orientation|screenSize"> android:configChanges="keyboardHidden|orientation|screenSize">
@ -289,7 +301,9 @@
android:theme="@style/AppDialog"> android:theme="@style/AppDialog">
</activity> </activity>
<receiver android:name="net.pierrox.lightning_launcher.util.MPReceiver"> <receiver
android:exported="true"
android:name="net.pierrox.lightning_launcher.util.MPReceiver">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.PACKAGE_REMOVED" /> <action android:name="android.intent.action.PACKAGE_REMOVED" />
<action android:name="android.intent.action.PACKAGE_REPLACED"/> <action android:name="android.intent.action.PACKAGE_REPLACED"/>
@ -299,6 +313,7 @@
</receiver> </receiver>
<receiver <receiver
android:exported="true"
android:name="net.pierrox.lightning_launcher.util.ShortcutReceiver" android:name="net.pierrox.lightning_launcher.util.ShortcutReceiver"
android:permission="com.android.launcher.permission.INSTALL_SHORTCUT"> android:permission="com.android.launcher.permission.INSTALL_SHORTCUT">
<intent-filter> <intent-filter>
@ -316,6 +331,7 @@
<!-- Home reset --> <!-- Home reset -->
<activity <activity
android:exported="true"
android:name="net.pierrox.lightning_launcher.activities.dummy.D1" android:name="net.pierrox.lightning_launcher.activities.dummy.D1"
android:enabled="false"> android:enabled="false">
<intent-filter> <intent-filter>
@ -327,6 +343,7 @@
<!-- Default language pack --> <!-- Default language pack -->
<activity <activity
android:exported="false"
android:name="net.pierrox.lightning_launcher.activities.dummy.D2" android:name="net.pierrox.lightning_launcher.activities.dummy.D2"
android:label="@string/default_pack_name" android:label="@string/default_pack_name"
android:excludeFromRecents="true" android:excludeFromRecents="true"
@ -338,6 +355,7 @@
<!-- Browse script APKS--> <!-- Browse script APKS-->
<activity <activity
android:exported="false"
android:name="net.pierrox.lightning_launcher.activities.dummy.D3" android:name="net.pierrox.lightning_launcher.activities.dummy.D3"
android:label="@string/ls_b" android:label="@string/ls_b"
android:excludeFromRecents="true" android:excludeFromRecents="true"
@ -349,6 +367,7 @@
<!-- No icon pack--> <!-- No icon pack-->
<activity <activity
android:exported="false"
android:name="net.pierrox.lightning_launcher.activities.dummy.D4" android:name="net.pierrox.lightning_launcher.activities.dummy.D4"
android:label="@string/nip" android:label="@string/nip"
android:excludeFromRecents="true" android:excludeFromRecents="true"

View file

@ -78,18 +78,8 @@ public class HotwordServiceClient {
} }
} }
private boolean isPreKitKatDevice() {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
Log.w(TAG, "Hotword service isn't usable on pre-Kitkat devices");
return true;
}
return false;
}
public final void onAttachedToWindow() { public final void onAttachedToWindow() {
if (isPreKitKatDevice())
return;
assertMainThread(); assertMainThread();
mActivity.getWindow().getDecorView().getWindowId().registerFocusObserver(mFocusObserver); mActivity.getWindow().getDecorView().getWindowId().registerFocusObserver(mFocusObserver);
internalBind(); internalBind();
@ -97,9 +87,6 @@ public class HotwordServiceClient {
@SuppressLint("MissingSuperCall") @SuppressLint("MissingSuperCall")
public final void onDetachedFromWindow() { public final void onDetachedFromWindow() {
if (isPreKitKatDevice())
return;
if (!mIsBound) { if (!mIsBound) {
return; return;
} }
@ -111,9 +98,6 @@ public class HotwordServiceClient {
} }
public final void requestHotwordDetection(boolean detect) { public final void requestHotwordDetection(boolean detect) {
if (isPreKitKatDevice())
return;
assertMainThread(); assertMainThread();
mIsRequested = detect; mIsRequested = detect;
internalRequestHotword(); internalRequestHotword();

View file

@ -58,17 +58,15 @@ public abstract class LLAppPhone extends LLApp {
// and a systematic check has to be made at startup. // and a systematic check has to be made at startup.
// TODO when the check is implemented, also delete the broadcast receiver entry in the manifest // TODO when the check is implemented, also delete the broadcast receiver entry in the manifest
// and register the receiver here for all platform versions. // and register the receiver here for all platform versions.
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { mMPReceiver = new MPReceiver();
mMPReceiver = new MPReceiver();
IntentFilter intent_filter = new IntentFilter(); IntentFilter intent_filter = new IntentFilter();
intent_filter.addAction(Intent.ACTION_PACKAGE_REMOVED); intent_filter.addAction(Intent.ACTION_PACKAGE_REMOVED);
intent_filter.addAction(Intent.ACTION_PACKAGE_REPLACED); intent_filter.addAction(Intent.ACTION_PACKAGE_REPLACED);
intent_filter.addAction(Intent.ACTION_PACKAGE_ADDED); intent_filter.addAction(Intent.ACTION_PACKAGE_ADDED);
intent_filter.addDataScheme("package"); intent_filter.addDataScheme("package");
registerReceiver(mMPReceiver, intent_filter); registerReceiver(mMPReceiver, intent_filter);
}
} }
@Override @Override

View file

@ -371,11 +371,9 @@ public class AppDrawerX extends Dashboard implements EditTextIme.OnEditTextImeLi
super.configureActivity(page); super.configureActivity(page);
mActionBar.setVisibility(mDrawerPage.config.adHideActionBar || mIsAndroidActionBarDisplayed ? View.GONE : View.VISIBLE); mActionBar.setVisibility(mDrawerPage.config.adHideActionBar || mIsAndroidActionBarDisplayed ? View.GONE : View.VISIBLE);
if(Build.VERSION.SDK_INT>=19) { //noinspection ResourceType
//noinspection ResourceType ((FrameLayout.LayoutParams) mActionBar.getLayoutParams()).topMargin = mDrawerPage.config.statusBarHide ? 0 : mScreen.getSystemBarTintManager().getConfig().getStatusBarHeight();
((FrameLayout.LayoutParams) mActionBar.getLayoutParams()).topMargin = mDrawerPage.config.statusBarHide ? 0 : mScreen.getSystemBarTintManager().getConfig().getStatusBarHeight(); mActionBar.requestLayout();
mActionBar.requestLayout();
}
int ab_text_color = mDrawerPage.config.adActionBarTextColor; int ab_text_color = mDrawerPage.config.adActionBarTextColor;
if(ab_text_color == 0) { if(ab_text_color == 0) {
@ -403,9 +401,7 @@ public class AppDrawerX extends Dashboard implements EditTextIme.OnEditTextImeLi
if(mActionBarBackground == null) { if(mActionBarBackground == null) {
int bg_res_id; int bg_res_id;
if(Build.VERSION.SDK_INT>=21) bg_res_id = R.color.color_primary; bg_res_id = R.color.color_primary;
else if(Build.VERSION.SDK_INT>=13) bg_res_id = R.drawable.ab_bg_v13;
else bg_res_id = R.drawable.ab_bg_v9;
mActionBarBackground = getResources().getDrawable(bg_res_id); mActionBarBackground = getResources().getDrawable(bg_res_id);
} }

View file

@ -219,9 +219,7 @@ public class Customize extends ResourceWrapperActivity implements
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
if(Build.VERSION.SDK_INT>=19) { mSystemBarTintManager = new SystemBarTintManager(getWindow());
mSystemBarTintManager = new SystemBarTintManager(getWindow());
}
setContentView(R.layout.customize); setContentView(R.layout.customize);
@ -1101,11 +1099,9 @@ public class Customize extends ResourceWrapperActivity implements
mPreferencesPageBackground.add(mPGBackgroundSystemWallpaperScroll = new LLPreferenceCheckBox(this, ID_mPGBackgroundSystemWallpaperScroll, R.string.wp_scroll_t, R.string.wp_scroll_s, pc.bgSystemWPScroll, null)); mPreferencesPageBackground.add(mPGBackgroundSystemWallpaperScroll = new LLPreferenceCheckBox(this, ID_mPGBackgroundSystemWallpaperScroll, R.string.wp_scroll_t, R.string.wp_scroll_s, pc.bgSystemWPScroll, null));
mPreferencesPageBackground.add(mPGBackgroundSystemWallpaperWidth = new LLPreferenceSlider(this, ID_mPGBackgroundSystemWallpaperWidth, R.string.wp_w_t, R.string.wp_auto, pc.bgSystemWPWidth, null, ValueType.INT, 0, 2000, 1, null)); mPreferencesPageBackground.add(mPGBackgroundSystemWallpaperWidth = new LLPreferenceSlider(this, ID_mPGBackgroundSystemWallpaperWidth, R.string.wp_w_t, R.string.wp_auto, pc.bgSystemWPWidth, null, ValueType.INT, 0, 2000, 1, null));
mPreferencesPageBackground.add(mPGBackgroundSystemWallpaperHeight = new LLPreferenceSlider(this, ID_mPGBackgroundSystemWallpaperHeight, R.string.wp_h_t, R.string.wp_auto, pc.bgSystemWPHeight, null, ValueType.INT, 0, 2000, 1, null)); mPreferencesPageBackground.add(mPGBackgroundSystemWallpaperHeight = new LLPreferenceSlider(this, ID_mPGBackgroundSystemWallpaperHeight, R.string.wp_h_t, R.string.wp_auto, pc.bgSystemWPHeight, null, ValueType.INT, 0, 2000, 1, null));
if(android.os.Build.VERSION.SDK_INT>=9) { mPreferencesPageBackground.add(new LLPreferenceCategory(this, R.string.bg_screen_wp));
mPreferencesPageBackground.add(new LLPreferenceCategory(this, R.string.bg_screen_wp)); mPreferencesPageBackground.add(mPGBackgroundSelectScreenWallpaper = new LLPreference(this, ID_mPGBackgroundSelectScreenWallpaper, R.string.bg_screen_wp_select_t, R.string.bg_screen_wp_select_s));
mPreferencesPageBackground.add(mPGBackgroundSelectScreenWallpaper = new LLPreference(this, ID_mPGBackgroundSelectScreenWallpaper, R.string.bg_screen_wp_select_t, R.string.bg_screen_wp_select_s)); mPreferencesPageBackground.add(mPGBackgroundScaleType = new LLPreferenceList(this, ID_mPGBackgroundScaleType, R.string.bg_st, R.array.bg_st_e, pc.bgScaleType, null));
mPreferencesPageBackground.add(mPGBackgroundScaleType = new LLPreferenceList(this, ID_mPGBackgroundScaleType, R.string.bg_st, R.array.bg_st_e, pc.bgScaleType, null));
}
mPreferencesPageBackground.add(new LLPreferenceCategory(this, R.string.bg_more)); mPreferencesPageBackground.add(new LLPreferenceCategory(this, R.string.bg_more));
mPreferencesPageBackground.add(mPGBackgroundColor = new LLPreferenceColor(this, ID_mPGBackgroundColor, R.string.bg_more_color_t, R.string.bg_more_color_s, pc.bgColor, null, true)); mPreferencesPageBackground.add(mPGBackgroundColor = new LLPreferenceColor(this, ID_mPGBackgroundColor, R.string.bg_more_color_t, R.string.bg_more_color_s, pc.bgColor, null, true));
} }
@ -1184,50 +1180,21 @@ public class Customize extends ResourceWrapperActivity implements
mPreferencesPageSystemBars.add(new LLPreferenceCategory(this, R.string.sb_c)); mPreferencesPageSystemBars.add(new LLPreferenceCategory(this, R.string.sb_c));
mPreferencesPageSystemBars.add(mPGSystemBarsHideStatusBar = new LLPreferenceCheckBox(this, ID_mPGSystemBarsHideStatusBar, R.string.hide_statusbar_t, 0, pc.statusBarHide, null)); mPreferencesPageSystemBars.add(mPGSystemBarsHideStatusBar = new LLPreferenceCheckBox(this, ID_mPGSystemBarsHideStatusBar, R.string.hide_statusbar_t, 0, pc.statusBarHide, null));
// try to detect status bar capabilities on devices < API 19
boolean has_transparent_status_bar = false;
if (Build.VERSION.SDK_INT < 19) {
try {
Class<?> statusbarManager = Class.forName("android.app.StatusBarManager");
statusbarManager.getMethod("setStatusBarTransparent", boolean.class);
has_transparent_status_bar = true;
} catch (Exception e1) {
}
if (!has_transparent_status_bar) { mPreferencesPageSystemBars.add(mPGSystemBarsStatusBarColor = new LLPreferenceColor(this, ID_mPGSystemBarsStatusBarColor, R.string.sbc_t, 0, pc.statusBarColor, null, true));
try {
Field field = View.class.getDeclaredField("SYSTEM_UI_FLAG_TRANSPARENT_BACKGROUND");
Class<?> t = field.getType();
if (t == int.class) {
field.getInt(null);
View.class.getMethod("setSystemUiVisibility", int.class);
has_transparent_status_bar = true;
}
} catch (Exception e) {
}
}
if (has_transparent_status_bar) { mPreferencesPageSystemBars.add(mPGSystemBarsStatusBarLight = new LLPreferenceCheckBox(this, ID_mPGSystemBarsStatusBarLight, R.string.sbl_t, 0, pc.statusBarLight, null));
mPreferencesPageSystemBars.add(mPGSystemBarsTransparentStatusBar = new LLPreferenceCheckBox(this, ID_mPGSystemBarsTransparentStatusBar, R.string.trans_statusbar_t, R.string.trans_statusbar_s, pc.statusBarColor == 0, null));
}
}
if (Build.VERSION.SDK_INT >= 19) {
mPreferencesPageSystemBars.add(mPGSystemBarsStatusBarColor = new LLPreferenceColor(this, ID_mPGSystemBarsStatusBarColor, R.string.sbc_t, 0, pc.statusBarColor, null, true));
if (Build.VERSION.SDK_INT >= 23) {
mPreferencesPageSystemBars.add(mPGSystemBarsStatusBarLight = new LLPreferenceCheckBox(this, ID_mPGSystemBarsStatusBarLight, R.string.sbl_t, 0, pc.statusBarLight, null));
}
mPreferencesPageSystemBars.add(mPGSystemBarsStatusBarOverlap = new LLPreferenceCheckBox(this, ID_mPGSystemBarsStatusBarOverlap, R.string.sbo_t, 0, pc.statusBarOverlap, null)); mPreferencesPageSystemBars.add(mPGSystemBarsStatusBarOverlap = new LLPreferenceCheckBox(this, ID_mPGSystemBarsStatusBarOverlap, R.string.sbo_t, 0, pc.statusBarOverlap, null));
if (mSystemBarTintManager == null || (mSystemBarTintManager != null && mSystemBarTintManager.getConfig().hasNavigationBar())) { if (mSystemBarTintManager == null || (mSystemBarTintManager != null && mSystemBarTintManager.getConfig().hasNavigationBar())) {
mPreferencesPageSystemBars.add(new LLPreferenceCategory(this, R.string.nb_c)); mPreferencesPageSystemBars.add(new LLPreferenceCategory(this, R.string.nb_c));
mPreferencesPageSystemBars.add(mPGSystemBarsNavigationBarColor = new LLPreferenceColor(this, ID_mPGSystemBarsNavigationBarColor, R.string.nbc_t, 0, pc.navigationBarColor, null, true)); mPreferencesPageSystemBars.add(mPGSystemBarsNavigationBarColor = new LLPreferenceColor(this, ID_mPGSystemBarsNavigationBarColor, R.string.nbc_t, 0, pc.navigationBarColor, null, true));
if (Build.VERSION.SDK_INT >= 26) { mPreferencesPageSystemBars.add(mPGSystemBarsNavigationBarLight = new LLPreferenceCheckBox(this, ID_mPGSystemBarsNavigationBarLight, R.string.nbl_t, 0, pc.navigationBarLight, null));
mPreferencesPageSystemBars.add(mPGSystemBarsNavigationBarLight = new LLPreferenceCheckBox(this, ID_mPGSystemBarsNavigationBarLight, R.string.nbl_t, 0, pc.navigationBarLight, null));
}
mPreferencesPageSystemBars.add(mPGSystemBarsNavBarOverlap = new LLPreferenceCheckBox(this, ID_mPGSystemBarsNavBarOverlap, R.string.nbo_t, 0, pc.navigationBarOverlap, null)); mPreferencesPageSystemBars.add(mPGSystemBarsNavBarOverlap = new LLPreferenceCheckBox(this, ID_mPGSystemBarsNavBarOverlap, R.string.nbo_t, 0, pc.navigationBarOverlap, null));
} }
}
if (is_app_drawer) { if (is_app_drawer) {
mPreferencesPageSystemBars.add(new LLPreferenceCategory(this, R.string.ad_ab_c_t)); mPreferencesPageSystemBars.add(new LLPreferenceCategory(this, R.string.ad_ab_c_t));
@ -1357,9 +1324,6 @@ public class Customize extends ResourceWrapperActivity implements
mPreferencesPageADModes.add(mPGADModeCustom = new LLPreferenceCheckBox(this, 0, R.string.mi_mode_custom, 0, Utils.hasAppDrawerMode(modes, Utils.LAYOUT_MODE_CUSTOM), null)); mPreferencesPageADModes.add(mPGADModeCustom = new LLPreferenceCheckBox(this, 0, R.string.mi_mode_custom, 0, Utils.hasAppDrawerMode(modes, Utils.LAYOUT_MODE_CUSTOM), null));
mPreferencesPageADModes.add(mPGADModeByName = new LLPreferenceCheckBox(this, 0, R.string.mi_mode_by_name, 0, Utils.hasAppDrawerMode(modes, Utils.LAYOUT_MODE_BY_NAME), null)); mPreferencesPageADModes.add(mPGADModeByName = new LLPreferenceCheckBox(this, 0, R.string.mi_mode_by_name, 0, Utils.hasAppDrawerMode(modes, Utils.LAYOUT_MODE_BY_NAME), null));
mPreferencesPageADModes.add(mPGADModeFrequentlyUsed = new LLPreferenceCheckBox(this, 0, R.string.mi_mode_frequently_used, 0, Utils.hasAppDrawerMode(modes, Utils.LAYOUT_MODE_FREQUENTLY_USED), null)); mPreferencesPageADModes.add(mPGADModeFrequentlyUsed = new LLPreferenceCheckBox(this, 0, R.string.mi_mode_frequently_used, 0, Utils.hasAppDrawerMode(modes, Utils.LAYOUT_MODE_FREQUENTLY_USED), null));
if(Build.VERSION.SDK_INT<21) {
mPreferencesPageADModes.add(mPGADModeRecentApps = new LLPreferenceCheckBox(this, 0, R.string.mi_mode_recent_apps, 0, Utils.hasAppDrawerMode(modes, Utils.LAYOUT_MODE_RECENT_APPS), null));
}
mPreferencesPageADModes.add(mPGADModeRecentlyUpdated = new LLPreferenceCheckBox(this, 0, R.string.mi_mode_recently_updated, 0, Utils.hasAppDrawerMode(modes, Utils.LAYOUT_MODE_RECENTLY_UPDATED), null)); mPreferencesPageADModes.add(mPGADModeRecentlyUpdated = new LLPreferenceCheckBox(this, 0, R.string.mi_mode_recently_updated, 0, Utils.hasAppDrawerMode(modes, Utils.LAYOUT_MODE_RECENTLY_UPDATED), null));
mPreferencesPageADModes.add(mPGADModeRunning = new LLPreferenceCheckBox(this, 0, R.string.mi_mode_running, 0, Utils.hasAppDrawerMode(modes, Utils.LAYOUT_MODE_RUNNING), null)); mPreferencesPageADModes.add(mPGADModeRunning = new LLPreferenceCheckBox(this, 0, R.string.mi_mode_running, 0, Utils.hasAppDrawerMode(modes, Utils.LAYOUT_MODE_RUNNING), null));
} }
@ -1409,24 +1373,23 @@ public class Customize extends ResourceWrapperActivity implements
mPreferencesGlobalConfig.add(mGCExpertMode = new LLPreferenceCheckBox(this, ID_mGCExpertMode, R.string.em_t, R.string.em_s, mSystemConfig.expertMode, null)); mPreferencesGlobalConfig.add(mGCExpertMode = new LLPreferenceCheckBox(this, ID_mGCExpertMode, R.string.em_t, R.string.em_s, mSystemConfig.expertMode, null));
mPreferencesGlobalConfig.add(mGCLanguageCategory = new LLPreference( mPreferencesGlobalConfig.add(mGCLanguageCategory = new LLPreference(
this, ID_mGCLanguageCategory, R.string.language_t, R.string.language_s)); this, ID_mGCLanguageCategory, R.string.language_t, R.string.language_s));
if(Build.VERSION.SDK_INT>=13) {
mPreferencesGlobalConfig.add(mGCAppStyle = new LLPreferenceList(this, ID_mGCAppStyle, R.string.gc_as_t, R.array.gc_as_e, mSystemConfig.appStyle, null)); mPreferencesGlobalConfig.add(mGCAppStyle = new LLPreferenceList(this, ID_mGCAppStyle, R.string.gc_as_t, R.array.gc_as_e, mSystemConfig.appStyle, null));
}
mPreferencesGlobalConfig.add(mGCEventsCategory = new LLPreference(this, ID_mGCEventsCategory, mPreferencesGlobalConfig.add(mGCEventsCategory = new LLPreference(this, ID_mGCEventsCategory,
R.string.events_t, R.string.events_s)); R.string.events_t, R.string.events_s));
if(Build.VERSION.SDK_INT>=8) {
mPreferencesGlobalConfig.add(mGCLockScreenCategory = new LLPreference(this, ID_mGCLockScreenCategory, R.string.s_ls_t, R.string.s_ls_s)); mPreferencesGlobalConfig.add(mGCLockScreenCategory = new LLPreference(this, ID_mGCLockScreenCategory, R.string.s_ls_t, R.string.s_ls_s));
mPreferencesGlobalConfigLockScreen = new ArrayList<LLPreference>(3); mPreferencesGlobalConfigLockScreen = new ArrayList<LLPreference>(3);
mPreferencesGlobalConfigLockScreen.add(mGCLockScreenSelect = new LLPreference(this, ID_mGCLockScreenSelect, R.string.s_ls_s_t, R.string.s_ls_s_s)); mPreferencesGlobalConfigLockScreen.add(mGCLockScreenSelect = new LLPreference(this, ID_mGCLockScreenSelect, R.string.s_ls_s_t, R.string.s_ls_s_s));
mPreferencesGlobalConfigLockScreen.add(mGCLockScreenLaunchUnlock = new LLPreferenceCheckBox(this, ID_mGCLockScreenLaunchUnlock, R.string.s_ls_lu_t, R.string.s_ls_lu_s, mGlobalConfig.launchUnlock, null)); mPreferencesGlobalConfigLockScreen.add(mGCLockScreenLaunchUnlock = new LLPreferenceCheckBox(this, ID_mGCLockScreenLaunchUnlock, R.string.s_ls_lu_t, R.string.s_ls_lu_s, mGlobalConfig.launchUnlock, null));
mPreferencesGlobalConfigLockScreen.add(mGCLockScreenDisableOverlay = new LLPreferenceCheckBox(this, ID_mGCLockScreenDisableOverlay, R.string.ldo_t, R.string.ldo_s, mGlobalConfig.lockDisableOverlay, null)); mPreferencesGlobalConfigLockScreen.add(mGCLockScreenDisableOverlay = new LLPreferenceCheckBox(this, ID_mGCLockScreenDisableOverlay, R.string.ldo_t, R.string.ldo_s, mGlobalConfig.lockDisableOverlay, null));
}
if(Build.VERSION.SDK_INT>=14) { mPreferencesGlobalConfig.add(mGCOverlayCategory = new LLPreference(this, ID_mGCOverlayCategory, R.string.ov_t, R.string.ov_s));
mPreferencesGlobalConfig.add(mGCOverlayCategory = new LLPreference(this, ID_mGCOverlayCategory, R.string.ov_t, R.string.ov_s)); mPreferencesGlobalConfigOverlay = new ArrayList<LLPreference>(3);
mPreferencesGlobalConfigOverlay = new ArrayList<LLPreference>(3);
if(Build.VERSION.SDK_INT >= 23) { mPreferencesGlobalConfigOverlay.add(mGCOverlayPermission = new LLPreference(this, ID_mGCOverlayPermission, R.string.ov_pt, R.string.ov_ps));
mPreferencesGlobalConfigOverlay.add(mGCOverlayPermission = new LLPreference(this, ID_mGCOverlayPermission, R.string.ov_pt, R.string.ov_ps));
}
mPreferencesGlobalConfigOverlay.add(mGCOverlaySelect = new LLPreference(this, ID_mGCOverlaySelect, R.string.ov_st, R.string.ov_ss)); mPreferencesGlobalConfigOverlay.add(mGCOverlaySelect = new LLPreference(this, ID_mGCOverlaySelect, R.string.ov_st, R.string.ov_ss));
mPreferencesGlobalConfigOverlay.add(mGCOverlayLaunchHide = new LLPreferenceCheckBox(this, ID_mGCOverlayLaunchHide, R.string.ov_lht, R.string.ov_lhs, mGlobalConfig.overlayLaunchHide, null)); mPreferencesGlobalConfigOverlay.add(mGCOverlayLaunchHide = new LLPreferenceCheckBox(this, ID_mGCOverlayLaunchHide, R.string.ov_lht, R.string.ov_lhs, mGlobalConfig.overlayLaunchHide, null));
mPreferencesGlobalConfigOverlay.add(mGCOverlayDisplayHandles = new LLPreferenceCheckBox(this, ID_mGCOverlayDisplayHandles, R.string.ov_dht, R.string.ov_dhs, mGlobalConfig.overlayDisplayHandles, null)); mPreferencesGlobalConfigOverlay.add(mGCOverlayDisplayHandles = new LLPreferenceCheckBox(this, ID_mGCOverlayDisplayHandles, R.string.ov_dht, R.string.ov_dhs, mGlobalConfig.overlayDisplayHandles, null));
@ -1436,19 +1399,17 @@ public class Customize extends ResourceWrapperActivity implements
mPreferencesGlobalConfigOverlay.add(mGCOverlayHideHandleSize = new LLPreferenceSlider(this, ID_mGCOverlayHandleSize, R.string.ov_hhs, 0, mGlobalConfig.overlayHideHandleSize, null, ValueType.FLOAT, 0, 1, 0.1f, "%")); mPreferencesGlobalConfigOverlay.add(mGCOverlayHideHandleSize = new LLPreferenceSlider(this, ID_mGCOverlayHandleSize, R.string.ov_hhs, 0, mGlobalConfig.overlayHideHandleSize, null, ValueType.FLOAT, 0, 1, 0.1f, "%"));
mPreferencesGlobalConfigOverlay.add(mGCOverlayHideHandleWidth = new LLPreferenceSlider(this, ID_mGCOverlayHandleWidth, R.string.ov_hhw, 0, mGlobalConfig.overlayHideHandleWidth, null, ValueType.FLOAT, 0, 0.2f, 0.01f, "%")); mPreferencesGlobalConfigOverlay.add(mGCOverlayHideHandleWidth = new LLPreferenceSlider(this, ID_mGCOverlayHandleWidth, R.string.ov_hhw, 0, mGlobalConfig.overlayHideHandleWidth, null, ValueType.FLOAT, 0, 0.2f, 0.01f, "%"));
mPreferencesGlobalConfigOverlay.add(mGCOverlayHideHandlePosition = new LLPreferenceList(this, ID_mGCOverlayHandlePosition, R.string.ov_hhp, R.array.ov_hp_e, mGlobalConfig.overlayHideHandlePosition, null)); mPreferencesGlobalConfigOverlay.add(mGCOverlayHideHandlePosition = new LLPreferenceList(this, ID_mGCOverlayHandlePosition, R.string.ov_hhp, R.array.ov_hp_e, mGlobalConfig.overlayHideHandlePosition, null));
if(Build.VERSION.SDK_INT >= 23) {
boolean disabled = !WindowService.isPermissionAllowed(this); boolean disabled = !WindowService.isPermissionAllowed(this);
for (LLPreference p : mPreferencesGlobalConfigOverlay) { for (LLPreference p : mPreferencesGlobalConfigOverlay) {
if(p != mGCOverlayPermission) { if(p != mGCOverlayPermission) {
p.setDisabled(disabled); p.setDisabled(disabled);
} }
} }
}
}
mPreferencesGlobalConfig.add(mGCPageAnimation = new LLPreferenceList(this, ID_mGCPageAnimation, R.string.page_anim_t, R.array.page_anim_e, mGlobalConfig.pageAnimation, null)); mPreferencesGlobalConfig.add(mGCPageAnimation = new LLPreferenceList(this, ID_mGCPageAnimation, R.string.page_anim_t, R.array.page_anim_e, mGlobalConfig.pageAnimation, null));
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { mPreferencesGlobalConfig.add(mGCHotwords = new LLPreferenceCheckBox(this, ID_mGCHotwords, R.string.hw_t, R.string.hw_s, mSystemConfig.hotwords, null));
mPreferencesGlobalConfig.add(mGCHotwords = new LLPreferenceCheckBox(this, ID_mGCHotwords, R.string.hw_t, R.string.hw_s, mSystemConfig.hotwords, null));
}
if(mSystemConfig.expertMode) { if(mSystemConfig.expertMode) {
mPreferencesGlobalConfig.add(mGCRunScripts = new LLPreferenceCheckBox(this, ID_mGCRunScripts, R.string.rs_t, R.string.rs_s, mGlobalConfig.runScripts && !LLApp.get().isFreeVersion(), null)); mPreferencesGlobalConfig.add(mGCRunScripts = new LLPreferenceCheckBox(this, ID_mGCRunScripts, R.string.rs_t, R.string.rs_s, mGlobalConfig.runScripts && !LLApp.get().isFreeVersion(), null));
mPreferencesGlobalConfig.add(mGCKeepInMemory = new LLPreferenceCheckBox(this, ID_mGCKeepInMemory, R.string.keep_in_memory_t, R.string.keep_in_memory_s, mSystemConfig.keepInMemory, null)); mPreferencesGlobalConfig.add(mGCKeepInMemory = new LLPreferenceCheckBox(this, ID_mGCKeepInMemory, R.string.keep_in_memory_t, R.string.keep_in_memory_s, mSystemConfig.keepInMemory, null));
@ -1565,16 +1526,16 @@ public class Customize extends ResourceWrapperActivity implements
mGlobalConfig.launchUnlock = mGCLockScreenLaunchUnlock.isChecked(); mGlobalConfig.launchUnlock = mGCLockScreenLaunchUnlock.isChecked();
mGlobalConfig.lockDisableOverlay = mGCLockScreenDisableOverlay.isChecked(); mGlobalConfig.lockDisableOverlay = mGCLockScreenDisableOverlay.isChecked();
if(Build.VERSION.SDK_INT>=14) {
mGlobalConfig.overlayLaunchHide = mGCOverlayLaunchHide.isChecked(); mGlobalConfig.overlayLaunchHide = mGCOverlayLaunchHide.isChecked();
mGlobalConfig.overlayDisplayHandles = mGCOverlayDisplayHandles.isChecked(); mGlobalConfig.overlayDisplayHandles = mGCOverlayDisplayHandles.isChecked();
mGlobalConfig.overlayShowHandlePosition = (GlobalConfig.OverlayHandlePosition) mGCOverlayShowHandlePosition.getValueEnum(); mGlobalConfig.overlayShowHandlePosition = (GlobalConfig.OverlayHandlePosition) mGCOverlayShowHandlePosition.getValueEnum();
mGlobalConfig.overlayShowHandleSize = mGCOverlayShowHandleSize.getValue(); mGlobalConfig.overlayShowHandleSize = mGCOverlayShowHandleSize.getValue();
mGlobalConfig.overlayShowHandleWidth = mGCOverlayShowHandleWidth.getValue(); mGlobalConfig.overlayShowHandleWidth = mGCOverlayShowHandleWidth.getValue();
mGlobalConfig.overlayHideHandlePosition = (GlobalConfig.OverlayHandlePosition) mGCOverlayHideHandlePosition.getValueEnum(); mGlobalConfig.overlayHideHandlePosition = (GlobalConfig.OverlayHandlePosition) mGCOverlayHideHandlePosition.getValueEnum();
mGlobalConfig.overlayHideHandleSize = mGCOverlayHideHandleSize.getValue(); mGlobalConfig.overlayHideHandleSize = mGCOverlayHideHandleSize.getValue();
mGlobalConfig.overlayHideHandleWidth = mGCOverlayHideHandleWidth.getValue(); mGlobalConfig.overlayHideHandleWidth = mGCOverlayHideHandleWidth.getValue();
}
mGlobalConfig.homeKey = mGCEventHomeKey.getValue(); mGlobalConfig.homeKey = mGCEventHomeKey.getValue();
mGlobalConfig.menuKey = mGCEventMenuKey.getValue(); mGlobalConfig.menuKey = mGCEventMenuKey.getValue();

View file

@ -800,7 +800,7 @@ public class Dashboard extends ResourceWrapperActivity implements OnLongClickLis
mEngine.cancelDelayedSaveData(); mEngine.cancelDelayedSaveData();
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT && getClass() == Dashboard.class && mSystemConfig.hotwords && mHotwordServiceClient != null) { if (getClass() == Dashboard.class && mSystemConfig.hotwords && mHotwordServiceClient != null) {
mHotwordServiceClient.requestHotwordDetection(true); mHotwordServiceClient.requestHotwordDetection(true);
} }
@ -839,7 +839,7 @@ public class Dashboard extends ResourceWrapperActivity implements OnLongClickLis
mDialog = null; mDialog = null;
} }
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT && getClass() == Dashboard.class && mSystemConfig.hotwords && mHotwordServiceClient != null) { if (getClass() == Dashboard.class && mSystemConfig.hotwords && mHotwordServiceClient != null) {
mHotwordServiceClient.requestHotwordDetection(false); mHotwordServiceClient.requestHotwordDetection(false);
} }
@ -915,7 +915,7 @@ public class Dashboard extends ResourceWrapperActivity implements OnLongClickLis
public void onAttachedToWindow() { public void onAttachedToWindow() {
super.onAttachedToWindow(); super.onAttachedToWindow();
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT && getClass() == Dashboard.class) { if (getClass() == Dashboard.class) {
if(mSystemConfig.hotwords) { if(mSystemConfig.hotwords) {
if (mHotwordServiceClient == null) { if (mHotwordServiceClient == null) {
mHotwordServiceClient = new HotwordServiceClient(this); mHotwordServiceClient = new HotwordServiceClient(this);
@ -930,7 +930,7 @@ public class Dashboard extends ResourceWrapperActivity implements OnLongClickLis
public void onDetachedFromWindow() { public void onDetachedFromWindow() {
super.onDetachedFromWindow(); super.onDetachedFromWindow();
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT && getClass() == Dashboard.class) { if (getClass() == Dashboard.class) {
if(mSystemConfig.hotwords) { if(mSystemConfig.hotwords) {
mHotwordServiceClient.requestHotwordDetection(false); mHotwordServiceClient.requestHotwordDetection(false);
mHotwordServiceClient.onDetachedFromWindow(); mHotwordServiceClient.onDetachedFromWindow();
@ -2508,10 +2508,9 @@ public class Dashboard extends ResourceWrapperActivity implements OnLongClickLis
} }
} }
private static boolean MANUAL_LONG_KEY_PRESS_HANDLING = Build.VERSION.SDK_INT >= 24;
private int mLongPressKeyCode; private int mLongPressKeyCode;
private boolean mHasLongKeyPress; private boolean mHasLongKeyPress;
private Runnable mLongKeyPressRunnable = !MANUAL_LONG_KEY_PRESS_HANDLING ? null : new Runnable() { private final Runnable mLongKeyPressRunnable = new Runnable() {
@Override @Override
public void run() { public void run() {
mHasLongKeyPress = true; mHasLongKeyPress = true;
@ -2520,18 +2519,16 @@ public class Dashboard extends ResourceWrapperActivity implements OnLongClickLis
}; };
private void startLongKeyPressTimer(int keyCode) { private void startLongKeyPressTimer(int keyCode) {
if(MANUAL_LONG_KEY_PRESS_HANDLING) {
// only one key managed at a time // only one key managed at a time
mLongPressKeyCode = keyCode; mLongPressKeyCode = keyCode;
mHandler.removeCallbacks(mLongKeyPressRunnable); mHandler.removeCallbacks(mLongKeyPressRunnable);
mHandler.postDelayed(mLongKeyPressRunnable, ViewConfiguration.getLongPressTimeout()); mHandler.postDelayed(mLongKeyPressRunnable, ViewConfiguration.getLongPressTimeout());
}
} }
private void cancelLongKeyPressTimer() { private void cancelLongKeyPressTimer() {
if(MANUAL_LONG_KEY_PRESS_HANDLING) { mHandler.removeCallbacks(mLongKeyPressRunnable);
mHandler.removeCallbacks(mLongKeyPressRunnable);
}
} }
@Override @Override
@ -2862,7 +2859,7 @@ public class Dashboard extends ResourceWrapperActivity implements OnLongClickLis
} }
private void configureSystemBarsPadding(PageConfig c) { private void configureSystemBarsPadding(PageConfig c) {
if(Build.VERSION.SDK_INT>=19) { {
SystemBarTintManager.SystemBarConfig config = mScreen.getSystemBarTintManager().getConfig(); SystemBarTintManager.SystemBarConfig config = mScreen.getSystemBarTintManager().getConfig();
int sbh = c.statusBarHide ? 0 : config.getStatusBarHeight(); int sbh = c.statusBarHide ? 0 : config.getStatusBarHeight();
int abh = getActionBarHeight(); int abh = getActionBarHeight();
@ -2892,10 +2889,6 @@ public class Dashboard extends ResourceWrapperActivity implements OnLongClickLis
} }
findViewById(R.id.sb_padding).setPadding(0, padding_top, padding_right, padding_bottom); findViewById(R.id.sb_padding).setPadding(0, padding_top, padding_right, padding_bottom);
mEditControlsView.setPadding(0, sbh + abh, navigationAtBottom ? 0 : nbh, navigationAtBottom ? nbh : 0); mEditControlsView.setPadding(0, sbh + abh, navigationAtBottom ? 0 : nbh, navigationAtBottom ? nbh : 0);
} else {
int abh = getActionBarHeight();
findViewById(R.id.sb_padding).setPadding(0, abh, 0, 0);
mEditControlsView.setPadding(0, abh, 0, 0);
} }
} }
@ -3077,12 +3070,8 @@ public class Dashboard extends ResourceWrapperActivity implements OnLongClickLis
mAllocatedAppWidgetId=LLApp.get().getAppWidgetHost().allocateAppWidgetId(); mAllocatedAppWidgetId=LLApp.get().getAppWidgetHost().allocateAppWidgetId();
Intent pickIntent; Intent pickIntent;
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { pickIntent = new Intent(this, AppWidgetPickerActivity.class);
pickIntent = new Intent(this, AppWidgetPickerActivity.class); pickIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, mAllocatedAppWidgetId);
} else {
pickIntent = new Intent(AppWidgetManager.ACTION_APPWIDGET_PICK);
}
pickIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, mAllocatedAppWidgetId);
ArrayList<AppWidgetProviderInfo> customInfo = new ArrayList<AppWidgetProviderInfo>(); ArrayList<AppWidgetProviderInfo> customInfo = new ArrayList<AppWidgetProviderInfo>();
pickIntent.putParcelableArrayListExtra(AppWidgetManager.EXTRA_CUSTOM_INFO, customInfo); pickIntent.putParcelableArrayListExtra(AppWidgetManager.EXTRA_CUSTOM_INFO, customInfo);
ArrayList<Bundle> customExtras = new ArrayList<Bundle>(); ArrayList<Bundle> customExtras = new ArrayList<Bundle>();
@ -3583,11 +3572,7 @@ public class Dashboard extends ResourceWrapperActivity implements OnLongClickLis
} }
private void setAlphaOrVisibility(View view, float to) { private void setAlphaOrVisibility(View view, float to) {
if(Build.VERSION.SDK_INT >= 11) { view.setAlpha(to);
view.setAlpha(to);
} else {
view.setVisibility(to==1 ? View.VISIBLE : View.GONE);
}
} }
/** /**
@ -5400,7 +5385,7 @@ public class Dashboard extends ResourceWrapperActivity implements OnLongClickLis
lp.height = mEditBarsHeight; lp.height = mEditBarsHeight;
mEditBarHider.requestLayout(); mEditBarHider.requestLayout();
if(mEditBarsVisible && mSystemConfig.hasSwitch(SystemConfig.SWITCH_CONTENT_ZOOMED) && Build.VERSION.SDK_INT >= 11) { if (mEditBarsVisible && mSystemConfig.hasSwitch(SystemConfig.SWITCH_CONTENT_ZOOMED)) {
View desktopView = mScreen.getDesktopView(); View desktopView = mScreen.getDesktopView();
desktopView.setScaleX(mEditBarsScale); desktopView.setScaleX(mEditBarsScale);
desktopView.setScaleY(mEditBarsScale); desktopView.setScaleY(mEditBarsScale);
@ -5474,7 +5459,7 @@ public class Dashboard extends ResourceWrapperActivity implements OnLongClickLis
} }
} }
if(mAnimateZoom && Build.VERSION.SDK_INT >= 11) { if (mAnimateZoom) {
desktopView.setScaleX(sx); desktopView.setScaleX(sx);
desktopView.setScaleY(sy); desktopView.setScaleY(sy);
} }
@ -6148,13 +6133,7 @@ public class Dashboard extends ResourceWrapperActivity implements OnLongClickLis
return ScreenIdentity.HOME; return ScreenIdentity.HOME;
} }
@Override
protected boolean isAndroidActionBarSupported() {
// action bar introduced in API 11 but support in LL only starting at 21 because of additional options (see configureSystemBarsPadding)
return Build.VERSION.SDK_INT >= 21;
}
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@Override @Override
public void showAndroidActionBar(Function onCreateOptionsMenu, Function onOptionsItemSelected) { public void showAndroidActionBar(Function onCreateOptionsMenu, Function onOptionsItemSelected) {
if(isAndroidActionBarSupported() && !mIsAndroidActionBarDisplayed) { if(isAndroidActionBarSupported() && !mIsAndroidActionBarDisplayed) {
@ -6519,8 +6498,8 @@ public class Dashboard extends ResourceWrapperActivity implements OnLongClickLis
@Override @Override
public void onItemLayoutAppShortcutDropped(ItemLayout itemLayout, Object shortcutInfoObject, float x, float y) { public void onItemLayoutAppShortcutDropped(ItemLayout itemLayout, Object shortcutInfoObject, float x, float y) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) {
ShortcutInfo shortcutInfo = (ShortcutInfo) shortcutInfoObject; ShortcutInfo shortcutInfo = (ShortcutInfo) shortcutInfoObject;
CharSequence label = shortcutInfo.getLongLabel(); CharSequence label = shortcutInfo.getLongLabel();
if(label == null || label.length() == 0) { if(label == null || label.length() == 0) {
label = shortcutInfo.getShortLabel(); label = shortcutInfo.getShortLabel();
@ -6534,7 +6513,7 @@ public class Dashboard extends ResourceWrapperActivity implements OnLongClickLis
intent.putExtra(Shortcut.INTENT_EXTRA_APP_SHORTCUT_DISABLED_MSG, shortcutInfo.getDisabledMessage()); intent.putExtra(Shortcut.INTENT_EXTRA_APP_SHORTCUT_DISABLED_MSG, shortcutInfo.getDisabledMessage());
Utils.addShortcut(label.toString(), icon, intent, itemLayout.getPage(), x, y, 1, true); Utils.addShortcut(label.toString(), icon, intent, itemLayout.getPage(), x, y, 1, true);
} }
}
@Override @Override
public void onHandlePressed(Handle h) { public void onHandlePressed(Handle h) {
@ -7265,9 +7244,7 @@ public class Dashboard extends ResourceWrapperActivity implements OnLongClickLis
break; break;
case GlobalConfig.SHOW_APP_SHORTCUTS: case GlobalConfig.SHOW_APP_SHORTCUTS:
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) { showAppShortcuts(itemView);
showAppShortcuts(itemView);
}
break; break;
case GlobalConfig.SEARCH: case GlobalConfig.SEARCH:

View file

@ -471,11 +471,9 @@ public class ImagePicker extends ResourceWrapperActivity implements AdapterView.
label = s+"/"+pkg.label; label = s+"/"+pkg.label;
clip_text = "\""+s+"\", \""+pkg.label+"\""; clip_text = "\""+s+"\", \""+pkg.label+"\"";
} }
if(Build.VERSION.SDK_INT>=11) { ClipboardManager clipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
ClipboardManager clipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE); ClipData clip = newPlainText("llx", clip_text);
ClipData clip = newPlainText("llx", clip_text); clipboard.setPrimaryClip(clip);
clipboard.setPrimaryClip(clip);
}
Toast.makeText(this, label, Toast.LENGTH_LONG).show(); Toast.makeText(this, label, Toast.LENGTH_LONG).show();
return true; return true;
} }

View file

@ -104,9 +104,7 @@ public class LockScreen extends Dashboard {
// newUiOptions |= View.SYSTEM_UI_FLAG_LOW_PROFILE; // newUiOptions |= View.SYSTEM_UI_FLAG_LOW_PROFILE;
// } // }
if (Build.VERSION.SDK_INT >= 18) { newUiOptions |= 0x00001000; //View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
newUiOptions |= 0x00001000; //View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
}
Method setSystemUiVisibility = decor_view.getClass().getMethod("setSystemUiVisibility", int.class); Method setSystemUiVisibility = decor_view.getClass().getMethod("setSystemUiVisibility", int.class);
setSystemUiVisibility.invoke(decor_view, newUiOptions); setSystemUiVisibility.invoke(decor_view, newUiOptions);

View file

@ -152,9 +152,7 @@ public class EmptyService extends Service {
public void onDestroy() { public void onDestroy() {
super.onDestroy(); super.onDestroy();
if(Build.VERSION.SDK_INT>=8) { unregisterReceiver(mBroadcastReceiver);
unregisterReceiver(mBroadcastReceiver);
}
} }

View file

@ -441,10 +441,8 @@ public class Setup {
config.defaultFolderConfig.outsideTapClose = true; config.defaultFolderConfig.outsideTapClose = true;
config.gridPRowNum = config.gridLRowNum = 4; config.gridPRowNum = config.gridLRowNum = 4;
config.scrollingDirection = PageConfig.ScrollingDirection.X; config.scrollingDirection = PageConfig.ScrollingDirection.X;
if(Build.VERSION.SDK_INT>=19) { config.statusBarColor = resources.getColor(R.color.color_primary_dark);
config.statusBarColor = resources.getColor(R.color.color_primary_dark); config.navigationBarColor = Color.BLACK;
config.navigationBarColor = Color.BLACK;
}
config.screenOrientation = PageConfig.ScreenOrientation.PORTRAIT; config.screenOrientation = PageConfig.ScreenOrientation.PORTRAIT;
// config.defaultItemConfig.rotate = true; // config.defaultItemConfig.rotate = true;

View file

@ -118,7 +118,7 @@ public class BoxEditorView extends View implements Runnable {
mSelectedAreaPaint = new Paint(); mSelectedAreaPaint = new Paint();
mSelectedAreaPaint.setStyle(Paint.Style.FILL); mSelectedAreaPaint.setStyle(Paint.Style.FILL);
mSelectedAreaPaint.setColor(Build.VERSION.SDK_INT<11 ? 0xff8080ff : 0x808080ff); // workaround for a drawing bug on some devices mSelectedAreaPaint.setColor(0x808080ff); // workaround for a drawing bug on some devices
mTextPaint = new Paint(Paint.ANTI_ALIAS_FLAG); mTextPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mTextPaint.setColor(Color.BLACK); mTextPaint.setColor(Color.BLACK);

View file

@ -703,7 +703,7 @@ public class CustomizeItemView extends MyViewPager implements LLPreferenceListVi
ArrayList<LLPreference> prefs_misc = new ArrayList<>(); ArrayList<LLPreference> prefs_misc = new ArrayList<>();
prefs_misc.add(mItemMiscName = new LLPreference(context, ID_mItemMiscName, R.string.in_t, R.string.in_s)); prefs_misc.add(mItemMiscName = new LLPreference(context, ID_mItemMiscName, R.string.in_t, R.string.in_s));
prefs_misc.add(mItemMiscLaunchAnimation = new LLPreferenceList(context, ID_mItemMiscLaunchAnimation, R.string.m_la_t, R.array.m_la_e, 0)); prefs_misc.add(mItemMiscLaunchAnimation = new LLPreferenceList(context, ID_mItemMiscLaunchAnimation, R.string.m_la_t, R.array.m_la_e, 0));
prefs_misc.add(mItemMiscSelectionEffect = new LLPreferenceList(context, ID_mItemMiscSelectionEffect, R.string.m_sel_e_t, R.array.m_sel_e_e, Build.VERSION.SDK_INT >= 21 ? 3 : 2)); prefs_misc.add(mItemMiscSelectionEffect = new LLPreferenceList(context, ID_mItemMiscSelectionEffect, R.string.m_sel_e_t, R.array.m_sel_e_e, 3));
prefs_misc.add(mItemMiscSelectionEffectMask = new LLPreferenceCheckBox(context, ID_mItemMiscSelectionEffectMask, R.string.i_rm_t, R.string.i_rm_s)); prefs_misc.add(mItemMiscSelectionEffectMask = new LLPreferenceCheckBox(context, ID_mItemMiscSelectionEffectMask, R.string.i_rm_t, R.string.i_rm_s));
prefs_misc.add(mItemMiscPinMode = new LLPreferenceList(context, ID_mItemMiscPinMode, R.string.m_pin_mode, R.array.m_pin_mode_e, 0)); prefs_misc.add(mItemMiscPinMode = new LLPreferenceList(context, ID_mItemMiscPinMode, R.string.m_pin_mode, R.array.m_pin_mode_e, 0));
@ -1236,11 +1236,9 @@ public class CustomizeItemView extends MyViewPager implements LLPreferenceListVi
if (mExpertMode) { if (mExpertMode) {
mItemMiscSelectionEffect.setValue(ic.selectionEffect, ic_def == null ? null : ic_def.selectionEffect); mItemMiscSelectionEffect.setValue(ic.selectionEffect, ic_def == null ? null : ic_def.selectionEffect);
mItemMiscSelectionEffect.setVisible(true); mItemMiscSelectionEffect.setVisible(true);
if (Build.VERSION.SDK_INT >= 21) { mItemMiscSelectionEffectMask.setValue(ic.selectionEffectMask, ic_def == null ? null : ic_def.selectionEffectMask);
mItemMiscSelectionEffectMask.setValue(ic.selectionEffectMask, ic_def == null ? null : ic_def.selectionEffectMask); mItemMiscSelectionEffectMask.setDisabled(ic.selectionEffect != ItemConfig.SelectionEffect.MATERIAL);
mItemMiscSelectionEffectMask.setDisabled(ic.selectionEffect != ItemConfig.SelectionEffect.MATERIAL); mItemMiscSelectionEffectMask.setVisible(true);
mItemMiscSelectionEffectMask.setVisible(true);
}
} }
if (mItem != null) { if (mItem != null) {
mItemMiscPinMode.setValue(ic.pinMode, ic_def == null ? null : ic_def.pinMode); mItemMiscPinMode.setValue(ic.pinMode, ic_def == null ? null : ic_def.pinMode);

View file

@ -1,11 +1,11 @@
apply plugin: 'com.android.library' apply plugin: 'com.android.library'
android { android {
compileSdkVersion 28 compileSdk 33
defaultConfig { defaultConfig {
minSdkVersion 14 minSdk 26
targetSdkVersion 28 targetSdk 33
buildConfigField "boolean", "IS_BETA", "false" buildConfigField "boolean", "IS_BETA", "false"
ndk { ndk {

View file

@ -225,9 +225,8 @@ public class SystemBarTintManager {
* *
* @param alpha The alpha to use * @param alpha The alpha to use
*/ */
@TargetApi(11)
public void setStatusBarAlpha(float alpha) { public void setStatusBarAlpha(float alpha) {
if (mStatusBarAvailable && Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { if (mStatusBarAvailable) {
mStatusBarTintView.setAlpha(alpha); mStatusBarTintView.setAlpha(alpha);
} }
} }
@ -272,9 +271,8 @@ public class SystemBarTintManager {
* *
* @param alpha The alpha to use * @param alpha The alpha to use
*/ */
@TargetApi(11)
public void setNavigationBarAlpha(float alpha) { public void setNavigationBarAlpha(float alpha) {
if (mNavBarAvailable && Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { if (mNavBarAvailable) {
mNavBarTintView.setAlpha(alpha); mNavBarTintView.setAlpha(alpha);
} }
} }
@ -369,7 +367,6 @@ public class SystemBarTintManager {
private static int sSafeInsetWidth = 0; private static int sSafeInsetWidth = 0;
private static int sSafeInsetHeight = 0; private static int sSafeInsetHeight = 0;
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
private SystemBarConfig(Window window) { private SystemBarConfig(Window window) {
Resources res = window.getContext().getResources(); Resources res = window.getContext().getResources();
@ -377,11 +374,9 @@ public class SystemBarTintManager {
mStatusBarHeight = getInternalDimensionSize(res, STATUS_BAR_HEIGHT_RES_NAME); mStatusBarHeight = getInternalDimensionSize(res, STATUS_BAR_HEIGHT_RES_NAME);
int result = 0; int result = 0;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { TypedValue tv = new TypedValue();
TypedValue tv = new TypedValue(); window.getContext().getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true);
window.getContext().getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true); result = TypedValue.complexToDimensionPixelSize(tv.data, res.getDisplayMetrics());
result = TypedValue.complexToDimensionPixelSize(tv.data, res.getDisplayMetrics());
}
mActionBarHeight = result; mActionBarHeight = result;
// mNavigationBarWidth = getNavigationBarWidth(activity); // mNavigationBarWidth = getNavigationBarWidth(activity);

View file

@ -37,12 +37,10 @@ public abstract class ResourceWrapperActivity extends Activity {
return super.getResources(); return super.getResources();
} }
@TargetApi(Build.VERSION_CODES.M)
public boolean checkPermissions(String[] permissions, int[] rationales, final int requestCode) { public boolean checkPermissions(String[] permissions, int[] rationales, final int requestCode) {
if(Build.VERSION.SDK_INT >= 23) { final ArrayList<String> permissionsToRequest = new ArrayList<>();
final ArrayList<String> permissionsToRequest = new ArrayList<>(); final ArrayList<String> permissionsToExplain = new ArrayList<>();
final ArrayList<String> permissionsToExplain = new ArrayList<>(); for (String p : permissions) {
for (String p : permissions) {
if(checkSelfPermission(p) == PackageManager.PERMISSION_DENIED) { if(checkSelfPermission(p) == PackageManager.PERMISSION_DENIED) {
if(shouldShowRequestPermissionRationale(p)) { if(shouldShowRequestPermissionRationale(p)) {
permissionsToExplain.add(p); permissionsToExplain.add(p);
@ -52,7 +50,7 @@ public abstract class ResourceWrapperActivity extends Activity {
} }
} }
if(permissionsToExplain.size() == 0) { if (permissionsToExplain.size() == 0) {
if(permissionsToRequest.size() > 0) { if(permissionsToRequest.size() > 0) {
requestPermissions(listToArray(permissionsToRequest), requestCode); requestPermissions(listToArray(permissionsToRequest), requestCode);
return false; return false;
@ -96,9 +94,6 @@ public abstract class ResourceWrapperActivity extends Activity {
builder.create().show(); builder.create().show();
return false; return false;
} }
} else {
return true;
}
} }
protected boolean areAllPermissionsGranted(int[] grantResults, int errorToast) { protected boolean areAllPermissionsGranted(int[] grantResults, int errorToast) {

View file

@ -44,7 +44,7 @@ public class ItemConfig extends JsonLoader {
public PinMode pinMode=PinMode.NONE; public PinMode pinMode=PinMode.NONE;
public int alpha=255; public int alpha=255;
public boolean enabled=true; public boolean enabled=true;
public SelectionEffect selectionEffect = Build.VERSION.SDK_INT >=21 ? SelectionEffect.MATERIAL : SelectionEffect.HOLO; public SelectionEffect selectionEffect = SelectionEffect.MATERIAL;
public boolean selectionEffectMask = true; public boolean selectionEffectMask = true;
public boolean rotate=false; public boolean rotate=false;
public boolean hardwareAccelerated=true; public boolean hardwareAccelerated=true;

View file

@ -267,16 +267,14 @@ public class Utils {
public static Bitmap decodeScaledBitmapResource(Resources rsrc, int id, int max_size) { public static Bitmap decodeScaledBitmapResource(Resources rsrc, int id, int max_size) {
try { try {
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { Drawable drawable = decodeDrawableResource(rsrc, id);
Drawable drawable = decodeDrawableResource(rsrc, id); if (drawable instanceof AdaptiveIconDrawable) {
if(drawable instanceof AdaptiveIconDrawable) { Bitmap bitmap = Bitmap.createBitmap(max_size, max_size, Bitmap.Config.ARGB_8888);
Bitmap bitmap = Bitmap.createBitmap(max_size, max_size, Bitmap.Config.ARGB_8888); drawable.setBounds(0, 0, max_size, max_size);
drawable.setBounds(0, 0, max_size, max_size); drawable.draw(new Canvas(bitmap));
drawable.draw(new Canvas(bitmap)); return bitmap;
return bitmap;
}
} }
if(sGetDrawableForDensity!=null) { if (sGetDrawableForDensity != null) {
try { try {
BitmapDrawable d=(BitmapDrawable) sGetDrawableForDensity.invoke(rsrc, id, sLauncherIconDensity); BitmapDrawable d=(BitmapDrawable) sGetDrawableForDensity.invoke(rsrc, id, sLauncherIconDensity);
return createStandardSizedIcon(d.getBitmap(), max_size); return createStandardSizedIcon(d.getBitmap(), max_size);
@ -836,18 +834,14 @@ public class Utils {
} }
o = new BitmapFactory.Options(); o = new BitmapFactory.Options();
o.inSampleSize = sample_size; o.inSampleSize = sample_size;
if(Build.VERSION.SDK_INT>=11) { o.inMutable = true;
o.inMutable = true;
}
Bitmap bitmap = BitmapFactory.decodeFile(path, o); Bitmap bitmap = BitmapFactory.decodeFile(path, o);
if(bitmap != null) { if(bitmap != null) {
if(sample_size > 1 && NinePatch.isNinePatchChunk(bitmap.getNinePatchChunk())) { if(sample_size > 1 && NinePatch.isNinePatchChunk(bitmap.getNinePatchChunk())) {
// too bad, this is a nine patch, need to decode it again with its full size // too bad, this is a nine patch, need to decode it again with its full size
bitmap.recycle(); bitmap.recycle();
o = new BitmapFactory.Options(); o = new BitmapFactory.Options();
if(Build.VERSION.SDK_INT>=11) { o.inMutable = true;
o.inMutable = true;
}
bitmap = BitmapFactory.decodeFile(path, o); bitmap = BitmapFactory.decodeFile(path, o);
if(bitmap == null) { if(bitmap == null) {
return null; return null;
@ -2469,7 +2463,7 @@ public class Utils {
// failsafe // failsafe
return true; return true;
} }
if(mode == LAYOUT_MODE_RECENT_APPS && Build.VERSION.SDK_INT>=21) { if (mode == LAYOUT_MODE_RECENT_APPS) {
return false; return false;
} }

View file

@ -626,35 +626,29 @@ public class LightningEngine implements Page.PageListener {
} }
private void loadAppShortcuts() { private void loadAppShortcuts() {
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) { File appShortcutsFile = FileUtils.getPinnedAppShortcutsFile(mBaseDir);
File appShortcutsFile = FileUtils.getPinnedAppShortcutsFile(mBaseDir); mAppShortcuts = FileUtils.readJSONObjectFromFile(appShortcutsFile);
mAppShortcuts = FileUtils.readJSONObjectFromFile(appShortcutsFile); if (mAppShortcuts == null) {
if (mAppShortcuts == null) { mAppShortcuts = new JSONObject();
mAppShortcuts = new JSONObject();
}
} }
} }
private void saveAppShortcuts() { private void saveAppShortcuts() {
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) { try {
try { File out = FileUtils.getPinnedAppShortcutsFile(mBaseDir);
File out = FileUtils.getPinnedAppShortcutsFile(mBaseDir); FileUtils.saveStringToFile(mAppShortcuts.toString(), out);
FileUtils.saveStringToFile(mAppShortcuts.toString(), out); } catch (Exception e) {
} catch (Exception e) { // pass
// pass
}
} }
} }
/** Return null if this isn't a Android 7.1 app shortcut */ /** Return null if this isn't a Android 7.1 app shortcut */
private Intent getAppShortcutIntent(Item item) { private Intent getAppShortcutIntent(Item item) {
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) { if (item.getClass() == Shortcut.class) {
if (item.getClass() == Shortcut.class) { Shortcut shortcut = (Shortcut) item;
Shortcut shortcut = (Shortcut) item; Intent intent = shortcut.getIntent();
Intent intent = shortcut.getIntent(); if (intent != null && Shortcut.INTENT_ACTION_APP_SHORTCUT.equals(intent.getAction())) {
if (intent != null && Shortcut.INTENT_ACTION_APP_SHORTCUT.equals(intent.getAction())) { return intent;
return intent;
}
} }
} }

View file

@ -59,13 +59,13 @@ import net.pierrox.lightning_launcher.data.StopPoint;
import net.pierrox.lightning_launcher.data.Unlocker; import net.pierrox.lightning_launcher.data.Unlocker;
import net.pierrox.lightning_launcher.data.Utils; import net.pierrox.lightning_launcher.data.Utils;
import net.pierrox.lightning_launcher.data.Widget; import net.pierrox.lightning_launcher.data.Widget;
import net.pierrox.lightning_launcher.engine.variable.Variable;
import net.pierrox.lightning_launcher.engine.variable.VariableManager;
import net.pierrox.lightning_launcher.script.Script; import net.pierrox.lightning_launcher.script.Script;
import net.pierrox.lightning_launcher.script.ScriptExecutor; import net.pierrox.lightning_launcher.script.ScriptExecutor;
import net.pierrox.lightning_launcher.script.ScriptManager; import net.pierrox.lightning_launcher.script.ScriptManager;
import net.pierrox.lightning_launcher.script.api.Container; import net.pierrox.lightning_launcher.script.api.Container;
import net.pierrox.lightning_launcher.script.api.ImageBitmap; import net.pierrox.lightning_launcher.script.api.ImageBitmap;
import net.pierrox.lightning_launcher.engine.variable.Variable;
import net.pierrox.lightning_launcher.engine.variable.VariableManager;
import net.pierrox.lightning_launcher.script.api.Lightning; import net.pierrox.lightning_launcher.script.api.Lightning;
import net.pierrox.lightning_launcher.views.FolderView; import net.pierrox.lightning_launcher.views.FolderView;
import net.pierrox.lightning_launcher.views.HandleView; import net.pierrox.lightning_launcher.views.HandleView;
@ -315,9 +315,7 @@ public abstract class Screen implements ItemLayout.ItemLayoutListener, ItemView.
public void setWindow(Window window) { public void setWindow(Window window) {
mWindow = window; mWindow = window;
if(Build.VERSION.SDK_INT>=19) { mSystemBarTintManager = new SystemBarTintManager(mWindow);
mSystemBarTintManager = new SystemBarTintManager(mWindow);
}
} }
public void setVisibility(boolean visible) { public void setVisibility(boolean visible) {
@ -963,7 +961,7 @@ public abstract class Screen implements ItemLayout.ItemLayoutListener, ItemView.
opener.getViewHeight() - s[Box.MT] - s[Box.BT] - s[Box.PT] - s[Box.MB] - s[Box.BB] - s[Box.PB] opener.getViewHeight() - s[Box.MT] - s[Box.BT] - s[Box.PT] - s[Box.MB] - s[Box.BB] - s[Box.PB]
); );
Rect r = computeItemViewBounds(openerView); Rect r = computeItemViewBounds(openerView);
if (!getCurrentRootPage().config.statusBarHide && Build.VERSION.SDK_INT >= 11) { if (!getCurrentRootPage().config.statusBarHide) {
// hackish and duplicate with Dashboard.leaveEditMode // hackish and duplicate with Dashboard.leaveEditMode
Resources res = mContext.getResources(); Resources res = mContext.getResources();
int statusBarHeight = 0; int statusBarHeight = 0;
@ -1038,7 +1036,7 @@ public abstract class Screen implements ItemLayout.ItemLayoutListener, ItemView.
if(t != null) t.mapRect(bounds); if(t != null) t.mapRect(bounds);
traverseViews((View)il.getParent(), bounds); traverseViews((View)il.getParent(), bounds);
if(il.getEditMode() && Build.VERSION.SDK_INT>=11) { if (il.getEditMode()) {
// pivot is always 0x0 // pivot is always 0x0
float sx = mDesktopView.getScaleX(); float sx = mDesktopView.getScaleX();
float sy = mDesktopView.getScaleY(); float sy = mDesktopView.getScaleY();
@ -1088,7 +1086,7 @@ public abstract class Screen implements ItemLayout.ItemLayoutListener, ItemView.
il.getTransformForRect(r).mapRect(r); il.getTransformForRect(r).mapRect(r);
traverseViews((View)(il.getParent()), r); traverseViews((View)(il.getParent()), r);
float[] coords = new float[] {r.left, r.top}; float[] coords = new float[] {r.left, r.top};
if(il.getEditMode() && Build.VERSION.SDK_INT>=11) { if (il.getEditMode()) {
// pivot is always 0x0 // pivot is always 0x0
coords[0] *= mDesktopView.getScaleX(); coords[0] *= mDesktopView.getScaleX();
coords[1] *= mDesktopView.getScaleY(); coords[1] *= mDesktopView.getScaleY();
@ -1606,7 +1604,7 @@ public abstract class Screen implements ItemLayout.ItemLayoutListener, ItemView.
//noinspection ResourceType //noinspection ResourceType
service = mContext.getSystemService("statusbar"); service = mContext.getSystemService("statusbar");
statusbarManager = Class.forName("android.app.StatusBarManager"); statusbarManager = Class.forName("android.app.StatusBarManager");
Method expand = statusbarManager.getMethod(Build.VERSION.SDK_INT>=17 ? "expandNotificationsPanel" : "expand"); Method expand = statusbarManager.getMethod("expandNotificationsPanel");
expand.invoke(service); expand.invoke(service);
} catch(Exception e1) { } catch(Exception e1) {
} }
@ -1712,7 +1710,7 @@ public abstract class Screen implements ItemLayout.ItemLayoutListener, ItemView.
} }
try { try {
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1 && Shortcut.INTENT_ACTION_APP_SHORTCUT.equals(intent.getAction())) { if (Shortcut.INTENT_ACTION_APP_SHORTCUT.equals(intent.getAction())) {
LauncherApps launcherApps = (LauncherApps) mContext.getSystemService(Context.LAUNCHER_APPS_SERVICE); LauncherApps launcherApps = (LauncherApps) mContext.getSystemService(Context.LAUNCHER_APPS_SERVICE);
String id = intent.getStringExtra(Shortcut.INTENT_EXTRA_APP_SHORTCUT_ID); String id = intent.getStringExtra(Shortcut.INTENT_EXTRA_APP_SHORTCUT_ID);
String pkg = intent.getStringExtra(Shortcut.INTENT_EXTRA_APP_SHORTCUT_PKG); String pkg = intent.getStringExtra(Shortcut.INTENT_EXTRA_APP_SHORTCUT_PKG);
@ -2121,11 +2119,7 @@ public abstract class Screen implements ItemLayout.ItemLayoutListener, ItemView.
if(mWindow != null && (mCustomScreenWidth == 0 || mCustomScreenHeight == 0)) { if(mWindow != null && (mCustomScreenWidth == 0 || mCustomScreenHeight == 0)) {
DisplayMetrics dm = new DisplayMetrics(); DisplayMetrics dm = new DisplayMetrics();
Display display = mWindow.getWindowManager().getDefaultDisplay(); Display display = mWindow.getWindowManager().getDefaultDisplay();
if (Build.VERSION.SDK_INT >= 17) { display.getRealMetrics(dm);
display.getRealMetrics(dm);
} else {
display.getMetrics(dm);
}
out[0] = dm.widthPixels; out[0] = dm.widthPixels;
out[1] = dm.heightPixels; out[1] = dm.heightPixels;
} else { } else {

View file

@ -61,7 +61,9 @@ public class WindowService extends Service implements LightningEngine.GlobalConf
private static final int OPEN_CLOSE_ANIMATION_DURATION = 300; private static final int OPEN_CLOSE_ANIMATION_DURATION = 300;
private static final String NOTIFICATION_CHANNEL_ID = "LL_SERVICES"; private static final String NOTIFICATION_CHANNEL_ID = "LL_SERVICES";
private static final int NOTIFICATION_ID = 0;
// Notification ID cannot be 0
private static final int NOTIFICATION_ID = 102;
private WindowScreen mScreen; private WindowScreen mScreen;
@ -94,7 +96,7 @@ public class WindowService extends Service implements LightningEngine.GlobalConf
private boolean mIsShown; private boolean mIsShown;
public static boolean isPermissionAllowed(Context context) { public static boolean isPermissionAllowed(Context context) {
return Build.VERSION.SDK_INT<23 || Settings.canDrawOverlays(context); return Settings.canDrawOverlays(context);
} }
@Override @Override
@ -173,10 +175,8 @@ public class WindowService extends Service implements LightningEngine.GlobalConf
mItemLayout=(ItemLayout) mWorkspaceView.findViewById(R.id.window_il); mItemLayout=(ItemLayout) mWorkspaceView.findViewById(R.id.window_il);
mScreen.takeItemLayoutOwnership(mItemLayout); mScreen.takeItemLayoutOwnership(mItemLayout);
mItemLayout.setHonourFocusChange(false); mItemLayout.setHonourFocusChange(false);
int windowType = Build.VERSION.SDK_INT >= Build.VERSION_CODES.O int windowType = WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY;
? WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY
: WindowManager.LayoutParams.TYPE_SYSTEM_ALERT;
mWindowManager = (WindowManager) getSystemService(WINDOW_SERVICE); mWindowManager = (WindowManager) getSystemService(WINDOW_SERVICE);
WindowManager.LayoutParams lp = new WindowManager.LayoutParams( WindowManager.LayoutParams lp = new WindowManager.LayoutParams(
@ -340,30 +340,23 @@ public class WindowService extends Service implements LightningEngine.GlobalConf
configureDrawer(); configureDrawer();
if (Build.VERSION.SDK_INT >= 26) { CharSequence name = "Lightning Services";
CharSequence name = "Lightning Services"; String description = "Background Launcher activities";
String description = "Background Launcher activities"; int importance = NotificationManager.IMPORTANCE_LOW;
int importance = NotificationManager.IMPORTANCE_LOW; NotificationChannel channel = new NotificationChannel(NOTIFICATION_CHANNEL_ID, name, importance);
NotificationChannel channel = new NotificationChannel(NOTIFICATION_CHANNEL_ID, name, importance); channel.setDescription(description);
channel.setDescription(description); NotificationManager notificationManager = getSystemService(NotificationManager.class);
NotificationManager notificationManager = getSystemService(NotificationManager.class); notificationManager.createNotificationChannel(channel);
notificationManager.createNotificationChannel(channel);
}
Intent notificationIntent = LLApp.get().getWindowServiceIntent(); Intent notificationIntent = LLApp.get().getWindowServiceIntent();
notificationIntent.setAction(WindowService.INTENT_ACTION_SHOW); notificationIntent.setAction(WindowService.INTENT_ACTION_SHOW);
PendingIntent pendingIntent = PendingIntent.getService(this, 0, notificationIntent, 0); PendingIntent pendingIntent = PendingIntent.getService(this, 0, notificationIntent, 0);
Notification.Builder builder; Notification.Builder builder;
if (Build.VERSION.SDK_INT >= 26) { builder = new Notification.Builder(this, NOTIFICATION_CHANNEL_ID);
builder = new Notification.Builder(this, NOTIFICATION_CHANNEL_ID);
} else {
builder = new Notification.Builder(this);
}
builder.setContentTitle(getString(R.string.ov_r)) builder.setContentTitle(getString(R.string.ov_r))
.setContentIntent(pendingIntent) .setContentIntent(pendingIntent)
.setCategory(Notification.CATEGORY_SERVICE) .setCategory(Notification.CATEGORY_SERVICE);
.setPriority(Notification.PRIORITY_LOW);
Notification notification = builder.build(); Notification notification = builder.build();

View file

@ -88,10 +88,8 @@ public class BoxLayout extends ViewGroup implements SharedAsyncGraphicsDrawable.
public BoxLayout(Context context, AttributeSet attrs, boolean hardware_accelerated) { public BoxLayout(Context context, AttributeSet attrs, boolean hardware_accelerated) {
super(context, attrs); super(context, attrs);
if(Build.VERSION.SDK_INT >= 11) { if (hardware_accelerated) {
if(hardware_accelerated) { setLayerType(LAYER_TYPE_HARDWARE, new Paint());
setLayerType(LAYER_TYPE_HARDWARE, new Paint());
}
} }
mDensity = getResources().getDisplayMetrics().density; mDensity = getResources().getDisplayMetrics().density;
@ -108,7 +106,7 @@ public class BoxLayout extends ViewGroup implements SharedAsyncGraphicsDrawable.
@Override @Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) { protected void onSizeChanged(int w, int h, int oldw, int oldh) {
if(Build.VERSION.SDK_INT >= 11 && (w > 2048 || h > 2048)) { if (w > 2048 || h > 2048) {
int layer_type = getLayerType(); int layer_type = getLayerType();
if(layer_type != LAYER_TYPE_NONE) { if(layer_type != LAYER_TYPE_NONE) {
setLayerType(LAYER_TYPE_NONE, null); setLayerType(LAYER_TYPE_NONE, null);
@ -200,16 +198,6 @@ public class BoxLayout extends ViewGroup implements SharedAsyncGraphicsDrawable.
invalidate(); invalidate();
} }
@Override
public void setAlpha(float alpha) {
if(Build.VERSION.SDK_INT < 11) {
mAlpha = (int) (255 * alpha);
invalidate();
} else {
super.setAlpha(alpha);
}
}
@Override @Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
final int size_w=MeasureSpec.getSize(widthMeasureSpec); final int size_w=MeasureSpec.getSize(widthMeasureSpec);
@ -457,21 +445,7 @@ public class BoxLayout extends ViewGroup implements SharedAsyncGraphicsDrawable.
canvas.clipRect(pl, pt, getWidth() - pr, getHeight() - pb); canvas.clipRect(pl, pt, getWidth() - pr, getHeight() - pb);
canvas.translate(mChildLeft, mChildTop); canvas.translate(mChildLeft, mChildTop);
if (Build.VERSION.SDK_INT < 11) { mChildView.draw(canvas);
if (mChildView.isDrawingCacheEnabled()) {
try {
Bitmap cache = mChildView.getDrawingCache();
canvas.drawBitmap(cache, 0, 0, null);
} catch (Exception e) {
// this will happen if something failed with the cache creation (bitmap too large, other ?)
mChildView.draw(canvas);
}
} else {
mChildView.draw(canvas);
}
} else {
mChildView.draw(canvas);
}
canvas.translate(-mChildLeft, -mChildTop); canvas.translate(-mChildLeft, -mChildTop);
canvas.restore(); canvas.restore();
} }
@ -492,10 +466,6 @@ public class BoxLayout extends ViewGroup implements SharedAsyncGraphicsDrawable.
sBorderPaint.setColor(mCurrentBorderBottomColor); sBorderPaint.setColor(mCurrentBorderBottomColor);
canvas.drawPath(mBorderBottomPath, sBorderPaint); canvas.drawPath(mBorderBottomPath, sBorderPaint);
} }
if(mAlpha!=255 && Build.VERSION.SDK_INT < 11) {
canvas.restore();
}
} }
@Override @Override

View file

@ -13,9 +13,6 @@ public class IconView extends View implements SharedAsyncGraphicsDrawable.Shared
private IconView(Context context) { private IconView(Context context) {
super(context); super(context);
if( Build.VERSION.SDK_INT < 11) {
setDrawingCacheEnabled(true);
}
} }
public IconView(Context context, Bitmap bitmap, boolean filter) { public IconView(Context context, Bitmap bitmap, boolean filter) {

View file

@ -2250,11 +2250,6 @@ public class ItemLayout extends ViewGroup {
continue; continue;
} }
// on API >= 11 views with alpha 0 need to be drawn so that View private flags are correctly handled
if(Build.VERSION.SDK_INT < 11 && item.getAlpha() == 0) {
continue;
}
Matrix transform = getTransformForItemView(itemView); Matrix transform = getTransformForItemView(itemView);
itemView.getHitRect(mTempRect); itemView.getHitRect(mTempRect);

View file

@ -27,12 +27,10 @@ public class NativeImage {
public static void init(Context context) { public static void init(Context context) {
sAvailable = false; sAvailable = false;
try { try {
if(android.os.Build.VERSION.SDK_INT>=9) { System.loadLibrary("ll");
System.loadLibrary("ll"); nativeInit();
nativeInit(); sAvailable = true;
sAvailable = true; } catch (Throwable e1) {
}
} catch (Throwable e1) {
sAvailable = false; sAvailable = false;
} }
} }

View file

@ -402,9 +402,7 @@ public class SharedAsyncGraphicsDrawable extends Drawable implements Drawable.Ca
byte[] chunk = bitmap.getNinePatchChunk(); byte[] chunk = bitmap.getNinePatchChunk();
if(NinePatch.isNinePatchChunk(chunk)) { if(NinePatch.isNinePatchChunk(chunk)) {
mType = TYPE_NINE_PATCH; mType = TYPE_NINE_PATCH;
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { bitmap.setDensity(DisplayMetrics.DENSITY_DEFAULT);
bitmap.setDensity(DisplayMetrics.DENSITY_DEFAULT);
}
NinePatch np = new NinePatch(bitmap, chunk, null); NinePatch np = new NinePatch(bitmap, chunk, null);
mIntrinsicWidth = np.getWidth(); mIntrinsicWidth = np.getWidth();
mIntrinsicHeight = np.getHeight(); mIntrinsicHeight = np.getHeight();

View file

@ -9,36 +9,8 @@ import android.view.WindowManager;
public class SystemUIHelper { public class SystemUIHelper {
public static void setStatusBarVisibility(Window w, boolean visible, boolean overlap) { public static void setStatusBarVisibility(Window w, boolean visible, boolean overlap) {
if (Build.VERSION.SDK_INT >= 16) { View decorView = w.getDecorView();
View decorView = w.getDecorView(); decorView.setSystemUiVisibility(visible ? 0 : View.SYSTEM_UI_FLAG_FULLSCREEN);
decorView.setSystemUiVisibility(visible ? 0 : View.SYSTEM_UI_FLAG_FULLSCREEN);
if(Build.VERSION.SDK_INT < 19) {
if(!visible || overlap) {
w.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN, WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN);
w.clearFlags(WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR);
} else {
w.clearFlags(WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN);
}
}
} else {
if(visible) {
w.clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN | WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR);
} else {
w.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
if(visible) {
if(overlap) {
w.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN, WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN);
} else {
w.clearFlags(WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN);
}
w.clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
} else {
w.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
w.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN, WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN);
}
}
} }
} }

View file

@ -114,24 +114,14 @@ public class TransformLayout extends TouchEventInterceptor {
@Override @Override
public void dispatchDraw(Canvas canvas) { public void dispatchDraw(Canvas canvas) {
if(mLocalTransform==null) { if(mLocalTransform==null) {
if(Build.VERSION.SDK_INT < 11) { super.dispatchDraw(canvas);
if(mChildView != null) {
mChildView.draw(canvas);
}
} else {
super.dispatchDraw(canvas);
}
} else { } else {
if(mFilterChildView) canvas.setDrawFilter(sPaintFlagDrawFilter); if(mFilterChildView) canvas.setDrawFilter(sPaintFlagDrawFilter);
canvas.save(); canvas.save();
canvas.concat(mLocalTransform); canvas.concat(mLocalTransform);
// canvas.clipRect(0, 0, mChildView.getWidth(), mChildView.getHeight()); // canvas.clipRect(0, 0, mChildView.getWidth(), mChildView.getHeight());
if(Build.VERSION.SDK_INT < 11) { super.dispatchDraw(canvas);
mChildView.draw(canvas);
} else {
super.dispatchDraw(canvas);
}
canvas.restore(); canvas.restore();
if(mFilterChildView) canvas.setDrawFilter(null); if(mFilterChildView) canvas.setDrawFilter(null);
@ -175,25 +165,6 @@ public class TransformLayout extends TouchEventInterceptor {
} }
} }
@Override
public ViewParent invalidateChildInParent(final int[] location, final Rect dirty) {
if(Build.VERSION.SDK_INT < 11) {
if (mTransform == null || mLocalTransform == null) {
return super.invalidateChildInParent(location, dirty);
} else {
location[0] = getLeft();
location[1] = getTop();
mTempRectF.set(dirty);
mLocalTransform.mapRect(mTempRectF);
mTempRectF.roundOut(dirty);
return getParent();
}
} else {
return super.invalidateChildInParent(location, dirty);
}
}
public Rect getTransformBoundingBox() { public Rect getTransformBoundingBox() {
return mTransformBoundingBox; return mTransformBoundingBox;
} }

View file

@ -173,7 +173,7 @@ public abstract class ItemView extends TransformLayout implements TouchEventInte
mAlpha = mItem.getAlpha(); mAlpha = mItem.getAlpha();
updateViewAlpha(); updateViewAlpha();
if(Build.VERSION.SDK_INT >= 21 && ic.selectionEffect == ItemConfig.SelectionEffect.MATERIAL) { if (ic.selectionEffect == ItemConfig.SelectionEffect.MATERIAL) {
ColorStateList colors = new ColorStateList(RIPPLE_STATES_LIST, new int[]{ic.box.ccs}); ColorStateList colors = new ColorStateList(RIPPLE_STATES_LIST, new int[]{ic.box.ccs});
RippleDrawable background = new RippleDrawable(colors, null, ic.selectionEffectMask ? new ColorDrawable(-1) : null); RippleDrawable background = new RippleDrawable(colors, null, ic.selectionEffectMask ? new ColorDrawable(-1) : null);
setBackgroundDrawable(background); setBackgroundDrawable(background);

View file

@ -1,12 +1,12 @@
apply plugin: 'com.android.library' apply plugin: 'com.android.library'
android { android {
compileSdkVersion 26 compileSdk 33
defaultConfig { defaultConfig {
minSdkVersion 8 minSdk 26
targetSdkVersion 26 targetSdk 33
} }
namespace 'net.pierrox.lightning_launcher.plugin' namespace 'net.pierrox.lightning_launcher.plugin'