forked from virresh/matvt
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 01e33dc
Showing
30 changed files
with
589 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
*.iml | ||
.gradle | ||
/local.properties | ||
/.idea/caches | ||
/.idea/libraries | ||
/.idea/modules.xml | ||
/.idea/workspace.xml | ||
/.idea/navEditor.xml | ||
/.idea/assetWizardSettings.xml | ||
.DS_Store | ||
/build | ||
/captures | ||
.externalNativeBuild | ||
.cxx | ||
local.properties |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
plugins { | ||
id 'com.android.application' | ||
} | ||
|
||
android { | ||
compileSdkVersion 29 | ||
buildToolsVersion "30.0.3" | ||
|
||
defaultConfig { | ||
applicationId "io.github.virresh.matvt" | ||
minSdkVersion 21 | ||
targetSdkVersion 29 | ||
versionCode 1 | ||
versionName "1.0" | ||
|
||
} | ||
|
||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
|
||
implementation 'androidx.leanback:leanback:1.0.0' | ||
implementation 'androidx.appcompat:appcompat:1.2.0' | ||
implementation 'androidx.constraintlayout:constraintlayout:1.1.3' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="io.github.virresh.matvt"> | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:supportsRtl="true" | ||
android:theme="@style/Theme.MATVTMouseForAndroidTVToggle"> | ||
<activity android:name=".gui.GuiActivity"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
|
||
<service | ||
android:name=".services.MouseEventService" | ||
android:label="Mouse Event Listening Service" | ||
android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE"> | ||
<intent-filter> | ||
<action android:name="android.accessibilityservice.AccessibilityService" /> | ||
</intent-filter> | ||
<meta-data | ||
android:name="android.accessibilityservice" | ||
android:resource="@xml/accessibility_service_config" /> | ||
</service> | ||
</application> | ||
|
||
</manifest> |
17 changes: 17 additions & 0 deletions
17
app/src/main/java/io/github/virresh/matvt/gui/GuiActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package io.github.virresh.matvt.gui; | ||
|
||
import androidx.appcompat.app.AppCompatActivity; | ||
|
||
import android.app.Activity; | ||
import android.os.Bundle; | ||
|
||
import io.github.virresh.matvt.R; | ||
|
||
public class GuiActivity extends Activity { | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_gui); | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
app/src/main/java/io/github/virresh/matvt/services/MouseEventService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package io.github.virresh.matvt.services; | ||
|
||
import android.accessibilityservice.AccessibilityService; | ||
import android.accessibilityservice.AccessibilityServiceInfo; | ||
import android.util.Log; | ||
import android.view.KeyEvent; | ||
import android.view.accessibility.AccessibilityEvent; | ||
|
||
public class MouseEventService extends AccessibilityService { | ||
|
||
private static String LOG_TAG = "MATVT_SERVICE"; | ||
|
||
@Override | ||
public void onAccessibilityEvent(AccessibilityEvent accessibilityEvent) { | ||
|
||
} | ||
|
||
@Override | ||
protected boolean onKeyEvent(KeyEvent event) { | ||
Log.i(LOG_TAG, event.toString()); | ||
return super.onKeyEvent(event); | ||
} | ||
|
||
@Override | ||
public void onInterrupt() { | ||
|
||
} | ||
|
||
@Override | ||
protected void onServiceConnected() { | ||
super.onServiceConnected(); | ||
Log.i(LOG_TAG, "TV Service Connected!"); | ||
// AccessibilityServiceInfo eventConnectionInfo = new AccessibilityServiceInfo(); | ||
// eventConnectionInfo.eventTypes = AccessibilityEvent.TYPES_ALL_MASK; | ||
// this.setServiceInfo(eventConnectionInfo); | ||
// Log.i(LOG_TAG, "Setting event types to " + eventConnectionInfo.eventTypes); | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
app/src/main/java/io/github/virresh/matvt/view/MouseCursorView.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package io.github.virresh.matvt.view; | ||
|
||
import android.content.Context; | ||
import android.graphics.Bitmap; | ||
import android.graphics.Canvas; | ||
import android.graphics.Paint; | ||
import android.graphics.PointF; | ||
import android.graphics.drawable.BitmapDrawable; | ||
import android.view.View; | ||
|
||
import io.github.virresh.matvt.R; | ||
|
||
/** | ||
* Draw a Mouse Cursor on screen | ||
*/ | ||
public class MouseCursorView extends View { | ||
private static final int DEFAULT_ALPHA= 255; | ||
|
||
private PointF mPointerLocation; | ||
private Paint mPaintBox; | ||
private Bitmap mPointerBitmap; | ||
private int mAlphaPointer= DEFAULT_ALPHA; | ||
|
||
|
||
public MouseCursorView(Context context) { | ||
super(context); | ||
setWillNotDraw(false); | ||
mPointerLocation = new PointF(); | ||
mPaintBox = new Paint(); | ||
|
||
BitmapDrawable bp = (BitmapDrawable) getContext().getResources().getDrawable(R.drawable.pointer); | ||
Bitmap originalBitmap = bp.getBitmap(); | ||
mPointerBitmap = originalBitmap; | ||
} | ||
|
||
@Override | ||
protected void onDraw(Canvas canvas) { | ||
super.onDraw(canvas); | ||
mPaintBox.setAlpha(mAlphaPointer); | ||
canvas.drawBitmap(mPointerBitmap, mPointerLocation.x, mPointerLocation.y, mPaintBox); | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
tools:context=".gui.GuiActivity"> | ||
|
||
<TextView | ||
android:id="@+id/textView" | ||
android:layout_width="536dp" | ||
android:layout_height="121dp" | ||
android:layout_marginStart="212dp" | ||
android:layout_marginTop="210dp" | ||
android:layout_marginEnd="213dp" | ||
android:layout_marginBottom="210dp" | ||
android:text="Button Events" | ||
app:layout_constraintBottom_toBottomOf="parent" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toTopOf="parent" /> | ||
</androidx.constraintlayout.widget.ConstraintLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent"> | ||
|
||
<!-- <io.github.virresh.matvt.view.MouseCursorView | ||
style="@style/Widget.Theme.MATVTMouseForAndroidTVToggle.MyView" | ||
android:layout_width="300dp" | ||
android:layout_height="300dp" | ||
android:paddingLeft="20dp" | ||
android:paddingBottom="40dp" | ||
app:exampleDimension="24sp" | ||
app:exampleDrawable="@android:drawable/ic_menu_add" | ||
app:exampleString="Hello, BlackMouseCursor" /> | ||
--> | ||
</FrameLayout> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<resources> | ||
|
||
<style name="Widget.Theme.MATVTMouseForAndroidTVToggle.MyView" parent=""> | ||
<item name="android:background">@color/gray_600</item> | ||
<item name="exampleColor">@color/light_blue_600</item> | ||
</style> | ||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<resources> | ||
<declare-styleable name="BlackMouseCursor"> | ||
<attr name="exampleString" format="string" /> | ||
<attr name="exampleDimension" format="dimension" /> | ||
<attr name="exampleColor" format="color" /> | ||
<attr name="exampleDrawable" format="color|reference" /> | ||
</declare-styleable> | ||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<resources> | ||
<color name="light_blue_400">#FF29B6F6</color> | ||
<color name="light_blue_600">#FF039BE5</color> | ||
<color name="gray_400">#FFBDBDBD</color> | ||
<color name="gray_600">#FF757575</color> | ||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<resources> | ||
<string name="app_name">MATVT - Mouse for Android TV Toggle</string> | ||
<string name="accessibility_service_description">Control mouse cursor on your Android TV using your remote</string> | ||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<resources> | ||
|
||
<style name="Widget.Theme.MATVTMouseForAndroidTVToggle.MyView" parent=""> | ||
<item name="android:background">@color/gray_400</item> | ||
<item name="exampleColor">@color/light_blue_400</item> | ||
</style> | ||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<resources> | ||
|
||
<style name="Theme.MATVTMouseForAndroidTVToggle" parent="@style/Theme.Leanback" /> | ||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<accessibility-service xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:description="@string/accessibility_service_description" | ||
android:accessibilityEventTypes="typeAllMask" | ||
android:canRequestFilterKeyEvents="true" | ||
android:accessibilityFlags="flagRequestFilterKeyEvents" | ||
android:accessibilityFeedbackType="feedbackGeneric" | ||
android:notificationTimeout="100" | ||
android:canRetrieveWindowContent="true" | ||
android:settingsActivity="io.github.virresh.matvt.gui.GuiActivity" | ||
/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Top-level build file where you can add configuration options common to all sub-projects/modules. | ||
buildscript { | ||
repositories { | ||
google() | ||
jcenter() | ||
} | ||
dependencies { | ||
classpath 'com.android.tools.build:gradle:4.1.2' | ||
|
||
// NOTE: Do not place your application dependencies here; they belong | ||
// in the individual module build.gradle files | ||
} | ||
} | ||
|
||
allprojects { | ||
repositories { | ||
google() | ||
jcenter() | ||
} | ||
} | ||
|
||
task clean(type: Delete) { | ||
delete rootProject.buildDir | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Project-wide Gradle settings. | ||
# IDE (e.g. Android Studio) users: | ||
# Gradle settings configured through the IDE *will override* | ||
# any settings specified in this file. | ||
# For more details on how to configure your build environment visit | ||
# http://www.gradle.org/docs/current/userguide/build_environment.html | ||
# Specifies the JVM arguments used for the daemon process. | ||
# The setting is particularly useful for tweaking memory settings. | ||
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 | ||
# When configured, Gradle will run in incubating parallel mode. | ||
# This option should only be used with decoupled projects. More details, visit | ||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects | ||
# org.gradle.parallel=true | ||
# AndroidX package structure to make it clearer which packages are bundled with the | ||
# Android operating system, and which are packaged with your app"s APK | ||
# https://developer.android.com/topic/libraries/support-library/androidx-rn | ||
android.useAndroidX=true | ||
# Automatically convert third-party libraries to use AndroidX | ||
android.enableJetifier=true |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#Sun Jan 17 00:02:44 IST 2021 | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip |
Oops, something went wrong.