Remove module repo
This commit is contained in:
parent
a7255a180f
commit
49629ed1a7
|
|
@ -13,16 +13,13 @@ import android.os.Handler;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
|
||||||
import androidx.preference.PreferenceManager;
|
import androidx.preference.PreferenceManager;
|
||||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
|
||||||
|
|
||||||
import org.meowcat.edxposed.manager.adapters.AppHelper;
|
import org.meowcat.edxposed.manager.adapters.AppHelper;
|
||||||
import org.meowcat.edxposed.manager.receivers.PackageChangeReceiver;
|
import org.meowcat.edxposed.manager.receivers.PackageChangeReceiver;
|
||||||
import org.meowcat.edxposed.manager.ui.activity.CrashReportActivity;
|
import org.meowcat.edxposed.manager.ui.activity.CrashReportActivity;
|
||||||
import org.meowcat.edxposed.manager.util.ModuleUtil;
|
import org.meowcat.edxposed.manager.util.ModuleUtil;
|
||||||
import org.meowcat.edxposed.manager.util.NotificationUtil;
|
import org.meowcat.edxposed.manager.util.NotificationUtil;
|
||||||
import org.meowcat.edxposed.manager.util.RepoLoader;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
|
|
@ -40,7 +37,7 @@ public class App extends Application implements Application.ActivityLifecycleCal
|
||||||
private static Thread uiThread;
|
private static Thread uiThread;
|
||||||
private static Handler mainHandler;
|
private static Handler mainHandler;
|
||||||
private SharedPreferences pref;
|
private SharedPreferences pref;
|
||||||
private AppCompatActivity currentActivity = null;
|
//private AppCompatActivity currentActivity = null;
|
||||||
private boolean isUiLoaded = false;
|
private boolean isUiLoaded = false;
|
||||||
|
|
||||||
public static App getInstance() {
|
public static App getInstance() {
|
||||||
|
|
@ -124,7 +121,7 @@ public class App extends Application implements Application.ActivityLifecycleCal
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RepoLoader.getInstance().triggerFirstLoadIfNecessary();
|
//RepoLoader.getInstance().triggerFirstLoadIfNecessary();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void registerReceivers() {
|
private void registerReceivers() {
|
||||||
|
|
@ -145,25 +142,26 @@ public class App extends Application implements Application.ActivityLifecycleCal
|
||||||
mkdir("log");
|
mkdir("log");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateProgressIndicator(final SwipeRefreshLayout refreshLayout) {
|
/*
|
||||||
final boolean isLoading = RepoLoader.getInstance().isLoading() || ModuleUtil.getInstance().isLoading();
|
public void updateProgressIndicator(final SwipeRefreshLayout refreshLayout) {
|
||||||
runOnUiThread(() -> {
|
final boolean isLoading = RepoLoader.getInstance().isLoading() || ModuleUtil.getInstance().isLoading();
|
||||||
synchronized (App.this) {
|
runOnUiThread(() -> {
|
||||||
if (currentActivity != null) {
|
synchronized (App.this) {
|
||||||
if (refreshLayout != null)
|
if (currentActivity != null) {
|
||||||
refreshLayout.setRefreshing(isLoading);
|
if (refreshLayout != null)
|
||||||
|
refreshLayout.setRefreshing(isLoading);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
}
|
||||||
}
|
*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public synchronized void onActivityCreated(@NonNull Activity activity, Bundle savedInstanceState) {
|
public synchronized void onActivityCreated(@NonNull Activity activity, Bundle savedInstanceState) {
|
||||||
if (isUiLoaded) {
|
if (isUiLoaded) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
RepoLoader.getInstance().triggerFirstLoadIfNecessary();
|
//RepoLoader.getInstance().triggerFirstLoadIfNecessary();
|
||||||
isUiLoaded = true;
|
isUiLoaded = true;
|
||||||
|
|
||||||
if (pref.getBoolean("hook_modules", true)) {
|
if (pref.getBoolean("hook_modules", true)) {
|
||||||
|
|
@ -184,13 +182,13 @@ public class App extends Application implements Application.ActivityLifecycleCal
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public synchronized void onActivityResumed(@NonNull Activity activity) {
|
public synchronized void onActivityResumed(@NonNull Activity activity) {
|
||||||
currentActivity = (AppCompatActivity) activity;
|
//currentActivity = (AppCompatActivity) activity;
|
||||||
updateProgressIndicator(null);
|
//updateProgressIndicator(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public synchronized void onActivityPaused(@NonNull Activity activity) {
|
public synchronized void onActivityPaused(@NonNull Activity activity) {
|
||||||
currentActivity = null;
|
//currentActivity = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -218,6 +218,11 @@ public class DownloadActivity extends BaseActivity implements RepoLoader.RepoLis
|
||||||
reloadItems();
|
reloadItems();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onModuleEnableChange(ModuleUtil moduleUtil) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
|
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
|
||||||
changed = true;
|
changed = true;
|
||||||
|
|
|
||||||
|
|
@ -159,6 +159,11 @@ public class DownloadDetailsActivity extends BaseActivity implements RepoLoader.
|
||||||
reload();
|
reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onModuleEnableChange(ModuleUtil moduleUtil) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSingleInstalledModuleReloaded(ModuleUtil moduleUtil, String packageName, ModuleUtil.InstalledModule module) {
|
public void onSingleInstalledModuleReloaded(ModuleUtil moduleUtil, String packageName, ModuleUtil.InstalledModule module) {
|
||||||
if (this.packageName.equals(packageName))
|
if (this.packageName.equals(packageName))
|
||||||
|
|
|
||||||
|
|
@ -17,12 +17,11 @@ import org.meowcat.edxposed.manager.adapters.BlackListAdapter;
|
||||||
import org.meowcat.edxposed.manager.databinding.ActivityMainBinding;
|
import org.meowcat.edxposed.manager.databinding.ActivityMainBinding;
|
||||||
import org.meowcat.edxposed.manager.util.GlideHelper;
|
import org.meowcat.edxposed.manager.util.GlideHelper;
|
||||||
import org.meowcat.edxposed.manager.util.ModuleUtil;
|
import org.meowcat.edxposed.manager.util.ModuleUtil;
|
||||||
import org.meowcat.edxposed.manager.util.RepoLoader;
|
|
||||||
import org.meowcat.edxposed.manager.util.light.Light;
|
import org.meowcat.edxposed.manager.util.light.Light;
|
||||||
|
|
||||||
public class MainActivity extends BaseActivity implements RepoLoader.RepoListener, ModuleUtil.ModuleListener {
|
public class MainActivity extends BaseActivity implements /*RepoLoader.RepoListener, */ModuleUtil.ModuleListener {
|
||||||
ActivityMainBinding binding;
|
ActivityMainBinding binding;
|
||||||
private RepoLoader repoLoader;
|
//private RepoLoader repoLoader;
|
||||||
|
|
||||||
@SuppressLint("PrivateResource")
|
@SuppressLint("PrivateResource")
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -34,23 +33,23 @@ public class MainActivity extends BaseActivity implements RepoLoader.RepoListene
|
||||||
if (Light.setLightSourceAlpha(getWindow().getDecorView(), 0.01f, 0.029f)) {
|
if (Light.setLightSourceAlpha(getWindow().getDecorView(), 0.01f, 0.029f)) {
|
||||||
binding.status.setElevation(24);
|
binding.status.setElevation(24);
|
||||||
binding.modules.setElevation(12);
|
binding.modules.setElevation(12);
|
||||||
binding.downloads.setElevation(12);
|
//binding.downloads.setElevation(12);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
setupWindowInsets(binding.snackbar, null);
|
setupWindowInsets(binding.snackbar, null);
|
||||||
repoLoader = RepoLoader.getInstance();
|
//repoLoader = RepoLoader.getInstance();
|
||||||
ModuleUtil.getInstance().addListener(this);
|
ModuleUtil.getInstance().addListener(this);
|
||||||
repoLoader.addListener(this, false);
|
//repoLoader.addListener(this, false);
|
||||||
binding.modules.setOnClickListener(v -> {
|
binding.modules.setOnClickListener(v -> {
|
||||||
Intent intent = new Intent();
|
Intent intent = new Intent();
|
||||||
intent.setClass(getApplicationContext(), ModulesActivity.class);
|
intent.setClass(getApplicationContext(), ModulesActivity.class);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
});
|
});
|
||||||
binding.downloads.setOnClickListener(v -> {
|
/*binding.downloads.setOnClickListener(v -> {
|
||||||
Intent intent = new Intent();
|
Intent intent = new Intent();
|
||||||
intent.setClass(getApplicationContext(), DownloadActivity.class);
|
intent.setClass(getApplicationContext(), DownloadActivity.class);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
});
|
});*/
|
||||||
binding.apps.setOnClickListener(v -> {
|
binding.apps.setOnClickListener(v -> {
|
||||||
Intent intent = new Intent();
|
Intent intent = new Intent();
|
||||||
intent.setClass(getApplicationContext(), BlackListActivity.class);
|
intent.setClass(getApplicationContext(), BlackListActivity.class);
|
||||||
|
|
@ -110,22 +109,12 @@ public class MainActivity extends BaseActivity implements RepoLoader.RepoListene
|
||||||
binding.status.setCardBackgroundColor(ContextCompat.getColor(this, R.color.colorPrimary));
|
binding.status.setCardBackgroundColor(ContextCompat.getColor(this, R.color.colorPrimary));
|
||||||
binding.statusIcon.setImageResource(R.drawable.ic_error);
|
binding.statusIcon.setImageResource(R.drawable.ic_error);
|
||||||
}
|
}
|
||||||
notifyDataSetChanged();
|
//notifyDataSetChanged();
|
||||||
|
binding.modulesSummary.setText(String.format(getString(R.string.ModulesDetail), ModuleUtil.getInstance().getEnabledModules().size()));
|
||||||
new Thread(() -> new BlackListAdapter(getApplicationContext(), AppHelper.isWhiteListMode()).generateCheckedList());
|
new Thread(() -> new BlackListAdapter(getApplicationContext(), AppHelper.isWhiteListMode()).generateCheckedList());
|
||||||
}
|
}
|
||||||
|
|
||||||
private int extractIntPart(String str) {
|
/*
|
||||||
int result = 0, length = str.length();
|
|
||||||
for (int offset = 0; offset < length; offset++) {
|
|
||||||
char c = str.charAt(offset);
|
|
||||||
if ('0' <= c && c <= '9')
|
|
||||||
result = result * 10 + (c - '0');
|
|
||||||
else
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void notifyDataSetChanged() {
|
private void notifyDataSetChanged() {
|
||||||
runOnUiThread(() -> {
|
runOnUiThread(() -> {
|
||||||
String frameworkUpdateVersion = repoLoader.getFrameworkUpdateVersion();
|
String frameworkUpdateVersion = repoLoader.getFrameworkUpdateVersion();
|
||||||
|
|
@ -142,28 +131,33 @@ public class MainActivity extends BaseActivity implements RepoLoader.RepoListene
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onInstalledModulesReloaded(ModuleUtil moduleUtil) {
|
public void onInstalledModulesReloaded(ModuleUtil moduleUtil) {
|
||||||
notifyDataSetChanged();
|
//notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onModuleEnableChange(ModuleUtil moduleUtil) {
|
||||||
|
binding.modulesSummary.setText(String.format(getString(R.string.ModulesDetail), moduleUtil.getEnabledModules().size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSingleInstalledModuleReloaded(ModuleUtil moduleUtil, String packageName, ModuleUtil.InstalledModule module) {
|
public void onSingleInstalledModuleReloaded(ModuleUtil moduleUtil, String packageName, ModuleUtil.InstalledModule module) {
|
||||||
notifyDataSetChanged();
|
//notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
/*@Override
|
||||||
public void onRepoReloaded(RepoLoader loader) {
|
public void onRepoReloaded(RepoLoader loader) {
|
||||||
notifyDataSetChanged();
|
notifyDataSetChanged();
|
||||||
}
|
}*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDestroy() {
|
protected void onDestroy() {
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
ModuleUtil.getInstance().removeListener(this);
|
ModuleUtil.getInstance().removeListener(this);
|
||||||
repoLoader.removeListener(this);
|
//repoLoader.removeListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,22 +32,13 @@ import org.meowcat.edxposed.manager.BuildConfig;
|
||||||
import org.meowcat.edxposed.manager.Constants;
|
import org.meowcat.edxposed.manager.Constants;
|
||||||
import org.meowcat.edxposed.manager.R;
|
import org.meowcat.edxposed.manager.R;
|
||||||
import org.meowcat.edxposed.manager.databinding.ActivityModulesBinding;
|
import org.meowcat.edxposed.manager.databinding.ActivityModulesBinding;
|
||||||
import org.meowcat.edxposed.manager.repo.Module;
|
|
||||||
import org.meowcat.edxposed.manager.repo.ModuleVersion;
|
|
||||||
import org.meowcat.edxposed.manager.repo.ReleaseType;
|
|
||||||
import org.meowcat.edxposed.manager.repo.RepoDb;
|
|
||||||
import org.meowcat.edxposed.manager.util.GlideApp;
|
import org.meowcat.edxposed.manager.util.GlideApp;
|
||||||
import org.meowcat.edxposed.manager.util.InstallApkUtil;
|
import org.meowcat.edxposed.manager.util.InstallApkUtil;
|
||||||
import org.meowcat.edxposed.manager.util.LinearLayoutManagerFix;
|
import org.meowcat.edxposed.manager.util.LinearLayoutManagerFix;
|
||||||
import org.meowcat.edxposed.manager.util.ModuleUtil;
|
import org.meowcat.edxposed.manager.util.ModuleUtil;
|
||||||
import org.meowcat.edxposed.manager.util.NavUtil;
|
|
||||||
import org.meowcat.edxposed.manager.util.RepoLoader;
|
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
|
|
@ -288,7 +279,7 @@ public class ModulesActivity extends BaseActivity implements ModuleUtil.ModuleLi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (requestCode == 44) {
|
}/* else if (requestCode == 44) {
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
Uri uri = data.getData();
|
Uri uri = data.getData();
|
||||||
if (uri != null) {
|
if (uri != null) {
|
||||||
|
|
@ -299,7 +290,7 @@ public class ModulesActivity extends BaseActivity implements ModuleUtil.ModuleLi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -340,51 +331,52 @@ public class ModulesActivity extends BaseActivity implements ModuleUtil.ModuleLi
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void importModules(Uri uri) {
|
/*
|
||||||
RepoLoader repoLoader = RepoLoader.getInstance();
|
private void importModules(Uri uri) {
|
||||||
List<Module> list = new ArrayList<>();
|
RepoLoader repoLoader = RepoLoader.getInstance();
|
||||||
|
List<Module> list = new ArrayList<>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
InputStream inputStream = getContentResolver().openInputStream(uri);
|
InputStream inputStream = getContentResolver().openInputStream(uri);
|
||||||
InputStreamReader isr = new InputStreamReader(inputStream);
|
InputStreamReader isr = new InputStreamReader(inputStream);
|
||||||
BufferedReader br = new BufferedReader(isr);
|
BufferedReader br = new BufferedReader(isr);
|
||||||
String line;
|
String line;
|
||||||
while ((line = br.readLine()) != null) {
|
while ((line = br.readLine()) != null) {
|
||||||
Module m = repoLoader.getModule(line);
|
Module m = repoLoader.getModule(line);
|
||||||
|
|
||||||
if (m == null) {
|
if (m == null) {
|
||||||
Snackbar.make(binding.snackbar, getString(R.string.download_details_not_found, line), Snackbar.LENGTH_SHORT).show();
|
Snackbar.make(binding.snackbar, getString(R.string.download_details_not_found, line), Snackbar.LENGTH_SHORT).show();
|
||||||
} else {
|
} else {
|
||||||
list.add(m);
|
list.add(m);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
br.close();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
br.close();
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
for (final Module m : list) {
|
for (final Module m : list) {
|
||||||
if (moduleUtil.getModule(m.packageName) != null) {
|
if (moduleUtil.getModule(m.packageName) != null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
ModuleVersion mv = null;
|
ModuleVersion mv = null;
|
||||||
for (int i = 0; i < m.versions.size(); i++) {
|
for (int i = 0; i < m.versions.size(); i++) {
|
||||||
ModuleVersion mvTemp = m.versions.get(i);
|
ModuleVersion mvTemp = m.versions.get(i);
|
||||||
|
|
||||||
if (mvTemp.relType == ReleaseType.STABLE) {
|
if (mvTemp.relType == ReleaseType.STABLE) {
|
||||||
mv = mvTemp;
|
mv = mvTemp;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mv != null) {
|
||||||
|
NavUtil.startURL(this, mv.downloadLink);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mv != null) {
|
ModuleUtil.getInstance().reloadInstalledModules();
|
||||||
NavUtil.startURL(this, mv.downloadLink);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
ModuleUtil.getInstance().reloadInstalledModules();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
|
|
@ -405,6 +397,11 @@ public class ModulesActivity extends BaseActivity implements ModuleUtil.ModuleLi
|
||||||
runOnUiThread(reloadModules);
|
runOnUiThread(reloadModules);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onModuleEnableChange(ModuleUtil moduleUtil) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextItemSelected(@NonNull MenuItem item) {
|
public boolean onContextItemSelected(@NonNull MenuItem item) {
|
||||||
ModuleUtil.InstalledModule module = ModuleUtil.getInstance().getModule(selectedPackageName);
|
ModuleUtil.InstalledModule module = ModuleUtil.getInstance().getModule(selectedPackageName);
|
||||||
|
|
@ -424,14 +421,14 @@ public class ModulesActivity extends BaseActivity implements ModuleUtil.ModuleLi
|
||||||
Snackbar.make(binding.snackbar, R.string.module_no_ui, Snackbar.LENGTH_LONG).show();
|
Snackbar.make(binding.snackbar, R.string.module_no_ui, Snackbar.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} else if (itemId == R.id.menu_download_updates) {
|
/*} else if (itemId == R.id.menu_download_updates) {
|
||||||
Intent intent = new Intent(this, DownloadDetailsActivity.class);
|
Intent intent = new Intent(this, DownloadDetailsActivity.class);
|
||||||
intent.setData(Uri.fromParts("package", module.packageName, null));
|
intent.setData(Uri.fromParts("package", module.packageName, null));
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
return true;
|
return true;
|
||||||
} else if (itemId == R.id.menu_support) {
|
} else if (itemId == R.id.menu_support) {
|
||||||
NavUtil.startURL(this, Uri.parse(RepoDb.getModuleSupport(module.packageName)));
|
//NavUtil.startURL(this, Uri.parse(RepoDb.getModuleSupport(module.packageName)));
|
||||||
return true;
|
return true;*/
|
||||||
} else if (itemId == R.id.menu_app_store) {
|
} else if (itemId == R.id.menu_app_store) {
|
||||||
Uri uri = Uri.parse("market://details?id=" + module.packageName);
|
Uri uri = Uri.parse("market://details?id=" + module.packageName);
|
||||||
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
|
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
|
||||||
|
|
@ -538,7 +535,7 @@ public class ModulesActivity extends BaseActivity implements ModuleUtil.ModuleLi
|
||||||
|
|
||||||
holder.itemView.setOnCreateContextMenuListener((menu, v, menuInfo) -> {
|
holder.itemView.setOnCreateContextMenuListener((menu, v, menuInfo) -> {
|
||||||
getMenuInflater().inflate(R.menu.context_menu_modules, menu);
|
getMenuInflater().inflate(R.menu.context_menu_modules, menu);
|
||||||
ModuleUtil.InstalledModule installedModule = ModuleUtil.getInstance().getModule(item.packageName);
|
/*ModuleUtil.InstalledModule installedModule = ModuleUtil.getInstance().getModule(item.packageName);
|
||||||
if (installedModule == null) {
|
if (installedModule == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -555,7 +552,7 @@ public class ModulesActivity extends BaseActivity implements ModuleUtil.ModuleLi
|
||||||
menu.removeItem(R.id.menu_launch);
|
menu.removeItem(R.id.menu_launch);
|
||||||
menu.removeItem(R.id.menu_scope);
|
menu.removeItem(R.id.menu_scope);
|
||||||
menu.removeItem(R.id.menu_uninstall);
|
menu.removeItem(R.id.menu_uninstall);
|
||||||
}
|
}*/
|
||||||
});
|
});
|
||||||
holder.appName.setText(item.getAppName());
|
holder.appName.setText(item.getAppName());
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@ import org.meowcat.edxposed.manager.Constants;
|
||||||
import org.meowcat.edxposed.manager.R;
|
import org.meowcat.edxposed.manager.R;
|
||||||
import org.meowcat.edxposed.manager.databinding.ActivitySettingsBinding;
|
import org.meowcat.edxposed.manager.databinding.ActivitySettingsBinding;
|
||||||
import org.meowcat.edxposed.manager.ui.widget.IntegerListPreference;
|
import org.meowcat.edxposed.manager.ui.widget.IntegerListPreference;
|
||||||
import org.meowcat.edxposed.manager.util.RepoLoader;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
|
|
@ -112,7 +111,7 @@ public class SettingsActivity extends BaseActivity {
|
||||||
@Override
|
@Override
|
||||||
public void onCreatePreferencesFix(Bundle savedInstanceState, String rootKey) {
|
public void onCreatePreferencesFix(Bundle savedInstanceState, String rootKey) {
|
||||||
addPreferencesFromResource(R.xml.prefs);
|
addPreferencesFromResource(R.xml.prefs);
|
||||||
|
/*
|
||||||
Preference releaseType = findPreference("release_type_global");
|
Preference releaseType = findPreference("release_type_global");
|
||||||
if (releaseType != null) {
|
if (releaseType != null) {
|
||||||
releaseType.setOnPreferenceChangeListener((preference, newValue) -> {
|
releaseType.setOnPreferenceChangeListener((preference, newValue) -> {
|
||||||
|
|
@ -120,7 +119,7 @@ public class SettingsActivity extends BaseActivity {
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
SwitchPreferenceCompat prefWhiteListMode = findPreference("white_list_switch");
|
SwitchPreferenceCompat prefWhiteListMode = findPreference("white_list_switch");
|
||||||
if (prefWhiteListMode != null) {
|
if (prefWhiteListMode != null) {
|
||||||
prefWhiteListMode.setChecked(Files.exists(whiteListModeFlag));
|
prefWhiteListMode.setChecked(Files.exists(whiteListModeFlag));
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,6 @@ import org.meowcat.edxposed.manager.Constants;
|
||||||
import org.meowcat.edxposed.manager.R;
|
import org.meowcat.edxposed.manager.R;
|
||||||
import org.meowcat.edxposed.manager.databinding.ActivityModulesBinding;
|
import org.meowcat.edxposed.manager.databinding.ActivityModulesBinding;
|
||||||
import org.meowcat.edxposed.manager.repo.ModuleVersion;
|
import org.meowcat.edxposed.manager.repo.ModuleVersion;
|
||||||
import org.meowcat.edxposed.manager.repo.RepoDb;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
|
|
@ -77,9 +76,9 @@ public final class ModuleUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, InstalledModule> modules = new HashMap<>();
|
Map<String, InstalledModule> modules = new HashMap<>();
|
||||||
RepoDb.beginTransation();
|
//RepoDb.beginTransation();
|
||||||
try {
|
try {
|
||||||
RepoDb.deleteAllInstalledModules();
|
//RepoDb.deleteAllInstalledModules();
|
||||||
|
|
||||||
for (PackageInfo pkg : pm.getInstalledPackages(PackageManager.GET_META_DATA)) {
|
for (PackageInfo pkg : pm.getInstalledPackages(PackageManager.GET_META_DATA)) {
|
||||||
ApplicationInfo app = pkg.applicationInfo;
|
ApplicationInfo app = pkg.applicationInfo;
|
||||||
|
|
@ -94,13 +93,13 @@ public final class ModuleUtil {
|
||||||
framework = installed = new InstalledModule(pkg, true);
|
framework = installed = new InstalledModule(pkg, true);
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
if (installed != null)
|
//if (installed != null)
|
||||||
RepoDb.insertInstalledModule(installed);
|
// RepoDb.insertInstalledModule(installed);
|
||||||
}
|
}
|
||||||
|
|
||||||
RepoDb.setTransactionSuccessful();
|
//RepoDb.setTransactionSuccessful();
|
||||||
} finally {
|
} finally {
|
||||||
RepoDb.endTransation();
|
//RepoDb.endTransation();
|
||||||
}
|
}
|
||||||
|
|
||||||
installedModules = modules;
|
installedModules = modules;
|
||||||
|
|
@ -117,7 +116,7 @@ public final class ModuleUtil {
|
||||||
try {
|
try {
|
||||||
pkg = pm.getPackageInfo(packageName, PackageManager.GET_META_DATA);
|
pkg = pm.getPackageInfo(packageName, PackageManager.GET_META_DATA);
|
||||||
} catch (NameNotFoundException e) {
|
} catch (NameNotFoundException e) {
|
||||||
RepoDb.deleteInstalledModule(packageName);
|
//RepoDb.deleteInstalledModule(packageName);
|
||||||
InstalledModule old = installedModules.remove(packageName);
|
InstalledModule old = installedModules.remove(packageName);
|
||||||
if (old != null) {
|
if (old != null) {
|
||||||
for (ModuleListener listener : listeners) {
|
for (ModuleListener listener : listeners) {
|
||||||
|
|
@ -130,7 +129,7 @@ public final class ModuleUtil {
|
||||||
ApplicationInfo app = pkg.applicationInfo;
|
ApplicationInfo app = pkg.applicationInfo;
|
||||||
if (app.enabled && app.metaData != null && app.metaData.containsKey("xposedmodule")) {
|
if (app.enabled && app.metaData != null && app.metaData.containsKey("xposedmodule")) {
|
||||||
InstalledModule module = new InstalledModule(pkg, false);
|
InstalledModule module = new InstalledModule(pkg, false);
|
||||||
RepoDb.insertInstalledModule(module);
|
//RepoDb.insertInstalledModule(module);
|
||||||
installedModules.put(packageName, module);
|
installedModules.put(packageName, module);
|
||||||
for (ModuleListener listener : listeners) {
|
for (ModuleListener listener : listeners) {
|
||||||
listener.onSingleInstalledModuleReloaded(instance, packageName,
|
listener.onSingleInstalledModuleReloaded(instance, packageName,
|
||||||
|
|
@ -138,7 +137,7 @@ public final class ModuleUtil {
|
||||||
}
|
}
|
||||||
return module;
|
return module;
|
||||||
} else {
|
} else {
|
||||||
RepoDb.deleteInstalledModule(packageName);
|
//RepoDb.deleteInstalledModule(packageName);
|
||||||
InstalledModule old = installedModules.remove(packageName);
|
InstalledModule old = installedModules.remove(packageName);
|
||||||
if (old != null) {
|
if (old != null) {
|
||||||
for (ModuleListener listener : listeners) {
|
for (ModuleListener listener : listeners) {
|
||||||
|
|
@ -183,6 +182,9 @@ public final class ModuleUtil {
|
||||||
} else {
|
} else {
|
||||||
pref.edit().remove(packageName).apply();
|
pref.edit().remove(packageName).apply();
|
||||||
}
|
}
|
||||||
|
for (ModuleListener listener : listeners) {
|
||||||
|
listener.onModuleEnableChange(instance);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isModuleEnabled(String packageName) {
|
public boolean isModuleEnabled(String packageName) {
|
||||||
|
|
@ -287,6 +289,8 @@ public final class ModuleUtil {
|
||||||
* Called whenever all installed modules have been reloaded
|
* Called whenever all installed modules have been reloaded
|
||||||
*/
|
*/
|
||||||
void onInstalledModulesReloaded(ModuleUtil moduleUtil);
|
void onInstalledModulesReloaded(ModuleUtil moduleUtil);
|
||||||
|
|
||||||
|
void onModuleEnableChange(ModuleUtil moduleUtil);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class InstalledModule {
|
public class InstalledModule {
|
||||||
|
|
|
||||||
|
|
@ -206,7 +206,7 @@ public class RepoLoader {
|
||||||
return;
|
return;
|
||||||
isLoading = true;
|
isLoading = true;
|
||||||
}
|
}
|
||||||
app.updateProgressIndicator(swipeRefreshLayout);
|
//app.updateProgressIndicator(swipeRefreshLayout);
|
||||||
|
|
||||||
new Thread("RepositoryReload") {
|
new Thread("RepositoryReload") {
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
@ -229,7 +229,7 @@ public class RepoLoader {
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
isLoading = false;
|
isLoading = false;
|
||||||
}
|
}
|
||||||
app.updateProgressIndicator(swipeRefreshLayout);
|
//app.updateProgressIndicator(swipeRefreshLayout);
|
||||||
}
|
}
|
||||||
}.start();
|
}.start();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -172,7 +172,7 @@
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
</com.google.android.material.card.MaterialCardView>
|
</com.google.android.material.card.MaterialCardView>
|
||||||
|
|
||||||
<com.google.android.material.card.MaterialCardView
|
<!-- <com.google.android.material.card.MaterialCardView
|
||||||
android:id="@+id/downloads"
|
android:id="@+id/downloads"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|
@ -222,7 +222,7 @@
|
||||||
android:textColor="@android:color/darker_gray" />
|
android:textColor="@android:color/darker_gray" />
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
</com.google.android.material.card.MaterialCardView>
|
</com.google.android.material.card.MaterialCardView>
|
||||||
|
-->
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/apps"
|
android:id="@+id/apps"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
|
||||||
|
|
@ -7,12 +7,12 @@
|
||||||
<item
|
<item
|
||||||
android:id="@+id/menu_scope"
|
android:id="@+id/menu_scope"
|
||||||
android:title="@string/menu_scope" />
|
android:title="@string/menu_scope" />
|
||||||
<item
|
<!-- <item
|
||||||
android:id="@+id/menu_download_updates"
|
android:id="@+id/menu_download_updates"
|
||||||
android:title="@string/module_download_updates" />
|
android:title="@string/module_download_updates" />
|
||||||
<item
|
<item
|
||||||
android:id="@+id/menu_support"
|
android:id="@+id/menu_support"
|
||||||
android:title="@string/module_support" />
|
android:title="@string/module_support" />-->
|
||||||
<item
|
<item
|
||||||
android:id="@+id/menu_app_store"
|
android:id="@+id/menu_app_store"
|
||||||
android:title="@string/modules_app_store" />
|
android:title="@string/modules_app_store" />
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@
|
||||||
android:title="@string/pure_black_dark_theme"
|
android:title="@string/pure_black_dark_theme"
|
||||||
app:iconSpaceReserved="false" />
|
app:iconSpaceReserved="false" />
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
<PreferenceCategory
|
<!-- <PreferenceCategory
|
||||||
android:title="@string/settings_group_download"
|
android:title="@string/settings_group_download"
|
||||||
app:iconSpaceReserved="false">
|
app:iconSpaceReserved="false">
|
||||||
|
|
||||||
|
|
@ -109,7 +109,7 @@
|
||||||
app:iconSpaceReserved="false" />
|
app:iconSpaceReserved="false" />
|
||||||
|
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
-->
|
||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
android:key="group_framework"
|
android:key="group_framework"
|
||||||
android:title="@string/settings_group_framework"
|
android:title="@string/settings_group_framework"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue