GlowPadBackport


Source link: https://github.com/frakbot/GlowPadBackport

GlowPadBackport

A backport of the Android 4.2 GlowPadView that works on the SDK on API levels 4+.

It is heavily based upon Google's own internal implementation of the GlowPadView found in Android 4.2 Jelly Bean, but ported to be able to run on the Android SDK up from version 1.6 (API level 4, codename Donut). It uses Reflection in a couple of method calls to access some hidden APIs, so it might break on some Android version, or in the future. I tried limiting the usage of Reflection as much as possible, but those three methods did not have any alternatives.

I'm releasing my own code under the same Apache 2.0 license the underlying Android code is licensed under. Android code is written by Google, and licensed under that same Apache 2.0 license.

GlowPadBackport relies on NineOldAndroids, an awesome backport of the Android 3+ Animation APIs made by Jake Wharton.

Important note

This library will NOT do anything that is not strictly needed for this to build/work. Since this class has since been removed from AOSP, this library should be considered DEPRECATED. No efforts will be put into it, including merging PRs, for anything but very critical issues.

What is a GlowPad?

The GlowPadView is the view that Google uses in Android 4.1 and 4.2 (and, in a slightly different flavour, on Android 4.0 as well) on both the insecure lockscreen and the Incoming call Activity. It's the circular grid of dots, with a central handle that the user can grab to various customizable targets.

Google decided to only provide a private implementation of that view in AOSP. It's not an SDK-facing view, it has lots of internal APIs references, and doesn't work in older versions of Android. What I have done is I have rewritten part of the code to work on Android SDK versions starting with Android 1.6 Donut, which is to mean it runs pretty much on any hardware out there.

Of course performance is not going to be buttery smooth on older OS versions if the hardware is not up to it. Still, it can work decently even on underpowered hardware such as the i'm Watch Android smartwatch (you have to decrease the points count multiplier to 3-4 from the default of 8 thou).

I also exposed a couple more functions that aren't available on the AOSP internal version, such as the ability to change the points count. This means you can use the GlowPadView in any of your apps, and create custom Holo-like lockscreens for older versions of Android.

Usage

In order to use the GlowPadView in your project, follow these steps:

  1. Ensure you have the proper repository configured in your build.gradle file, eg.:
repositories {

maven {

  url "http://dl.bintray.com/frakbot/maven"
 
}
 
}

This has to be in your app module's build.gradle or in the project's top-level build.gradle file. Android Studio puts it into the top-level file by default.

  1. Add the dependency to your app's module build.gradle file, eg.:
dependencies {

  // Your other dependencies...
  compile 'net.frakbot:glowpadbackport:2.1.1' 
}
  1. Reference the GlowPadView in an XML layout (or initialise it from code)
```xml <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"

  xmlns:app="http://schemas.android.com/apk/res-auto"

  android:layout_width="fill_parent"

  android:layout_height="fill_parent">

<net.frakbot.glowpadbackport.GlowPadView

 android:id="@+id/incomingCallWidget"

 android:layout_width="fill_parent"

 android:layout_height="fill_parent"

 android:layout_marginTop="-10dp"

 android:layout_marginBottom="-46dp"

 android:background="@android:color/black"

 android:visibility="visible"

 android:gravity="top"

  app:targetDrawables="@array/incoming_call_widget_2way_targets"

 app:handleDrawable="@drawable/ic_in_call_touch_handle"

 app:innerRadius="@dimen/glowpadview_inner_radius"

 app:outerRadius="@dimen/glowpadview_target_placement_radius"

 app:outerRingDrawable="@drawable/ic_lockscreen_outerring"

 app:snapMargin="@dimen/glowpadview_snap_margin"

 app:vibrationDuration="20"

 app:feedbackCount="1"

 app:glowRadius="@dimen/glowpadview_glow_radius"

 app:pointDrawable="@drawable/ic_lockscreen_glowdot"/>  </RelativeLayout> ``` 
  1. ????
  2. Profit!

Sample app

You can find the GlowPadSample app in the Releases section of this repo.

The app used to be available on the Play Store but has not been updated and has since been pulled.

Building from source

Clone the repository on your computer. The old IntelliJ IDEA and Eclipse-style projects have been discontinued, and the library has been moved to the new Gradle-based build system, and Android Studio. You can of course continue to use this library in IntelliJ IDEA, but you'll have to build it using Gradle.

Before being able to build the project, you will need to rename the keystore.properties.example and local.properties.example files in the repo root, removing the .example suffix. Please note that you will need to provide valid values in both files, in place of the placeholders, before being able to complete a build.

License

Copyright 2015 Frakbot (Sebastiano Poggi and Francesco Pontillo)  Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License. You may obtain a copy of the License at
  http://www.apache.org/licenses/LICENSE-2.0  Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. 

Resources

MatchView is a library which includes MatchTextView and MatchButton.

Renderers is an Android library created to avoid all the Adapter/ListView boilerplate needed to create a new adapter and all the spaghetti code that developers used to create following the ViewHolder classic implementation.

This Android library offers you two main classes to extend and create your own rendering algorithms out of your adapter implementation.

Renderers is an easy way to work with android ListView and Adapter classes. With this library you only have to create your renderers and declare the mapping between the object to render and the renderer.

Futuroid is an Android library that allows running asynchronous tasks and attaching callbacks thanks to a convenient syntax. It offers an alternative to the Android AsyncTask class.

Features:

  • Future-based API (similar to Guava's ListenableFutures, Scala/Akka Futures, Javascript promises...)
  • Allows registering callbacks to be run on the Android UI/main thread
  • Provides a default ExecutorService (fixed thread pool with 5 threads) that can be replaced by a custom one
  • Each task can be run on the default ExecutorService or on a custom one
  • Allows task chaining (monad-style)

Custom shape ImageView using PorterDuffXfermode with paint shapes and SVGs.

You can use it to quickly turn a String into a Spannable and apply different types of spans to it.

new Makeup( name + ", " + age).boldify(0, name.length()).apply()

This would show a name and age of a person, and make the name part bold.

Battery Historian is a tool to analyze battery consumers using Android "bugreport" files.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes