Remove duplicate help/welcome page methods

This commit is contained in:
Rashiq 2017-01-01 15:24:54 +01:00
parent b6c2c4a725
commit ca1edaf950
3 changed files with 7 additions and 12 deletions

View File

@ -706,7 +706,7 @@ public class KiwixMobileActivity extends AppCompatActivity implements WebViewCal
break; break;
case R.id.menu_help: case R.id.menu_help:
showHelp(); showHelpPage();
break; break;
case R.id.menu_openfile: case R.id.menu_openfile:
@ -789,7 +789,7 @@ public class KiwixMobileActivity extends AppCompatActivity implements WebViewCal
isFullscreenOpened = false; isFullscreenOpened = false;
} }
@Override public void showWelcomePage() { public void showHelpPage() {
getCurrentWebView().loadUrl("file:///android_res/raw/welcome.html"); getCurrentWebView().loadUrl("file:///android_res/raw/welcome.html");
} }
@ -803,11 +803,6 @@ public class KiwixMobileActivity extends AppCompatActivity implements WebViewCal
} }
public void showHelp() {
newTab();
getCurrentWebView().loadUrl("file:///android_res/raw/welcome.html");
}
public boolean openZimFile(File file, boolean clearHistory) { public boolean openZimFile(File file, boolean clearHistory) {
if (file.canRead() || Build.VERSION.SDK_INT < 19 || (Constants.IS_CUSTOM_APP if (file.canRead() || Build.VERSION.SDK_INT < 19 || (Constants.IS_CUSTOM_APP
&& Build.VERSION.SDK_INT != 23)) { && Build.VERSION.SDK_INT != 23)) {
@ -836,14 +831,14 @@ public class KiwixMobileActivity extends AppCompatActivity implements WebViewCal
} else { } else {
Toast.makeText(this, getResources().getString(R.string.error_fileinvalid), Toast.makeText(this, getResources().getString(R.string.error_fileinvalid),
Toast.LENGTH_LONG).show(); Toast.LENGTH_LONG).show();
showWelcomePage(); showHelpPage();
} }
} else { } else {
Log.e(TAG_KIWIX, "ZIM file doesn't exist at " + file.getAbsolutePath()); Log.e(TAG_KIWIX, "ZIM file doesn't exist at " + file.getAbsolutePath());
Toast.makeText(this, getResources().getString(R.string.error_filenotfound), Toast.LENGTH_LONG) Toast.makeText(this, getResources().getString(R.string.error_filenotfound), Toast.LENGTH_LONG)
.show(); .show();
showWelcomePage(); showHelpPage();
} }
return false; return false;
} else { } else {
@ -1574,7 +1569,7 @@ public class KiwixMobileActivity extends AppCompatActivity implements WebViewCal
} else { } else {
Log.d(TAG_KIWIX, Log.d(TAG_KIWIX,
" Kiwix normal start, no zimFile loaded last time -> display welcome page"); " Kiwix normal start, no zimFile loaded last time -> display welcome page");
showWelcomePage(); showHelpPage();
} }
} }
} }

View File

@ -64,7 +64,7 @@ public class KiwixWebViewClient extends WebViewClient {
@Override @Override
public void onPageFinished(WebView view, String url) { public void onPageFinished(WebView view, String url) {
if ((url.equals("content://org.kiwix.zim.base/null")) && !Constants.IS_CUSTOM_APP) { if ((url.equals("content://org.kiwix.zim.base/null")) && !Constants.IS_CUSTOM_APP) {
callback.showWelcomePage(); callback.showHelpPage();
return; return;
} }
if (!url.equals("file:///android_res/raw/welcome.html")) { if (!url.equals("file:///android_res/raw/welcome.html")) {

View File

@ -9,7 +9,7 @@ public interface WebViewCallback {
void webViewFailedLoading(String failingUrl); void webViewFailedLoading(String failingUrl);
void showWelcomePage(); void showHelpPage();
void openExternalUrl(Intent intent); void openExternalUrl(Intent intent);