Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.mrikso.modmenu;
- import android.app.ActivityManager;
- import android.app.ActivityManager.RunningAppProcessInfo;
- import android.app.AlertDialog;
- import android.app.AlertDialog.Builder;
- import android.app.Service;
- import android.content.Context;
- import android.content.Intent;
- import android.graphics.Color;
- import android.graphics.Paint.Style;
- import android.graphics.Typeface;
- import android.graphics.drawable.Drawable;
- import android.graphics.drawable.LayerDrawable;
- import android.graphics.drawable.ShapeDrawable;
- import android.graphics.drawable.shapes.RoundRectShape;
- import android.os.Build.VERSION;
- import android.os.Handler;
- import android.os.IBinder;
- import android.text.Html;
- import android.net.Uri;
- import android.view.MotionEvent;
- import android.view.View;
- import android.view.View.OnClickListener;
- import android.view.View.OnTouchListener;
- import android.view.WindowManager;
- import android.webkit.WebView;
- import android.widget.Button;
- import android.widget.CheckBox;
- import android.widget.Checkable;
- import android.widget.CompoundButton;
- import android.widget.FrameLayout;
- import android.widget.FrameLayout.LayoutParams;
- import android.widget.ImageView;
- import android.widget.LinearLayout;
- import android.widget.RelativeLayout;
- import android.widget.ScrollView;
- import android.widget.SeekBar;
- import android.widget.Switch;
- import android.widget.TextView;
- import android.widget.Toast;
- import java.io.IOException;
- import java.io.InputStream;
- import java.util.Random;
- public class FloatingModMenuService extends Service {
- public View mFloatingView;
- private LinearLayout modBody;
- public WindowManager windowManager;
- //инициализируем методы из нативной библиотеки
- // private native String toastFromJNI();
- private native void anticheat_on();
- private native void anticheat_off();
- private native void negativeAmmo_on();
- private native void negativeAmmo_off();
- private native void respawnCharge_on();
- private native void respawnCharge_off();
- private native void noGravity_on();
- private native void noGravity_off();
- private native void godmode_on();
- private native void godmode_off();
- private native void abilityCharge_on();
- private native void abilityCharge_off();
- private native void superSpeed_on();
- private native void superSpeed_off();
- private native void noSpook_on();
- private native void noSpook_off();
- private native void noAbilityCooldown_on();
- private native void noAbilityCooldown_off();
- private native void noGrenadeCooldown_on();
- private native void noGrenadeCooldown_off();
- private native void godmode2_on();
- private native void godmode2_off();
- private native void noPolymorph_on();
- private native void noPolymorph_off();
- private native void propValue_on();
- private native void propValue_off();
- private native void noPassword_on();
- private native void noPassword_off();
- private native void bigReward_on();
- private native void bigReward_off();
- @Override
- public IBinder onBind(Intent intent) {
- return null;
- }
- @Override
- public void onCreate() {
- super.onCreate();
- InstallMenu();
- final Handler handler = new Handler();
- handler.post(new Runnable() {
- public void run() {
- FloatingModMenuService.this.Thread();
- handler.postDelayed(this, 1000);
- }
- });
- }
- private void InstallMenu() {
- int i = VERSION.SDK_INT >= 26 ? 2038 : 2002;
- FrameLayout frameLayout = new FrameLayout(this);
- frameLayout.setLayoutParams(new LayoutParams(-2, -2));
- RelativeLayout relativeLayout = new RelativeLayout(this);
- relativeLayout.setLayoutParams(new RelativeLayout.LayoutParams(-1, -1));
- ImageView imageView = new ImageView(this);
- imageView.setLayoutParams(new RelativeLayout.LayoutParams(convertDipToPixels(50.0f), convertDipToPixels(50.0f)));
- try {
- InputStream open = getAssets().open("floating.png");
- InputStream background = getAssets().open("background.png");
- imageView.setImageDrawable(Drawable.createFromStream(open, null));
- open.close();
- relativeLayout.addView(imageView);
- this.mFloatingView = relativeLayout;
- LinearLayout linearLayout = new LinearLayout(this);
- linearLayout.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, 400));
- linearLayout.setBackground(Drawable.createFromStream(background, null));
- linearLayout.setOrientation(LinearLayout.VERTICAL);
- TextView textView = new TextView(this);
- textView.setLayoutParams(new LinearLayout.LayoutParams(-1, -2));
- textView.setGravity(1);
- textView.setTextColor(Color.parseColor("#000000"));
- textView.setText("Menu v1.4");
- textView.setTypeface(textView.getTypeface(), Typeface.BOLD);
- textView.setTextSize(20.0f);
- ScrollView scrollView = new ScrollView(this);
- scrollView.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT));
- scrollView.setScrollBarSize(convertDipToPixels(5.0f));
- this.modBody = new LinearLayout(this);
- this.modBody.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT));
- this.modBody.setOrientation(LinearLayout.VERTICAL);
- scrollView.addView(this.modBody);
- linearLayout.addView(textView);
- linearLayout.addView(scrollView);
- frameLayout.addView(linearLayout);
- final AlertDialog create = new Builder(this, 2).create();
- create.getWindow().setType(i);
- create.setView(frameLayout);
- final WindowManager.LayoutParams layoutParams3 = new WindowManager.LayoutParams( -2, -2, i, 8, -3);
- layoutParams3.gravity = 51;
- layoutParams3.x = 0;
- layoutParams3.y = 100;
- this.windowManager = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
- this.windowManager.addView(this.mFloatingView, layoutParams3);
- this.mFloatingView.setOnTouchListener(new OnTouchListener() {
- private float initialTouchX;
- private float initialTouchY;
- private int initialX;
- private int initialY;
- public boolean onTouch(View view, MotionEvent motionEvent) {
- switch (motionEvent.getAction()) {
- case 0:
- this.initialX = layoutParams3.x;
- this.initialY = layoutParams3.y;
- this.initialTouchX = motionEvent.getRawX();
- this.initialTouchY = motionEvent.getRawY();
- return true;
- case 1:
- create.show();
- return true;
- case 2:
- float round = (float) Math.round(motionEvent.getRawX() - this.initialTouchX);
- float round2 = (float) Math.round(motionEvent.getRawY() - this.initialTouchY);
- layoutParams3.x = this.initialX + ((int) round);
- layoutParams3.y = this.initialY + ((int) round2);
- FloatingModMenuService.this.windowManager.updateViewLayout(FloatingModMenuService.this.mFloatingView, layoutParams3);
- return true;
- default:
- return false;
- }
- }
- });
- } catch (IOException unused) {
- }
- modMenu();
- }
- private void modMenu() {
- addCheckbox("Function", new CB() {
- public void OnWrite(boolean isChecked) {
- if (isChecked)
- {
- Function();
- }
- else
- {
- Function();
- }
- }
- });
- addCheckbox("Function", new CB() {
- public void OnWrite(boolean isChecked) {
- if (isChecked)
- {
- Function();
- }
- else
- {
- Function();
- }
- }
- });
- addCheckbox("Function", new CB() {
- public void OnWrite(boolean isChecked) {
- if (isChecked)
- {
- Function();
- }
- else
- {
- }
- }
- });
- addCheckbox("Function]", new CB(){
- public void OnWrite(boolean isChecked) {
- if (isChecked)
- {
- Function();
- }
- else
- {
- Function();
- }
- }
- });
- addCheckbox("Function", new CB(){
- public void OnWrite(boolean isChecked) {
- if (isChecked)
- {
- Function();
- }
- else
- {
- Function();
- }
- }
- });
- addCheckbox("Function [Function]", new CB(){
- public void OnWrite(boolean isChecked) {
- if (isChecked)
- {
- Function();
- }
- else
- {
- Function();
- }
- }
- });
- addCheckbox("Function [Function]", new CB(){
- public void OnWrite(boolean isChecked) {
- if (isChecked)
- {
- Function();
- }
- else
- {
- Function();
- }
- }
- });
- addCheckbox("Function]", new CB(){
- public void OnWrite(boolean isChecked) {
- if (isChecked)
- {
- Function();
- }
- else
- {
- Function();
- }
- }
- });
- addCheckbox("Function]", new CB(){
- public void OnWrite(boolean isChecked) {
- if (isChecked)
- {
- Function();
- }
- else
- {
- Function();
- }
- }
- });
- addCheckbox("Function]", new CB(){
- public void OnWrite(boolean isChecked) {
- if (isChecked)
- {
- Function();
- }
- else
- {
- Function();
- }
- }
- });
- addCheckbox("Function]", new CB(){
- public void OnWrite(boolean isChecked) {
- if (isChecked)
- {
- Function();
- }
- else
- {
- Function();
- }
- }
- });
- addCheckbox("Function]", new CB(){
- public void OnWrite(boolean isChecked) {
- if (isChecked)
- {
- Function();
- }
- else
- {
- Function();
- }
- }
- });
- }
- //метод для быстрого добавления свичей в меню патчей
- private void addCheckbox(String name, final CB listner) {
- CheckBox cb = new CheckBox(this);
- LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(-1, -1);
- layoutParams.setMargins(0, 2, 0, 1);
- cb.setLayoutParams(layoutParams);
- cb.setBackgroundColor(Color.parseColor("#00000000"));
- cb.setPadding(20, 5, 20, 5);
- cb.setText(name);
- cb.setTextColor(Color.parseColor("#000000"));
- cb.setTextSize(20.0f);
- cb.setWidth(2);
- cb.setHighlightColor(Color.parseColor("#FFFFFF"));
- cb.setTypeface(cb.getTypeface(), Typeface.NORMAL);
- cb.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
- @Override
- public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked) {
- listner.OnWrite(isChecked);
- }
- });
- this.modBody.addView(cb);
- }
- private int convertDipToPixels(float f) {
- return (int) ((f * getResources().getDisplayMetrics().density) + 0.5f);
- }
- private LayerDrawable GetlayerDrawable() {
- float[] fArr = {75.0f, 75.0f, 75.0f, 75.0f, 75.0f, 75.0f, 75.0f, 75.0f};
- float[] fArr2 = {75.0f, 75.0f, 75.0f, 75.0f, 75.0f, 75.0f, 75.0f, 75.0f};
- ShapeDrawable shapeDrawable = new ShapeDrawable(new RoundRectShape(fArr, null, fArr2));
- shapeDrawable.getPaint().setColor(Color.parseColor("#ff000000"));
- shapeDrawable.getPaint().setStyle(Style.FILL);
- shapeDrawable.setPadding(1, 1, 1, 1);
- ShapeDrawable shapeDrawable2 = new ShapeDrawable(new RoundRectShape(fArr, null, fArr2));
- shapeDrawable2.getPaint().setColor(Color.parseColor("#ff1f2b3f"));
- shapeDrawable2.getPaint().setStyle(Style.FILL);
- shapeDrawable2.getPaint().setAntiAlias(true);
- Drawable[] drawableArr = {shapeDrawable, shapeDrawable2};
- shapeDrawable2.setPadding(5, 5, 5, 5);
- return new LayerDrawable(drawableArr);
- }
- public void onDestroy() {
- super.onDestroy();
- if (this.mFloatingView != null) {
- this.windowManager.removeView(this.mFloatingView);
- }
- }
- private boolean isChayNgam() {
- RunningAppProcessInfo runningAppProcessInfo = new RunningAppProcessInfo();
- ActivityManager.getMyMemoryState(runningAppProcessInfo);
- return runningAppProcessInfo.importance != 100;
- }
- /* access modifiers changed from: private */
- public void Thread() {
- if (this.mFloatingView == null) {
- return;
- }
- if (isChayNgam()) {
- this.mFloatingView.setVisibility(View.INVISIBLE);
- } else {
- this.mFloatingView.setVisibility(View.VISIBLE);
- }
- }
- private interface SW {
- void OnWrite(boolean z);
- }
- private interface CB {
- void OnWrite (boolean z);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement