RachaProFreeFire

Untitled

Jul 5th, 2025
16
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 49.55 KB | None | 0 0
  1. package com.mycompany.application;
  2. import android.app.Activity;
  3. import android.content.Context;
  4. import android.graphics.PixelFormat;
  5. import android.graphics.Point;
  6. import android.os.Build;
  7. import android.os.Bundle;
  8. import android.os.Handler;
  9. import android.view.Gravity;
  10. import android.view.MotionEvent;
  11. import android.view.View;
  12. import android.view.ViewTreeObserver;
  13. import android.view.Window;
  14. import android.widget.LinearLayout;
  15. import android.view.WindowManager;
  16. import com.mycompany.application.GLES3JNIView;
  17. import java.io.InputStream;
  18. import android.view.WindowManager.LayoutParams;
  19. import android.view.Display;
  20. import android.provider.Settings;
  21. import android.widget.Toast;
  22. import android.content.Intent;
  23. import android.Manifest;
  24. import android.net.Uri;
  25. import java.io.IOException;
  26. import java.io.File;
  27. import android.util.Log;
  28. import java.io.InputStream;
  29. import java.io.IOException;
  30. import java.io.FileOutputStream;
  31. import java.io.DataOutputStream;
  32. import android.content.pm.PackageManager;
  33. import android.widget.FrameLayout;
  34. import android.annotation.SuppressLint;
  35. //import android.app.*;
  36.  
  37. import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT;
  38. import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
  39. import static android.view.WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS;
  40. import static android.widget.RelativeLayout.ALIGN_PARENT_LEFT;
  41. import static android.widget.RelativeLayout.ALIGN_PARENT_RIGHT;
  42. import android.widget.ImageView;
  43. import android.graphics.drawable.Drawable;
  44. import android.widget.RelativeLayout;
  45. import android.util.TypedValue;
  46. import android.view.ViewGroup;
  47. import android.view.View.OnClickListener;
  48. import android.content.res.AssetManager;
  49. import android.widget.TextView;
  50. import android.graphics.Color;
  51. import android.widget.ScrollView;
  52. import android.graphics.Typeface;
  53. import android.widget.SeekBar;
  54. import android.content.SharedPreferences;
  55. import android.app.Service;
  56. import android.widget.Spinner;
  57. import android.widget.Switch;
  58. import android.widget.CompoundButton;
  59. import android.content.res.Configuration;
  60.  
  61.  
  62. public class MainActivity extends Activity {
  63.  
  64. static{
  65. System.loadLibrary("IMGUI");
  66. }
  67.  
  68. public static native void Resolution(float px, float py);
  69. public static native void Close();
  70. public static native void getReady();
  71. WindowManager mWindowManager;
  72. FrameLayout vTouch;
  73.  
  74. // ประกาศเมธอด native ที่จะเรียกจาก JNI
  75. public static native boolean getFixTouchScreen();
  76.  
  77. // คุณสามารถใช้เมธอดนี้เพื่อรับค่า boolean จากฝั่ง C++
  78. public void checkFixTouchScreen(GLES3JNIView display) {
  79. boolean isFixTouchEnabled = getFixTouchScreen();
  80. if (isFixTouchEnabled) {
  81. // ทำสิ่งที่ต้องการเมื่อ FixTouchScreen เป็น true
  82. //System.out.println("FixTouchScreen is enabled.");
  83.  
  84. display.setVisibility(View.INVISIBLE);
  85. } else {
  86. // ทำสิ่งที่ต้องการเมื่อ FixTouchScreen เป็น false
  87. //System.out.println("FixTouchScreen is disabled.");
  88. //display.setVisibility(View.VISIBLE);
  89. }
  90. }
  91.  
  92.  
  93.  
  94. private RelativeLayout ICON_IMG;
  95. private Point point;
  96. private static MainActivity Instance;
  97. private WindowManager manager;
  98.  
  99. private WindowManager.LayoutParams vParams;
  100.  
  101.  
  102. //private View vTouch;
  103. public WindowManager windowManager,xfqManager;
  104. private WindowManager 绘制窗口;
  105. public static int 真实宽;//ความละเอียด x
  106. public static int 真实高;//ความละเอียด y
  107. private LinearLayout Start_btn;
  108. public int POS_X = 0;
  109. public int POS_Y = 100;
  110. // WindowManager.LayoutParams vmParams;
  111.  
  112.  
  113. public static boolean 写出assets资源文件(Context context, String outPath, String fileName) {
  114. File file = new File(outPath);
  115. if (!file.exists()) {
  116. if (!file.mkdirs()) {
  117. Log.e("--Method--", "copyAssetsSingleFile: cannot create directory.");
  118. return false;
  119. }
  120. }
  121. try {
  122. InputStream inputStream = context.getAssets().open(fileName);
  123. File outFile = new File(file, fileName);
  124. FileOutputStream fileOutputStream = new FileOutputStream(outFile);
  125. // ถ่ายโอนไบต์จาก inputStream ไปยัง fileOutputStream
  126. byte[] buffer = new byte[1024];
  127. int byteRead;
  128. while (-1 != (byteRead = inputStream.read(buffer))) {
  129. fileOutputStream.write(buffer, 0, byteRead);
  130. }
  131. inputStream.close();
  132. fileOutputStream.flush();
  133. fileOutputStream.close();
  134. return true;
  135. } catch (IOException e) {
  136. e.printStackTrace();
  137. return false;
  138. }
  139. }
  140.  
  141. //ตรวจจับรูท
  142. /*สมัครสิทธิ์รูทและกำหนดสิทธิ์รูท*/
  143. public static synchronized boolean 申请ROOT() {
  144. Process process = null;
  145. DataOutputStream os = null;
  146. try {
  147. process = Runtime.getRuntime().exec("su");
  148. os = new DataOutputStream(process.getOutputStream());
  149. os.writeBytes("exit\n");
  150. os.flush();
  151. int exitValue = process.waitFor();
  152. if (exitValue == 0) {
  153. return true;
  154. } else {
  155. return false;
  156. }
  157. } catch (Exception e) {
  158. return false;
  159. } finally {
  160. try {
  161. if (os != null) {
  162. os.close();
  163. }
  164. process.destroy();
  165. } catch (Exception e) {
  166. e.printStackTrace();
  167. }
  168. }
  169. }
  170.  
  171. public static void RunShell(String shell) {
  172. String s = shell;
  173.  
  174. try {
  175. Runtime.getRuntime().exec(s, null, null);//ดำเนินการ
  176. } catch (Exception e) {
  177. e.printStackTrace();
  178. }
  179. }
  180.  
  181. public void 执行二进制(String 路径) {
  182. if (申请ROOT() == false) {
  183. RunShell("chmod 777 " + getFilesDir() + 路径);
  184. RunShell(" " + getFilesDir() + 路径);
  185. } else {
  186. RunShell("su -c chmod 777 " + getFilesDir() + 路径);
  187. RunShell("su -c " + getFilesDir() + 路径);
  188. }
  189. }
  190.  
  191.  
  192.  
  193.  
  194. public void 储存权限(){
  195. boolean isGranted = true;
  196. if (android.os.Build.VERSION.SDK_INT >= 23) {
  197. if (this.checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
  198. isGranted = false;
  199. }
  200. if (this.checkSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
  201. isGranted = false;
  202. }
  203. if (!isGranted) {
  204. this.requestPermissions(
  205. new String[]{Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission
  206. .ACCESS_FINE_LOCATION,
  207. Manifest.permission.READ_EXTERNAL_STORAGE,
  208. Manifest.permission.WRITE_EXTERNAL_STORAGE},
  209. 102);
  210. }
  211. }
  212. }
  213.  
  214.  
  215. private static final int CODE_DRAW_OVER_OTHER_APP_PERMISSION = 2002;
  216. public void StartFloating() {
  217. // System.loadLibrary("KittyMemory");
  218. if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && !Settings.canDrawOverlays(this)) {
  219. Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION, Uri.parse("package:" + getPackageName()));
  220. startActivityForResult(intent, CODE_DRAW_OVER_OTHER_APP_PERMISSION);
  221. } else {
  222. startService(new Intent(MainActivity.this, FloatingModMenuService.class));
  223. }
  224. }
  225.  
  226.  
  227.  
  228. @Override
  229. protected void onCreate(Bundle savedInstanceState) {
  230. super.onCreate(savedInstanceState);
  231. /*super.onSaveInstanceState(savedInstanceState);
  232.  
  233. savedInstanceState.putInt("postX",0);*/
  234.  
  235. if (!Settings.canDrawOverlays(this)) {
  236. Toast.makeText(this, "โปรดอนุญาตให้ใช้หน้าต่างลอย", Toast.LENGTH_LONG).show();
  237. startActivityForResult(new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION, Uri.parse("package:" + getPackageName())), 0);
  238. } /*else {
  239. createFloatingIcon(); // สร้าง Floating Icon
  240. }*/
  241.  
  242.  
  243.  
  244.  
  245. 储存权限();
  246. try {//สมัครเพื่อรับสิทธิ์รูท
  247. Runtime.getRuntime().exec("su", null, null);
  248. } catch (IOException e) {}
  249. this.requestWindowFeature(Window.FEATURE_NO_TITLE);
  250. windowManager = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
  251. WindowManager 窗口=(WindowManager)getSystemService(Context.WINDOW_SERVICE);
  252. assert 窗口 != null;
  253. Display 分辨率=窗口.getDefaultDisplay();
  254. Point 输出分辨=new Point();
  255. if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
  256. 分辨率.getRealSize(输出分辨);
  257. }
  258. 真实宽 = 输出分辨.x;
  259. 真实高 = 输出分辨.y;
  260. if (真实宽 > 真实高) {
  261. 真实宽 = 输出分辨.y;
  262. 真实高 = 输出分辨.x;
  263. }
  264. Resolution(真实高, 真实宽);
  265. setContentView(R.layout.activity_main);
  266. // Start();
  267. //แถบสถานะโปร่งใสและแถบนำทาง
  268. if (Build.VERSION.SDK_INT >= 19) {
  269. //แถบสถานะโปร่งใส
  270. this.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
  271. this.getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN);
  272. this.getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
  273. //แถบนำทางแบบโปร่งใส
  274. //this.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
  275. }
  276.  
  277.  
  278. if (Build.VERSION.SDK_INT >= 19) {
  279. this.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
  280. }
  281.  
  282. try {
  283. InputStream in =getAssets().open("JSKarabow.otf");
  284. GLES3JNIView.fontData = new byte[in.available()];
  285. in.read(GLES3JNIView.fontData);
  286. } catch (Exception e) {
  287. System.err.println(e.getMessage());
  288. }
  289. //写出assets资源文件(this, getFilesDir() + "/assets", "1");
  290. //执行二进制("/assets/1");
  291. ICON_IMG = new RelativeLayout(this);
  292. Start_btn = findViewById(R.id.btnStartTG);
  293. Start_btn.setOnClickListener(new View.OnClickListener() {
  294. @Override
  295. public void onClick(View v) {
  296. String url = "https://t.me/Anil_Xd";
  297. Intent i = new Intent(Intent.ACTION_VIEW);
  298. i.setData(Uri.parse(url));
  299. startActivity(i);
  300. }
  301. });
  302.  
  303.  
  304. // FloatingModMenuService floatingModMenuService = new FloatingModMenuService();
  305. //floatingModMenuService.initFloating(MainActivity.this);
  306.  
  307. }
  308.  
  309.  
  310. /*
  311. @Override
  312. protected void onSaveInstanceState(Bundle outState) {
  313. super.onSaveInstanceState(outState);
  314. outState.putInt("vTouchVisibility", vTouch.getVisibility());
  315. outState.putInt("displayVisibility", display.getVisibility());
  316. }
  317.  
  318. @Override
  319. protected void onRestoreInstanceState(Bundle savedInstanceState) {
  320. super.onRestoreInstanceState(savedInstanceState);
  321. vTouch.setVisibility(savedInstanceState.getInt("vTouchVisibility", View.VISIBLE));
  322. display.setVisibility(savedInstanceState.getInt("displayVisibility", View.VISIBLE));
  323. }
  324. */
  325.  
  326.  
  327.  
  328. @Override
  329. public void onConfigurationChanged(Configuration newConfig) {
  330. super.onConfigurationChanged(newConfig);
  331.  
  332. if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE ||
  333. newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) {
  334. updateFloatingWindow();
  335. }
  336. }
  337.  
  338.  
  339. private void updateFloatingWindow() {
  340. if (vTouch == null || manager == null) {
  341. return; // ออกหาก View หรือ Manager ยังไม่มีค่า
  342. }
  343.  
  344. try {
  345. Point newSize = new Point();
  346. windowManager.getDefaultDisplay().getRealSize(newSize);
  347.  
  348. vParams.width = newSize.x;
  349. vParams.height = newSize.y;
  350.  
  351. if (vTouch.getParent() != null) {
  352. manager.updateViewLayout(vTouch, vParams);
  353. }
  354. } catch (IllegalArgumentException e) {
  355. e.printStackTrace();
  356. }
  357. }
  358.  
  359.  
  360.  
  361. public void StartMenu(View v){
  362. // createFloatingIcon();
  363. //StartFloating();
  364. loadPrefs();
  365. initFloating();
  366. final Handler handler = new Handler();
  367. handler.post(new Runnable() {
  368. public void run() {
  369. MainActivity.this.Thread();
  370. handler.postDelayed(this, 1000);
  371. }
  372. });
  373. //startService(new Intent(MainActivity.this, FloatingModMenuService.class));
  374. Toast.makeText(getApplicationContext(), "Test Hello", Toast.LENGTH_LONG).show();
  375. }
  376.  
  377.  
  378.  
  379. public void StartMenuIMGUI(View v){
  380. loadPrefs();
  381. initFloating();
  382. final Handler handler = new Handler();
  383. handler.post(new Runnable() {
  384. public void run() {
  385. MainActivity.this.Thread();
  386. handler.postDelayed(this, 1000);
  387. }
  388. });
  389. StartIMGUI();
  390. }
  391.  
  392.  
  393. @SuppressLint("WrongConstant")
  394. public void SetWindowManagerWindowService(WindowManager.LayoutParams vmParams) {
  395. //Variable to check later if the phone supports Draw over other apps permission
  396. int iparams = Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O ? 2038 : 2002;
  397. vmParams = new WindowManager.LayoutParams(
  398. WRAP_CONTENT,
  399. WRAP_CONTENT,
  400. iparams,
  401. 8 | FLAG_TRANSLUCENT_STATUS,
  402. -3);
  403. //params = new WindowManager.LayoutParams(WindowManager.LayoutParams.LAST_APPLICATION_WINDOW, 8, -3);
  404. vmParams.gravity = 51;
  405. vmParams.x = POS_X;
  406. vmParams.y = POS_Y;
  407.  
  408. //mWindowManager = (WindowManager) getContext.getSystemService(getContext.WINDOW_SERVICE);
  409. //mWindowManager.addView(rootFrame, vmParams);
  410.  
  411. //overlayRequired = true;
  412. }
  413.  
  414.  
  415. //private FrameLayout _vTouch;
  416. // private GLES3JNIView _display;
  417. public static GLES3JNIView display;
  418.  
  419. public void StartIMGUI() {
  420. manager = (WindowManager) getApplicationContext().getSystemService(Context.WINDOW_SERVICE);
  421.  
  422. vParams = getAttributes(false);
  423. final WindowManager.LayoutParams wParams = getAttributes(true);
  424.  
  425. display = new GLES3JNIView(this);
  426. vTouch = new FrameLayout(getApplicationContext());
  427.  
  428. try {
  429. manager.addView(vTouch, vParams);
  430. manager.addView(display, wParams);
  431. } catch (Exception e) {
  432. e.printStackTrace();
  433. }
  434.  
  435. vTouch.setOnTouchListener(new View.OnTouchListener() {
  436. @Override
  437. public boolean onTouch(View v, MotionEvent event) {
  438. int action = event.getAction();
  439. if (action == MotionEvent.ACTION_DOWN || action == MotionEvent.ACTION_MOVE || action == MotionEvent.ACTION_UP) {
  440. GLES3JNIView.MotionEventClick(action != MotionEvent.ACTION_UP, event.getRawX(), event.getRawY());
  441. }
  442. return true;
  443. }
  444. });
  445.  
  446. final Handler handler = new Handler();
  447. handler.postDelayed(new Runnable() {
  448. @Override
  449. public void run() {
  450. try {
  451. if (vTouch.getParent() != null) {
  452. String[] rect = GLES3JNIView.getWindowRect().split("\\|");
  453. if (rect.length == 4) {
  454. vParams.x = Integer.parseInt(rect[0]);
  455. vParams.y = Integer.parseInt(rect[1]);
  456. vParams.width = Integer.parseInt(rect[2]);
  457. vParams.height = Integer.parseInt(rect[3]);
  458. manager.updateViewLayout(vTouch, vParams);
  459. boolean isFixTouchEnabled = getFixTouchScreen();
  460. if (isFixTouchEnabled) {
  461. mWindowManager_.addView(mFloatingView, params);
  462. } else {
  463. mWindowManager_.removeView(mFloatingView);
  464. }
  465. }
  466. }
  467. } catch (Exception e) {
  468. e.printStackTrace();
  469. } finally {
  470. handler.postDelayed(this, 20);
  471. }
  472. }
  473. }, 20);
  474.  
  475. point = new Point();
  476. vTouch.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
  477. @Override
  478. public void onGlobalLayout() {
  479. manager.getDefaultDisplay().getRealSize(point);
  480. GLES3JNIView.real(point.x, point.y);
  481. }
  482. });
  483. }
  484.  
  485.  
  486. @Override
  487. protected void onPause() {
  488. super.onPause();
  489. if (vTouch != null && vTouch.getParent() != null) {
  490. //manager.removeView(vTouch);
  491. }
  492. }
  493.  
  494.  
  495. public void StartIMGUI_สำรอง(){
  496. 绘制窗口 = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
  497. //manager = (WindowManager) getApplicationContext().getSystemService(Context.WINDOW_SERVICE);
  498. manager = (WindowManager) getApplicationContext().getSystemService(Context.WINDOW_SERVICE);
  499.  
  500. // กำหนด vParams และ wParams ให้มีค่าตรงกัน และตั้งค่า FLAG_NOT_TOUCH_MODAL
  501.  
  502.  
  503.  
  504. vParams = getAttributes(false);
  505. //vParams.flags = WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL;
  506. final WindowManager.LayoutParams wParams = getAttributes(true);
  507.  
  508. // final GLES3JNIView
  509. display = new GLES3JNIView(this);
  510. //vTouch = new View(this);
  511. //mWindowManager = ((Activity)getApplicationContext()).getWindowManager();
  512.  
  513. vTouch = new FrameLayout(getApplicationContext());
  514.  
  515. // เพิ่ม vTouch และ display ลงใน WindowManager
  516. manager.addView(vTouch, vParams);
  517. manager.addView(display, wParams);
  518.  
  519. //display.setVisibility(View.INVISIBLE);
  520.  
  521. // รับสัมผัสใน vTouch
  522. vTouch.setOnTouchListener(new View.OnTouchListener() {
  523. @Override
  524. public boolean onTouch(View v, MotionEvent event) {
  525. int action = event.getAction();
  526. switch (action) {
  527. case MotionEvent.ACTION_MOVE:
  528. case MotionEvent.ACTION_DOWN:
  529. case MotionEvent.ACTION_UP:
  530. GLES3JNIView.MotionEventClick(action != MotionEvent.ACTION_UP, event.getRawX(), event.getRawY());
  531. break;
  532. default:
  533. break;
  534. }
  535. return true;
  536. }
  537. });
  538.  
  539. //_display = display;
  540. ///_vTouch = vTouch;
  541. // อัปเดตขนาดและตำแหน่งของ vTouch
  542. final Handler handler = new Handler();
  543. handler.postDelayed(new Runnable() {
  544. @Override
  545. public void run() {
  546. try {
  547. String rect[] = GLES3JNIView.getWindowRect().split("\\|");
  548. vParams.x = Integer.parseInt(rect[0]);
  549. vParams.y = Integer.parseInt(rect[1]);
  550. vParams.width = Integer.parseInt(rect[2]);
  551. vParams.height = Integer.parseInt(rect[3]);
  552. manager.updateViewLayout(vTouch, vParams);
  553. //display.setVisibility(View.VISIBLE);
  554. //checkFixTouchScreen(display);
  555. boolean isFixTouchEnabled = getFixTouchScreen();
  556. if (isFixTouchEnabled) {
  557. // System.out.println("FixTouchScreen is enabled.");
  558. //display.setVisibility(View.INVISIBLE);
  559. //vTouch.setVisibility(View.GONE);
  560. // ICON_IMG.setVisibility(View.VISIBLE);
  561. // Toast.makeText(getApplication(), "เปิด", Toast.LENGTH_LONG).show();
  562. //window_Manager.addView(startimage, layoutParams);
  563. mWindowManager_.addView(mFloatingView, params);
  564.  
  565. } else {
  566. //System.out.println("FixTouchScreen is disabled.");
  567. //display.setVisibility(View.VISIBLE);
  568. //vTouch.setVisibility(View.VISIBLE);
  569. // ICON_IMG.setVisibility(View.GONE);
  570. // Toast.makeText(getApplication(), "ปิด", Toast.LENGTH_LONG).show();
  571. //window_Manager.removeView(startimage);
  572. mWindowManager_.removeView(mFloatingView);
  573. }
  574. } catch (Exception e) {
  575. System.err.println(e.getMessage());
  576. }
  577. handler.postDelayed(this, 20);
  578. }
  579. }, 20);
  580.  
  581. point = new Point();
  582. // ได้ขนาดหน้าจอจริง
  583. vTouch.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
  584. @Override
  585. public void onGlobalLayout() {
  586. 绘制窗口.getDefaultDisplay().getRealSize(point);
  587. GLES3JNIView.real(point.x, point.y);
  588. }
  589. });
  590.  
  591.  
  592. /*startimage.setOnClickListener(new ImageView.OnClickListener() {
  593. boolean hide_imgui = false;
  594. @Override
  595. public void onClick(View view) {
  596. //collapsedView.setVisibility(View.GONE);
  597. //expandedView.setVisibility(View.VISIBLE);
  598. //mainActivity.StartIMGUI();
  599. // hide_imgui = (hide_imgui == false);
  600.  
  601. Toast.makeText(getApplicationContext(), "AAAAAA", Toast.LENGTH_LONG).show();
  602.  
  603. }
  604. });*/
  605. }
  606.  
  607.  
  608.  
  609.  
  610.  
  611.  
  612.  
  613.  
  614.  
  615. ///####END StartMenuFix ######
  616.  
  617.  
  618. public void onClick1(View v) {
  619. Start();
  620. }
  621.  
  622. public void Start() {
  623. if (Instance == null) {
  624.  
  625. Thread t1 = new Thread(new Runnable() {
  626. @Override
  627. public void run() {
  628. getReady();
  629. }
  630. });
  631. t1.start();
  632.  
  633. Thread t2 = new Thread(new Runnable() {
  634. @Override
  635. public void run() {
  636. try {
  637. Thread.sleep(200);
  638. } catch (InterruptedException e) {
  639. e.printStackTrace();
  640. }
  641. // Tool.runExecutable(FloatingModMenuService.this, "/assets/Son_non_fish", 1);
  642. }
  643. });
  644. t2.start();
  645. }
  646. }
  647.  
  648.  
  649.  
  650.  
  651.  
  652. public WindowManager window_Manager;
  653. private ImageView startimage2;
  654. private WindowManager.LayoutParams layoutParams;
  655. private float initialTouchX, initialTouchY;
  656. private int initialX, initialY;
  657. int ICON_SIZE = 0;
  658. // ตัวแปรเพื่อติดตามการเคลื่อนไหว
  659. private boolean isMoved = false;
  660.  
  661.  
  662.  
  663.  
  664.  
  665. private WindowManager.LayoutParams getAttributes(boolean isWindow) {
  666. WindowManager.LayoutParams params = new WindowManager.LayoutParams();
  667. if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
  668. params.type = WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY;
  669. } else {
  670. params.type = WindowManager.LayoutParams.TYPE_PHONE;
  671. }
  672. params.flags = WindowManager.LayoutParams.FLAG_FULLSCREEN
  673. | WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS
  674. | WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION
  675. | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
  676.  
  677. if (isWindow) {
  678. params.flags |= WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE;
  679. }
  680. params.format = PixelFormat.RGBA_8888;
  681. if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
  682. params.layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES;
  683. }
  684. params.gravity = Gravity.START | Gravity.TOP;
  685. params.x = 0;
  686. params.y = 0;
  687. params.width = WindowManager.LayoutParams.MATCH_PARENT; // ใช้ MATCH_PARENT
  688. params.height = WindowManager.LayoutParams.MATCH_PARENT; // ใช้ MATCH_PARENT
  689.  
  690. return params;
  691. }
  692.  
  693.  
  694.  
  695.  
  696.  
  697. @Override
  698. protected void onActivityResult(int requestCode, int resultCode, Intent data) {
  699. super.onActivityResult(requestCode, resultCode, data);
  700. if (requestCode == 1234) {
  701. if (Settings.canDrawOverlays(this)) {
  702. //createFloatingIcon(); // สร้าง Floating Icon
  703. startService(new Intent(MainActivity.this, FloatingModMenuService.class));
  704. }
  705. }
  706. }
  707.  
  708. private int convertDipToPixels(int i) {
  709. return (int) ((((float) i) * getApplicationContext().getResources().getDisplayMetrics().density) + 0.5f);
  710. }
  711.  
  712.  
  713. //#######################################################//#######################################################
  714. //#######################################################//#######################################################
  715.  
  716.  
  717.  
  718. Drawable icon;
  719. private WindowManager mWindowManager_;
  720. private View mFloatingView;
  721. private RelativeLayout mCollapsed;
  722. private LinearLayout patches, mExpandet, settings, mButtonPanel, mTitlle, settingsTitle;
  723. private ImageView startimage, closeimage, closeimage_title, closeimage_settings, mSettinsMenu, openSite;
  724. private SeekBar seek_icon, seek_alpha, seek_red, seek_green, seek_blue;
  725. private WindowManager.LayoutParams params;
  726. private float curent_icon;
  727. private SharedPreferences.Editor editor;
  728. private int mProgress_icon, background_color, alpha, red, green, blue;
  729. private TextView alpha_text, red_text, green_text, blue_text, current_opacity_icon;
  730. private Spinner spinner;
  731.  
  732.  
  733.  
  734.  
  735. private int dp2px(int dp){
  736. final float scale = getResources().getDisplayMetrics().density;
  737. return (int) (dp * scale + 0.5f);
  738. }
  739.  
  740. /* access modifiers changed from: private */
  741. public void Thread() {
  742. if (this.mFloatingView == null) {
  743. return;
  744. }
  745. if (Util.isAppBackground()) {
  746. //this.mFloatingView.setVisibility(View.INVISIBLE);
  747. } else {
  748. this.mFloatingView.setVisibility(View.VISIBLE);
  749. }
  750. }
  751.  
  752.  
  753. public void initFloating() {
  754.  
  755. //MainActivity mainActivity = new MainActivity();
  756. //mainActivity.StartIMGUI();
  757. //MainActivity.StartIMGUI();
  758. AssetManager assetManager = getAssets();
  759. //инициализируем элементы
  760. FrameLayout rootFrame = new FrameLayout(getBaseContext()); //глобальная разметка
  761. RelativeLayout mRootContainer = new RelativeLayout(getBaseContext());//разметка на которую будут помещены две разметки иконки и самого меню
  762. mCollapsed = new RelativeLayout(getBaseContext());//разметка иконки(когда меню свернуто)
  763. mExpandet = new LinearLayout(getBaseContext());//разметка меню(когда меню развернуто)
  764. patches = new LinearLayout(getBaseContext());//разметка самих опций(когда меню развернуто)
  765. mButtonPanel = new LinearLayout(getBaseContext());//разметка кнопок опций(когда меню развернуто)
  766. mTitlle = new LinearLayout(getBaseContext());//разметка заголовка меню(когда меню развернуто)
  767. settingsTitle = new LinearLayout(getBaseContext());//разметка заголовка настроек(когда меню развернуто)
  768. //mCloseMenu = new Button(getBaseContext());//кнопка закрыть меню(когда меню развернуто)
  769. mSettinsMenu = new ImageView(getBaseContext());//кнопка настроить меню(когда меню развернуто)
  770. //прописываем разметку
  771. FrameLayout.LayoutParams flayoutParams = new FrameLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT);
  772. rootFrame.setLayoutParams(flayoutParams);
  773. mRootContainer.setLayoutParams(new FrameLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT));
  774. //корневая разметка плавающей иконки
  775. mCollapsed.setLayoutParams(new RelativeLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT));
  776. mCollapsed.setVisibility(View.VISIBLE);//mExpandet видимый
  777. try {
  778. startimage = new ImageView(getBaseContext());
  779. startimage.setLayoutParams(new RelativeLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT));
  780. //задаём размер иконки
  781. int dimension = 60;//60dp
  782. int dimensionInDp = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dimension, getResources().getDisplayMetrics());
  783. startimage.getLayoutParams().height = dimensionInDp;
  784. startimage.getLayoutParams().width = dimensionInDp;
  785. startimage.requestLayout();
  786. startimage.setScaleType(ImageView.ScaleType.FIT_XY);
  787. InputStream inputStream_hack = assetManager.open("v1on.png"); //ic_hack_floating
  788. icon = Drawable.createFromStream(inputStream_hack, null);
  789. startimage.setImageDrawable(icon);
  790. startimage.setAlpha(curent_icon);
  791. //
  792. closeimage = new ImageView(getBaseContext());
  793. closeimage.setLayoutParams(new RelativeLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT));
  794. ((ViewGroup.MarginLayoutParams) startimage.getLayoutParams()).topMargin = dp2px(10);
  795. //задаём размер иконки закрыть
  796. int dimensionClose = 20;//20dp
  797. int dimensionInDpClose = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dimensionClose, getResources().getDisplayMetrics());
  798. closeimage.getLayoutParams().height = dimensionInDpClose;
  799. closeimage.getLayoutParams().width = dimensionInDpClose;
  800. closeimage.requestLayout();
  801. InputStream inputStream_close = assetManager.open("ic_close.png");
  802. Drawable ic_close = Drawable.createFromStream(inputStream_close, null);
  803. closeimage.setImageDrawable(ic_close);
  804. closeimage.setAlpha(curent_icon);
  805. ((ViewGroup.MarginLayoutParams) closeimage.getLayoutParams()).leftMargin = dp2px(35);
  806. //
  807. //иконка закрыть для развернутого меню
  808. closeimage_title = new ImageView(getBaseContext());
  809. LinearLayout.LayoutParams pp1 = new LinearLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT);
  810. pp1.gravity = Gravity.LEFT;
  811. pp1.height = dimensionInDpClose;
  812. pp1.width = dimensionInDpClose;
  813. closeimage_title.setLayoutParams(pp1);
  814. closeimage_title.requestLayout();
  815. closeimage_title.setImageDrawable(ic_close);
  816. //
  817. closeimage_settings = new ImageView(getBaseContext());
  818. LinearLayout.LayoutParams pp = new LinearLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT);
  819. pp.gravity = Gravity.LEFT;
  820. pp.height = dimensionInDpClose;
  821. pp.width = dimensionInDpClose;
  822. closeimage_settings.setLayoutParams(pp);
  823. closeimage_settings.requestLayout();
  824. closeimage_settings.setImageDrawable(ic_close);
  825. ((ViewGroup.MarginLayoutParams) closeimage_settings.getLayoutParams()).leftMargin = dp2px(95);
  826. //
  827. LinearLayout.LayoutParams set = new LinearLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT);
  828. set.gravity = Gravity.RIGHT;
  829. set.height = dimensionInDpClose;
  830. set.width = dimensionInDpClose;
  831. mSettinsMenu.setLayoutParams(set);
  832. mSettinsMenu.requestLayout();
  833. InputStream inputStream_settings = assetManager.open("ic_settings.png");
  834. Drawable ic_settings = Drawable.createFromStream(inputStream_settings, null);
  835. mSettinsMenu.setImageDrawable(ic_settings);
  836. //
  837. LinearLayout.LayoutParams pp3 = new LinearLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT);
  838. openSite = new ImageView(getBaseContext());
  839. pp3.gravity = Gravity.LEFT;
  840. pp3.height = dimensionInDpClose;
  841. pp3.width = dimensionInDpClose;
  842. openSite.setLayoutParams(pp3);
  843. openSite.requestLayout();
  844. InputStream inputStream_openSite = assetManager.open("ic_open.png");
  845. Drawable ic_openSite = Drawable.createFromStream(inputStream_openSite, null);
  846. openSite.setImageDrawable(ic_openSite);
  847. ((ViewGroup.MarginLayoutParams) openSite.getLayoutParams()).leftMargin = dp2px(95);
  848. } catch (IOException ex) {
  849. Toast.makeText(getBaseContext(), ex.toString(), Toast.LENGTH_LONG).show();
  850. }
  851. //прописываем разметку когда меню развернуто
  852. mExpandet.setVisibility(View.GONE);//mExpandet скрытый
  853. mExpandet.setBackgroundColor(background_color);
  854. //mExpandet.setOrientation(LinearLayout.VERTICAL);
  855. LinearLayout.LayoutParams params_mExpandet = new LinearLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT);
  856. mExpandet.setLayoutParams(params_mExpandet);
  857. ScrollView scrollView = new ScrollView(getBaseContext());
  858. scrollView.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));
  859. patches.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, WRAP_CONTENT));
  860. patches.setOrientation(LinearLayout.VERTICAL);
  861. mButtonPanel.setLayoutParams(new LinearLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT));
  862. mTitlle.setLayoutParams(new LinearLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT));
  863. TextView title_text = new TextView(getBaseContext());
  864. title_text.setText("Mod Menu v1.0.1");
  865. title_text.setTextColor(Color.RED);
  866. title_text.setTypeface(Typeface.DEFAULT_BOLD);
  867. title_text.setTextSize(16);
  868. title_text.setPadding(10, 10, 10, 10);
  869. LinearLayout.LayoutParams title_Layout = new LinearLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT);
  870. title_Layout.gravity = Gravity.CENTER;
  871. title_text.setLayoutParams(title_Layout);
  872. mTitlle.addView(title_text);
  873. mTitlle.addView(closeimage_title);
  874. settings = new LinearLayout(getBaseContext());
  875. settings.setVisibility(View.GONE);//mExpandet скрытый
  876. settings.setBackgroundColor(background_color);
  877. settings.setOrientation(LinearLayout.VERTICAL);
  878. settings.setLayoutParams(new LinearLayout.LayoutParams(dp2px(175), WRAP_CONTENT));
  879. TextView settings_title_text = new TextView(getBaseContext());
  880. settings_title_text.setText("Settings");
  881. settings_title_text.setTextColor(Color.RED);
  882. settings_title_text.setTypeface(Typeface.DEFAULT_BOLD);
  883. settings_title_text.setTextSize(16);
  884. //settings_title_text.setPadding(10, 10, 10, 10);
  885. settingsTitle.setLayoutParams(new LinearLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT));
  886. LinearLayout.LayoutParams settingstitle_Layout = new LinearLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT);
  887. settingstitle_Layout.gravity = Gravity.CENTER;
  888. settings_title_text.setLayoutParams(settingstitle_Layout);
  889. ScrollView settings_scroll = new ScrollView(getBaseContext());
  890. settings_scroll.setLayoutParams(new LinearLayout.LayoutParams(WRAP_CONTENT, dp2px(160)));
  891. LinearLayout settings_scroll_linear = new LinearLayout(getBaseContext());
  892. settings_scroll_linear.setLayoutParams(new LinearLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT));
  893. settings_scroll_linear.setOrientation(LinearLayout.VERTICAL);
  894. TextView opacity_icon = new TextView(getBaseContext());
  895. opacity_icon.setText("Change opacity icon");
  896. opacity_icon.setTypeface(Typeface.DEFAULT_BOLD);
  897. opacity_icon.setTextColor(Color.WHITE);
  898. opacity_icon.setPadding(10, 10, 10, 10);
  899. current_opacity_icon = new TextView(getBaseContext());
  900. current_opacity_icon.setText("Opacity:" + curent_icon);
  901. current_opacity_icon.setTextColor(Color.WHITE);
  902. current_opacity_icon.setPadding(10, 10, 10, 10);
  903. TextView background_menu = new TextView(getBaseContext());
  904. background_menu.setText("Change color background");
  905. background_menu.setTypeface(Typeface.DEFAULT_BOLD);
  906. background_menu.setTextColor(Color.WHITE);
  907. background_menu.setPadding(10, 10, 10, 10);
  908. alpha_text = new TextView(getBaseContext());
  909. alpha_text.setText("Alpha:" + alpha);
  910. alpha_text.setTextColor(Color.WHITE);
  911. alpha_text.setPadding(10, 10, 10, 10);
  912. red_text = new TextView(getBaseContext());
  913. red_text.setText("Red:" + red);
  914. red_text.setTextColor(Color.WHITE);
  915. red_text.setPadding(10, 10, 10, 10);
  916. green_text = new TextView(getBaseContext());
  917. green_text.setText("Green:" + green);
  918. green_text.setTextColor(Color.WHITE);
  919. green_text.setPadding(10, 10, 10, 10);
  920. blue_text = new TextView(getBaseContext());
  921. blue_text.setText("Blue:" + blue);
  922. blue_text.setTextColor(Color.WHITE);
  923. blue_text.setPadding(10, 10, 10, 10);
  924. seek_icon = new SeekBar(getBaseContext());
  925. seek_icon.setMax(10);
  926. seek_icon.setProgress(mProgress_icon);
  927. seek_alpha = new SeekBar(getBaseContext());
  928. seek_alpha.setMax(255);
  929. seek_alpha.setProgress(alpha);
  930. seek_red = new SeekBar(getBaseContext());
  931. seek_red.setProgress(red);
  932. seek_red.setMax(255);
  933. seek_green = new SeekBar(getBaseContext());
  934. seek_green.setMax(255);
  935. seek_green.setProgress(green);
  936. seek_blue = new SeekBar(getBaseContext());
  937. seek_blue.setProgress(blue);
  938. seek_blue.setMax(255);
  939. /*Спиннер на всякий случай*/
  940. /* String[] items = {"Item 1", "Item 2", "Item 3"};
  941. spinner = new Spinner(getBaseContext());
  942. ArrayAdapter<String> arrayAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_dropdown_item, items);
  943. spinner.setAdapter(arrayAdapter);
  944. spinner.setBackgroundColor(background_color);*/
  945. settingsTitle.addView(settings_title_text);
  946. settingsTitle.addView(closeimage_settings);
  947. settings.addView(settingsTitle);
  948. settings.addView(settings_scroll);
  949. settings_scroll.addView(settings_scroll_linear);
  950. settings_scroll_linear.addView(opacity_icon);
  951. settings_scroll_linear.addView(current_opacity_icon);
  952. settings_scroll_linear.addView(seek_icon);
  953. settings_scroll_linear.addView(background_menu);
  954. settings_scroll_linear.addView(alpha_text);
  955. settings_scroll_linear.addView(seek_alpha);
  956. settings_scroll_linear.addView(red_text);
  957. settings_scroll_linear.addView(seek_red);
  958. settings_scroll_linear.addView(green_text);
  959. settings_scroll_linear.addView(seek_green);
  960. settings_scroll_linear.addView(blue_text);
  961. settings_scroll_linear.addView(seek_blue);
  962. //settings_scroll_linear.addView(spinner);
  963.  
  964. //добавляем элементы в корневую разметку
  965. rootFrame.addView(mRootContainer);
  966. //добавляем элементы в mRootContainer
  967. mRootContainer.addView(mCollapsed);//меню закрыто
  968. mRootContainer.addView(mExpandet);//меню открыто
  969. mRootContainer.addView(settings);
  970. //добавляем элементы в mCollapsed
  971. mCollapsed.addView(startimage);
  972. mCollapsed.addView(closeimage);
  973. //добавляем элементы в mExpandet
  974. //mExpandet.addView(scrollView);
  975. //scrollView.addView(patches);
  976. mExpandet.addView(patches);
  977. patches.addView(mTitlle);
  978. //добавляем элементы в mButtonPanel
  979. mButtonPanel.addView(mSettinsMenu);
  980. mButtonPanel.addView(openSite);
  981. mFloatingView = rootFrame;//rootFrame(mFloatingView) корневая разметка всего окна
  982.  
  983. //Add the view to the window.
  984. if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
  985. params = new WindowManager.LayoutParams(
  986. WRAP_CONTENT,
  987. WRAP_CONTENT,
  988. WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY,
  989. WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,
  990. PixelFormat.TRANSLUCENT);
  991. } else {
  992. params = new WindowManager.LayoutParams(
  993. WRAP_CONTENT,
  994. WRAP_CONTENT,
  995. WindowManager.LayoutParams.TYPE_PHONE,
  996. WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,
  997. PixelFormat.TRANSLUCENT);
  998. }
  999.  
  1000. //Specify the view position
  1001. params.gravity = Gravity.TOP | Gravity.START; //Initially view will be added to top-left corner
  1002. params.x = 0;
  1003. params.y = 100;
  1004.  
  1005. //Add the view to the window
  1006. mWindowManager_ = (WindowManager) getSystemService(WINDOW_SERVICE);
  1007. //mWindowManager_.addView(mFloatingView, params);
  1008.  
  1009. //The root element of the collapsed view layout
  1010. final View collapsedView = mCollapsed;
  1011. //The root element of the expanded view layout
  1012. final View expandedView = mExpandet;
  1013.  
  1014. mFloatingView.setOnTouchListener(onTouchListener());
  1015. startimage.setOnTouchListener(onTouchListener());
  1016.  
  1017. initMenuButton(collapsedView, expandedView, vTouch, display);
  1018. //modMenu();
  1019. }
  1020.  
  1021. //обработчик события, когда перетаскивают объект касанием
  1022. private View.OnTouchListener onTouchListener() {
  1023. return new View.OnTouchListener() {
  1024. final View collapsedView = mCollapsed;
  1025. //The root element of the expanded view layout
  1026. final View expandedView = mExpandet;
  1027. private int initialX;
  1028. private int initialY;
  1029. private float initialTouchX;
  1030. private float initialTouchY;
  1031.  
  1032. @Override
  1033. public boolean onTouch(View v, MotionEvent event) {
  1034. switch (event.getAction()) {
  1035. case MotionEvent.ACTION_DOWN:
  1036.  
  1037. //remember the initial position.
  1038. initialX = params.x;
  1039. initialY = params.y;
  1040.  
  1041. //get the touch location
  1042. initialTouchX = event.getRawX();
  1043. initialTouchY = event.getRawY();
  1044. return true;
  1045. case MotionEvent.ACTION_UP:
  1046. int Xdiff = (int) (event.getRawX() - initialTouchX);
  1047. int Ydiff = (int) (event.getRawY() - initialTouchY);
  1048.  
  1049. //The check for Xdiff <10 && YDiff< 10 because sometime elements moves a little while clicking.
  1050. //So that is click event.
  1051. if (Xdiff < 10 && Ydiff < 10) {
  1052. if (isViewCollapsed()) {
  1053. //When user clicks on the image view of the collapsed layout,
  1054. //visibility of the collapsed layout will be changed to "View.GONE"
  1055. //and expanded view will become visible.
  1056. //collapsedView.setVisibility(View.GONE);
  1057. //expandedView.setVisibility(View.VISIBLE);
  1058. เปลี่ยนสลับไอค่อน();
  1059. }
  1060. }
  1061. return true;
  1062. case MotionEvent.ACTION_MOVE:
  1063. //Calculate the X and Y coordinates of the view.
  1064. params.x = initialX + (int) (event.getRawX() - initialTouchX);
  1065. params.y = initialY + (int) (event.getRawY() - initialTouchY);
  1066.  
  1067. //Update the layout with new X & Y coordinate
  1068. mWindowManager_.updateViewLayout(mFloatingView, params);
  1069. return true;
  1070. }
  1071. return false;
  1072. }
  1073. };
  1074. }
  1075.  
  1076.  
  1077.  
  1078. private boolean hide_imgui = false;
  1079. public void เปลี่ยนสลับไอค่อน(){
  1080. //collapsedView.setVisibility(View.GONE);
  1081. //expandedView.setVisibility(View.VISIBLE);
  1082. hide_imgui = (hide_imgui == false);
  1083. if (hide_imgui){
  1084. vTouch.setVisibility(View.GONE);
  1085. display.setVisibility(View.INVISIBLE);
  1086. } else {
  1087. vTouch.setVisibility(View.VISIBLE);
  1088. display.setVisibility(View.VISIBLE);
  1089. }
  1090. Util.Tost("Hello,999",MainActivity.this);
  1091. }
  1092.  
  1093.  
  1094. //private FrameLayout _vTouch;
  1095. //private GLES3JNIView _display;
  1096. //иницализируем обработчики событий для кнопок итд..
  1097. public void initMenuButton(final View collapsedView, final View expandedView, final FrameLayout vTouch, final GLES3JNIView display) {
  1098. }
  1099.  
  1100.  
  1101. //загрузка и установка настроек по-умолчанию
  1102. private void loadPrefs() {
  1103. SharedPreferences preferences = getApplicationContext().getSharedPreferences("mod_menu", 0);
  1104. editor = preferences.edit();
  1105. background_color = preferences.getInt("background_color", -14606047);
  1106. curent_icon = preferences.getFloat("current_background", 1);
  1107. alpha = preferences.getInt("current_progress_alpha", 255);
  1108. red = preferences.getInt("current_progress_red", 33);
  1109. green = preferences.getInt("current_progress_green", 33);
  1110. blue = preferences.getInt("current_progress_blue", 33);
  1111. mProgress_icon = preferences.getInt("current_progress_icon", 10);
  1112. }
  1113.  
  1114. private boolean isViewCollapsed() {
  1115. return mFloatingView == null || mCollapsed.getVisibility() == View.VISIBLE;
  1116. }
  1117.  
  1118.  
  1119.  
  1120. @Override
  1121. public void onDestroy() {
  1122. super.onDestroy();
  1123. if (mFloatingView != null){
  1124. //mWindowManager_.removeView(mFloatingView);
  1125. Toast.makeText(getBaseContext(), "Mod Menu Service is stopped", Toast.LENGTH_SHORT).show();
  1126. }
  1127. if (manager != null){
  1128. //manager.updateViewLayout(vTouch, params);
  1129. }
  1130. }
  1131.  
  1132. private interface SW {
  1133. void OnWrite(boolean z);
  1134. }
  1135.  
  1136. @Override
  1137. public void onResume() {
  1138. super.onResume();
  1139. // updateFloatingWindow(); // เรียกฟังก์ชันที่อัปเดตขนาดและตำแหน่ง
  1140. }
  1141.  
  1142.  
  1143. //#######################################################//#######################################################
  1144. //#######################################################//#######################################################
  1145.  
  1146. }
  1147.  
Advertisement
Add Comment
Please, Sign In to add comment