Skip to content

Instantly share code, notes, and snippets.

### Keybase proof
I hereby claim:
* I am hkosacki on github.
* I am hubko (https://keybase.io/hubko) on keybase.
* I have a public key ASDY-5h3iTgEONoqsToXyQANx6SCg09VOyX02GDVPsEDmAo
To claim this, I am signing this object:
@hkosacki
hkosacki / HalfCircleListView.java
Created September 3, 2018 11:08 — forked from ethankhall/HalfCircleListView.java
Half Circle List View
import android.widget.ListView;
import android.widget.AbsListView;
import android.content.Context;
public class HalfCircleListView extends ListView implements AbsListView.OnScrollListener {
public HalfCircleListView(Context context) {
super(context);
setOnScrollListener(this);
}
@hkosacki
hkosacki / multi-git.md
Created November 6, 2017 07:20 — forked from rosswd/multi-git-win.md
Setting up a Github and Bitbucket account on the same computer.

Setting up github and bitbucket on the same computer

Github will be the main account and bitbucket the secondary.

Create SSH Keys

ssh-keygen -t rsa -C "github email"

Enter passphrase when prompted. If you see an option to save the passphrase in your keychain, do it for an easier life.

/*
* Used to register to each adapter item, to handle long click events
*/
private OnItemLongClickListener longClickListener = new OnItemLongClickListener<File>() {
@Override
public void onItemLongClick(View view, File f) {
if (f.isDirectory()) {
Snackbar.make(view, "Sorry, no drag'n'drop support for directories", Snackbar.LENGTH_SHORT).show();
return;
}
ClipDescription description = new ClipDescription(f.getName(), new String[]{ClipDescription.MIMETYPE_TEXT_URILIST});
ClipData.Item clipDataItem = new ClipData.Item(Uri.fromFile(f));
ClipData draggedData = new ClipData(description, clipDataItem);
View.DragShadowBuilder dragShadowBuilder = new View.DragShadowBuilder(view);
// start drag'n'drop operation with Nougat flags
view.startDragAndDrop(draggedData, dragShadowBuilder, null, View.DRAG_FLAG_OPAQUE | View.DRAG_FLAG_GLOBAL);
ClipDescription description = new ClipDescription(null, new String[]{ClipDescription.MIMETYPE_TEXT_PLAIN});
ClipData.Item clipDataItem = new ClipData.Item("myItem");
ClipData draggedData = new ClipData(description, clipDataItem);
View.DragShadowBuilder dragShadowBuilder = new View.DragShadowBuilder(view);
// start drag'n'drop operation with Nougat flags
view.startDragAndDrop(draggedData, dragShadowBuilder, null, View.DRAG_FLAG_OPAQUE | View.DRAG_FLAG_GLOBAL);
ClipDescription description = new ClipDescription(null, new String[]{ClipDescription.MIMETYPE_TEXT_PLAIN});
ClipData.Item clipDataItem = new ClipData.Item("myItem");
ClipData draggedData = new ClipData(description, clipDataItem);
View.DragShadowBuilder dragShadowBuilder = new View.DragShadowBuilder(view);
// start drag'n'drop operation
view.startDragAndDrop(draggedData, dragShadowBuilder, null, 0);
ClipDescription description = new ClipDescription(f.getName(), new String[]{ClipDescription.MIMETYPE_TEXT_URILIST});
ClipData.Item clipDataItem = new ClipData.Item(Uri.fromFile(f));
ClipData draggedData = new ClipData(description, clipDataItem);
View.DragShadowBuilder dragShadowBuilder = new View.DragShadowBuilder(view);
// start drag'n'drop operation
view.startDrag(draggedData, dragShadowBuilder, null, 0);
@hkosacki
hkosacki / consumingDragEvent.java
Last active October 25, 2016 13:52
Drag and drop - Android Nougat 7.0
imageTrash.setOnDragListener(new View.OnDragListener() {
@Override
public boolean onDrag(View view, DragEvent dragEvent) {
switch(dragEvent.getAction()){
case DragEvent.ACTION_DRAG_STARTED:
case DragEvent.ACTION_DRAG_ENTERED:
case DragEvent.ACTION_DRAG_LOCATION:
case DragEvent.ACTION_DRAG_EXITED:
case DragEvent.ACTION_DRAG_ENDED:
return true;