Giter VIP home page Giter VIP logo

touchinputdisplaydriver's Introduction

Touch Input Display Driver for Android

Android Things have been deprecated. My motivation behind trying to revive this project was that I wanted to run Android on RaspberryPi with a 3.5" GPIO display that had touch support.

However, due to my limited knowledge of Android development, although I got to get the Gradle build to pass and the Activity to display, the Android service that is supposed to run on the background that uses SPI library which enables touch doesn't work. This could be because I commented out a lot of code related to maven because I didn't understand how to use it. (Looks like jitpack.io is the way to go). I got the apk to be exported for demo service but not touch service. That could also be an another reason why it didn't work.

Anyway, I found that I can buy 3.5", 4.3" and 5" displays that has touch support with HDMI and USB which will satisfy my need. So, I'm going to leave this code so that maybe someone in the future would still be able to make it work for GPIO displays.

Useful articles from Original Author

https://medium.com/@dirkvranckaert/android-things-and-touch-display-compatibility-b013a77a8bb8 https://medium.com/@dirkvranckaert/android-things-and-a-waveshare-5-display-289c2ef2fe8c

Troubleshooting Lineage OS to display using HDMI Output

https://forum.xda-developers.com/t/running-konstakang-lineage-os-on-my-rpi-4-and-hdmi-is-not-outputting.4431465/

Q: My display is not working. I can only see the rainbow screen but no Android boot animation. What should I do?
A: This build only supports HDMI displays that report supported resolutions using EDID. 
1920x1080 resolution is used by default with this build. You can change value in /boot/resolution.txt to use a different resolution that your display supports. 
Removing /boot/resolution.txt will use the preferred resolution of your display

Displays with USB Touch Port

Additional Resources:




Below are Notes from Original Author

Prerequisites (Not sure if this is required)

Before using the driver you need to make sure you have the Input Device Confguration file (.idc) installed on your Android things device. To do so mount the SD card of your Android Things device and in the root partition under /system/usr/idc/ you should copy the AndroidTouchInputDriver.idc file that is available in the root of this project. If you do not copy that file the driver will work but Android will think that the driver is a physical mouse, which obviously results in totally different behaviour.

Gradle

If having issues with gradle build

Default drivers

You can use the library in two different ways:

  1. Using the TouchScreenDriverApplication Add an Application to your source code and reference it from the AndroidManifest. Then extend your application from the TouchScreenDriverApplication and override the getDriverProfile() method. The DriverProfile can be initiated using WaveshareProfile.getInstance(WaveshareProfile.DIMENSION_800_480); or KedeiProfile.getInstance(KedeiProfile.DIMENSION_480_320);. This will make sure the correct driver for your display configuration/dimensions will be loaded.

  2. Implementing the TouchScreenDriverManager yourself If you cannot extend your Application from the TouchScreenDriverApplication then you can use the TouchScreenDriverManager to load and unload the driver in the onCreate and onDestroy methods of your Application instance. The manager is a singleton class that manages any state for you. Using this method you will also have to impelement a callback that provides DriverProfile for your screen.

Custom Drivers

Adding a custom driver is really simple. The hardest part in a custom driver is knowing how to read from your touch input display. Eg: https://github.com/dirkvranckaert/touchinputdisplaydriver/pull/12/files

To implement the driver in the library you should extend the eu.vranckaert.driver.touch.driver.Driver class or the eu.vranckaert.driver.touch.driver.SpiDriver class in case your touch input display is SPI compatible. If your touch input display uses the XPT2046 touch controller you can even directly extend the eu.vranckaert.driver.touch.driver.XPT2046Driver class. It's the driver class that will contain the reading/writing logic for your touch display.

Next you need a eu.vranckaert.driver.touch.profile.DriverProfile which needs a Vendor (or Vendor.UNKNOWN in case your vendor is not yet listed), and a ScreenDimension specifying the width, height and screen ratio. The Ratio is an enum with fixed ratio values, or again a Ratio.UNKNOWN if the ratio is not yet listed.

Demo

There's a demo module to test your drivers immediately. The demo contains a splash screen, some default Android controls ideally to test touch inputs (a slider, a switch and buttons) and a 'Touch Debugging' mode, when enabled drives a circle on the touch position that you discover from the display. This way you can almost perfect calibrate the driver against the specific display!

touchinputdisplaydriver's People

Contributors

dirkvranckaert avatar roshin8 avatar alvaroqueiroz avatar fleker avatar mangini avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.