From 4fcee6957fa12ca660c8f40a5ff2e091d0d00a99 Mon Sep 17 00:00:00 2001 From: soralis0912 Date: Fri, 19 Jan 2024 18:05:43 +0900 Subject: [PATCH 1/6] add ci --- .github/workflows/release.yml | 45 +++++++++++++++++++++++++++++++++++ gradlew | 0 2 files changed, 45 insertions(+) create mode 100644 .github/workflows/release.yml mode change 100644 => 100755 gradlew diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..19bc4716 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,45 @@ +on: + workflow_dispatch: + branches-ignore: + - '**' + tags: + - 'v*' + create: + branches-ignore: + - '**' + tags: + - 'v*' +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'adopt' + - name: Build with Gradle + run: | + if [[ -n "${{ secrets.KEYSTORE_BASE64 }}" ]]; then + echo "${{ secrets.KEYSTORE_BASE64 }}" | base64 -d > release.keystore + export KEYSTORE_PASSWORD="${{ secrets.KEYSTORE_PASSWORD }}" + export KEY_ALIAS="${{ secrets.KEY_ALIAS }}" + export KEY_PASSWORD="${{ secrets.KEY_PASSWORD }}" + fi + ./gradlew assembleRelease + - name: Get apk path + id: apk-path + run: | + path=$(find **/build/outputs/apk -name '*.apk' -type f | head -1) + echo "::set-output name=path::$path" + - name: Upload apk file + uses: actions/upload-artifact@v1 + with: + name: apk + path: ${{ steps.apk-path.outputs.path }} + - name: Upload Release + uses: ncipollo/release-action@v1 + with: + allowUpdates: true + artifacts: ${{ steps.apk-path.outputs.path }} + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/gradlew b/gradlew old mode 100644 new mode 100755 From 8faccbae0e582fc6288303263e0e65c4cab21cb8 Mon Sep 17 00:00:00 2001 From: soralis Date: Fri, 19 Jan 2024 18:14:36 +0900 Subject: [PATCH 2/6] =?UTF-8?q?=E8=87=AA=E5=8B=95=E7=BD=B2=E5=90=8D?= =?UTF-8?q?=E3=81=AE=E8=A8=AD=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 4438c54b..10a00828 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -15,11 +15,24 @@ android { testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } - + signingConfigs { + debug { + storeFile rootProject.file('debug.keystore') + } + release { + storeFile rootProject.file('release.keystore') + storePassword System.getenv('KEYSTORE_PASSWORD') + keyAlias System.getenv('KEY_ALIAS') + keyPassword System.getenv('KEY_PASSWORD') + } + } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + if (rootProject.file('release.keystore').exists()) { + signingConfig signingConfigs.release + } } } compileOptions { @@ -39,4 +52,4 @@ dependencies { compileOnly 'de.robv.android.xposed:api:82' compileOnly 'de.robv.android.xposed:api:82:sources' implementation 'androidx.browser:browser:1.5.0' -} \ No newline at end of file +} From cdb657ab7b6691d840c034e7445e0d3d80018d98 Mon Sep 17 00:00:00 2001 From: anago <48195751+auag0@users.noreply.github.com> Date: Sat, 20 Jan 2024 00:51:59 +0900 Subject: [PATCH 3/6] =?UTF-8?q?=E3=83=AA=E3=82=BD=E3=83=BC=E3=82=B9?= =?UTF-8?q?=E5=90=8D=E3=81=8B=E3=82=89=E5=8B=95=E7=9A=84=E3=81=AB=E3=83=AA?= =?UTF-8?q?=E3=82=BD=E3=83=BC=E3=82=B9ID=E3=82=92=E5=8F=96=E5=BE=97?= =?UTF-8?q?=E3=81=99=E3=82=8B=E3=82=88=E3=81=86=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/io/github/chipppppppppp/lime/Main.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/io/github/chipppppppppp/lime/Main.java b/app/src/main/java/io/github/chipppppppppp/lime/Main.java index 11ad011c..3cce4b5c 100644 --- a/app/src/main/java/io/github/chipppppppppp/lime/Main.java +++ b/app/src/main/java/io/github/chipppppppppp/lime/Main.java @@ -33,7 +33,9 @@ public void handleLoadPackage(XC_LoadPackage.LoadPackageParam lparam) throws Thr XposedHelpers.findAndHookMethod(hookTarget, "onResume", new XC_MethodHook() { @Override protected void beforeHookedMethod(MethodHookParam param) throws Throwable { - ((ViewGroup) ((Activity) param.thisObject).findViewById(2131433343)).getChildAt(6).setVisibility(View.GONE); + Activity activity = (Activity) param.thisObject; + int resourceId = activity.getResources().getIdentifier("main_tab_container", "id", activity.getPackageName()); + ((ViewGroup) activity.findViewById(resourceId)).getChildAt(6).setVisibility(View.GONE); } }); } From 1278fc7738ed054139d4631d8b764155dedece4a Mon Sep 17 00:00:00 2001 From: AioiLight Date: Sat, 20 Jan 2024 01:49:04 +0900 Subject: [PATCH 4/6] Adjust spacing of bottom navigation --- .../io/github/chipppppppppp/lime/Main.java | 36 +++++++++++++------ 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/io/github/chipppppppppp/lime/Main.java b/app/src/main/java/io/github/chipppppppppp/lime/Main.java index 11ad011c..ed6f4930 100644 --- a/app/src/main/java/io/github/chipppppppppp/lime/Main.java +++ b/app/src/main/java/io/github/chipppppppppp/lime/Main.java @@ -1,20 +1,22 @@ package io.github.chipppppppppp.lime; -import de.robv.android.xposed.XposedBridge; -import de.robv.android.xposed.IXposedHookLoadPackage; -import de.robv.android.xposed.callbacks.XC_LoadPackage; -import de.robv.android.xposed.XposedHelpers; -import de.robv.android.xposed.XC_MethodHook; -import de.robv.android.xposed.XSharedPreferences; - import android.app.Activity; +import android.content.Intent; import android.graphics.Canvas; +import android.net.Uri; import android.view.View; import android.view.ViewGroup; -import android.net.Uri; import android.webkit.WebView; + import androidx.browser.customtabs.CustomTabsIntent; -import android.content.Intent; +import androidx.constraintlayout.widget.ConstraintLayout; + +import de.robv.android.xposed.IXposedHookLoadPackage; +import de.robv.android.xposed.XC_MethodHook; +import de.robv.android.xposed.XSharedPreferences; +import de.robv.android.xposed.XposedBridge; +import de.robv.android.xposed.XposedHelpers; +import de.robv.android.xposed.callbacks.XC_LoadPackage; public class Main implements IXposedHookLoadPackage { public void handleLoadPackage(XC_LoadPackage.LoadPackageParam lparam) throws Throwable { @@ -33,7 +35,21 @@ public void handleLoadPackage(XC_LoadPackage.LoadPackageParam lparam) throws Thr XposedHelpers.findAndHookMethod(hookTarget, "onResume", new XC_MethodHook() { @Override protected void beforeHookedMethod(MethodHookParam param) throws Throwable { - ((ViewGroup) ((Activity) param.thisObject).findViewById(2131433343)).getChildAt(6).setVisibility(View.GONE); + Activity activity = (Activity) param.thisObject; + int resourceId = activity.getResources().getIdentifier("main_tab_container", "id", activity.getPackageName()); + ViewGroup vG = ((ViewGroup) activity.findViewById(resourceId)); + View chat = vG.getChildAt(4); // chat + vG.getChildAt(5).setVisibility(View.GONE); // timeline spacer + vG.getChildAt(6).setVisibility(View.GONE); // timeline + View newsSpacer = vG.getChildAt(7); // news spacer + + ConstraintLayout.LayoutParams paramChat = (ConstraintLayout.LayoutParams)chat.getLayoutParams(); + paramChat.rightToLeft = vG.getChildAt(7).getId(); + chat.setLayoutParams(paramChat); + + ConstraintLayout.LayoutParams paramNewsSpacer = (ConstraintLayout.LayoutParams)newsSpacer.getLayoutParams(); + paramNewsSpacer.leftToRight = chat.getId(); + newsSpacer.setLayoutParams(paramNewsSpacer); } }); } From c72e6e9c8e768e1c3da812321b4ae11676b576ca Mon Sep 17 00:00:00 2001 From: Chipppppp Date: Sat, 20 Jan 2024 10:15:06 +0900 Subject: [PATCH 5/6] Alert when the module is not activated --- .../chipppppppppp/lime/SettingsActivity.java | 73 ++++++++++++------- 1 file changed, 47 insertions(+), 26 deletions(-) diff --git a/app/src/main/java/io/github/chipppppppppp/lime/SettingsActivity.java b/app/src/main/java/io/github/chipppppppppp/lime/SettingsActivity.java index d2382cea..b8e5a406 100644 --- a/app/src/main/java/io/github/chipppppppppp/lime/SettingsActivity.java +++ b/app/src/main/java/io/github/chipppppppppp/lime/SettingsActivity.java @@ -1,6 +1,8 @@ package io.github.chipppppppppp.lime; import android.os.Bundle; +import android.app.AlertDialog; +import android.content.DialogInterface; import androidx.appcompat.app.AppCompatActivity; import android.widget.Switch; import android.content.SharedPreferences; @@ -17,31 +19,50 @@ protected void onCreate(Bundle savedInstanceState) { Switch switchRedirectWebView = findViewById(R.id.switch_redirect_web_view); Switch switchOpenInBrowser = findViewById(R.id.switch_open_in_browser); - SharedPreferences prefs = getSharedPreferences("settings", MODE_WORLD_READABLE); - switchDeleteVoom.setChecked(prefs.getBoolean("delete_voom", true)); - switchDeleteAds.setChecked(prefs.getBoolean("delete_ads", true)); - switchRedirectWebView.setChecked(prefs.getBoolean("redirect_web_view", true)); - switchOpenInBrowser.setChecked(prefs.getBoolean("open_in_browser", false)); - - switchDeleteVoom.setOnCheckedChangeListener((buttonView, isChecked) -> { - prefs.edit().putBoolean("delete_voom", isChecked).apply(); - }); - - switchDeleteAds.setOnCheckedChangeListener((buttonView, isChecked) -> { - prefs.edit().putBoolean("delete_ads", isChecked).apply(); - }); - - switchRedirectWebView.setOnCheckedChangeListener((buttonView, isChecked) -> { - prefs.edit().putBoolean("redirect_web_view", isChecked).apply(); - if (isChecked) switchOpenInBrowser.setEnabled(true); - else { - switchOpenInBrowser.setEnabled(false); - switchOpenInBrowser.setChecked(false); - } - }); - - switchOpenInBrowser.setOnCheckedChangeListener((buttonView, isChecked) -> { - prefs.edit().putBoolean("open_in_browser", isChecked).apply(); - }); + try { + SharedPreferences prefs; + prefs = getSharedPreferences("settings", MODE_WORLD_READABLE); + switchDeleteVoom.setChecked(prefs.getBoolean("delete_voom", true)); + switchDeleteAds.setChecked(prefs.getBoolean("delete_ads", true)); + switchRedirectWebView.setChecked(prefs.getBoolean("redirect_web_view", true)); + switchOpenInBrowser.setChecked(prefs.getBoolean("open_in_browser", false)); + + switchDeleteVoom.setOnCheckedChangeListener((buttonView, isChecked) -> { + prefs.edit().putBoolean("delete_voom", isChecked).apply(); + }); + + switchDeleteAds.setOnCheckedChangeListener((buttonView, isChecked) -> { + prefs.edit().putBoolean("delete_ads", isChecked).apply(); + }); + + switchRedirectWebView.setOnCheckedChangeListener((buttonView, isChecked) -> { + prefs.edit().putBoolean("redirect_web_view", isChecked).apply(); + if (isChecked) switchOpenInBrowser.setEnabled(true); + else { + switchOpenInBrowser.setEnabled(false); + switchOpenInBrowser.setChecked(false); + } + }); + + switchOpenInBrowser.setOnCheckedChangeListener((buttonView, isChecked) -> { + prefs.edit().putBoolean("open_in_browser", isChecked).apply(); + }); + } catch (SecurityException e) { + showModuleNotEnabledAlert(); + } + } + + private void showModuleNotEnabledAlert() { + new AlertDialog.Builder(this) + .setTitle("Error") + .setMessage("Module not enabled!") + .setPositiveButton("OK", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + finish(); + } + }) + .setCancelable(false) + .show(); } } \ No newline at end of file From db3161778a5af20f905f68508b0e4159d43e7088 Mon Sep 17 00:00:00 2001 From: Chipppppp Date: Sat, 20 Jan 2024 10:17:17 +0900 Subject: [PATCH 6/6] Delete a line --- app/src/main/java/io/github/chipppppppppp/lime/Main.java | 1 - 1 file changed, 1 deletion(-) diff --git a/app/src/main/java/io/github/chipppppppppp/lime/Main.java b/app/src/main/java/io/github/chipppppppppp/lime/Main.java index ed6f4930..d1aa9c22 100644 --- a/app/src/main/java/io/github/chipppppppppp/lime/Main.java +++ b/app/src/main/java/io/github/chipppppppppp/lime/Main.java @@ -7,7 +7,6 @@ import android.view.View; import android.view.ViewGroup; import android.webkit.WebView; - import androidx.browser.customtabs.CustomTabsIntent; import androidx.constraintlayout.widget.ConstraintLayout;