Skip to content

Commit

Permalink
add provision module
Browse files Browse the repository at this point in the history
  • Loading branch information
Fan095 committed Jan 25, 2025
1 parent ae64b3c commit 0b6eb24
Show file tree
Hide file tree
Showing 111 changed files with 5,419 additions and 61 deletions.
16 changes: 1 addition & 15 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -227,14 +227,6 @@ dependencies {
compileOnly(projects.hiddenApi)
compileOnly(libs.xposed.api)

implementation(libs.core)
implementation(libs.recyclerview)
implementation(libs.fragment)
implementation(libs.coordinatorlayout)
implementation(libs.constraintlayout) {
exclude("androidx.appcompat", "appcompat")
}

implementation(libs.dexkit)
implementation(libs.mmkv)
implementation(libs.ezxhelper)
Expand All @@ -244,13 +236,7 @@ dependencies {
implementation(libs.lyric.getter.api)
implementation(libs.lunarcalendar)

implementation(
fileTree(
mapOf("dir" to "libs", "include" to listOf("*-debug.aar"))
)
)

// implementation(projects.provision)
implementation(projects.provision)
implementation(projects.processor)
annotationProcessor(projects.processor)
}
Binary file removed app/libs/core-debug.aar
Binary file not shown.
3 changes: 2 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@
android:requestLegacyExternalStorage="true"
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:allowNativeHeapPointerTagging="true">
android:allowNativeHeapPointerTagging="true"
android:extractNativeLibs="true">

<activity
android:name=".ui.main.HyperCeilerTabActivity"
Expand Down
80 changes: 44 additions & 36 deletions app/src/main/res/xml/prefs_development.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,42 +20,50 @@

<PreferenceCategory>

<Preference
android:fragment="com.sevtinge.hyperceiler.ui.settings.development.DevelopmentDebugInfoFragment"
android:key="prefs_key_development_debug_info"
android:title="@string/development_debug_info" />

<Preference
android:fragment="com.sevtinge.hyperceiler.ui.settings.development.DevelopmentKillFragment"
android:key="prefs_key_development_kill"
android:title="@string/kill" />

<Preference
android:fragment="com.sevtinge.hyperceiler.ui.settings.development.DevelopmentPrefsFragment"
android:key="prefs_key_development_prefs"
android:title="@string/development_prefs" />

<Preference
android:fragment="com.sevtinge.hyperceiler.ui.settings.development.DevelopmentUIFragment"
android:key="prefs_key_development_ui"
android:title="@string/development_ui" />

<Preference
android:key="prefs_key_development_cmd_r"
android:title="@string/development_cmd_r" />

<Preference
android:key="prefs_key_development_delete_all_dexkit_cache"
android:title="@string/development_delete_all_dexkit_cache" />

<SwitchPreference
android:title="@string/development_close_log_alert_dialog"
android:key="prefs_key_development_close_log_alert_dialog"
android:defaultValue="false" />

<Preference
android:key="prefs_key_development_fix_lsposed_log"
android:title="@string/development_fix_lsposed_log" />
<Preference
android:fragment="com.sevtinge.hyperceiler.ui.settings.development.DevelopmentDebugInfoFragment"
android:key="prefs_key_development_debug_info"
android:title="@string/development_debug_info" />

<Preference
android:fragment="com.sevtinge.hyperceiler.ui.settings.development.DevelopmentKillFragment"
android:key="prefs_key_development_kill"
android:title="@string/kill" />

<Preference
android:fragment="com.sevtinge.hyperceiler.ui.settings.development.DevelopmentPrefsFragment"
android:key="prefs_key_development_prefs"
android:title="@string/development_prefs" />

<Preference
android:fragment="com.sevtinge.hyperceiler.ui.settings.development.DevelopmentUIFragment"
android:key="prefs_key_development_ui"
android:title="@string/development_ui" />

<Preference
android:key="prefs_key_development_oobe"
android:title="Oobe测试">
<intent
android:targetPackage="com.sevtinge.hyperceiler"
android:targetClass="com.sevtinge.provision.activity.ProvisionActivity"/>
</Preference>

<Preference
android:key="prefs_key_development_cmd_r"
android:title="@string/development_cmd_r" />

<Preference
android:key="prefs_key_development_delete_all_dexkit_cache"
android:title="@string/development_delete_all_dexkit_cache" />

<SwitchPreference
android:defaultValue="false"
android:key="prefs_key_development_close_log_alert_dialog"
android:title="@string/development_close_log_alert_dialog" />

<Preference
android:key="prefs_key_development_fix_lsposed_log"
android:title="@string/development_fix_lsposed_log" />

</PreferenceCategory>

Expand Down
8 changes: 7 additions & 1 deletion provision/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ android {

java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
languageVersion = JavaLanguageVersion.of(22)
}
}
}
Expand All @@ -64,4 +64,10 @@ dependencies {
api(libs.constraintlayout) {
exclude("androidx.appcompat", "appcompat")
}

api(
fileTree(
mapOf("dir" to "libs", "include" to listOf("*-debug.aar"))
)
)
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file added provision/libs/core-debug.aar
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file added provision/libs/mgl-debug.aar
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
48 changes: 48 additions & 0 deletions provision/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<application>

<activity
android:theme="@style/ProvisionTheme"
android:name=".activity.ProvisionActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

<activity
android:theme="@style/ProvisionTheme"
android:name=".activity.PermissionSettingsActivity"
android:exported="true"/>

<activity
android:theme="@style/ProvisionTheme"
android:name=".activity.TermsAndStatementActivity"
android:exported="true"/>

<activity
android:theme="@style/ProvisionTheme"
android:name=".activity.BasicSettingsActivity"
android:exported="true"/>

<activity
android:theme="@style/ProvisionTheme"
android:name=".activity.CongratulationActivity"
android:exported="true"/>

<service android:name=".service.ProvisionAnimService"
android:enabled="true"
android:exported="false">
<intent-filter>
<action
android:name="fan.intent.action.OOBSERVICE" />
<category
android:name="android.intent.category.DEFAULT" />
</intent-filter>
</service>
</application>

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
package com.sevtinge.provision.activity;

import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.TextView;

import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;

import com.sevtinge.provision.R;
import com.sevtinge.provision.utils.OobeUtils;
import com.sevtinge.provision.utils.PageIntercepHelper;

public abstract class BaseActivity extends ProvisionBaseActivity {

protected Fragment mFragment;

private boolean mCheckNewJump = true;
private boolean mIsDisableBack = false;

private View.OnClickListener mBackListener = _ -> onBackPressed();

protected abstract Fragment getFragment();
protected abstract String getFragmentTag();

protected abstract int getLogoDrawableId();
protected abstract int getPreviewDrawable();
protected abstract int getTitleStringId();
protected abstract CharSequence getListDescCharSequence();

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (OobeUtils.isProvisioned(this)) {
setResult(-1);
finish();
} else {
mIsDisableBack = getIntent().getBooleanExtra("extra_disable_back", false);
FragmentManager fragmentManager = getSupportFragmentManager();
if (fragmentManager.isDestroyed()) {
setResult(-1);
finish();
} else {
mFragment = fragmentManager.findFragmentByTag(getFragmentTag());
if (mFragment == null) {
FragmentTransaction beginTransaction = fragmentManager.beginTransaction();
mFragment = getFragment();
beginTransaction.replace(R.id.provision_container, mFragment, getFragmentTag());
beginTransaction.commit();
}
if (getTitleStringId() > 0) {
setTitle(getTitleStringId());
} else {
setTitle(getTitleStringText());
}

if (getPreviewDrawable() > 0) {
setPreviewDrawable(getPreviewDrawable());
}
}
}
}

protected String getTitleStringText() {
return "";
}

protected CharSequence getDescriptionContent() {
return null;
}

@Override
protected void onResume() {
super.onResume();
if (mTitle != null) {
mTitle.setTextDirection(OobeUtils.isRTL() ? 4 : 3);
int titleStringId = getTitleStringId();
if (titleStringId > 0) {
mTitle.setText(titleStringId);
}
}
if (mNewBackBtn != null && !mIsDisableBack && !hasPreview()) {
mNewBackBtn.setOnClickListener(mBackListener);
}
if (mFragment != null) {
View description = mFragment.getView().findViewById(R.id.list_description);
if (description != null && (description instanceof TextView)) {
CharSequence listDescCharSequence = getListDescCharSequence();
if (listDescCharSequence != null) {
description.setTextDirection(OobeUtils.isRTL() ? 4 : 3);
TextView textView = (TextView) description;
textView.setText(listDescCharSequence);
description.setVisibility(View.VISIBLE);
} else {
description.setVisibility(View.GONE);
}
}
View view = mFragment.getView().findViewById(R.id.description);
if (view != null && view instanceof TextView) {
CharSequence descriptionContent = getDescriptionContent();
if (!TextUtils.isEmpty(descriptionContent)) {
view.setTextDirection(OobeUtils.isRTL() ? 4 : 3);
((TextView) view).setText(descriptionContent);
view.setVisibility(View.VISIBLE);
} else {
view.setVisibility(View.GONE);
}
}
}
}

protected void additionalProcess() {
setResult(0);
}

@Override
public void onBackPressed() {
if (!mIsDisableBack) {
try {
additionalProcess();
if (!getSupportFragmentManager().isDestroyed()) {
super.onBackPressed();
}
if (mFragment != null) {
mFragment.getClass();
}
} catch (Exception e) {
Log.e("BaseActivity", "ex: " + e.getMessage());
}
}
}

protected void setPreviewDrawable(int id) {
if (mImageView != null) {
setPreviewView(ContextCompat.getDrawable(this, id));
}
}

public void setCheck(boolean jump) {
mCheckNewJump = jump;
}


@Override
public void finish() {
if (PageIntercepHelper.getInstance().isAdapterNewJump(this) && mCheckNewJump) {
PageIntercepHelper.getInstance().sendFinish(this);
setResult(PageIntercepHelper.getInstance().getPlaceHolderCode(this));
} else {
super.finish();
}
}

}
Loading

0 comments on commit 0b6eb24

Please sign in to comment.