use of com.foobnix.ui2.MainTabs2 in project LibreraReader by foobnix.
the class Keyboards method hideNavigation.
public static void hideNavigation(final Activity a) {
try {
if (a == null) {
return;
}
if (a instanceof MainTabs2 && !AppState.get().isFullScreenMain) {
return;
} else if (!AppState.get().isFullScreen) {
return;
}
final View decorView = a.getWindow().getDecorView();
decorView.postDelayed(new Runnable() {
@Override
public void run() {
if (Build.VERSION.SDK_INT >= 19) {
//
decorView.setSystemUiVisibility(//
View.SYSTEM_UI_FLAG_LAYOUT_STABLE | //
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | //
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | //
View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | //
View.SYSTEM_UI_FLAG_FULLSCREEN | //
View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
} else if (Build.VERSION.SDK_INT >= 14) {
//
decorView.setSystemUiVisibility(//
View.SYSTEM_UI_FLAG_LOW_PROFILE | //
View.SYSTEM_UI_FLAG_FULLSCREEN);
}
}
}, 100);
} catch (Exception e) {
LOG.e(e);
}
}
use of com.foobnix.ui2.MainTabs2 in project LibreraReader by foobnix.
the class ShareDialog method show.
public static void show(final Activity a, final File file, final Runnable onDeleteAction, final int page, final DocumentWrapperUI ui, final DocumentController dc) {
if (!ExtUtils.isExteralSD(file.getPath()) && ExtUtils.isNotValidFile(file)) {
Toast.makeText(a, R.string.file_not_found, Toast.LENGTH_LONG).show();
return;
}
final boolean isPDF = BookType.PDF.is(file.getPath());
// a instanceof MainTabs2 ? false :
final boolean isLibrary = false;
// true;
final boolean isMainTabs = a instanceof MainTabs2;
List<String> items = new ArrayList<String>();
if (isLibrary) {
items.add(a.getString(R.string.library));
}
if (dc != null) {
if (a instanceof VerticalViewActivity || AppState.get().isMusicianMode) {
items.add(AppState.get().nameHorizontalMode);
}
if (a instanceof HorizontalViewActivity || AppState.get().isMusicianMode) {
items.add(AppState.get().nameVerticalMode);
}
if (AppState.get().isMusicianMode == false) {
items.add(AppState.get().nameMusicianMode);
}
}
if (isPDF) {
items.add(a.getString(R.string.make_text_reflow));
}
items.add(a.getString(R.string.open_with));
items.add(a.getString(R.string.send_file));
items.add(a.getString(R.string.export_bookmarks));
final boolean canDelete = ExtUtils.isExteralSD(file.getPath()) ? true : file.canWrite();
final boolean isShowInfo = !ExtUtils.isExteralSD(file.getPath());
if (isMainTabs) {
if (canDelete) {
items.add(a.getString(R.string.delete));
}
items.add(a.getString(R.string.remove_from_library));
}
if (!isMainTabs) {
items.add(a.getString(R.string.send_snapshot_of_the_page) + " " + (Math.max(page, 0) + 1) + "");
}
items.add(a.getString(R.string.tags));
if (isShowInfo) {
items.add(a.getString(R.string.file_info));
}
final AlertDialog.Builder builder = new AlertDialog.Builder(a);
// builder.setTitle(R.string.choose_)//
builder.setItems(items.toArray(new String[items.size()]), new DialogInterface.OnClickListener() {
@Override
public void onClick(final DialogInterface dialog, final int which) {
int i = 0;
if (isLibrary && which == i++) {
a.finish();
MainTabs2.startActivity(a, UITab.getCurrentTabIndex(UITab.SearchFragment));
}
if (dc != null && (a instanceof HorizontalViewActivity || AppState.get().isMusicianMode) && which == i++) {
dc.onCloseActivityFinal(new Runnable() {
@Override
public void run() {
if (AppState.get().isMusicianMode) {
AppState.get().isAlwaysOpenAsMagazine = true;
} else {
AppState.get().isAlwaysOpenAsMagazine = false;
}
AppState.get().isMusicianMode = false;
ExtUtils.showDocumentWithoutDialog(a, file, page + 1);
}
});
}
if (dc != null && (a instanceof VerticalViewActivity || AppState.get().isMusicianMode) && which == i++) {
if (dc != null) {
dc.onCloseActivityFinal(new Runnable() {
@Override
public void run() {
if (AppState.get().isMusicianMode) {
AppState.get().isAlwaysOpenAsMagazine = false;
} else {
AppState.get().isAlwaysOpenAsMagazine = true;
}
AppState.get().isMusicianMode = false;
ExtUtils.showDocumentWithoutDialog(a, file, page + 1);
}
});
}
}
if (dc != null && AppState.get().isMusicianMode == false && which == i++) {
dc.onCloseActivityFinal(new Runnable() {
@Override
public void run() {
AppState.get().isMusicianMode = true;
AppState.get().isAlwaysOpenAsMagazine = false;
ExtUtils.showDocumentWithoutDialog(a, file, page + 1);
}
});
}
if (isPDF && which == i++) {
ExtUtils.openPDFInTextReflow(a, file, page + 1, dc);
}
if (which == i++) {
ExtUtils.openWith(a, file);
} else if (which == i++) {
ExtUtils.sendFileTo(a, file);
} else if (which == i++) {
ExtUtils.sendBookmarksTo(a, file);
} else if (isMainTabs && canDelete && which == i++) {
FileInformationDialog.dialogDelete(a, file, onDeleteAction);
} else if (isMainTabs && which == i++) {
FileMeta load = AppDB.get().load(file.getPath());
if (load != null) {
load.setIsSearchBook(false);
AppDB.get().update(load);
}
EventBus.getDefault().post(new UpdateAllFragments());
} else if (!isMainTabs && which == i++) {
if (dc != null) {
ExtUtils.sharePage(a, file, page, dc.getPageUrl(page).toString());
} else {
ExtUtils.sharePage(a, file, page, null);
}
} else if (which == i++) {
Dialogs.showTagsDialog(a, file, null);
} else if (isShowInfo && which == i++) {
FileInformationDialog.showFileInfoDialog(a, file, onDeleteAction);
}
}
});
AlertDialog create = builder.create();
create.setOnDismissListener(new OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
Keyboards.hideNavigation(a);
}
});
create.show();
}
Aggregations