Skip to content

Commit

Permalink
Merge branch 'Dev4Mod:master' into theme
Browse files Browse the repository at this point in the history
  • Loading branch information
Strange-IPmart authored Aug 10, 2024
2 parents 85a2fd6 + cb1577c commit 73d067d
Show file tree
Hide file tree
Showing 29 changed files with 557 additions and 292 deletions.
4 changes: 2 additions & 2 deletions .idea/deploymentTargetSelector.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ android {
ndk {
abiFilters.add("armeabi-v7a")
abiFilters.add("arm64-v8a")
abiFilters.add("x86_64")
abiFilters.add("x86")
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,4 +137,9 @@ public static boolean isXposedEnabled() {
return false;
}

@Override
public boolean onSupportNavigateUp() {
onBackPressed();
return super.onSupportNavigateUp();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,11 @@ public void onCreatePreferences(@Nullable Bundle savedInstanceState, @Nullable S
super.onCreatePreferences(savedInstanceState, rootKey);
setPreferencesFromResource(R.xml.fragment_customization, rootKey);
}

@Override
public void onResume() {
super.onResume();
setDisplayHomeAsUpEnabled(false);
}

}
Original file line number Diff line number Diff line change
@@ -1,19 +1,69 @@
package com.wmods.wppenhacer.ui.fragments;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.wmods.wppenhacer.R;
import com.wmods.wppenhacer.ui.fragments.base.BaseFragment;
import com.wmods.wppenhacer.ui.fragments.base.BasePreferenceFragment;

public class GeneralFragment extends BasePreferenceFragment {

public class GeneralFragment extends BaseFragment {

@Nullable
@Override
public void onCreatePreferences(@Nullable Bundle savedInstanceState, @Nullable String rootKey) {
super.onCreatePreferences(savedInstanceState, rootKey);
setPreferencesFromResource(R.xml.fragment_general, rootKey);
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
var root = super.onCreateView(inflater, container, savedInstanceState);
if (savedInstanceState == null) {
getChildFragmentManager().beginTransaction().add(R.id.frag_container, new GeneralPreferenceFragment()).commitNow();
}
return root;
}

public static class GeneralPreferenceFragment extends BasePreferenceFragment {
@Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
super.onCreatePreferences(savedInstanceState, rootKey);
setPreferencesFromResource(R.xml.fragment_general, rootKey);

}

@Override
public void onResume() {
super.onResume();
setDisplayHomeAsUpEnabled(false);
}
}

public static class HomeGeneralPreference extends BasePreferenceFragment {
@Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
super.onCreatePreferences(savedInstanceState, rootKey);
setPreferencesFromResource(R.xml.preference_general_home, rootKey);
setDisplayHomeAsUpEnabled(true);
}
}

public static class HomeScreenGeneralPreference extends BasePreferenceFragment {
@Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
super.onCreatePreferences(savedInstanceState, rootKey);
setPreferencesFromResource(R.xml.preference_general_homescreen, rootKey);
setDisplayHomeAsUpEnabled(true);
}
}

public static class ConversationGeneralPreference extends BasePreferenceFragment {
@Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
super.onCreatePreferences(savedInstanceState, rootKey);
setPreferencesFromResource(R.xml.preference_general_conversation, rootKey);
setDisplayHomeAsUpEnabled(true);
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@ public View onCreateView(@NonNull LayoutInflater inflater,
return binding.getRoot();
}

@Override
public void onResume() {
super.onResume();
setDisplayHomeAsUpEnabled(false);
}

@SuppressLint("StringFormatInvalid")
private void receiverBroadcastBusiness(Context context, Intent intent) {
binding.statusTitle3.setText(R.string.business_in_background);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}

@Override
public void onResume() {
super.onResume();
setDisplayHomeAsUpEnabled(false);
}


@Override
public void onCreatePreferences(@Nullable Bundle savedInstanceState, @Nullable String rootKey) {
super.onCreatePreferences(savedInstanceState, rootKey);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ public void onCreatePreferences(@Nullable Bundle savedInstanceState, @Nullable S
setPreferencesFromResource(R.xml.fragment_privacy, rootKey);
}

@Override
public void onResume() {
super.onResume();
setDisplayHomeAsUpEnabled(false);
}


@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
package com.wmods.wppenhacer.ui.fragments.base;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;

import androidx.annotation.IdRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.StringRes;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.core.view.MenuProvider;
import androidx.fragment.app.Fragment;
Expand All @@ -15,13 +21,24 @@
import com.google.android.material.snackbar.Snackbar;
import com.wmods.wppenhacer.App;
import com.wmods.wppenhacer.R;
import com.wmods.wppenhacer.databinding.BaseFragmentBinding;

import java.util.concurrent.Callable;
import java.util.concurrent.Future;
import java.util.concurrent.FutureTask;

public class BaseFragment extends Fragment {


public BaseFragmentBinding binding;

@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
binding = BaseFragmentBinding.inflate(inflater, container, false);
return binding.getRoot();
}

public void navigateUp() {
getNavController().navigateUp();
}
Expand Down Expand Up @@ -121,4 +138,13 @@ public void showHint(CharSequence str, boolean lengthShort, CharSequence actionS
});
}

public void setDisplayHomeAsUpEnabled(boolean enabled) {
if (getActivity() == null) return;
var actionBar = ((AppCompatActivity) getActivity()).getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(enabled);
}
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@
import android.view.View;
import android.view.ViewGroup;

import androidx.activity.OnBackPressedCallback;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.ContextCompat;
import androidx.preference.PreferenceFragmentCompat;
import androidx.preference.PreferenceManager;
Expand All @@ -33,6 +35,12 @@ public abstract class BasePreferenceFragment extends PreferenceFragmentCompat im
public void onCreatePreferences(@Nullable Bundle savedInstanceState, @Nullable String rootKey) {
mPrefs = PreferenceManager.getDefaultSharedPreferences(requireContext());
mPrefs.registerOnSharedPreferenceChangeListener(this);
requireActivity().getOnBackPressedDispatcher().addCallback(this, new OnBackPressedCallback(true) {
@Override
public void handleOnBackPressed() {
getParentFragmentManager().popBackStack();
}
});
}

@NonNull
Expand All @@ -43,6 +51,12 @@ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup c
return super.onCreateView(inflater, container, savedInstanceState);
}

