Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
s1204IT authored Jan 20, 2024
2 parents 44de93a + e4f28f8 commit 405d0eb
Show file tree
Hide file tree
Showing 4 changed files with 128 additions and 38 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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 }}
13 changes: 11 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,17 @@ android {
keyPassword System.getenv('KEY_PASSWORD')
}
}

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 {
debug {
minifyEnabled false
Expand All @@ -38,7 +48,6 @@ android {
minifyEnabled false
proguardFiles += 'proguard-rules.pro'
if (file('release.jks').exists()) {
signingConfig signingConfigs.release
}
}
}
Expand Down
35 changes: 25 additions & 10 deletions app/src/main/java/io/github/chipppppppppp/lime/Main.java
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
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 {
Expand All @@ -33,7 +34,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);
}
});
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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();
}
}

0 comments on commit 405d0eb

Please sign in to comment.