diff --git a/.github/workflows/build-debug-apk.yml b/.github/workflows/build-debug-apk.yml
index f3eaf94..50ec396 100644
--- a/.github/workflows/build-debug-apk.yml
+++ b/.github/workflows/build-debug-apk.yml
@@ -3,8 +3,8 @@ name: Latest Build(debug)
on:
push:
branches:
- - master
-
+ - main
+ - dev
jobs:
build:
name: Build debug apk
@@ -26,7 +26,7 @@ jobs:
uses: gradle/wrapper-validation-action@v1.0.4
- name: Build with gradle
- uses: gradle/gradle-build-action@v2.1.5
+ uses: gradle/gradle-build-action@v2.4.2
with:
arguments: assembleDebug
diff --git a/.github/workflows/build-release-apk.yml b/.github/workflows/build-release-apk.yml
index 4c52a99..62b9ad9 100644
--- a/.github/workflows/build-release-apk.yml
+++ b/.github/workflows/build-release-apk.yml
@@ -2,8 +2,6 @@ name: Latest build(release)
on:
workflow_dispatch:
- branches:
- - master
jobs:
build:
@@ -26,7 +24,7 @@ jobs:
uses: gradle/wrapper-validation-action@v1.0.4
- name: Build with gradle
- uses: gradle/gradle-build-action@v2.1.5
+ uses: gradle/gradle-build-action@v2.4.2
with:
arguments: assembleRelease
diff --git a/README.md b/README.md
index c2d9f4c..dd15b75 100644
--- a/README.md
+++ b/README.md
@@ -1,18 +1,20 @@
-

