Skip to content

Commit

Permalink
Let's start with 0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
michelelacorte authored Dec 5, 2016
1 parent 8e04145 commit 58e960e
Showing 1 changed file with 101 additions and 2 deletions.
103 changes: 101 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ This project needs you! If you would like to support this project's further deve
Of course, you can also choose what you want to donate, all donations are awesome!!

<img align="left" src="https://s15.postimg.org/km4eygofv/ic_launcher.png">
#v1.0.0 (Coming Soon)
#v0.1.0 (Coming Soon)

###Here we are!
###The touch force is ready and is going to get on the custom launcher !!
Expand All @@ -46,6 +46,103 @@ Of course, you can also choose what you want to donate, all donations are awesom
###Stay Tuned!
###For other detail to use force touch follow [Force Touch](https://github.com/michelelacorte/ForceTouch)

##USAGE

Add this to `build.gradle`

```groovy
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
}
```

Than add this dependencies

```groovy
compile 'com.github.michelelacorte:AndroidShortcuts:0.1.0'
```

Now let's start to create Shortcuts!

```groovy
//Layout for shortcuts
private AdapterView gridView;
private RelativeLayout activityParent;
```

Than in MainActivity

```
activityParent = (RelativeLayout) findViewById(R.id.activity_main);
gridView=(GridView) findViewById(R.id.gridView);
gridView.setAdapter(new MyArrayAdapter(this, R.layout.app_grid_item));
//Create Shortcuts
final ShortcutsCreation shortcutsCreation = new ShortcutsCreation(MainActivity.this, activityParent, gridView);
//Create gesture detector for onLongPress
final GestureDetector gestureDetector = new GestureDetector(getApplicationContext(), new GestureDetector.OnGestureListener() {
@Override
public boolean onDown(MotionEvent motionEvent) {
shortcutsCreation.clearAllLayout();
return false;
}
@Override
public void onShowPress(MotionEvent motionEvent) {
shortcutsCreation.clearAllLayout();
}
@Override
public boolean onSingleTapUp(MotionEvent motionEvent) {
shortcutsCreation.clearAllLayout();
return false;
}
@Override
public boolean onScroll(MotionEvent motionEvent, MotionEvent motionEvent1, float v, float v1) {
shortcutsCreation.clearAllLayout();
return false;
}
@Override
public void onLongPress(MotionEvent motionEvent) {
//Make sure to clear layout before create new
shortcutsCreation.clearAllLayout();
//Now create shortcuts!!
shortcutsCreation.createShortcuts((int)motionEvent.getX(), (int)motionEvent.getY(),
new Shortcuts(R.mipmap.ic_launcher, "Shortcuts", new View.OnClickListener() {
@Override
public void onClick(View view) {
Toast.makeText(getApplicationContext(), "Hello Shortcuts!!", Toast.LENGTH_LONG).show();
}
}),
new Shortcuts(R.mipmap.ic_launcher, "Hello!"));
}
@Override
public boolean onFling(MotionEvent motionEvent, MotionEvent motionEvent1, float v, float v1) {
shortcutsCreation.clearAllLayout();
return false;
}
});
// Set custom touch listener
gridView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
return gestureDetector.onTouchEvent(motionEvent);
}
});
```

Coming soon with [Force Touch](https://github.com/michelelacorte/ForceTouch) implementation

##SYSTEM REQUIREMENT

Android API 14+
Expand All @@ -56,8 +153,10 @@ Android API 14+

##CHANGELOG

**v1.0.0 (Coming Soon!)**
**v0.1.0 (Coming Soon!)**
- Support API 14+ (API 25 Compatible)
- Added params `ShorcutsCreation` class for initialize `gridView` and `parentLayout`
- Added `Shortcuts` class for create your custom shortcuts!!

##CREDITS

Expand Down

0 comments on commit 58e960e

Please sign in to comment.