本文整理汇总了Java中org.geometerplus.android.util.UIUtil类的典型用法代码示例。如果您正苦于以下问题:Java UIUtil类的具体用法?Java UIUtil怎么用?Java UIUtil使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
UIUtil类属于org.geometerplus.android.util包,在下文中一共展示了UIUtil类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: openTreeInternal
import org.geometerplus.android.util.UIUtil; //导入依赖的package包/类
private void openTreeInternal(FBTree tree, FBTree treeToSelect, boolean storeInHistory) {
switch (tree.getOpeningStatus()) {
case READY_TO_OPEN:
case ALWAYS_RELOAD_BEFORE_OPENING:
if (storeInHistory && !myCurrentKey.equals(tree.getUniqueKey())) {
myHistory.add(myCurrentKey);
}
onNewIntent(new Intent(this, getClass())
.setAction(OPEN_TREE_ACTION)
.putExtra(TREE_KEY_KEY, tree.getUniqueKey())
.putExtra(
SELECTED_TREE_KEY_KEY,
treeToSelect != null ? treeToSelect.getUniqueKey() : null
)
.putExtra(HISTORY_KEY, myHistory)
);
break;
case CANNOT_OPEN:
UIUtil.showErrorMessage(TreeActivity.this, tree.getOpeningStatusMessage());
break;
}
}
示例2: openTree
import org.geometerplus.android.util.UIUtil; //导入依赖的package包/类
private void openTree(final FBTree tree, final FBTree treeToSelect, final boolean storeInHistory) {
switch (tree.getOpeningStatus()) {
case WAIT_FOR_OPEN:
case ALWAYS_RELOAD_BEFORE_OPENING:
final String messageKey = tree.getOpeningStatusMessage();
if (messageKey != null) {
UIUtil.runWithMessage(
TreeActivity.this, messageKey,
new Runnable() {
public void run() {
tree.waitForOpening();
}
},
new Runnable() {
public void run() {
openTreeInternal(tree, treeToSelect, storeInHistory);
}
},
true
);
} else {
tree.waitForOpening();
openTreeInternal(tree, treeToSelect, storeInHistory);
}
break;
default:
openTreeInternal(tree, treeToSelect, storeInHistory);
break;
}
}
示例3: run
import org.geometerplus.android.util.UIUtil; //导入依赖的package包/类
@Override
protected void run(Object ... params) {
final String text = Reader.getTextView().getSelectedText();
Reader.getTextView().clearSelection();
final ClipboardManager clipboard =
(ClipboardManager)BaseActivity.getApplication().getSystemService(Application.CLIPBOARD_SERVICE);
clipboard.setText(text);
UIUtil.showMessageText(
BaseActivity,
ZLResource.resource("selection").getResource("textInBuffer").getValue().replace("%s", clipboard.getText())
);
}
示例4: runWithMessage
import org.geometerplus.android.util.UIUtil; //导入依赖的package包/类
@Override
public void runWithMessage(String key, Runnable action, Runnable postAction) {
final Activity activity =
((ZLAndroidLibrary)ZLAndroidLibrary.Instance()).getActivity();
if (activity != null) {
UIUtil.runWithMessage(activity, key, action, postAction, false);
} else {
action.run();
}
}
示例5: onNewIntent
import org.geometerplus.android.util.UIUtil; //导入依赖的package包/类
@Override
protected void onNewIntent(Intent intent) {
Log.i("MAIN", "onNewIntent");
OrientationUtil.setOrientation(this, intent);
if (!Intent.ACTION_SEARCH.equals(intent.getAction())) {
return;
}
String pattern = intent.getStringExtra(SearchManager.QUERY);
Log.i("MAIN", pattern + "");
myBookmarkSearchPatternOption.setValue(pattern);
final LinkedList<Bookmark> bookmarks = new LinkedList<Bookmark>();
pattern = pattern.toLowerCase();
for (Bookmark b : myAllBooksAdapter.bookmarks()) {
Log.i("MAIN", b.getText());
if (MiscUtil.matchesIgnoreCase(b.getText(), pattern)) {
bookmarks.add(b);
}
}
//
if (!bookmarks.isEmpty()) {
showSearchResultsTab(bookmarks);
} else {
UIUtil.showErrorMessage(this, "bookmarkNotFound");
}
}
示例6: gotoBookmark
import org.geometerplus.android.util.UIUtil; //导入依赖的package包/类
private void gotoBookmark(Bookmark bookmark) {
bookmark.markAsAccessed();
myCollection.saveBookmark(bookmark);
final Book book = myCollection.getBookById(bookmark.getBookId());
if (book != null) {
CoreReadActivity.openBookActivity(this, book, bookmark);
} else {
UIUtil.showErrorMessage(this, "cannotOpenBook");
}
}
示例7: onSearchEvent
import org.geometerplus.android.util.UIUtil; //导入依赖的package包/类
private void onSearchEvent(final boolean found) {
runOnUiThread(new Runnable() {
public void run() {
if (found) {
openSearchResults();
} else {
UIUtil.showErrorMessage(LibraryActivity.this, "bookNotFound");
}
}
});
}
示例8: runWithMessage
import org.geometerplus.android.util.UIUtil; //导入依赖的package包/类
@Override
public void runWithMessage(String key, Runnable action, Runnable postAction)
{
UIUtil.runWithMessage(this, key, action, postAction, false);
}
示例9: installDictionary
import org.geometerplus.android.util.UIUtil; //导入依赖的package包/类
private static void installDictionary(Activity activity, PackageInfo dictionaryInfo) {
if (!PackageUtil.installFromMarket(activity, dictionaryInfo.PackageName)) {
UIUtil.showErrorMessage(activity, "cannotRunAndroidMarket", dictionaryInfo.Title);
}
}
示例10: onNewIntent
import org.geometerplus.android.util.UIUtil; //导入依赖的package包/类
@Override
protected void onNewIntent(final Intent intent) {
Log.i("TAG", "onNewIntent()");
final String action = intent.getAction();
final Uri data = intent.getData();
if ((intent.getFlags() & Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY) != 0) {
super.onNewIntent(intent);
} else if (Intent.ACTION_VIEW.equals(action) && data != null
&& "fbreader-action".equals(data.getScheme())) {
myFBReaderApp.runAction(data.getEncodedSchemeSpecificPart(),
data.getFragment());
} else if (ACTION_OPEN_BOOK.equals(action)) {
getCollection().bindToService(this, new Runnable() {
public void run() {
Log.i("TAG", "openBook()");
openBook(intent, null, true);
}
});
} else if (Intent.ACTION_SEARCH.equals(action)) {
final String pattern = intent.getStringExtra(SearchManager.QUERY);
final Runnable runnable = new Runnable() {
public void run() {
final TextSearchPopup popup = (TextSearchPopup) myFBReaderApp
.getPopupById(TextSearchPopup.ID);
popup.initPosition();
myFBReaderApp.TextSearchPatternOption.setValue(pattern);
if (myFBReaderApp.getTextView().search(pattern, true,
false, false, false) != 0) {
runOnUiThread(new Runnable() {
public void run() {
myFBReaderApp.showPopup(popup.getId());
}
});
} else {
runOnUiThread(new Runnable() {
public void run() {
UIUtil.showErrorMessage(CoreReadActivity.this,
"textNotFound");
popup.StartPosition = null;
}
});
}
}
};
UIUtil.wait("search", runnable, this);
} else {
super.onNewIntent(intent);
}
}