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 {
compileSdkVersion 28
compileSdk 33
defaultConfig {
versionCode 330
@ -50,8 +50,8 @@ android {
buildConfigField "boolean", "IS_BETA", "false" // change in core too
buildConfigField "boolean", "HAS_UEC", "false"
minSdkVersion 14
targetSdkVersion 28
minSdk 26
targetSdk 33
}
// dexOptions {

View file

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

View file

@ -2,6 +2,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
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.SET_WALLPAPER"/>
<uses-permission android:name="android.permission.SET_WALLPAPER_HINTS"/>
@ -48,6 +49,7 @@
android:label="@string/app_name">
<activity
android:exported="true"
android:name="net.pierrox.lightning_launcher.activities.Dashboard"
android:label="@string/app_name"
android:launchMode="singleTask"
@ -85,7 +87,8 @@
android:theme="@style/AppLightNoActionBarWallpaper"
android:excludeFromRecents="true"
android:windowSoftInputMode="adjustNothing"
android:configChanges="keyboardHidden|orientation|screenSize|mcc|mnc">
android:configChanges="keyboardHidden|orientation|screenSize|mcc|mnc"
android:exported="true">
<intent-filter>
<action android:name="net.pierrox.lightning_launcher.ALL_APPS" />
@ -121,7 +124,8 @@
<activity
android:name="net.pierrox.lightning_launcher.activities.BackupRestore"
android:excludeFromRecents="true"
android:configChanges="keyboardHidden|orientation|screenSize">
android:configChanges="keyboardHidden|orientation|screenSize"
android:exported="true">
<!--requires com.google.android.gm.permission.READ_GMAIL-->
<!--<intent-filter>-->
@ -181,7 +185,8 @@
android:configChanges="keyboardHidden|orientation|screenSize"
android:screenOrientation="user"
android:finishOnCloseSystemDialogs="true"
android:windowSoftInputMode="adjustResize|stateHidden">
android:windowSoftInputMode="adjustResize|stateHidden"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
@ -195,7 +200,8 @@
android:configChanges="keyboardHidden|orientation|screenSize"/>
<activity android:name="net.pierrox.lightning_launcher.activities.Shortcuts"
android:label="@string/shortcut_settings">
android:label="@string/shortcut_settings"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.CREATE_SHORTCUT" />
<category android:name="android.intent.category.DEFAULT" />
@ -211,6 +217,7 @@
android:configChanges="keyboardHidden|orientation|screenSize"/>
<activity-alias
android:exported="true"
android:name="net.pierrox.lightning_launcher.activities.ShortcutsA"
android:targetActivity="net.pierrox.lightning_launcher.activities.EventActionSetup"
android:label="@string/shortcut_actions">
@ -221,6 +228,7 @@
</activity-alias>
<activity-alias
android:exported="true"
android:name="net.pierrox.lightning_launcher.activities.ShortcutsT"
android:targetActivity="net.pierrox.lightning_launcher.activities.EventActionSetup"
android:label="@string/shortcut_actions">
@ -230,6 +238,7 @@
</activity-alias>
<activity-alias
android:exported="true"
android:name="net.pierrox.lightning_launcher.activities.ShortcutsTS"
android:targetActivity="net.pierrox.lightning_launcher.activities.Shortcuts"
android:label="@string/tss">
@ -239,6 +248,7 @@
</activity-alias>
<activity-alias
android:exported="true"
android:name="net.pierrox.lightning_launcher.activities.ShortcutsTV"
android:targetActivity="net.pierrox.lightning_launcher.activities.Shortcuts"
android:label="@string/tsv">
@ -248,6 +258,7 @@
</activity-alias>
<activity-alias
android:exported="true"
android:name="net.pierrox.lightning_launcher.activities.ShortcutsS"
android:targetActivity="net.pierrox.lightning_launcher.activities.ScreenManager"
android:label="@string/shortcut_screen">
@ -258,6 +269,7 @@
</activity-alias>
<activity
android:exported="true"
android:name="net.pierrox.lightning_launcher.activities.ApplyTemplate"
android:excludeFromRecents="true"
android:configChanges="keyboardHidden|orientation|screenSize">
@ -289,7 +301,9 @@
android:theme="@style/AppDialog">
</activity>
<receiver android:name="net.pierrox.lightning_launcher.util.MPReceiver">
<receiver
android:exported="true"
android:name="net.pierrox.lightning_launcher.util.MPReceiver">
<intent-filter>
<action android:name="android.intent.action.PACKAGE_REMOVED" />
<action android:name="android.intent.action.PACKAGE_REPLACED"/>
@ -299,6 +313,7 @@
</receiver>
<receiver
android:exported="true"
android:name="net.pierrox.lightning_launcher.util.ShortcutReceiver"
android:permission="com.android.launcher.permission.INSTALL_SHORTCUT">
<intent-filter>
@ -316,6 +331,7 @@
<!-- Home reset -->
<activity
android:exported="true"
android:name="net.pierrox.lightning_launcher.activities.dummy.D1"
android:enabled="false">
<intent-filter>
@ -327,6 +343,7 @@
<!-- Default language pack -->
<activity
android:exported="false"
android:name="net.pierrox.lightning_launcher.activities.dummy.D2"
android:label="@string/default_pack_name"
android:excludeFromRecents="true"
@ -338,6 +355,7 @@
<!-- Browse script APKS-->
<activity
android:exported="false"
android:name="net.pierrox.lightning_launcher.activities.dummy.D3"
android:label="@string/ls_b"
android:excludeFromRecents="true"
@ -349,6 +367,7 @@
<!-- No icon pack-->
<activity
android:exported="false"
android:name="net.pierrox.lightning_launcher.activities.dummy.D4"
android:label="@string/nip"
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() {
if (isPreKitKatDevice())
return;
assertMainThread();
mActivity.getWindow().getDecorView().getWindowId().registerFocusObserver(mFocusObserver);
internalBind();
@ -97,9 +87,6 @@ public class HotwordServiceClient {
@SuppressLint("MissingSuperCall")
public final void onDetachedFromWindow() {
if (isPreKitKatDevice())
return;
if (!mIsBound) {
return;
}
@ -111,9 +98,6 @@ public class HotwordServiceClient {
}
public final void requestHotwordDetection(boolean detect) {
if (isPreKitKatDevice())
return;
assertMainThread();
mIsRequested = detect;
internalRequestHotword();

View file

@ -58,17 +58,15 @@ public abstract class LLAppPhone extends LLApp {
// 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
// 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();
intent_filter.addAction(Intent.ACTION_PACKAGE_REMOVED);
intent_filter.addAction(Intent.ACTION_PACKAGE_REPLACED);
intent_filter.addAction(Intent.ACTION_PACKAGE_ADDED);
intent_filter.addDataScheme("package");
IntentFilter intent_filter = new IntentFilter();
intent_filter.addAction(Intent.ACTION_PACKAGE_REMOVED);
intent_filter.addAction(Intent.ACTION_PACKAGE_REPLACED);
intent_filter.addAction(Intent.ACTION_PACKAGE_ADDED);
intent_filter.addDataScheme("package");
registerReceiver(mMPReceiver, intent_filter);
}
registerReceiver(mMPReceiver, intent_filter);
}
@Override

View file

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

View file

@ -219,9 +219,7 @@ public class Customize extends ResourceWrapperActivity implements
super.onCreate(savedInstanceState);
if(Build.VERSION.SDK_INT>=19) {
mSystemBarTintManager = new SystemBarTintManager(getWindow());
}
mSystemBarTintManager = new SystemBarTintManager(getWindow());
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(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));
if(android.os.Build.VERSION.SDK_INT>=9) {
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(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_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(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(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(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) {
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) {
}
}
mPreferencesPageSystemBars.add(mPGSystemBarsStatusBarColor = new LLPreferenceColor(this, ID_mPGSystemBarsStatusBarColor, R.string.sbc_t, 0, pc.statusBarColor, null, true));
if (has_transparent_status_bar) {
mPreferencesPageSystemBars.add(mPGSystemBarsTransparentStatusBar = new LLPreferenceCheckBox(this, ID_mPGSystemBarsTransparentStatusBar, R.string.trans_statusbar_t, R.string.trans_statusbar_s, pc.statusBarColor == 0, null));
}
}
mPreferencesPageSystemBars.add(mPGSystemBarsStatusBarLight = new LLPreferenceCheckBox(this, ID_mPGSystemBarsStatusBarLight, R.string.sbl_t, 0, pc.statusBarLight, 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));
if (mSystemBarTintManager == null || (mSystemBarTintManager != null && mSystemBarTintManager.getConfig().hasNavigationBar())) {
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));
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));
}
}
if (is_app_drawer) {
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(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));
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(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(mGCLanguageCategory = new LLPreference(
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,
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));
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(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));
}
if(Build.VERSION.SDK_INT>=14) {
mPreferencesGlobalConfig.add(mGCOverlayCategory = new LLPreference(this, ID_mGCOverlayCategory, R.string.ov_t, R.string.ov_s));
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));
}
mPreferencesGlobalConfig.add(mGCLockScreenCategory = new LLPreference(this, ID_mGCLockScreenCategory, R.string.s_ls_t, R.string.s_ls_s));
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(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));
mPreferencesGlobalConfig.add(mGCOverlayCategory = new LLPreference(this, ID_mGCOverlayCategory, R.string.ov_t, R.string.ov_s));
mPreferencesGlobalConfigOverlay = new ArrayList<LLPreference>(3);
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(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));
@ -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(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));
if(Build.VERSION.SDK_INT >= 23) {
boolean disabled = !WindowService.isPermissionAllowed(this);
boolean disabled = !WindowService.isPermissionAllowed(this);
for (LLPreference p : mPreferencesGlobalConfigOverlay) {
if(p != mGCOverlayPermission) {
p.setDisabled(disabled);
}
}
}
}
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) {
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));
@ -1565,16 +1526,16 @@ public class Customize extends ResourceWrapperActivity implements
mGlobalConfig.launchUnlock = mGCLockScreenLaunchUnlock.isChecked();
mGlobalConfig.lockDisableOverlay = mGCLockScreenDisableOverlay.isChecked();
if(Build.VERSION.SDK_INT>=14) {
mGlobalConfig.overlayLaunchHide = mGCOverlayLaunchHide.isChecked();
mGlobalConfig.overlayDisplayHandles = mGCOverlayDisplayHandles.isChecked();
mGlobalConfig.overlayShowHandlePosition = (GlobalConfig.OverlayHandlePosition) mGCOverlayShowHandlePosition.getValueEnum();
mGlobalConfig.overlayShowHandleSize = mGCOverlayShowHandleSize.getValue();
mGlobalConfig.overlayShowHandleWidth = mGCOverlayShowHandleWidth.getValue();
mGlobalConfig.overlayHideHandlePosition = (GlobalConfig.OverlayHandlePosition) mGCOverlayHideHandlePosition.getValueEnum();
mGlobalConfig.overlayHideHandleSize = mGCOverlayHideHandleSize.getValue();
mGlobalConfig.overlayHideHandleWidth = mGCOverlayHideHandleWidth.getValue();
}
mGlobalConfig.overlayLaunchHide = mGCOverlayLaunchHide.isChecked();
mGlobalConfig.overlayDisplayHandles = mGCOverlayDisplayHandles.isChecked();
mGlobalConfig.overlayShowHandlePosition = (GlobalConfig.OverlayHandlePosition) mGCOverlayShowHandlePosition.getValueEnum();
mGlobalConfig.overlayShowHandleSize = mGCOverlayShowHandleSize.getValue();
mGlobalConfig.overlayShowHandleWidth = mGCOverlayShowHandleWidth.getValue();
mGlobalConfig.overlayHideHandlePosition = (GlobalConfig.OverlayHandlePosition) mGCOverlayHideHandlePosition.getValueEnum();
mGlobalConfig.overlayHideHandleSize = mGCOverlayHideHandleSize.getValue();
mGlobalConfig.overlayHideHandleWidth = mGCOverlayHideHandleWidth.getValue();
mGlobalConfig.homeKey = mGCEventHomeKey.getValue();
mGlobalConfig.menuKey = mGCEventMenuKey.getValue();

