Add files via upload
This commit is contained in:
parent
e8f2a2e6af
commit
bfb2427ed4
15 changed files with 462 additions and 0 deletions
30
app/build.gradle
Normal file
30
app/build.gradle
Normal file
|
@ -0,0 +1,30 @@
|
|||
plugins {
|
||||
id 'com.android.application'
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdk 30
|
||||
|
||||
defaultConfig {
|
||||
applicationId "ru.darkcat09.blockapp"
|
||||
minSdk 16
|
||||
targetSdk 30
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled true
|
||||
shrinkResources true
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
}
|
21
app/proguard-rules.pro
vendored
Normal file
21
app/proguard-rules.pro
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
25
app/src/main/AndroidManifest.xml
Normal file
25
app/src/main/AndroidManifest.xml
Normal file
|
@ -0,0 +1,25 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="ru.darkcat09.blockapp">
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:label="@string/android_system_label"
|
||||
android:supportsRtl="true">
|
||||
|
||||
<service
|
||||
android:name=".BlockAppAccessibilityService"
|
||||
android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE"
|
||||
android:label="@string/android_system_label"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.accessibilityservice.AccessibilityService" />
|
||||
</intent-filter>
|
||||
<meta-data
|
||||
android:name="android.accessibilityservice"
|
||||
android:resource="@xml/blockapp_service_config" />
|
||||
</service>
|
||||
|
||||
</application>
|
||||
|
||||
</manifest>
|
|
@ -0,0 +1,37 @@
|
|||
package ru.darkcat09.blockapp;
|
||||
|
||||
import android.accessibilityservice.AccessibilityService;
|
||||
import android.accessibilityservice.AccessibilityServiceInfo;
|
||||
import android.view.accessibility.AccessibilityEvent;
|
||||
import android.widget.Toast;
|
||||
|
||||
public class BlockAppAccessibilityService extends AccessibilityService {
|
||||
|
||||
@Override
|
||||
protected void onServiceConnected() {
|
||||
super.onServiceConnected();
|
||||
AccessibilityServiceInfo info = new AccessibilityServiceInfo();
|
||||
info.flags = AccessibilityServiceInfo.DEFAULT;
|
||||
info.eventTypes = AccessibilityEvent.TYPES_ALL_MASK;
|
||||
info.feedbackType = AccessibilityServiceInfo.FEEDBACK_GENERIC;
|
||||
info.packageNames = new String[] {
|
||||
"com.zhiliaoapp.musically",
|
||||
"com.zhiliaoapp.musically.go",
|
||||
"com.ss.android.ugc.trill"
|
||||
};
|
||||
setServiceInfo(info);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccessibilityEvent(AccessibilityEvent event) {
|
||||
String msg = getString(R.string.message);
|
||||
performGlobalAction(GLOBAL_ACTION_HOME);
|
||||
if (!msg.equals(""))
|
||||
Toast.makeText(this, msg, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInterrupt() {
|
||||
//
|
||||
}
|
||||
}
|
4
app/src/main/res/values-ru-rRU/strings.xml
Normal file
4
app/src/main/res/values-ru-rRU/strings.xml
Normal file
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="android_system_label">Система Android</string>
|
||||
</resources>
|
4
app/src/main/res/values/strings.xml
Normal file
4
app/src/main/res/values/strings.xml
Normal file
|
@ -0,0 +1,4 @@
|
|||
<resources>
|
||||
<string name="android_system_label">Android System</string>
|
||||
<string name="message" translatable="false">Займись чем-нибудь полезным</string>
|
||||
</resources>
|
5
app/src/main/res/xml/blockapp_service_config.xml
Normal file
5
app/src/main/res/xml/blockapp_service_config.xml
Normal file
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<accessibility-service xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:accessibilityFlags="flagDefault"
|
||||
android:accessibilityEventTypes="typeWindowStateChanged|typeWindowsChanged"
|
||||
android:canRetrieveWindowContent="false" />
|
Loading…
Add table
Add a link
Reference in a new issue