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

Overview

GlowPadBackport Download

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.
Comments
  • Importing libary in project

    Importing libary in project

    Hi, I was wondering if you can tell me how to import the library in my Android Studio 0.5.7 ? I am having quite some issues :(

    /edit : Is there any other way to contact you ? I actually read and tried the documentation first, and what I did was clone the project first, then copy the GlowPadBackport directory (so not the rest of the project/directories) under my own project /libs directory, and afterwards I would be getting errors (Error : configuration with name 'deffault' not found)... Whilst writing this I already am wondering if I should not copy the whole project and then get rid of the GlowPadBackport-sample directory....

    invalid 
    opened by tiger79 9
  • Rendering problem Android Studio

    Rendering problem Android Studio

    java.lang.ClassNotFoundException: net.sebastianopoggi.ui.GlowPadBackport.GlowPadView$AnimationBundle
        at org.jetbrains.android.uipreview.ProjectClassLoader.load(ProjectClassLoader.java:92)
        at com.android.tools.idea.rendering.RenderClassLoader.findClass(RenderClassLoader.java:55)
        at org.jetbrains.android.uipreview.ProjectClassLoader.findClass(ProjectClassLoader.java:54)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
        at net.sebastianopoggi.ui.GlowPadBackport.GlowPadView.<init>(GlowPadView.java:99)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
        at org.jetbrains.android.uipreview.ViewLoader.createNewInstance(ViewLoader.java:375)
        at org.jetbrains.android.uipreview.ViewLoader.loadView(ViewLoader.java:100)
        at com.android.tools.idea.rendering.ProjectCallback.loadView(ProjectCallback.java:165)
        at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:207)
        at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:135)
        at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:755)
        at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:727)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:373)
        at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:399)
        at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:336)
        at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:332)
        at com.android.tools.idea.rendering.RenderService$3.compute(RenderService.java:549)
        at com.android.tools.idea.rendering.RenderService$3.compute(RenderService.java:538)
        at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:932)
        at com.android.tools.idea.rendering.RenderService.createRenderSession(RenderService.java:538)
        at com.android.tools.idea.rendering.RenderService.render(RenderService.java:611)
        at org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager.doRender(AndroidLayoutPreviewToolWindowManager.java:575)
        at org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager.access$1700(AndroidLayoutPreviewToolWindowManager.java:81)
        at org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager$6$1.run(AndroidLayoutPreviewToolWindowManager.java:521)
        at com.intellij.openapi.progress.impl.ProgressManagerImpl$2.run(ProgressManagerImpl.java:178)
        at com.intellij.openapi.progress.ProgressManager.executeProcessUnderProgress(ProgressManager.java:209)
        at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:212)
        at com.intellij.openapi.progress.impl.ProgressManagerImpl.runProcess(ProgressManagerImpl.java:171)
        at org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager$6.run(AndroidLayoutPreviewToolWindowManager.java:516)
        at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:320)
        at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:310)
        at com.intellij.util.ui.update.MergingUpdateQueue$2.run(MergingUpdateQueue.java:254)
        at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:269)
        at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:227)
        at com.intellij.util.ui.update.MergingUpdateQueue.run(MergingUpdateQueue.java:217)
        at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:238)
        at com.intellij.util.Alarm$Request$1.run(Alarm.java:318)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
        at java.util.concurrent.FutureTask.run(FutureTask.java:262)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:744)
    
    bug wontfix 
    opened by dhruvthak 8
  • android.content.res.Resources$NotFoundException

    android.content.res.Resources$NotFoundException

    your library is great. it works smoothly on 2.3 to 4.4.2. But I have 1 unknown issue. In my nexus one with 2.3.7, when i touch the ring it force closes. below is the log.

    please help.

    01-12 14:34:11.787: E/AndroidRuntime(9479): android.content.res.Resources$NotFoundException: Array resource ID #0x0 01-12 14:34:11.787: E/AndroidRuntime(9479): at android.content.res.Resources.obtainTypedArray(Resources.java:432) 01-12 14:34:11.787: E/AndroidRuntime(9479): at net.sebastianopoggi.ui.GlowPadBackport.GlowPadView.loadDescriptions(GlowPadView.java:1359) 01-12 14:34:11.787: E/AndroidRuntime(9479): at net.sebastianopoggi.ui.GlowPadBackport.GlowPadView.getTargetDescription(GlowPadView.java:1336) 01-12 14:34:11.787: E/AndroidRuntime(9479): at net.sebastianopoggi.ui.GlowPadBackport.GlowPadView.announceTargets(GlowPadView.java:1321) 01-12 14:34:11.787: E/AndroidRuntime(9479): at net.sebastianopoggi.ui.GlowPadBackport.GlowPadView.switchToState(GlowPadView.java:379) 01-12 14:34:11.787: E/AndroidRuntime(9479): at net.sebastianopoggi.ui.GlowPadBackport.GlowPadView.trySwitchToFirstTouchState(GlowPadView.java:1059) 01-12 14:34:11.787: E/AndroidRuntime(9479): at net.sebastianopoggi.ui.GlowPadBackport.GlowPadView.handleDown(GlowPadView.java:841) 01-12 14:34:11.787: E/AndroidRuntime(9479): at net.sebastianopoggi.ui.GlowPadBackport.GlowPadView.onTouchEvent(GlowPadView.java:783)

    bug 
    opened by prashantwosti 8
  • Proguard warnings about android.util.FloatMath methods

    Proguard warnings about android.util.FloatMath methods

    When setting compileSdkVersion to 23 in my project, proguard shows these warnings:

    Warning: net.frakbot.glowpadbackport.PointCloud: can't find referenced method 'float cos(float)' in library class android.util.FloatMath
    Warning: net.frakbot.glowpadbackport.PointCloud: can't find referenced method 'float sin(float)' in library class android.util.FloatMath
    Warning: net.frakbot.glowpadbackport.PointCloud: can't find referenced method 'float sqrt(float)' in library class android.util.FloatMath
    
    wontfix 
    opened by calvarez-ov 4
  • IllegalStateException : Must specify atleast one target drawable

    IllegalStateException : Must specify atleast one target drawable

    Hi rock3r,

    Imported ur library in to my sample project but each time I try to run it I face this same error in GlowPadView.java

    at[ if(mTargetDrawables == null || mTargetDrawables.size()==0) ] - to be specific. That condition turns true and it throws the IllegalStateException as coded.

    What could be the reason? The library is untouched and none of the arrays,attrs are missing. It compiles successfully but throws an error at runtime.

    By the way, I am using AIDE for android. But looking at the nature of the error thrown, I don't think IDE has anything to do with it. Please respond soon. Even though this is not the main functionality of my app, its going to be a valuable addition. Thanks for ur effort to pull n port this library.

    bug 
    opened by peppy112 4
  • Update dependencies

    Update dependencies

    This PR updates the build config, cleans up some stuff, switches to bintray-release plugin from the hacky built-in script we were using, renames the modules to lib and app, and renames source folder paths to match actual (lowercase) package names.

    opened by rock3r 1
  • Double unlock required

    Double unlock required

    I have integrated your great glowpadview backport into one of my app on a lock screen activity. On the onTrigger event, a call to finish is performed. I have tested it on some devices and it works good. However I have a user who has reported an issue with his phone (Coolpad 8297 - Android 4.2.2):

    "When I get an incoming text and I try to unlock the custom lockscreen it suddenly gives me the inner slider lock again but now with a circle around it like it does when sliding to the right. Now I have to slide the slider to the right again, so twice in total to unlock. Unlike once when no incoming texts.

    Steps to reproduce are: I get incoming text, I press power button on phone, I wait for custom lock screen to load, I try to unlock, then I have to unlock it again since its somehow stuck when I get a text."

    Below is an image sent by the user: http://imgur.com/3F5VNmA

    Unfortunately, I haven't succeeded to reproduce the issue. I post the issue here because it is perhaps related to your backport implementation. In that case you will maybe have an idea about where the issue may come from?

    invalid 
    opened by lpellegr 1
  • allow use of custom drawables

    allow use of custom drawables

    From what I see, there is no way to use a generated drawable on any of the targets. Also, there's a replace replaceTargetDrawablesIfPresent() that takes Components. Can you also make the replaceTargetDrawables() public and take Drawable objects and resource ids?

    PS: From what I know, the use case of replaceTargetDrawablesIfPresent() is probably for something like launching custom apps(thus needing to get the app's launcher icon resource). It would also be handy to replace targets with custom Drawable objects.

    opened by tom91136 1
  • Android P - non-SDK interfaces and StateListDrawable

    Android P - non-SDK interfaces and StateListDrawable

    TargetDrawable.java uses reflection to access the getStateCount, which causes an error to popup in Android P

    mGetStateCount = StateListDrawable.class.getDeclaredMethod("getStateCount");

    49 | mGetStateCount.setAccessible(true);

    https://github.com/frakbot/GlowPadBackport/search?utf8=%E2%9C%93&q=StateListDrawable&type=

    opened by behelit 1
Releases(v2.1.1)
Owner
Frakbot
Frakbot
Provides 9-patch based drop shadow for view elements. Works on API level 9 or later.

Material Shadow 9-Patch This library provides 9-patch based drop shadow for view elements. Works on API level 14 or later. Target platforms API level

Haruki Hasegawa 481 Dec 19, 2022
A beautiful Android custom View that works similar to a range or seekbar. With animations.

ValueBar A beautiful Android custom View that works similar to a range or seekbar. Selection by gesture. With animations. Supporting API level 11+. De

Philipp Jahoda 147 Nov 20, 2022
Xamarin.Android provides open-source bindings of the Android SDK for use with .NET managed languages such as C#

Xamarin.Android Xamarin.Android provides open-source bindings of the Android SDK for use with .NET managed languages such as C#. Build Status Platform

Xamarin 1.8k Jan 5, 2023
A new canvas drawing library for Android. Aims to be the Fabric.js for Android. Supports text, images, and hand/stylus drawing input. The library has a website and API docs, check it out

FabricView - A new canvas drawing library for Android. The library was born as part of a project in SD Hacks (www.sdhacks.io) on October 3rd. It is cu

Antwan Gaggi 1k Dec 13, 2022
A convinience library for working with all versions of the Android Preference package from API v4 and up

UnifiedPreference UnifiedPreference is a library for working with all versions of the Android Preference package from API v4 and up. Features Easy to

Joel Pedraza 544 Nov 28, 2022
Android library used to create an awesome Android UI based on a draggable element similar to the last YouTube graphic component.

Draggable Panel DEPRECATED. This project is not maintained anymore. Draggable Panel is an Android library created to build a draggable user interface

Pedro Vicente Gómez Sánchez 3k Dec 6, 2022
TourGuide is an Android library that aims to provide an easy way to add pointers with animations over a desired Android View

TourGuide TourGuide is an Android library. It lets you add pointer, overlay and tooltip easily, guiding users on how to use your app. Refer to the exa

Tan Jun Rong 2.6k Jan 5, 2023
Bubbles for Android is an Android library to provide chat heads capabilities on your apps. With a fast way to integrate with your development.

Bubbles for Android Bubbles for Android is an Android library to provide chat heads capabilities on your apps. With a fast way to integrate with your

Txus Ballesteros 1.5k Jan 2, 2023
View that imitates Ripple Effect on click which was introduced in Android L (for Android 2.3+)

RippleView View that imitates Ripple Effect on click which was introduced in Android L. Usage For a working implementation, Have a look at the Sample

Muthuramakrishnan Viswanathan 1.2k Dec 30, 2022
MarkdownView is an Android webview with the capablity of loading Markdown text or file and display it as HTML, it uses MarkdownJ and extends Android webview.

About MarkdownView (Markdown For Android) is an Android library that helps you display Markdown text or files (local/remote) as formatted HTML, and st

Feras Alnatsheh 1k Dec 20, 2022
SwipeBack for Android Activities to do pretty the same as the android "back-button" will do, but in a really intuitive way by using a swipe gesture

SwipeBack SwipeBack is for Android Activities to do pretty the same as the android "back-button" will do, but in a really intuitive way by using a swi

Hannes Dorfmann 697 Dec 14, 2022
Wizard Pager is a library that provides an example implementation of a Wizard UI on Android, it's based of Roman Nurik's wizard pager (https://github.com/romannurik/android-wizardpager)

Wizard Pager Wizard Pager is a library that provides an example implementation of a Wizard UI on Android, it's based of Roman Nurik's wizard pager (ht

Julián Suárez 520 Nov 11, 2022
Make your native android Toasts Fancy. A library that takes the standard Android toast to the next level with a variety of styling options. Style your toast from code.

FancyToast-Android Prerequisites Add this in your root build.gradle file (not your module build.gradle file): allprojects { repositories { ... ma

Shashank Singhal 1.2k Dec 26, 2022
Make your native android Dialog Fancy. A library that takes the standard Android Dialog to the next level with a variety of styling options. Style your dialog from code.

FancyAlertDialog-Android Prerequisites Add this in your root build.gradle file (not your module build.gradle file): allprojects { repositories { ..

Shashank Singhal 350 Dec 9, 2022
A Tinder-like Android library to create the swipe cards effect. You can swipe left or right to like or dislike the content.

Swipecards Travis master: A Tinder-like cards effect as of August 2014. You can swipe left or right to like or dislike the content. The library create

Dionysis Lorentzos 2.3k Dec 9, 2022
Bootstrap style widgets for Android, with Glyph Icons

Android-Bootstrap Android Bootstrap is an Android library which provides custom views styled according to the Twitter Bootstrap Specification. This al

Bearded Hen 7.3k Jan 3, 2023
[] A fast PDF reader component for Android development

This project is no longer maintained. You can find a good replacement here, which is a fork relying on Pdfium instead of Vudroid/MuPDF for decoding PD

Joan Zapata 2.8k Dec 16, 2022
[] Define and render UI specs on top of your Android UI

dspec A simple way to define and render UI specs on top of your Android UI. Usage Enclose the target UI with a DesignSpecFrameLayout, usually the root

Lucas Rocha 561 Dec 16, 2022