#2199 removed old library activity and more unused

This commit is contained in:
HissPirat 2020-07-14 15:59:52 +02:00
parent f7828f7465
commit 567939b520
23 changed files with 14 additions and 387 deletions

View File

@ -142,17 +142,6 @@
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name=".zim_manager.ZimManageActivity"
android:label="@string/choose_file"
android:launchMode="singleTop">
<intent-filter>
<action android:name="org.kiwix.kiwixmobile.utils.KiwixSearchWidget.TEXT_CLICKED" />
<action android:name="org.kiwix.kiwixmobile.utils.KiwixSearchWidget.ICON_CLICKED" />
<action android:name="org.kiwix.kiwixmobile.utils.KiwixSearchWidget.MIC_CLICKED" />
<action android:name="org.kiwix.kiwixmobile.utils.KiwixSearchWidget.STAR_CLICKED" />
</intent-filter>
</activity>
<activity android:name=".language.LanguageActivity" />
<activity
android:name=".local_file_transfer.LocalFileTransferActivity"

View File

@ -34,7 +34,6 @@ import org.kiwix.kiwixmobile.settings.KiwixSettingsActivity
import org.kiwix.kiwixmobile.splash.KiwixSplashActivity
import org.kiwix.kiwixmobile.webserver.ZimHostActivity
import org.kiwix.kiwixmobile.webserver.ZimHostModule
import org.kiwix.kiwixmobile.zim_manager.ZimManageActivity
import org.kiwix.kiwixmobile.zim_manager.fileselect_view.ZimFileSelectFragment
import org.kiwix.kiwixmobile.zim_manager.fileselect_view.effects.DeleteFiles
import org.kiwix.kiwixmobile.zim_manager.library_view.LibraryFragment
@ -54,7 +53,6 @@ interface KiwixActivityComponent {
fun inject(localLibraryFragment: LocalLibraryFragment)
fun inject(deleteFiles: DeleteFiles)
fun inject(localFileTransferActivity: LocalFileTransferActivity)
fun inject(zimManageActivity: ZimManageActivity)
fun inject(languageActivity: LanguageActivity)
fun inject(kiwixSettingsActivity: KiwixSettingsActivity)
fun inject(zimHostActivity: ZimHostActivity)

View File

@ -1,37 +0,0 @@
/*
* Kiwix Android
* Copyright (c) 2019 Kiwix <android.kiwix.org>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package org.kiwix.kiwixmobile.main
import android.webkit.WebView
import org.kiwix.kiwixmobile.core.main.CoreWebViewClient
import org.kiwix.kiwixmobile.core.main.WebViewCallback
import org.kiwix.kiwixmobile.core.reader.ZimReaderContainer
class KiwixWebViewClient internal constructor(
callback: WebViewCallback,
zimReaderContainer: ZimReaderContainer
) : CoreWebViewClient(callback, zimReaderContainer) {
override fun onUrlEqualToHome(view: WebView) {
inflateHomeView(view)
}
override fun onInvalidUrl(view: WebView) {
inflateHomeView(view)
}
}

View File

@ -43,6 +43,7 @@ import org.kiwix.kiwixmobile.core.extensions.setImageDrawableCompat
import org.kiwix.kiwixmobile.core.extensions.snack
import org.kiwix.kiwixmobile.core.extensions.toast
import org.kiwix.kiwixmobile.core.main.CoreReaderFragment
import org.kiwix.kiwixmobile.core.main.CoreWebViewClient
import org.kiwix.kiwixmobile.core.main.WebViewCallback
import org.kiwix.kiwixmobile.core.reader.ZimReaderContainer
import org.kiwix.kiwixmobile.core.utils.SharedPreferenceUtil
@ -54,10 +55,8 @@ import org.kiwix.kiwixmobile.core.utils.TAG_KIWIX
import org.kiwix.kiwixmobile.core.utils.UpdateUtils
import org.kiwix.kiwixmobile.core.utils.files.FileUtils
import org.kiwix.kiwixmobile.kiwixActivityComponent
import org.kiwix.kiwixmobile.main.KiwixWebViewClient
import org.kiwix.kiwixmobile.navigate
import org.kiwix.kiwixmobile.webserver.ZimHostActivity
import org.kiwix.kiwixmobile.zim_manager.ZimManageActivity
import java.io.File
private const val HIDE_TAB_SWITCHER_DELAY: Long = 300
@ -163,7 +162,7 @@ class ReaderFragment : CoreReaderFragment() {
override fun createWebClient(
webViewCallback: WebViewCallback,
zimReaderContainer: ZimReaderContainer
) = KiwixWebViewClient(webViewCallback, zimReaderContainer)
) = CoreWebViewClient(webViewCallback, zimReaderContainer)
override fun onNewNavigationMenuClicked() {
// do nothing
@ -247,10 +246,6 @@ class ReaderFragment : CoreReaderFragment() {
}
}
override fun manageZimFiles(tab: Int) {
activity?.start<ZimManageActivity> { putExtra(ZimManageActivity.TAB_EXTRA, tab) }
}
override fun onNewIntent(
intent: Intent,
activity: AppCompatActivity

View File

@ -1,135 +0,0 @@
/*
* Kiwix Android
* Copyright (c) 2019 Kiwix <android.kiwix.org>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package org.kiwix.kiwixmobile.zim_manager
import android.content.Intent
import android.os.Bundle
import android.view.Menu
import android.view.MenuItem
import androidx.appcompat.widget.SearchView
import androidx.appcompat.widget.Toolbar
import androidx.lifecycle.ViewModelProvider
import kotlinx.android.synthetic.main.zim_manager.manageViewPager
import kotlinx.android.synthetic.main.zim_manager.tabs
import org.kiwix.kiwixmobile.R
import org.kiwix.kiwixmobile.core.base.BaseActivity
import org.kiwix.kiwixmobile.core.dao.NewLanguagesDao
import org.kiwix.kiwixmobile.core.di.components.CoreComponent
import org.kiwix.kiwixmobile.core.extensions.ActivityExtensions.start
import org.kiwix.kiwixmobile.core.extensions.ActivityExtensions.viewModel
import org.kiwix.kiwixmobile.core.utils.LanguageUtils
import org.kiwix.kiwixmobile.core.utils.SimpleTextListener
import org.kiwix.kiwixmobile.kiwixActivityComponent
import org.kiwix.kiwixmobile.language.LanguageActivity
import org.kiwix.kiwixmobile.local_file_transfer.LocalFileTransferActivity
import javax.inject.Inject
class ZimManageActivity : BaseActivity() {
override fun injection(coreComponent: CoreComponent) {
cachedComponent.inject(this)
}
val cachedComponent by lazy { kiwixActivityComponent }
private val zimManageViewModel by lazy { viewModel<ZimManageViewModel>(viewModelFactory) }
private val sectionsPagerAdapter: SectionsPagerAdapter by lazy {
SectionsPagerAdapter(this, fm = supportFragmentManager)
}
private var searchItem: MenuItem? = null
private var languageItem: MenuItem? = null
private var getZimItem: MenuItem? = null
@Inject lateinit var viewModelFactory: ViewModelProvider.Factory
@Inject lateinit var languagesDao: NewLanguagesDao
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
LanguageUtils.handleLocaleChange(this, sharedPreferenceUtil)
setContentView(R.layout.zim_manager)
setUpToolbar()
manageViewPager.run {
adapter = sectionsPagerAdapter
offscreenPageLimit = sectionsPagerAdapter.count - 1
tabs.setupWithViewPager(this)
addOnPageChangeListener(SimplePageChangeListener(::updateMenu))
addOnPageChangeListener(SimplePageChangeListener(::updatePage))
}
setViewPagerPositionFromIntent(intent)
}
private fun updatePage(position: Int) {
zimManageViewModel.currentPage.offer(position)
}
override fun onNewIntent(intent: Intent?) {
super.onNewIntent(intent)
setViewPagerPositionFromIntent(intent)
}
private fun setViewPagerPositionFromIntent(intent: Intent?) {
if (intent?.hasExtra(TAB_EXTRA) == true) {
manageViewPager.currentItem = intent.getIntExtra(TAB_EXTRA, 0)
}
}
private fun updateMenu(position: Int) {
searchItem?.isVisible = position == 1
languageItem?.isVisible = position == 1
getZimItem?.isVisible = position == 0
}
private fun setUpToolbar() {
val toolbar = findViewById<Toolbar>(R.id.toolbar)
setSupportActionBar(toolbar)
supportActionBar!!.setHomeButtonEnabled(true)
supportActionBar!!.setDisplayHomeAsUpEnabled(true)
supportActionBar!!.setTitle(R.string.library)
toolbar.setNavigationOnClickListener { onBackPressed() }
toolbar.setOnClickListener {
if (manageViewPager.currentItem == 1)
searchItem?.expandActionView()
}
}
override fun onCreateOptionsMenu(menu: Menu): Boolean {
// Inflate the menu; this adds items to the action bar if it is present.
menuInflater.inflate(R.menu.menu_zim_manager, menu)
searchItem = menu.findItem(R.id.action_search)
languageItem = menu.findItem(R.id.select_language)
getZimItem = menu.findItem(R.id.get_zim_nearby_device)
updateMenu(manageViewPager.currentItem)
(searchItem?.actionView as? SearchView)?.setOnQueryTextListener(
SimpleTextListener(zimManageViewModel.requestFiltering::onNext)
)
return true
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {
when (item.itemId) {
R.id.select_language -> start<LanguageActivity>()
R.id.get_zim_nearby_device -> start<LocalFileTransferActivity>()
}
return super.onOptionsItemSelected(item)
}
companion object {
const val TAB_EXTRA = "TAB"
}
}

View File

@ -1,6 +1,6 @@
/*
* Kiwix Android
* Copyright (c) 2019 Kiwix <android.kiwix.org>
* Copyright (c) 2020 Kiwix <android.kiwix.org>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@ -47,7 +47,7 @@ import org.kiwix.kiwixmobile.core.zim_manager.fileselect_view.adapter.BookOnDisk
import org.kiwix.kiwixmobile.core.zim_manager.fileselect_view.adapter.BookOnDiskDelegate.LanguageDelegate
import org.kiwix.kiwixmobile.core.zim_manager.fileselect_view.adapter.BooksOnDiskAdapter
import org.kiwix.kiwixmobile.core.zim_manager.fileselect_view.adapter.BooksOnDiskListItem
import org.kiwix.kiwixmobile.zim_manager.ZimManageActivity
import org.kiwix.kiwixmobile.kiwixActivityComponent
import org.kiwix.kiwixmobile.zim_manager.ZimManageViewModel
import org.kiwix.kiwixmobile.zim_manager.ZimManageViewModel.FileSelectActions
import org.kiwix.kiwixmobile.zim_manager.ZimManageViewModel.FileSelectActions.RequestMultiSelection
@ -81,7 +81,7 @@ open class ZimFileSelectFragment : BaseFragment() {
}
override fun inject(baseActivity: BaseActivity) {
(baseActivity as ZimManageActivity).cachedComponent.inject(this)
baseActivity.kiwixActivityComponent.inject(this)
}
override fun onCreateView(

View File

@ -48,10 +48,10 @@ import org.kiwix.kiwixmobile.core.utils.KiwixDialog.YesNoDialog.StopDownload
import org.kiwix.kiwixmobile.core.utils.KiwixDialog.YesNoDialog.WifiOnly
import org.kiwix.kiwixmobile.core.utils.NetworkUtils
import org.kiwix.kiwixmobile.core.utils.SharedPreferenceUtil
import org.kiwix.kiwixmobile.kiwixActivityComponent
import org.kiwix.kiwixmobile.zim_manager.NetworkState
import org.kiwix.kiwixmobile.zim_manager.NetworkState.CONNECTED
import org.kiwix.kiwixmobile.zim_manager.NetworkState.NOT_CONNECTED
import org.kiwix.kiwixmobile.zim_manager.ZimManageActivity
import org.kiwix.kiwixmobile.zim_manager.ZimManageViewModel
import org.kiwix.kiwixmobile.zim_manager.library_view.adapter.LibraryAdapter
import org.kiwix.kiwixmobile.zim_manager.library_view.adapter.LibraryDelegate.BookDelegate
@ -91,7 +91,7 @@ open class LibraryFragment : BaseFragment() {
private val isNotConnected get() = conMan.activeNetworkInfo?.isConnected == false
override fun inject(baseActivity: BaseActivity) {
(baseActivity as ZimManageActivity).cachedComponent.inject(this)
baseActivity.kiwixActivityComponent.inject(this)
}
override fun onCreateView(

View File

@ -1,32 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/zim_manager_main_activity"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="org.kiwix.kiwixmobile.zim_manager.ZimManageActivity">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<include layout="@layout/layout_toolbar" />
<com.google.android.material.tabs.TabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tabGravity="fill"
app:tabMaxWidth="0dp" />
</com.google.android.material.appbar.AppBarLayout>
<androidx.viewpager.widget.ViewPager
android:id="@+id/manageViewPager"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@ -980,10 +980,6 @@ public abstract class CoreReaderFragment extends BaseFragment
}
}
@Override public void onLibraryMenuClicked() {
manageZimFiles(hasLocalBooks ? 0 : 1);
}
@Override public void onRandomArticleMenuClicked() {
openRandomArticle();
}
@ -1381,10 +1377,6 @@ public abstract class CoreReaderFragment extends BaseFragment
if (intent.getAction() != null) {
if (zimReaderContainer.getId() != null) {
startIntentBasedOnAction(intent);
} else {
if (CoreSearchWidget.MIC_CLICKED.equals(intent.getAction())) {
manageZimFiles(0);
}
}
}
}
@ -1788,8 +1780,6 @@ public abstract class CoreReaderFragment extends BaseFragment
RecyclerView homeRecyclerView = view.findViewById(R.id.recycler_view);
presenter.loadBooks();
homeRecyclerView.setAdapter(booksAdapter);
downloadBookButton = view.findViewById(R.id.content_main_card_download_button);
downloadBookButton.setOnClickListener(v -> manageZimFiles(1));
updateTitle();
}

View File

@ -21,7 +21,6 @@ package org.kiwix.kiwixmobile.core.main;
import android.content.Intent;
import android.net.Uri;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.webkit.MimeTypeMap;
import android.webkit.WebResourceResponse;
@ -30,7 +29,6 @@ import android.webkit.WebViewClient;
import androidx.annotation.Nullable;
import java.util.HashMap;
import org.kiwix.kiwixmobile.core.CoreApp;
import org.kiwix.kiwixmobile.core.R;
import org.kiwix.kiwixmobile.core.reader.ZimReaderContainer;
import static org.kiwix.kiwixmobile.core.reader.ZimFileReader.CONTENT_PREFIX;
@ -38,7 +36,7 @@ import static org.kiwix.kiwixmobile.core.reader.ZimFileReader.UI_URI;
import static org.kiwix.kiwixmobile.core.utils.ConstantsKt.EXTRA_EXTERNAL_LINK;
import static org.kiwix.kiwixmobile.core.utils.ConstantsKt.TAG_KIWIX;
public abstract class CoreWebViewClient extends WebViewClient {
public class CoreWebViewClient extends WebViewClient {
private static final HashMap<String, String> DOCUMENT_TYPES = new HashMap<String, String>() {{
put("epub", "application/epub+zip");
put("pdf", "application/pdf");
@ -121,7 +119,10 @@ public abstract class CoreWebViewClient extends WebViewClient {
Log.d(TAG_KIWIX, "invalidUrl = " + invalidUrl);
if (invalidUrl) {
onInvalidUrl(view);
Log.e(
TAG_KIWIX,
"Abandoning WebView as there's a problem getting the content for this custom app."
);
return;
}
@ -129,18 +130,6 @@ public abstract class CoreWebViewClient extends WebViewClient {
callback.webViewUrlFinishedLoading();
}
protected abstract void onUrlEqualToHome(WebView view);
protected abstract void onInvalidUrl(WebView view);
protected void inflateHomeView(WebView view) {
LayoutInflater inflater = LayoutInflater.from(view.getContext());
home = inflater.inflate(R.layout.content_main, view, false);
callback.setHomePage(home);
view.removeAllViews();
view.addView(home);
}
@Nullable
@Override
public WebResourceResponse shouldInterceptRequest(WebView view, String url) {

View File

@ -23,7 +23,6 @@ import android.view.Menu
import android.view.MenuItem
import android.widget.TextView
import androidx.core.view.isVisible
import org.kiwix.kiwixmobile.core.BuildConfig
import org.kiwix.kiwixmobile.core.Intents.internal
import org.kiwix.kiwixmobile.core.R
import org.kiwix.kiwixmobile.core.extensions.ActivityExtensions.intent
@ -68,7 +67,6 @@ class MainMenu(
fun onAddNoteMenuClicked()
fun onBookmarksMenuClicked()
fun onRandomArticleMenuClicked()
fun onLibraryMenuClicked()
fun onReadAloudMenuClicked()
fun onFullscreenMenuClicked()
fun onSupportKiwixMenuClicked()
@ -86,7 +84,6 @@ class MainMenu(
tabSwitcher?.actionView?.findViewById(R.id.ic_tab_switcher_text)
private val bookmarks = menu.findItem(R.id.menu_bookmarks_list)
private val history = menu.findItem(R.id.menu_history)
private val library = menu.findItem(R.id.menu_openfile)
private val addNote = menu.findItem(R.id.menu_add_note)
private val randomArticle = menu.findItem(R.id.menu_random_article)
private val fullscreen = menu.findItem(R.id.menu_fullscreen)
@ -133,7 +130,6 @@ class MainMenu(
addNote.menuItemClickListener { menuClickListener.onAddNoteMenuClicked() }
bookmarks.menuItemClickListener { menuClickListener.onBookmarksMenuClicked() }
randomArticle.menuItemClickListener { menuClickListener.onRandomArticleMenuClicked() }
library.menuItemClickListener { menuClickListener.onLibraryMenuClicked() }
readAloud.menuItemClickListener { menuClickListener.onReadAloudMenuClicked() }
fullscreen.menuItemClickListener { menuClickListener.onFullscreenMenuClicked() }
supportKiwix.menuItemClickListener { menuClickListener.onSupportKiwixMenuClicked() }

View File

@ -31,8 +31,6 @@ public interface WebViewCallback {
void openExternalUrl(Intent intent);
void manageZimFiles(int tab);
void webViewProgressChanged(int progress);
void webViewTitleUpdated(String title);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 81 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 233 KiB

View File

@ -1,9 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="36dp"
android:viewportHeight="24.0"
android:viewportWidth="24.0"
android:width="36dp">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M18,2h-8L4.02,8 4,20c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2L20,4c0,-1.1 -0.9,-2 -2,-2zM12,8h-2L10,4h2v4zM15,8h-2L13,4h2v4zM18,8h-2L16,4h2v4z" />
</vector>

View File

@ -1,62 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?colorSurface"
tools:ignore="Overdraw">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.material.card.MaterialCardView
android:id="@+id/content_main_card"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
app:cardCornerRadius="4dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_width="0dp"
android:layout_height="144dp"
android:scaleType="fitXY"
android:src="@drawable/ic_home_kiwix_banner"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<!-- constraintRight_toRightOf is used as android:layoutDirection is supported from API 17 -->
<Button
android:id="@+id/content_main_card_download_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/activity_horizontal_margin"
android:text="@string/download_books"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.card.MaterialCardView>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/home_list_margin"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@id/content_main_card"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/content_main_card" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView>

View File

@ -26,12 +26,6 @@
android:title="@string/history"
app:showAsAction="never" />
<item
android:id="@+id/menu_openfile"
android:icon="@drawable/action_open_file"
android:title="@string/library"
app:showAsAction="never" />
<item
android:id="@+id/menu_add_note"
android:icon="@drawable/ic_add_note"

View File

@ -12,7 +12,6 @@
<dimen name="kiwix_search_widget_margin">1dp</dimen>
<dimen name="progress_view_height">2dp</dimen>
<dimen name="home_list_margin">8dp</dimen>
<dimen name="title_text_margin">16dp</dimen>
<dimen name="title_text_padding">16dp</dimen>
<dimen name="kiwix_search_widget_padding">0dp</dimen>

View File

@ -41,6 +41,7 @@ import org.kiwix.kiwixmobile.core.base.BaseFragmentActivityExtensions.Super
import org.kiwix.kiwixmobile.core.base.BaseFragmentActivityExtensions.Super.ShouldCall
import org.kiwix.kiwixmobile.core.extensions.ActivityExtensions.start
import org.kiwix.kiwixmobile.core.main.CoreReaderFragment
import org.kiwix.kiwixmobile.core.main.CoreWebViewClient
import org.kiwix.kiwixmobile.core.main.MainMenu
import org.kiwix.kiwixmobile.core.main.WebViewCallback
import org.kiwix.kiwixmobile.core.reader.ZimFileReader.Companion.CONTENT_PREFIX
@ -153,7 +154,6 @@ class CustomReaderFragment : CoreReaderFragment() {
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
super.onCreateOptionsMenu(menu, inflater)
menu.findItem(R.id.menu_help)?.isVisible = false
menu.findItem(R.id.menu_openfile)?.isVisible = false
menu.findItem(R.id.menu_host_books)?.isVisible = false
}
@ -162,7 +162,7 @@ class CustomReaderFragment : CoreReaderFragment() {
override fun createWebClient(
webViewCallback: WebViewCallback,
zimReaderContainer: ZimReaderContainer
) = CustomWebViewClient(webViewCallback, zimReaderContainer)
) = CoreWebViewClient(webViewCallback, zimReaderContainer)
override fun onNewNavigationMenuClicked() {
// do nothing
@ -202,10 +202,6 @@ class CustomReaderFragment : CoreReaderFragment() {
super.configureWebViewSelectionHandler(menu)
}
override fun manageZimFiles(tab: Int) {
// Do nothing
}
override fun showHomePage() {
Log.e("CustomMain", "tried to show home page")
}

View File

@ -1,42 +0,0 @@
/*
* Kiwix Android
* Copyright (c) 2019 Kiwix <android.kiwix.org>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package org.kiwix.kiwixmobile.custom.main
import android.util.Log
import android.webkit.WebView
import org.kiwix.kiwixmobile.core.main.CoreWebViewClient
import org.kiwix.kiwixmobile.core.main.WebViewCallback
import org.kiwix.kiwixmobile.core.reader.ZimReaderContainer
import org.kiwix.kiwixmobile.core.utils.TAG_KIWIX
class CustomWebViewClient internal constructor(
callback: WebViewCallback,
zimReaderContainer: ZimReaderContainer
) : CoreWebViewClient(callback, zimReaderContainer) {
override fun onUrlEqualToHome(view: WebView) {
// do nothing
}
override fun onInvalidUrl(view: WebView) {
Log.e(
TAG_KIWIX,
"Abandoning WebView as there's a problem getting the content for this custom app."
)
}
}