mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-04 18:29:23 +02:00
code cleanup
This commit is contained in:
parent
8006ec5fd0
commit
009821710b
2 changed files with 29 additions and 25 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue