Skip to content

Commit

Permalink
项目模块化
Browse files Browse the repository at this point in the history
  • Loading branch information
Fan095 committed Apr 18, 2024
1 parent a5526f5 commit 6181f53
Show file tree
Hide file tree
Showing 155 changed files with 902 additions and 895 deletions.
26 changes: 2 additions & 24 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ android {
}

dependencies {
implementation project(':common:ui')

compileOnly(project(":hidden-api"))

compileOnly files('libs/miui.jar')
Expand All @@ -155,29 +157,5 @@ dependencies {
implementation libs.gson
implementation libs.commons.codec

implementation libs.core
implementation libs.collection
implementation libs.recyclerview
implementation libs.fragment
implementation libs.lifecycle.common
implementation libs.vectordrawable
implementation libs.vectordrawable.animated
implementation libs.customview
implementation libs.customview.poolingcontainer
implementation (libs.constraintlayout) {
exclude group: 'androidx.appcompat', module: 'appcompat'
}

implementation files(roots.animation)
implementation files(roots.appcompat)
implementation files(roots.core)
implementation files(roots.haptic)
implementation files(roots.preference)
implementation files(roots.smooth)
implementation files(roots.springback)
implementation files(roots.external)
implementation files(roots.graphics)
implementation files(roots.os)

implementation files("libs/hyperceiler_expansion_packs-debug.aar")
}
Binary file removed app/libs/animation-release.aar
Binary file not shown.
Binary file removed app/libs/appcompat-release.aar
Binary file not shown.
Binary file removed app/libs/core-release.aar
Binary file not shown.
Binary file removed app/libs/external-release.aar
Binary file not shown.
Binary file removed app/libs/graphics-release.aar
Binary file not shown.
Binary file removed app/libs/haptic-release.aar
Binary file not shown.
Binary file removed app/libs/navigator-release.aar
Binary file not shown.
Binary file removed app/libs/os-release.aar
Binary file not shown.
Binary file removed app/libs/preference-release.aar
Binary file not shown.
Binary file removed app/libs/smooth-release.aar
Binary file not shown.
Binary file removed app/libs/springback-release.aar
Binary file not shown.
8 changes: 0 additions & 8 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,6 @@
<category android:name="de.robv.android.xposed.category.MODULE_SETTINGS" />
</intent-filter>
</activity>
<!--<activity
android:name=".ui.MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="de.robv.android.xposed.category.MODULE_SETTINGS" />
</intent-filter>
</activity>-->

<activity-alias
android:name=".ui.LauncherActivity"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* This file is part of HyperCeiler.
* HyperCeiler is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
Expand All @@ -22,12 +22,12 @@ import android.content.ComponentName
import com.sevtinge.hyperceiler.module.base.BaseHook
import de.robv.android.xposed.XC_MethodHook
import de.robv.android.xposed.XposedHelpers
import miui.os.Build
import fan.os.BuildCompat

@Suppress("UNCHECKED_CAST")
object DisableHideGoogle : BaseHook() {
override fun init() {
if (Build.IS_INTERNATIONAL_BUILD)
if (BuildCompat.IS_INTERNATIONAL_BUILD)
return

XposedHelpers.findAndHookConstructor(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
import java.util.List;

import de.robv.android.xposed.XposedHelpers;
import fan.core.utils.SystemProperties;
import fan.os.SystemProperties;

public class HyperCeilerSettings extends BaseHook {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import androidx.annotation.Nullable;

import com.sevtinge.hyperceiler.R;
import com.sevtinge.hyperceiler.ui.base.NavigationActivity;
import com.sevtinge.hyperceiler.utils.BackupUtils;
import com.sevtinge.hyperceiler.utils.Helpers;
import com.sevtinge.hyperceiler.utils.PrefsUtils;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,32 +16,30 @@
* Copyright (C) 2023-2024 HyperCeiler Contributions
*/
package com.sevtinge.hyperceiler.ui.base;
package com.sevtinge.hyperceiler.ui;

import android.os.Bundle;

import androidx.annotation.NonNull;

import com.sevtinge.hyperceiler.ui.SubSettings;
import com.sevtinge.hyperceiler.ui.fragment.base.TabNavigatorContentFragment;

import fan.preference.Preference;
import fan.preference.PreferenceFragment;
import fan.preference.internal.compat.PreferenceFragmentCompat;
import fan.preference.core.PreferenceFragmentCompat;

public abstract class NavigationActivity extends SettingsActivity implements PreferenceFragment.OnPreferenceStartFragmentCallback {
public abstract class NavigationActivity extends SettingsActivity {

public abstract int getBottomTabMenu();

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setFragment(new TabNavigatorContentFragment());
/*setRestartView(view -> DialogHelper.showRestartDialog(this));*/
}


@Override
public boolean onPreferenceStartFragment(@NonNull PreferenceFragmentCompat preferenceFragmentCompat, @NonNull Preference preference) {
public boolean onPreferenceStartFragment(@NonNull PreferenceFragmentCompat preferenceFragment, @NonNull Preference preference) {
mProxy.onStartSettingsForArguments(SubSettings.class, preference, false);
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,96 +16,89 @@
* Copyright (C) 2023-2024 HyperCeiler Contributions
*/
package com.sevtinge.hyperceiler.ui.base;
package com.sevtinge.hyperceiler.ui;

import android.app.backup.BackupManager;
import android.content.SharedPreferences;
import android.net.Uri;
import android.os.Bundle;
import android.os.FileObserver;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;

import androidx.annotation.DrawableRes;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.annotation.NonNull;

import com.sevtinge.hyperceiler.R;
import com.fan.common.base.BaseSettingsActivity;
import com.sevtinge.hyperceiler.provider.SharedPrefsProvider;
import com.sevtinge.hyperceiler.ui.fragment.framework.OtherSettings;
import com.sevtinge.hyperceiler.ui.fragment.home.HomeDockSettings;
import com.sevtinge.hyperceiler.ui.fragment.home.HomeFolderSettings;
import com.sevtinge.hyperceiler.ui.fragment.home.HomeGestureSettings;
import com.sevtinge.hyperceiler.ui.fragment.sub.MultiActionSettings;
import com.sevtinge.hyperceiler.ui.fragment.various.AlertDialogSettings;
import com.sevtinge.hyperceiler.utils.Helpers;
import com.sevtinge.hyperceiler.utils.PrefsUtils;

import java.util.Set;

import fan.appcompat.app.AppCompatActivity;
import fan.preference.Preference;
import fan.preference.PreferenceFragment;
import fan.preference.core.PreferenceFragmentCompat;

public abstract class BaseActivity extends AppCompatActivity {
public abstract class SettingsActivity extends BaseSettingsActivity implements PreferenceFragment.OnPreferenceStartFragmentCallback {

protected BaseSettingsProxy mProxy;
SharedPreferences.OnSharedPreferenceChangeListener mSharedPreferenceChangeListener = (sharedPreferences, s) -> {
Log.i("prefs", "Changed: " + s);
requestBackup();
Object val = sharedPreferences.getAll().get(s);
String path = "";
if (val instanceof String)
path = "string/";
else if (val instanceof Set<?>)
path = "stringset/";
else if (val instanceof Integer)
path = "integer/";
else if (val instanceof Boolean)
path = "boolean/";
getContentResolver().notifyChange(Uri.parse("content://" + SharedPrefsProvider.AUTHORITY + "/" + path + s), null);
if (!path.equals("")) getContentResolver().notifyChange(Uri.parse("content://" + SharedPrefsProvider.AUTHORITY + "/pref/" + path + s), null);
};

@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
mProxy = new SettingsProxy(this);
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
initActionBar();
registerObserver();
initCreate();
initActionBar();
}

public void setFragment(Fragment fragment) {
getSupportFragmentManager()
.beginTransaction()
.replace(R.id.frame_content, fragment)
.commit();
}
public void initCreate() {}

protected void initActionBar() {
hideActionBar();
/*setDisplayHomeAsUpEnabled(!(this instanceof NavigationActivity));*/
public void initActionBar() {
getAppCompatActionBar().setDisplayHomeAsUpEnabled(!(this instanceof HyperCeilerTabActivity));
}

protected void hideActionBar() {
getAppCompatActionBar().hide();
public void onStartSettingsForArguments(Preference preference, boolean isBundleEnable) {
mProxy.onStartSettingsForArguments(SubSettings.class, preference, isBundleEnable);
}

/*public void setActionBarEndView(View view) {
getAppCompatActionBar().setEndView(view);
}*/

/*public void setActionBarEndIcon(@DrawableRes int resId, View.OnClickListener listener) {
ImageView mRestartView = new ImageView(this);
mRestartView.setImageResource(resId);
mRestartView.setOnClickListener(listener);
setActionBarEndView(mRestartView);
}*/

/*public void setRestartView(View.OnClickListener listener) {
if (listener != null) setActionBarEndIcon(R.drawable.ic_reboot_small, listener);
}*/
@Override
public boolean onPreferenceStartFragment(@NonNull PreferenceFragmentCompat preferenceFragment, @NonNull Preference preference) {
boolean isBundleEnable = preferenceFragment instanceof OtherSettings ||
preferenceFragment instanceof HomeDockSettings ||
preferenceFragment instanceof HomeFolderSettings ||
preferenceFragment instanceof AlertDialogSettings ||
preferenceFragment instanceof HomeGestureSettings ||
preferenceFragment instanceof MultiActionSettings;
onStartSettingsForArguments(preference, isBundleEnable);
return true;
}

private void registerObserver() {
PrefsUtils.mSharedPreferences.registerOnSharedPreferenceChangeListener(mSharedPreferenceChangeListener);
Helpers.fixPermissionsAsync(getApplicationContext());
registerFileObserver();
}

SharedPreferences.OnSharedPreferenceChangeListener mSharedPreferenceChangeListener = (sharedPreferences, s) -> {
Log.i("prefs", "Changed: " + s);
requestBackup();
Object val = sharedPreferences.getAll().get(s);
String path = "";
if (val instanceof String)
path = "string/";
else if (val instanceof Set<?>)
path = "stringset/";
else if (val instanceof Integer)
path = "integer/";
else if (val instanceof Boolean)
path = "boolean/";
getContentResolver().notifyChange(Uri.parse("content://" + SharedPrefsProvider.AUTHORITY + "/" + path + s), null);
if (!path.equals("")) getContentResolver().notifyChange(Uri.parse("content://" + SharedPrefsProvider.AUTHORITY + "/pref/" + path + s), null);
};

private void registerFileObserver() {
try {
FileObserver mFileObserver = new FileObserver(PrefsUtils.getSharedPrefsPath(), FileObserver.CLOSE_WRITE) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* This file is part of HyperCeiler.
* HyperCeiler is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
Expand All @@ -19,10 +19,8 @@
package com.sevtinge.hyperceiler.ui;

import android.content.Intent;
import android.os.Bundle;

import com.sevtinge.hyperceiler.callback.IAppSelectCallback;
import com.sevtinge.hyperceiler.ui.base.SettingsActivity;
import com.sevtinge.hyperceiler.ui.fragment.sub.AppPicker;

public class SubPickerActivity extends SettingsActivity {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* This file is part of HyperCeiler.
* HyperCeiler is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
Expand All @@ -18,6 +18,4 @@
*/
package com.sevtinge.hyperceiler.ui;

import com.sevtinge.hyperceiler.ui.base.SettingsActivity;

public class SubSettings extends SettingsActivity {}
Loading

0 comments on commit 6181f53

Please sign in to comment.