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

code cleanup

This commit is contained in:
Nikolay Pultsin 2011-01-14 05:34:00 +00:00
parent 8006ec5fd0
commit 009821710b
2 changed files with 29 additions and 25 deletions

View file

@ -19,10 +19,9 @@
package org.geometerplus.android.fbreader;
import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.content.ActivityNotFoundException;
import android.net.Uri;
//import android.widget.Toast;
import org.geometerplus.zlibrary.core.resources.ZLResource;
import org.geometerplus.zlibrary.core.network.ZLNetworkException;
@ -67,29 +66,7 @@ class ProcessHyperlinkAction extends FBAction {
return;
}
final String text = Reader.getTextView().getSelectedText();
if (text != null) {
int start = 0;
int end = text.length();
for (; start < end && !Character.isLetterOrDigit(text.charAt(start)); ++start);
for (; start < end && !Character.isLetterOrDigit(text.charAt(end - 1)); --end);
if (start == end) {
return;
}
final Intent intent = DictionaryUtil.getDictionaryIntent(text.substring(start, end));
try {
myBaseActivity.startActivity(intent);
} catch(ActivityNotFoundException e){
DictionaryUtil.installDictionaryIfNotInstalled(myBaseActivity);
/*
Toast.makeText(
myBaseActivity,
ZLResource.resource("errorMessage").getResource("dictionaryIsNotInstalled").getValue(),
Toast.LENGTH_LONG
).show();
*/
}
}
DictionaryUtil.openWordInDictionary(myBaseActivity, Reader.getTextView().getSelectedText());
}
private void openInBrowser(String urlString) {