mirror of
https://github.com/syncthing/syncthing-android.git
synced 2024-12-23 03:11:30 +00:00
Allow opening folder in other app by long clicking (fixes #175).
Unfortunately, there is no folder mime type that seems to work with popular file managers, so we use '*/*', which means the list contains a lot of apps that don't make sense.
This commit is contained in:
parent
e131849171
commit
c8f0df35fa
1 changed files with 17 additions and 1 deletions
|
@ -1,8 +1,11 @@
|
|||
package com.nutomic.syncthingandroid.fragments;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.support.v4.app.ListFragment;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
|
||||
|
@ -19,7 +22,7 @@ import java.util.TimerTask;
|
|||
* Displays a list of all existing folders.
|
||||
*/
|
||||
public class FoldersFragment extends ListFragment implements SyncthingService.OnApiChangeListener,
|
||||
AdapterView.OnItemClickListener {
|
||||
AdapterView.OnItemClickListener, AdapterView.OnItemLongClickListener {
|
||||
|
||||
private FoldersAdapter mAdapter;
|
||||
|
||||
|
@ -56,6 +59,7 @@ public class FoldersFragment extends ListFragment implements SyncthingService.On
|
|||
setListAdapter(mAdapter);
|
||||
setEmptyText(getString(R.string.folder_list_empty));
|
||||
getListView().setOnItemClickListener(this);
|
||||
getListView().setOnItemLongClickListener(this);
|
||||
}
|
||||
|
||||
private void updateList() {
|
||||
|
@ -94,4 +98,16 @@ public class FoldersFragment extends ListFragment implements SyncthingService.On
|
|||
startActivity(intent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens the folder path with a user selected app.
|
||||
*/
|
||||
@Override
|
||||
public boolean onItemLongClick(AdapterView<?> adapterView, View view, int i, long l) {
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||
Uri uri = Uri.parse(mAdapter.getItem(i).Path);
|
||||
intent.setDataAndType(uri, "*/*");
|
||||
startActivity(intent);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue