mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-27 23:36:47 +00:00
Use setBlocking on toggleHomeScreenLock() instead of BuildersKt
Co-authored-by: Daria Hamrah Paytakht <info@dariarnd.ir>
This commit is contained in:
@@ -377,7 +377,7 @@ dependencies {
|
||||
implementation 'dev.kdrag0n:colorkt:1.0.5'
|
||||
implementation 'io.coil-kt:coil-compose:2.0.0'
|
||||
implementation 'me.xdrop:fuzzywuzzy:1.4.0'
|
||||
implementation "com.patrykmichalik:preference-manager:1.0.6"
|
||||
implementation "com.patrykmichalik:preference-manager:1.0.7"
|
||||
implementation "androidx.datastore:datastore-preferences:1.0.0"
|
||||
implementation "com.squareup.retrofit2:retrofit:2.9.0"
|
||||
implementation "com.squareup.retrofit2:converter-gson:2.9.0"
|
||||
|
||||
@@ -52,16 +52,13 @@ import com.android.launcher3.shortcuts.DeepShortcutView;
|
||||
import com.android.launcher3.testing.TestLogging;
|
||||
import com.android.launcher3.testing.TestProtocol;
|
||||
import com.android.launcher3.widget.picker.WidgetsFullSheet;
|
||||
import com.patrykmichalik.preferencemanager.Preference;
|
||||
import com.patrykmichalik.preferencemanager.PreferenceExtensionsKt;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import app.lawnchair.preferences2.PreferenceManager2;
|
||||
import kotlin.coroutines.CoroutineContext;
|
||||
import kotlinx.coroutines.BuildersKt;
|
||||
import kotlinx.coroutines.CoroutineStart;
|
||||
import kotlinx.coroutines.GlobalScope;
|
||||
|
||||
/**
|
||||
* Popup shown on long pressing an empty space in launcher
|
||||
@@ -276,17 +273,11 @@ public class OptionsPopupView extends ArrowPopup<Launcher>
|
||||
return launcher.startActivitySafely(v, intent, placeholderInfo(intent));
|
||||
}
|
||||
|
||||
@SuppressLint("UnsafeOptInUsageWarning")
|
||||
private static boolean toggleHomeScreenLock(View v) {
|
||||
Context context = v.getContext();
|
||||
PreferenceManager2 preferenceManager2 = PreferenceManager2.getInstance(context);
|
||||
GlobalScope globalScope = GlobalScope.INSTANCE;
|
||||
CoroutineContext coroutineContext = globalScope.getCoroutineContext();
|
||||
BuildersKt.launch(globalScope,
|
||||
coroutineContext,
|
||||
CoroutineStart.DEFAULT,
|
||||
(coroutineScope, continuation) -> PreferenceExtensionsKt.toggle(preferenceManager2.getLockHomeScreen(), continuation)
|
||||
);
|
||||
boolean oldValue = PreferenceExtensionsKt.firstBlocking(preferenceManager2.getLockHomeScreen());
|
||||
PreferenceExtensionsKt.setBlocking(preferenceManager2.getLockHomeScreen(), !oldValue);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user