@Override
public void onResume() {
super.onResume();
setDisplayHomeAsUpEnabled(true);
}

@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, @Nullable String s) {
Intent intent = new Intent(BuildConfig.APPLICATION_ID + ".MANUAL_RESTART");
Expand Down Expand Up @@ -142,4 +156,12 @@ private void chanceStates(String key) {

}
}

public void setDisplayHomeAsUpEnabled(boolean enabled) {
if (getActivity() == null) return;
var actionBar = ((AppCompatActivity) getActivity()).getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(enabled);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@
import com.wmods.wppenhacer.xposed.features.customization.CustomTime;
import com.wmods.wppenhacer.xposed.features.customization.CustomToolbar;
import com.wmods.wppenhacer.xposed.features.customization.CustomView;
import com.wmods.wppenhacer.xposed.features.customization.DotOnline;
import com.wmods.wppenhacer.xposed.features.customization.FilterGroups;
import com.wmods.wppenhacer.xposed.features.customization.HideTabs;
import com.wmods.wppenhacer.xposed.features.customization.IGStatus;
import com.wmods.wppenhacer.xposed.features.customization.SeparateGroup;
import com.wmods.wppenhacer.xposed.features.customization.ShowOnline;
import com.wmods.wppenhacer.xposed.features.general.AntiRevoke;
import com.wmods.wppenhacer.xposed.features.general.CallType;
import com.wmods.wppenhacer.xposed.features.general.ChatLimit;
Expand All @@ -59,6 +59,7 @@
import com.wmods.wppenhacer.xposed.features.others.Stickers;
import com.wmods.wppenhacer.xposed.features.others.TextStatusComposer;
import com.wmods.wppenhacer.xposed.features.others.ToastViewer;
import com.wmods.wppenhacer.xposed.features.privacy.AntiDetector;
import com.wmods.wppenhacer.xposed.features.privacy.CallPrivacy;
import com.wmods.wppenhacer.xposed.features.privacy.DndMode;
import com.wmods.wppenhacer.xposed.features.privacy.FreezeLastSeen;
Expand Down Expand Up @@ -234,7 +235,7 @@ private static void plugins(@NonNull ClassLoader loader, @NonNull XSharedPrefere
CustomTheme.class,
ChatLimit.class,
SeparateGroup.class,
DotOnline.class,
ShowOnline.class,
DndMode.class,
FreezeLastSeen.class,
TypePrivacy.class,
Expand Down Expand Up @@ -266,7 +267,8 @@ private static void plugins(@NonNull ClassLoader loader, @NonNull XSharedPrefere
CopyStatus.class,
TextStatusComposer.class,
ToastViewer.class,
MenuHome.class
MenuHome.class,
AntiDetector.class
};
XposedBridge.log("Loading Plugins");
var executorService = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1609,4 +1609,22 @@ public synchronized static Method loadBubbleDrawableMethod(ClassLoader classLoad
return methodData.get(0).getMethodInstance(classLoader);
});
}

