mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-20 10:23:30 -04:00
Basic deeplinking
This commit is contained in:
parent
5a7bcfbc98
commit
1975a7c2f3
@ -114,6 +114,15 @@
|
||||
<data android:pathPattern=".*\\..*\\..*\\.zim(aa|)" />
|
||||
<data android:pathPattern=".*\\..*\\..*\\..*\\.zim(aa|)" />
|
||||
</intent-filter>
|
||||
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<data android:scheme="kiwix"
|
||||
android:host="search" />
|
||||
</intent-filter>
|
||||
|
||||
<intent-filter android:label="@string/app_search_string">
|
||||
<action android:name="android.intent.action.PROCESS_TEXT"/>
|
||||
<category android:name="android.intent.category.DEFAULT"/>
|
||||
|
@ -1194,6 +1194,7 @@ public class KiwixMobileActivity extends BaseActivity implements WebViewCallback
|
||||
pageBottomTabLayout.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
Log.d(TAG_KIWIX, "action" + getIntent().getAction());
|
||||
Intent intent = getIntent();
|
||||
if (intent.getAction() != null) {
|
||||
|
||||
@ -1216,6 +1217,14 @@ public class KiwixMobileActivity extends BaseActivity implements WebViewCallback
|
||||
} else if (intent.getAction().equals(KiwixSearchWidget.MIC_CLICKED)) {
|
||||
intent.setAction("");
|
||||
goToSearch(true);
|
||||
} else if (intent.getAction().equals(Intent.ACTION_VIEW)) {
|
||||
final String zimFile = ZimContentProvider.getZimFile();
|
||||
saveTabStates();
|
||||
Intent i = new Intent(KiwixMobileActivity.this, SearchActivity.class);
|
||||
i.putExtra("zimFile", zimFile);
|
||||
i.putExtra("search", intent.getData().getLastPathSegment());
|
||||
intent.setAction("");
|
||||
startActivityForResult(i, REQUEST_FILE_SEARCH);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -133,6 +133,10 @@ public class SearchActivity extends AppCompatActivity
|
||||
searchView.setQuery(getIntent().getStringExtra(Intent.EXTRA_PROCESS_TEXT), true);
|
||||
}
|
||||
|
||||
if (getIntent().hasExtra("search")) {
|
||||
searchView.setQuery(getIntent().getStringExtra("search"), true);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user