added welcome page + help page + integrated

This commit is contained in:
renaud gaudin 2013-04-06 04:03:06 +02:00
parent 484ddb7da1
commit 6f5256b56b
13 changed files with 95 additions and 94 deletions

View File

Before

Width:  |  Height:  |  Size: 8.6 KiB

After

Width:  |  Height:  |  Size: 8.6 KiB

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -2,12 +2,12 @@
<html> <html>
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<title>Welcome to Kiwix!</title> <title>Kiwix Help</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="bootstrap/css/bootstrap.css" rel="stylesheet"> <link href="file:///android_asset/www/bootstrap/css/bootstrap.css" rel="stylesheet">
<link href="bootstrap/css/bootstrap-responsive.css" rel="stylesheet"> <link href="file:///android_asset/www/bootstrap/css/bootstrap-responsive.css" rel="stylesheet">
<link href="welcome.css" rel="stylesheet"> <link href="file:///android_asset/www/static.css" rel="stylesheet">
</head> </head>
<body class="help" lang="en-US"> <body class="help" lang="en-US">
@ -41,11 +41,6 @@
<div id="contents"></div> <div id="contents"></div>
</section> </section>
<section id="how-to-download">
<h2>How do I download?</h2>
</section>
<section id="can-wikipedia"> <section id="can-wikipedia">
<h2>Can I download from Wikipedia directly?</h2> <h2>Can I download from Wikipedia directly?</h2>
<p>Yes! You can create a <em>book</em> while browsing Wikipedia and add as many article to this <em>book</em>. Once done, you can download the book as an <em>OpenZIM file</em>. This file can be opened by Kiwix.</p> <p>Yes! You can create a <em>book</em> while browsing Wikipedia and add as many article to this <em>book</em>. Once done, you can download the book as an <em>OpenZIM file</em>. This file can be opened by Kiwix.</p>
@ -59,8 +54,8 @@
</div> </div>
<script src="jquery.js"></script> <script src="file:///android_asset/www/jquery.js"></script>
<script src="js/bootstrap.min.js"></script> <script src="file:///android_asset/www/js/bootstrap.min.js"></script>
<script type="text/javascript"> <script type="text/javascript">
var loaded = false; var loaded = false;
function loadcontent() { function loadcontent() {

View File

@ -5,9 +5,9 @@
<title>Welcome to Kiwix!</title> <title>Welcome to Kiwix!</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="bootstrap/css/bootstrap.css" rel="stylesheet"> <link href="file:///android_asset/www/bootstrap/css/bootstrap.css" rel="stylesheet">
<link href="bootstrap/css/bootstrap-responsive.css" rel="stylesheet"> <link href="file:///android_asset/www/bootstrap/css/bootstrap-responsive.css" rel="stylesheet">
<link href="welcome.css" rel="stylesheet"> <link href="file:///android_asset/www/static.css" rel="stylesheet">
</head> </head>
<body class="welcome" lang="en-US"> <body class="welcome" lang="en-US">
@ -25,19 +25,19 @@
<section id="step2"> <section id="step2">
<h2><span>2.</span> Take a drink break!</h2> <h2><span>2.</span> Take a drink break!</h2>
<img class="media-object" data-src="holder.js/64x64" src="coffee.png"> <img src="coffee.png">
<p>Downloads can take a long time, go mind your regular business and come back once done.</p> <p>Downloads can take a long time, go mind your regular business and come back once done.</p>
</section> </section>
<section id="step3"> <section id="step3">
<h2><span>3.</span> Open the file up-here!</h2> <h2><span>3.</span> Open the file up-there!</h2>
<p>Click the <span><a href="content://org.kiwix.ui/selectzimfile">Open File</a></span> button in the toolbar up there and select the ZIM file you downloaded. <strong>That's It!</strong></p> <p>Click the <span><a href="content://org.kiwix.ui/selectzimfile">Open File</a></span> button in the toolbar up there and select the ZIM file you downloaded. <strong>That's It!</strong></p>
<p>Now, Enjoy your content, and take a look at the <a href="help.html">Help Page</a> once bored.</p> <p>Now, Enjoy your content, and take a look at the <a href="content://org.kiwix.ui/gotohelp">Help</a> Page once bored.</p>
</section> </section>
</div> </div>
<script src="jquery.js"></script> <script src="file:///android_asset/www/jquery.js"></script>
<script src="js/bootstrap.min.js"></script> <script src="file:///android_asset/www/js/bootstrap.min.js"></script>
</body> </body>
</html> </html>

View File

@ -50,7 +50,7 @@ import android.widget.Toast;
public class KiwixMobileActivity extends Activity { public class KiwixMobileActivity extends Activity {
/** Called when the activity is first created. */ /** Called when the activity is first created. */
private WebView webView; private WebView webView;
private ArrayAdapter<String> adapter; private ArrayAdapter<String> adapter;
protected boolean requestClearHistoryAfterLoad; protected boolean requestClearHistoryAfterLoad;
@ -58,8 +58,8 @@ public class KiwixMobileActivity extends Activity {
private static final String PREFS_KIWIX_MOBILE = "kiwix-mobile"; private static final String PREFS_KIWIX_MOBILE = "kiwix-mobile";
private AutoCompleteTextView articleSearchtextView; private AutoCompleteTextView articleSearchtextView;
private LinearLayout articleSearchBar; private LinearLayout articleSearchBar;
public class AutoCompleteAdapter extends ArrayAdapter<String> implements Filterable { public class AutoCompleteAdapter extends ArrayAdapter<String> implements Filterable {
private ArrayList<String> mData; private ArrayList<String> mData;
@ -90,11 +90,11 @@ public class KiwixMobileActivity extends Activity {
try { try {
ZimContentProvider.searchSuggestions(constraint.toString(), 20); ZimContentProvider.searchSuggestions(constraint.toString(), 20);
String suggestion; String suggestion;
data.clear(); data.clear();
while ((suggestion = ZimContentProvider.getNextSuggestion())!=null) { while ((suggestion = ZimContentProvider.getNextSuggestion())!=null) {
data.add(suggestion); data.add(suggestion);
} }
} }
catch(Exception e) {} catch(Exception e) {}
// Now assign the values and count to the FilterResults object // Now assign the values and count to the FilterResults object
@ -118,25 +118,25 @@ public class KiwixMobileActivity extends Activity {
}; };
return myFilter; return myFilter;
} }
} }
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
requestClearHistoryAfterLoad=false; requestClearHistoryAfterLoad=false;
this.requestWindowFeature(Window.FEATURE_PROGRESS); this.requestWindowFeature(Window.FEATURE_PROGRESS);
this.setProgressBarVisibility(true); this.setProgressBarVisibility(true);
setContentView(R.layout.main); setContentView(R.layout.main);
webView = (WebView) findViewById(R.id.webview); webView = (WebView) findViewById(R.id.webview);
articleSearchBar = (LinearLayout) findViewById(R.id.articleSearchBar); articleSearchBar = (LinearLayout) findViewById(R.id.articleSearchBar);
articleSearchtextView = (AutoCompleteTextView) findViewById(R.id.articleSearchTextView); articleSearchtextView = (AutoCompleteTextView) findViewById(R.id.articleSearchTextView);
// Create the adapter and set it to the AutoCompleteTextView // Create the adapter and set it to the AutoCompleteTextView
adapter = new AutoCompleteAdapter(this, android.R.layout.simple_list_item_1); adapter = new AutoCompleteAdapter(this, android.R.layout.simple_list_item_1);
articleSearchtextView.setAdapter(adapter); articleSearchtextView.setAdapter(adapter);
articleSearchtextView.setOnItemClickListener(new OnItemClickListener() { articleSearchtextView.setOnItemClickListener(new OnItemClickListener() {
@ -154,8 +154,8 @@ public class KiwixMobileActivity extends Activity {
//Do Stuff //Do Stuff
return openArticle(); return openArticle();
}}); }});
// js includes will not happen unless we enable JS // js includes will not happen unless we enable JS
webView.getSettings().setJavaScriptEnabled(true); webView.getSettings().setJavaScriptEnabled(true);
//Does not seem to have impact. (Idea was that //Does not seem to have impact. (Idea was that
@ -163,12 +163,12 @@ public class KiwixMobileActivity extends Activity {
//webView.getSettings().setRenderPriority(RenderPriority.HIGH); //webView.getSettings().setRenderPriority(RenderPriority.HIGH);
final Activity activity = this; final Activity activity = this;
webView.setWebChromeClient(new WebChromeClient(){ webView.setWebChromeClient(new WebChromeClient(){
public void onProgressChanged(WebView view, int progress) { public void onProgressChanged(WebView view, int progress) {
activity.setProgress(progress * 100); activity.setProgress(progress * 100);
if (progress==100) { if (progress==100) {
Log.d("kiwix", "Loading article finished."); Log.d("kiwix", "Loading article finished.");
if (requestClearHistoryAfterLoad) { if (requestClearHistoryAfterLoad) {
Log.d("kiwix", "Loading article finished and requestClearHistoryAfterLoad -> clearHistory"); Log.d("kiwix", "Loading article finished and requestClearHistoryAfterLoad -> clearHistory");
@ -181,9 +181,9 @@ public class KiwixMobileActivity extends Activity {
// Should basically resemble the behavior when setWebClient not done // Should basically resemble the behavior when setWebClient not done
// (i.p. internal urls load in webview, external urls in browser) // (i.p. internal urls load in webview, external urls in browser)
// as currently no custom setWebViewClient required it is commented // as currently no custom setWebViewClient required it is commented
webView.setWebViewClient(new WebViewClient() { webView.setWebViewClient(new WebViewClient() {
@Override @Override
public boolean shouldOverrideUrlLoading(WebView view, String url) { public boolean shouldOverrideUrlLoading(WebView view, String url) {
if (url.startsWith(ZimContentProvider.CONTENT_URI.toString())) { if (url.startsWith(ZimContentProvider.CONTENT_URI.toString())) {
@ -196,6 +196,8 @@ public class KiwixMobileActivity extends Activity {
// To handle links which access user interface (i.p. used in help page) // To handle links which access user interface (i.p. used in help page)
if (url.equals(ZimContentProvider.UI_URI.toString()+"selectzimfile")) { if (url.equals(ZimContentProvider.UI_URI.toString()+"selectzimfile")) {
selectZimFile(); selectZimFile();
} else if (url.equals(ZimContentProvider.UI_URI.toString()+"gotohelp")) {
showHelp();
} else { } else {
Log.e("kiwix", "UI Url "+url+ " not supported."); Log.e("kiwix", "UI Url "+url+ " not supported.");
} }
@ -206,15 +208,15 @@ public class KiwixMobileActivity extends Activity {
startActivity(intent); startActivity(intent);
return true; return true;
} }
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
String errorString = String.format(getResources().getString(R.string.error_articleurlnotfound), failingUrl); String errorString = String.format(getResources().getString(R.string.error_articleurlnotfound), failingUrl);
//TODO apparently screws up back/forward //TODO apparently screws up back/forward
webView.loadDataWithBaseURL("file://error","<html><body>"+errorString+"</body></html>", "text/html", "utf-8", failingUrl); webView.loadDataWithBaseURL("file://error","<html><body>"+errorString+"</body></html>", "text/html", "utf-8", failingUrl);
String title = getResources().getString(R.string.app_name); String title = getResources().getString(R.string.app_name);
getActionBar().setTitle(title); getActionBar().setTitle(title);
} }
public void onPageFinished(WebView view, String url) { public void onPageFinished(WebView view, String url) {
String title = getResources().getString(R.string.app_name); String title = getResources().getString(R.string.app_name);
if (webView.getTitle()!=null && !webView.getTitle().isEmpty()) if (webView.getTitle()!=null && !webView.getTitle().isEmpty())
@ -222,7 +224,7 @@ public class KiwixMobileActivity extends Activity {
getActionBar().setTitle(title); getActionBar().setTitle(title);
} }
}); });
//Pinch to zoom //Pinch to zoom
webView.getSettings().setBuiltInZoomControls(true); webView.getSettings().setBuiltInZoomControls(true);
//webView.getSettings().setLoadsImagesAutomatically(false); //webView.getSettings().setLoadsImagesAutomatically(false);
@ -238,38 +240,38 @@ public class KiwixMobileActivity extends Activity {
Log.d("kiwix", " Device is phone-> setDefaultZoom(WebSettings.ZoomDensity.MEDIUM)"); Log.d("kiwix", " Device is phone-> setDefaultZoom(WebSettings.ZoomDensity.MEDIUM)");
webView.getSettings().setDefaultZoom(WebSettings.ZoomDensity.MEDIUM); webView.getSettings().setDefaultZoom(WebSettings.ZoomDensity.MEDIUM);
} }
if (getIntent().getData()!=null) { if (getIntent().getData()!=null) {
String filePath = getIntent().getData().getEncodedPath(); String filePath = getIntent().getData().getEncodedPath();
Log.d("kiwix", " Kiwix started from a filemanager. Intent filePath: "+filePath+" -> open this zimfile and load main page"); Log.d("kiwix", " Kiwix started from a filemanager. Intent filePath: "+filePath+" -> open this zimfile and load main page");
openZimFile(new File(filePath), false); openZimFile(new File(filePath), false);
} else if (savedInstanceState!=null) { } else if (savedInstanceState!=null) {
Log.d("kiwix", " Kiwix started with a savedInstanceState (That is was closed by OS) -> restore webview state and zimfile (if set)"); Log.d("kiwix", " Kiwix started with a savedInstanceState (That is was closed by OS) -> restore webview state and zimfile (if set)");
if (savedInstanceState.getString("currentzimfile")!=null) { if (savedInstanceState.getString("currentzimfile")!=null) {
openZimFile(new File(savedInstanceState.getString("currentzimfile")), false); openZimFile(new File(savedInstanceState.getString("currentzimfile")), false);
} }
// Restore the state of the WebView // Restore the state of the WebView
webView.restoreState(savedInstanceState); webView.restoreState(savedInstanceState);
} else { } else {
SharedPreferences settings = getSharedPreferences(PREFS_KIWIX_MOBILE, 0); SharedPreferences settings = getSharedPreferences(PREFS_KIWIX_MOBILE, 0);
String zimfile = settings.getString("currentzimfile", null); String zimfile = settings.getString("currentzimfile", null);
if (zimfile != null) { if (zimfile != null) {
Log.d("kiwix", " Kiwix normal start, zimfile loaded last time -> Open last used zimfile "+zimfile); Log.d("kiwix", " Kiwix normal start, zimfile loaded last time -> Open last used zimfile "+zimfile);
openZimFile(new File(zimfile), false); openZimFile(new File(zimfile), false);
// Alternative would be to restore webView state. But more effort to implement, and actually // Alternative would be to restore webView state. But more effort to implement, and actually
// fits better normal android behavior if after closing app ("back" button) state is not maintained. // fits better normal android behavior if after closing app ("back" button) state is not maintained.
} else { } else {
Log.d("kiwix", " Kiwix normal start, no zimfile loaded last time -> display welcome page"); Log.d("kiwix", " Kiwix normal start, no zimfile loaded last time -> display welcome page");
showHelp(); showWelcome();
} }
} }
} }
@Override @Override
public void onPause() { public void onPause() {
super.onPause(); super.onPause();
@ -281,30 +283,30 @@ public class KiwixMobileActivity extends Activity {
Log.d("kiwix", "onPause Save currentzimfile to preferences:"+ZimContentProvider.getZimFile()); Log.d("kiwix", "onPause Save currentzimfile to preferences:"+ZimContentProvider.getZimFile());
} }
@Override @Override
protected void onSaveInstanceState(Bundle outState) { protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState); super.onSaveInstanceState(outState);
// Save the state of the WebView // Save the state of the WebView
webView.saveState(outState); webView.saveState(outState);
outState.putString("currentzimfile", ZimContentProvider.getZimFile()); outState.putString("currentzimfile", ZimContentProvider.getZimFile());
Log.v("kiwix", "onSaveInstanceState Save currentzimfile to bundle:"+ZimContentProvider.getZimFile()+" and webView state"); Log.v("kiwix", "onSaveInstanceState Save currentzimfile to bundle:"+ZimContentProvider.getZimFile()+" and webView state");
} }
@Override @Override
protected void onRestoreInstanceState(Bundle savedInstanceState) { protected void onRestoreInstanceState(Bundle savedInstanceState) {
super.onRestoreInstanceState(savedInstanceState); super.onRestoreInstanceState(savedInstanceState);
} }
@Override @Override
public boolean onCreateOptionsMenu(Menu menu) { public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater(); MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.main, menu); inflater.inflate(R.menu.main, menu);
return true; return true;
} }
@Override @Override
public boolean onOptionsItemSelected(MenuItem item) { public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) { switch (item.getItemId()) {
@ -317,7 +319,7 @@ public class KiwixMobileActivity extends Activity {
} else { } else {
hideSearchBar(); hideSearchBar();
} }
break; break;
case R.id.menu_searchintext: case R.id.menu_searchintext:
webView.showFindDialog("", true); webView.showFindDialog("", true);
break; break;
@ -334,7 +336,7 @@ public class KiwixMobileActivity extends Activity {
webView.goBack(); webView.goBack();
} }
break; break;
case R.id.menu_help: case R.id.menu_help:
showHelp(); showHelp();
break; break;
case R.id.menu_openfile: case R.id.menu_openfile:
@ -348,9 +350,9 @@ public class KiwixMobileActivity extends Activity {
private void selectZimFile() { private void selectZimFile() {
final Intent target = new Intent(Intent.ACTION_GET_CONTENT); final Intent target = new Intent(Intent.ACTION_GET_CONTENT);
// The MIME data type filter // The MIME data type filter
target.setType("*/*"); target.setType("*/*");
// Only return URIs that can be opened with ContentResolver // Only return URIs that can be opened with ContentResolver
target.addCategory(Intent.CATEGORY_OPENABLE); target.addCategory(Intent.CATEGORY_OPENABLE);
//Force use of our file selection component. //Force use of our file selection component.
@ -359,7 +361,7 @@ public class KiwixMobileActivity extends Activity {
try { try {
startActivityForResult(target, ZIMFILESELECT_REQUEST_CODE); startActivityForResult(target, ZIMFILESELECT_REQUEST_CODE);
} catch (ActivityNotFoundException e) { } catch (ActivityNotFoundException e) {
} }
} }
@ -374,7 +376,7 @@ public class KiwixMobileActivity extends Activity {
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED,0); imm.toggleSoftInput(InputMethodManager.SHOW_FORCED,0);
} }
private String readTextFromResource(int resourceID) private String readTextFromResource(int resourceID)
{ {
InputStream raw = getResources().openRawResource(resourceID); InputStream raw = getResources().openRawResource(resourceID);
@ -396,28 +398,32 @@ public class KiwixMobileActivity extends Activity {
} }
return stream.toString(); return stream.toString();
} }
private void showWelcome() {
webView.loadUrl("file:///android_res/raw/welcome.html");
}
private void showHelp() { private void showHelp() {
//Load from resource. Use with base url as else no images can be embedded. //Load from resource. Use with base url as else no images can be embedded.
// Note that this leads inclusion of welcome page in browser history // Note that this leads inclusion of welcome page in browser history
// This is not perfect, but good enough. (and would be signifcant // This is not perfect, but good enough. (and would be signifcant
// effort to remove file) // effort to remove file)
webView.loadUrl("file:///android_res/raw/welcome.html"); webView.loadUrl("file:///android_res/raw/help.html");
} }
@Override @Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) { protected void onActivityResult(int requestCode, int resultCode, Intent data) {
switch (requestCode) { switch (requestCode) {
case ZIMFILESELECT_REQUEST_CODE: case ZIMFILESELECT_REQUEST_CODE:
if (resultCode == RESULT_OK) { if (resultCode == RESULT_OK) {
// The URI of the selected file // The URI of the selected file
final Uri uri = data.getData(); final Uri uri = data.getData();
File file = null; File file = null;
if (uri != null) { if (uri != null) {
String path = uri.getPath(); String path = uri.getPath();
if (path != null) if (path != null)
file = new File(path); file = new File(path);
} }
if (file==null) if (file==null)
return; return;
@ -436,7 +442,7 @@ public class KiwixMobileActivity extends Activity {
getActionBar().setSubtitle(ZimContentProvider.getZimFileTitle()); getActionBar().setSubtitle(ZimContentProvider.getZimFileTitle());
//Apparently with webView.clearHistory() only //Apparently with webView.clearHistory() only
// history before currently (fully) loaded page is cleared // history before currently (fully) loaded page is cleared
// -> request clear, actual clear done after load. // -> request clear, actual clear done after load.
// Probably not working in all corners (e.g. zim file openend // Probably not working in all corners (e.g. zim file openend
@ -451,20 +457,20 @@ public class KiwixMobileActivity extends Activity {
} else { } else {
Toast.makeText(this, getResources().getString(R.string.error_fileinvalid), Toast.LENGTH_LONG).show(); Toast.makeText(this, getResources().getString(R.string.error_fileinvalid), Toast.LENGTH_LONG).show();
} }
} else { } else {
Toast.makeText(this, getResources().getString(R.string.error_filenotfound), Toast.LENGTH_LONG).show(); Toast.makeText(this, getResources().getString(R.string.error_filenotfound), Toast.LENGTH_LONG).show();
} }
return false; return false;
} }
private void loadMainPage() { private void loadMainPage() {
String article = ZimContentProvider.getMainPage(); String article = ZimContentProvider.getMainPage();
webView.loadUrl(Uri.parse(ZimContentProvider.CONTENT_URI webView.loadUrl(Uri.parse(ZimContentProvider.CONTENT_URI
+ article).toString()); + article).toString());
} }
@Override @Override
public boolean onKeyDown(int keyCode, KeyEvent event) { public boolean onKeyDown(int keyCode, KeyEvent event) {
if(event.getAction() == KeyEvent.ACTION_DOWN){ if(event.getAction() == KeyEvent.ACTION_DOWN){
@ -473,9 +479,9 @@ public class KiwixMobileActivity extends Activity {
case KeyEvent.KEYCODE_BACK: case KeyEvent.KEYCODE_BACK:
if(webView.canGoBack() == true){ if(webView.canGoBack() == true){
/*WebBackForwardList history = webView.copyBackForwardList(); /*WebBackForwardList history = webView.copyBackForwardList();
if (history.getCurrentIndex() )*/ if (history.getCurrentIndex() )*/
webView.goBack(); webView.goBack();
}else{ }else{
finish(); finish();
@ -492,19 +498,19 @@ public class KiwixMobileActivity extends Activity {
private boolean openArticle() { private boolean openArticle() {
Log.d("kiwix", articleSearchtextView+" onEditorAction. "+articleSearchtextView.getText()); Log.d("kiwix", articleSearchtextView+" onEditorAction. "+articleSearchtextView.getText());
String articleUrl = ZimContentProvider.getPageUrlFromTitle(articleSearchtextView.getText().toString()); String articleUrl = ZimContentProvider.getPageUrlFromTitle(articleSearchtextView.getText().toString());
Log.d("kiwix", articleSearchtextView+" onEditorAction. TextView: "+articleSearchtextView.getText()+ " articleUrl: "+articleUrl); Log.d("kiwix", articleSearchtextView+" onEditorAction. TextView: "+articleSearchtextView.getText()+ " articleUrl: "+articleUrl);
if (articleUrl!=null) { if (articleUrl!=null) {
hideSearchBar(); hideSearchBar();
webView.loadUrl(Uri.parse(ZimContentProvider.CONTENT_URI webView.loadUrl(Uri.parse(ZimContentProvider.CONTENT_URI
+articleUrl).toString()); +articleUrl).toString());
return true; return true;
} else { } else {
String errorString = String.format(getResources().getString(R.string.error_articlenotfound), articleSearchtextView.getText().toString()); String errorString = String.format(getResources().getString(R.string.error_articlenotfound), articleSearchtextView.getText().toString());
Toast.makeText(getWindow().getContext(), errorString, Toast.LENGTH_SHORT).show(); Toast.makeText(getWindow().getContext(), errorString, Toast.LENGTH_SHORT).show();
return true; return true;
} }
} }
@ -516,12 +522,12 @@ public class KiwixMobileActivity extends Activity {
& Configuration.SCREENLAYOUT_SIZE_MASK) & Configuration.SCREENLAYOUT_SIZE_MASK)
>= Configuration.SCREENLAYOUT_SIZE_LARGE; >= Configuration.SCREENLAYOUT_SIZE_LARGE;
} }
private void hideSearchBar() { private void hideSearchBar() {
// Hide searchbar // Hide searchbar
articleSearchBar.setVisibility(View.GONE); articleSearchBar.setVisibility(View.GONE);
// To close softkeyboard // To close softkeyboard
webView.requestFocus(); webView.requestFocus();
//Seems not really be necessary //Seems not really be necessary
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(articleSearchtextView.getWindowToken(),0); imm.hideSoftInputFromWindow(articleSearchtextView.getWindowToken(),0);