All Projects → nantaphop → Hovertouchview

nantaphop / Hovertouchview

Stimulate Apple's Force Touch or 3D Touch on Android App with Hover Gesture

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Hovertouchview

React Gesture Responder
a gesture responder system for your react application
Stars: ✭ 99 (-48.44%)
Mutual labels:  gesture, touch
gesto
You can set up drag, pinch events in any browser.
Stars: ✭ 47 (-75.52%)
Mutual labels:  touch, gesture
gestures
A library for normalized events and gesture for desktop and mobile.
Stars: ✭ 31 (-83.85%)
Mutual labels:  touch, gesture
Better Gesture
A gesture library use for pc, mobile, vue, and mini programs
Stars: ✭ 419 (+118.23%)
Mutual labels:  gesture, touch
Any Touch
👋 手势库, 按需2kb~5kb, 兼容PC / 移动端
Stars: ✭ 567 (+195.31%)
Mutual labels:  gesture, touch
React Native Swipe Gestures
4-directional swipe gestures for react-native
Stars: ✭ 471 (+145.31%)
Mutual labels:  gesture, touch
Alloyfinger
Super tiny size multi-touch gestures library for the web.    You can touch this →
Stars: ✭ 3,244 (+1589.58%)
Mutual labels:  gesture, touch
Touchkit
基于mtouch封装的,更便于业务使用的贴纸手势库
Stars: ✭ 48 (-75%)
Mutual labels:  gesture, touch
Zingtouch
A JavaScript touch gesture detection library for the modern web
Stars: ✭ 2,019 (+951.56%)
Mutual labels:  gesture, touch
C2mstoryviewer
This repository contains a detailed sample app for displaying stories like Instagram.
Stars: ✭ 175 (-8.85%)
Mutual labels:  instagram
Lantern
基于Swift的高可用视图框架
Stars: ✭ 181 (-5.73%)
Mutual labels:  gesture
Vue Instagram
Instagram's feed fetcher component based on Vue.js
Stars: ✭ 173 (-9.9%)
Mutual labels:  instagram
Instagram Crawler
Crawl instagram photos, posts and videos for download.
Stars: ✭ 178 (-7.29%)
Mutual labels:  instagram
Instauto
Instagram bot / automation library written in Javascript for Node.js
Stars: ✭ 184 (-4.17%)
Mutual labels:  instagram
Insta Mass Account Creator
User Friendly - Instagram Auto Account Creation Bot 🤖
Stars: ✭ 173 (-9.9%)
Mutual labels:  instagram
Pixel
📷 A composable image editor using Core Image and Metal.
Stars: ✭ 2,495 (+1199.48%)
Mutual labels:  instagram
Rxiglistkit
IGListKit with RxSwift🚀
Stars: ✭ 174 (-9.37%)
Mutual labels:  instagram
Slider
Touch swipe image slider/slideshow/gallery/carousel/banner mobile responsive bootstrap
Stars: ✭ 2,046 (+965.63%)
Mutual labels:  touch
Faimagecropper
Image Cropper like Instagram
Stars: ✭ 188 (-2.08%)
Mutual labels:  instagram
Instagramclone
A detailed clone of the Instagram app built with the Firebase database
Stars: ✭ 186 (-3.12%)
Mutual labels:  instagram

HoverTouchView

Stimulate Apple's Force Touch or 3D Touch on Android App with Hover Gesture

NOTED: Hover in this case is gesture that user hold a touch in the view. This Lib implemented by View.OnTouchListener, MotionEvent.ACTION_DOWN and MotionEvent.ACTION_UP

Hover Touch Gif Watch in Youtube Click Here!

Welcome for Pull Request

Features

  • Allow Custom View as a Hover View
  • Built-in Blur Effect on Backgroud
  • Config for Animation Duration
  • Provide onStartHover() and onStopHover() for flexibility

Limitation

  • Root View Must Be FrameLayout(Because Hover View will add as a child in FrameLayout)

Setup

Gradle (jCenter)

  dependencies {
    compile 'com.nantaphop:hoverTouchView:0.1'
  }

Enable Renderscript for blur effect

android {
    ...
    defaultConfig {
        ...
        renderscriptTargetApi 20
        renderscriptSupportModeEnabled true
    }
}

Usage

This library work as a util class that call setOnTouchListener(...) to the view that you want user to hold a finger to see more information. Basically, I provided HoverTouchAble interface that you have to implement on your Custom View Class that act as a hover area such as Thumbnail, List Item, Cover Image

public interface HoverTouchAble{
    public View getHoverView(); // return view that appear when user hold touch on this view
    public int getHoverAnimateDuration(); // return duration(ms) for show/hide Hover View Animation
    public void onStartHover(); // Callback when user start hover this view
    public void onStopHover(); // Callback when user stop hover this view
}

Then use helper class to initial hover view

MyThumbnail pic1 = (MyThumbnail) findViewById(R.id.pic1);
HoverTouchHelper.make(root, pic1);

Example

Custom Image View as Thumbnail

public class MyThumbnail extends ImageView implements HoverTouchAble {
  ...
  
    @Override
    public View getHoverView() {
        return new MyThumbnailExpand(getContext(), getDrawable(), "Description Text For Photo");
    }

    @Override
    public int getHoverAnimateDuration() {
        return 300;
    }

    @Override
    public void onStartHover() {
        Toast.makeText(getContext(), "Start Hover", Toast.LENGTH_SHORT).show();
    }

    @Override
    public void onStopHover() {
        Toast.makeText(getContext(), "Stop Hover", Toast.LENGTH_SHORT).show();
    }
}

Create Your Custom View that show when user hover

public class MyThumbnailExpand extends LinearLayout {
  ...
  public MyThumbnailExpand(Context context, Drawable drawable, String text) {
        super(context);
        this.drawable = drawable;
        this.text = text;
        init();
    }
    
  private void init(){
        inflate(getContext(), R.layout.view_my_thumbnail_expand, this);
        ImageView img = (ImageView) findViewById(R.id.img);
        TextView text = (TextView) findViewById(R.id.text);
        img.setImageDrawable(this.drawable);
        text.setText(this.text);

  }
}

Your Hover Able View must place in FrameLayout

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/root"
    ... >
    ...
    <com.nantaphop.hovertouchviewexample.widget.MyThumbnail
            android:id="@+id/pic1"
            android:layout_width="128dp"
            android:layout_height="128dp"
            android:src="@drawable/pic1" />
    ...
</FrameLayout>

Then, Use HoverTouchHelper to initial your hover view

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    MyThumbnail pic1 = (MyThumbnail) findViewById(R.id.pic1);
    MyThumbnail pic2 = (MyThumbnail) findViewById(R.id.pic2);
    MyThumbnail pic3 = (MyThumbnail) findViewById(R.id.pic3);
    MyThumbnail pic4 = (MyThumbnail) findViewById(R.id.pic4);
    HoverTouchHelper.make(root, pic1);
    HoverTouchHelper.make(root, pic2);
    HoverTouchHelper.make(root, pic3);
    HoverTouchHelper.make(root, pic4);
}

Acknowledgement

License

Copyright 2016 Nantaphop Phuengphae

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.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].