public static Method[] loadRootDetector(ClassLoader classLoader) {
var methods = findAllMethodUsingStrings(classLoader, StringMatchType.Contains, "/system/bin/su");
if (methods.length == 0) throw new RuntimeException("RootDetector method not found");
return methods;
}

public static Method loadCheckEmulator(ClassLoader classLoader) throws Exception {
var method = findFirstMethodUsingStrings(classLoader, StringMatchType.Contains, "Android SDK built for x86");
if (method == null) throw new RuntimeException("CheckEmulator method not found");
return method;
}

public static Method loadCheckCustomRom(ClassLoader classLoader) throws Exception {
var method = findFirstMethodUsingStrings(classLoader, StringMatchType.Contains, "cyanogen");
if (method == null) throw new RuntimeException("CheckCustomRom method not found");
return method;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@
import de.robv.android.xposed.XposedBridge;
import de.robv.android.xposed.XposedHelpers;

public class DotOnline extends Feature {
public class ShowOnline extends Feature {

private Object mStatusUser;
private Object mInstancePresence;

public DotOnline(@NonNull ClassLoader loader, @NonNull XSharedPreferences preferences) {
public ShowOnline(@NonNull ClassLoader loader, @NonNull XSharedPreferences preferences) {
super(loader, preferences);
}

Expand Down Expand Up @@ -64,7 +64,7 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
TextView lastSeenText = new TextView(context);
lastSeenText.setId(0x7FFF0002);
lastSeenText.setTextSize(12f);
lastSeenText.setText(ResId.string.not_available);
lastSeenText.setText("");
lastSeenText.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.MATCH_PARENT));
lastSeenText.setGravity(Gravity.CENTER_VERTICAL);
lastSeenText.setVisibility(View.VISIBLE);
Expand Down Expand Up @@ -165,10 +165,10 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
if (UnobfuscatorCache.getInstance().getString("online").equals(status)) {
lastSeenText.setTextColor(Color.GREEN);
} else {
lastSeenText.setTextColor(Color.RED);
lastSeenText.setTextColor(0xffcac100);
}
} else {
lastSeenText.setText(ResId.string.not_available);
lastSeenText.setText("");
lastSeenText.setTextColor(Color.GRAY);
}
}
Expand Down
Loading

0 comments on commit 73d067d

Please sign in to comment.