use of com.foobnix.pdf.search.activity.msg.OpenDirMessage in project LibreraReader by foobnix.
the class DefaultListeners method getOnItemClickListener.
public static ResultResponse<FileMeta> getOnItemClickListener(final Activity a) {
return new ResultResponse<FileMeta>() {
@Override
public boolean onResultRecive(FileMeta result) {
if (isTagCicked(a, result)) {
return true;
}
final File item = new File(result.getPath());
if (item.isDirectory()) {
Intent intent = //
new Intent(UIFragment.INTENT_TINT_CHANGE).putExtra(MainTabs2.EXTRA_PAGE_NUMBER, //
UITab.getCurrentTabIndex(UITab.BrowseFragment));
LocalBroadcastManager.getInstance(a).sendBroadcast(intent);
EventBus.getDefault().post(new OpenDirMessage(result.getPath()));
} else {
ExtUtils.openFile(a, result);
}
return false;
}
};
}
use of com.foobnix.pdf.search.activity.msg.OpenDirMessage in project LibreraReader by foobnix.
the class DefaultListeners method getOnItemLongClickListener.
public static ResultResponse<FileMeta> getOnItemLongClickListener(final Activity a, final FileMetaAdapter searchAdapter) {
return new ResultResponse<FileMeta>() {
@Override
public boolean onResultRecive(final FileMeta result) {
if (ExtUtils.isExteralSD(result.getPath())) {
return false;
}
if (isTagCicked(a, result)) {
return true;
}
File item = new File(result.getPath());
if (item.isDirectory()) {
Intent intent = //
new Intent(UIFragment.INTENT_TINT_CHANGE).putExtra(MainTabs2.EXTRA_PAGE_NUMBER, //
UITab.getCurrentTabIndex(UITab.BrowseFragment));
LocalBroadcastManager.getInstance(a).sendBroadcast(intent);
EventBus.getDefault().post(new OpenDirMessage(result.getPath()));
return true;
}
Runnable onDeleteAction = new Runnable() {
@Override
public void run() {
deleteFile(a, searchAdapter, result);
}
};
if (ExtUtils.doifFileExists(a, item)) {
FileInformationDialog.showFileInfoDialog(a, item, onDeleteAction);
}
return true;
}
};
}
Aggregations