Skip to content

Commit 5957c54

Browse files
authored
Merge pull request #4 from ratulhasanrahat/main
Merge Update
2 parents 9413ea2 + 4b01236 commit 5957c54

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+629
-410
lines changed

.resources/images/ic_launcher.png

1.62 KB
Loading

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,12 @@ An useful tool for Android Developers & Reversers, which shows the package n
1313
[![Contributions](https://img.shields.io/badge/Contributions-Open-blue)](https://github.com/RatulHasan8/Current-Activity/pulls)
1414

1515
<h1 align="left">
16-
<b>&nbsp;Original Repo</b>
16+
<b>&nbsp;Credits</b>
1717
</h1>
18-
The original repo of this project is unmaintained right now. However you can check it from <a href="https://github.com/109021017/android-TopActivity">here</a>.
18+
19+
* [Wen](https://github.com/109021017) for [project base](https://github.com/109021017/android-TopActivity).
20+
* [Frieder Bluemle](https://github.com/friederbluemle) for project optimization.
21+
* [Muhtaseem Al Mahmud](https://github.com/KingMahmud) for project optimization.
1922

2023
<h1 align="left">
2124
<b>&nbsp;License</b>

app/build.gradle

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,29 @@ apply plugin: 'com.android.application'
22

33
android {
44
compileSdkVersion 29
5-
// buildToolsVersion '33.0.0 rc1'
65
defaultConfig {
76
applicationId "com.ratul.topactivity"
8-
minSdkVersion 24
9-
targetSdkVersion 33
7+
minSdkVersion 21
8+
targetSdkVersion 25
109
versionCode 15
1110
versionName "1.5.5"
1211
}
1312

1413
buildTypes {
1514
release {
16-
debuggable false
1715
minifyEnabled true
1816
shrinkResources true
1917
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
2018
}
2119
debug {
2220
debuggable true
23-
minifyEnabled false
24-
shrinkResources false
21+
minifyEnabled true
22+
shrinkResources true
2523
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
2624
}
2725
}
2826
}
2927

3028
dependencies {
31-
// todo : use AndroidX
32-
implementation 'com.android.support:support-v4:25.4.0'
29+
implementation 'com.android.support:support-v4:26.0.1'
3330
}

app/proguard-rules.pro

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
1+
-keep public class android.view.** {
2+
public private protected *;
3+
}

app/src/main/AndroidManifest.xml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,23 @@
1212
<!-- Prevent phone from sleeping -->
1313
<uses-permission android:name="android.permission.WAKE_LOCK" />
1414
<application
15-
android:name="crash.App"
15+
android:name=".App"
1616
android:label="@string/app_name"
1717
android:icon="@drawable/ic_launcher"
18+
android:theme="@style/AppTheme"
1819
android:allowBackup="true"
20+
android:supportsPictureInPicture="true"
1921
android:resizeableActivity="true"
2022
android:roundIcon="@drawable/ic_launcher_round">
2123
<activity
22-
android:name=".MainActivity"
24+
android:name=".ui.MainActivity"
2325
android:label="@string/app_name"
2426
android:exported="true"
25-
android:theme="@style/AppTheme"
2627
android:configChanges="orientation|screenSize|keyboardHidden|smallestScreenSize|screenLayout"
2728
android:hardwareAccelerated="true"
28-
android:supportsPictureInPicture="true"
2929
android:screenOrientation="portrait"
30-
android:launchMode="singleTask">
30+
android:launchMode="singleTask"
31+
android:maxRecents="1">
3132
<intent-filter>
3233
<action android:name="android.intent.action.MAIN"/>
3334
<category android:name="android.intent.category.LAUNCHER"/>
@@ -38,40 +39,39 @@
3839
</activity>
3940

4041
<activity
41-
android:theme="@style/AppTheme"
4242
android:configChanges="orientation|screenSize|keyboardHidden|smallestScreenSize|screenLayout"
4343
android:hardwareAccelerated="true"
44-
android:supportsPictureInPicture="true"
4544
android:screenOrientation="portrait"
4645
android:launchMode="singleTask"
47-
android:name="crash.CrashActivity"
46+
android:name=".ui.CrashActivity"
47+
android:maxRecents="1"
4848
android:label="@string/app_name"
4949
android:exported="true" />
5050

5151
<activity
52-
android:name=".ShortcutHandlerActivity"
52+
android:name=".ui.ShortcutHandlerActivity"
5353
android:excludeFromRecents="true"
5454
android:enabled="true"
5555
android:exported="true"
5656
android:theme="@style/TransparentTheme"/>
5757

5858
<activity
59-
android:name=".BackgroundActivity"
59+
android:name=".ui.BackgroundActivity"
6060
android:excludeFromRecents="true"
6161
android:enabled="true"
6262
android:exported="true"
6363
android:theme="@style/TransparentTheme"/>
6464

6565
<service
66-
android:name=".MonitoringService"
66+
android:name=".service.MonitoringService"
6767
android:enabled="true"
6868
android:exported="false"/>
6969

7070
<service
71-
android:name=".AccessibilityWatcher"
71+
android:name=".service.AccessibilityMonitoringService"
7272
android:label="@string/app_name"
7373
android:description="@string/accessibility_permission"
74-
android:enabled="@bool/use_accessibility_service"
74+
android:enabled="true"
7575
android:exported="false"
7676
android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE">
7777
<intent-filter>
@@ -83,9 +83,9 @@
8383
android:resource="@xml/accessibility"/>
8484
</service>
8585
<service
86-
android:name=".QuickSettingsService"
86+
android:name=".service.QuickSettingsService"
8787
android:enabled="@bool/quick_settings_availability"
88-
android:icon="@drawable/ic_shortcut"
88+
android:icon="@drawable/ic_launcher_foreground"
8989
android:label="@string/app_name"
9090
android:exported="false"
9191
android:permission="android.permission.BIND_QUICK_SETTINGS_TILE">
@@ -99,7 +99,7 @@
9999
</service>
100100

101101
<receiver
102-
android:name=".NotificationMonitor"
102+
android:name=".model.NotificationMonitor"
103103
android:exported="false"
104104
android:enabled="true">
105105
<intent-filter>
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*
2+
* Copyright (C) 2022 Ratul Hasan
3+
*
4+
* This program is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU General Public License
15+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
16+
*/
17+
package android.view;
18+
19+
import android.content.Context;
20+
import android.graphics.Canvas;
21+
import android.graphics.Typeface;
22+
import android.util.AttributeSet;
23+
import android.widget.TextView;
24+
25+
public class BoldTextView extends TextView {
26+
public void setBoldFont(Context context) {
27+
Typeface face = Typeface.createFromAsset(context.getAssets(), "fonts/google_sans_bold.ttf");
28+
super.setTypeface(face);
29+
}
30+
31+
public BoldTextView(Context context) {
32+
super(context);
33+
setBoldFont(context);
34+
}
35+
36+
public BoldTextView(Context context, AttributeSet attrs) {
37+
super(context, attrs);
38+
setBoldFont(context);
39+
}
40+
41+
public BoldTextView(Context context, AttributeSet attrs, int defStyle) {
42+
super(context, attrs, defStyle);
43+
setBoldFont(context);
44+
}
45+
46+
protected void onDraw (Canvas canvas) {
47+
super.onDraw(canvas);
48+
}
49+
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/*
2+
* Copyright (C) 2022 Ratul Hasan
3+
*
4+
* This program is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU General Public License
15+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
16+
*/
17+
package android.view;
18+
19+
import android.content.Context;
20+
import android.graphics.Canvas;
21+
import android.graphics.Typeface;
22+
import android.util.AttributeSet;
23+
import android.widget.TextView;
24+
import android.widget.Toast;
25+
26+
public class NormalTextView extends TextView {
27+
public void setRegularFont(Context context) {
28+
Typeface face = Typeface.createFromAsset(context.getAssets(), "fonts/google_sans_regular.ttf");
29+
super.setTypeface(face);
30+
}
31+
32+
public NormalTextView(Context context) {
33+
super(context);
34+
setRegularFont(context);
35+
}
36+
37+
public NormalTextView(Context context, AttributeSet attrs) {
38+
super(context, attrs);
39+
setRegularFont(context);
40+
}
41+
42+
public NormalTextView(Context context, AttributeSet attrs, int defStyle) {
43+
super(context, attrs, defStyle);
44+
setRegularFont(context);
45+
}
46+
47+
protected void onDraw (Canvas canvas) {
48+
super.onDraw(canvas);
49+
}
50+
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/*
2+
* Copyright (C) 2022 Ratul Hasan
3+
*
4+
* This program is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU General Public License
15+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
16+
*/
17+
package android.view;
18+
19+
import android.content.Context;
20+
import android.graphics.Canvas;
21+
import android.graphics.Typeface;
22+
import android.util.AttributeSet;
23+
import android.widget.TextView;
24+
import android.widget.Toast;
25+
26+
public class RegularTextView extends TextView {
27+
public void setRegularFont(Context context) {
28+
Typeface face = Typeface.createFromAsset(context.getAssets(), "fonts/google_sans_regular.ttf");
29+
super.setTypeface(face, 1);
30+
}
31+
32+
public RegularTextView(Context context) {
33+
super(context);
34+
setRegularFont(context);
35+
}
36+
37+
public RegularTextView(Context context, AttributeSet attrs) {
38+
super(context, attrs);
39+
setRegularFont(context);
40+
}
41+
42+
public RegularTextView(Context context, AttributeSet attrs, int defStyle) {
43+
super(context, attrs, defStyle);
44+
setRegularFont(context);
45+
}
46+
47+
protected void onDraw (Canvas canvas) {
48+
super.onDraw(canvas);
49+
}
50+
}
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
/*
2+
* Copyright (C) 2022 Ratul Hasan
3+
*
4+
* This program is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU General Public License
15+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
16+
*/
17+
package com.ratul.topactivity;
18+
19+
import android.app.Application;
20+
import com.ratul.topactivity.R;
21+
import com.ratul.topactivity.model.CrashHandler;
22+
import android.content.Context;
23+
import java.io.File;
24+
import android.app.Activity;
25+
import com.ratul.topactivity.ui.MainActivity;
26+
import android.content.Intent;
27+
import com.ratul.topactivity.ui.CrashActivity;
28+
import android.widget.Toast;
29+
30+
public class App extends Application {
31+
private static App sApp;
32+
private Thread.UncaughtExceptionHandler getHandler = Thread.getDefaultUncaughtExceptionHandler();
33+
34+
@Override
35+
protected void attachBaseContext(Context base) {
36+
super.attachBaseContext(base);
37+
CrashHandler handleCrash = new CrashHandler(this, getHandler);
38+
handleCrash.init(this.getFilesDir());
39+
}
40+
41+
public void gotoCrashActivity(Exception ex) {
42+
if (ex == null) {
43+
return;
44+
}
45+
Intent intent = new Intent(this, CrashActivity.class);
46+
intent.putExtra(CrashActivity.EXTRA_CRASH_INFO, ex.toString());
47+
startActivity(intent);
48+
}
49+
50+
public void setSafeContentView(Activity activity, int layout) {
51+
try {
52+
activity.setContentView(layout);
53+
} catch (Exception e) {
54+
Toast.makeText(this, "Saving crash log", 0).show();
55+
gotoCrashActivity(e);
56+
}
57+
}
58+
59+
@Override
60+
public void onCreate() {
61+
super.onCreate();
62+
sApp = this;
63+
}
64+
65+
public static App getApp() {
66+
return sApp;
67+
}
68+
69+
}

0 commit comments

Comments
 (0)