Merge pull request #1613 from kiwix/feature/macgills/prevent-kiwix-icon-in-custom

Move kiwix icon to app module
This commit is contained in:
Seán Mac Gillicuddy 2019-12-05 11:58:47 +00:00 committed by GitHub
commit 1d2786e0d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 10 additions and 4 deletions

View File

@ -25,7 +25,7 @@ import android.widget.Toast
import androidx.core.net.toFile
import androidx.core.net.toUri
import org.json.JSONArray
import org.kiwix.kiwixmobile.core.R
import org.kiwix.kiwixmobile.R
import org.kiwix.kiwixmobile.core.extensions.ActivityExtensions.start
import org.kiwix.kiwixmobile.core.extensions.toast
import org.kiwix.kiwixmobile.core.main.CoreMainActivity
@ -107,6 +107,8 @@ class KiwixMainActivity : CoreMainActivity() {
override fun hasValidFileAndUrl(url: String?, zimFileReader: ZimFileReader?) =
super.hasValidFileAndUrl(url, zimFileReader) && url != HOME_URL
override fun getIconResId() = R.mipmap.ic_launcher
override fun urlIsInvalid() =
super.urlIsInvalid() || currentWebView.url == HOME_URL

View File

@ -28,7 +28,7 @@ import android.os.Build;
import androidx.annotation.NonNull;
import androidx.core.app.NotificationCompat;
import javax.inject.Inject;
import org.kiwix.kiwixmobile.core.R;
import org.kiwix.kiwixmobile.R;
import org.kiwix.kiwixmobile.core.utils.Constants;
import org.kiwix.kiwixmobile.webserver.ZimHostActivity;

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

View File

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

View File

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

View File

Before

Width:  |  Height:  |  Size: 8.3 KiB

After

Width:  |  Height:  |  Size: 8.3 KiB

View File

Before

Width:  |  Height:  |  Size: 5.8 KiB

After

Width:  |  Height:  |  Size: 5.8 KiB

View File

Before

Width:  |  Height:  |  Size: 6.0 KiB

After

Width:  |  Height:  |  Size: 6.0 KiB

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -598,10 +598,12 @@ public abstract class CoreMainActivity extends BaseActivity
tempVisitCount = 0;
visitCounterPref.setCount(tempVisitCount);
})
.setIcon(ContextCompat.getDrawable(this, R.mipmap.ic_launcher))
.setIcon(ContextCompat.getDrawable(this, getIconResId()))
.show();
}
protected abstract int getIconResId();
private void goToSearch(boolean isVoice) {
final String zimFile = zimReaderContainer.getZimCanonicalPath();
saveTabStates();

View File

@ -21,13 +21,13 @@ package org.kiwix.kiwixmobile.custom.main
import android.os.Bundle
import android.util.Log
import android.view.Menu
import org.kiwix.kiwixmobile.core.R
import org.kiwix.kiwixmobile.core.extensions.ActivityExtensions.start
import org.kiwix.kiwixmobile.core.main.CoreMainActivity
import org.kiwix.kiwixmobile.core.main.WebViewCallback
import org.kiwix.kiwixmobile.core.reader.ZimReaderContainer
import org.kiwix.kiwixmobile.core.utils.LanguageUtils
import org.kiwix.kiwixmobile.custom.BuildConfig
import org.kiwix.kiwixmobile.custom.R
import org.kiwix.kiwixmobile.custom.customActivityComponent
import org.kiwix.kiwixmobile.custom.download.CustomDownloadActivity
import org.kiwix.kiwixmobile.custom.main.ValidationState.HasBothFiles
@ -83,6 +83,8 @@ class CustomMainActivity : CoreMainActivity() {
zimReaderContainer: ZimReaderContainer
) = CustomWebViewClient(webViewCallback, zimReaderContainer)
override fun getIconResId() = R.mipmap.ic_launcher
private fun requireEnforcedLanguage(): Boolean {
val currentLocaleCode = Locale.getDefault().toString()
if (BuildConfig.ENFORCED_LANG.isNotEmpty() && BuildConfig.ENFORCED_LANG != currentLocaleCode) {