mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-05 02:39:23 +02:00
formatting cleanup
This commit is contained in:
parent
6aa822b126
commit
9db7ec0a18
11 changed files with 47 additions and 47 deletions
|
@ -106,7 +106,7 @@ public class BookmarksActivity extends TabActivity implements MenuItem.OnMenuIte
|
||||||
if (!Intent.ACTION_SEARCH.equals(intent.getAction())) {
|
if (!Intent.ACTION_SEARCH.equals(intent.getAction())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String pattern = intent.getStringExtra(SearchManager.QUERY);
|
String pattern = intent.getStringExtra(SearchManager.QUERY);
|
||||||
myBookmarkSearchPatternOption.setValue(pattern);
|
myBookmarkSearchPatternOption.setValue(pattern);
|
||||||
|
|
||||||
final LinkedList<Bookmark> bookmarks = new LinkedList<Bookmark>();
|
final LinkedList<Bookmark> bookmarks = new LinkedList<Bookmark>();
|
||||||
|
@ -192,8 +192,8 @@ public class BookmarksActivity extends TabActivity implements MenuItem.OnMenuIte
|
||||||
gotoBookmark(bookmark);
|
gotoBookmark(bookmark);
|
||||||
return true;
|
return true;
|
||||||
case EDIT_ITEM_ID:
|
case EDIT_ITEM_ID:
|
||||||
final Intent intent = new Intent(this, BookmarkEditActivity.class);
|
final Intent intent = new Intent(this, BookmarkEditActivity.class);
|
||||||
startActivityForResult(intent, 1);
|
startActivityForResult(intent, 1);
|
||||||
// TODO: implement
|
// TODO: implement
|
||||||
return true;
|
return true;
|
||||||
case DELETE_ITEM_ID:
|
case DELETE_ITEM_ID:
|
||||||
|
|
|
@ -33,7 +33,7 @@ public class SelectionBookmarkAction extends FBAndroidAction {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void run(Object ... params) {
|
protected void run(Object ... params) {
|
||||||
final FBView fbview = Reader.getTextView();
|
final FBView fbview = Reader.getTextView();
|
||||||
final String text = fbview.getSelectedText();
|
final String text = fbview.getSelectedText();
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ public class SelectionBookmarkAction extends FBAndroidAction {
|
||||||
text,
|
text,
|
||||||
true
|
true
|
||||||
).save();
|
).save();
|
||||||
fbview.clearSelection();
|
fbview.clearSelection();
|
||||||
|
|
||||||
UIUtil.showMessageText(
|
UIUtil.showMessageText(
|
||||||
BaseActivity,
|
BaseActivity,
|
||||||
|
|
|
@ -46,26 +46,26 @@ class SelectionPopup extends ButtonsPopupPanel {
|
||||||
|
|
||||||
myWindow = new PopupWindow(activity, root, PopupWindow.Location.Floating, false);
|
myWindow = new PopupWindow(activity, root, PopupWindow.Location.Floating, false);
|
||||||
|
|
||||||
addButton(ActionCode.SELECTION_COPY_TO_CLIPBOARD, true, R.drawable.selection_copy);
|
addButton(ActionCode.SELECTION_COPY_TO_CLIPBOARD, true, R.drawable.selection_copy);
|
||||||
addButton(ActionCode.SELECTION_SHARE, true, R.drawable.selection_share);
|
addButton(ActionCode.SELECTION_SHARE, true, R.drawable.selection_share);
|
||||||
addButton(ActionCode.SELECTION_TRANSLATE, true, R.drawable.selection_translate);
|
addButton(ActionCode.SELECTION_TRANSLATE, true, R.drawable.selection_translate);
|
||||||
addButton(ActionCode.SELECTION_BOOKMARK, true, R.drawable.selection_bookmark);
|
addButton(ActionCode.SELECTION_BOOKMARK, true, R.drawable.selection_bookmark);
|
||||||
addButton(ActionCode.SELECTION_CLEAR, true, R.drawable.selection_close);
|
addButton(ActionCode.SELECTION_CLEAR, true, R.drawable.selection_close);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void move(int selectionStartY, int selectionEndY) {
|
public void move(int selectionStartY, int selectionEndY) {
|
||||||
if (myWindow == null) {
|
if (myWindow == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(
|
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(
|
||||||
RelativeLayout.LayoutParams.WRAP_CONTENT,
|
RelativeLayout.LayoutParams.WRAP_CONTENT,
|
||||||
RelativeLayout.LayoutParams.WRAP_CONTENT
|
RelativeLayout.LayoutParams.WRAP_CONTENT
|
||||||
);
|
);
|
||||||
layoutParams.addRule(RelativeLayout.CENTER_HORIZONTAL);
|
layoutParams.addRule(RelativeLayout.CENTER_HORIZONTAL);
|
||||||
|
|
||||||
final int verticalPosition;
|
final int verticalPosition;
|
||||||
final int screenHeight = ((View)myWindow.getParent()).getHeight();
|
final int screenHeight = ((View)myWindow.getParent()).getHeight();
|
||||||
final int diffTop = screenHeight - selectionEndY;
|
final int diffTop = screenHeight - selectionEndY;
|
||||||
final int diffBottom = selectionStartY;
|
final int diffBottom = selectionStartY;
|
||||||
if (diffTop > diffBottom) {
|
if (diffTop > diffBottom) {
|
||||||
|
@ -76,7 +76,7 @@ class SelectionPopup extends ButtonsPopupPanel {
|
||||||
? RelativeLayout.ALIGN_PARENT_TOP : RelativeLayout.CENTER_VERTICAL;
|
? RelativeLayout.ALIGN_PARENT_TOP : RelativeLayout.CENTER_VERTICAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
layoutParams.addRule(verticalPosition);
|
layoutParams.addRule(verticalPosition);
|
||||||
myWindow.setLayoutParams(layoutParams);
|
myWindow.setLayoutParams(layoutParams);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,20 +23,20 @@ import org.geometerplus.fbreader.fbreader.FBReaderApp;
|
||||||
import org.geometerplus.fbreader.fbreader.FBView;
|
import org.geometerplus.fbreader.fbreader.FBView;
|
||||||
|
|
||||||
public class SelectionTranslateAction extends FBAndroidAction {
|
public class SelectionTranslateAction extends FBAndroidAction {
|
||||||
SelectionTranslateAction(FBReader baseActivity, FBReaderApp fbreader) {
|
SelectionTranslateAction(FBReader baseActivity, FBReaderApp fbreader) {
|
||||||
super(baseActivity, fbreader);
|
super(baseActivity, fbreader);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void run(Object ... params) {
|
protected void run(Object ... params) {
|
||||||
final FBView fbview = Reader.getTextView();
|
final FBView fbview = Reader.getTextView();
|
||||||
DictionaryUtil.openTextInDictionary(
|
DictionaryUtil.openTextInDictionary(
|
||||||
BaseActivity,
|
BaseActivity,
|
||||||
fbview.getSelectedText(),
|
fbview.getSelectedText(),
|
||||||
fbview.getCountOfSelectedWords() == 1,
|
fbview.getCountOfSelectedWords() == 1,
|
||||||
fbview.getSelectionStartY(),
|
fbview.getSelectionStartY(),
|
||||||
fbview.getSelectionEndY()
|
fbview.getSelectionEndY()
|
||||||
);
|
);
|
||||||
fbview.clearSelection();
|
fbview.clearSelection();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue