1
0
Fork 0
mirror of https://github.com/geometer/FBReaderJ.git synced 2025-10-05 02:39:23 +02:00

formatting cleanup

This commit is contained in:
Nikolay Pultsin 2012-04-18 03:27:07 +01:00
parent 6aa822b126
commit 9db7ec0a18
11 changed files with 47 additions and 47 deletions

View file

@ -88,7 +88,7 @@ public class BookmarksActivity extends TabActivity implements MenuItem.OnMenuIte
myThisBookBookmarks.add(bookmark); myThisBookBookmarks.add(bookmark);
} }
} }
myThisBookView = createTab("thisBook", R.id.this_book); myThisBookView = createTab("thisBook", R.id.this_book);
new BookmarksAdapter(myThisBookView, myThisBookBookmarks, true); new BookmarksAdapter(myThisBookView, myThisBookBookmarks, true);
} else { } else {
@ -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:
@ -294,7 +294,7 @@ public class BookmarksActivity extends TabActivity implements MenuItem.OnMenuIte
public final long getItemId(int position) { public final long getItemId(int position) {
return position; return position;
} }
public final Bookmark getItem(int position) { public final Bookmark getItem(int position) {
if (myCurrentBook) { if (myCurrentBook) {
--position; --position;

View file

@ -33,18 +33,18 @@ 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();
new Bookmark( new Bookmark(
Reader.Model.Book, Reader.Model.Book,
fbview.getModel().getId(), fbview.getModel().getId(),
fbview.getSelectionStartPosition(), fbview.getSelectionStartPosition(),
text, text,
true true
).save(); ).save();
fbview.clearSelection(); fbview.clearSelection();
UIUtil.showMessageText( UIUtil.showMessageText(
BaseActivity, BaseActivity,

View file

@ -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);
} }
} }

View file

@ -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();
} }
} }

View file

@ -280,7 +280,7 @@ public class BookInfoActivity extends Activity {
setupInfoPair(R.id.file_name, "name", book.File.getPath()); setupInfoPair(R.id.file_name, "name", book.File.getPath());
if (ENABLE_EXTENDED_FILE_INFO) { if (ENABLE_EXTENDED_FILE_INFO) {
setupInfoPair(R.id.file_type, "type", book.File.getExtension()); setupInfoPair(R.id.file_type, "type", book.File.getExtension());
final ZLPhysicalFile physFile = book.File.getPhysicalFile(); final ZLPhysicalFile physFile = book.File.getPhysicalFile();
final File file = physFile == null ? null : physFile.javaFile(); final File file = physFile == null ? null : physFile.javaFile();
if (file != null && file.exists() && file.isFile()) { if (file != null && file.exists() && file.isFile()) {

View file

@ -141,7 +141,7 @@ public class LibraryActivity extends TreeActivity implements MenuItem.OnMenuItem
} else { } else {
super.onActivityResult(requestCode, returnCode, intent); super.onActivityResult(requestCode, returnCode, intent);
} }
} }
// //
// Search // Search
@ -177,7 +177,7 @@ public class LibraryActivity extends TreeActivity implements MenuItem.OnMenuItem
final int position = ((AdapterView.AdapterContextMenuInfo)menuInfo).position; final int position = ((AdapterView.AdapterContextMenuInfo)menuInfo).position;
final Book book = ((LibraryTree)getListAdapter().getItem(position)).getBook(); final Book book = ((LibraryTree)getListAdapter().getItem(position)).getBook();
if (book != null) { if (book != null) {
createBookContextMenu(menu, book); createBookContextMenu(menu, book);
} }
} }

View file

