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