1
0
Fork 0
mirror of https://github.com/geometer/FBReaderJ.git synced 2025-10-06 03:50:19 +02:00

refactoring: RunPluginAction

This commit is contained in:
Nikolay Pultsin 2011-06-18 01:41:24 +01:00
parent 9e3c338db4
commit 6f4da1c335
3 changed files with 29 additions and 5 deletions

View file

@ -162,6 +162,16 @@
</activity>
<receiver android:name="org.geometerplus.android.fbreader.network.BookDownloaderCallback" android:process=":networkLibrary" />
<service android:name="org.geometerplus.android.fbreader.network.LibraryInitializationService" android:process=":networkLibrary" />
<activity android:name="org.geometerplus.android.fbreader.SpeakActivity" android:configChanges="orientation|keyboardHidden" android:theme="@android:style/Theme.Dialog" android:process=":tts"/>
<activity android:name="org.geometerplus.android.fbreader.SpeakActivity" android:configChanges="orientation|keyboardHidden" android:theme="@android:style/Theme.Dialog" android:process=":tts">
<intent-filter>
<action android:name="android.fbreader.action.plugin.REGISTER" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<intent-filter>
<action android:name="android.fbreader.action.plugin.RUN" />
<category android:name="android.intent.category.DEFAULT" />
<data android:host="data.fbreader.org" android:scheme="http" android:path="/plugin/tts" />
</intent-filter>
</activity>
</application>
</manifest>

View file

@ -106,7 +106,7 @@ public final class FBReader extends ZLAndroidActivity {
fbReader.addAction(ActionCode.PROCESS_HYPERLINK, new ProcessHyperlinkAction(this, fbReader));
fbReader.addAction(ActionCode.SPEAK, new SpeakAction(this, fbReader));
fbReader.addAction(ActionCode.SPEAK, new RunPluginAction(this, fbReader, Uri.parse("http://data.fbreader.org/plugin/tts")));
fbReader.addAction(ActionCode.SHOW_CANCEL_MENU, new ShowCancelMenuAction(this, fbReader));
}

View file

@ -19,10 +19,24 @@
package org.geometerplus.android.fbreader;
import android.content.Intent;
import android.content.ActivityNotFoundException;
import android.net.Uri;
import org.geometerplus.fbreader.fbreader.FBReaderApp;
class SpeakAction extends RunActivityAction {
SpeakAction(FBReader baseActivity, FBReaderApp fbreader) {
super(baseActivity, fbreader, SpeakActivity.class);
class RunPluginAction extends FBAndroidAction {
private final Uri myUri;
RunPluginAction(FBReader baseActivity, FBReaderApp fbreader, Uri uri) {
super(baseActivity, fbreader);
myUri = uri;
}
public void run() {
try {
BaseActivity.startActivity(new Intent("android.fbreader.action.plugin.RUN", myUri));
} catch (ActivityNotFoundException e) {
}
}
}