@ -66,7 +66,7 @@ public class AuthenticationActivity extends Activity {
static final String PASSWORD_KEY = "password"; static final String PASSWORD_KEY = "password";
static final String ERROR_KEY = "error"; static final String ERROR_KEY = "error";
static final String CUSTOM_AUTH_KEY = "customAuth"; static final String CUSTOM_AUTH_KEY = "customAuth";
static void initCredentialsCreator(Context context) { static void initCredentialsCreator(Context context) {
final ZLNetworkManager manager = ZLNetworkManager.Instance(); final ZLNetworkManager manager = ZLNetworkManager.Instance();
if (manager.getCredentialsCreator() == null) { if (manager.getCredentialsCreator() == null) {

View file

@ -101,7 +101,7 @@ public class NetworkBookInfoActivity extends Activity implements NetworkLibrary.
} }
library.initialize(); library.initialize();
} }
if (myBook == null) { if (myBook == null) {
final Uri url = getIntent().getData(); final Uri url = getIntent().getData();
if (url != null && "litres-book".equals(url.getScheme())) { if (url != null && "litres-book".equals(url.getScheme())) {
@ -140,9 +140,9 @@ public class NetworkBookInfoActivity extends Activity implements NetworkLibrary.
myConnection, myConnection,
BIND_AUTO_CREATE BIND_AUTO_CREATE
); );
setTitle(myBook.Title); setTitle(myBook.Title);
setupDescription(); setupDescription();
setupExtraLinks(); setupExtraLinks();
setupInfo(); setupInfo();

View file

@ -62,7 +62,7 @@ public abstract class Util implements UserRegistrationConstants {
if (SQLiteNetworkDatabase.Instance() == null) { if (SQLiteNetworkDatabase.Instance() == null) {
new SQLiteNetworkDatabase(activity.getApplication()); new SQLiteNetworkDatabase(activity.getApplication());
} }
library.initialize(); library.initialize();
} }
}, activity); }, activity);
@ -119,7 +119,7 @@ public abstract class Util implements UserRegistrationConstants {
final BookUrlInfo ref = book.reference(resolvedType); final BookUrlInfo ref = book.reference(resolvedType);
if (ref != null) { if (ref != null) {
activity.startService( activity.startService(
new Intent(Intent.ACTION_VIEW, Uri.parse(ref.Url), new Intent(Intent.ACTION_VIEW, Uri.parse(ref.Url),
activity.getApplicationContext(), BookDownloaderService.class) activity.getApplicationContext(), BookDownloaderService.class)
.putExtra(BookDownloaderService.BOOK_FORMAT_KEY, ref.BookFormat) .putExtra(BookDownloaderService.BOOK_FORMAT_KEY, ref.BookFormat)
.putExtra(BookDownloaderService.REFERENCE_TYPE_KEY, resolvedType) .putExtra(BookDownloaderService.REFERENCE_TYPE_KEY, resolvedType)

View file

@ -116,11 +116,11 @@ public abstract class PackageUtil {
final ZLBooleanOption doNotInstallOption = new ZLBooleanOption("doNotInstall", plugin, false); final ZLBooleanOption doNotInstallOption = new ZLBooleanOption("doNotInstall", plugin, false);
if (!doNotInstallOption.getValue()) { if (!doNotInstallOption.getValue()) {
final String pluginVersion = pluginData.get("androidPluginVersion"); final String pluginVersion = pluginData.get("androidPluginVersion");
String message = null; String message = null;
String positiveButtonKey = null; String positiveButtonKey = null;
String titleResourceKey = null; String titleResourceKey = null;
if (!PackageUtil.isPluginInstalled(activity, plugin)) { if (!PackageUtil.isPluginInstalled(activity, plugin)) {
message = pluginData.get("androidPluginInstallMessage"); message = pluginData.get("androidPluginInstallMessage");
positiveButtonKey = "install"; positiveButtonKey = "install";

View file

@ -235,7 +235,7 @@ public final class FBView extends ZLTextView {
} else if (soul instanceof ZLTextHyperlinkRegionSoul) { } else if (soul instanceof ZLTextHyperlinkRegionSoul) {
doSelectRegion = true; doSelectRegion = true;
} }
if (doSelectRegion) { if (doSelectRegion) {
selectRegion(region); selectRegion(region);
myReader.getViewWidget().reset(); myReader.getViewWidget().reset();
@ -355,7 +355,7 @@ public final class FBView extends ZLTextView {
if ("".equals(filePath)) { if ("".equals(filePath)) {
return null; return null;
} }
final ZLFile file = ZLFile.createFileByPath(filePath); final ZLFile file = ZLFile.createFileByPath(filePath);
if (file == null || !file.exists()) { if (file == null || !file.exists()) {
return null; return null;