mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-08-03 18:56:44 -04:00
Android fix for #36
This commit is contained in:
parent
6de8b21e18
commit
04ac4ff660
@ -95,7 +95,7 @@
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".ZimFileSelectFragment"
|
||||
android:name=".ZimManageActivity"
|
||||
android:label="@string/choose_file">
|
||||
|
||||
<!-- TODO -->
|
||||
@ -131,13 +131,9 @@
|
||||
android:resource="@xml/kiwix_widget_provider_info" />
|
||||
</receiver>
|
||||
|
||||
<activity android:name=".LibraryFragment" />
|
||||
|
||||
<service android:name=".downloader.DownloadService" />
|
||||
|
||||
<activity
|
||||
android:name=".ZimManageActivity"
|
||||
android:theme="@style/AppTheme"></activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
@ -485,6 +485,9 @@ public class KiwixMobileActivity extends AppCompatActivity {
|
||||
if (i.getBooleanExtra("library",false)){
|
||||
manageZimFiles(2);
|
||||
}
|
||||
if (i.hasExtra(TAG_FILE_SEARCHED)){
|
||||
searchForTitle(i.getStringExtra(TAG_FILE_SEARCHED));
|
||||
}
|
||||
if (i.hasExtra("zimFile")){
|
||||
File file = new File(i.getStringExtra("zimFile"));
|
||||
LibraryFragment.mService.cancelNotification(i.getIntExtra("notificationID",0));
|
||||
@ -1331,6 +1334,19 @@ public class KiwixMobileActivity extends AppCompatActivity {
|
||||
super.onConfigurationChanged(newConfig);
|
||||
}
|
||||
|
||||
public void searchForTitle(String title){
|
||||
String articleUrl = "";
|
||||
|
||||
if (title.startsWith("A/")) {
|
||||
articleUrl = title;
|
||||
} else {
|
||||
articleUrl = ZimContentProvider.getPageUrlFromTitle(title);
|
||||
}
|
||||
|
||||
//System.out.println("Opening "+articleUrl + " (" + title + ")");
|
||||
|
||||
openArticle(articleUrl);
|
||||
}
|
||||
@Override
|
||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
|
||||
@ -1367,17 +1383,7 @@ public class KiwixMobileActivity extends AppCompatActivity {
|
||||
if (resultCode == RESULT_OK) {
|
||||
String title =
|
||||
data.getStringExtra(TAG_FILE_SEARCHED).replace("<b>", "").replace("</b>", "");
|
||||
String articleUrl = "";
|
||||
|
||||
if (title.startsWith("A/")) {
|
||||
articleUrl = title;
|
||||
} else {
|
||||
articleUrl = ZimContentProvider.getPageUrlFromTitle(title);
|
||||
}
|
||||
|
||||
//System.out.println("Opening "+articleUrl + " (" + title + ")");
|
||||
|
||||
openArticle(articleUrl);
|
||||
searchForTitle(title);
|
||||
}
|
||||
break;
|
||||
case REQUEST_PREFERENCES:
|
||||
|
@ -4,6 +4,7 @@ import android.content.ActivityNotFoundException;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.provider.Settings;
|
||||
import android.speech.RecognizerIntent;
|
||||
import android.support.v4.view.MenuItemCompat;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
@ -124,10 +125,15 @@ public class SearchActivity extends AppCompatActivity
|
||||
}
|
||||
|
||||
private void sendMessage(String uri) {
|
||||
Intent i = new Intent();
|
||||
Intent i = new Intent(this, KiwixMobileActivity.class);
|
||||
i.putExtra(KiwixMobileActivity.TAG_FILE_SEARCHED, uri);
|
||||
setResult(RESULT_OK, i);
|
||||
finish();
|
||||
int value = Settings.System.getInt(getContentResolver(), Settings.System.ALWAYS_FINISH_ACTIVITIES, 0);
|
||||
if (value == 1) {
|
||||
startActivity(i);
|
||||
} else {
|
||||
setResult(RESULT_OK, i);
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
x
Reference in New Issue
Block a user