Add files via upload

This commit is contained in:
Andrey 2021-11-02 12:45:10 +04:00 committed by GitHub
parent e8f2a2e6af
commit bfb2427ed4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 462 additions and 0 deletions

30
app/build.gradle Normal file
View 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
View 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

View 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>

View file

@ -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() {
//
}
}

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="android_system_label">Система Android</string>
</resources>

View file

@ -0,0 +1,4 @@
<resources>
<string name="android_system_label">Android System</string>
<string name="message" translatable="false">Займись чем-нибудь полезным</string>
</resources>

View 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" />