mirror of
https://github.com/TrianguloY/LightningLauncher.git
synced 2025-01-29 20:34:55 +01:00
Fixes for setTheme
This commit is contained in:
parent
a60e59f2cd
commit
b008bc96f2
25 changed files with 375 additions and 253 deletions
|
@ -1,5 +1,6 @@
|
|||
plugins {
|
||||
alias(libs.plugins.android)
|
||||
alias(libs.plugins.kotlin)
|
||||
}
|
||||
|
||||
def appendVersionNameVersionCode(variant, defaultConfig) {
|
||||
|
@ -134,6 +135,15 @@ android {
|
|||
aidl true
|
||||
}
|
||||
namespace 'net.pierrox.lightning_launcher_extreme'
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_11
|
||||
targetCompatibility JavaVersion.VERSION_11
|
||||
}
|
||||
|
||||
kotlinOptions {
|
||||
jvmTarget = '11'
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
@ -144,4 +154,5 @@ dependencies {
|
|||
implementation libs.koin.android
|
||||
implementation libs.androidx.appcomat
|
||||
implementation libs.androidx.material
|
||||
implementation libs.androidx.preference
|
||||
}
|
||||
|
|
|
@ -126,7 +126,7 @@
|
|||
android:grantUriPermissions="true"/>
|
||||
|
||||
<activity
|
||||
android:name="net.pierrox.lightning_launcher.activities.RootSettings"
|
||||
android:name="net.pierrox.lightning_launcher.feature.settings.RootSettings"
|
||||
android:excludeFromRecents="true"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize"/>
|
||||
|
||||
|
|
|
@ -51,6 +51,8 @@ import android.widget.FrameLayout;
|
|||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
|
||||
import com.readystatesoftware.systembartint.SystemBarTintManager;
|
||||
|
||||
import net.pierrox.lightning_launcher.API;
|
||||
|
@ -123,7 +125,6 @@ import java.io.File;
|
|||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class Customize extends ResourceWrapperActivity implements
|
||||
|
@ -515,6 +516,9 @@ public class Customize extends ResourceWrapperActivity implements
|
|||
|
||||
setContentView(R.layout.customize);
|
||||
|
||||
Toolbar toolbar = findViewById(R.id.toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
|
||||
mMyViewPager = findViewById(R.id.view_pager);
|
||||
mMyViewPager.setOnPageChangeListener(this);
|
||||
mPreferenceScreens = new LLPreferenceListView[2];
|
||||
|
@ -674,13 +678,6 @@ public class Customize extends ResourceWrapperActivity implements
|
|||
|
||||
private void setScreenTitle(String title) {
|
||||
setTitle(title);
|
||||
try {
|
||||
Method getActionBar = getClass().getMethod("getActionBar");
|
||||
Object action_bar = getActionBar.invoke(this, (Object[]) null);
|
||||
action_bar.getClass().getMethod("setTitle", String.class).invoke(action_bar, title);
|
||||
} catch (Exception e) {
|
||||
// pass, API level 11
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,213 +0,0 @@
|
|||
/*
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2022 Pierre Hébert
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
|
||||
package net.pierrox.lightning_launcher.activities;
|
||||
|
||||
import android.content.ComponentName;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager.NameNotFoundException;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Bundle;
|
||||
import android.preference.Preference;
|
||||
import android.preference.Preference.OnPreferenceClickListener;
|
||||
import android.preference.PreferenceActivity;
|
||||
import android.preference.PreferenceCategory;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
|
||||
import net.pierrox.lightning_launcher.LLApp;
|
||||
import net.pierrox.lightning_launcher.Version;
|
||||
import net.pierrox.lightning_launcher.data.ContainerPath;
|
||||
import net.pierrox.lightning_launcher.data.Page;
|
||||
import net.pierrox.lightning_launcher.template.LLTemplateAPI;
|
||||
import net.pierrox.lightning_launcher.util.PhoneUtils;
|
||||
import net.pierrox.lightning_launcher_extreme.R;
|
||||
|
||||
public class RootSettings extends PreferenceActivity implements OnPreferenceClickListener {
|
||||
private static final String KEY_GLOBAL_CONFIG="g";
|
||||
private static final String KEY_CURRENT_PAGE="d";
|
||||
private static final String KEY_APP_DRAWER="a";
|
||||
private static final String KEY_BACKUP_RESTORE="br";
|
||||
private static final String KEY_CAT_SETTINGS="t";
|
||||
private static final String KEY_CAT_INFOS="i";
|
||||
private static final String KEY_COMMUNITY ="f";
|
||||
private static final String KEY_RATE="r";
|
||||
private static final String KEY_SELECT_LAUNCHER ="s";
|
||||
private static final String KEY_CONFIGURE_PAGES="p";
|
||||
private static final String KEY_CAT_TEMPLATES="tc";
|
||||
private static final String KEY_TEMPLATES_BROWSE="tb";
|
||||
private static final String KEY_TEMPLATES_APPLY="ta";
|
||||
private static final String KEY_UPGRADE="u";
|
||||
|
||||
private static final int REQUEST_SELECT_TEMPLATE = 1;
|
||||
|
||||
private ResourcesWrapperHelper mResourcesWrapperHelper;
|
||||
@Override
|
||||
public final Resources getResources() {
|
||||
if(mResourcesWrapperHelper == null) {
|
||||
mResourcesWrapperHelper = new ResourcesWrapperHelper(this, super.getResources());
|
||||
}
|
||||
return mResourcesWrapperHelper.getResources();
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
addPreferencesFromResource(R.xml.preference_root);
|
||||
|
||||
setupPreference(KEY_CAT_SETTINGS, R.string.settings, 0);
|
||||
setupPreference(KEY_GLOBAL_CONFIG, R.string.general_t, R.string.general_s);
|
||||
setupPreference(KEY_CURRENT_PAGE, R.string.dashboard_t, R.string.dashboard_s);
|
||||
setupPreference(KEY_APP_DRAWER, R.string.app_drawer_t, R.string.app_drawer_s);
|
||||
|
||||
final LLApp app = LLApp.get();
|
||||
setupPreference(KEY_CONFIGURE_PAGES, R.string.configure_pages_t, app.isFreeVersion() ? R.string.tr_br_s : R.string.configure_pages_s);
|
||||
setupPreference(KEY_BACKUP_RESTORE, R.string.backup_restore_t, app.isTrialVersion() ? R.string.tr_br_s : 0);
|
||||
|
||||
setupPreference(KEY_CAT_INFOS, R.string.app_name, 0);
|
||||
setupPreference(KEY_SELECT_LAUNCHER, R.string.select_launcher_title, 0);
|
||||
setupPreference(KEY_COMMUNITY, R.string.facebook_t, R.string.facebook_s);
|
||||
setupPreference(KEY_RATE, R.string.rate_t, R.string.rate_s);
|
||||
|
||||
setupPreference(KEY_UPGRADE, R.string.tr_rs_t, R.string.tr_rs_s);
|
||||
if(app.isTrialVersion()) {
|
||||
final long left = app.getTrialLeft();
|
||||
long d = left==0 ? 0 : 1 + left / 86400000L;
|
||||
findPreference(KEY_UPGRADE).setSummary(getString(R.string.tr_l, d));
|
||||
}
|
||||
|
||||
setupPreference(KEY_CAT_TEMPLATES, R.string.tmpl_t, R.string.tmpl_s);
|
||||
setupPreference(KEY_TEMPLATES_BROWSE, R.string.tmpl_b_t, R.string.tmpl_b_s);
|
||||
setupPreference(KEY_TEMPLATES_APPLY, R.string.tmpl_a_t, R.string.tmpl_a_s);
|
||||
|
||||
PreferenceCategory pc=(PreferenceCategory)getPreferenceScreen().findPreference(KEY_CAT_INFOS);
|
||||
if(!Version.HAS_RATE_LINK || app.isFreeVersion() || app.isTrialVersion()) {
|
||||
pc.removePreference(findPreference(KEY_RATE));
|
||||
}
|
||||
if(!app.isFreeVersion() && !app.isTrialVersion()) {
|
||||
pc.removePreference(findPreference(KEY_UPGRADE));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
// Inflate the menu items for use in the action bar
|
||||
MenuInflater inflater = getMenuInflater();
|
||||
inflater.inflate(R.menu.root_settings, menu);
|
||||
menu.findItem(R.id.h).setTitle(getString(R.string.sc_help));
|
||||
return super.onCreateOptionsMenu(menu);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
// Handle presses on the action bar items
|
||||
switch (item.getItemId()) {
|
||||
case R.id.h: PhoneUtils.showPreferenceHelp(this, null); return true;
|
||||
default: return super.onOptionsItemSelected(item);
|
||||
}
|
||||
}
|
||||
|
||||
private void setupPreference(String key, int title, int summary) {
|
||||
@SuppressWarnings("deprecation")
|
||||
Preference p=findPreference(key);
|
||||
if(key.equals(KEY_CAT_INFOS)) {
|
||||
try {
|
||||
PackageInfo pi = getPackageManager().getPackageInfo(getPackageName(), 0);
|
||||
p.setTitle(getString(title) + " v"+pi.versionName);
|
||||
} catch(NameNotFoundException e) {
|
||||
// pass, cannot fail
|
||||
}
|
||||
} else {
|
||||
p.setTitle(title);
|
||||
}
|
||||
if(summary!=0) p.setSummary(summary);
|
||||
p.setOnPreferenceClickListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPreferenceClick(Preference pref) {
|
||||
String key=pref.getKey();
|
||||
if(KEY_CONFIGURE_PAGES.equals(key)) {
|
||||
Intent intent = new Intent(this, ScreenManager.class);
|
||||
intent.setAction(Intent.ACTION_EDIT);
|
||||
startActivity(intent);
|
||||
} else if(KEY_BACKUP_RESTORE.equals(key)) {
|
||||
startActivity(new Intent(this, BackupRestore.class));
|
||||
} else if(KEY_SELECT_LAUNCHER.equals(key)) {
|
||||
PhoneUtils.selectLauncher(this, true);
|
||||
} else if(KEY_UPGRADE.equals(key)) {
|
||||
LLApp.get().startUnlockProcess(this);
|
||||
} else if(KEY_TEMPLATES_BROWSE.equals(key)) {
|
||||
startActivity(Intent.createChooser(new Intent(Intent.ACTION_VIEW, Version.BROWSE_TEMPLATES_URI), ""));
|
||||
} else if(KEY_TEMPLATES_APPLY.equals(key)) {
|
||||
Intent i=new Intent(Intent.ACTION_PICK_ACTIVITY);
|
||||
i.putExtra(Intent.EXTRA_TITLE, getString(R.string.tmpl_c));
|
||||
Intent filter=new Intent(LLTemplateAPI.INTENT_QUERY_TEMPLATE);
|
||||
i.putExtra(Intent.EXTRA_INTENT, filter);
|
||||
startActivityForResult(i, REQUEST_SELECT_TEMPLATE);
|
||||
} else if(!KEY_RATE.equals(key) && !KEY_COMMUNITY.equals(key)) {
|
||||
Intent intent=new Intent(this, Customize.class);
|
||||
ContainerPath path = null;
|
||||
if(KEY_CURRENT_PAGE.equals(key)) {
|
||||
int current_page = LLApp.get().getAppEngine().readCurrentPage(Page.FIRST_DASHBOARD_PAGE);
|
||||
String s = getIntent().getStringExtra(Customize.INTENT_EXTRA_PAGE_PATH);
|
||||
if(s == null) {
|
||||
path = new ContainerPath(getIntent().getIntExtra(Customize.INTENT_EXTRA_PAGE_ID, current_page));
|
||||
} else {
|
||||
path = new ContainerPath(s);
|
||||
if(path.getLast() == Page.APP_DRAWER_PAGE) {
|
||||
path = new ContainerPath(current_page);
|
||||
}
|
||||
}
|
||||
} if(KEY_APP_DRAWER.equals(key)) {
|
||||
path = new ContainerPath(Page.APP_DRAWER_PAGE);
|
||||
}
|
||||
if(path != null) {
|
||||
intent.putExtra(Customize.INTENT_EXTRA_PAGE_PATH, path.toString());
|
||||
}
|
||||
startActivity(intent);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
if(requestCode == REQUEST_SELECT_TEMPLATE) {
|
||||
if(resultCode == RESULT_OK) {
|
||||
ComponentName component_name=data.getComponent();
|
||||
if(component_name != null) {
|
||||
Intent intent = new Intent(this, ApplyTemplate.class);
|
||||
intent.putExtra(LLTemplateAPI.INTENT_TEMPLATE_COMPONENT_NAME, component_name);
|
||||
startActivity(intent);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -40,6 +40,7 @@ import net.pierrox.lightning_launcher.data.LightningIntent;
|
|||
import net.pierrox.lightning_launcher.data.Page;
|
||||
import net.pierrox.lightning_launcher.data.TaskerPlugin;
|
||||
import net.pierrox.lightning_launcher.engine.variable.Variable;
|
||||
import net.pierrox.lightning_launcher.feature.settings.RootSettings;
|
||||
import net.pierrox.lightning_launcher.script.Script;
|
||||
import net.pierrox.lightning_launcher.util.ScriptPickerDialog;
|
||||
import net.pierrox.lightning_launcher.util.SetVariableDialog;
|
||||
|
|
|
@ -0,0 +1,75 @@
|
|||
/*
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2022 Pierre Hébert
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
|
||||
package net.pierrox.lightning_launcher.feature.settings;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
|
||||
import net.pierrox.lightning_launcher.activities.ResourceWrapperActivity;
|
||||
import net.pierrox.lightning_launcher.util.PhoneUtils;
|
||||
import net.pierrox.lightning_launcher_extreme.R;
|
||||
|
||||
public class RootSettings extends ResourceWrapperActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_settings);
|
||||
Toolbar toolbar = findViewById(R.id.toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
replaceScreen();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
// Inflate the menu items for use in the action bar
|
||||
MenuInflater inflater = getMenuInflater();
|
||||
inflater.inflate(R.menu.root_settings, menu);
|
||||
menu.findItem(R.id.h).setTitle(getString(R.string.sc_help));
|
||||
return super.onCreateOptionsMenu(menu);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
// Handle presses on the action bar items
|
||||
switch (item.getItemId()) {
|
||||
case R.id.h: PhoneUtils.showPreferenceHelp(this, null); return true;
|
||||
default: return super.onOptionsItemSelected(item);
|
||||
}
|
||||
}
|
||||
|
||||
private void replaceScreen() {
|
||||
getSupportFragmentManager()
|
||||
.beginTransaction()
|
||||
.replace(R.id.fragment_container, new SettingsFragment())
|
||||
.commit();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,185 @@
|
|||
package net.pierrox.lightning_launcher.feature.settings
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Intent
|
||||
import android.content.pm.PackageInfo
|
||||
import android.content.pm.PackageManager
|
||||
import android.os.Bundle
|
||||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
import androidx.preference.Preference
|
||||
import androidx.preference.PreferenceCategory
|
||||
import androidx.preference.PreferenceFragmentCompat
|
||||
import net.pierrox.lightning_launcher.LLApp
|
||||
import net.pierrox.lightning_launcher.Version
|
||||
import net.pierrox.lightning_launcher.activities.ApplyTemplate
|
||||
import net.pierrox.lightning_launcher.activities.BackupRestore
|
||||
import net.pierrox.lightning_launcher.activities.Customize
|
||||
import net.pierrox.lightning_launcher.activities.ScreenManager
|
||||
import net.pierrox.lightning_launcher.data.ContainerPath
|
||||
import net.pierrox.lightning_launcher.data.Page
|
||||
import net.pierrox.lightning_launcher.template.LLTemplateAPI
|
||||
import net.pierrox.lightning_launcher.util.PhoneUtils
|
||||
import net.pierrox.lightning_launcher_extreme.R
|
||||
|
||||
class SettingsFragment : PreferenceFragmentCompat(), Preference.OnPreferenceClickListener {
|
||||
companion object {
|
||||
private const val KEY_GLOBAL_CONFIG = "g"
|
||||
private const val KEY_CURRENT_PAGE = "d"
|
||||
private const val KEY_APP_DRAWER = "a"
|
||||
private const val KEY_BACKUP_RESTORE = "br"
|
||||
private const val KEY_CAT_SETTINGS = "t"
|
||||
private const val KEY_CAT_INFOS = "i"
|
||||
private const val KEY_COMMUNITY = "f"
|
||||
private const val KEY_RATE = "r"
|
||||
private const val KEY_SELECT_LAUNCHER = "s"
|
||||
private const val KEY_CONFIGURE_PAGES = "p"
|
||||
private const val KEY_CAT_TEMPLATES = "tc"
|
||||
private const val KEY_TEMPLATES_BROWSE = "tb"
|
||||
private const val KEY_TEMPLATES_APPLY = "ta"
|
||||
private const val KEY_UPGRADE = "u"
|
||||
}
|
||||
|
||||
private val templateLauncher =
|
||||
registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { result ->
|
||||
if (result.resultCode == Activity.RESULT_OK) {
|
||||
val componentName = result.data?.component
|
||||
if (componentName != null) {
|
||||
val intent = Intent(activity, ApplyTemplate::class.java)
|
||||
intent.putExtra(LLTemplateAPI.INTENT_TEMPLATE_COMPONENT_NAME, componentName)
|
||||
startActivity(intent)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
|
||||
addPreferencesFromResource(R.xml.preference_root)
|
||||
|
||||
setupPreference(KEY_CAT_SETTINGS, R.string.settings, 0)
|
||||
setupPreference(KEY_GLOBAL_CONFIG, R.string.general_t, R.string.general_s)
|
||||
setupPreference(KEY_CURRENT_PAGE, R.string.dashboard_t, R.string.dashboard_s)
|
||||
setupPreference(KEY_APP_DRAWER, R.string.app_drawer_t, R.string.app_drawer_s)
|
||||
|
||||
val app = LLApp.get()
|
||||
setupPreference(
|
||||
KEY_CONFIGURE_PAGES,
|
||||
R.string.configure_pages_t,
|
||||
if (app.isFreeVersion()) R.string.tr_br_s else R.string.configure_pages_s
|
||||
)
|
||||
setupPreference(
|
||||
KEY_BACKUP_RESTORE,
|
||||
R.string.backup_restore_t,
|
||||
if (app.isTrialVersion()) R.string.tr_br_s else 0
|
||||
)
|
||||
|
||||
setupPreference(KEY_CAT_INFOS, R.string.app_name, 0)
|
||||
setupPreference(KEY_SELECT_LAUNCHER, R.string.select_launcher_title, 0)
|
||||
setupPreference(KEY_COMMUNITY, R.string.facebook_t, R.string.facebook_s)
|
||||
setupPreference(KEY_RATE, R.string.rate_t, R.string.rate_s)
|
||||
|
||||
setupPreference(KEY_UPGRADE, R.string.tr_rs_t, R.string.tr_rs_s)
|
||||
if (app.isTrialVersion()) {
|
||||
val left = app.getTrialLeft()
|
||||
val d = if (left == 0L) 0 else 1 + left / 86400000L
|
||||
findPreference<Preference>(KEY_UPGRADE)?.setSummary(getString(R.string.tr_l, d))
|
||||
}
|
||||
|
||||
setupPreference(KEY_CAT_TEMPLATES, R.string.tmpl_t, R.string.tmpl_s)
|
||||
setupPreference(KEY_TEMPLATES_BROWSE, R.string.tmpl_b_t, R.string.tmpl_b_s)
|
||||
setupPreference(KEY_TEMPLATES_APPLY, R.string.tmpl_a_t, R.string.tmpl_a_s)
|
||||
|
||||
val pc = preferenceScreen.findPreference(KEY_CAT_INFOS) as PreferenceCategory?
|
||||
val ratePreference = findPreference<Preference>(KEY_RATE)
|
||||
val upgradePreference = findPreference<Preference>(KEY_UPGRADE)
|
||||
|
||||
if (!Version.HAS_RATE_LINK || app.isFreeVersion() || app.isTrialVersion()) {
|
||||
ratePreference?.let { pc?.removePreference(it) }
|
||||
}
|
||||
if (!app.isFreeVersion() && !app.isTrialVersion()) {
|
||||
upgradePreference?.let { pc?.removePreference(it) }
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupPreference(key: String, title: Int, summary: Int) {
|
||||
val p: Preference? = findPreference(key)
|
||||
if (key == KEY_CAT_INFOS) {
|
||||
try {
|
||||
val pi: PackageInfo =
|
||||
requireContext().packageManager.getPackageInfo(requireContext().packageName, 0)
|
||||
p?.title = getString(title) + " v" + pi.versionName
|
||||
} catch (e: PackageManager.NameNotFoundException) {
|
||||
// pass, cannot fail
|
||||
}
|
||||
} else {
|
||||
p?.setTitle(title)
|
||||
}
|
||||
if (summary != 0) p?.setSummary(summary)
|
||||
p?.onPreferenceClickListener = this
|
||||
}
|
||||
|
||||
override fun onPreferenceClick(preference: Preference): Boolean {
|
||||
val key: String = preference.key
|
||||
|
||||
if (KEY_CONFIGURE_PAGES == key) {
|
||||
val intent = Intent(activity, ScreenManager::class.java)
|
||||
intent.setAction(Intent.ACTION_EDIT)
|
||||
startActivity(intent)
|
||||
} else if (KEY_BACKUP_RESTORE == key) {
|
||||
startActivity(Intent(activity, BackupRestore::class.java))
|
||||
} else if (KEY_SELECT_LAUNCHER == key) {
|
||||
PhoneUtils.selectLauncher(activity, true)
|
||||
} else if (KEY_UPGRADE == key) {
|
||||
LLApp.get().startUnlockProcess(activity)
|
||||
} else if (KEY_TEMPLATES_BROWSE == key) {
|
||||
startActivity(
|
||||
Intent.createChooser(
|
||||
Intent(
|
||||
Intent.ACTION_VIEW,
|
||||
Version.BROWSE_TEMPLATES_URI
|
||||
), ""
|
||||
)
|
||||
)
|
||||
} else if (KEY_TEMPLATES_APPLY == key) {
|
||||
launchApplyTemplates()
|
||||
} else if (KEY_RATE != key && KEY_COMMUNITY != key) {
|
||||
val intent = Intent(activity, Customize::class.java)
|
||||
var path: ContainerPath? = null
|
||||
if (KEY_CURRENT_PAGE == key) {
|
||||
val current_page = LLApp.get().appEngine.readCurrentPage(Page.FIRST_DASHBOARD_PAGE)
|
||||
val s: String? =
|
||||
requireActivity().intent?.getStringExtra(Customize.INTENT_EXTRA_PAGE_PATH)
|
||||
if (s == null) {
|
||||
path = ContainerPath(
|
||||
requireActivity().intent?.getIntExtra(
|
||||
Customize.INTENT_EXTRA_PAGE_ID,
|
||||
current_page
|
||||
) ?: current_page
|
||||
)
|
||||
} else {
|
||||
path = ContainerPath(s)
|
||||
if (path.last == Page.APP_DRAWER_PAGE) {
|
||||
path = ContainerPath(current_page)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (KEY_APP_DRAWER == key) {
|
||||
path = ContainerPath(Page.APP_DRAWER_PAGE)
|
||||
}
|
||||
if (path != null) {
|
||||
intent.putExtra(Customize.INTENT_EXTRA_PAGE_PATH, path.toString())
|
||||
}
|
||||
startActivity(intent)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
private fun launchApplyTemplates() {
|
||||
val filter = Intent(LLTemplateAPI.INTENT_QUERY_TEMPLATE)
|
||||
val i = Intent(Intent.ACTION_PICK_ACTIVITY).apply {
|
||||
putExtra(Intent.EXTRA_TITLE, getString(R.string.tmpl_c))
|
||||
putExtra(Intent.EXTRA_INTENT, filter)
|
||||
}
|
||||
templateLauncher.launch(i)
|
||||
}
|
||||
|
||||
}
|
|
@ -39,13 +39,13 @@ import net.pierrox.lightning_launcher.LLApp;
|
|||
import net.pierrox.lightning_launcher.Version;
|
||||
import net.pierrox.lightning_launcher.activities.Customize;
|
||||
import net.pierrox.lightning_launcher.activities.Dashboard;
|
||||
import net.pierrox.lightning_launcher.activities.RootSettings;
|
||||
import net.pierrox.lightning_launcher.api.ScreenIdentity;
|
||||
import net.pierrox.lightning_launcher.data.ContainerPath;
|
||||
import net.pierrox.lightning_launcher.data.LightningIntent;
|
||||
import net.pierrox.lightning_launcher.data.Page;
|
||||
import net.pierrox.lightning_launcher.data.Utils;
|
||||
import net.pierrox.lightning_launcher.engine.Screen;
|
||||
import net.pierrox.lightning_launcher.feature.settings.RootSettings;
|
||||
import net.pierrox.lightning_launcher.prefs.LLPreference;
|
||||
import net.pierrox.lightning_launcher.views.ItemLayout;
|
||||
import net.pierrox.lightning_launcher_extreme.R;
|
||||
|
|
|
@ -43,7 +43,6 @@ import net.pierrox.lightning_launcher.activities.AppDrawerX;
|
|||
import net.pierrox.lightning_launcher.activities.BackupRestore;
|
||||
import net.pierrox.lightning_launcher.activities.Customize;
|
||||
import net.pierrox.lightning_launcher.activities.Dashboard;
|
||||
import net.pierrox.lightning_launcher.activities.RootSettings;
|
||||
import net.pierrox.lightning_launcher.activities.ScriptEditor;
|
||||
import net.pierrox.lightning_launcher.configuration.DynamicTextConfig;
|
||||
import net.pierrox.lightning_launcher.configuration.FolderConfig;
|
||||
|
@ -63,6 +62,7 @@ import net.pierrox.lightning_launcher.data.PageProcessor;
|
|||
import net.pierrox.lightning_launcher.data.Shortcut;
|
||||
import net.pierrox.lightning_launcher.data.Utils;
|
||||
import net.pierrox.lightning_launcher.engine.LightningEngine;
|
||||
import net.pierrox.lightning_launcher.feature.settings.RootSettings;
|
||||
import net.pierrox.lightning_launcher.script.ScriptManager;
|
||||
import net.pierrox.lightning_launcher_extreme.BuildConfig;
|
||||
import net.pierrox.lightning_launcher_extreme.R;
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:color="?android:attr/colorControlHighlight">
|
||||
<item android:drawable="@color/bubble_item_bg_normal"/>
|
||||
</ripple>
|
Binary file not shown.
Before Width: | Height: | Size: 1.8 KiB |
18
app/llx/app/src/main/res/drawable/bubble_bg.xml
Normal file
18
app/llx/app/src/main/res/drawable/bubble_bg.xml
Normal file
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item
|
||||
android:right="8dp"
|
||||
android:left="8dp"
|
||||
android:top="8dp"
|
||||
android:bottom="8dp">
|
||||
<shape>
|
||||
<padding
|
||||
android:bottom="8dp"
|
||||
android:left="8dp"
|
||||
android:top="8dp"
|
||||
android:right="8dp" />
|
||||
<corners android:radius="8dp" />
|
||||
<solid android:color="?android:colorBackgroundFloating" />
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_pressed="true" android:drawable="@color/bubble_item_bg_pressed"/>
|
||||
<item android:drawable="@android:color/transparent"/>
|
||||
</selector>
|
||||
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:color="?android:attr/colorControlHighlight">
|
||||
<item android:drawable="?colorBackgroundFloating" />
|
||||
</ripple>
|
18
app/llx/app/src/main/res/layout/activity_settings.xml
Normal file
18
app/llx/app/src/main/res/layout/activity_settings.xml
Normal file
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/ThemeOverlay.AppCompat" />
|
||||
|
||||
<androidx.fragment.app.FragmentContainerView
|
||||
android:id="@+id/fragment_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</LinearLayout>
|
|
@ -1,11 +1,12 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<net.pierrox.lightning_launcher.views.BubbleLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<net.pierrox.lightning_launcher.views.BubbleLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/bubble"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="gone"
|
||||
android:elevation="9dp">
|
||||
android:elevation="9dp"
|
||||
tools:visibility="visible">
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -29,7 +30,8 @@
|
|||
android:id="@+id/bbl_ttl"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/bbl_ttl" />
|
||||
style="@style/bbl_ttl"
|
||||
tools:text="Test" />
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1px"
|
||||
|
@ -49,7 +51,7 @@
|
|||
<Button
|
||||
android:id="@+id/bbl_edit"
|
||||
android:text="O"
|
||||
style="@style/bubble_item_icon"/>
|
||||
style="@style/bubble_item_icon" />
|
||||
<Button
|
||||
android:id="@+id/bbl_add"
|
||||
android:text="7"
|
||||
|
|
|
@ -1,7 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" >
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<net.pierrox.lightning_launcher.views.MyViewPager
|
||||
android:id="@+id/view_pager"
|
||||
|
@ -66,4 +72,4 @@
|
|||
|
||||
</net.pierrox.lightning_launcher.views.MyViewPager>
|
||||
|
||||
</FrameLayout>
|
||||
</LinearLayout>
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<merge
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
|
@ -129,7 +129,8 @@
|
|||
android:orientation="vertical"
|
||||
android:gravity="center_horizontal"
|
||||
style="@style/bubble_bg"
|
||||
android:visibility="gone">
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
@ -210,6 +211,7 @@
|
|||
android:orientation="vertical"
|
||||
android:layout_gravity="bottom"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"
|
||||
style="@style/bubble_bg">
|
||||
|
||||
<LinearLayout
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<item name="android:paddingLeft">12dip</item>
|
||||
<item name="android:paddingRight">12dip</item>
|
||||
<item name="android:gravity">left|center_vertical</item>
|
||||
<item name="android:textColor">#262626</item>
|
||||
<item name="android:textColor">?android:colorForeground</item>
|
||||
</style>
|
||||
|
||||
<style name="bubble_item_icon" parent="bubble_item">
|
||||
|
@ -19,6 +19,7 @@
|
|||
<item name="android:padding">@null</item>
|
||||
<item name="android:textSize">18dp</item>
|
||||
<item name="android:gravity">center</item>
|
||||
<item name="android:textColor">?android:colorForeground</item>
|
||||
</style>
|
||||
|
||||
<style name="bbl_ttl_base">
|
||||
|
@ -129,22 +130,24 @@
|
|||
<style name="ab_text" parent="@android:style/TextAppearance.Material.Widget.ActionBar.Title.Inverse" />
|
||||
|
||||
<style name="bubble_bg">
|
||||
<item name="android:background">@drawable/bubble_v13</item>
|
||||
<item name="android:background">@drawable/bubble_bg</item>
|
||||
</style>
|
||||
|
||||
<style name="bubble_arrow_up_bg">
|
||||
<item name="android:src">@drawable/arrow_up_v13</item>
|
||||
<item name="tint">?colorBackgroundFloating</item>
|
||||
</style>
|
||||
|
||||
<style name="bubble_arrow_down_bg">
|
||||
<item name="android:src">@drawable/arrow_down_v13</item>
|
||||
<item name="tint">?colorBackgroundFloating</item>
|
||||
</style>
|
||||
|
||||
<style name="sc_text" parent="sc_text_base">
|
||||
<item name="android:background">@null</item>
|
||||
</style>
|
||||
|
||||
<style name="AppDialog" parent="android:Theme.Material.Light.Dialog.NoActionBar">
|
||||
<style name="AppDialog" parent="Theme.AppCompat.DayNight.Dialog">
|
||||
<item name="android:colorPrimary">@color/color_primary</item>
|
||||
<item name="android:colorPrimaryDark">@color/color_primary_dark</item>
|
||||
<item name="android:colorAccent">@color/color_accent</item>
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
<intent
|
||||
android:action="android.intent.action.VIEW"
|
||||
android:targetPackage="net.pierrox.lightning_launcher_extreme"
|
||||
android:targetClass="net.pierrox.lightning_launcher.activities.RootSettings" />
|
||||
android:targetClass="net.pierrox.lightning_launcher.feature.settings.RootSettings" />
|
||||
</shortcut>
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
plugins {
|
||||
alias(libs.plugins.androlib)
|
||||
alias(libs.plugins.kotlin)
|
||||
}
|
||||
|
||||
android {
|
||||
|
@ -32,6 +33,15 @@ android {
|
|||
}
|
||||
}
|
||||
namespace 'net.pierrox.lightning_launcher'
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_11
|
||||
targetCompatibility JavaVersion.VERSION_11
|
||||
}
|
||||
|
||||
kotlinOptions {
|
||||
jvmTarget = '11'
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
|
|
@ -52,7 +52,8 @@ public class WidgetView extends ItemView {
|
|||
AppWidgetProviderInfo app_widget_info=app_widget_manager.getAppWidgetInfo(mAppWidgetId);
|
||||
|
||||
if(app_widget_info != null) {
|
||||
AppWidgetHostView app_widget_host_view=LLApp.get().getAppWidgetHost().getWidgetView(context, mAppWidgetId, app_widget_info);
|
||||
// Application context is needed with AppCompat theme for properly inflating RemoteViews
|
||||
AppWidgetHostView app_widget_host_view = LLApp.get().getAppWidgetHost().getWidgetView(context.getApplicationContext(), mAppWidgetId, app_widget_info);
|
||||
app_widget_host_view.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
|
||||
app_widget_host_view.setAppWidget(mAppWidgetId, app_widget_info);
|
||||
// used to store last widget size, in order to filter calls to updateAppWidgetHostViewSize
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<style name="AppDark" parent="@style/Theme.AppCompat.NoActionBar">
|
||||
<style name="AppDark" parent="@style/Theme.AppCompat.DayNight.NoActionBar">
|
||||
<item name="colorPrimary">@color/color_primary</item>
|
||||
<item name="colorPrimaryDark">@color/color_primary_dark</item>
|
||||
<item name="colorAccent">@color/color_accent</item>
|
||||
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
|
||||
</style>
|
||||
|
||||
<style name="AppLight" parent="@style/Theme.AppCompat.Light.NoActionBar">
|
||||
<style name="AppLight" parent="@style/Theme.AppCompat.DayNight.NoActionBar">
|
||||
<item name="colorPrimary">@color/color_primary</item>
|
||||
<item name="colorPrimaryDark">@color/color_primary_dark</item>
|
||||
<item name="colorAccent">@color/color_accent</item>
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<resources>
|
||||
|
||||
<style name="AppDark" parent="@style/Theme.AppCompat.NoActionBar">
|
||||
<style name="AppDark" parent="@style/Theme.AppCompat.DayNight.NoActionBar">
|
||||
<item name="colorPrimary">@color/color_primary</item>
|
||||
<item name="colorPrimaryDark">@color/color_primary_dark</item>
|
||||
<item name="colorAccent">@color/color_accent</item>
|
||||
</style>
|
||||
|
||||
<style name="AppLight" parent="@style/Theme.AppCompat.Light.NoActionBar">
|
||||
<style name="AppLight" parent="@style/Theme.AppCompat.DayNight.NoActionBar">
|
||||
<item name="colorPrimary">@color/color_primary</item>
|
||||
<item name="colorPrimaryDark">@color/color_primary_dark</item>
|
||||
<item name="colorAccent">@color/color_accent</item>
|
||||
|
|
|
@ -16,6 +16,7 @@ parceler-compiler = { module = "org.parceler:parceler", version.ref = "parceler_
|
|||
|
||||
androidx-appcomat = { module = "androidx.appcompat:appcompat", version = "1.6.1" }
|
||||
androidx-material = { module = "com.google.android.material:material", version = "1.9.0" }
|
||||
androidx-preference = { module = "androidx.preference:preference", version = "1.2.0" }
|
||||
|
||||
flows = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version = "1.7.3" }
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
plugins {
|
||||
alias(libs.plugins.androlib)
|
||||
alias(libs.plugins.kotlin)
|
||||
}
|
||||
|
||||
android {
|
||||
|
@ -12,6 +13,15 @@ android {
|
|||
}
|
||||
namespace 'net.pierrox.lightning_launcher.plugin'
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_11
|
||||
targetCompatibility JavaVersion.VERSION_11
|
||||
}
|
||||
|
||||
kotlinOptions {
|
||||
jvmTarget = '11'
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
|
Loading…
Add table
Reference in a new issue