diff --git a/AJCode.java b/AJCode.java new file mode 100644 index 0000000..6860b0b --- /dev/null +++ b/AJCode.java @@ -0,0 +1,25 @@ +package com.xc3fff0e.xmanager; + +import android.graphics.drawable.*; +import android.view.*; +import android.widget.*; +import android.content.res.*; +import android.graphics.*; +import android.view.Gravity; + +public class AJCode{ + +public static void setBackgroundGradient(View view, int color1, int color2){ +GradientDrawable gd = new GradientDrawable(GradientDrawable.Orientation.BL_TR, new int[] {color1,color2}); +view.setBackgroundDrawable(gd); +} + +public static void setRoundedRipple(View v,int LT,int RT,int RB,int LB,int color1,int size,int color2,int color3){ +GradientDrawable shape = new GradientDrawable(); +shape.setColor(color1); +shape.setCornerRadii(new float[]{(float)LT,(float)LT,(float)RT,(float)RT,(float)RB,(float)RB,(float)LB,(float)LB}); +shape.setStroke(size, color2); +RippleDrawable ripdr = new RippleDrawable(new ColorStateList(new int[][]{new int[]{}}, new int[]{color3}), shape, null); +v.setBackgroundDrawable(ripdr); +} +} \ No newline at end of file diff --git a/BluetoothConnect.java b/BluetoothConnect.java new file mode 100644 index 0000000..3fdea27 --- /dev/null +++ b/BluetoothConnect.java @@ -0,0 +1,111 @@ +package com.xc3fff0e.xmanager; + +import android.app.Activity; +import android.bluetooth.BluetoothAdapter; +import android.bluetooth.BluetoothDevice; +import android.content.Intent; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Set; +import java.util.UUID; + +public class BluetoothConnect { +private static final String DEFAULT_UUID = "00001101-0000-1000-8000-00805F9B34FB"; + +private Activity activity; + +private BluetoothAdapter bluetoothAdapter; + +public BluetoothConnect(Activity activity) { +this.activity = activity; +this.bluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); +} + +public boolean isBluetoothEnabled() { +if(bluetoothAdapter != null) return true; + +return false; +} + +public boolean isBluetoothActivated() { +if(bluetoothAdapter == null) return false; + +return bluetoothAdapter.isEnabled(); +} + +public void activateBluetooth() { +Intent intent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE); +activity.startActivity(intent); +} + +public String getRandomUUID() { +return String.valueOf(UUID.randomUUID()); +} + +public void getPairedDevices(ArrayList> results) { +Set pairedDevices = bluetoothAdapter.getBondedDevices(); + +if(pairedDevices.size() > 0) { +for(BluetoothDevice device : pairedDevices) { +HashMap result = new HashMap<>(); +result.put("name", device.getName()); +result.put("address", device.getAddress()); + +results.add(result); +} +} +} + +public void readyConnection(BluetoothConnectionListener listener, String tag) { +if(BluetoothController.getInstance().getState().equals(BluetoothController.STATE_NONE)) { +BluetoothController.getInstance().start(this, listener, tag, UUID.fromString(DEFAULT_UUID), bluetoothAdapter); +} +} + +public void readyConnection(BluetoothConnectionListener listener, String uuid, String tag) { +if(BluetoothController.getInstance().getState().equals(BluetoothController.STATE_NONE)) { +BluetoothController.getInstance().start(this, listener, tag, UUID.fromString(uuid), bluetoothAdapter); +} +} + + +public void startConnection(BluetoothConnectionListener listener, String address, String tag) { +BluetoothDevice device = bluetoothAdapter.getRemoteDevice(address); + +BluetoothController.getInstance().connect(device, this, listener, tag, UUID.fromString(DEFAULT_UUID), bluetoothAdapter); +} + +public void startConnection(BluetoothConnectionListener listener, String uuid, String address, String tag) { +BluetoothDevice device = bluetoothAdapter.getRemoteDevice(address); + +BluetoothController.getInstance().connect(device, this, listener, tag, UUID.fromString(uuid), bluetoothAdapter); +} + +public void stopConnection(BluetoothConnectionListener listener, String tag) { +BluetoothController.getInstance().stop(this, listener, tag); +} + +public void sendData(BluetoothConnectionListener listener, String data, String tag) { +String state = BluetoothController.getInstance().getState(); + +if(!state.equals(BluetoothController.STATE_CONNECTED)) { +listener.onConnectionError(tag, state, "Bluetooth is not connected yet"); +return; +} + +BluetoothController.getInstance().write(data.getBytes()); +} + +public Activity getActivity() { +return activity; +} + +public interface BluetoothConnectionListener { +void onConnected(String tag, HashMap deviceData); +void onDataReceived(String tag, byte[] data, int bytes); +void onDataSent(String tag, byte[] data); +void onConnectionError(String tag, String connectionState, String message); +void onConnectionStopped(String tag); +} +} \ No newline at end of file diff --git a/BluetoothController.java b/BluetoothController.java new file mode 100644 index 0000000..31b850b --- /dev/null +++ b/BluetoothController.java @@ -0,0 +1,354 @@ +package com.xc3fff0e.xmanager; + +import android.bluetooth.BluetoothAdapter; +import android.bluetooth.BluetoothDevice; +import android.bluetooth.BluetoothServerSocket; +import android.bluetooth.BluetoothSocket; + +import java.io.InputStream; +import java.io.OutputStream; +import java.util.HashMap; +import java.util.UUID; + +public class BluetoothController { +public static final String STATE_NONE = "none"; +public static final String STATE_LISTEN = "listen"; +public static final String STATE_CONNECTING = "connecting"; +public static final String STATE_CONNECTED = "connected"; + +private AcceptThread acceptThread; +private ConnectThread connectThread; +private ConnectedThread connectedThread; + +private String state = STATE_NONE; + +private static BluetoothController instance; + +public static synchronized BluetoothController getInstance() { +if(instance == null) { +instance = new BluetoothController(); +} + +return instance; +} + +public synchronized void start(BluetoothConnect bluetoothConnect, BluetoothConnect.BluetoothConnectionListener listener, String tag, UUID uuid, BluetoothAdapter bluetoothAdapter) { +if (connectThread != null) { +connectThread.cancel(); +connectThread = null; +} + +if (connectedThread != null) { +connectedThread.cancel(); +connectedThread = null; +} + +if (acceptThread != null) { +acceptThread.cancel(); +acceptThread = null; +} + +acceptThread = new AcceptThread(bluetoothConnect, listener, tag, uuid, bluetoothAdapter); +acceptThread.start();} + +public synchronized void connect(BluetoothDevice device, BluetoothConnect bluetoothConnect, BluetoothConnect.BluetoothConnectionListener listener, String tag, UUID uuid, BluetoothAdapter bluetoothAdapter) { +if (state.equals(STATE_CONNECTING)) { +if (connectThread != null) { +connectThread.cancel(); +connectThread = null; +} +} + +if (connectedThread != null) { +connectedThread.cancel(); +connectedThread = null; +} + +connectThread = new ConnectThread(device, bluetoothConnect, listener, tag, uuid, bluetoothAdapter); +connectThread.start(); +} + +public synchronized void connected(BluetoothSocket socket, final BluetoothDevice device, BluetoothConnect bluetoothConnect, final BluetoothConnect.BluetoothConnectionListener listener, final String tag) { +if (connectThread != null) { +connectThread.cancel(); +connectThread = null; +} + +if (connectedThread != null) { +connectedThread.cancel(); +connectedThread = null; +} + +if (acceptThread != null) { +acceptThread.cancel(); +acceptThread = null; +} + +connectedThread = new ConnectedThread(socket, bluetoothConnect, listener, tag); +connectedThread.start(); + +bluetoothConnect.getActivity().runOnUiThread(new Runnable() { +@Override +public void run() { +HashMap deviceMap = new HashMap<>(); +deviceMap.put("name", device.getName()); +deviceMap.put("address", device.getAddress()); + +listener.onConnected(tag, deviceMap); +} +}); +} + +public synchronized void stop(BluetoothConnect bluetoothConnect, final BluetoothConnect.BluetoothConnectionListener listener, final String tag) { +if (connectThread != null) { +connectThread.cancel(); +connectThread = null; +} + +if (connectedThread != null) { +connectedThread.cancel(); +connectedThread = null; +} + +if (acceptThread != null) { +acceptThread.cancel(); +acceptThread = null; +} + +state = STATE_NONE; + +bluetoothConnect.getActivity().runOnUiThread(new Runnable() { +@Override +public void run() { +listener.onConnectionStopped(tag); +} +}); +} + +public void write(byte[] out) { +ConnectedThread r; + +synchronized (this) { +if (!state.equals(STATE_CONNECTED)) return; +r = connectedThread; +} + +r.write(out); +} + +public void connectionFailed(BluetoothConnect bluetoothConnect, final BluetoothConnect.BluetoothConnectionListener listener, final String tag, final String message) { +state = STATE_NONE; + +bluetoothConnect.getActivity().runOnUiThread(new Runnable() { +@Override +public void run() { +listener.onConnectionError(tag, state, message); +} +}); +} + +public void connectionLost(BluetoothConnect bluetoothConnect, final BluetoothConnect.BluetoothConnectionListener listener, final String tag) { +state = STATE_NONE; + +bluetoothConnect.getActivity().runOnUiThread(new Runnable() { +@Override +public void run() { +listener.onConnectionError(tag, state, "Bluetooth connection is disconnected"); +} +}); +} + +public String getState() { +return state; +} + +private class AcceptThread extends Thread { +private BluetoothServerSocket serverSocket; + +private BluetoothConnect bluetoothConnect; +private BluetoothConnect.BluetoothConnectionListener listener; +private String tag; + +public AcceptThread(BluetoothConnect bluetoothConnect, BluetoothConnect.BluetoothConnectionListener listener, String tag, UUID uuid, BluetoothAdapter bluetoothAdapter) { +this.bluetoothConnect = bluetoothConnect; +this.listener = listener; +this.tag = tag; + +try { +serverSocket = bluetoothAdapter.listenUsingRfcommWithServiceRecord(tag, uuid); +} catch (Exception e) { +e.printStackTrace(); +} + +state = STATE_LISTEN; +} + +@Override +public void run() { +BluetoothSocket bluetoothSocket; + +while (!state.equals(STATE_CONNECTED)) { +try { +bluetoothSocket = serverSocket.accept(); +} catch (Exception e) { +e.printStackTrace(); +break; +} + +if (bluetoothSocket != null) { +synchronized (BluetoothController.this) { +switch (state) { +case STATE_LISTEN: +case STATE_CONNECTING: +connected(bluetoothSocket, bluetoothSocket.getRemoteDevice(), bluetoothConnect, listener, tag); +break; +case STATE_NONE: +case STATE_CONNECTED: +try { +bluetoothSocket.close(); +} catch (Exception e) { +e.printStackTrace(); +} +break; +} +} +} +} +} + +public void cancel() { +try { +serverSocket.close(); +} catch (Exception e) { +e.printStackTrace(); +} +} +} + +private class ConnectThread extends Thread { +private BluetoothDevice device; +private BluetoothSocket socket; + +private BluetoothConnect bluetoothConnect; +private BluetoothConnect.BluetoothConnectionListener listener; +private String tag; +private BluetoothAdapter bluetoothAdapter; + +public ConnectThread(BluetoothDevice device, BluetoothConnect bluetoothConnect, BluetoothConnect.BluetoothConnectionListener listener, String tag, UUID uuid, BluetoothAdapter bluetoothAdapter) { +this.device = device; +this.bluetoothConnect = bluetoothConnect; +this.listener = listener; +this.tag = tag; +this.bluetoothAdapter = bluetoothAdapter; + +try { +socket = device.createRfcommSocketToServiceRecord(uuid); +} catch (Exception e) { +e.printStackTrace(); +} + +state = STATE_CONNECTING; +} + +@Override +public void run() { +bluetoothAdapter.cancelDiscovery(); + +try { +socket.connect(); +} catch (Exception e) { +try { +socket.close(); +} catch (Exception e2) { +e2.printStackTrace(); +} +connectionFailed(bluetoothConnect, listener, tag, e.getMessage()); +return; +} + +synchronized (BluetoothController.this) { +connectThread = null; +} + +connected(socket, device, bluetoothConnect, listener, tag); +} + +public void cancel() { +try { +socket.close(); +} catch (Exception e) { +e.printStackTrace(); +} +} +} + +private class ConnectedThread extends Thread { +private BluetoothSocket socket; +private InputStream inputStream; +private OutputStream outputStream; + +private BluetoothConnect bluetoothConnect; +private BluetoothConnect.BluetoothConnectionListener listener; +private String tag; + +public ConnectedThread(BluetoothSocket socket, BluetoothConnect bluetoothConnect, BluetoothConnect.BluetoothConnectionListener listener, String tag) { +this.bluetoothConnect = bluetoothConnect; +this.listener = listener; +this.tag = tag; + +this.socket = socket; + +try { +inputStream = socket.getInputStream(); +outputStream = socket.getOutputStream(); +} catch (Exception e) { +e.printStackTrace(); +} + +state = STATE_CONNECTED; +} + +public void run() { +while (state.equals(STATE_CONNECTED)) { +try { +final byte[] buffer = new byte[1024]; +final int bytes = inputStream.read(buffer); + +bluetoothConnect.getActivity().runOnUiThread(new Runnable() { +@Override +public void run() { +listener.onDataReceived(tag, buffer, bytes); +} +}); +} catch (Exception e) { +e.printStackTrace(); +connectionLost(bluetoothConnect, listener, tag); +break; +} +} +} + +public void write(final byte[] buffer) { +try { +outputStream.write(buffer); + +bluetoothConnect.getActivity().runOnUiThread(new Runnable() { +@Override +public void run() { +listener.onDataSent(tag, buffer); +} +}); +} catch (Exception e) { +e.printStackTrace(); +} +} + +public void cancel() { +try { +socket.close(); +} catch (Exception e) { +e.printStackTrace(); +} +} +} +} \ No newline at end of file diff --git a/FileUtil.java b/FileUtil.java new file mode 100644 index 0000000..d995925 --- /dev/null +++ b/FileUtil.java @@ -0,0 +1,604 @@ +package com.xc3fff0e.xmanager; + +import android.content.ContentResolver; +import android.content.ContentUris; +import android.content.Context; +import android.database.Cursor; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; +import android.graphics.Canvas; +import android.graphics.ColorFilter; +import android.graphics.ColorMatrix; +import android.graphics.ColorMatrixColorFilter; +import android.graphics.LightingColorFilter; +import android.graphics.Matrix; +import android.graphics.Paint; +import android.graphics.PorterDuff; +import android.graphics.PorterDuffXfermode; +import android.graphics.Rect; +import android.graphics.RectF; +import android.media.ExifInterface; +import android.net.Uri; +import android.os.Environment; +import android.provider.DocumentsContract; +import android.provider.MediaStore; +import android.text.TextUtils; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.net.URLDecoder; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; + +public class FileUtil { + +private static void createNewFile(String path) { +int lastSep = path.lastIndexOf(File.separator); +if (lastSep > 0) { +String dirPath = path.substring(0, lastSep); +makeDir(dirPath); +} + +File file = new File(path); + +try { +if (!file.exists()) +file.createNewFile(); +} catch (IOException e) { +e.printStackTrace(); +} +} + +public static String readFile(String path) { +createNewFile(path); + +StringBuilder sb = new StringBuilder(); +FileReader fr = null; +try { +fr = new FileReader(new File(path)); + +char[] buff = new char[1024]; +int length = 0; + +while ((length = fr.read(buff)) > 0) { +sb.append(new String(buff, 0, length)); +} +} catch (IOException e) { +e.printStackTrace(); +} finally { +if (fr != null) { +try { +fr.close(); +} catch (Exception e) { +e.printStackTrace(); +} +} +} + +return sb.toString(); +} + +public static void writeFile(String path, String str) { +createNewFile(path); +FileWriter fileWriter = null; + +try { +fileWriter = new FileWriter(new File(path), false); +fileWriter.write(str); +fileWriter.flush(); +} catch (IOException e) { +e.printStackTrace(); +} finally { +try { +if (fileWriter != null) +fileWriter.close(); +} catch (IOException e) { +e.printStackTrace(); +} +} +} + +public static void copyFile(String sourcePath, String destPath) { +if (!isExistFile(sourcePath)) return; +createNewFile(destPath); + +FileInputStream fis = null; +FileOutputStream fos = null; + +try { +fis = new FileInputStream(sourcePath); +fos = new FileOutputStream(destPath, false); + +byte[] buff = new byte[1024]; +int length = 0; + +while ((length = fis.read(buff)) > 0) { +fos.write(buff, 0, length); +} +} catch (IOException e) { +e.printStackTrace(); +} finally { +if (fis != null) { +try { +fis.close(); +} catch (IOException e) { +e.printStackTrace(); +} +} +if (fos != null) { +try { +fos.close(); +} catch (IOException e) { +e.printStackTrace(); +} +} +} +} + +public static void moveFile(String sourcePath, String destPath) { +copyFile(sourcePath, destPath); +deleteFile(sourcePath); +} + +public static void deleteFile(String path) { +File file = new File(path); + +if (!file.exists()) return; + +if (file.isFile()) { +file.delete(); +return; +} + +File[] fileArr = file.listFiles(); + +if (fileArr != null) { +for (File subFile : fileArr) { +if (subFile.isDirectory()) { +deleteFile(subFile.getAbsolutePath()); +} + +if (subFile.isFile()) { +subFile.delete(); +} +} +} + +file.delete(); +} + +public static boolean isExistFile(String path) { +File file = new File(path); +return file.exists(); +} + +public static void makeDir(String path) { +if (!isExistFile(path)) { +File file = new File(path); +file.mkdirs(); +} +} + +public static void listDir(String path, ArrayList list) { +File dir = new File(path); +if (!dir.exists() || dir.isFile()) return; + +File[] listFiles = dir.listFiles(); +if (listFiles == null || listFiles.length <= 0) return; + +if (list == null) return; +list.clear(); +for (File file : listFiles) { +list.add(file.getAbsolutePath()); +} +} + +public static boolean isDirectory(String path) { +if (!isExistFile(path)) return false; +return new File(path).isDirectory(); +} + +public static boolean isFile(String path) { +if (!isExistFile(path)) return false; +return new File(path).isFile(); +} + +public static long getFileLength(String path) { +if (!isExistFile(path)) return 0; +return new File(path).length(); +} + +public static String getExternalStorageDir() { +return Environment.getExternalStorageDirectory().getAbsolutePath(); +} + +public static String getPackageDataDir(Context context) { +return context.getExternalFilesDir(null).getAbsolutePath(); +} + +public static String getPublicDir(String type) { +return Environment.getExternalStoragePublicDirectory(type).getAbsolutePath(); +} + +public static String convertUriToFilePath(final Context context, final Uri uri) { +String path = null; +if (DocumentsContract.isDocumentUri(context, uri)) { +if (isExternalStorageDocument(uri)) { +final String docId = DocumentsContract.getDocumentId(uri); +final String[] split = docId.split(":"); +final String type = split[0]; + +if ("primary".equalsIgnoreCase(type)) { +path = Environment.getExternalStorageDirectory() + "/" + split[1]; +} +} else if (isDownloadsDocument(uri)) { +final String id = DocumentsContract.getDocumentId(uri); + +if (!TextUtils.isEmpty(id)) { +if (id.startsWith("raw:")) { +return id.replaceFirst("raw:", ""); +} +} + +final Uri contentUri = ContentUris +.withAppendedId(Uri.parse("content://downloads/public_downloads"), Long.valueOf(id)); + +path = getDataColumn(context, contentUri, null, null); +} else if (isMediaDocument(uri)) { +final String docId = DocumentsContract.getDocumentId(uri); +final String[] split = docId.split(":"); +final String type = split[0]; + +Uri contentUri = null; +if ("image".equals(type)) { +contentUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI; +} else if ("video".equals(type)) { +contentUri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI; +} else if ("audio".equals(type)) { +contentUri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI; +} + +final String selection = MediaStore.Audio.Media._ID + "=?"; +final String[] selectionArgs = new String[]{ +split[1] +}; + +path = getDataColumn(context, contentUri, selection, selectionArgs); +} +} else if (ContentResolver.SCHEME_CONTENT.equalsIgnoreCase(uri.getScheme())) { +path = getDataColumn(context, uri, null, null); +} else if (ContentResolver.SCHEME_FILE.equalsIgnoreCase(uri.getScheme())) { +path = uri.getPath(); +} + +if (path != null) { +try { +return URLDecoder.decode(path, "UTF-8"); +}catch(Exception e){ +return null; +} +} +return null; +} + +private static String getDataColumn(Context context, Uri uri, String selection, String[] selectionArgs) { +Cursor cursor = null; + +final String column = MediaStore.Images.Media.DATA; +final String[] projection = { +column +}; + +try { +cursor = context.getContentResolver().query(uri, projection, selection, selectionArgs, null); +if (cursor != null && cursor.moveToFirst()) { +final int column_index = cursor.getColumnIndexOrThrow(column); +return cursor.getString(column_index); +} +} catch (Exception e) { + +} finally { +if (cursor != null) { +cursor.close(); +} +} +return null; +} + + +private static boolean isExternalStorageDocument(Uri uri) { +return "com.android.externalstorage.documents".equals(uri.getAuthority()); +} + +private static boolean isDownloadsDocument(Uri uri) { +return "com.android.providers.downloads.documents".equals(uri.getAuthority()); +} + +private static boolean isMediaDocument(Uri uri) { +return "com.android.providers.media.documents".equals(uri.getAuthority()); +} + +private static void saveBitmap(Bitmap bitmap, String destPath) { +FileOutputStream out = null; +FileUtil.createNewFile(destPath); +try { +out = new FileOutputStream(new File(destPath)); +bitmap.compress(Bitmap.CompressFormat.PNG, 100, out); +} catch (Exception e) { +e.printStackTrace(); +} finally { +try { +if (out != null) { +out.close(); +} +} catch (IOException e) { +e.printStackTrace(); +} +} +} + +public static Bitmap getScaledBitmap(String path, int max) { +Bitmap src = BitmapFactory.decodeFile(path); + +int width = src.getWidth(); +int height = src.getHeight(); +float rate = 0.0f; + +if (width > height) { +rate = max / (float) width; +height = (int) (height * rate); +width = max; +} else { +rate = max / (float) height; +width = (int) (width * rate); +height = max; +} + +return Bitmap.createScaledBitmap(src, width, height, true); +} + +public static int calculateInSampleSize(BitmapFactory.Options options, int reqWidth, int reqHeight) { +final int width = options.outWidth; +final int height = options.outHeight; +int inSampleSize = 1; + +if (height > reqHeight || width > reqWidth) { +final int halfHeight = height / 2; +final int halfWidth = width / 2; + +while ((halfHeight / inSampleSize) >= reqHeight && (halfWidth / inSampleSize) >= reqWidth) { +inSampleSize *= 2; +} +} + +return inSampleSize; +} + +public static Bitmap decodeSampleBitmapFromPath(String path, int reqWidth, int reqHeight) { +final BitmapFactory.Options options = new BitmapFactory.Options(); +options.inJustDecodeBounds = true; +BitmapFactory.decodeFile(path, options); + +options.inSampleSize = calculateInSampleSize(options, reqWidth, reqHeight); + +options.inJustDecodeBounds = false; +return BitmapFactory.decodeFile(path, options); +} + +public static void resizeBitmapFileRetainRatio(String fromPath, String destPath, int max) { +if (!isExistFile(fromPath)) return; +Bitmap bitmap = getScaledBitmap(fromPath, max); +saveBitmap(bitmap, destPath); +} + +public static void resizeBitmapFileToSquare(String fromPath, String destPath, int max) { +if (!isExistFile(fromPath)) return; +Bitmap src = BitmapFactory.decodeFile(fromPath); +Bitmap bitmap = Bitmap.createScaledBitmap(src, max, max, true); +saveBitmap(bitmap, destPath); +} + +public static void resizeBitmapFileToCircle(String fromPath, String destPath) { +if (!isExistFile(fromPath)) return; +Bitmap src = BitmapFactory.decodeFile(fromPath); +Bitmap bitmap = Bitmap.createBitmap(src.getWidth(), +src.getHeight(), Bitmap.Config.ARGB_8888); +Canvas canvas = new Canvas(bitmap); + +final int color = 0xff424242; +final Paint paint = new Paint(); +final Rect rect = new Rect(0, 0, src.getWidth(), src.getHeight()); + +paint.setAntiAlias(true); +canvas.drawARGB(0, 0, 0, 0); +paint.setColor(color); +canvas.drawCircle(src.getWidth() / 2, src.getHeight() / 2, +src.getWidth() / 2, paint); +paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN)); +canvas.drawBitmap(src, rect, rect, paint); + +saveBitmap(bitmap, destPath); +} + +public static void resizeBitmapFileWithRoundedBorder(String fromPath, String destPath, int pixels) { +if (!isExistFile(fromPath)) return; +Bitmap src = BitmapFactory.decodeFile(fromPath); +Bitmap bitmap = Bitmap.createBitmap(src.getWidth(), src +.getHeight(), Bitmap.Config.ARGB_8888); +Canvas canvas = new Canvas(bitmap); + +final int color = 0xff424242; +final Paint paint = new Paint(); +final Rect rect = new Rect(0, 0, src.getWidth(), src.getHeight()); +final RectF rectF = new RectF(rect); +final float roundPx = pixels; + +paint.setAntiAlias(true); +canvas.drawARGB(0, 0, 0, 0); +paint.setColor(color); +canvas.drawRoundRect(rectF, roundPx, roundPx, paint); + +paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN)); +canvas.drawBitmap(src, rect, rect, paint); + +saveBitmap(bitmap, destPath); +} + +public static void cropBitmapFileFromCenter(String fromPath, String destPath, int w, int h) { +if (!isExistFile(fromPath)) return; +Bitmap src = BitmapFactory.decodeFile(fromPath); + +int width = src.getWidth(); +int height = src.getHeight(); + +if (width < w && height < h) +return; + +int x = 0; +int y = 0; + +if (width > w) +x = (width - w) / 2; + +if (height > h) +y = (height - h) / 2; + +int cw = w; +int ch = h; + +if (w > width) +cw = width; + +if (h > height) +ch = height; + +Bitmap bitmap = Bitmap.createBitmap(src, x, y, cw, ch); +saveBitmap(bitmap, destPath); +} + +public static void rotateBitmapFile(String fromPath, String destPath, float angle) { +if (!isExistFile(fromPath)) return; +Bitmap src = BitmapFactory.decodeFile(fromPath); +Matrix matrix = new Matrix(); +matrix.postRotate(angle); +Bitmap bitmap = Bitmap.createBitmap(src, 0, 0, src.getWidth(), src.getHeight(), matrix, true); +saveBitmap(bitmap, destPath); +} + +public static void scaleBitmapFile(String fromPath, String destPath, float x, float y) { +if (!isExistFile(fromPath)) return; +Bitmap src = BitmapFactory.decodeFile(fromPath); +Matrix matrix = new Matrix(); +matrix.postScale(x, y); + +int w = src.getWidth(); +int h = src.getHeight(); + +Bitmap bitmap = Bitmap.createBitmap(src, 0, 0, w, h, matrix, true); +saveBitmap(bitmap, destPath); +} + +public static void skewBitmapFile(String fromPath, String destPath, float x, float y) { +if (!isExistFile(fromPath)) return; +Bitmap src = BitmapFactory.decodeFile(fromPath); +Matrix matrix = new Matrix(); +matrix.postSkew(x, y); + +int w = src.getWidth(); +int h = src.getHeight(); + +Bitmap bitmap = Bitmap.createBitmap(src, 0, 0, w, h, matrix, true); +saveBitmap(bitmap, destPath); +} + +public static void setBitmapFileColorFilter(String fromPath, String destPath, int color) { +if (!isExistFile(fromPath)) return; +Bitmap src = BitmapFactory.decodeFile(fromPath); +Bitmap bitmap = Bitmap.createBitmap(src, 0, 0, +src.getWidth() - 1, src.getHeight() - 1); +Paint p = new Paint(); +ColorFilter filter = new LightingColorFilter(color, 1); +p.setColorFilter(filter); +Canvas canvas = new Canvas(bitmap); +canvas.drawBitmap(bitmap, 0, 0, p); +saveBitmap(bitmap, destPath); +} + +public static void setBitmapFileBrightness(String fromPath, String destPath, float brightness) { +if (!isExistFile(fromPath)) return; +Bitmap src = BitmapFactory.decodeFile(fromPath); +ColorMatrix cm = new ColorMatrix(new float[] +{ +1, 0, 0, 0, brightness, +0, 1, 0, 0, brightness, +0, 0, 1, 0, brightness, +0, 0, 0, 1, 0 +}); + +Bitmap bitmap = Bitmap.createBitmap(src.getWidth(), src.getHeight(), src.getConfig()); +Canvas canvas = new Canvas(bitmap); +Paint paint = new Paint(); +paint.setColorFilter(new ColorMatrixColorFilter(cm)); +canvas.drawBitmap(src, 0, 0, paint); +saveBitmap(bitmap, destPath); +} + +public static void setBitmapFileContrast(String fromPath, String destPath, float contrast) { +if (!isExistFile(fromPath)) return; +Bitmap src = BitmapFactory.decodeFile(fromPath); +ColorMatrix cm = new ColorMatrix(new float[] +{ +contrast, 0, 0, 0, 0, +0, contrast, 0, 0, 0, +0, 0, contrast, 0, 0, +0, 0, 0, 1, 0 +}); + +Bitmap bitmap = Bitmap.createBitmap(src.getWidth(), src.getHeight(), src.getConfig()); +Canvas canvas = new Canvas(bitmap); +Paint paint = new Paint(); +paint.setColorFilter(new ColorMatrixColorFilter(cm)); +canvas.drawBitmap(src, 0, 0, paint); + +saveBitmap(bitmap, destPath); +} + +public static int getJpegRotate(String filePath) { +int rotate = 0; +try { +ExifInterface exif = new ExifInterface(filePath); +int iOrientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, -1); + +switch (iOrientation) { +case ExifInterface.ORIENTATION_ROTATE_90: +rotate = 90; +break; +case ExifInterface.ORIENTATION_ROTATE_180: +rotate = 180; +break; +case ExifInterface.ORIENTATION_ROTATE_270: +rotate = 270; +break; +default: +rotate = 0; +break; +} +} +catch (IOException e) { +return 0; +} + +return rotate; +} +public static File createNewPictureFile(Context context) { +SimpleDateFormat date = new SimpleDateFormat("yyyyMMdd_HHmmss"); +String fileName = date.format(new Date()) + ".jpg"; +File file = new File(context.getExternalFilesDir(Environment.DIRECTORY_DCIM).getAbsolutePath() + File.separator + fileName); +return file; +} +} \ No newline at end of file diff --git a/MainActivity.java b/MainActivity.java new file mode 100644 index 0000000..5053ca0 --- /dev/null +++ b/MainActivity.java @@ -0,0 +1,4660 @@ +package com.xc3fff0e.xmanager; + +import androidx.appcompat.app.AppCompatActivity; +import android.app.*; +import android.os.*; +import android.view.*; +import android.view.View.*; +import android.widget.*; +import android.content.*; +import android.graphics.*; +import android.media.*; +import android.net.*; +import android.text.*; +import android.util.*; +import android.webkit.*; +import android.animation.*; +import android.view.animation.*; +import java.util.*; +import java.text.*; +import java.util.HashMap; +import java.util.ArrayList; +import android.widget.LinearLayout; +import android.widget.ScrollView; +import android.widget.TextView; +import android.widget.ImageView; +import android.widget.EditText; +import android.widget.ListView; +import android.widget.ArrayAdapter; +import android.widget.BaseAdapter; +import android.widget.Switch; +import com.google.firebase.database.FirebaseDatabase; +import com.google.firebase.database.DatabaseReference; +import com.google.firebase.database.ValueEventListener; +import com.google.firebase.database.DataSnapshot; +import com.google.firebase.database.DatabaseError; +import com.google.firebase.database.GenericTypeIndicator; +import com.google.firebase.database.ChildEventListener; +import android.app.AlertDialog; +import android.content.DialogInterface; +import java.util.Timer; +import java.util.TimerTask; +import android.content.Intent; +import android.net.Uri; +import android.app.Activity; +import android.content.SharedPreferences; +import android.widget.CompoundButton; +import android.view.View; +import android.text.Editable; +import android.text.TextWatcher; +import android.graphics.Typeface; +import androidx.core.content.ContextCompat; +import androidx.core.app.ActivityCompat; +import android.Manifest; +import android.content.pm.PackageManager; + +public class MainActivity extends AppCompatActivity { + + private Timer _timer = new Timer(); + private FirebaseDatabase _firebase = FirebaseDatabase.getInstance(); + + private String SUB_A = ""; + private String SUB_B = ""; + private String SUB_X = ""; + private String SUB_Y = ""; + private double CHECK = 0; + private String Latest_Version = ""; + private String Current_Version = ""; + private String Package_Name = ""; + private HashMap Versions = new HashMap<>(); + private HashMap vmap_data = new HashMap<>(); + private boolean Lock_Check = false; + private String Regular_Title = ""; + private String Regular_Link = ""; + private String Amoled_Title = ""; + private String Amoled_Link = ""; + private double TEST = 0; + + private ArrayList> listdata = new ArrayList<>(); + private ArrayList> Versions_1 = new ArrayList<>(); + private ArrayList> others = new ArrayList<>(); + + private LinearLayout box_header; + private LinearLayout main_body_intro; + private ScrollView main_scroll_about; + private ScrollView main_scroll_upload; + private main_refresh_layout; + private TextView title_header; + private LinearLayout box_header_tab; + private LinearLayout box_uploader; + private LinearLayout box_update; + private ImageView icon_uploader; + private ImageView icon_update; + private TextView hidden_download; + private TextView dev_1; + private TextView dev_2; + private TextView app_changelogs; + private LinearLayout main_body_about; + private LinearLayout box_about_close; + private LinearLayout box_about_header; + private LinearLayout box_about_sub; + private LinearLayout box_about_1; + private LinearLayout box_about_2; + private LinearLayout box_about_3; + private LinearLayout box_about_4; + private LinearLayout box_about_5; + private LinearLayout box_about_6; + private LinearLayout box_about_7; + private TextView contributors_1; + private LinearLayout box_icon_close; + private ImageView icon_close; + private TextView title_about; + private TextView app_version; + private TextView sub_title; + private TextView developer_manager; + private TextView developer_1; + private TextView developer_spotify; + private TextView developer_2; + private TextView support_team; + private TextView support_1; + private TextView mod_testers; + private TextView testers_1; + private TextView mobilism_team; + private TextView mobilism_1; + private TextView forum_team; + private TextView forum_1; + private TextView manager_team; + private TextView manager_1; + private LinearLayout main_body_upload; + private LinearLayout box_upload_header; + private LinearLayout box_regular_2; + private LinearLayout box_amoled_2; + private LinearLayout box_logs_2; + private LinearLayout box_information; + private LinearLayout box_exit; + private TextView header_upload_title; + private TextView header_regular; + private LinearLayout box_regular_1; + private LinearLayout box_regular_3; + private LinearLayout box_regular_6; + private EditText edit_regular_1; + private EditText edit_regular_3; + private LinearLayout box_regular_4; + private LinearLayout box_regular_5; + private TextView regular_submit; + private TextView regular_delete; + private TextView header_amoled; + private LinearLayout box_amoled_1; + private LinearLayout box_amoled_3; + private LinearLayout box_amoled_6; + private EditText edit_amoled_1; + private EditText edit_amoled_3; + private LinearLayout box_amoled_4; + private LinearLayout box_amoled_5; + private TextView amoled_submit; + private TextView amoled_delete; + private TextView header_logs; + private LinearLayout box_logs_1; + private LinearLayout box_logs_3; + private EditText edit_logs_1; + private LinearLayout box_logs_4; + private LinearLayout box_logs_5; + private TextView logs_save; + private TextView logs_edit; + private TextView title_format; + private TextView body_format; + private TextView title_delete; + private TextView body_delete; + private TextView title_exit; + private ScrollView main_body_scroll; + private LinearLayout main_body; + private LinearLayout main_box_1; + private LinearLayout main_box_2; + private LinearLayout main_box_6; + private LinearLayout box_sub_header; + private LinearLayout main_box_5; + private LinearLayout main_box_4; + private LinearLayout box_1; + private LinearLayout box_2; + private ListView list_menu_1; + private TextView title_1; + private LinearLayout box_1_sub; + private TextView sub_text_1; + private TextView sub_1; + private TextView sub_text_2; + private TextView sub_2; + private LinearLayout box_switch_1; + private Switch version_switch_1; + private LinearLayout box_3; + private LinearLayout box_4; + private ListView list_menu_2; + private TextView title_2; + private LinearLayout box_3_sub; + private TextView sub_text_3; + private TextView sub_3; + private TextView sub_text_4; + private TextView sub_4; + private LinearLayout box_switch_2; + private Switch version_switch_2; + private LinearLayout box_6_sub_1; + private LinearLayout box_6_sub_2; + private TextView changelogs; + private LinearLayout box_changelogs; + private Switch changelogs_switch; + private LinearLayout box_changelogs_1; + private TextView changelogs_0; + private LinearLayout box_sub_1; + private LinearLayout box_sub_2; + private TextView title_sub; + private LinearLayout box_cpu; + private TextView device_cpu; + private TextView cpu; + private LinearLayout box_uninstall; + private LinearLayout box_settings; + private LinearLayout box_cache; + private LinearLayout box_open; + private ImageView icon_uninstall; + private ImageView icon_settings; + private ImageView icon_cache; + private ImageView icon_open; + private LinearLayout box_5_sub_1; + private LinearLayout box_5_sub_2; + private TextView theme; + private LinearLayout box_theme_switch; + private Switch theme_switch; + private LinearLayout box_theme_0; + private LinearLayout box_theme_1; + private LinearLayout box_theme_2; + private LinearLayout box_theme_3; + private LinearLayout box_theme_4; + private LinearLayout box_theme_5; + private LinearLayout box_theme_6; + private TextView green_theme; + private LinearLayout box_green_switch; + private Switch green_switch; + private TextView purple_theme; + private LinearLayout box_purple_switch; + private Switch purple_switch; + private TextView red_theme; + private LinearLayout box_red_switch; + private Switch red_switch; + private TextView blue_theme; + private LinearLayout box_blue_switch; + private Switch blue_switch; + private TextView orange_theme; + private LinearLayout box_orange_switch; + private Switch orange_switch; + private TextView yellow_theme; + private LinearLayout box_yellow_switch; + private Switch yellow_switch; + private TextView gray_theme; + private LinearLayout box_gray_switch; + private Switch gray_switch; + private LinearLayout box_support; + private LinearLayout box_donate; + private LinearLayout box_about; + private TextView support; + private ImageView icon_support; + private TextView donate; + private ImageView icon_donate; + private TextView about; + private ImageView icon_about; + + private DatabaseReference regular_mod_data = _firebase.getReference("regular_mod_data"); + private ChildEventListener _regular_mod_data_child_listener; + private DatabaseReference amoled_black_data = _firebase.getReference("amoled_black_data"); + private ChildEventListener _amoled_black_data_child_listener; + private AlertDialog.Builder Clear_Cache; + private AlertDialog.Builder Clear_Cache_Done; + private TimerTask Timer; + private Intent Support = new Intent(); + private AlertDialog.Builder Donation; + private Intent Donate = new Intent(); + private AlertDialog.Builder Mod_Features; + private AlertDialog.Builder Selected_Spotify; + private AlertDialog.Builder Download_Spotify; + private AlertDialog.Builder Mod_Info; + private AlertDialog.Builder Credits; + private SharedPreferences SUB_1; + private SharedPreferences SUB_2; + private AlertDialog.Builder Success_Download; + private SharedPreferences ON_SCREEN; + private AlertDialog.Builder Restart; + private AlertDialog.Builder Restart_Finished; + private SharedPreferences THEME; + private SharedPreferences DESC_X; + private RequestNetwork Connection; + private RequestNetwork.RequestListener _Connection_request_listener; + private DatabaseReference Version = _firebase.getReference("Version"); + private ChildEventListener _Version_child_listener; + private AlertDialog.Builder Update_Authorized; + private AlertDialog.Builder Update_Unauthorized; + private AlertDialog.Builder Update_Latest; + private DatabaseReference xManager_Update = _firebase.getReference("xManager_Update"); + private ChildEventListener _xManager_Update_child_listener; + private AlertDialog.Builder Developer_Login; + private DatabaseReference Developer = _firebase.getReference("Developer"); + private ChildEventListener _Developer_child_listener; + private DatabaseReference Mod_Changelogs = _firebase.getReference("Mod_Changelogs"); + private ChildEventListener _Mod_Changelogs_child_listener; + private AlertDialog.Builder Developer_Logout; + private xManager_Notification; + private DatabaseReference xManager_Changelogs = _firebase.getReference("xManager_Changelogs"); + private ChildEventListener _xManager_Changelogs_child_listener; + private SharedPreferences DEVELOPER_MODE; + private FileProvider; + private File_Fixer; + @Override + protected void onCreate(Bundle _savedInstanceState) { + super.onCreate(_savedInstanceState); + setContentView(R.layout.main); + com.google.firebase.FirebaseApp.initializeApp(this); + initialize(_savedInstanceState); + if (ContextCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE) == PackageManager.PERMISSION_DENIED + || ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_DENIED) { + ActivityCompat.requestPermissions(this, new String[] {Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE}, 1000); + } + else { + initializeLogic(); + } + } + @Override + public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { + super.onRequestPermissionsResult(requestCode, permissions, grantResults); + if (requestCode == 1000) { + initializeLogic(); + } + } + + private void initialize(Bundle _savedInstanceState) { + + box_header = (LinearLayout) findViewById(R.id.box_header); + main_body_intro = (LinearLayout) findViewById(R.id.main_body_intro); + main_scroll_about = (ScrollView) findViewById(R.id.main_scroll_about); + main_scroll_upload = (ScrollView) findViewById(R.id.main_scroll_upload); + main_refresh_layout = () findViewById(R.id.main_refresh_layout); + title_header = (TextView) findViewById(R.id.title_header); + box_header_tab = (LinearLayout) findViewById(R.id.box_header_tab); + box_uploader = (LinearLayout) findViewById(R.id.box_uploader); + box_update = (LinearLayout) findViewById(R.id.box_update); + icon_uploader = (ImageView) findViewById(R.id.icon_uploader); + icon_update = (ImageView) findViewById(R.id.icon_update); + hidden_download = (TextView) findViewById(R.id.hidden_download); + dev_1 = (TextView) findViewById(R.id.dev_1); + dev_2 = (TextView) findViewById(R.id.dev_2); + app_changelogs = (TextView) findViewById(R.id.app_changelogs); + main_body_about = (LinearLayout) findViewById(R.id.main_body_about); + box_about_close = (LinearLayout) findViewById(R.id.box_about_close); + box_about_header = (LinearLayout) findViewById(R.id.box_about_header); + box_about_sub = (LinearLayout) findViewById(R.id.box_about_sub); + box_about_1 = (LinearLayout) findViewById(R.id.box_about_1); + box_about_2 = (LinearLayout) findViewById(R.id.box_about_2); + box_about_3 = (LinearLayout) findViewById(R.id.box_about_3); + box_about_4 = (LinearLayout) findViewById(R.id.box_about_4); + box_about_5 = (LinearLayout) findViewById(R.id.box_about_5); + box_about_6 = (LinearLayout) findViewById(R.id.box_about_6); + box_about_7 = (LinearLayout) findViewById(R.id.box_about_7); + contributors_1 = (TextView) findViewById(R.id.contributors_1); + box_icon_close = (LinearLayout) findViewById(R.id.box_icon_close); + icon_close = (ImageView) findViewById(R.id.icon_close); + title_about = (TextView) findViewById(R.id.title_about); + app_version = (TextView) findViewById(R.id.app_version); + sub_title = (TextView) findViewById(R.id.sub_title); + developer_manager = (TextView) findViewById(R.id.developer_manager); + developer_1 = (TextView) findViewById(R.id.developer_1); + developer_spotify = (TextView) findViewById(R.id.developer_spotify); + developer_2 = (TextView) findViewById(R.id.developer_2); + support_team = (TextView) findViewById(R.id.support_team); + support_1 = (TextView) findViewById(R.id.support_1); + mod_testers = (TextView) findViewById(R.id.mod_testers); + testers_1 = (TextView) findViewById(R.id.testers_1); + mobilism_team = (TextView) findViewById(R.id.mobilism_team); + mobilism_1 = (TextView) findViewById(R.id.mobilism_1); + forum_team = (TextView) findViewById(R.id.forum_team); + forum_1 = (TextView) findViewById(R.id.forum_1); + manager_team = (TextView) findViewById(R.id.manager_team); + manager_1 = (TextView) findViewById(R.id.manager_1); + main_body_upload = (LinearLayout) findViewById(R.id.main_body_upload); + box_upload_header = (LinearLayout) findViewById(R.id.box_upload_header); + box_regular_2 = (LinearLayout) findViewById(R.id.box_regular_2); + box_amoled_2 = (LinearLayout) findViewById(R.id.box_amoled_2); + box_logs_2 = (LinearLayout) findViewById(R.id.box_logs_2); + box_information = (LinearLayout) findViewById(R.id.box_information); + box_exit = (LinearLayout) findViewById(R.id.box_exit); + header_upload_title = (TextView) findViewById(R.id.header_upload_title); + header_regular = (TextView) findViewById(R.id.header_regular); + box_regular_1 = (LinearLayout) findViewById(R.id.box_regular_1); + box_regular_3 = (LinearLayout) findViewById(R.id.box_regular_3); + box_regular_6 = (LinearLayout) findViewById(R.id.box_regular_6); + edit_regular_1 = (EditText) findViewById(R.id.edit_regular_1); + edit_regular_3 = (EditText) findViewById(R.id.edit_regular_3); + box_regular_4 = (LinearLayout) findViewById(R.id.box_regular_4); + box_regular_5 = (LinearLayout) findViewById(R.id.box_regular_5); + regular_submit = (TextView) findViewById(R.id.regular_submit); + regular_delete = (TextView) findViewById(R.id.regular_delete); + header_amoled = (TextView) findViewById(R.id.header_amoled); + box_amoled_1 = (LinearLayout) findViewById(R.id.box_amoled_1); + box_amoled_3 = (LinearLayout) findViewById(R.id.box_amoled_3); + box_amoled_6 = (LinearLayout) findViewById(R.id.box_amoled_6); + edit_amoled_1 = (EditText) findViewById(R.id.edit_amoled_1); + edit_amoled_3 = (EditText) findViewById(R.id.edit_amoled_3); + box_amoled_4 = (LinearLayout) findViewById(R.id.box_amoled_4); + box_amoled_5 = (LinearLayout) findViewById(R.id.box_amoled_5); + amoled_submit = (TextView) findViewById(R.id.amoled_submit); + amoled_delete = (TextView) findViewById(R.id.amoled_delete); + header_logs = (TextView) findViewById(R.id.header_logs); + box_logs_1 = (LinearLayout) findViewById(R.id.box_logs_1); + box_logs_3 = (LinearLayout) findViewById(R.id.box_logs_3); + edit_logs_1 = (EditText) findViewById(R.id.edit_logs_1); + box_logs_4 = (LinearLayout) findViewById(R.id.box_logs_4); + box_logs_5 = (LinearLayout) findViewById(R.id.box_logs_5); + logs_save = (TextView) findViewById(R.id.logs_save); + logs_edit = (TextView) findViewById(R.id.logs_edit); + title_format = (TextView) findViewById(R.id.title_format); + body_format = (TextView) findViewById(R.id.body_format); + title_delete = (TextView) findViewById(R.id.title_delete); + body_delete = (TextView) findViewById(R.id.body_delete); + title_exit = (TextView) findViewById(R.id.title_exit); + main_body_scroll = (ScrollView) findViewById(R.id.main_body_scroll); + main_body = (LinearLayout) findViewById(R.id.main_body); + main_box_1 = (LinearLayout) findViewById(R.id.main_box_1); + main_box_2 = (LinearLayout) findViewById(R.id.main_box_2); + main_box_6 = (LinearLayout) findViewById(R.id.main_box_6); + box_sub_header = (LinearLayout) findViewById(R.id.box_sub_header); + main_box_5 = (LinearLayout) findViewById(R.id.main_box_5); + main_box_4 = (LinearLayout) findViewById(R.id.main_box_4); + box_1 = (LinearLayout) findViewById(R.id.box_1); + box_2 = (LinearLayout) findViewById(R.id.box_2); + list_menu_1 = (ListView) findViewById(R.id.list_menu_1); + title_1 = (TextView) findViewById(R.id.title_1); + box_1_sub = (LinearLayout) findViewById(R.id.box_1_sub); + sub_text_1 = (TextView) findViewById(R.id.sub_text_1); + sub_1 = (TextView) findViewById(R.id.sub_1); + sub_text_2 = (TextView) findViewById(R.id.sub_text_2); + sub_2 = (TextView) findViewById(R.id.sub_2); + box_switch_1 = (LinearLayout) findViewById(R.id.box_switch_1); + version_switch_1 = (Switch) findViewById(R.id.version_switch_1); + box_3 = (LinearLayout) findViewById(R.id.box_3); + box_4 = (LinearLayout) findViewById(R.id.box_4); + list_menu_2 = (ListView) findViewById(R.id.list_menu_2); + title_2 = (TextView) findViewById(R.id.title_2); + box_3_sub = (LinearLayout) findViewById(R.id.box_3_sub); + sub_text_3 = (TextView) findViewById(R.id.sub_text_3); + sub_3 = (TextView) findViewById(R.id.sub_3); + sub_text_4 = (TextView) findViewById(R.id.sub_text_4); + sub_4 = (TextView) findViewById(R.id.sub_4); + box_switch_2 = (LinearLayout) findViewById(R.id.box_switch_2); + version_switch_2 = (Switch) findViewById(R.id.version_switch_2); + box_6_sub_1 = (LinearLayout) findViewById(R.id.box_6_sub_1); + box_6_sub_2 = (LinearLayout) findViewById(R.id.box_6_sub_2); + changelogs = (TextView) findViewById(R.id.changelogs); + box_changelogs = (LinearLayout) findViewById(R.id.box_changelogs); + changelogs_switch = (Switch) findViewById(R.id.changelogs_switch); + box_changelogs_1 = (LinearLayout) findViewById(R.id.box_changelogs_1); + changelogs_0 = (TextView) findViewById(R.id.changelogs_0); + box_sub_1 = (LinearLayout) findViewById(R.id.box_sub_1); + box_sub_2 = (LinearLayout) findViewById(R.id.box_sub_2); + title_sub = (TextView) findViewById(R.id.title_sub); + box_cpu = (LinearLayout) findViewById(R.id.box_cpu); + device_cpu = (TextView) findViewById(R.id.device_cpu); + cpu = (TextView) findViewById(R.id.cpu); + box_uninstall = (LinearLayout) findViewById(R.id.box_uninstall); + box_settings = (LinearLayout) findViewById(R.id.box_settings); + box_cache = (LinearLayout) findViewById(R.id.box_cache); + box_open = (LinearLayout) findViewById(R.id.box_open); + icon_uninstall = (ImageView) findViewById(R.id.icon_uninstall); + icon_settings = (ImageView) findViewById(R.id.icon_settings); + icon_cache = (ImageView) findViewById(R.id.icon_cache); + icon_open = (ImageView) findViewById(R.id.icon_open); + box_5_sub_1 = (LinearLayout) findViewById(R.id.box_5_sub_1); + box_5_sub_2 = (LinearLayout) findViewById(R.id.box_5_sub_2); + theme = (TextView) findViewById(R.id.theme); + box_theme_switch = (LinearLayout) findViewById(R.id.box_theme_switch); + theme_switch = (Switch) findViewById(R.id.theme_switch); + box_theme_0 = (LinearLayout) findViewById(R.id.box_theme_0); + box_theme_1 = (LinearLayout) findViewById(R.id.box_theme_1); + box_theme_2 = (LinearLayout) findViewById(R.id.box_theme_2); + box_theme_3 = (LinearLayout) findViewById(R.id.box_theme_3); + box_theme_4 = (LinearLayout) findViewById(R.id.box_theme_4); + box_theme_5 = (LinearLayout) findViewById(R.id.box_theme_5); + box_theme_6 = (LinearLayout) findViewById(R.id.box_theme_6); + green_theme = (TextView) findViewById(R.id.green_theme); + box_green_switch = (LinearLayout) findViewById(R.id.box_green_switch); + green_switch = (Switch) findViewById(R.id.green_switch); + purple_theme = (TextView) findViewById(R.id.purple_theme); + box_purple_switch = (LinearLayout) findViewById(R.id.box_purple_switch); + purple_switch = (Switch) findViewById(R.id.purple_switch); + red_theme = (TextView) findViewById(R.id.red_theme); + box_red_switch = (LinearLayout) findViewById(R.id.box_red_switch); + red_switch = (Switch) findViewById(R.id.red_switch); + blue_theme = (TextView) findViewById(R.id.blue_theme); + box_blue_switch = (LinearLayout) findViewById(R.id.box_blue_switch); + blue_switch = (Switch) findViewById(R.id.blue_switch); + orange_theme = (TextView) findViewById(R.id.orange_theme); + box_orange_switch = (LinearLayout) findViewById(R.id.box_orange_switch); + orange_switch = (Switch) findViewById(R.id.orange_switch); + yellow_theme = (TextView) findViewById(R.id.yellow_theme); + box_yellow_switch = (LinearLayout) findViewById(R.id.box_yellow_switch); + yellow_switch = (Switch) findViewById(R.id.yellow_switch); + gray_theme = (TextView) findViewById(R.id.gray_theme); + box_gray_switch = (LinearLayout) findViewById(R.id.box_gray_switch); + gray_switch = (Switch) findViewById(R.id.gray_switch); + box_support = (LinearLayout) findViewById(R.id.box_support); + box_donate = (LinearLayout) findViewById(R.id.box_donate); + box_about = (LinearLayout) findViewById(R.id.box_about); + support = (TextView) findViewById(R.id.support); + icon_support = (ImageView) findViewById(R.id.icon_support); + donate = (TextView) findViewById(R.id.donate); + icon_donate = (ImageView) findViewById(R.id.icon_donate); + about = (TextView) findViewById(R.id.about); + icon_about = (ImageView) findViewById(R.id.icon_about); + Clear_Cache = new AlertDialog.Builder(this); + Clear_Cache_Done = new AlertDialog.Builder(this); + Donation = new AlertDialog.Builder(this); + Mod_Features = new AlertDialog.Builder(this); + Selected_Spotify = new AlertDialog.Builder(this); + Download_Spotify = new AlertDialog.Builder(this); + Mod_Info = new AlertDialog.Builder(this); + Credits = new AlertDialog.Builder(this); + SUB_1 = getSharedPreferences("SUB_1", Activity.MODE_PRIVATE); + SUB_2 = getSharedPreferences("SUB_2", Activity.MODE_PRIVATE); + Success_Download = new AlertDialog.Builder(this); + ON_SCREEN = getSharedPreferences("ON_SCREEN", Activity.MODE_PRIVATE); + Restart = new AlertDialog.Builder(this); + Restart_Finished = new AlertDialog.Builder(this); + THEME = getSharedPreferences("THEME", Activity.MODE_PRIVATE); + DESC_X = getSharedPreferences("DESC_X", Activity.MODE_PRIVATE); + Connection = new RequestNetwork(this); + Update_Authorized = new AlertDialog.Builder(this); + Update_Unauthorized = new AlertDialog.Builder(this); + Update_Latest = new AlertDialog.Builder(this); + Developer_Login = new AlertDialog.Builder(this); + Developer_Logout = new AlertDialog.Builder(this); + DEVELOPER_MODE = getSharedPreferences("DEVELOPER_MODE", Activity.MODE_PRIVATE); + + box_uploader.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View _view) { + try { + _RequiredDialog(Developer_Login, false); + Developer_Login.setTitle("DEVELOPER MODE"); + final EditText edit_dev = new EditText(MainActivity.this); + + LinearLayout.LayoutParams lpar = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); + edit_dev.setLayoutParams(lpar); + + edit_dev.setHint("What's the password?"); + edit_dev.setHintTextColor(Color.parseColor("#FF9E9E9E")); + edit_dev.setTextColor(Color.parseColor("#FFFFFFFF")); + + Developer_Login.setView(edit_dev); + Developer_Login.setPositiveButton("LOGIN", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface _dialog, int _which) { + _RequiredDialog(Developer_Login, true); + dev_1.setText(edit_dev.getText()); + if (dev_1.getText().toString().equals(dev_2.getText().toString())) { + final ProgressDialog prog = new ProgressDialog(MainActivity.this, ProgressDialog.THEME_DEVICE_DEFAULT_DARK);prog.setMax(100);prog.setMessage("Please wait...");prog.setIndeterminate(true) ;prog.setCancelable(false);if (!MainActivity.this.isFinishing()){ prog.show(); } + Timer = new TimerTask() { + @Override + public void run() { + runOnUiThread(new Runnable() { + @Override + public void run() { + + main_scroll_upload.setVisibility(View.VISIBLE); + main_body_intro.setVisibility(View.GONE); + main_refresh_layout.setVisibility(View.GONE); + main_scroll_about.setVisibility(View.GONE); + box_uploader.setEnabled(false); + box_update.setEnabled(false); + prog.dismiss(); + } + }); + } + }; + _timer.schedule(Timer, (int)(1000)); + } + else { + + } + edit_dev.setEnabled(false); + } + }); + Developer_Login.setNeutralButton("CANCEL", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface _dialog, int _which) { + _RequiredDialog(Developer_Login, true); + edit_dev.setEnabled(false); + Timer = new TimerTask() { + @Override + public void run() { + runOnUiThread(new Runnable() { + @Override + public void run() { + _Hide_Navigation(); + } + }); + } + }; + _timer.schedule(Timer, (int)(100)); + } + }); + Developer_Login.create().show(); + } + catch(Exception e) { + } + } + }); + + box_update.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View _view) { + try { + Version.addListenerForSingleValueEvent(new ValueEventListener() { + @Override + public void onDataChange(DataSnapshot _dataSnapshot) { + Versions_1 = new ArrayList<>(); + try { + GenericTypeIndicator> _ind = new GenericTypeIndicator>() {}; + for (DataSnapshot _data : _dataSnapshot.getChildren()) { + HashMap _map = _data.getValue(_ind); + Versions_1.add(_map); + } + } + catch (Exception _e) { + _e.printStackTrace(); + } + Latest_Version = Versions_1.get((int)0).get("V").toString(); + if (Double.parseDouble(Latest_Version) > Double.parseDouble(Current_Version)) { + try { + _RequiredDialog(Update_Authorized, false); + Update_Authorized.setTitle("NEW MANAGER UPDATE"); + Update_Authorized.setPositiveButton("DOWNLOAD UPDATE", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface _dialog, int _which) { + _RequiredDialog(Update_Authorized, true); + _Download_Update(hidden_download.getText().toString(), "/storage/emulated/0/Android/data/com.xc3fff0e.xmanager/files/Download/Update/"); + _Update_Remover(); + Timer = new TimerTask() { + @Override + public void run() { + runOnUiThread(new Runnable() { + @Override + public void run() { + _Hide_Navigation(); + } + }); + } + }; + _timer.schedule(Timer, (int)(100)); + } + }); + Update_Authorized.setNeutralButton("NOT NOW", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface _dialog, int _which) { + _RequiredDialog(Update_Authorized, true); + Timer = new TimerTask() { + @Override + public void run() { + runOnUiThread(new Runnable() { + @Override + public void run() { + _Hide_Navigation(); + } + }); + } + }; + _timer.schedule(Timer, (int)(100)); + } + }); + Update_Authorized.create().show(); + } + catch(Exception e) { + } + } + else { + if (Double.parseDouble(Current_Version) > Double.parseDouble(Latest_Version)) { + Version.child("App").child("V").setValue(Current_Version); + } + else { + try { + xManager_Changelogs.addListenerForSingleValueEvent(new ValueEventListener() { + @Override + public void onDataChange(DataSnapshot _dataSnapshot) { + listdata = new ArrayList<>(); + try { + GenericTypeIndicator> _ind = new GenericTypeIndicator>() {}; + for (DataSnapshot _data : _dataSnapshot.getChildren()) { + HashMap _map = _data.getValue(_ind); + listdata.add(_map); + } + } + catch (Exception _e) { + _e.printStackTrace(); + } + xManager_Changelogs.addChildEventListener(_xManager_Changelogs_child_listener); + } + @Override + public void onCancelled(DatabaseError _databaseError) { + } + }); + Update_Latest.setTitle("xManager v".concat(app_version.getText().toString().concat(" (Latest)"))); + Update_Latest.setMessage(app_changelogs.getText().toString()); + Update_Latest.create().show(); + Timer = new TimerTask() { + @Override + public void run() { + runOnUiThread(new Runnable() { + @Override + public void run() { + _Hide_Navigation(); + } + }); + } + }; + _timer.schedule(Timer, (int)(100)); + } + catch(Exception e) { + } + } + } + } + @Override + public void onCancelled(DatabaseError _databaseError) { + } + }); + } + catch(Exception e) { + } + } + }); + + box_icon_close.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View _view) { + + main_refresh_layout.setVisibility(View.VISIBLE); + main_scroll_about.setVisibility(View.GONE); + main_scroll_upload.setVisibility(View.GONE); + main_body_intro.setVisibility(View.GONE); + } + }); + + box_exit.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View _view) { + try { + _RequiredDialog(Developer_Logout, false); + Developer_Logout.setTitle("DEVELOPER MODE"); + Developer_Logout.setPositiveButton("LOG OUT", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface _dialog, int _which) { + _RequiredDialog(Developer_Logout, true); + final ProgressDialog prog = new ProgressDialog(MainActivity.this, ProgressDialog.THEME_DEVICE_DEFAULT_DARK);prog.setMax(100);prog.setMessage("Refreshing databases...");prog.setIndeterminate(true) ;prog.setCancelable(false);if (!MainActivity.this.isFinishing()){ prog.show(); } + main_body.setEnabled(false); + main_body.setAlpha((float)(0.65d)); + regular_mod_data.addListenerForSingleValueEvent(new ValueEventListener() { + @Override + public void onDataChange(DataSnapshot _dataSnapshot) { + listdata = new ArrayList<>(); + try { + GenericTypeIndicator> _ind = new GenericTypeIndicator>() {}; + for (DataSnapshot _data : _dataSnapshot.getChildren()) { + HashMap _map = _data.getValue(_ind); + listdata.add(_map); + } + } + catch (Exception _e) { + _e.printStackTrace(); + } + sub_1.setText(SUB_1.getString("SUB_1", "")); + Timer = new TimerTask() { + @Override + public void run() { + runOnUiThread(new Runnable() { + @Override + public void run() { + + version_switch_1.setChecked(true); + version_switch_2.setChecked(false); + changelogs_switch.setChecked(false); + } + }); + } + }; + _timer.schedule(Timer, (int)(300)); + list_menu_1.setAdapter(new List_menu_1Adapter(listdata)); + ((BaseAdapter)list_menu_1.getAdapter()).notifyDataSetChanged(); + } + @Override + public void onCancelled(DatabaseError _databaseError) { + } + }); + amoled_black_data.addListenerForSingleValueEvent(new ValueEventListener() { + @Override + public void onDataChange(DataSnapshot _dataSnapshot) { + listdata = new ArrayList<>(); + try { + GenericTypeIndicator> _ind = new GenericTypeIndicator>() {}; + for (DataSnapshot _data : _dataSnapshot.getChildren()) { + HashMap _map = _data.getValue(_ind); + listdata.add(_map); + } + } + catch (Exception _e) { + _e.printStackTrace(); + } + sub_3.setText(SUB_2.getString("SUB_2", "")); + Timer = new TimerTask() { + @Override + public void run() { + runOnUiThread(new Runnable() { + @Override + public void run() { + + version_switch_1.setChecked(false); + version_switch_2.setChecked(true); + changelogs_switch.setChecked(false); + Timer = new TimerTask() { + @Override + public void run() { + runOnUiThread(new Runnable() { + @Override + public void run() { + version_switch_1.setChecked(false); + version_switch_2.setChecked(false); + changelogs_switch.setChecked(true); + Timer = new TimerTask() { + @Override + public void run() { + runOnUiThread(new Runnable() { + @Override + public void run() { + + version_switch_1.setChecked(false); + version_switch_2.setChecked(false); + changelogs_switch.setChecked(false); + main_body.setEnabled(true); + main_body.setAlpha((float)(1.0d)); + } + }); + } + }; + _timer.schedule(Timer, (int)(700)); + } + }); + } + }; + _timer.schedule(Timer, (int)(700)); + } + }); + } + }; + _timer.schedule(Timer, (int)(500)); + list_menu_2.setAdapter(new List_menu_2Adapter(listdata)); + ((BaseAdapter)list_menu_2.getAdapter()).notifyDataSetChanged(); + } + @Override + public void onCancelled(DatabaseError _databaseError) { + } + }); + xManager_Changelogs.addListenerForSingleValueEvent(new ValueEventListener() { + @Override + public void onDataChange(DataSnapshot _dataSnapshot) { + others = new ArrayList<>(); + try { + GenericTypeIndicator> _ind = new GenericTypeIndicator>() {}; + for (DataSnapshot _data : _dataSnapshot.getChildren()) { + HashMap _map = _data.getValue(_ind); + others.add(_map); + } + } + catch (Exception _e) { + _e.printStackTrace(); + } + xManager_Changelogs.addChildEventListener(_xManager_Changelogs_child_listener); + } + @Override + public void onCancelled(DatabaseError _databaseError) { + } + }); + Mod_Changelogs.addListenerForSingleValueEvent(new ValueEventListener() { + @Override + public void onDataChange(DataSnapshot _dataSnapshot) { + others = new ArrayList<>(); + try { + GenericTypeIndicator> _ind = new GenericTypeIndicator>() {}; + for (DataSnapshot _data : _dataSnapshot.getChildren()) { + HashMap _map = _data.getValue(_ind); + others.add(_map); + } + } + catch (Exception _e) { + _e.printStackTrace(); + } + Mod_Changelogs.addChildEventListener(_Mod_Changelogs_child_listener); + } + @Override + public void onCancelled(DatabaseError _databaseError) { + } + }); + Developer.addListenerForSingleValueEvent(new ValueEventListener() { + @Override + public void onDataChange(DataSnapshot _dataSnapshot) { + others = new ArrayList<>(); + try { + GenericTypeIndicator> _ind = new GenericTypeIndicator>() {}; + for (DataSnapshot _data : _dataSnapshot.getChildren()) { + HashMap _map = _data.getValue(_ind); + others.add(_map); + } + } + catch (Exception _e) { + _e.printStackTrace(); + } + Developer.addChildEventListener(_Developer_child_listener); + } + @Override + public void onCancelled(DatabaseError _databaseError) { + } + }); + Version.addListenerForSingleValueEvent(new ValueEventListener() { + @Override + public void onDataChange(DataSnapshot _dataSnapshot) { + others = new ArrayList<>(); + try { + GenericTypeIndicator> _ind = new GenericTypeIndicator>() {}; + for (DataSnapshot _data : _dataSnapshot.getChildren()) { + HashMap _map = _data.getValue(_ind); + others.add(_map); + } + } + catch (Exception _e) { + _e.printStackTrace(); + } + Version.addChildEventListener(_Version_child_listener); + } + @Override + public void onCancelled(DatabaseError _databaseError) { + } + }); + Timer = new TimerTask() { + @Override + public void run() { + runOnUiThread(new Runnable() { + @Override + public void run() { + + main_scroll_upload.setVisibility(View.GONE); + main_body_intro.setVisibility(View.GONE); + main_refresh_layout.setVisibility(View.VISIBLE); + main_scroll_about.setVisibility(View.GONE); + box_uploader.setEnabled(true); + box_update.setEnabled(true); + prog.dismiss(); + } + }); + } + }; + _timer.schedule(Timer, (int)(3000)); + Timer = new TimerTask() { + @Override + public void run() { + runOnUiThread(new Runnable() { + @Override + public void run() { + _Hide_Navigation(); + } + }); + } + }; + _timer.schedule(Timer, (int)(100)); + DEVELOPER_MODE.edit().putString("DEVELOPER", "OFF").commit(); + Connection.startRequestNetwork(RequestNetworkController.GET, "https://spotify.com", "PAWN!", _Connection_request_listener); + } + }); + Developer_Logout.setNeutralButton("CANCEL", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface _dialog, int _which) { + _RequiredDialog(Developer_Logout, true); + } + }); + Developer_Logout.create().show(); + } + catch(Exception e) { + } + } + }); + + edit_regular_1.addTextChangedListener(new TextWatcher() { + @Override + public void onTextChanged(CharSequence _param1, int _param2, int _param3, int _param4) { + final String _charSeq = _param1.toString(); + Regular_Title = _charSeq; + _Locked(); + } + + @Override + public void beforeTextChanged(CharSequence _param1, int _param2, int _param3, int _param4) { + + } + + @Override + public void afterTextChanged(Editable _param1) { + + } + }); + + edit_regular_3.addTextChangedListener(new TextWatcher() { + @Override + public void onTextChanged(CharSequence _param1, int _param2, int _param3, int _param4) { + final String _charSeq = _param1.toString(); + Regular_Link = _charSeq; + _Locked(); + } + + @Override + public void beforeTextChanged(CharSequence _param1, int _param2, int _param3, int _param4) { + + } + + @Override + public void afterTextChanged(Editable _param1) { + + } + }); + + box_regular_4.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View _view) { + try { + vmap_data = new HashMap<>(); + vmap_data.put("title", edit_regular_1.getText().toString().replace(".", "-")); + vmap_data.put("link", edit_regular_3.getText().toString()); + regular_mod_data.child(edit_regular_1.getText().toString().replace(".", "-")).updateChildren(vmap_data); + vmap_data.clear(); + edit_regular_1.setText(""); + edit_regular_3.setText(""); + SketchwareUtil.showMessage(getApplicationContext(), "Successfully added"); + + } + catch(Exception e) { + } + } + }); + + box_regular_5.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View _view) { + try { + regular_mod_data.child(edit_regular_1.getText().toString().replace(".", "-")).removeValue(); + vmap_data.remove(edit_regular_1.getText().toString().replace(".", "-")); + edit_regular_1.setText(""); + edit_regular_3.setText(""); + SketchwareUtil.showMessage(getApplicationContext(), "Successfully deleted"); + + } + catch(Exception e) { + } + } + }); + + edit_amoled_1.addTextChangedListener(new TextWatcher() { + @Override + public void onTextChanged(CharSequence _param1, int _param2, int _param3, int _param4) { + final String _charSeq = _param1.toString(); + Amoled_Title = _charSeq; + _Locked(); + } + + @Override + public void beforeTextChanged(CharSequence _param1, int _param2, int _param3, int _param4) { + + } + + @Override + public void afterTextChanged(Editable _param1) { + + } + }); + + edit_amoled_3.addTextChangedListener(new TextWatcher() { + @Override + public void onTextChanged(CharSequence _param1, int _param2, int _param3, int _param4) { + final String _charSeq = _param1.toString(); + Amoled_Link = _charSeq; + _Locked(); + } + + @Override + public void beforeTextChanged(CharSequence _param1, int _param2, int _param3, int _param4) { + + } + + @Override + public void afterTextChanged(Editable _param1) { + + } + }); + + box_amoled_4.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View _view) { + try { + vmap_data = new HashMap<>(); + vmap_data.put("title", edit_amoled_1.getText().toString().replace(".", "-")); + vmap_data.put("link", edit_amoled_3.getText().toString()); + amoled_black_data.child(edit_amoled_1.getText().toString().replace(".", "-")).updateChildren(vmap_data); + vmap_data.clear(); + edit_amoled_1.setText(""); + edit_amoled_3.setText(""); + SketchwareUtil.showMessage(getApplicationContext(), "Successfully added"); + + } + catch(Exception e) { + } + } + }); + + box_amoled_5.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View _view) { + try { + amoled_black_data.child(edit_amoled_1.getText().toString().replace(".", "-")).removeValue(); + vmap_data.remove(edit_amoled_1.getText().toString().replace(".", "-")); + edit_amoled_1.setText(""); + edit_amoled_3.setText(""); + SketchwareUtil.showMessage(getApplicationContext(), "Successfully deleted"); + + } + catch(Exception e) { + } + } + }); + + box_logs_4.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View _view) { + try { + final ProgressDialog prog = new ProgressDialog(MainActivity.this, ProgressDialog.THEME_DEVICE_DEFAULT_DARK);prog.setMax(100);prog.setMessage("Saving changes...");prog.setIndeterminate(true) ;prog.setCancelable(false);if (!MainActivity.this.isFinishing()){ prog.show(); } + vmap_data.put("Changelogs", edit_logs_1.getText().toString()); + Mod_Changelogs.child("Mod_Changelogs").updateChildren(vmap_data); + edit_logs_1.setTextColor(0xFF9E9E9E); + logs_save.setTextColor(0xFF9E9E9E); + logs_edit.setTextColor(0xFFFFFFFF); + edit_logs_1.setEnabled(false); + box_logs_4.setEnabled(false); + box_logs_5.setEnabled(true); + Timer = new TimerTask() { + @Override + public void run() { + runOnUiThread(new Runnable() { + @Override + public void run() { + prog.dismiss(); + SketchwareUtil.showMessage(getApplicationContext(), "Successfully edited"); + } + }); + } + }; + _timer.schedule(Timer, (int)(2000)); + } + catch(Exception e) { + } + } + }); + + box_logs_5.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View _view) { + edit_logs_1.setTextColor(0xFF000000); + logs_save.setTextColor(0xFFFFFFFF); + logs_edit.setTextColor(0xFF9E9E9E); + edit_logs_1.setEnabled(true); + box_logs_4.setEnabled(true); + box_logs_5.setEnabled(false); + SketchwareUtil.showMessage(getApplicationContext(), "Edit mode activated"); + } + }); + + version_switch_1.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton _param1, boolean _param2) { + final boolean _isChecked = _param2; + try { + if (_isChecked) { + try { + version_switch_2.setChecked(false); + list_menu_1.setVisibility(View.VISIBLE); + regular_mod_data.addListenerForSingleValueEvent(new ValueEventListener() { + @Override + public void onDataChange(DataSnapshot _dataSnapshot) { + listdata = new ArrayList<>(); + try { + GenericTypeIndicator> _ind = new GenericTypeIndicator>() {}; + for (DataSnapshot _data : _dataSnapshot.getChildren()) { + HashMap _map = _data.getValue(_ind); + listdata.add(_map); + } + } + catch (Exception _e) { + _e.printStackTrace(); + } + list_menu_1.setAdapter(new List_menu_1Adapter(listdata)); + ((BaseAdapter)list_menu_1.getAdapter()).notifyDataSetChanged(); + } + @Override + public void onCancelled(DatabaseError _databaseError) { + } + }); + xManager_Changelogs.addListenerForSingleValueEvent(new ValueEventListener() { + @Override + public void onDataChange(DataSnapshot _dataSnapshot) { + others = new ArrayList<>(); + try { + GenericTypeIndicator> _ind = new GenericTypeIndicator>() {}; + for (DataSnapshot _data : _dataSnapshot.getChildren()) { + HashMap _map = _data.getValue(_ind); + others.add(_map); + } + } + catch (Exception _e) { + _e.printStackTrace(); + } + xManager_Changelogs.addChildEventListener(_xManager_Changelogs_child_listener); + } + @Override + public void onCancelled(DatabaseError _databaseError) { + } + }); + Mod_Changelogs.addListenerForSingleValueEvent(new ValueEventListener() { + @Override + public void onDataChange(DataSnapshot _dataSnapshot) { + others = new ArrayList<>(); + try { + GenericTypeIndicator> _ind = new GenericTypeIndicator>() {}; + for (DataSnapshot _data : _dataSnapshot.getChildren()) { + HashMap _map = _data.getValue(_ind); + others.add(_map); + } + } + catch (Exception _e) { + _e.printStackTrace(); + } + Mod_Changelogs.addChildEventListener(_Mod_Changelogs_child_listener); + } + @Override + public void onCancelled(DatabaseError _databaseError) { + } + }); + Developer.addListenerForSingleValueEvent(new ValueEventListener() { + @Override + public void onDataChange(DataSnapshot _dataSnapshot) { + others = new ArrayList<>(); + try { + GenericTypeIndicator> _ind = new GenericTypeIndicator>() {}; + for (DataSnapshot _data : _dataSnapshot.getChildren()) { + HashMap _map = _data.getValue(_ind); + others.add(_map); + } + } + catch (Exception _e) { + _e.printStackTrace(); + } + Developer.addChildEventListener(_Developer_child_listener); + } + @Override + public void onCancelled(DatabaseError _databaseError) { + } + }); + Version.addListenerForSingleValueEvent(new ValueEventListener() { + @Override + public void onDataChange(DataSnapshot _dataSnapshot) { + others = new ArrayList<>(); + try { + GenericTypeIndicator> _ind = new GenericTypeIndicator>() {}; + for (DataSnapshot _data : _dataSnapshot.getChildren()) { + HashMap _map = _data.getValue(_ind); + others.add(_map); + } + } + catch (Exception _e) { + _e.printStackTrace(); + } + Version.addChildEventListener(_Version_child_listener); + } + @Override + public void onCancelled(DatabaseError _databaseError) { + } + }); + main_refresh_layout.setEnabled(false); + } + catch(Exception e) { + } + } + else { + main_refresh_layout.setEnabled(true); + list_menu_1.setVisibility(View.GONE); + list_menu_1.setAdapter(new List_menu_1Adapter(listdata)); + ((BaseAdapter)list_menu_1.getAdapter()).notifyDataSetChanged(); + } + } + catch(Exception e) { + } + } + }); + + version_switch_2.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton _param1, boolean _param2) { + final boolean _isChecked = _param2; + try { + if (_isChecked) { + try { + version_switch_1.setChecked(false); + list_menu_2.setVisibility(View.VISIBLE); + amoled_black_data.addListenerForSingleValueEvent(new ValueEventListener() { + @Override + public void onDataChange(DataSnapshot _dataSnapshot) { + listdata = new ArrayList<>(); + try { + GenericTypeIndicator> _ind = new GenericTypeIndicator>() {}; + for (DataSnapshot _data : _dataSnapshot.getChildren()) { + HashMap _map = _data.getValue(_ind); + listdata.add(_map); + } + } + catch (Exception _e) { + _e.printStackTrace(); + } + list_menu_2.setAdapter(new List_menu_2Adapter(listdata)); + ((BaseAdapter)list_menu_2.getAdapter()).notifyDataSetChanged(); + } + @Override + public void onCancelled(DatabaseError _databaseError) { + } + }); + xManager_Changelogs.addListenerForSingleValueEvent(new ValueEventListener() { + @Override + public void onDataChange(DataSnapshot _dataSnapshot) { + others = new ArrayList<>(); + try { + GenericTypeIndicator> _ind = new GenericTypeIndicator>() {}; + for (DataSnapshot _data : _dataSnapshot.getChildren()) { + HashMap _map = _data.getValue(_ind); + others.add(_map); + } + } + catch (Exception _e) { + _e.printStackTrace(); + } + xManager_Changelogs.addChildEventListener(_xManager_Changelogs_child_listener); + } + @Override + public void onCancelled(DatabaseError _databaseError) { + } + }); + Mod_Changelogs.addListenerForSingleValueEvent(new ValueEventListener() { + @Override + public void onDataChange(DataSnapshot _dataSnapshot) { + others = new ArrayList<>(); + try { + GenericTypeIndicator> _ind = new GenericTypeIndicator>() {}; + for (DataSnapshot _data : _dataSnapshot.getChildren()) { + HashMap _map = _data.getValue(_ind); + others.add(_map); + } + } + catch (Exception _e) { + _e.printStackTrace(); + } + Mod_Changelogs.addChildEventListener(_Mod_Changelogs_child_listener); + } + @Override + public void onCancelled(DatabaseError _databaseError) { + } + }); + Developer.addListenerForSingleValueEvent(new ValueEventListener() { + @Override + public void onDataChange(DataSnapshot _dataSnapshot) { + others = new ArrayList<>(); + try { + GenericTypeIndicator> _ind = new GenericTypeIndicator>() {}; + for (DataSnapshot _data : _dataSnapshot.getChildren()) { + HashMap _map = _data.getValue(_ind); + others.add(_map); + } + } + catch (Exception _e) { + _e.printStackTrace(); + } + Developer.addChildEventListener(_Developer_child_listener); + } + @Override + public void onCancelled(DatabaseError _databaseError) { + } + }); + Version.addListenerForSingleValueEvent(new ValueEventListener() { + @Override + public void onDataChange(DataSnapshot _dataSnapshot) { + others = new ArrayList<>(); + try { + GenericTypeIndicator> _ind = new GenericTypeIndicator>() {}; + for (DataSnapshot _data : _dataSnapshot.getChildren()) { + HashMap _map = _data.getValue(_ind); + others.add(_map); + } + } + catch (Exception _e) { + _e.printStackTrace(); + } + Version.addChildEventListener(_Version_child_listener); + } + @Override + public void onCancelled(DatabaseError _databaseError) { + } + }); + main_refresh_layout.setEnabled(false); + } + catch(Exception e) { + } + } + else { + main_refresh_layout.setEnabled(true); + list_menu_2.setVisibility(View.GONE); + list_menu_2.setAdapter(new List_menu_2Adapter(listdata)); + ((BaseAdapter)list_menu_2.getAdapter()).notifyDataSetChanged(); + } + } + catch(Exception e) { + } + } + }); + + changelogs_switch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton _param1, boolean _param2) { + final boolean _isChecked = _param2; + if (_isChecked) { + box_6_sub_2.setVisibility(View.VISIBLE); + } + else { + box_6_sub_2.setVisibility(View.GONE); + } + } + }); + + box_uninstall.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View _view) { + try { + Intent intent = new Intent(Intent.ACTION_DELETE); intent.setData(Uri.parse("package:com.spotify.music")); + startActivity(intent); + } + catch(Exception e) { + } + } + }); + + box_settings.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View _view) { + try { + Intent intent = new Intent(android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS); intent.setData(Uri.parse("package:com.spotify.music")); + startActivity(intent); + } + catch(Exception e) { + } + } + }); + + box_cache.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View _view) { + try { + _RequiredDialog(Clear_Cache, false); + Clear_Cache.setTitle("CLEAR CACHE"); + Clear_Cache.setMessage("This will erase all the downloaded songs, albums and playlists including offline cached datas from the original or modified Spotify app. Would you like to continue?"); + Clear_Cache.setPositiveButton("CONTINUE", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface _dialog, int _which) { + _RequiredDialog(Clear_Cache, true); + if (FileUtil.isExistFile("/storage/emulated/0/Android/data/com.spotify.music/")) { + FileUtil.deleteFile("/storage/emulated/0/Android/data/com.spotify.music/"); + final ProgressDialog prog = new ProgressDialog(MainActivity.this, ProgressDialog.THEME_DEVICE_DEFAULT_DARK); + + prog.setMax(100); + prog.setMessage("Deleting Spotify's directory folder..."); + prog.setIndeterminate(true); + prog.setCancelable(false); + if (!MainActivity.this.isFinishing()) { + prog.show(); + } + Timer = new TimerTask() { + @Override + public void run() { + runOnUiThread(new Runnable() { + @Override + public void run() { + _RequiredDialog(Clear_Cache_Done, false); + Clear_Cache_Done.setTitle("DIRECTORY FILES DELETED"); + Clear_Cache_Done.setMessage("Kindly relogin your Spotify account to restore the settings."); + Clear_Cache_Done.setPositiveButton("GOT IT, THANKS!", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface _dialog, int _which) { + _RequiredDialog(Clear_Cache_Done, true); + } + }); + Clear_Cache_Done.create().show(); + prog.dismiss(); + Timer = new TimerTask() { + @Override + public void run() { + runOnUiThread(new Runnable() { + @Override + public void run() { + _Hide_Navigation(); + } + }); + } + }; + _timer.schedule(Timer, (int)(100)); + SketchwareUtil.showMessage(getApplicationContext(), "Successfully deleted"); + } + }); + } + }; + _timer.schedule(Timer, (int)(3000)); + } + else { + Timer = new TimerTask() { + @Override + public void run() { + runOnUiThread(new Runnable() { + @Override + public void run() { + _Hide_Navigation(); + } + }); + } + }; + _timer.schedule(Timer, (int)(100)); + SketchwareUtil.showMessage(getApplicationContext(), "Directory files already cleared"); + } + } + }); + Clear_Cache.setNeutralButton("CANCEL", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface _dialog, int _which) { + _RequiredDialog(Clear_Cache, true); + Timer = new TimerTask() { + @Override + public void run() { + runOnUiThread(new Runnable() { + @Override + public void run() { + _Hide_Navigation(); + } + }); + } + }; + _timer.schedule(Timer, (int)(100)); + } + }); + Clear_Cache.create().show(); + } + catch(Exception e) { + } + } + }); + + box_open.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View _view) { + String packageName = "com.spotify.music"; + + Intent intent = getPackageManager().getLaunchIntentForPackage(packageName); + if(intent == null) { + + try { + intent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + packageName)); + } catch (Exception e) { + showMessage("Application not installed"); + } + } + startActivity(intent); + } + }); + + theme_switch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton _param1, boolean _param2) { + final boolean _isChecked = _param2; + if (_isChecked) { + box_5_sub_2.setVisibility(View.VISIBLE); + } + else { + box_5_sub_2.setVisibility(View.GONE); + } + } + }); + + green_switch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton _param1, boolean _param2) { + final boolean _isChecked = _param2; + if (_isChecked) { + THEME.edit().putString("THEME", "1").commit(); + + + + green_switch.setChecked(true); + purple_switch.setChecked(false); + red_switch.setChecked(false); + blue_switch.setChecked(false); + orange_switch.setChecked(false); + yellow_switch.setChecked(false); + gray_switch.setChecked(false); + } + else { + if (purple_switch.isChecked()) { + THEME.edit().putString("THEME", "2").commit(); + + + + green_switch.setChecked(false); + purple_switch.setChecked(true); + red_switch.setChecked(false); + blue_switch.setChecked(false); + orange_switch.setChecked(false); + yellow_switch.setChecked(false); + gray_switch.setChecked(false); + } + else { + if (red_switch.isChecked()) { + THEME.edit().putString("THEME", "3").commit(); + + + + green_switch.setChecked(false); + purple_switch.setChecked(false); + red_switch.setChecked(true); + blue_switch.setChecked(false); + orange_switch.setChecked(false); + yellow_switch.setChecked(false); + gray_switch.setChecked(false); + } + else { + if (blue_switch.isChecked()) { + THEME.edit().putString("THEME", "4").commit(); + + + + green_switch.setChecked(false); + purple_switch.setChecked(false); + red_switch.setChecked(false); + blue_switch.setChecked(true); + orange_switch.setChecked(false); + yellow_switch.setChecked(false); + gray_switch.setChecked(false); + } + else { + if (orange_switch.isChecked()) { + THEME.edit().putString("THEME", "5").commit(); + + + + green_switch.setChecked(false); + purple_switch.setChecked(false); + red_switch.setChecked(false); + blue_switch.setChecked(false); + orange_switch.setChecked(true); + yellow_switch.setChecked(false); + gray_switch.setChecked(false); + } + else { + if (yellow_switch.isChecked()) { + THEME.edit().putString("THEME", "6").commit(); + + + + green_switch.setChecked(false); + purple_switch.setChecked(false); + red_switch.setChecked(false); + blue_switch.setChecked(false); + orange_switch.setChecked(false); + yellow_switch.setChecked(true); + gray_switch.setChecked(false); + } + else { + if (gray_switch.isChecked()) { + THEME.edit().putString("THEME", "7").commit(); + + + + green_switch.setChecked(false); + purple_switch.setChecked(false); + red_switch.setChecked(false); + blue_switch.setChecked(false); + orange_switch.setChecked(false); + yellow_switch.setChecked(false); + gray_switch.setChecked(true); + } + else { + if (!(green_switch.isChecked() && (purple_switch.isChecked() && red_switch.isChecked()))) { + THEME.edit().putString("THEME", "0").commit(); + + + + green_switch.setChecked(false); + purple_switch.setChecked(false); + red_switch.setChecked(false); + blue_switch.setChecked(false); + orange_switch.setChecked(false); + yellow_switch.setChecked(false); + gray_switch.setChecked(false); + } + } + } + } + } + } + } + } + } + }); + + purple_switch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton _param1, boolean _param2) { + final boolean _isChecked = _param2; + if (_isChecked) { + THEME.edit().putString("THEME", "2").commit(); + + + + green_switch.setChecked(false); + purple_switch.setChecked(true); + red_switch.setChecked(false); + blue_switch.setChecked(false); + orange_switch.setChecked(false); + yellow_switch.setChecked(false); + gray_switch.setChecked(false); + } + else { + if (green_switch.isChecked()) { + THEME.edit().putString("THEME", "1").commit(); + + + + green_switch.setChecked(true); + purple_switch.setChecked(false); + red_switch.setChecked(false); + blue_switch.setChecked(false); + orange_switch.setChecked(false); + yellow_switch.setChecked(false); + gray_switch.setChecked(false); + } + else { + if (red_switch.isChecked()) { + THEME.edit().putString("THEME", "3").commit(); + + + + green_switch.setChecked(false); + purple_switch.setChecked(false); + red_switch.setChecked(true); + blue_switch.setChecked(false); + orange_switch.setChecked(false); + yellow_switch.setChecked(false); + gray_switch.setChecked(false); + } + else { + if (blue_switch.isChecked()) { + THEME.edit().putString("THEME", "4").commit(); + + + + green_switch.setChecked(false); + purple_switch.setChecked(false); + red_switch.setChecked(false); + blue_switch.setChecked(true); + orange_switch.setChecked(false); + yellow_switch.setChecked(false); + gray_switch.setChecked(false); + } + else { + if (orange_switch.isChecked()) { + THEME.edit().putString("THEME", "5").commit(); + + + + green_switch.setChecked(false); + purple_switch.setChecked(false); + red_switch.setChecked(false); + blue_switch.setChecked(false); + orange_switch.setChecked(true); + yellow_switch.setChecked(false); + gray_switch.setChecked(false); + } + else { + if (yellow_switch.isChecked()) { + THEME.edit().putString("THEME", "6").commit(); + + + + green_switch.setChecked(false); + purple_switch.setChecked(false); + red_switch.setChecked(false); + blue_switch.setChecked(false); + orange_switch.setChecked(false); + yellow_switch.setChecked(true); + gray_switch.setChecked(false); + } + else { + if (gray_switch.isChecked()) { + THEME.edit().putString("THEME", "7").commit(); + + + + green_switch.setChecked(false); + purple_switch.setChecked(false); + red_switch.setChecked(false); + blue_switch.setChecked(false); + orange_switch.setChecked(false); + yellow_switch.setChecked(false); + gray_switch.setChecked(true); + } + else { + if (!(green_switch.isChecked() && (purple_switch.isChecked() && red_switch.isChecked()))) { + THEME.edit().putString("THEME", "0").commit(); + + + + green_switch.setChecked(false); + purple_switch.setChecked(false); + red_switch.setChecked(false); + blue_switch.setChecked(false); + orange_switch.setChecked(false); + yellow_switch.setChecked(false); + gray_switch.setChecked(false); + } + } + } + } + } + } + } + } + } + }); + + red_switch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton _param1, boolean _param2) { + final boolean _isChecked = _param2; + if (_isChecked) { + THEME.edit().putString("THEME", "3").commit(); + + + + green_switch.setChecked(false); + purple_switch.setChecked(false); + red_switch.setChecked(true); + blue_switch.setChecked(false); + orange_switch.setChecked(false); + yellow_switch.setChecked(false); + gray_switch.setChecked(false); + } + else { + if (purple_switch.isChecked()) { + THEME.edit().putString("THEME", "2").commit(); + + + + green_switch.setChecked(false); + purple_switch.setChecked(true); + red_switch.setChecked(false); + blue_switch.setChecked(false); + orange_switch.setChecked(false); + yellow_switch.setChecked(false); + gray_switch.setChecked(false); + } + else { + if (green_switch.isChecked()) { + THEME.edit().putString("THEME", "1").commit(); + + + + green_switch.setChecked(true); + purple_switch.setChecked(false); + red_switch.setChecked(false); + blue_switch.setChecked(false); + orange_switch.setChecked(false); + yellow_switch.setChecked(false); + gray_switch.setChecked(false); + } + else { + if (blue_switch.isChecked()) { + THEME.edit().putString("THEME", "4").commit(); + + + + green_switch.setChecked(false); + purple_switch.setChecked(false); + red_switch.setChecked(false); + blue_switch.setChecked(true); + orange_switch.setChecked(false); + yellow_switch.setChecked(false); + gray_switch.setChecked(false); + } + else { + if (orange_switch.isChecked()) { + THEME.edit().putString("THEME", "5").commit(); + + + + green_switch.setChecked(false); + purple_switch.setChecked(false); + red_switch.setChecked(false); + blue_switch.setChecked(false); + orange_switch.setChecked(true); + yellow_switch.setChecked(false); + gray_switch.setChecked(false); + } + else { + if (yellow_switch.isChecked()) { + THEME.edit().putString("THEME", "6").commit(); + + + + green_switch.setChecked(false); + purple_switch.setChecked(false); + red_switch.setChecked(false); + blue_switch.setChecked(false); + orange_switch.setChecked(false); + yellow_switch.setChecked(true); + gray_switch.setChecked(false); + } + else { + if (gray_switch.isChecked()) { + THEME.edit().putString("THEME", "7").commit(); + + + + green_switch.setChecked(false); + purple_switch.setChecked(false); + red_switch.setChecked(false); + blue_switch.setChecked(false); + orange_switch.setChecked(false); + yellow_switch.setChecked(false); + gray_switch.setChecked(true); + } + else { + if (!(green_switch.isChecked() && (purple_switch.isChecked() && red_switch.isChecked()))) { + THEME.edit().putString("THEME", "0").commit(); + + + + green_switch.setChecked(false); + purple_switch.setChecked(false); + red_switch.setChecked(false); + blue_switch.setChecked(false); + orange_switch.setChecked(false); + yellow_switch.setChecked(false); + gray_switch.setChecked(false); + } + } + } + } + } + } + } + } + } + }); + + blue_switch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton _param1, boolean _param2) { + final boolean _isChecked = _param2; + if (_isChecked) { + THEME.edit().putString("THEME", "4").commit(); + + + + green_switch.setChecked(false); + purple_switch.setChecked(false); + red_switch.setChecked(false); + blue_switch.setChecked(true); + orange_switch.setChecked(false); + yellow_switch.setChecked(false); + gray_switch.setChecked(false); + } + else { + if (purple_switch.isChecked()) { + THEME.edit().putString("THEME", "2").commit(); + + + + green_switch.setChecked(false); + purple_switch.setChecked(true); + red_switch.setChecked(false); + blue_switch.setChecked(false); + orange_switch.setChecked(false); + yellow_switch.setChecked(false); + gray_switch.setChecked(false); + } + else { + if (red_switch.isChecked()) { + THEME.edit().putString("THEME", "3").commit(); + + + + green_switch.setChecked(false); + purple_switch.setChecked(false); + red_switch.setChecked(true); + blue_switch.setChecked(false); + orange_switch.setChecked(false); + yellow_switch.setChecked(false); + gray_switch.setChecked(false); + } + else { + if (green_switch.isChecked()) { + THEME.edit().putString("THEME", "1").commit(); + + + + green_switch.setChecked(true); + purple_switch.setChecked(false); + red_switch.setChecked(false); + blue_switch.setChecked(false); + orange_switch.setChecked(false); + yellow_switch.setChecked(false); + gray_switch.setChecked(false); + } + else { + if (orange_switch.isChecked()) { + THEME.edit().putString("THEME", "5").commit(); + + + + green_switch.setChecked(false); + purple_switch.setChecked(false); + red_switch.setChecked(false); + blue_switch.setChecked(false); + orange_switch.setChecked(true); + yellow_switch.setChecked(false); + gray_switch.setChecked(false); + } + else { + if (yellow_switch.isChecked()) { + THEME.edit().putString("THEME", "6").commit(); + + + + green_switch.setChecked(false); + purple_switch.setChecked(false); + red_switch.setChecked(false); + blue_switch.setChecked(false); + orange_switch.setChecked(false); + yellow_switch.setChecked(true); + gray_switch.setChecked(false); + } + else { + if (gray_switch.isChecked()) { + THEME.edit().putString("THEME", "7").commit(); + + + + green_switch.setChecked(false); + purple_switch.setChecked(false); + red_switch.setChecked(false); + blue_switch.setChecked(false); + orange_switch.setChecked(false); + yellow_switch.setChecked(false); + gray_switch.setChecked(true); + } + else { + if (!(green_switch.isChecked() && (purple_switch.isChecked() && red_switch.isChecked()))) { + THEME.edit().putString("THEME", "0").commit(); + + + + green_switch.setChecked(false); + purple_switch.setChecked(false); + red_switch.setChecked(false); + blue_switch.setChecked(false); + orange_switch.setChecked(false); + yellow_switch.setChecked(false); + gray_switch.setChecked(false); + } + } + } + } + } + } + } + } + } + }); + + orange_switch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton _param1, boolean _param2) { + final boolean _isChecked = _param2; + if (_isChecked) { + THEME.edit().putString("THEME", "5").commit(); + + + + green_switch.setChecked(false); + purple_switch.setChecked(false); + red_switch.setChecked(false); + blue_switch.setChecked(false); + orange_switch.setChecked(true); + yellow_switch.setChecked(false); + gray_switch.setChecked(false); + } + else { + if (purple_switch.isChecked()) { + THEME.edit().putString("THEME", "2").commit(); + + + + green_switch.setChecked(false); + purple_switch.setChecked(true); + red_switch.setChecked(false); + blue_switch.setChecked(false); + orange_switch.setChecked(false); + yellow_switch.setChecked(false); + gray_switch.setChecked(false); + } + else { + if (red_switch.isChecked()) { + THEME.edit().putString("THEME", "3").commit(); + + + + green_switch.setChecked(false); + purple_switch.setChecked(false); + red_switch.setChecked(true); + blue_switch.setChecked(false); + orange_switch.setChecked(false); + yellow_switch.setChecked(false); + gray_switch.setChecked(false); + } + else { + if (blue_switch.isChecked()) { + THEME.edit().putString("THEME", "4").commit(); + + + + green_switch.setChecked(false); + purple_switch.setChecked(false); + red_switch.setChecked(false); + blue_switch.setChecked(true); + orange_switch.setChecked(false); + yellow_switch.setChecked(false); + gray_switch.setChecked(false); + } + else { + if (green_switch.isChecked()) { + THEME.edit().putString("THEME", "1").commit(); + + + + green_switch.setChecked(true); + purple_switch.setChecked(false); + red_switch.setChecked(false); + blue_switch.setChecked(false); + orange_switch.setChecked(false); + yellow_switch.setChecked(false); + gray_switch.setChecked(false); + } + else { + if (yellow_switch.isChecked()) { + THEME.edit().putString("THEME", "6").commit(); + + + + green_switch.setChecked(false); + purple_switch.setChecked(false); + red_switch.setChecked(false); + blue_switch.setChecked(false); + orange_switch.setChecked(false); + yellow_switch.setChecked(true); + gray_switch.setChecked(false); + } + else { + if (gray_switch.isChecked()) { + THEME.edit().putString("THEME", "7").commit(); + + + + green_switch.setChecked(false); + purple_switch.setChecked(false); + red_switch.setChecked(false); + blue_switch.setChecked(false); + orange_switch.setChecked(false); + yellow_switch.setChecked(false); + gray_switch.setChecked(true); + } + else { + if (!(green_switch.isChecked() && (purple_switch.isChecked() && red_switch.isChecked()))) { + THEME.edit().putString("THEME", "0").commit(); + + + + green_switch.setChecked(false); + purple_switch.setChecked(false); + red_switch.setChecked(false); + blue_switch.setChecked(false); + orange_switch.setChecked(false); + yellow_switch.setChecked(false); + gray_switch.setChecked(false); + } + } + } + } + } + } + } + } + } + }); + + yellow_switch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton _param1, boolean _param2) { + final boolean _isChecked = _param2; + if (_isChecked) { + THEME.edit().putString("THEME", "6").commit(); + + + + green_switch.setChecked(false); + purple_switch.setChecked(false); + red_switch.setChecked(false); + blue_switch.setChecked(false); + orange_switch.setChecked(false); + yellow_switch.setChecked(true); + gray_switch.setChecked(false); + } + else { + if (purple_switch.isChecked()) { + THEME.edit().putString("THEME", "2").commit(); + + + + green_switch.setChecked(false); + purple_switch.setChecked(true); + red_switch.setChecked(false); + blue_switch.setChecked(false); + orange_switch.setChecked(false); + yellow_switch.setChecked(false); + gray_switch.setChecked(false); + } + else { + if (red_switch.isChecked()) { + THEME.edit().putString("THEME", "3").commit(); + + + + green_switch.setChecked(false); + purple_switch.setChecked(false); + red_switch.setChecked(true); + blue_switch.setChecked(false); + orange_switch.setChecked(false); + yellow_switch.setChecked(false); + gray_switch.setChecked(false); + } + else { + if (blue_switch.isChecked()) { + THEME.edit().putString("THEME", "4").commit(); + + + + green_switch.setChecked(false); + purple_switch.setChecked(false); + red_switch.setChecked(false); + blue_switch.setChecked(true); + orange_switch.setChecked(false); + yellow_switch.setChecked(false); + gray_switch.setChecked(false); + } + else { + if (orange_switch.isChecked()) { + THEME.edit().putString("THEME", "5").commit(); + + + + green_switch.setChecked(false); + purple_switch.setChecked(false); + red_switch.setChecked(false); + blue_switch.setChecked(false); + orange_switch.setChecked(true); + yellow_switch.setChecked(false); + gray_switch.setChecked(false); + } + else { + if (green_switch.isChecked()) { + THEME.edit().putString("THEME", "1").commit(); + + + + green_switch.setChecked(true); + purple_switch.setChecked(false); + red_switch.setChecked(false); + blue_switch.setChecked(false); + orange_switch.setChecked(false); + yellow_switch.setChecked(false); + gray_switch.setChecked(false); + } + else { + if (gray_switch.isChecked()) { + THEME.edit().putString("THEME", "7").commit(); + + + + green_switch.setChecked(false); + purple_switch.setChecked(false); + red_switch.setChecked(false); + blue_switch.setChecked(false); + orange_switch.setChecked(false); + yellow_switch.setChecked(false); + gray_switch.setChecked(true); + } + else { + if (!(green_switch.isChecked() && (purple_switch.isChecked() && red_switch.isChecked()))) { + THEME.edit().putString("THEME", "0").commit(); + + + + green_switch.setChecked(false); + purple_switch.setChecked(false); + red_switch.setChecked(false); + blue_switch.setChecked(false); + orange_switch.setChecked(false); + yellow_switch.setChecked(false); + gray_switch.setChecked(false); + } + } + } + } + } + } + } + } + } + }); + + gray_switch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton _param1, boolean _param2) { + final boolean _isChecked = _param2; + if (_isChecked) { + THEME.edit().putString("THEME", "7").commit(); + + + + green_switch.setChecked(false); + purple_switch.setChecked(false); + red_switch.setChecked(false); + blue_switch.setChecked(false); + orange_switch.setChecked(false); + yellow_switch.setChecked(false); + gray_switch.setChecked(true); + } + else { + if (purple_switch.isChecked()) { + THEME.edit().putString("THEME", "2").commit(); + + + + green_switch.setChecked(false); + purple_switch.setChecked(true); + red_switch.setChecked(false); + blue_switch.setChecked(false); + orange_switch.setChecked(false); + yellow_switch.setChecked(false); + gray_switch.setChecked(false); + } + else { + if (red_switch.isChecked()) { + THEME.edit().putString("THEME", "3").commit(); + + + + green_switch.setChecked(false); + purple_switch.setChecked(false); + red_switch.setChecked(true); + blue_switch.setChecked(false); + orange_switch.setChecked(false); + yellow_switch.setChecked(false); + gray_switch.setChecked(false); + } + else { + if (blue_switch.isChecked()) { + THEME.edit().putString("THEME", "4").commit(); + + + + green_switch.setChecked(false); + purple_switch.setChecked(false); + red_switch.setChecked(false); + blue_switch.setChecked(true); + orange_switch.setChecked(false); + yellow_switch.setChecked(false); + gray_switch.setChecked(false); + } + else { + if (orange_switch.isChecked()) { + THEME.edit().putString("THEME", "5").commit(); + + + + green_switch.setChecked(false); + purple_switch.setChecked(false); + red_switch.setChecked(false); + blue_switch.setChecked(false); + orange_switch.setChecked(true); + yellow_switch.setChecked(false); + gray_switch.setChecked(false); + } + else { + if (yellow_switch.isChecked()) { + THEME.edit().putString("THEME", "6").commit(); + + + + green_switch.setChecked(false); + purple_switch.setChecked(false); + red_switch.setChecked(false); + blue_switch.setChecked(false); + orange_switch.setChecked(false); + yellow_switch.setChecked(true); + gray_switch.setChecked(false); + } + else { + if (green_switch.isChecked()) { + THEME.edit().putString("THEME", "1").commit(); + + + + green_switch.setChecked(true); + purple_switch.setChecked(false); + red_switch.setChecked(false); + blue_switch.setChecked(false); + orange_switch.setChecked(false); + yellow_switch.setChecked(false); + gray_switch.setChecked(false); + } + else { + if (!(green_switch.isChecked() && (purple_switch.isChecked() && red_switch.isChecked()))) { + THEME.edit().putString("THEME", "0").commit(); + + + + green_switch.setChecked(false); + purple_switch.setChecked(false); + red_switch.setChecked(false); + blue_switch.setChecked(false); + orange_switch.setChecked(false); + yellow_switch.setChecked(false); + gray_switch.setChecked(false); + } + } + } + } + } + } + } + } + } + }); + + box_support.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View _view) { + try { + Support.setAction(Intent.ACTION_VIEW); + Support.setData(Uri.parse("https://t.me/SpotifyModSupport")); + startActivity(Support); + Timer = new TimerTask() { + @Override + public void run() { + runOnUiThread(new Runnable() { + @Override + public void run() { + _Hide_Navigation(); + } + }); + } + }; + _timer.schedule(Timer, (int)(100)); + } + catch(Exception e) { + } + } + }); + + box_donate.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View _view) { + try { + _RequiredDialog(Donation, false); + Donation.setTitle("SHOW YOUR SUPPORT"); + Donation.setMessage("We are a non-profit, non-corporate and non-compromised team. People like you encourage us to create an app to make things much easier especially from downloading to installing.\n\nWe are pouring all of our time and best efforts just to make things right and perfect. We will do our best to support this app as long as we could.\n\nAny amount will help and be very much appreciated!"); + Donation.setPositiveButton("DONATE", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface _dialog, int _which) { + _RequiredDialog(Donation, true); + Donate.setAction(Intent.ACTION_VIEW); + Donate.setData(Uri.parse("https://www.paypal.me/mrvnce")); + startActivity(Donate); + Timer = new TimerTask() { + @Override + public void run() { + runOnUiThread(new Runnable() { + @Override + public void run() { + _Hide_Navigation(); + } + }); + } + }; + _timer.schedule(Timer, (int)(100)); + } + }); + Donation.setNeutralButton("NOT NOW", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface _dialog, int _which) { + _RequiredDialog(Donation, true); + Timer = new TimerTask() { + @Override + public void run() { + runOnUiThread(new Runnable() { + @Override + public void run() { + _Hide_Navigation(); + } + }); + } + }; + _timer.schedule(Timer, (int)(100)); + } + }); + Donation.create().show(); + } + catch(Exception e) { + } + } + }); + + box_about.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View _view) { + + main_scroll_about.setVisibility(View.VISIBLE); + main_refresh_layout.setVisibility(View.GONE); + main_scroll_upload.setVisibility(View.GONE); + main_body_intro.setVisibility(View.GONE); + } + }); + + _regular_mod_data_child_listener = new ChildEventListener() { + @Override + public void onChildAdded(DataSnapshot _param1, String _param2) { + GenericTypeIndicator> _ind = new GenericTypeIndicator>() {}; + final String _childKey = _param1.getKey(); + final HashMap _childValue = _param1.getValue(_ind); + listdata.add(_childValue); + } + + @Override + public void onChildChanged(DataSnapshot _param1, String _param2) { + GenericTypeIndicator> _ind = new GenericTypeIndicator>() {}; + final String _childKey = _param1.getKey(); + final HashMap _childValue = _param1.getValue(_ind); + + } + + @Override + public void onChildMoved(DataSnapshot _param1, String _param2) { + + } + + @Override + public void onChildRemoved(DataSnapshot _param1) { + GenericTypeIndicator> _ind = new GenericTypeIndicator>() {}; + final String _childKey = _param1.getKey(); + final HashMap _childValue = _param1.getValue(_ind); + + } + + @Override + public void onCancelled(DatabaseError _param1) { + final int _errorCode = _param1.getCode(); + final String _errorMessage = _param1.getMessage(); + + } + }; + regular_mod_data.addChildEventListener(_regular_mod_data_child_listener); + + _amoled_black_data_child_listener = new ChildEventListener() { + @Override + public void onChildAdded(DataSnapshot _param1, String _param2) { + GenericTypeIndicator> _ind = new GenericTypeIndicator>() {}; + final String _childKey = _param1.getKey(); + final HashMap _childValue = _param1.getValue(_ind); + listdata.add(_childValue); + } + + @Override + public void onChildChanged(DataSnapshot _param1, String _param2) { + GenericTypeIndicator> _ind = new GenericTypeIndicator>() {}; + final String _childKey = _param1.getKey(); + final HashMap _childValue = _param1.getValue(_ind); + + } + + @Override + public void onChildMoved(DataSnapshot _param1, String _param2) { + + } + + @Override + public void onChildRemoved(DataSnapshot _param1) { + GenericTypeIndicator> _ind = new GenericTypeIndicator>() {}; + final String _childKey = _param1.getKey(); + final HashMap _childValue = _param1.getValue(_ind); + + } + + @Override + public void onCancelled(DatabaseError _param1) { + final int _errorCode = _param1.getCode(); + final String _errorMessage = _param1.getMessage(); + + } + }; + amoled_black_data.addChildEventListener(_amoled_black_data_child_listener); + + _Connection_request_listener = new RequestNetwork.RequestListener() { + @Override + public void onResponse(String _param1, String _param2) { + final String _tag = _param1; + final String _response = _param2; + regular_mod_data.addListenerForSingleValueEvent(new ValueEventListener() { + @Override + public void onDataChange(DataSnapshot _dataSnapshot) { + listdata = new ArrayList<>(); + try { + GenericTypeIndicator> _ind = new GenericTypeIndicator>() {}; + for (DataSnapshot _data : _dataSnapshot.getChildren()) { + HashMap _map = _data.getValue(_ind); + listdata.add(_map); + } + } + catch (Exception _e) { + _e.printStackTrace(); + } + sub_1.setText(SUB_1.getString("SUB_1", "")); + + + main_body.setEnabled(false); + main_body.setAlpha((float)(0.65d)); + } + @Override + public void onCancelled(DatabaseError _databaseError) { + } + }); + amoled_black_data.addListenerForSingleValueEvent(new ValueEventListener() { + @Override + public void onDataChange(DataSnapshot _dataSnapshot) { + listdata = new ArrayList<>(); + try { + GenericTypeIndicator> _ind = new GenericTypeIndicator>() {}; + for (DataSnapshot _data : _dataSnapshot.getChildren()) { + HashMap _map = _data.getValue(_ind); + listdata.add(_map); + } + } + catch (Exception _e) { + _e.printStackTrace(); + } + sub_3.setText(SUB_2.getString("SUB_2", "")); + + main_body.setEnabled(true); + main_body.setAlpha((float)(1.0d)); + } + @Override + public void onCancelled(DatabaseError _databaseError) { + } + }); + } + + @Override + public void onErrorResponse(String _param1, String _param2) { + final String _tag = _param1; + final String _message = _param2; + + main_body.setAlpha((float)(0.65d)); + Timer = new TimerTask() { + @Override + public void run() { + runOnUiThread(new Runnable() { + @Override + public void run() { + + main_body.setAlpha((float)(1.0d)); + } + }); + } + }; + _timer.schedule(Timer, (int)(700)); + } + }; + + _Version_child_listener = new ChildEventListener() { + @Override + public void onChildAdded(DataSnapshot _param1, String _param2) { + GenericTypeIndicator> _ind = new GenericTypeIndicator>() {}; + final String _childKey = _param1.getKey(); + final HashMap _childValue = _param1.getValue(_ind); + + } + + @Override + public void onChildChanged(DataSnapshot _param1, String _param2) { + GenericTypeIndicator> _ind = new GenericTypeIndicator>() {}; + final String _childKey = _param1.getKey(); + final HashMap _childValue = _param1.getValue(_ind); + + } + + @Override + public void onChildMoved(DataSnapshot _param1, String _param2) { + + } + + @Override + public void onChildRemoved(DataSnapshot _param1) { + GenericTypeIndicator> _ind = new GenericTypeIndicator>() {}; + final String _childKey = _param1.getKey(); + final HashMap _childValue = _param1.getValue(_ind); + + } + + @Override + public void onCancelled(DatabaseError _param1) { + final int _errorCode = _param1.getCode(); + final String _errorMessage = _param1.getMessage(); + + } + }; + Version.addChildEventListener(_Version_child_listener); + + _xManager_Update_child_listener = new ChildEventListener() { + @Override + public void onChildAdded(DataSnapshot _param1, String _param2) { + GenericTypeIndicator> _ind = new GenericTypeIndicator>() {}; + final String _childKey = _param1.getKey(); + final HashMap _childValue = _param1.getValue(_ind); + hidden_download.setText(_childValue.get("Links").toString()); + } + + @Override + public void onChildChanged(DataSnapshot _param1, String _param2) { + GenericTypeIndicator> _ind = new GenericTypeIndicator>() {}; + final String _childKey = _param1.getKey(); + final HashMap _childValue = _param1.getValue(_ind); + + } + + @Override + public void onChildMoved(DataSnapshot _param1, String _param2) { + + } + + @Override + public void onChildRemoved(DataSnapshot _param1) { + GenericTypeIndicator> _ind = new GenericTypeIndicator>() {}; + final String _childKey = _param1.getKey(); + final HashMap _childValue = _param1.getValue(_ind); + + } + + @Override + public void onCancelled(DatabaseError _param1) { + final int _errorCode = _param1.getCode(); + final String _errorMessage = _param1.getMessage(); + + } + }; + xManager_Update.addChildEventListener(_xManager_Update_child_listener); + + _Developer_child_listener = new ChildEventListener() { + @Override + public void onChildAdded(DataSnapshot _param1, String _param2) { + GenericTypeIndicator> _ind = new GenericTypeIndicator>() {}; + final String _childKey = _param1.getKey(); + final HashMap _childValue = _param1.getValue(_ind); + dev_2.setText(_childValue.get("Add_Datas").toString()); + } + + @Override + public void onChildChanged(DataSnapshot _param1, String _param2) { + GenericTypeIndicator> _ind = new GenericTypeIndicator>() {}; + final String _childKey = _param1.getKey(); + final HashMap _childValue = _param1.getValue(_ind); + + } + + @Override + public void onChildMoved(DataSnapshot _param1, String _param2) { + + } + + @Override + public void onChildRemoved(DataSnapshot _param1) { + GenericTypeIndicator> _ind = new GenericTypeIndicator>() {}; + final String _childKey = _param1.getKey(); + final HashMap _childValue = _param1.getValue(_ind); + + } + + @Override + public void onCancelled(DatabaseError _param1) { + final int _errorCode = _param1.getCode(); + final String _errorMessage = _param1.getMessage(); + + } + }; + Developer.addChildEventListener(_Developer_child_listener); + + _Mod_Changelogs_child_listener = new ChildEventListener() { + @Override + public void onChildAdded(DataSnapshot _param1, String _param2) { + GenericTypeIndicator> _ind = new GenericTypeIndicator>() {}; + final String _childKey = _param1.getKey(); + final HashMap _childValue = _param1.getValue(_ind); + changelogs_0.setText(_childValue.get("Changelogs").toString()); + edit_logs_1.setText(_childValue.get("Changelogs").toString()); + } + + @Override + public void onChildChanged(DataSnapshot _param1, String _param2) { + GenericTypeIndicator> _ind = new GenericTypeIndicator>() {}; + final String _childKey = _param1.getKey(); + final HashMap _childValue = _param1.getValue(_ind); + + } + + @Override + public void onChildMoved(DataSnapshot _param1, String _param2) { + + } + + @Override + public void onChildRemoved(DataSnapshot _param1) { + GenericTypeIndicator> _ind = new GenericTypeIndicator>() {}; + final String _childKey = _param1.getKey(); + final HashMap _childValue = _param1.getValue(_ind); + + } + + @Override + public void onCancelled(DatabaseError _param1) { + final int _errorCode = _param1.getCode(); + final String _errorMessage = _param1.getMessage(); + + } + }; + Mod_Changelogs.addChildEventListener(_Mod_Changelogs_child_listener); + + _xManager_Changelogs_child_listener = new ChildEventListener() { + @Override + public void onChildAdded(DataSnapshot _param1, String _param2) { + GenericTypeIndicator> _ind = new GenericTypeIndicator>() {}; + final String _childKey = _param1.getKey(); + final HashMap _childValue = _param1.getValue(_ind); + app_changelogs.setText(_childValue.get("App_Changelogs").toString()); + } + + @Override + public void onChildChanged(DataSnapshot _param1, String _param2) { + GenericTypeIndicator> _ind = new GenericTypeIndicator>() {}; + final String _childKey = _param1.getKey(); + final HashMap _childValue = _param1.getValue(_ind); + + } + + @Override + public void onChildMoved(DataSnapshot _param1, String _param2) { + + } + + @Override + public void onChildRemoved(DataSnapshot _param1) { + GenericTypeIndicator> _ind = new GenericTypeIndicator>() {}; + final String _childKey = _param1.getKey(); + final HashMap _childValue = _param1.getValue(_ind); + + } + + @Override + public void onCancelled(DatabaseError _param1) { + final int _errorCode = _param1.getCode(); + final String _errorMessage = _param1.getMessage(); + + } + }; + xManager_Changelogs.addChildEventListener(_xManager_Changelogs_child_listener); + } + private void initializeLogic() { + try { + _Informations(); + _Model_UI(); + } + catch(Exception e) { + } + } + + @Override + protected void onActivityResult(int _requestCode, int _resultCode, Intent _data) { + super.onActivityResult(_requestCode, _resultCode, _data); + + switch (_requestCode) { + + default: + break; + } + } + + @Override + public void onBackPressed() { + if (CHECK == 0) { + CHECK = 1; + Timer = new TimerTask() { + @Override + public void run() { + runOnUiThread(new Runnable() { + @Override + public void run() { + CHECK = 0; + } + }); + } + }; + _timer.schedule(Timer, (int)(1000)); + SketchwareUtil.showMessage(getApplicationContext(), "Press back again to exit"); + } + else { + finishAndRemoveTask(); + finishAffinity(); + } + } + + @Override + public void onResume() { + super.onResume(); + _Hide_Navigation(); + } + private void _Informations () { + sub_2.setText("N/A"); + cpu.setText("N/A"); + Timer = new TimerTask() { + @Override + public void run() { + runOnUiThread(new Runnable() { + @Override + public void run() { + String uri = "com.spotify.music"; + android.content.pm.PackageManager pm = getPackageManager(); + + try { + android.content.pm.PackageInfo pInfo = pm.getPackageInfo(uri, android.content.pm.PackageManager.GET_ACTIVITIES); + String version = pInfo.versionName; + sub_2.setText(version); + sub_4.setText(version); + + } catch (android.content.pm.PackageManager.NameNotFoundException e) { + } + String app = "com.xc3fff0e.xmanager"; + android.content.pm.PackageManager ver = getPackageManager(); + + try { + android.content.pm.PackageInfo pInfo = ver.getPackageInfo(app, android.content.pm.PackageManager.GET_ACTIVITIES); + String version = pInfo.versionName; + app_version.setText(version); + + } catch (android.content.pm.PackageManager.NameNotFoundException e) { + } + cpu.setText(Build.CPU_ABI); + } + }); + } + }; + _timer.schedule(Timer, (int)(750)); + } + + + private void _RequiredDialog (final AlertDialog.Builder _Dialog, final boolean _True) { + _Dialog.setCancelable(_True); + } + + + private void _Download (final String _url, final String _path) { + try { + FileUtil.makeDir(FileUtil.getPackageDataDir(getApplicationContext())); + + android.net.ConnectivityManager connMgr = (android.net.ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE); + android.net.NetworkInfo networkInfo = connMgr.getActiveNetworkInfo(); + if (networkInfo != null && networkInfo.isConnected()) { + + + final String urlDownload = _url; + + DownloadManager.Request request = new DownloadManager.Request(Uri.parse(urlDownload)); + + final String fileName = URLUtil.guessFileName(urlDownload, null, null); + + request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_ONLY_COMPLETION); + + request.setMimeType("application/vnd.android.package-archive"); + + request.allowScanningByMediaScanner(); + + request.setDestinationInExternalFilesDir(this,Environment.DIRECTORY_DOWNLOADS, "Spotify Mod (Official).apk"); + + final DownloadManager manager = (DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE); + + final long downloadId = manager.enqueue(request); + + final ProgressDialog prog = new ProgressDialog(this, ProgressDialog.THEME_DEVICE_DEFAULT_DARK); + prog.setMax(100); + prog.setIndeterminate(false); + prog.setCancelable(false); + prog.setCanceledOnTouchOutside(false); + prog.setTitle("DOWNLOADING FILE..."); + new Thread(new Runnable() { + + @Override + public void run() { + + boolean downloading = true; + + while (downloading) { + + DownloadManager.Query q = new DownloadManager.Query(); + + q.setFilterById(downloadId); + + android.database.Cursor cursor = manager.query(q); + + if (cursor != null) { + if (cursor.moveToFirst()) { + + int bytes_downloaded = cursor.getInt(cursor .getColumnIndex(DownloadManager.COLUMN_BYTES_DOWNLOADED_SO_FAR)); + + int bytes_total = cursor.getInt(cursor.getColumnIndex(DownloadManager.COLUMN_TOTAL_SIZE_BYTES)); + + if (cursor.getInt(cursor.getColumnIndex(DownloadManager.COLUMN_STATUS)) == DownloadManager.STATUS_SUCCESSFUL) { + + downloading = false; + + } + + if (cursor.getInt(cursor.getColumnIndex(DownloadManager.COLUMN_STATUS)) == DownloadManager.STATUS_FAILED) { + + runOnUiThread(new Runnable() { + public void run() { + + showMessage("The file or link is currently unavailable. Please try again later."); + } + }); + prog.cancel(); + break; + + } + + final int dl_progress = (int) ((bytes_downloaded * 100l) / bytes_total); + + runOnUiThread(new Runnable() { + @Override + public void run() { + + prog.setTitle("DOWNLOADING FILE..."); + prog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); + prog.setProgress(dl_progress); + prog.setMax(100); + prog.show(); + + if (dl_progress == prog.getMax()) { + + Timer = new TimerTask() { + @Override + public void run() { + runOnUiThread(new Runnable() { + @Override + public void run() { + + FileUtil.copyFile("/storage/emulated/0/Android/data/com.xc3fff0e.xmanager/files/Download/Spotify Mod (Official).apk", "/storage/emulated/0/xManager/Spotify Mod (Official).apk"); + prog.dismiss(); + + _RequiredDialog(Success_Download, false); + Success_Download.setTitle("SUCCESSFULLY DOWNLOADED"); + Success_Download.setMessage("FILE DIRECTORY:\n"); + Success_Download.setPositiveButton("INSTALL NOW", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface _dialog, int _which) { + _RequiredDialog(Success_Download, true); + StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder(); StrictMode.setVmPolicy(builder.build()); + + if(android.os.Build.VERSION.SDK_INT >= 29){ + + Intent intent = new Intent(Intent.ACTION_VIEW); + + intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); + + intent.setDataAndType(FileProvider.getUriForFile(MainActivity.this, "com.xc3fff0e.xmanager.provider", new File("/storage/emulated/0/Android/data/com.xc3fff0e.xmanager/files/Download/Spotify Mod (Official).apk")), "application/vnd.android.package-archive"); + + startActivity(intent); + + } else { + + Intent intent = new Intent(Intent.ACTION_VIEW); + intent.setDataAndType(Uri.fromFile(new File("/storage/emulated/0/Android/data/com.xc3fff0e.xmanager/files/Download/Spotify Mod (Official).apk")), "application/vnd.android.package-archive"); + + startActivity(intent); + Timer = new TimerTask() { + @Override + public void run() { + runOnUiThread(new Runnable() { + @Override + public void run() { + _Hide_Navigation(); + } + }); + } + }; + _timer.schedule(Timer, (int)(100)); + } + } + }); + Success_Download.setNeutralButton("LATER", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface _dialog, int _which) { + _RequiredDialog(Success_Download, true); + Timer = new TimerTask() { + @Override + public void run() { + runOnUiThread(new Runnable() { + @Override + public void run() { + _Hide_Navigation(); + } + }); + } + }; + _timer.schedule(Timer, (int)(100)); + } + }); + Success_Download.create().show(); + showMessage("Download Complete"); + } + }); + } + }; + _timer.schedule(Timer, (int)(1500)); + } + } }); + } + cursor.close(); + } + } } }).start(); + + } else { + showMessage("No Internet Connection"); + } + } + catch(Exception e) { + } + } + + + private void _File_Remover () { + if (FileUtil.isExistFile("/storage/emulated/0/Android/data/com.xc3fff0e.xmanager/files/Download/Spotify Mod (Official).apk")) { + FileUtil.deleteFile("/storage/emulated/0/Android/data/com.xc3fff0e.xmanager/files/Download/Spotify Mod (Official).apk"); + } + if (FileUtil.isExistFile("/storage/emulated/0/xManager/Spotify Mod (Official).apk")) { + FileUtil.deleteFile("/storage/emulated/0/xManager/Spotify Mod (Official).apk"); + } + } + + + private void _Update_Remover () { + if (FileUtil.isExistFile("/storage/emulated/0/Android/data/com.xc3fff0e.xmanager/files/Download/Update/xManager Update.apk")) { + FileUtil.deleteFile("/storage/emulated/0/Android/data/com.xc3fff0e.xmanager/files/Download/Update/xManager Update.apk"); + } + if (FileUtil.isExistFile("/storage/emulated/0/xManager/Update/xManager Update.apk")) { + FileUtil.deleteFile("/storage/emulated/0/xManager/Update/xManager Update.apk"); + } + } + + + private void _Model_UI () { + title_header.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 1); + title_sub.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 1); + title_1.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 1); + title_2.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 1); + sub_text_1.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 0); + sub_1.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 0); + sub_text_2.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 0); + sub_2.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 0); + sub_text_3.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 0); + sub_3.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 0); + sub_text_4.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 0); + sub_4.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 0); + title_sub.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 1); + device_cpu.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 0); + cpu.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 0); + support.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 1); + donate.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 1); + about.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 1); + version_switch_1.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 0); + version_switch_2.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 0); + theme.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 1); + green_theme.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 0); + purple_theme.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 0); + red_theme.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 0); + blue_theme.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 0); + orange_theme.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 0); + yellow_theme.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 0); + gray_theme.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 0); + title_about.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 1); + developer_manager.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 1); + developer_spotify.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 1); + support_team.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 0); + mod_testers.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 0); + mobilism_team.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 0); + forum_team.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 1); + manager_team.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 1); + developer_1.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 1); + developer_2.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 1); + support_1.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 0); + testers_1.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 0); + mobilism_1.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 0); + forum_1.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 1); + manager_1.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 1); + contributors_1.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 1); + changelogs.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 1); + changelogs_0.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 1); + sub_title.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 1); + app_version.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 1); + title_format.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 1); + body_format.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 1); + title_exit.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 1); + body_delete.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 1); + title_delete.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 1); + regular_delete.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 1); + amoled_delete.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 1); + header_logs.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 1); + logs_save.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 1); + logs_edit.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 1); + header_upload_title.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 1); + + + + + + list_menu_1.setVisibility(View.GONE); + list_menu_2.setVisibility(View.GONE); + box_5_sub_2.setVisibility(View.GONE); + box_6_sub_2.setVisibility(View.GONE); + list_menu_1.smoothScrollToPosition((int)(0)); + list_menu_2.smoothScrollToPosition((int)(0)); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + header_regular.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 1); + regular_submit.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 1); + header_amoled.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 1); + amoled_submit.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 1); + if (!ON_SCREEN.getString("ON_SCREEN", "").equals("ON_SCREEN")) { + try { + final ProgressDialog prog_0 = new ProgressDialog(MainActivity.this, ProgressDialog.THEME_DEVICE_DEFAULT_DARK); + + prog_0.setMax(100); + prog_0.setMessage("Initial optimization. Please wait..."); + prog_0.setIndeterminate(true); + prog_0.setCancelable(false); + if (!MainActivity.this.isFinishing()){ + prog_0.show(); + } + Timer = new TimerTask() { + @Override + public void run() { + runOnUiThread(new Runnable() { + @Override + public void run() { + prog_0.dismiss(); + final ProgressDialog prog_1 = new ProgressDialog(MainActivity.this, ProgressDialog.THEME_DEVICE_DEFAULT_DARK); + + prog_1.setMax(100); + prog_1.setMessage("Relaunching..."); + prog_1.setIndeterminate(true); + prog_1.setCancelable(false); + prog_1.show(); + + if (!MainActivity.this.isFinishing()){ + return; + } + Timer = new TimerTask() { + @Override + public void run() { + runOnUiThread(new Runnable() { + @Override + public void run() { + prog_1.dismiss(); + } + }); + } + }; + _timer.schedule(Timer, (int)(9000)); + } + }); + } + }; + _timer.schedule(Timer, (int)(8000)); + if (FileUtil.isExistFile("/storage/emulated/0/Android/data/com.xc3fff0e.xmanager/")) { + FileUtil.deleteFile("/storage/emulated/0/Android/data/com.xc3fff0e.xmanager/"); + } + if (FileUtil.isExistFile("/storage/emulated/0/xManager/")) { + FileUtil.deleteFile("/storage/emulated/0/xManager/"); + } + main_body.setEnabled(false); + main_body.setAlpha((float)(0.65d)); + regular_mod_data.addListenerForSingleValueEvent(new ValueEventListener() { + @Override + public void onDataChange(DataSnapshot _dataSnapshot) { + listdata = new ArrayList<>(); + try { + GenericTypeIndicator> _ind = new GenericTypeIndicator>() {}; + for (DataSnapshot _data : _dataSnapshot.getChildren()) { + HashMap _map = _data.getValue(_ind); + listdata.add(_map); + } + } + catch (Exception _e) { + _e.printStackTrace(); + } + sub_1.setText(SUB_1.getString("SUB_1", "")); + Timer = new TimerTask() { + @Override + public void run() { + runOnUiThread(new Runnable() { + @Override + public void run() { + + version_switch_1.setChecked(true); + version_switch_2.setChecked(false); + changelogs_switch.setChecked(false); + } + }); + } + }; + _timer.schedule(Timer, (int)(300)); + list_menu_1.setAdapter(new List_menu_1Adapter(listdata)); + ((BaseAdapter)list_menu_1.getAdapter()).notifyDataSetChanged(); + } + @Override + public void onCancelled(DatabaseError _databaseError) { + } + }); + amoled_black_data.addListenerForSingleValueEvent(new ValueEventListener() { + @Override + public void onDataChange(DataSnapshot _dataSnapshot) { + listdata = new ArrayList<>(); + try { + GenericTypeIndicator> _ind = new GenericTypeIndicator>() {}; + for (DataSnapshot _data : _dataSnapshot.getChildren()) { + HashMap _map = _data.getValue(_ind); + listdata.add(_map); + } + } + catch (Exception _e) { + _e.printStackTrace(); + } + sub_3.setText(SUB_2.getString("SUB_2", "")); + Timer = new TimerTask() { + @Override + public void run() { + runOnUiThread(new Runnable() { + @Override + public void run() { + + version_switch_1.setChecked(false); + version_switch_2.setChecked(true); + changelogs_switch.setChecked(false); + Timer = new TimerTask() { + @Override + public void run() { + runOnUiThread(new Runnable() { + @Override + public void run() { + + version_switch_1.setChecked(false); + version_switch_2.setChecked(false); + changelogs_switch.setChecked(true); + Timer = new TimerTask() { + @Override + public void run() { + runOnUiThread(new Runnable() { + @Override + public void run() { + + version_switch_1.setChecked(false); + version_switch_2.setChecked(false); + changelogs_switch.setChecked(false); + main_body.setEnabled(true); + main_body.setAlpha((float)(1.0d)); + } + }); + } + }; + _timer.schedule(Timer, (int)(700)); + } + }); + } + }; + _timer.schedule(Timer, (int)(700)); + } + }); + } + }; + _timer.schedule(Timer, (int)(500)); + list_menu_2.setAdapter(new List_menu_2Adapter(listdata)); + ((BaseAdapter)list_menu_2.getAdapter()).notifyDataSetChanged(); + } + @Override + public void onCancelled(DatabaseError _databaseError) { + } + }); + xManager_Changelogs.addChildEventListener(_xManager_Changelogs_child_listener); + Mod_Changelogs.addChildEventListener(_Mod_Changelogs_child_listener); + Developer.addChildEventListener(_Developer_child_listener); + Version.addChildEventListener(_Version_child_listener); + Timer = new TimerTask() { + @Override + public void run() { + runOnUiThread(new Runnable() { + @Override + public void run() { + ON_SCREEN.edit().putString("ON_SCREEN", "ON_SCREEN").commit(); + Intent intent = getBaseContext().getPackageManager().getLaunchIntentForPackage( getBaseContext().getPackageName() ); + + intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); + intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK); + startActivity(intent); + } + }); + } + }; + _timer.schedule(Timer, (int)(10000)); + box_uploader.setVisibility(View.GONE); + box_update.setVisibility(View.GONE); + Connection.startRequestNetwork(RequestNetworkController.GET, "https://spotify.com", "PAWN!", _Connection_request_listener); + } + catch(Exception e) { + } + } + else { + try { + regular_mod_data.addListenerForSingleValueEvent(new ValueEventListener() { + @Override + public void onDataChange(DataSnapshot _dataSnapshot) { + listdata = new ArrayList<>(); + try { + GenericTypeIndicator> _ind = new GenericTypeIndicator>() {}; + for (DataSnapshot _data : _dataSnapshot.getChildren()) { + HashMap _map = _data.getValue(_ind); + listdata.add(_map); + } + } + catch (Exception _e) { + _e.printStackTrace(); + } + sub_1.setText(SUB_1.getString("SUB_1", "")); + + list_menu_1.setAdapter(new List_menu_1Adapter(listdata)); + ((BaseAdapter)list_menu_1.getAdapter()).notifyDataSetChanged(); + main_body.setEnabled(false); + main_body.setAlpha((float)(0.65d)); + } + @Override + public void onCancelled(DatabaseError _databaseError) { + } + }); + amoled_black_data.addListenerForSingleValueEvent(new ValueEventListener() { + @Override + public void onDataChange(DataSnapshot _dataSnapshot) { + listdata = new ArrayList<>(); + try { + GenericTypeIndicator> _ind = new GenericTypeIndicator>() {}; + for (DataSnapshot _data : _dataSnapshot.getChildren()) { + HashMap _map = _data.getValue(_ind); + listdata.add(_map); + } + } + catch (Exception _e) { + _e.printStackTrace(); + } + sub_3.setText(SUB_2.getString("SUB_2", "")); + Timer = new TimerTask() { + @Override + public void run() { + runOnUiThread(new Runnable() { + @Override + public void run() { + + list_menu_2.setAdapter(new List_menu_2Adapter(listdata)); + ((BaseAdapter)list_menu_2.getAdapter()).notifyDataSetChanged(); + main_body.setEnabled(true); + main_body.setAlpha((float)(1.0d)); + } + }); + } + }; + _timer.schedule(Timer, (int)(800)); + } + @Override + public void onCancelled(DatabaseError _databaseError) { + } + }); + xManager_Changelogs.addListenerForSingleValueEvent(new ValueEventListener() { + @Override + public void onDataChange(DataSnapshot _dataSnapshot) { + others = new ArrayList<>(); + try { + GenericTypeIndicator> _ind = new GenericTypeIndicator>() {}; + for (DataSnapshot _data : _dataSnapshot.getChildren()) { + HashMap _map = _data.getValue(_ind); + others.add(_map); + } + } + catch (Exception _e) { + _e.printStackTrace(); + } + xManager_Changelogs.addChildEventListener(_xManager_Changelogs_child_listener); + } + @Override + public void onCancelled(DatabaseError _databaseError) { + } + }); + Mod_Changelogs.addListenerForSingleValueEvent(new ValueEventListener() { + @Override + public void onDataChange(DataSnapshot _dataSnapshot) { + others = new ArrayList<>(); + try { + GenericTypeIndicator> _ind = new GenericTypeIndicator>() {}; + for (DataSnapshot _data : _dataSnapshot.getChildren()) { + HashMap _map = _data.getValue(_ind); + others.add(_map); + } + } + catch (Exception _e) { + _e.printStackTrace(); + } + Mod_Changelogs.addChildEventListener(_Mod_Changelogs_child_listener); + } + @Override + public void onCancelled(DatabaseError _databaseError) { + } + }); + Developer.addListenerForSingleValueEvent(new ValueEventListener() { + @Override + public void onDataChange(DataSnapshot _dataSnapshot) { + others = new ArrayList<>(); + try { + GenericTypeIndicator> _ind = new GenericTypeIndicator>() {}; + for (DataSnapshot _data : _dataSnapshot.getChildren()) { + HashMap _map = _data.getValue(_ind); + others.add(_map); + } + } + catch (Exception _e) { + _e.printStackTrace(); + } + Developer.addChildEventListener(_Developer_child_listener); + } + @Override + public void onCancelled(DatabaseError _databaseError) { + } + }); + Version.addListenerForSingleValueEvent(new ValueEventListener() { + @Override + public void onDataChange(DataSnapshot _dataSnapshot) { + others = new ArrayList<>(); + try { + GenericTypeIndicator> _ind = new GenericTypeIndicator>() {}; + for (DataSnapshot _data : _dataSnapshot.getChildren()) { + HashMap _map = _data.getValue(_ind); + others.add(_map); + } + } + catch (Exception _e) { + _e.printStackTrace(); + } + Version.addChildEventListener(_Version_child_listener); + } + @Override + public void onCancelled(DatabaseError _databaseError) { + } + }); + main_body_intro.setVisibility(View.GONE); + main_scroll_upload.setVisibility(View.GONE); + main_scroll_about.setVisibility(View.GONE); + box_update.setVisibility(View.VISIBLE); + + Connection.startRequestNetwork(RequestNetworkController.GET, "https://spotify.com", "PAWN!", _Connection_request_listener); + } + catch(Exception e) { + } + } + + if (DEVELOPER_MODE.getString("DEVELOPER", "").equals("OFF")) { + main_body_intro.setVisibility(View.GONE); + main_scroll_about.setVisibility(View.GONE); + main_scroll_upload.setVisibility(View.GONE); + main_refresh_layout.setVisibility(View.VISIBLE); + box_uploader.setEnabled(true); + box_update.setEnabled(true); + } + else { + if (DEVELOPER_MODE.getString("DEVELOPER", "").equals("ON")) { + main_body_intro.setVisibility(View.GONE); + main_scroll_about.setVisibility(View.GONE); + main_scroll_upload.setVisibility(View.VISIBLE); + main_refresh_layout.setVisibility(View.GONE); + box_uploader.setEnabled(false); + box_update.setEnabled(false); + } + } + regular_submit.setTextColor(0xFF9E9E9E); + regular_delete.setTextColor(0xFF9E9E9E); + amoled_submit.setTextColor(0xFF9E9E9E); + amoled_delete.setTextColor(0xFF9E9E9E); + edit_logs_1.setTextColor(0xFF9E9E9E); + logs_save.setTextColor(0xFF9E9E9E); + box_regular_4.setEnabled(false); + box_regular_5.setEnabled(false); + box_amoled_4.setEnabled(false); + box_amoled_5.setEnabled(false); + edit_logs_1.setEnabled(false); + logs_save.setEnabled(false); + + Timer = new TimerTask() { + @Override + public void run() { + runOnUiThread(new Runnable() { + @Override + public void run() { + box_uploader.setVisibility(View.GONE); + } + }); + } + }; + _timer.schedule(Timer, (int)(1500)); + CHECK = 0; + _Update_Remover(); + _Updater_Check(); + _Theme_UI(); + _Effects(); + } + + + private void _Theme_UI () { + if (THEME.getString("THEME", "").equals("0")) { + + green_switch.setChecked(false); + purple_switch.setChecked(false); + red_switch.setChecked(false); + blue_switch.setChecked(false); + orange_switch.setChecked(false); + yellow_switch.setChecked(false); + gray_switch.setChecked(false); + } + else { + if (THEME.getString("THEME", "").equals("1")) { + + green_switch.setChecked(true); + purple_switch.setChecked(false); + red_switch.setChecked(false); + blue_switch.setChecked(false); + orange_switch.setChecked(false); + yellow_switch.setChecked(false); + gray_switch.setChecked(false); + } + else { + if (THEME.getString("THEME", "").equals("2")) { + + green_switch.setChecked(false); + purple_switch.setChecked(true); + red_switch.setChecked(false); + blue_switch.setChecked(false); + orange_switch.setChecked(false); + yellow_switch.setChecked(false); + gray_switch.setChecked(false); + } + else { + if (THEME.getString("THEME", "").equals("3")) { + + green_switch.setChecked(false); + purple_switch.setChecked(false); + red_switch.setChecked(true); + blue_switch.setChecked(false); + orange_switch.setChecked(false); + yellow_switch.setChecked(false); + gray_switch.setChecked(false); + } + else { + if (THEME.getString("THEME", "").equals("4")) { + + green_switch.setChecked(false); + purple_switch.setChecked(false); + red_switch.setChecked(false); + blue_switch.setChecked(true); + orange_switch.setChecked(false); + yellow_switch.setChecked(false); + gray_switch.setChecked(false); + } + else { + if (THEME.getString("THEME", "").equals("5")) { + + green_switch.setChecked(false); + purple_switch.setChecked(false); + red_switch.setChecked(false); + blue_switch.setChecked(false); + orange_switch.setChecked(true); + yellow_switch.setChecked(false); + gray_switch.setChecked(false); + } + else { + if (THEME.getString("THEME", "").equals("6")) { + + green_switch.setChecked(false); + purple_switch.setChecked(false); + red_switch.setChecked(false); + blue_switch.setChecked(false); + orange_switch.setChecked(false); + yellow_switch.setChecked(true); + gray_switch.setChecked(false); + } + else { + if (THEME.getString("THEME", "").equals("7")) { + + green_switch.setChecked(false); + purple_switch.setChecked(false); + red_switch.setChecked(false); + blue_switch.setChecked(false); + orange_switch.setChecked(false); + yellow_switch.setChecked(false); + gray_switch.setChecked(true); + } + } + } + } + } + } + } + } + } + + + private void _Updater () { + try { + Version.addListenerForSingleValueEvent(new ValueEventListener() { + @Override + public void onDataChange(DataSnapshot _dataSnapshot) { + Versions_1 = new ArrayList<>(); + try { + GenericTypeIndicator> _ind = new GenericTypeIndicator>() {}; + for (DataSnapshot _data : _dataSnapshot.getChildren()) { + HashMap _map = _data.getValue(_ind); + Versions_1.add(_map); + } + } + catch (Exception _e) { + _e.printStackTrace(); + } + Latest_Version = Versions_1.get((int)0).get("V").toString(); + if (Double.parseDouble(Latest_Version) > Double.parseDouble(Current_Version)) { + if (SketchwareUtil.getRandom((int)(0), (int)(2)) == 1) { + _RequiredDialog(Update_Authorized, false); + Update_Authorized.setTitle("NEW MANAGER UPDATE"); + Update_Authorized.setPositiveButton("DOWNLOAD UPDATE", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface _dialog, int _which) { + _RequiredDialog(Update_Authorized, true); + _Download_Update(hidden_download.getText().toString(), "/storage/emulated/0/Android/data/com.xc3fff0e.xmanager/files/Download/Update/"); + _Update_Remover(); + } + }); + Update_Authorized.setNeutralButton("NOT NOW", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface _dialog, int _which) { + _RequiredDialog(Update_Authorized, true); + } + }); + Update_Authorized.create().show(); + } + } + else { + if (Double.parseDouble(Current_Version) > Double.parseDouble(Latest_Version)) { + _RequiredDialog(Update_Unauthorized, false); + Update_Unauthorized.setTitle("MAINTENANCE"); + Update_Unauthorized.setMessage("xManager is currently unavailable right now. Kindly check the application later."); + Update_Unauthorized.setPositiveButton("THANKS!", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface _dialog, int _which) { + _RequiredDialog(Update_Unauthorized, true); + finishAndRemoveTask(); + finishAffinity(); + } + }); + Update_Unauthorized.create().show(); + } + else { + Version.child("App").child("V").setValue(Current_Version); + } + } + } + @Override + public void onCancelled(DatabaseError _databaseError) { + } + }); + } + catch(Exception e) { + } + } + + + private void _Updater_Check () { + Package_Name = "com.xc3fff0e.xmanager"; + try { + android.content.pm.PackageInfo pinfo = getPackageManager().getPackageInfo( Package_Name, android.content.pm.PackageManager.GET_ACTIVITIES); + Current_Version = pinfo.versionName; } + catch (Exception e){ showMessage(e.toString()); } + DatabaseReference rootRef = _firebase.getReference(); rootRef.child("version").addListenerForSingleValueEvent(new ValueEventListener() { + @Override + public void onDataChange(DataSnapshot snapshot) { + if (snapshot.exists()) { } else { + Versions = new HashMap<>(); + Versions.put("V", Current_Version); + Versions.clear(); + Version.child("App").updateChildren(Versions); + } } + @Override + public void onCancelled(DatabaseError _error) { } }); + _Updater(); + } + + + private void _Download_Update (final String _url, final String _path) { + try { + FileUtil.makeDir(FileUtil.getPackageDataDir(getApplicationContext())); + + android.net.ConnectivityManager connMgr = (android.net.ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE); + android.net.NetworkInfo networkInfo = connMgr.getActiveNetworkInfo(); + if (networkInfo != null && networkInfo.isConnected()) { + + + final String urlDownload = _url; + + DownloadManager.Request request = new DownloadManager.Request(Uri.parse(urlDownload)); + + final String fileName = URLUtil.guessFileName(urlDownload, null, null); + + request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_ONLY_COMPLETION); + + request.setMimeType("application/vnd.android.package-archive"); + + request.allowScanningByMediaScanner(); + + request.setDestinationInExternalFilesDir(this,Environment.DIRECTORY_DOWNLOADS, "/Update/xManager Update.apk"); + + final DownloadManager manager = (DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE); + + final long downloadId = manager.enqueue(request); + + final ProgressDialog prog = new ProgressDialog(this, ProgressDialog.THEME_DEVICE_DEFAULT_DARK); + prog.setMax(100); + prog.setIndeterminate(false); + prog.setCancelable(false); + prog.setCanceledOnTouchOutside(false); + prog.setTitle("DOWNLOADING FILE..."); + new Thread(new Runnable() { + + @Override + public void run() { + + boolean downloading = true; + + while (downloading) { + + DownloadManager.Query q = new DownloadManager.Query(); + + q.setFilterById(downloadId); + + android.database.Cursor cursor = manager.query(q); + + if (cursor != null) { + if (cursor.moveToFirst()) { + + int bytes_downloaded = cursor.getInt(cursor .getColumnIndex(DownloadManager.COLUMN_BYTES_DOWNLOADED_SO_FAR)); + + int bytes_total = cursor.getInt(cursor.getColumnIndex(DownloadManager.COLUMN_TOTAL_SIZE_BYTES)); + + if (cursor.getInt(cursor.getColumnIndex(DownloadManager.COLUMN_STATUS)) == DownloadManager.STATUS_SUCCESSFUL) { + + downloading = false; + + } + + if (cursor.getInt(cursor.getColumnIndex(DownloadManager.COLUMN_STATUS)) == DownloadManager.STATUS_FAILED) { + + runOnUiThread(new Runnable() { + public void run() { + + showMessage("The file or link is currently unavailable. Please try again later."); + } + }); + prog.cancel(); + break; + + } + + final int dl_progress = (int) ((bytes_downloaded * 100l) / bytes_total); + + runOnUiThread(new Runnable() { + @Override + public void run() { + + prog.setTitle("DOWNLOADING FILE..."); + prog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); + prog.setProgress(dl_progress); + prog.setMax(100); + prog.show(); + + if (dl_progress == prog.getMax()) { + + Timer = new TimerTask() { + @Override + public void run() { + runOnUiThread(new Runnable() { + @Override + public void run() { + + FileUtil.copyFile("/storage/emulated/0/Android/data/com.xc3fff0e.xmanager/files/Download/xManager Update.apk", "/storage/emulated/0/xManager/Update/xManager Update.apk"); + prog.dismiss(); + + _RequiredDialog(Success_Download, false); + Success_Download.setTitle("SUCCESSFULLY DOWNLOADED"); + Success_Download.setMessage("FILE DIRECTORY:\n"); + Success_Download.setPositiveButton("INSTALL UPDATE", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface _dialog, int _which) { + _RequiredDialog(Success_Download, true); + StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder(); StrictMode.setVmPolicy(builder.build()); + + if(android.os.Build.VERSION.SDK_INT >= 29){ + + Intent intent = new Intent(Intent.ACTION_VIEW); + + intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); + + intent.setDataAndType(FileProvider.getUriForFile(MainActivity.this, "com.xc3fff0e.xmanager.provider", new File("/storage/emulated/0/Android/data/com.xc3fff0e.xmanager/files/Download/Update/xManager Update.apk")), "application/vnd.android.package-archive"); + + startActivity(intent); + + } else { + + Intent intent = new Intent(Intent.ACTION_VIEW); + intent.setDataAndType(Uri.fromFile(new File("/storage/emulated/0/Android/data/com.xc3fff0e.xmanager/files/Download/Update/xManager Update.apk")), "application/vnd.android.package-archive"); + + startActivity(intent); + Timer = new TimerTask() { + @Override + public void run() { + runOnUiThread(new Runnable() { + @Override + public void run() { + _Hide_Navigation(); + } + }); + } + }; + _timer.schedule(Timer, (int)(100)); + } + } + }); + Success_Download.setNeutralButton("LATER", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface _dialog, int _which) { + _RequiredDialog(Success_Download, true); + Timer = new TimerTask() { + @Override + public void run() { + runOnUiThread(new Runnable() { + @Override + public void run() { + _Hide_Navigation(); + } + }); + } + }; + _timer.schedule(Timer, (int)(100)); + } + }); + Success_Download.create().show(); + showMessage("Download Complete"); + } + }); + } + }; + _timer.schedule(Timer, (int)(1500)); + } + } }); + } + cursor.close(); + } + } } }).start(); + + } else { + showMessage("No Internet Connection"); + } + } + catch(Exception e) { + } + } + + + private void _Locked () { + if (!(Regular_Title.equals("") || Regular_Link.equals(""))) { + Lock_Check = true; + } + else { + Lock_Check = false; + } + if (Lock_Check) { + box_regular_4.setEnabled(true); + regular_submit.setTextColor(0xFFFFFFFF); + } + else { + box_regular_4.setEnabled(false); + regular_submit.setTextColor(0xFF9E9E9E); + } + if (!Regular_Title.equals("")) { + Lock_Check = true; + } + else { + Lock_Check = false; + } + if (Lock_Check) { + box_regular_5.setEnabled(true); + regular_delete.setTextColor(0xFFFFFFFF); + } + else { + box_regular_5.setEnabled(false); + regular_delete.setTextColor(0xFF9E9E9E); + } + if (!(Amoled_Title.equals("") || Amoled_Link.equals(""))) { + Lock_Check = true; + } + else { + Lock_Check = false; + } + if (Lock_Check) { + box_amoled_4.setEnabled(true); + amoled_submit.setTextColor(0xFFFFFFFF); + } + else { + box_amoled_4.setEnabled(false); + amoled_submit.setTextColor(0xFF9E9E9E); + } + if (!Amoled_Title.equals("")) { + Lock_Check = true; + } + else { + Lock_Check = false; + } + if (Lock_Check) { + box_amoled_5.setEnabled(true); + amoled_delete.setTextColor(0xFFFFFFFF); + } + else { + box_amoled_5.setEnabled(false); + amoled_delete.setTextColor(0xFF9E9E9E); + } + } + + + private void _Effects () { + _Ripple(box_uploader, "#9E9E9E"); + _Ripple(box_update, "#9E9E9E"); + } + + + private void _Ripple (final View _view, final String _c) { + _view.setBackground(Drawables.getSelectableDrawableFor(Color.parseColor(_c))); + _view.setClickable(true); + + } + + public static class Drawables { + public static android.graphics.drawable.Drawable getSelectableDrawableFor(int color) { + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { + android.graphics.drawable.StateListDrawable stateListDrawable = new android.graphics.drawable.StateListDrawable(); + stateListDrawable.addState( + new int[]{android.R.attr.state_pressed}, + new android.graphics.drawable.ColorDrawable(Color.parseColor("#ffffff")) + ); + stateListDrawable.addState( + new int[]{android.R.attr.state_focused}, + new android.graphics.drawable.ColorDrawable(Color.parseColor("#00ffffff")) + ); + stateListDrawable.addState( + new int[]{}, + new android.graphics.drawable.ColorDrawable(Color.parseColor("#00ffffff")) + ); + return stateListDrawable; + } else { + android.content.res.ColorStateList pressedColor = android.content.res.ColorStateList.valueOf(color); + android.graphics.drawable.ColorDrawable defaultColor = new android.graphics.drawable.ColorDrawable(Color.parseColor("#00ffffff")); + + android.graphics.drawable.Drawable rippleColor = getRippleColor(color); + return new android.graphics.drawable.RippleDrawable( + pressedColor, + defaultColor, + rippleColor + ); + } + } + + private static android.graphics.drawable.Drawable getRippleColor(int color) { + float[] outerRadii = new float[8]; + Arrays.fill(outerRadii, 0); + android.graphics.drawable.shapes.RoundRectShape r = new android.graphics.drawable.shapes.RoundRectShape(outerRadii, null, null); + + android.graphics.drawable.ShapeDrawable shapeDrawable = new + android.graphics.drawable.ShapeDrawable(r); + shapeDrawable.getPaint().setColor(color); + return shapeDrawable; + } + + private static int lightenOrDarken(int color, double fraction) { + if (canLighten(color, fraction)) { + return lighten(color, fraction); + } else { + return darken(color, fraction); + } + } + + private static int lighten(int color, double fraction) { + int red = Color.red(color); + int green = Color.green(color); + int blue = Color.blue(color); + red = lightenColor(red, fraction); + green = lightenColor(green, fraction); + blue = lightenColor(blue, fraction); + int alpha = Color.alpha(color); + return Color.argb(alpha, red, green, blue); + } + + private static int darken(int color, double fraction) { + int red = Color.red(color); + int green = Color.green(color); + int blue = Color.blue(color); + red = darkenColor(red, fraction); + green = darkenColor(green, fraction); + blue = darkenColor(blue, fraction); + int alpha = Color.alpha(color); + + return Color.argb(alpha, red, green, blue); + } + + private static boolean canLighten(int color, double fraction) { + int red = Color.red(color); + int green = Color.green(color); + int blue = Color.blue(color); + return canLightenComponent(red, fraction) + && canLightenComponent(green, fraction) + && canLightenComponent(blue, fraction); + } + + private static boolean canLightenComponent(int colorComponent, double fraction) { + int red = Color.red(colorComponent); + int green = Color.green(colorComponent); + int blue = Color.blue(colorComponent); + return red + (red * fraction) < 255 + && green + (green * fraction) < 255 + && blue + (blue * fraction) < 255; + } + + private static int darkenColor(int color, double fraction) { + return (int) Math.max(color - (color * fraction), 0); + } + + private static int lightenColor(int color, double fraction) { + return (int) Math.min(color + (color * fraction), 255); + } + } + public static class CircleDrawables { + public static android.graphics.drawable.Drawable getSelectableDrawableFor(int color) { + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { + android.graphics.drawable.StateListDrawable stateListDrawable = new android.graphics.drawable.StateListDrawable(); + stateListDrawable.addState( + new int[]{android.R.attr.state_pressed}, + new android.graphics.drawable.ColorDrawable(Color.parseColor("#ffffff")) + ); + stateListDrawable.addState( + new int[]{android.R.attr.state_focused}, + new android.graphics.drawable.ColorDrawable(Color.parseColor("#00ffffff")) + ); + stateListDrawable.addState( + new int[]{}, + new android.graphics.drawable.ColorDrawable(Color.parseColor("#00ffffff")) + ); + return stateListDrawable; + } else { + android.content.res.ColorStateList pressedColor = android.content.res.ColorStateList.valueOf(color); + android.graphics.drawable.ColorDrawable defaultColor = new android.graphics.drawable.ColorDrawable(Color.parseColor("#00ffffff")); + + android.graphics.drawable.Drawable rippleColor = getRippleColor(color); + return new android.graphics.drawable.RippleDrawable( + pressedColor, + defaultColor, + rippleColor + ); + } + } + + private static android.graphics.drawable.Drawable getRippleColor(int color) { + float[] outerRadii = new float[180]; + Arrays.fill(outerRadii, 80); + android.graphics.drawable.shapes.RoundRectShape r = new android.graphics.drawable.shapes.RoundRectShape(outerRadii, null, null); + + android.graphics.drawable.ShapeDrawable shapeDrawable = new + android.graphics.drawable.ShapeDrawable(r); + shapeDrawable.getPaint().setColor(color); + return shapeDrawable; + } + + private static int lightenOrDarken(int color, double fraction) { + if (canLighten(color, fraction)) { + return lighten(color, fraction); + } else { + return darken(color, fraction); + } + } + + private static int lighten(int color, double fraction) { + int red = Color.red(color); + int green = Color.green(color); + int blue = Color.blue(color); + red = lightenColor(red, fraction); + green = lightenColor(green, fraction); + blue = lightenColor(blue, fraction); + int alpha = Color.alpha(color); + return Color.argb(alpha, red, green, blue); + } + + private static int darken(int color, double fraction) { + int red = Color.red(color); + int green = Color.green(color); + int blue = Color.blue(color); + red = darkenColor(red, fraction); + green = darkenColor(green, fraction); + blue = darkenColor(blue, fraction); + int alpha = Color.alpha(color); + + return Color.argb(alpha, red, green, blue); + } + + private static boolean canLighten(int color, double fraction) { + int red = Color.red(color); + int green = Color.green(color); + int blue = Color.blue(color); + return canLightenComponent(red, fraction) + && canLightenComponent(green, fraction) + && canLightenComponent(blue, fraction); + } + + private static boolean canLightenComponent(int colorComponent, double fraction) { + int red = Color.red(colorComponent); + int green = Color.green(colorComponent); + int blue = Color.blue(colorComponent); + return red + (red * fraction) < 255 + && green + (green * fraction) < 255 + && blue + (blue * fraction) < 255; + } + + private static int darkenColor(int color, double fraction) { + return (int) Math.max(color - (color * fraction), 0); + } + + private static int lightenColor(int color, double fraction) { + return (int) Math.min(color + (color * fraction), 255); + } + } + + public void drawableclass() { + + + } + + + private void _Hide_Navigation () { + try { + getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY); + + if (Build.VERSION.SDK_INT >= 21) { Window w = this.getWindow(); w.setNavigationBarColor(Color.parseColor("#212121")); + } + } + catch(Exception e) { + } + } + + + public class List_menu_1Adapter extends BaseAdapter { + ArrayList> _data; + public List_menu_1Adapter(ArrayList> _arr) { + _data = _arr; + } + + @Override + public int getCount() { + return _data.size(); + } + + @Override + public HashMap getItem(int _index) { + return _data.get(_index); + } + + @Override + public long getItemId(int _index) { + return _index; + } + @Override + public View getView(final int _position, View _view, ViewGroup _viewGroup) { + LayoutInflater _inflater = (LayoutInflater)getBaseContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); + View _v = _view; + if (_v == null) { + _v = _inflater.inflate(R.layout.list_menu_1, null); + } + + final LinearLayout box = (LinearLayout) _v.findViewById(R.id.box); + final TextView link = (TextView) _v.findViewById(R.id.link); + final ImageView icon = (ImageView) _v.findViewById(R.id.icon); + final TextView title = (TextView) _v.findViewById(R.id.title); + + try { + title.setVisibility(View.VISIBLE); + link.setVisibility(View.GONE); + title.setText(listdata.get((int)(listdata.size() - 1) - _position).get("title").toString().replace("-", ".")); + link.setText(listdata.get((int)(listdata.size() - 1) - _position).get("link").toString()); + title.setText(title.getText().toString().replace("(Armeabi.v7a)", "(Armeabi-v7a)")); + title.setText(title.getText().toString().replace("(Arm64.v8a)", "(Arm64-v8a)")); + title.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 1); + if ((_position == 0) && title.getText().toString().contains("(Armeabi-v7a)")) { + SUB_A = title.getText().toString().replace("Spotify v", " "); + SUB_B = SUB_A.replace("(Armeabi-v7a)", " "); + } + else { + if ((_position == 0) && title.getText().toString().contains("(Arm64-v8a)")) { + SUB_A = title.getText().toString().replace("Spotify v", " "); + SUB_B = SUB_A.replace("(Arm64-v8a)", " "); + } + } + SUB_1.edit().putString("SUB_1", SUB_B).commit(); + box.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View _view) { + _RequiredDialog(Selected_Spotify, false); + Selected_Spotify.setTitle(title.getText().toString()); + Selected_Spotify.setMessage("You selected this modified version. Do you want to continue?"); + Selected_Spotify.setPositiveButton("CONTINUE", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface _dialog, int _which) { + _RequiredDialog(Selected_Spotify, true); + _RequiredDialog(Download_Spotify, false); + Download_Spotify.setTitle("DOWNLOAD READY"); + Download_Spotify.setMessage("Downloading this modified apk will overwrite the previous file located at the application's external file directory."); + Download_Spotify.setPositiveButton("DOWNLOAD", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface _dialog, int _which) { + _RequiredDialog(Download_Spotify, true); + _Download(link.getText().toString(), "/storage/emulated/0/Android/data/com.xc3fff0e.xmanager/files/Download/"); + _File_Remover(); + } + }); + Download_Spotify.setNeutralButton("CANCEL", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface _dialog, int _which) { + _RequiredDialog(Download_Spotify, true); + Timer = new TimerTask() { + @Override + public void run() { + runOnUiThread(new Runnable() { + @Override + public void run() { + _Hide_Navigation(); + } + }); + } + }; + _timer.schedule(Timer, (int)(100)); + } + }); + Download_Spotify.create().show(); + } + }); + Selected_Spotify.setNeutralButton("CANCEL", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface _dialog, int _which) { + _RequiredDialog(Selected_Spotify, true); + Timer = new TimerTask() { + @Override + public void run() { + runOnUiThread(new Runnable() { + @Override + public void run() { + _Hide_Navigation(); + } + }); + } + }; + _timer.schedule(Timer, (int)(100)); + } + }); + Selected_Spotify.create().show(); + FileUtil.makeDir("/storage/emulated/0/xManager"); + FileUtil.makeDir("/storage/emulated/0/xManager/Update"); + } + }); + } + catch(Exception e) { + } + + return _v; + } + } + + public class List_menu_2Adapter extends BaseAdapter { + ArrayList> _data; + public List_menu_2Adapter(ArrayList> _arr) { + _data = _arr; + } + + @Override + public int getCount() { + return _data.size(); + } + + @Override + public HashMap getItem(int _index) { + return _data.get(_index); + } + + @Override + public long getItemId(int _index) { + return _index; + } + @Override + public View getView(final int _position, View _view, ViewGroup _viewGroup) { + LayoutInflater _inflater = (LayoutInflater)getBaseContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); + View _v = _view; + if (_v == null) { + _v = _inflater.inflate(R.layout.list_menu_2, null); + } + + final LinearLayout box = (LinearLayout) _v.findViewById(R.id.box); + final TextView link = (TextView) _v.findViewById(R.id.link); + final ImageView icon = (ImageView) _v.findViewById(R.id.icon); + final TextView title = (TextView) _v.findViewById(R.id.title); + + try { + title.setVisibility(View.VISIBLE); + link.setVisibility(View.GONE); + title.setText(listdata.get((int)(listdata.size() - 1) - _position).get("title").toString().replace("-", ".")); + link.setText(listdata.get((int)(listdata.size() - 1) - _position).get("link").toString()); + title.setText(title.getText().toString().replace("(Armeabi.v7a)", "(Armeabi-v7a)")); + title.setText(title.getText().toString().replace("(Arm64.v8a)", "(Arm64-v8a)")); + title.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 1); + if ((_position == 0) && title.getText().toString().contains("(Armeabi-v7a)")) { + SUB_X = title.getText().toString().replace("Spotify v", " "); + SUB_Y = SUB_X.replace("(Armeabi-v7a)", " "); + } + else { + if ((_position == 0) && title.getText().toString().contains("(Arm64-v8a)")) { + SUB_X = title.getText().toString().replace("Spotify v", " "); + SUB_Y = SUB_X.replace("(Arm64-v8a)", " "); + } + } + SUB_2.edit().putString("SUB_2", SUB_Y).commit(); + box.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View _view) { + _RequiredDialog(Selected_Spotify, false); + Selected_Spotify.setTitle(title.getText().toString()); + Selected_Spotify.setMessage("You selected this modified version. Do you want to continue?"); + Selected_Spotify.setPositiveButton("CONTINUE", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface _dialog, int _which) { + _RequiredDialog(Selected_Spotify, true); + _RequiredDialog(Download_Spotify, false); + Download_Spotify.setTitle("DOWNLOAD READY"); + Download_Spotify.setMessage("Downloading this modified apk will overwrite the previous file located at the application's external file directory."); + Download_Spotify.setPositiveButton("DOWNLOAD", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface _dialog, int _which) { + _RequiredDialog(Download_Spotify, true); + _Download(link.getText().toString(), "/storage/emulated/0/Android/data/com.xc3fff0e.xmanager/files/Download/"); + _File_Remover(); + } + }); + Download_Spotify.setNeutralButton("CANCEL", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface _dialog, int _which) { + _RequiredDialog(Download_Spotify, true); + Timer = new TimerTask() { + @Override + public void run() { + runOnUiThread(new Runnable() { + @Override + public void run() { + _Hide_Navigation(); + } + }); + } + }; + _timer.schedule(Timer, (int)(100)); + } + }); + Download_Spotify.create().show(); + } + }); + Selected_Spotify.setNeutralButton("CANCEL", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface _dialog, int _which) { + _RequiredDialog(Selected_Spotify, true); + Timer = new TimerTask() { + @Override + public void run() { + runOnUiThread(new Runnable() { + @Override + public void run() { + _Hide_Navigation(); + } + }); + } + }; + _timer.schedule(Timer, (int)(100)); + } + }); + Selected_Spotify.create().show(); + FileUtil.makeDir("/storage/emulated/0/xManager"); + FileUtil.makeDir("/storage/emulated/0/xManager/Update"); + } + }); + } + catch(Exception e) { + } + + return _v; + } + } + + @Deprecated + public void showMessage(String _s) { + Toast.makeText(getApplicationContext(), _s, Toast.LENGTH_SHORT).show(); + } + + @Deprecated + public int getLocationX(View _v) { + int _location[] = new int[2]; + _v.getLocationInWindow(_location); + return _location[0]; + } + + @Deprecated + public int getLocationY(View _v) { + int _location[] = new int[2]; + _v.getLocationInWindow(_location); + return _location[1]; + } + + @Deprecated + public int getRandom(int _min, int _max) { + Random random = new Random(); + return random.nextInt(_max - _min + 1) + _min; + } + + @Deprecated + public ArrayList getCheckedItemPositionsToArray(ListView _list) { + ArrayList _result = new ArrayList(); + SparseBooleanArray _arr = _list.getCheckedItemPositions(); + for (int _iIdx = 0; _iIdx < _arr.size(); _iIdx++) { + if (_arr.valueAt(_iIdx)) + _result.add((double)_arr.keyAt(_iIdx)); + } + return _result; + } + + @Deprecated + public float getDip(int _input){ + return TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, _input, getResources().getDisplayMetrics()); + } + + @Deprecated + public int getDisplayWidthPixels(){ + return getResources().getDisplayMetrics().widthPixels; + } + + @Deprecated + public int getDisplayHeightPixels(){ + return getResources().getDisplayMetrics().heightPixels; + } + +} diff --git a/RequestNetwork.java b/RequestNetwork.java new file mode 100644 index 0000000..fb148c5 --- /dev/null +++ b/RequestNetwork.java @@ -0,0 +1,52 @@ +package com.xc3fff0e.xmanager; + +import android.app.Activity; + +import java.util.HashMap; + +public class RequestNetwork { +private HashMap params = new HashMap<>(); +private HashMap headers = new HashMap<>(); + +private Activity activity; + +private int requestType = 0; + +public RequestNetwork(Activity activity) { +this.activity = activity; +} + +public void setHeaders(HashMap headers) { +this.headers = headers; +} + +public void setParams(HashMap params, int requestType) { +this.params = params; +this.requestType = requestType; +} + +public HashMap getParams() { +return params; +} + +public HashMap getHeaders() { +return headers; +} + +public Activity getActivity() { +return activity; +} + +public int getRequestType() { +return requestType; +} + +public void startRequestNetwork(String method, String url, String tag, RequestListener requestListener) { +RequestNetworkController.getInstance().execute(this, method, url, tag, requestListener); +} + +public interface RequestListener { +public void onResponse(String tag, String response); +public void onErrorResponse(String tag, String message); +} +} diff --git a/RequestNetworkController.java b/RequestNetworkController.java new file mode 100644 index 0000000..718d537 --- /dev/null +++ b/RequestNetworkController.java @@ -0,0 +1,180 @@ +package com.xc3fff0e.xmanager; + +import com.google.gson.Gson; + +import java.io.IOException; +import java.security.cert.CertificateException; +import java.util.HashMap; +import java.util.concurrent.TimeUnit; + +import javax.net.ssl.HostnameVerifier; +import javax.net.ssl.SSLContext; +import javax.net.ssl.SSLSession; +import javax.net.ssl.SSLSocketFactory; +import javax.net.ssl.TrustManager; +import javax.net.ssl.X509TrustManager; + +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.FormBody; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; + +public class RequestNetworkController { +public static final String GET = "GET"; +public static final String POST = "POST"; +public static final String PUT = "PUT"; +public static final String DELETE = "DELETE"; + +public static final int REQUEST_PARAM = 0; +public static final int REQUEST_BODY = 1; + +private static final int SOCKET_TIMEOUT = 15000; +private static final int READ_TIMEOUT = 25000; + +protected OkHttpClient client; + +private static RequestNetworkController mInstance; + +public static synchronized RequestNetworkController getInstance() { +if(mInstance == null) { +mInstance = new RequestNetworkController(); +} +return mInstance; +} + +private OkHttpClient getClient() { +if (client == null) { +OkHttpClient.Builder builder = new OkHttpClient.Builder(); + +try { +final TrustManager[] trustAllCerts = new TrustManager[]{ +new X509TrustManager() { +@Override +public void checkClientTrusted(java.security.cert.X509Certificate[] chain, String authType) +throws CertificateException { +} + +@Override +public void checkServerTrusted(java.security.cert.X509Certificate[] chain, String authType) +throws CertificateException { +} + +@Override +public java.security.cert.X509Certificate[] getAcceptedIssuers() { +return new java.security.cert.X509Certificate[]{}; +} +} +}; + +final SSLContext sslContext = SSLContext.getInstance("TLS"); +sslContext.init(null, trustAllCerts, new java.security.SecureRandom()); +final SSLSocketFactory sslSocketFactory = sslContext.getSocketFactory(); +builder.sslSocketFactory(sslSocketFactory, (X509TrustManager) trustAllCerts[0]); +builder.connectTimeout(SOCKET_TIMEOUT, TimeUnit.MILLISECONDS); +builder.readTimeout(READ_TIMEOUT, TimeUnit.MILLISECONDS); +builder.writeTimeout(READ_TIMEOUT, TimeUnit.MILLISECONDS); +builder.hostnameVerifier(new HostnameVerifier() { +@Override +public boolean verify(String hostname, SSLSession session) { +return true; +} +}); +} catch (Exception e) { +} + +client = builder.build(); +} + +return client; +} + +public void execute(final RequestNetwork requestNetwork, String method, String url, final String tag, final RequestNetwork.RequestListener requestListener) { +Request.Builder reqBuilder = new Request.Builder(); +Headers.Builder headerBuilder = new Headers.Builder(); + +if(requestNetwork.getHeaders().size() > 0) { +HashMap headers = requestNetwork.getHeaders(); + +for(HashMap.Entry header : headers.entrySet()) { +headerBuilder.add(header.getKey(), String.valueOf(header.getValue())); +} +} + +try { +if (requestNetwork.getRequestType() == REQUEST_PARAM) { +if (method.equals(GET)) { +HttpUrl.Builder httpBuilder; + +try { +httpBuilder = HttpUrl.parse(url).newBuilder(); +} catch (NullPointerException ne) { +throw new NullPointerException("unexpected url: " + url); +} + +if (requestNetwork.getParams().size() > 0) { +HashMap params = requestNetwork.getParams(); + +for (HashMap.Entry param : params.entrySet()) { +httpBuilder.addQueryParameter(param.getKey(), String.valueOf(param.getValue())); +} +} + +reqBuilder.url(httpBuilder.build()).headers(headerBuilder.build()).get(); +} else { +FormBody.Builder formBuilder = new FormBody.Builder(); +if (requestNetwork.getParams().size() > 0) { +HashMap params = requestNetwork.getParams(); + +for (HashMap.Entry param : params.entrySet()) { +formBuilder.add(param.getKey(), String.valueOf(param.getValue())); +} +} + +RequestBody reqBody = formBuilder.build(); + +reqBuilder.url(url).headers(headerBuilder.build()).method(method, reqBody); +} +} else { +RequestBody reqBody = RequestBody.create(okhttp3.MediaType.parse("application/json"), new Gson().toJson(requestNetwork.getParams())); + +if (method.equals(GET)) { +reqBuilder.url(url).headers(headerBuilder.build()).get(); +} else { +reqBuilder.url(url).headers(headerBuilder.build()).method(method, reqBody); +} +} + +Request req = reqBuilder.build(); + +getClient().newCall(req).enqueue(new Callback() { +@Override +public void onFailure(Call call, final IOException e) { +requestNetwork.getActivity().runOnUiThread(new Runnable() { +@Override +public void run() { +requestListener.onErrorResponse(tag, e.getMessage()); +} +}); +} + +@Override +public void onResponse(Call call, final Response response) throws IOException { +final String responseBody = response.body().string().trim(); +requestNetwork.getActivity().runOnUiThread(new Runnable() { +@Override +public void run() { +requestListener.onResponse(tag, responseBody); +} +}); +} +}); +} catch (Exception e) { +requestListener.onErrorResponse(tag, e.getMessage()); +} +} +} \ No newline at end of file diff --git a/SketchwareUtil.java b/SketchwareUtil.java new file mode 100644 index 0000000..1af20f7 --- /dev/null +++ b/SketchwareUtil.java @@ -0,0 +1,71 @@ +package com.xc3fff0e.xmanager; + +import android.content.Context; +import android.util.SparseBooleanArray; +import android.util.TypedValue; +import android.view.View; +import android.widget.ListView; +import android.widget.Toast; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.Map; +import java.util.Random; + +public class SketchwareUtil { +public static void showMessage(Context _context, String _s) { +Toast.makeText(_context, _s, Toast.LENGTH_SHORT).show(); +} + +public static int getLocationX(View _v) { +int _location[] = new int[2]; +_v.getLocationInWindow(_location); +return _location[0]; +} + +public static int getLocationY(View _v) { +int _location[] = new int[2]; +_v.getLocationInWindow(_location); +return _location[1]; +} + +public static int getRandom(int _min, int _max) { +Random random = new Random(); +return random.nextInt(_max - _min + 1) + _min; +} + +public static ArrayList getCheckedItemPositionsToArray(ListView _list) { +ArrayList _result = new ArrayList(); +SparseBooleanArray _arr = _list.getCheckedItemPositions(); +for (int _iIdx = 0; _iIdx < _arr.size(); _iIdx++) { +if (_arr.valueAt(_iIdx)) +_result.add((double) _arr.keyAt(_iIdx)); +} +return _result; +} + +public static float getDip(Context _context, int _input) { +return TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, _input, _context.getResources().getDisplayMetrics()); +} + +public static int getDisplayWidthPixels(Context _context) { +return _context.getResources().getDisplayMetrics().widthPixels; +} + +public static int getDisplayHeightPixels(Context _context) { +return _context.getResources().getDisplayMetrics().heightPixels; +} + +public static void getAllKeysFromMap(Map map, ArrayList output) { +if (output == null) return; +output.clear(); + +if (map == null || map.size() <= 0) return; + +Iterator itr = map.entrySet().iterator(); +while (itr.hasNext()) { +Map.Entry entry = (Map.Entry) itr.next(); +output.add(entry.getKey()); +} +} +} \ No newline at end of file diff --git a/SplashActivity.java b/SplashActivity.java new file mode 100644 index 0000000..9d8496f --- /dev/null +++ b/SplashActivity.java @@ -0,0 +1,151 @@ +package com.xc3fff0e.xmanager; + +import androidx.appcompat.app.AppCompatActivity; +import android.app.*; +import android.os.*; +import android.view.*; +import android.view.View.*; +import android.widget.*; +import android.content.*; +import android.graphics.*; +import android.media.*; +import android.net.*; +import android.text.*; +import android.util.*; +import android.webkit.*; +import android.animation.*; +import android.view.animation.*; +import java.util.*; +import java.text.*; +import android.widget.LinearLayout; +import android.widget.ImageView; +import java.util.Timer; +import java.util.TimerTask; +import android.content.Intent; +import android.net.Uri; + +public class SplashActivity extends AppCompatActivity { + + private Timer _timer = new Timer(); + + private LinearLayout main_body; + private ImageView icon_logo; + + private TimerTask Timer; + private Intent Switch_Activity = new Intent(); + @Override + protected void onCreate(Bundle _savedInstanceState) { + super.onCreate(_savedInstanceState); + setContentView(R.layout.splash); + com.google.firebase.FirebaseApp.initializeApp(this); + initialize(_savedInstanceState); + initializeLogic(); + } + + private void initialize(Bundle _savedInstanceState) { + + main_body = (LinearLayout) findViewById(R.id.main_body); + icon_logo = (ImageView) findViewById(R.id.icon_logo); + } + private void initializeLogic() { + Timer = new TimerTask() { + @Override + public void run() { + runOnUiThread(new Runnable() { + @Override + public void run() { + Switch_Activity.setClass(getApplicationContext(), MainActivity.class); + startActivity(Switch_Activity); + finish(); + } + }); + } + }; + _timer.schedule(Timer, (int)(1000)); + } + + @Override + protected void onActivityResult(int _requestCode, int _resultCode, Intent _data) { + super.onActivityResult(_requestCode, _resultCode, _data); + + switch (_requestCode) { + + default: + break; + } + } + + @Override + public void onBackPressed() { + SketchwareUtil.showMessage(getApplicationContext(), "Please wait..."); + } + + @Override + public void onResume() { + super.onResume(); + _Hide_Navigation(); + } + private void _Hide_Navigation () { + try { + getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY); + + if (Build.VERSION.SDK_INT >= 21) { Window w = this.getWindow(); w.setNavigationBarColor(Color.parseColor("#212121")); + } + } + catch(Exception e) { + } + } + + + @Deprecated + public void showMessage(String _s) { + Toast.makeText(getApplicationContext(), _s, Toast.LENGTH_SHORT).show(); + } + + @Deprecated + public int getLocationX(View _v) { + int _location[] = new int[2]; + _v.getLocationInWindow(_location); + return _location[0]; + } + + @Deprecated + public int getLocationY(View _v) { + int _location[] = new int[2]; + _v.getLocationInWindow(_location); + return _location[1]; + } + + @Deprecated + public int getRandom(int _min, int _max) { + Random random = new Random(); + return random.nextInt(_max - _min + 1) + _min; + } + + @Deprecated + public ArrayList getCheckedItemPositionsToArray(ListView _list) { + ArrayList _result = new ArrayList(); + SparseBooleanArray _arr = _list.getCheckedItemPositions(); + for (int _iIdx = 0; _iIdx < _arr.size(); _iIdx++) { + if (_arr.valueAt(_iIdx)) + _result.add((double)_arr.keyAt(_iIdx)); + } + return _result; + } + + @Deprecated + public float getDip(int _input){ + return TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, _input, getResources().getDisplayMetrics()); + } + + @Deprecated + public int getDisplayWidthPixels(){ + return getResources().getDisplayMetrics().widthPixels; + } + + @Deprecated + public int getDisplayHeightPixels(){ + return getResources().getDisplayMetrics().heightPixels; + } + +}