ForceTouch


Source link: https://github.com/michelelacorte/ForceTouch

ForceTouch

Simple implementation of ForceTouch on Android

##WHAT IS FORCE TOUCH?

You know that Android already detects different screen pressure from API 5? (Eclair, Android 2.0)

Well, I wanted to enlighten you about it, I created a library for Android that takes advantage of this property to implement the Force Touch (or 3D Touch), I have also created a dedicated app to give the opportunity for developers and not, try this library, the app is on the Play Store.

This library can also be used on the launcher and by doing so you can implement ForceTouch on icons of the applications, not using the Long Press (shortcut) introduced in android 7.1. I set myself a custom launcher to test the touch force and are currently in the testing phase, just ready you will see everything on GitHub.

##DONATIONS

This project needs you! If you would like to support this project's further development, the creator of this project or the continuous maintenance of this project, feel free to donate. Your donation is highly appreciated (and I love food, coffee and beer). Thank you!

PayPal

  • Donate $5: Thank's for creating this project, here's a coffee (or some beer) for you!

  • Donate $10: Wow, I am stunned. Let me take you to the movies!ù

  • Donate $15: I really appreciate your work, let's grab some lunch!

  • Donate $25: That's some awesome stuff you did right there, dinner is on me!

  • Donate $50: I really really want to support this project, great job!

  • Donate $100: You are the man! This project saved me hours (if not days) of struggle and hard work, simply awesome!

  • Donate $2799: Go buddy, buy Macbook Pro for yourself!

Of course, you can also choose what you want to donate! All donations are awesome!! Follow this link Donate!!

If you want to contribute you may download Donation App from Google Play

#v2.0.0 Big Update!! (Coming Soon)

###Here we are! ###The touch force is ready and is going to get on the custom launcher !!

###As promised I've implemented Force Touch in my custom launcher ... and you see the picture

###Yes, I'm working with shortcuts Android 7.1 Nougat! and will soon be available for custom launcher from API 14 !! ###See an example here (beta)

###I've also implemented Activity to calibrate Force Touch depending on screen device!! ###Stay Tuned! ###For changelog see v2.0.0 in CHANGELOG section

##EXAMPLE

####Force Touch is on Google Play!!!

####If you want to help me please download Donation App!!

##USAGE

Add this to build.gradle

allprojects {

  repositories {

jcenter()

maven {
 url "https://jitpack.io" 
}

  
}
 
}

Than add this dependencies

compile 'com.github.michelelacorte:ForceTouch:1.0.1'
final ForceTouchListener forceTouchListener = new ForceTouchListener(getApplicationContext(), 70, 0.27f, true, true, new Callback() {

 @Override

 public void onForceTouch() {

  //functionToInvokeOnForceTouch();


 
}

  @Override

 public void onNormalTouch() {

//functionToInvokeOnNormalTouch();
 

 
}

}
);

Than you can use Listener with setOnTouchListener method of View

view.setOnTouchListener(forceTouchListener);

##SYSTEM REQUIREMENT

Android API 14+

##STATUS

##CHANGELOG

v2.0.0 (Coming Soon!)

  • Added params View view, MotionEvent motionEvent to onNormalTouch and onForceTouch callback method
  • Added ForceTouchGestureListener for set force touch to custom Launcher! (similar to ForceTouchListener class)
  • Added Activity Calibration to calibrate force touch before use it!

v1.0.1

  • Added isProgressive boolean to detect progressive pressure! (Default false).
  • Added isVibrate boolean to set vibration.
  • Added method onNormalTouch to Callback interface, the method is invoked when pressure is low (not overtake pressureLimit).
  • Interface ForceTouchExecution renamed with Callback.
  • Improved example App.

v1.0.0

  • Support API 14+ (API 25 Compatible)
  • Added class ForceTouchListener with constructor to create Force Touch witch custom param.
  • Added interface ForceTouchExecution with method onForceTouch for define custom action onForceTouch detected.
  • Added example App.

##CREDITS

Author: Michele Lacorte ( [email protected])

Follow my Google+

##CONTRIBUTING

If you want to contribute to the project fork it and open Pull Request, or contact me by e-mail.

Each proposal will be accepted!

##LICENSE

Copyright 2016 Michele Lacorte  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. 

Support on Beerpay

Hey dude! Help me out for a couple of 🍻!

Resources

okio made easy, yo.

A Searchable Spinner with customizable color and a nice reveal animation.

The Sweetest way into connecting to your server. Now min SDK is 3!

This is an Image slider with swipes.

The widgets (EditText and TextView) for support of money requirements like currency, number formatting, comma formatting etc.

  • EasyMoneyEditText and EasyMoneyTextView widgets
  • Custom currency support added through string symbol, Locales, or Currency objects
  • Commas formatting support added
  • Show/hide currency symbol
  • Show/hide commas in the widgets
  • Get raw value in string or formatted value in string

RxTasks is a lightweight wrapper for the GMS Tasks API, more commonly recognized when using asynchronous results from Firebase requests.

Typically the Tasks API would allow you to add listeners that may be scoped to an activity or executor, however this is not needed since scheduling and Disposable's are handled by the user.

Please note that this library uses RxJava2 so calls must respect Completable and Single chains.

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