View file

@ -800,7 +800,7 @@ public class Dashboard extends ResourceWrapperActivity implements OnLongClickLis
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);
}
@ -839,7 +839,7 @@ public class Dashboard extends ResourceWrapperActivity implements OnLongClickLis
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);
}
@ -915,7 +915,7 @@ public class Dashboard extends ResourceWrapperActivity implements OnLongClickLis
public void onAttachedToWindow() {
super.onAttachedToWindow();
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT && getClass() == Dashboard.class) {
if (getClass() == Dashboard.class) {
if(mSystemConfig.hotwords) {
if (mHotwordServiceClient == null) {
mHotwordServiceClient = new HotwordServiceClient(this);
@ -930,7 +930,7 @@ public class Dashboard extends ResourceWrapperActivity implements OnLongClickLis
public void onDetachedFromWindow() {
super.onDetachedFromWindow();
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT && getClass() == Dashboard.class) {
if (getClass() == Dashboard.class) {
if(mSystemConfig.hotwords) {
mHotwordServiceClient.requestHotwordDetection(false);
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 boolean mHasLongKeyPress;
private Runnable mLongKeyPressRunnable = !MANUAL_LONG_KEY_PRESS_HANDLING ? null : new Runnable() {
private final Runnable mLongKeyPressRunnable = new Runnable() {
@Override
public void run() {
mHasLongKeyPress = true;
@ -2520,18 +2519,16 @@ public class Dashboard extends ResourceWrapperActivity implements OnLongClickLis
};
private void startLongKeyPressTimer(int keyCode) {
if(MANUAL_LONG_KEY_PRESS_HANDLING) {
// only one key managed at a time
mLongPressKeyCode = keyCode;
mHandler.removeCallbacks(mLongKeyPressRunnable);
mHandler.postDelayed(mLongKeyPressRunnable, ViewConfiguration.getLongPressTimeout());
}
}
private void cancelLongKeyPressTimer() {
if(MANUAL_LONG_KEY_PRESS_HANDLING) {
mHandler.removeCallbacks(mLongKeyPressRunnable);
}
mHandler.removeCallbacks(mLongKeyPressRunnable);
}
@Override
@ -2862,7 +2859,7 @@ public class Dashboard extends ResourceWrapperActivity implements OnLongClickLis
}
private void configureSystemBarsPadding(PageConfig c) {
if(Build.VERSION.SDK_INT>=19) {
{
SystemBarTintManager.SystemBarConfig config = mScreen.getSystemBarTintManager().getConfig();
int sbh = c.statusBarHide ? 0 : config.getStatusBarHeight();
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);
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();
Intent pickIntent;
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
pickIntent = new Intent(this, AppWidgetPickerActivity.class);
} else {
pickIntent = new Intent(AppWidgetManager.ACTION_APPWIDGET_PICK);
}
pickIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, mAllocatedAppWidgetId);
pickIntent = new Intent(this, AppWidgetPickerActivity.class);
pickIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, mAllocatedAppWidgetId);
ArrayList<AppWidgetProviderInfo> customInfo = new ArrayList<AppWidgetProviderInfo>();
pickIntent.putParcelableArrayListExtra(AppWidgetManager.EXTRA_CUSTOM_INFO, customInfo);
ArrayList<Bundle> customExtras = new ArrayList<Bundle>();
@ -3583,11 +3572,7 @@ public class Dashboard extends ResourceWrapperActivity implements OnLongClickLis
}
private void setAlphaOrVisibility(View view, float to) {
if(Build.VERSION.SDK_INT >= 11) {
view.setAlpha(to);
} else {
view.setVisibility(to==1 ? View.VISIBLE : View.GONE);
}
view.setAlpha(to);
}
/**
@ -5400,7 +5385,7 @@ public class Dashboard extends ResourceWrapperActivity implements OnLongClickLis
lp.height = mEditBarsHeight;
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();
desktopView.setScaleX(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.setScaleY(sy);
}
@ -6148,13 +6133,7 @@ public class Dashboard extends ResourceWrapperActivity implements OnLongClickLis
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
public void showAndroidActionBar(Function onCreateOptionsMenu, Function onOptionsItemSelected) {
if(isAndroidActionBarSupported() && !mIsAndroidActionBarDisplayed) {
@ -6519,8 +6498,8 @@ public class Dashboard extends ResourceWrapperActivity implements OnLongClickLis
@Override
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();
if(label == null || label.length() == 0) {
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());
Utils.addShortcut(label.toString(), icon, intent, itemLayout.getPage(), x, y, 1, true);
}
}
@Override
public void onHandlePressed(Handle h) {
@ -7265,9 +7244,7 @@ public class Dashboard extends ResourceWrapperActivity implements OnLongClickLis
break;
case GlobalConfig.SHOW_APP_SHORTCUTS:
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) {
showAppShortcuts(itemView);
}
showAppShortcuts(itemView);
break;
case GlobalConfig.SEARCH:

View file

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

View file

@ -104,9 +104,7 @@ public class LockScreen extends Dashboard {
// 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);
setSystemUiVisibility.invoke(decor_view, newUiOptions);

View file

@ -152,9 +152,7 @@ public class EmptyService extends Service {
public void 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.gridPRowNum = config.gridLRowNum = 4;
config.scrollingDirection = PageConfig.ScrollingDirection.X;
if(Build.VERSION.SDK_INT>=19) {
config.statusBarColor = resources.getColor(R.color.color_primary_dark);
config.navigationBarColor = Color.BLACK;
}
config.statusBarColor = resources.getColor(R.color.color_primary_dark);
config.navigationBarColor = Color.BLACK;
config.screenOrientation = PageConfig.ScreenOrientation.PORTRAIT;
// config.defaultItemConfig.rotate = true;

View file

@ -118,7 +118,7 @@ public class BoxEditorView extends View implements Runnable {
mSelectedAreaPaint = new Paint();
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.setColor(Color.BLACK);

View file

@ -703,7 +703,7 @@ public class CustomizeItemView extends MyViewPager implements LLPreferenceListVi
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(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(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) {
mItemMiscSelectionEffect.setValue(ic.selectionEffect, ic_def == null ? null : ic_def.selectionEffect);
mItemMiscSelectionEffect.setVisible(true);
if (Build.VERSION.SDK_INT >= 21) {
mItemMiscSelectionEffectMask.setValue(ic.selectionEffectMask, ic_def == null ? null : ic_def.selectionEffectMask);
mItemMiscSelectionEffectMask.setDisabled(ic.selectionEffect != ItemConfig.SelectionEffect.MATERIAL);
mItemMiscSelectionEffectMask.setVisible(true);
}
mItemMiscSelectionEffectMask.setValue(ic.selectionEffectMask, ic_def == null ? null : ic_def.selectionEffectMask);
mItemMiscSelectionEffectMask.setDisabled(ic.selectionEffect != ItemConfig.SelectionEffect.MATERIAL);
mItemMiscSelectionEffectMask.setVisible(true);
}
if (mItem != null) {
mItemMiscPinMode.setValue(ic.pinMode, ic_def == null ? null : ic_def.pinMode);

View file

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

View file

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

View file

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

View file

@ -44,7 +44,7 @@ public class ItemConfig extends JsonLoader {
public PinMode pinMode=PinMode.NONE;
public int alpha=255;
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 rotate=false;
public boolean hardwareAccelerated=true;

View file

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

View file

@ -626,35 +626,29 @@ public class LightningEngine implements Page.PageListener {
}
private void loadAppShortcuts() {
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) {
File appShortcutsFile = FileUtils.getPinnedAppShortcutsFile(mBaseDir);
mAppShortcuts = FileUtils.readJSONObjectFromFile(appShortcutsFile);
if (mAppShortcuts == null) {
mAppShortcuts = new JSONObject();
}
File appShortcutsFile = FileUtils.getPinnedAppShortcutsFile(mBaseDir);
mAppShortcuts = FileUtils.readJSONObjectFromFile(appShortcutsFile);
if (mAppShortcuts == null) {
mAppShortcuts = new JSONObject();
}
}
private void saveAppShortcuts() {
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) {
try {
File out = FileUtils.getPinnedAppShortcutsFile(mBaseDir);
FileUtils.saveStringToFile(mAppShortcuts.toString(), out);
} catch (Exception e) {
// pass
}
try {
File out = FileUtils.getPinnedAppShortcutsFile(mBaseDir);
FileUtils.saveStringToFile(mAppShortcuts.toString(), out);
} catch (Exception e) {
// pass
}
}
/** Return null if this isn't a Android 7.1 app shortcut */
private Intent getAppShortcutIntent(Item item) {
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) {
if (item.getClass() == Shortcut.class) {
Shortcut shortcut = (Shortcut) item;
Intent intent = shortcut.getIntent();
if (intent != null && Shortcut.INTENT_ACTION_APP_SHORTCUT.equals(intent.getAction())) {
return intent;
}
if (item.getClass() == Shortcut.class) {
Shortcut shortcut = (Shortcut) item;
Intent intent = shortcut.getIntent();
if (intent != null && Shortcut.INTENT_ACTION_APP_SHORTCUT.equals(intent.getAction())) {
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.Utils;
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.ScriptExecutor;
import net.pierrox.lightning_launcher.script.ScriptManager;
import net.pierrox.lightning_launcher.script.api.Container;
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.views.FolderView;
import net.pierrox.lightning_launcher.views.HandleView;
@ -315,9 +315,7 @@ public abstract class Screen implements ItemLayout.ItemLayoutListener, ItemView.
public void setWindow(Window window) {
mWindow = window;
if(Build.VERSION.SDK_INT>=19) {
mSystemBarTintManager = new SystemBarTintManager(mWindow);
}
mSystemBarTintManager = new SystemBarTintManager(mWindow);
}
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]
);
Rect r = computeItemViewBounds(openerView);
if (!getCurrentRootPage().config.statusBarHide && Build.VERSION.SDK_INT >= 11) {
if (!getCurrentRootPage().config.statusBarHide) {
// hackish and duplicate with Dashboard.leaveEditMode
Resources res = mContext.getResources();
int statusBarHeight = 0;
@ -1038,7 +1036,7 @@ public abstract class Screen implements ItemLayout.ItemLayoutListener, ItemView.
if(t != null) t.mapRect(bounds);
traverseViews((View)il.getParent(), bounds);
if(il.getEditMode() && Build.VERSION.SDK_INT>=11) {
if (il.getEditMode()) {
// pivot is always 0x0
float sx = mDesktopView.getScaleX();
float sy = mDesktopView.getScaleY();
@ -1088,7 +1086,7 @@ public abstract class Screen implements ItemLayout.ItemLayoutListener, ItemView.
il.getTransformForRect(r).mapRect(r);
traverseViews((View)(il.getParent()), r);
float[] coords = new float[] {r.left, r.top};
if(il.getEditMode() && Build.VERSION.SDK_INT>=11) {
if (il.getEditMode()) {
// pivot is always 0x0
coords[0] *= mDesktopView.getScaleX();
coords[1] *= mDesktopView.getScaleY();
@ -1606,7 +1604,7 @@ public abstract class Screen implements ItemLayout.ItemLayoutListener, ItemView.
//noinspection ResourceType
service = mContext.getSystemService("statusbar");
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);
} catch(Exception e1) {
}
@ -1712,7 +1710,7 @@ public abstract class Screen implements ItemLayout.ItemLayoutListener, ItemView.
}
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);
String id = intent.getStringExtra(Shortcut.INTENT_EXTRA_APP_SHORTCUT_ID);
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)) {
DisplayMetrics dm = new DisplayMetrics();
Display display = mWindow.getWindowManager().getDefaultDisplay();
if (Build.VERSION.SDK_INT >= 17) {
display.getRealMetrics(dm);
} else {
display.getMetrics(dm);
}
display.getRealMetrics(dm);
out[0] = dm.widthPixels;
out[1] = dm.heightPixels;
} 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 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;
@ -94,7 +96,7 @@ public class WindowService extends Service implements LightningEngine.GlobalConf
private boolean mIsShown;
public static boolean isPermissionAllowed(Context context) {
return Build.VERSION.SDK_INT<23 || Settings.canDrawOverlays(context);
return Settings.canDrawOverlays(context);
}
@Override
@ -173,10 +175,8 @@ public class WindowService extends Service implements LightningEngine.GlobalConf
mItemLayout=(ItemLayout) mWorkspaceView.findViewById(R.id.window_il);
mScreen.takeItemLayoutOwnership(mItemLayout);
mItemLayout.setHonourFocusChange(false);
int windowType = Build.VERSION.SDK_INT >= Build.VERSION_CODES.O
? WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY
: WindowManager.LayoutParams.TYPE_SYSTEM_ALERT;
int windowType = WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY;
mWindowManager = (WindowManager) getSystemService(WINDOW_SERVICE);
WindowManager.LayoutParams lp = new WindowManager.LayoutParams(
@ -340,30 +340,23 @@ public class WindowService extends Service implements LightningEngine.GlobalConf
configureDrawer();
if (Build.VERSION.SDK_INT >= 26) {
CharSequence name = "Lightning Services";
String description = "Background Launcher activities";
int importance = NotificationManager.IMPORTANCE_LOW;
NotificationChannel channel = new NotificationChannel(NOTIFICATION_CHANNEL_ID, name, importance);
channel.setDescription(description);
NotificationManager notificationManager = getSystemService(NotificationManager.class);
notificationManager.createNotificationChannel(channel);
}
CharSequence name = "Lightning Services";
String description = "Background Launcher activities";
int importance = NotificationManager.IMPORTANCE_LOW;
NotificationChannel channel = new NotificationChannel(NOTIFICATION_CHANNEL_ID, name, importance);
channel.setDescription(description);
NotificationManager notificationManager = getSystemService(NotificationManager.class);
notificationManager.createNotificationChannel(channel);
Intent notificationIntent = LLApp.get().getWindowServiceIntent();
notificationIntent.setAction(WindowService.INTENT_ACTION_SHOW);
PendingIntent pendingIntent = PendingIntent.getService(this, 0, notificationIntent, 0);
Notification.Builder builder;
if (Build.VERSION.SDK_INT >= 26) {
builder = new Notification.Builder(this, NOTIFICATION_CHANNEL_ID);
} else {
builder = new Notification.Builder(this);
}
builder = new Notification.Builder(this, NOTIFICATION_CHANNEL_ID);
builder.setContentTitle(getString(R.string.ov_r))
.setContentIntent(pendingIntent)
.setCategory(Notification.CATEGORY_SERVICE)
.setPriority(Notification.PRIORITY_LOW);
.setCategory(Notification.CATEGORY_SERVICE);
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) {
super(context, attrs);
if(Build.VERSION.SDK_INT >= 11) {
if(hardware_accelerated) {
setLayerType(LAYER_TYPE_HARDWARE, new Paint());
}
if (hardware_accelerated) {
setLayerType(LAYER_TYPE_HARDWARE, new Paint());
}
mDensity = getResources().getDisplayMetrics().density;
@ -108,7 +106,7 @@ public class BoxLayout extends ViewGroup implements SharedAsyncGraphicsDrawable.
@Override
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();
if(layer_type != LAYER_TYPE_NONE) {
setLayerType(LAYER_TYPE_NONE, null);
@ -200,16 +198,6 @@ public class BoxLayout extends ViewGroup implements SharedAsyncGraphicsDrawable.
invalidate();
}
@Override
public void setAlpha(float alpha) {
if(Build.VERSION.SDK_INT < 11) {
mAlpha = (int) (255 * alpha);
invalidate();
} else {
super.setAlpha(alpha);
}
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
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.translate(mChildLeft, mChildTop);
if (Build.VERSION.SDK_INT < 11) {
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);
}
mChildView.draw(canvas);
canvas.translate(-mChildLeft, -mChildTop);
canvas.restore();
}
@ -492,10 +466,6 @@ public class BoxLayout extends ViewGroup implements SharedAsyncGraphicsDrawable.
sBorderPaint.setColor(mCurrentBorderBottomColor);
canvas.drawPath(mBorderBottomPath, sBorderPaint);
}
if(mAlpha!=255 && Build.VERSION.SDK_INT < 11) {
canvas.restore();
}
}
@Override

View file

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

View file

@ -2250,11 +2250,6 @@ public class ItemLayout extends ViewGroup {
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);
itemView.getHitRect(mTempRect);

View file

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

View file

@ -402,9 +402,7 @@ public class SharedAsyncGraphicsDrawable extends Drawable implements Drawable.Ca
byte[] chunk = bitmap.getNinePatchChunk();
if(NinePatch.isNinePatchChunk(chunk)) {
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);
mIntrinsicWidth = np.getWidth();
mIntrinsicHeight = np.getHeight();

View file

@ -9,36 +9,8 @@ import android.view.WindowManager;
public class SystemUIHelper {
public static void setStatusBarVisibility(Window w, boolean visible, boolean overlap) {
if (Build.VERSION.SDK_INT >= 16) {
View decorView = w.getDecorView();
decorView.setSystemUiVisibility(visible ? 0 : View.SYSTEM_UI_FLAG_FULLSCREEN);
View decorView = w.getDecorView();
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
public void dispatchDraw(Canvas canvas) {
if(mLocalTransform==null) {
if(Build.VERSION.SDK_INT < 11) {
if(mChildView != null) {
mChildView.draw(canvas);
}
} else {
super.dispatchDraw(canvas);
}
super.dispatchDraw(canvas);
} else {
if(mFilterChildView) canvas.setDrawFilter(sPaintFlagDrawFilter);
canvas.save();
canvas.concat(mLocalTransform);
// canvas.clipRect(0, 0, mChildView.getWidth(), mChildView.getHeight());
if(Build.VERSION.SDK_INT < 11) {
mChildView.draw(canvas);
} else {
super.dispatchDraw(canvas);
}
super.dispatchDraw(canvas);
canvas.restore();
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() {
return mTransformBoundingBox;
}

View file

@ -173,7 +173,7 @@ public abstract class ItemView extends TransformLayout implements TouchEventInte
mAlpha = mItem.getAlpha();
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});
RippleDrawable background = new RippleDrawable(colors, null, ic.selectionEffectMask ? new ColorDrawable(-1) : null);
setBackgroundDrawable(background);

View file

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