use of com.foobnix.dao2.FileMeta in project LibreraReader by foobnix.
the class AppDB method addRecent.
public void addRecent(String path) {
if (!UITab.isShowRecent()) {
return;
}
if (!new File(path).isFile()) {
LOG.d("Can't add to recent, it's not a file", path);
return;
}
LOG.d("Add Recent", path);
FileMeta load = getOrCreate(path);
load.setIsRecent(true);
load.setIsRecentTime(System.currentTimeMillis());
fileMetaDao.update(load);
}
use of com.foobnix.dao2.FileMeta in project LibreraReader by foobnix.
the class AppDB method clearAllRecent.
public void clearAllRecent() {
List<FileMeta> recent = getRecent();
for (FileMeta meta : recent) {
meta.setIsRecent(false);
}
fileMetaDao.updateInTx(recent);
}
use of com.foobnix.dao2.FileMeta in project LibreraReader by foobnix.
the class AppDB method addStarFile.
public void addStarFile(String path) {
if (!new File(path).isFile()) {
LOG.d("Can't add to recent, it's not a file", path);
return;
}
LOG.d("addStarFile", path);
FileMeta load = getOrCreate(path);
load.setIsStar(true);
load.setIsStarTime(System.currentTimeMillis());
load.setCusType(FileMetaAdapter.DISPLAY_TYPE_FILE);
fileMetaDao.update(load);
}
use of com.foobnix.dao2.FileMeta in project LibreraReader by foobnix.
the class RecentUpates method updateAll.
@TargetApi(25)
public static void updateAll(final Context c) {
if (c == null) {
return;
}
LOG.d("RecentUpates", "MUPDF!", c.getClass());
try {
{
Intent intent = new Intent(c, RecentBooksWidget.class);
intent.setAction("android.appwidget.action.APPWIDGET_UPDATE");
c.sendBroadcast(intent);
}
} catch (Exception e) {
LOG.e(e);
}
if (Build.VERSION.SDK_INT >= 25) {
try {
FileMeta recentLast = AppDB.get().getRecentLast();
if (recentLast != null) {
ShortcutManager shortcutManager = c.getSystemService(ShortcutManager.class);
String url = IMG.toUrl(recentLast.getPath(), ImageExtractor.COVER_PAGE, IMG.getImageSize());
Bitmap image = ImageLoader.getInstance().loadImageSync(url, IMG.displayCacheMemoryDisc);
Intent lastBookIntent = new Intent(c, VerticalViewActivity.class);
if (AppState.get().isAlwaysOpenAsMagazine) {
lastBookIntent = new Intent(c, HorizontalViewActivity.class);
}
lastBookIntent.setAction(Intent.ACTION_VIEW);
lastBookIntent.setData(Uri.fromFile(new File(recentLast.getPath())));
ShortcutInfo shortcut = //
new ShortcutInfo.Builder(c, "last").setShortLabel(//
recentLast.getTitle()).setLongLabel(//
TxtUtils.getFileMetaBookName(recentLast)).setIcon(//
Icon.createWithBitmap(image)).setIntent(//
lastBookIntent).build();
Intent tTSIntent = new Intent(c, TTSActivity.class);
tTSIntent.setData(Uri.fromFile(new File(recentLast.getPath())));
tTSIntent.setAction(Intent.ACTION_VIEW);
ShortcutInfo tts = //
new ShortcutInfo.Builder(c, "tts").setShortLabel(//
c.getString(R.string.reading_out_loud)).setLongLabel(//
c.getString(R.string.reading_out_loud)).setIcon(//
Icon.createWithBitmap(image)).setIntent(//
tTSIntent).build();
shortcutManager.setDynamicShortcuts(Arrays.asList(tts, shortcut));
// shortcutManager.setDynamicShortcuts(Arrays.asList(shortcut));
}
} catch (Exception e) {
LOG.e(e);
}
}
}
use of com.foobnix.dao2.FileMeta in project LibreraReader by foobnix.
the class ExportSettingsManager method fileMetaTagToJSON.
public static JSONArray fileMetaTagToJSON(List<FileMeta> list) {
JSONArray jsonObject = new JSONArray();
if (list == null) {
return jsonObject;
}
for (FileMeta value : list) {
JSONObject obj = new JSONObject();
try {
obj.put("path", value.getPath());
obj.put("tag", value.getTag());
} catch (Exception e) {
LOG.e(e);
}
jsonObject.put(obj);
}
return jsonObject;
}
Aggregations