+
-
- Current Activity
+
+ Current Activity
+
An useful tool for Android Developers & Reversers, which shows the package name and class name of current activity which you are in
-
+
+
-[](https://github.com/RatulHasan8/Current-Activity/releases/tag/app-n-source)
+[](https://github.com/RatulHasan8/Current-Activity/releases/tag/app-n-source)
[](https://github.com/RatulHasan8/Current-Activity/releases/tag/app-n-source)
-[](https://github.com/RatulHasan8/Current-Activity/blob/main/LICENSE)
-[](https://github.com/RatulHasan8/Current-Activity/graphs/commit-activity)
-[](https://github.com/RatulHasan8/Current-Activity/pulls)
-[](https://github.com/ratulhasanrahat/Current-Activity/graphs/contributors)
+[](./LICENSE)
+[](https://github.com/ratsan/Current-Activity/graphs/commit-activity)
+[](https://github.com/ratsan/Current-Activity/pulls)
+[](https://github.com/ratsan/Current-Activity/graphs/contributors)
diff --git a/app/build.gradle b/app/build.gradle
index 69f1615..6afec5a 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -1,13 +1,13 @@
apply plugin: 'com.android.application'
android {
- compileSdkVersion 31
+ compileSdkVersion 32
defaultConfig {
applicationId "io.github.ratul.topactivity"
- minSdkVersion 21
- targetSdkVersion 30
- versionCode 16
- versionName "1.5.6"
+ minSdkVersion 24
+ targetSdkVersion 33
+ versionCode 18
+ versionName "1.5.8"
}
buildTypes {
@@ -28,7 +28,7 @@ android {
dependencies {
implementation 'androidx.appcompat:appcompat:1.4.1'
- implementation 'com.google.android.material:material:1.6.0'
+ implementation 'com.google.android.material:material:1.6.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
implementation 'androidx.preference:preference:1.2.0'
implementation 'androidx.core:core:1.7.0'
diff --git a/app/build/bin/injected/AndroidManifest.xml b/app/build/bin/injected/AndroidManifest.xml
new file mode 100644
index 0000000..c0ada5e
--- /dev/null
+++ b/app/build/bin/injected/AndroidManifest.xml
@@ -0,0 +1,159 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/build/bin/merged/AndroidManifest.xml b/app/build/bin/merged/AndroidManifest.xml
new file mode 100644
index 0000000..5188fe4
--- /dev/null
+++ b/app/build/bin/merged/AndroidManifest.xml
@@ -0,0 +1,131 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 3987427..f6a09fe 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -6,6 +6,15 @@
+
+
+
+
+
+
+
+
.
- */
-package io.github.ratul.topactivity.dialog;
-
-import android.widget.TextView;
-import android.app.AlertDialog;
-import android.content.Context;
-import android.graphics.Typeface;
-
-/**
- * Created by Ratul on 09/05/2022.
- */
-public class DialogBeautifier {
- private String regular_font = "fonts/google_sans_regular.ttf";
- private String bold_font = "fonts/google_sans_bold.ttf";
- private AlertDialog dialog;
- private Context dialogContext;
-
- public DialogBeautifier(AlertDialog alert) {
- dialog = alert;
- dialogContext = alert.getContext();
- }
-
- public boolean beautifyTitle() {
- try{
- int titleId = dialogContext.getResources().getIdentifier( "alertTitle", "id", "android" );
- TextView title = dialog.findViewById(titleId);
- Typeface typeface = Typeface.createFromAsset(dialogContext.getAssets(), bold_font);
- title.setTypeface(typeface);
- return true;
- } catch(Exception e) {
- return false;
- }
- }
-
- public void beautifyMessage() {
- TextView message = dialog.findViewById(android.R.id.message);
- message.setTypeface(Typeface.createFromAsset(dialogContext.getAssets(), regular_font), 0);
- }
-
- public void beautifyPositiveButton() {
- TextView positiveBtn = dialog.findViewById(android.R.id.button1);
- positiveBtn.setTypeface(Typeface.createFromAsset(dialogContext.getAssets(), regular_font), 1);
- positiveBtn.setAllCaps(false);
- }
-
- public void beautifyNegativeButton() {
- TextView negativeBtn = dialog.findViewById(android.R.id.button2);
- negativeBtn.setTypeface(Typeface.createFromAsset(dialogContext.getAssets(), regular_font), 1);
- negativeBtn.setAllCaps(false);
- }
-
- public void beautifyNeutralButton() {
- TextView neutralBtn = dialog.findViewById(android.R.id.button3);
- neutralBtn.setTypeface(Typeface.createFromAsset(dialogContext.getAssets(), regular_font), 1);
- neutralBtn.setAllCaps(false);
- }
-
- public void beautify() throws Exception {
- beautifyTitle();
- beautifyMessage();
- beautifyPositiveButton();
- beautifyNegativeButton();
- beautifyNeutralButton();
- }
-}
diff --git a/app/src/main/java/io/github/ratul/topactivity/model/CrashHandler.java b/app/src/main/java/io/github/ratul/topactivity/model/CrashHandler.java
index 56cb554..9abf750 100644
--- a/app/src/main/java/io/github/ratul/topactivity/model/CrashHandler.java
+++ b/app/src/main/java/io/github/ratul/topactivity/model/CrashHandler.java
@@ -55,23 +55,19 @@ public CrashHandler(App app) {
versionCode = Build.VERSION.SDK_INT >= 28 ? packageInfo.getLongVersionCode() : packageInfo.versionCode;
} catch (PackageManager.NameNotFoundException ignored) {
ignored.printStackTrace();
+ versionName = "unknown";
}
}
- public void init() {
- Thread.setDefaultUncaughtExceptionHandler(this);
- }
-
@Override
public void uncaughtException(Thread main, Throwable mThrowable) {
if (tryUncaughtException(main, mThrowable) || DEFAULT == null) {
try {
Thread.sleep(1000L);
} catch (InterruptedException e) {
- e.printStackTrace();
+ android.os.Process.sendSignal(android.os.Process.myPid(), android.os.Process.SIGNAL_KILL);
}
android.os.Process.killProcess(android.os.Process.myPid());
- System.exit(1);
} else {
DEFAULT.uncaughtException(main, mThrowable);
}
@@ -102,6 +98,9 @@ public void run() {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
throwable.printStackTrace(pw);
+ Throwable cause = throwable.getCause();
+ if (cause != null)
+ cause.printStackTrace(pw);
fullStackTrace = sw.toString();
pw.close();
@@ -142,10 +141,10 @@ private void writeFile(File file, String content) throws IOException {
parentFile.mkdirs();
}
file.createNewFile();
- FileOutputStream fos = new FileOutputStream(file);
- fos.write(content.getBytes());
try {
- fos.close();
+ FileWriter writer = new FileWriter(file);
+ writer.write(content);
+ writer.close();
} catch (IOException e) {
e.printStackTrace();
}
diff --git a/app/src/main/java/io/github/ratul/topactivity/model/NotificationMonitor.java b/app/src/main/java/io/github/ratul/topactivity/model/NotificationMonitor.java
index b9bf2e8..65ee793 100644
--- a/app/src/main/java/io/github/ratul/topactivity/model/NotificationMonitor.java
+++ b/app/src/main/java/io/github/ratul/topactivity/model/NotificationMonitor.java
@@ -19,34 +19,33 @@
import android.app.ActivityManager;
import android.app.NotificationManager;
import android.app.PendingIntent;
+import android.app.NotificationChannel;
+import android.app.TaskStackBuilder;
+import android.app.Notification;
+import android.graphics.Color;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
+import android.widget.Toast;
-import androidx.core.app.NotificationCompat;
import java.util.List;
-import javax.crypto.NullCipher;
+import java.lang.reflect.AnnotatedElement;
+
import io.github.ratul.topactivity.utils.DatabaseUtil;
import io.github.ratul.topactivity.R;
import io.github.ratul.topactivity.ui.MainActivity;
import io.github.ratul.topactivity.utils.WindowUtil;
-import io.github.ratul.topactivity.service.QuickSettingsService;
-import java.lang.reflect.AnnotatedElement;
-import android.app.NotificationChannel;
-import android.graphics.Color;
-import android.app.TaskStackBuilder;
-import android.widget.Toast;
+import io.github.ratul.topactivity.service.QuickSettingsTileService;
/**
* Created by Ratul on 04/05/2022.
*/
public class NotificationMonitor extends BroadcastReceiver {
public static final int NOTIFICATION_ID = 696969691;
- private static String CHANNEL_ID;
private static final int ACTION_STOP = 2;
private static final String EXTRA_NOTIFICATION_ACTION = "command";
- public static NotificationCompat.Builder builder;
+ public static Notification.Builder builder;
public static NotificationManager notifManager;
public static void showNotification(Context context, boolean isPaused) {
@@ -55,48 +54,53 @@ public static void showNotification(Context context, boolean isPaused) {
}
notifManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
+ Intent intent = new Intent(context, MainActivity.class);
+ TaskStackBuilder stackBuilder = TaskStackBuilder.create(context);
+ stackBuilder.addParentStack(MainActivity.class);
+ stackBuilder.addNextIntent(intent);
+ PendingIntent pIntent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT);
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
- CHANNEL_ID = context.getPackageName() + "_channel_007";
+ String CHANNEL_ID = context.getPackageName() + "_channel_007";
CharSequence name = "Activity Info";
- int importance = NotificationManager.IMPORTANCE_HIGH;
- NotificationChannel mChannel = new NotificationChannel(CHANNEL_ID, name, importance);
+ NotificationChannel mChannel = new NotificationChannel(CHANNEL_ID, name, NotificationManager.IMPORTANCE_MAX);
mChannel.setDescription("Shows current activity info");
mChannel.enableLights(false);
mChannel.enableVibration(false);
mChannel.setShowBadge(false);
notifManager.createNotificationChannel(mChannel);
- }
- Intent intent = new Intent(context, MainActivity.class);
- TaskStackBuilder stackBuilder = TaskStackBuilder.create(context);
- stackBuilder.addParentStack(MainActivity.class);
- stackBuilder.addNextIntent(intent);
- PendingIntent pIntent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT);
+ builder = new Notification.Builder(context, CHANNEL_ID);
+ }
+ else {
+ builder = new Notification.Builder(context);
+ }
- builder = new NotificationCompat.Builder(context, CHANNEL_ID)
- .setContentTitle(context.getString(R.string.is_running, context.getString(R.string.app_name)))
- .setSmallIcon(R.drawable.ic_shortcut).setPriority(NotificationCompat.PRIORITY_HIGH)
- .setContentText(context.getString(R.string.touch_to_open))
- .setColor(context.getColor(R.color.layerColor)).setVisibility(NotificationCompat.VISIBILITY_SECRET)
- .setOngoing(!isPaused);
+ builder.setContentTitle(context.getString(R.string.is_running, context.getString(R.string.app_name)))
+ .setSmallIcon(R.drawable.ic_shortcut)
+ .setContentText(context.getString(R.string.touch_to_open))
+ .setColor(context.getColor(R.color.layerColor))
+ .setVisibility(Notification.VISIBILITY_SECRET)
+ .setOngoing(!isPaused)
+ .setAutoCancel(true)
+ .setContentIntent(pIntent);
builder.addAction(R.drawable.ic_launcher_foreground, context.getString(R.string.noti_action_stop),
- getPendingIntent(context, ACTION_STOP)).setContentIntent(pIntent);
+ getPendingIntent(context, ACTION_STOP)).setContentIntent(pIntent);
notifManager.notify(NOTIFICATION_ID, builder.build());
}
public static PendingIntent getPendingIntent(Context context, int command) {
- Intent intent = new Intent(context, NotificationMonitor.class);
- intent.setAction("io.github.ratul.topactivity.ACTION_NOTIFICATION_RECEIVER");
+ Intent intent = new Intent("io.github.ratul.topactivity.ACTION_NOTIFICATION_RECEIVER");
intent.putExtra(EXTRA_NOTIFICATION_ACTION, command);
return PendingIntent.getBroadcast(context, 0, intent, 0);
}
public static void cancelNotification(Context context) {
- NotificationManager nm = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
- nm.cancel(NOTIFICATION_ID);
+ if (notifManager != null)
+ notifManager.cancel(NOTIFICATION_ID);
}
@Override
@@ -108,6 +112,6 @@ public void onReceive(Context context, Intent intent) {
cancelNotification(context);
context.sendBroadcast(new Intent(MainActivity.ACTION_STATE_CHANGED));
}
- context.sendBroadcast(new Intent(QuickSettingsService.ACTION_UPDATE_TITLE));
+ context.sendBroadcast(new Intent(QuickSettingsTileService.ACTION_UPDATE_TITLE));
}
}
diff --git a/app/src/main/java/io/github/ratul/topactivity/model/TypefaceSpan.java b/app/src/main/java/io/github/ratul/topactivity/model/TypefaceSpan.java
index 0d2d7a9..54ec372 100644
--- a/app/src/main/java/io/github/ratul/topactivity/model/TypefaceSpan.java
+++ b/app/src/main/java/io/github/ratul/topactivity/model/TypefaceSpan.java
@@ -24,7 +24,9 @@
import android.graphics.Paint;
public class TypefaceSpan extends MetricAffectingSpan {
+
private static LruCache sTypefaceCache = new LruCache(12);
+
private Typeface mTypeface;
public TypefaceSpan(Context context, String typefaceName) {
diff --git a/app/src/main/java/io/github/ratul/topactivity/service/AccessibilityMonitoringService.java b/app/src/main/java/io/github/ratul/topactivity/service/AccessibilityMonitoringService.java
index 8176412..916d6e7 100644
--- a/app/src/main/java/io/github/ratul/topactivity/service/AccessibilityMonitoringService.java
+++ b/app/src/main/java/io/github/ratul/topactivity/service/AccessibilityMonitoringService.java
@@ -62,18 +62,17 @@ public boolean isSystemClass(String className) {
@Override
public void onAccessibilityEvent(AccessibilityEvent event) {
if (WindowUtil.viewAdded && DatabaseUtil.isShowWindow() && DatabaseUtil.hasAccess()) {
- String act1 = event.getClassName().toString();
- String act2 = event.getPackageName().toString();
+ String act1 = String.valueOf(event.getClassName());
+ String act2 = String.valueOf(event.getPackageName());
if (isSystemClass(act1))
return;
WindowUtil.show(this, act2, act1);
}
}
-
+
@Override
public void onInterrupt() {
- sInstance = null;
}
@Override
@@ -87,7 +86,7 @@ public boolean onUnbind(Intent intent) {
sInstance = null;
WindowUtil.dismiss(this);
NotificationMonitor.cancelNotification(this);
- sendBroadcast(new Intent(QuickSettingsService.ACTION_UPDATE_TITLE));
+ sendBroadcast(new Intent(QuickSettingsTileService.ACTION_UPDATE_TITLE));
return super.onUnbind(intent);
}
}
diff --git a/app/src/main/java/io/github/ratul/topactivity/service/QuickSettingsService.java b/app/src/main/java/io/github/ratul/topactivity/service/QuickSettingsService.java
deleted file mode 100644
index 99df124..0000000
--- a/app/src/main/java/io/github/ratul/topactivity/service/QuickSettingsService.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Copyright (C) 2022 Ratul Hasan
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package io.github.ratul.topactivity.service;
-
-import android.annotation.TargetApi;
-import android.content.BroadcastReceiver;
-import android.content.ComponentName;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.os.Build;
-import android.provider.Settings;
-import android.service.quicksettings.Tile;
-import android.service.quicksettings.TileService;
-import android.text.style.BackgroundColorSpan;
-import io.github.ratul.topactivity.utils.DatabaseUtil;
-import io.github.ratul.topactivity.ui.MainActivity;
-import io.github.ratul.topactivity.utils.WindowUtil;
-import io.github.ratul.topactivity.model.NotificationMonitor;
-import io.github.ratul.topactivity.ui.BackgroundActivity;
-
-/**
- * Created by Wen on 5/3/16.
- * Refactored by Ratul on 04/05/2022.
- */
-@TargetApi(Build.VERSION_CODES.N)
-public class QuickSettingsService extends TileService {
- public static final String ACTION_UPDATE_TITLE = "io.github.ratul.topactivity.ACTION.UPDATE_TITLE";
- private UpdateTileReceiver mReceiver;
-
- public static void updateTile(Context context) {
- TileService.requestListeningState(context, new ComponentName(context, QuickSettingsService.class));
- context.sendBroadcast(new Intent(QuickSettingsService.ACTION_UPDATE_TITLE));
- }
-
- private void updateTile() {
- getQsTile().setState(DatabaseUtil.isShowWindow() ? Tile.STATE_ACTIVE : Tile.STATE_INACTIVE);
- getQsTile().updateTile();
- }
-
- @Override
- public void onCreate() {
- super.onCreate();
- mReceiver = new UpdateTileReceiver();
- }
-
- @Override
- public void onTileAdded() {
- DatabaseUtil.setQSTileAdded(true);
- sendBroadcast(new Intent(MainActivity.ACTION_STATE_CHANGED));
- }
-
- @Override
- public void onTileRemoved() {
- super.onTileRemoved();
- DatabaseUtil.setQSTileAdded(false);
- sendBroadcast(new Intent(MainActivity.ACTION_STATE_CHANGED));
- }
-
- @Override
- public void onStartListening() {
- registerReceiver(mReceiver, new IntentFilter(ACTION_UPDATE_TITLE));
- super.onStartListening();
- updateTile();
- }
-
- @Override
- public void onStopListening() {
- unregisterReceiver(mReceiver);
- super.onStopListening();
- }
-
- @Override
- public void onClick() {
- if (DatabaseUtil.isShowWindow())
- return;
- if (!MainActivity.usageStats(this) || !Settings.canDrawOverlays(this)) {
- Intent intent = new Intent(this, MainActivity.class);
- intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- intent.putExtra(MainActivity.EXTRA_FROM_QS_TILE, true);
- startActivityAndCollapse(intent);
- } else {
- if (DatabaseUtil.hasAccess() && AccessibilityMonitoringService.getInstance() == null)
- startService(new Intent().setClass(this, AccessibilityMonitoringService.class));
- DatabaseUtil.setIsShowWindow(!DatabaseUtil.isShowWindow());
- if (DatabaseUtil.isShowWindow()) {
- if (WindowUtil.sWindowManager == null)
- WindowUtil.init(this);
- NotificationMonitor.showNotification(this, false);
- startService(new Intent(this, MonitoringService.class));
- } else {
- WindowUtil.dismiss(this);
- NotificationMonitor.showNotification(this, true);
- }
- sendBroadcast(new Intent(MainActivity.ACTION_STATE_CHANGED));
- }
- }
-
- class UpdateTileReceiver extends BroadcastReceiver {
- @Override
- public void onReceive(Context context, Intent intent) {
- updateTile();
- }
- }
-}
diff --git a/app/src/main/java/io/github/ratul/topactivity/ui/BackgroundActivity.java b/app/src/main/java/io/github/ratul/topactivity/ui/BackgroundActivity.java
index 867ed45..81dd142 100644
--- a/app/src/main/java/io/github/ratul/topactivity/ui/BackgroundActivity.java
+++ b/app/src/main/java/io/github/ratul/topactivity/ui/BackgroundActivity.java
@@ -30,23 +30,44 @@
/**
* Created by Ratul on 04/05/2022.
*/
- @TargetApi(Build.VERSION_CODES.O)
+@TargetApi(Build.VERSION_CODES.O)
public class BackgroundActivity extends AppCompatActivity {
public static String STRING_COPY = "io.github.ratul.topactivity.COPY_STRING";
public static String COPY_MSG = "io.github.ratul.topactivity.COPY_STRING_MSG";
+ public static boolean isAlive;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+ if (!getIntent().hasExtra(STRING_COPY))
+ finish();
String str = getIntent().getStringExtra(STRING_COPY);
- String msg = getIntent().getStringExtra(STRING_COPY);
+ String msg = getIntent().getStringExtra(COPY_MSG);
+ msg = (msg == null || msg.trim().isEmpty()) ? "Copied" : msg;
if (str != null) {
ClipboardManager clipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
ClipData clip = new ClipData(ClipData.newPlainText("", str));
clipboard.setPrimaryClip(clip);
- App.showToast(msg, 0);
}
- finish();
+ finish();
}
+
+ @Override
+ protected void onStop() {
+ isAlive = false;
+ super.onStop();
+ }
+
+ @Override
+ protected void onDestroy() {
+ isAlive = false;
+ super.onDestroy();
+ }
+
+ @Override
+ protected void onStart() {
+ isAlive = true;
+ super.onStart();
+ }
}
diff --git a/app/src/main/java/io/github/ratul/topactivity/utils/WindowUtil.java b/app/src/main/java/io/github/ratul/topactivity/utils/WindowUtil.java
index 96bb233..80bfb32 100644
--- a/app/src/main/java/io/github/ratul/topactivity/utils/WindowUtil.java
+++ b/app/src/main/java/io/github/ratul/topactivity/utils/WindowUtil.java
@@ -36,11 +36,12 @@
import com.google.android.material.textview.MaterialTextView;
import io.github.ratul.topactivity.ui.MainActivity;
import io.github.ratul.topactivity.ui.BackgroundActivity;
-import io.github.ratul.topactivity.service.QuickSettingsService;
+import io.github.ratul.topactivity.service.QuickSettingsTileService;
import io.github.ratul.topactivity.service.MonitoringService;
import io.github.ratul.topactivity.service.AccessibilityMonitoringService;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
+import io.github.ratul.topactivity.App;
/**
* Created by Ratul on 04/05/2022.
@@ -87,21 +88,24 @@ public void onClick(View v) {
}
});
- appName.setOnClickListener(new View.OnClickListener() {
- public void onClick(View v) {
+ appName.setOnLongClickListener(new View.OnLongClickListener() {
+ public boolean onLongClick(View v) {
copyString(context, text, "App name copied");
+ return true;
}
});
- packageName.setOnClickListener(new View.OnClickListener() {
- public void onClick(View v) {
+ packageName.setOnLongClickListener(new View.OnLongClickListener() {
+ public boolean onLongClick(View v) {
copyString(context, text, "Package name copied");
+ return true;
}
});
- className.setOnClickListener(new View.OnClickListener() {
- public void onClick(View v) {
+ className.setOnLongClickListener(new View.OnLongClickListener() {
+ public boolean onLongClick(View v) {
copyString(context, text1, "Class name copied");
+ return true;
}
});
@@ -120,7 +124,8 @@ public boolean onTouch(View view, MotionEvent event) {
yInitCord = yCord;
xInitMargin = layoutParams.x;
yInitMargin = layoutParams.y;
- } else if (action == MotionEvent.ACTION_MOVE) {
+ }
+ else if (action == MotionEvent.ACTION_MOVE) {
int xDiffMove = xCord - xInitCord;
int yDiffMove = yCord - yInitCord;
xCordDestination = xInitMargin + xDiffMove;
@@ -144,6 +149,7 @@ private static void copyString(Context context, String str, String msg) {
new Intent(context, BackgroundActivity.class).putExtra(BackgroundActivity.STRING_COPY, str)
.putExtra(BackgroundActivity.COPY_MSG, msg).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
}
+ App.showToast(msg, 0);
}
public static String getAppName(Context context, String pkg) {
@@ -151,9 +157,7 @@ public static String getAppName(Context context, String pkg) {
PackageManager pm = context.getPackageManager();
return pm.getApplicationLabel(pm.getApplicationInfo(pkg, 0)).toString();
} catch (Exception e) {
- // Ignored
- e.printStackTrace();
- return "";
+ return "Unknown";
}
}
@@ -179,7 +183,7 @@ public static void show(Context context, String pkg, String clas) {
NotificationMonitor.builder.build());
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
- QuickSettingsService.updateTile(context);
+ QuickSettingsTileService.updateTile(context);
}
}
@@ -191,7 +195,7 @@ public static void dismiss(Context context) {
e.printStackTrace();
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
- QuickSettingsService.updateTile(context);
+ QuickSettingsTileService.updateTile(context);
}
}
}
diff --git a/app/src/main/java/io/github/ratul/topactivity/view/BoldTextView.java b/app/src/main/java/io/github/ratul/topactivity/view/BoldTextView.java
index 2add278..5d87080 100644
--- a/app/src/main/java/io/github/ratul/topactivity/view/BoldTextView.java
+++ b/app/src/main/java/io/github/ratul/topactivity/view/BoldTextView.java
@@ -42,6 +42,11 @@ public BoldTextView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
setBoldFont(context);
}
+
+ public BoldTextView(Context context, AttributeSet attrs, int defStyle, int res) {
+ super(context, attrs, defStyle, res);
+ setBoldFont(context);
+ }
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
diff --git a/app/src/main/java/io/github/ratul/topactivity/view/NormalTextView.java b/app/src/main/java/io/github/ratul/topactivity/view/NormalTextView.java
index 694ff50..381c8d7 100644
--- a/app/src/main/java/io/github/ratul/topactivity/view/NormalTextView.java
+++ b/app/src/main/java/io/github/ratul/topactivity/view/NormalTextView.java
@@ -42,6 +42,11 @@ public NormalTextView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
setRegularFont(context);
}
+
+ public NormalTextView(Context context, AttributeSet attrs, int defStyle, int res) {
+ super(context, attrs, defStyle, res);
+ setRegularFont(context);
+ }
protected void onDraw (Canvas canvas) {
super.onDraw(canvas);
diff --git a/app/src/main/java/io/github/ratul/topactivity/view/RegularTextView.java b/app/src/main/java/io/github/ratul/topactivity/view/RegularTextView.java
index e63bc0f..8470b9c 100644
--- a/app/src/main/java/io/github/ratul/topactivity/view/RegularTextView.java
+++ b/app/src/main/java/io/github/ratul/topactivity/view/RegularTextView.java
@@ -42,6 +42,11 @@ public RegularTextView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
setRegularFont(context);
}
+
+ public RegularTextView(Context context, AttributeSet attrs, int defStyle, int res) {
+ super(context, attrs, defStyle, res);
+ setRegularFont(context);
+ }
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
diff --git a/app/src/main/res/layout/window_tasks.xml b/app/src/main/res/layout/window_tasks.xml
index 896c5be..67758ca 100644
--- a/app/src/main/res/layout/window_tasks.xml
+++ b/app/src/main/res/layout/window_tasks.xml
@@ -14,17 +14,38 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
-
-
+
+
+ android:textSize="12sp" />
+
+
-
-
-
-
-
-
-
-
+
-
\ No newline at end of file
+
diff --git a/build.gradle b/build.gradle
index d3d2de0..9c32f2d 100644
--- a/build.gradle
+++ b/build.gradle
@@ -5,7 +5,7 @@ buildscript {
mavenCentral()
}
dependencies {
- classpath 'com.android.tools.build:gradle:7.1.2'
+ classpath 'com.android.tools.build:gradle:7.2.1'
}
}
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index b439258..174aad7 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
#Mon Aug 30 15:20:07 CST 2021
distributionBase=GRADLE_USER_HOME
-distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME