Merge pull request #1613 from kiwix/feature/macgills/prevent-kiwix-icon-in-custom
Move kiwix icon to app module
@ -25,7 +25,7 @@ import android.widget.Toast
|
|||||||
import androidx.core.net.toFile
|
import androidx.core.net.toFile
|
||||||
import androidx.core.net.toUri
|
import androidx.core.net.toUri
|
||||||
import org.json.JSONArray
|
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.ActivityExtensions.start
|
||||||
import org.kiwix.kiwixmobile.core.extensions.toast
|
import org.kiwix.kiwixmobile.core.extensions.toast
|
||||||
import org.kiwix.kiwixmobile.core.main.CoreMainActivity
|
import org.kiwix.kiwixmobile.core.main.CoreMainActivity
|
||||||
@ -107,6 +107,8 @@ class KiwixMainActivity : CoreMainActivity() {
|
|||||||
override fun hasValidFileAndUrl(url: String?, zimFileReader: ZimFileReader?) =
|
override fun hasValidFileAndUrl(url: String?, zimFileReader: ZimFileReader?) =
|
||||||
super.hasValidFileAndUrl(url, zimFileReader) && url != HOME_URL
|
super.hasValidFileAndUrl(url, zimFileReader) && url != HOME_URL
|
||||||
|
|
||||||
|
override fun getIconResId() = R.mipmap.ic_launcher
|
||||||
|
|
||||||
override fun urlIsInvalid() =
|
override fun urlIsInvalid() =
|
||||||
super.urlIsInvalid() || currentWebView.url == HOME_URL
|
super.urlIsInvalid() || currentWebView.url == HOME_URL
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ import android.os.Build;
|
|||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.core.app.NotificationCompat;
|
import androidx.core.app.NotificationCompat;
|
||||||
import javax.inject.Inject;
|
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.core.utils.Constants;
|
||||||
import org.kiwix.kiwixmobile.webserver.ZimHostActivity;
|
import org.kiwix.kiwixmobile.webserver.ZimHostActivity;
|
||||||
|
|
||||||
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 5.3 KiB After Width: | Height: | Size: 5.3 KiB |
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 4.1 KiB |
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 4.3 KiB |
Before Width: | Height: | Size: 8.3 KiB After Width: | Height: | Size: 8.3 KiB |
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 5.8 KiB |
Before Width: | Height: | Size: 6.0 KiB After Width: | Height: | Size: 6.0 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
@ -598,10 +598,12 @@ public abstract class CoreMainActivity extends BaseActivity
|
|||||||
tempVisitCount = 0;
|
tempVisitCount = 0;
|
||||||
visitCounterPref.setCount(tempVisitCount);
|
visitCounterPref.setCount(tempVisitCount);
|
||||||
})
|
})
|
||||||
.setIcon(ContextCompat.getDrawable(this, R.mipmap.ic_launcher))
|
.setIcon(ContextCompat.getDrawable(this, getIconResId()))
|
||||||
.show();
|
.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected abstract int getIconResId();
|
||||||
|
|
||||||
private void goToSearch(boolean isVoice) {
|
private void goToSearch(boolean isVoice) {
|
||||||
final String zimFile = zimReaderContainer.getZimCanonicalPath();
|
final String zimFile = zimReaderContainer.getZimCanonicalPath();
|
||||||
saveTabStates();
|
saveTabStates();
|
||||||
|
@ -21,13 +21,13 @@ package org.kiwix.kiwixmobile.custom.main
|
|||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import android.view.Menu
|
import android.view.Menu
|
||||||
import org.kiwix.kiwixmobile.core.R
|
|
||||||
import org.kiwix.kiwixmobile.core.extensions.ActivityExtensions.start
|
import org.kiwix.kiwixmobile.core.extensions.ActivityExtensions.start
|
||||||
import org.kiwix.kiwixmobile.core.main.CoreMainActivity
|
import org.kiwix.kiwixmobile.core.main.CoreMainActivity
|
||||||
import org.kiwix.kiwixmobile.core.main.WebViewCallback
|
import org.kiwix.kiwixmobile.core.main.WebViewCallback
|
||||||
import org.kiwix.kiwixmobile.core.reader.ZimReaderContainer
|
import org.kiwix.kiwixmobile.core.reader.ZimReaderContainer
|
||||||
import org.kiwix.kiwixmobile.core.utils.LanguageUtils
|
import org.kiwix.kiwixmobile.core.utils.LanguageUtils
|
||||||
import org.kiwix.kiwixmobile.custom.BuildConfig
|
import org.kiwix.kiwixmobile.custom.BuildConfig
|
||||||
|
import org.kiwix.kiwixmobile.custom.R
|
||||||
import org.kiwix.kiwixmobile.custom.customActivityComponent
|
import org.kiwix.kiwixmobile.custom.customActivityComponent
|
||||||
import org.kiwix.kiwixmobile.custom.download.CustomDownloadActivity
|
import org.kiwix.kiwixmobile.custom.download.CustomDownloadActivity
|
||||||
import org.kiwix.kiwixmobile.custom.main.ValidationState.HasBothFiles
|
import org.kiwix.kiwixmobile.custom.main.ValidationState.HasBothFiles
|
||||||
@ -83,6 +83,8 @@ class CustomMainActivity : CoreMainActivity() {
|
|||||||
zimReaderContainer: ZimReaderContainer
|
zimReaderContainer: ZimReaderContainer
|
||||||
) = CustomWebViewClient(webViewCallback, zimReaderContainer)
|
) = CustomWebViewClient(webViewCallback, zimReaderContainer)
|
||||||
|
|
||||||
|
override fun getIconResId() = R.mipmap.ic_launcher
|
||||||
|
|
||||||
private fun requireEnforcedLanguage(): Boolean {
|
private fun requireEnforcedLanguage(): Boolean {
|
||||||
val currentLocaleCode = Locale.getDefault().toString()
|
val currentLocaleCode = Locale.getDefault().toString()
|
||||||
if (BuildConfig.ENFORCED_LANG.isNotEmpty() && BuildConfig.ENFORCED_LANG != currentLocaleCode) {
|
if (BuildConfig.ENFORCED_LANG.isNotEmpty() && BuildConfig.ENFORCED_LANG != currentLocaleCode) {
|
||||||
|