mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-08 06:42:21 -04:00
Fixed the UnsafeCallOnNullableType
detekt issue in the project.
This commit is contained in:
parent
7493b842b7
commit
6e195fc42f
@ -49,6 +49,7 @@ import kotlin.math.min
|
|||||||
* We refactor this java file to kotlin file
|
* We refactor this java file to kotlin file
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@Suppress("UnsafeCallOnNullableType")
|
||||||
class CustomPageIndicator @JvmOverloads constructor(
|
class CustomPageIndicator @JvmOverloads constructor(
|
||||||
context: Context,
|
context: Context,
|
||||||
attrs: AttributeSet? = null,
|
attrs: AttributeSet? = null,
|
||||||
@ -114,10 +115,10 @@ class CustomPageIndicator @JvmOverloads constructor(
|
|||||||
fun setViewPager(viewPager: ViewPager) {
|
fun setViewPager(viewPager: ViewPager) {
|
||||||
this.viewPager = viewPager
|
this.viewPager = viewPager
|
||||||
viewPager.addOnPageChangeListener(this)
|
viewPager.addOnPageChangeListener(this)
|
||||||
setPageCount(viewPager.adapter!!.count)
|
viewPager.adapter?.count?.let(::setPageCount)
|
||||||
viewPager.adapter!!.registerDataSetObserver(object : DataSetObserver() {
|
viewPager.adapter?.registerDataSetObserver(object : DataSetObserver() {
|
||||||
override fun onChanged() {
|
override fun onChanged() {
|
||||||
setPageCount(this@CustomPageIndicator.viewPager!!.adapter!!.count)
|
this@CustomPageIndicator.viewPager?.adapter?.count?.let(::setPageCount)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
setCurrentPageImmediate()
|
setCurrentPageImmediate()
|
||||||
|
@ -46,7 +46,7 @@ class LanguageViewModel @Inject constructor(
|
|||||||
|
|
||||||
init {
|
init {
|
||||||
compositeDisposable.addAll(
|
compositeDisposable.addAll(
|
||||||
actions.map { reduce(it, state.value!!) }
|
actions.map { state.value?.let { value -> reduce(it, value) } }
|
||||||
.distinctUntilChanged()
|
.distinctUntilChanged()
|
||||||
.subscribe(state::postValue, Throwable::printStackTrace),
|
.subscribe(state::postValue, Throwable::printStackTrace),
|
||||||
languageDao.languages().filter { it.isNotEmpty() }
|
languageDao.languages().filter { it.isNotEmpty() }
|
||||||
|
@ -59,7 +59,8 @@ internal class SenderDevice(
|
|||||||
.forEachIndexed { fileIndex, fileItem ->
|
.forEachIndexed { fileIndex, fileItem ->
|
||||||
try {
|
try {
|
||||||
Socket().use { socket ->
|
Socket().use { socket ->
|
||||||
context.contentResolver.openInputStream(fileItem?.fileUri!!).use { fileInputStream ->
|
fileItem?.fileUri?.let {
|
||||||
|
context.contentResolver.openInputStream(it).use { fileInputStream ->
|
||||||
socket.bind(null)
|
socket.bind(null)
|
||||||
socket.connect(
|
socket.connect(
|
||||||
InetSocketAddress(hostAddress, WifiDirectManager.FILE_TRANSFER_PORT),
|
InetSocketAddress(hostAddress, WifiDirectManager.FILE_TRANSFER_PORT),
|
||||||
@ -68,11 +69,13 @@ internal class SenderDevice(
|
|||||||
Log.d(TAG, "Sender socket connected to server - " + socket.isConnected)
|
Log.d(TAG, "Sender socket connected to server - " + socket.isConnected)
|
||||||
publishProgress(fileIndex, FileItem.FileStatus.SENDING)
|
publishProgress(fileIndex, FileItem.FileStatus.SENDING)
|
||||||
val socketOutputStream = socket.getOutputStream()
|
val socketOutputStream = socket.getOutputStream()
|
||||||
|
@Suppress("UnsafeCallOnNullableType")
|
||||||
copyToOutputStream(fileInputStream!!, socketOutputStream)
|
copyToOutputStream(fileInputStream!!, socketOutputStream)
|
||||||
if (BuildConfig.DEBUG) Log.d(TAG, "Sender: Data written")
|
if (BuildConfig.DEBUG) Log.d(TAG, "Sender: Data written")
|
||||||
publishProgress(fileIndex, FileItem.FileStatus.SENT)
|
publishProgress(fileIndex, FileItem.FileStatus.SENT)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} catch (e: IOException) {
|
} catch (e: IOException) {
|
||||||
e.message?.let { message ->
|
e.message?.let { message ->
|
||||||
Log.e(TAG, message)
|
Log.e(TAG, message)
|
||||||
|
@ -278,7 +278,7 @@ class OnlineLibraryFragment : BaseFragment(), FragmentActivityExtensions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun onRefreshStateChange(isRefreshing: Boolean?) {
|
private fun onRefreshStateChange(isRefreshing: Boolean?) {
|
||||||
fragmentDestinationDownloadBinding?.librarySwipeRefresh?.isRefreshing = isRefreshing!!
|
fragmentDestinationDownloadBinding?.librarySwipeRefresh?.isRefreshing = isRefreshing == true
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onNetworkStateChange(networkState: NetworkState?) {
|
private fun onNetworkStateChange(networkState: NetworkState?) {
|
||||||
@ -325,8 +325,10 @@ class OnlineLibraryFragment : BaseFragment(), FragmentActivityExtensions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun onLibraryItemsChange(it: List<LibraryListItem>?) {
|
private fun onLibraryItemsChange(it: List<LibraryListItem>?) {
|
||||||
libraryAdapter.items = it!!
|
if (it != null) {
|
||||||
if (it.isEmpty()) {
|
libraryAdapter.items = it
|
||||||
|
}
|
||||||
|
if (it?.isEmpty() == true) {
|
||||||
fragmentDestinationDownloadBinding?.libraryErrorText?.setText(
|
fragmentDestinationDownloadBinding?.libraryErrorText?.setText(
|
||||||
if (isNotConnected) R.string.no_network_connection
|
if (isNotConnected) R.string.no_network_connection
|
||||||
else R.string.no_items_msg
|
else R.string.no_items_msg
|
||||||
|
@ -262,6 +262,7 @@ class KiwixReaderFragment : CoreReaderFragment() {
|
|||||||
restoreTabs(zimArticles, zimPositions, currentTab)
|
restoreTabs(zimArticles, zimPositions, currentTab)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("UnsafeCallOnNullableType")
|
||||||
override fun createWebView(attrs: AttributeSet?): ToolbarScrollingKiwixWebView {
|
override fun createWebView(attrs: AttributeSet?): ToolbarScrollingKiwixWebView {
|
||||||
return ToolbarScrollingKiwixWebView(
|
return ToolbarScrollingKiwixWebView(
|
||||||
requireContext(), this, attrs!!, activityMainRoot as ViewGroup, videoView!!,
|
requireContext(), this, attrs!!, activityMainRoot as ViewGroup, videoView!!,
|
||||||
|
@ -68,11 +68,11 @@ class KiwixPrefsFragment : CorePrefsFragment() {
|
|||||||
showPermissionPreference()
|
showPermissionPreference()
|
||||||
val externalStorageManager = Environment.isExternalStorageManager()
|
val externalStorageManager = Environment.isExternalStorageManager()
|
||||||
if (externalStorageManager) {
|
if (externalStorageManager) {
|
||||||
permissionPref!!.setSummary(org.kiwix.kiwixmobile.core.R.string.allowed)
|
permissionPref?.setSummary(org.kiwix.kiwixmobile.core.R.string.allowed)
|
||||||
} else {
|
} else {
|
||||||
permissionPref!!.setSummary(org.kiwix.kiwixmobile.core.R.string.not_allowed)
|
permissionPref?.setSummary(org.kiwix.kiwixmobile.core.R.string.not_allowed)
|
||||||
}
|
}
|
||||||
permissionPref.onPreferenceClickListener =
|
permissionPref?.onPreferenceClickListener =
|
||||||
Preference.OnPreferenceClickListener {
|
Preference.OnPreferenceClickListener {
|
||||||
activity?.let(FragmentActivity::navigateToSettings)
|
activity?.let(FragmentActivity::navigateToSettings)
|
||||||
true
|
true
|
||||||
@ -84,7 +84,7 @@ class KiwixPrefsFragment : CorePrefsFragment() {
|
|||||||
val preferenceCategory = findPreference<PreferenceCategory>(
|
val preferenceCategory = findPreference<PreferenceCategory>(
|
||||||
PREF_PERMISSION
|
PREF_PERMISSION
|
||||||
)
|
)
|
||||||
preferenceCategory!!.isVisible = true
|
preferenceCategory?.isVisible = true
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@ -358,6 +358,7 @@ class ZimManageViewModel @Inject constructor(
|
|||||||
locale: Locale
|
locale: Locale
|
||||||
) = allLanguages.firstOrNull { it.languageCode == locale.isO3Language }?.active == true
|
) = allLanguages.firstOrNull { it.languageCode == locale.isO3Language }?.active == true
|
||||||
|
|
||||||
|
@Suppress("UnsafeCallOnNullableType")
|
||||||
private fun combineLibrarySources(
|
private fun combineLibrarySources(
|
||||||
booksOnFileSystem: List<BookOnDisk>,
|
booksOnFileSystem: List<BookOnDisk>,
|
||||||
activeDownloads: List<DownloadModel>,
|
activeDownloads: List<DownloadModel>,
|
||||||
|
@ -27,6 +27,7 @@ class AdapterDelegateManager<T> {
|
|||||||
delegates.put(delegates.size(), delegate)
|
delegates.put(delegates.size(), delegate)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("UnsafeCallOnNullableType")
|
||||||
fun createViewHolder(
|
fun createViewHolder(
|
||||||
parent: ViewGroup,
|
parent: ViewGroup,
|
||||||
viewType: Int
|
viewType: Int
|
||||||
@ -36,7 +37,7 @@ class AdapterDelegateManager<T> {
|
|||||||
libraryListItem: T,
|
libraryListItem: T,
|
||||||
holder: RecyclerView.ViewHolder
|
holder: RecyclerView.ViewHolder
|
||||||
) {
|
) {
|
||||||
delegates[holder.itemViewType]!!.bind(holder, libraryListItem)
|
delegates[holder.itemViewType]?.bind(holder, libraryListItem)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getViewTypeFor(item: T) = delegates.keyAt(getDelegateIndexFor(item))
|
fun getViewTypeFor(item: T) = delegates.keyAt(getDelegateIndexFor(item))
|
||||||
|
@ -75,6 +75,7 @@ class NewBookDao @Inject constructor(private val box: Box<BookOnDiskEntity>) {
|
|||||||
box.remove(databaseId)
|
box.remove(databaseId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("UnsafeCallOnNullableType")
|
||||||
fun migrationInsert(books: List<Book>) {
|
fun migrationInsert(books: List<Book>) {
|
||||||
insert(books.map { BookOnDisk(book = it, file = it.file!!) })
|
insert(books.map { BookOnDisk(book = it, file = it.file!!) })
|
||||||
}
|
}
|
||||||
|
@ -39,6 +39,7 @@ open class DatabaseModule {
|
|||||||
var boxStore: BoxStore? = null
|
var boxStore: BoxStore? = null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("UnsafeCallOnNullableType")
|
||||||
// NOT RECOMMENDED TODO use custom runner to load TestApplication
|
// NOT RECOMMENDED TODO use custom runner to load TestApplication
|
||||||
@Provides @Singleton fun providesBoxStore(context: Context): BoxStore {
|
@Provides @Singleton fun providesBoxStore(context: Context): BoxStore {
|
||||||
if (boxStore == null) {
|
if (boxStore == null) {
|
||||||
|
@ -44,6 +44,7 @@ class DownloaderImpl @Inject constructor(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("UnsafeCallOnNullableType")
|
||||||
private fun urlProvider(book: Book): Observable<String> =
|
private fun urlProvider(book: Book): Observable<String> =
|
||||||
if (book.url?.endsWith("meta4") == true) kiwixService.getMetaLinks(book.url!!)
|
if (book.url?.endsWith("meta4") == true) kiwixService.getMetaLinks(book.url!!)
|
||||||
.map { it.relevantUrl.value }
|
.map { it.relevantUrl.value }
|
||||||
|
@ -63,7 +63,7 @@ open class ErrorActivity : BaseActivity() {
|
|||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
activityKiwixErrorBinding = ActivityKiwixErrorBinding.inflate(layoutInflater)
|
activityKiwixErrorBinding = ActivityKiwixErrorBinding.inflate(layoutInflater)
|
||||||
setContentView(activityKiwixErrorBinding!!.root)
|
setContentView(activityKiwixErrorBinding?.root)
|
||||||
val extras = intent.extras
|
val extras = intent.extras
|
||||||
exception = if (extras != null && safeContains(extras)) {
|
exception = if (extras != null && safeContains(extras)) {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
||||||
@ -134,7 +134,7 @@ open class ErrorActivity : BaseActivity() {
|
|||||||
private fun exceptionDetails(): String =
|
private fun exceptionDetails(): String =
|
||||||
"""
|
"""
|
||||||
Exception Details:
|
Exception Details:
|
||||||
${toStackTraceString(exception!!)}
|
${exception?.let(::toStackTraceString)}
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
|
|
||||||
private fun zimFiles(): String {
|
private fun zimFiles(): String {
|
||||||
|
@ -610,10 +610,11 @@ abstract class CoreReaderFragment :
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun setupTabsAdapter() {
|
private fun setupTabsAdapter() {
|
||||||
tabsAdapter = TabsAdapter(
|
tabsAdapter = painter?.let {
|
||||||
|
TabsAdapter(
|
||||||
requireActivity() as AppCompatActivity,
|
requireActivity() as AppCompatActivity,
|
||||||
webViewList,
|
webViewList,
|
||||||
painter!!
|
it
|
||||||
).apply {
|
).apply {
|
||||||
registerAdapterDataObserver(object : AdapterDataObserver() {
|
registerAdapterDataObserver(object : AdapterDataObserver() {
|
||||||
override fun onChanged() {
|
override fun onChanged() {
|
||||||
@ -622,6 +623,7 @@ abstract class CoreReaderFragment :
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun addFileReader() {
|
private fun addFileReader() {
|
||||||
documentParserJs = requireActivity().readFile("js/documentParser.js")
|
documentParserJs = requireActivity().readFile("js/documentParser.js")
|
||||||
@ -638,7 +640,7 @@ abstract class CoreReaderFragment :
|
|||||||
override fun onSectionClick(view: View?, position: Int) {
|
override fun onSectionClick(view: View?, position: Int) {
|
||||||
loadUrlWithCurrentWebview(
|
loadUrlWithCurrentWebview(
|
||||||
"javascript:document.getElementById('" +
|
"javascript:document.getElementById('" +
|
||||||
documentSections!![position].id.replace("'", "\\'") +
|
documentSections?.get(position)?.id?.replace("'", "\\'") +
|
||||||
"').scrollIntoView();"
|
"').scrollIntoView();"
|
||||||
)
|
)
|
||||||
drawerLayout?.closeDrawers()
|
drawerLayout?.closeDrawers()
|
||||||
@ -670,7 +672,7 @@ abstract class CoreReaderFragment :
|
|||||||
if (tabsAdapter.selected < webViewList.size &&
|
if (tabsAdapter.selected < webViewList.size &&
|
||||||
recyclerView.layoutManager != null
|
recyclerView.layoutManager != null
|
||||||
) {
|
) {
|
||||||
recyclerView.layoutManager!!.scrollToPosition(tabsAdapter.selected)
|
recyclerView.layoutManager?.scrollToPosition(tabsAdapter.selected)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Notify the tabs adapter to update the UI when the tab switcher is shown
|
// Notify the tabs adapter to update the UI when the tab switcher is shown
|
||||||
@ -886,7 +888,8 @@ abstract class CoreReaderFragment :
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun getValidTitle(zimFileTitle: String?): String =
|
private fun getValidTitle(zimFileTitle: String?): String =
|
||||||
if (isAdded && isInvalidTitle(zimFileTitle)) getString(R.string.app_name) else zimFileTitle!!
|
if (isAdded && isInvalidTitle(zimFileTitle)) getString(R.string.app_name)
|
||||||
|
else zimFileTitle.toString()
|
||||||
|
|
||||||
private fun isInvalidTitle(zimFileTitle: String?): Boolean =
|
private fun isInvalidTitle(zimFileTitle: String?): Boolean =
|
||||||
zimFileTitle == null || zimFileTitle.trim { it <= ' ' }.isEmpty()
|
zimFileTitle == null || zimFileTitle.trim { it <= ' ' }.isEmpty()
|
||||||
@ -1058,6 +1061,7 @@ abstract class CoreReaderFragment :
|
|||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("UnsafeCallOnNullableType")
|
||||||
protected open fun createWebView(attrs: AttributeSet?): ToolbarScrollingKiwixWebView? {
|
protected open fun createWebView(attrs: AttributeSet?): ToolbarScrollingKiwixWebView? {
|
||||||
return if (activityMainRoot != null) {
|
return if (activityMainRoot != null) {
|
||||||
ToolbarScrollingKiwixWebView(
|
ToolbarScrollingKiwixWebView(
|
||||||
@ -1739,10 +1743,10 @@ abstract class CoreReaderFragment :
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun searchForTitle(title: String?, openInNewTab: Boolean) {
|
private fun searchForTitle(title: String?, openInNewTab: Boolean) {
|
||||||
val articleUrl: String? = if (title!!.startsWith("A/")) {
|
val articleUrl: String? = if (title?.startsWith("A/") == true) {
|
||||||
title
|
title
|
||||||
} else {
|
} else {
|
||||||
zimReaderContainer?.getPageUrlFromTitle(title)
|
title?.let { zimReaderContainer?.getPageUrlFromTitle(it) }
|
||||||
}
|
}
|
||||||
if (openInNewTab) {
|
if (openInNewTab) {
|
||||||
openArticleInNewTab(articleUrl)
|
openArticleInNewTab(articleUrl)
|
||||||
@ -1764,14 +1768,16 @@ abstract class CoreReaderFragment :
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected open fun createMainMenu(menu: Menu?): MainMenu? =
|
protected open fun createMainMenu(menu: Menu?): MainMenu? =
|
||||||
|
menu?.let {
|
||||||
menuFactory?.create(
|
menuFactory?.create(
|
||||||
menu!!,
|
it,
|
||||||
webViewList,
|
webViewList,
|
||||||
urlIsValid(),
|
urlIsValid(),
|
||||||
menuClickListener = this,
|
menuClickListener = this,
|
||||||
disableReadAloud = false,
|
disableReadAloud = false,
|
||||||
disableTabs = false
|
disableTabs = false
|
||||||
)
|
)
|
||||||
|
}
|
||||||
|
|
||||||
protected fun urlIsValid(): Boolean = getCurrentWebView()?.url != null
|
protected fun urlIsValid(): Boolean = getCurrentWebView()?.url != null
|
||||||
|
|
||||||
@ -1851,6 +1857,7 @@ abstract class CoreReaderFragment :
|
|||||||
requireActivity()
|
requireActivity()
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@Suppress("UnsafeCallOnNullableType")
|
||||||
getCurrentWebView()?.let {
|
getCurrentWebView()?.let {
|
||||||
val history = HistoryItem(
|
val history = HistoryItem(
|
||||||
it.url!!,
|
it.url!!,
|
||||||
|
@ -66,7 +66,7 @@ abstract class PageViewModel<T : Page, S : PageState<T>>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun viewStateReducer(): Disposable =
|
private fun viewStateReducer(): Disposable =
|
||||||
actions.map { reduce(it, state.value!!) }
|
actions.map { state.value?.let { value -> reduce(it, value) } }
|
||||||
.subscribe(state::postValue, Throwable::printStackTrace)
|
.subscribe(state::postValue, Throwable::printStackTrace)
|
||||||
|
|
||||||
protected fun addDisposablesToCompositeDisposable() {
|
protected fun addDisposablesToCompositeDisposable() {
|
||||||
|
@ -60,7 +60,7 @@ class RateDialogHandler @Inject constructor(
|
|||||||
fun checkForRateDialog(@IdRes iconResId: Int) {
|
fun checkForRateDialog(@IdRes iconResId: Int) {
|
||||||
isFirstRun = sharedPreferenceUtil.prefIsFirstRun
|
isFirstRun = sharedPreferenceUtil.prefIsFirstRun
|
||||||
visitCounterPref = RateAppCounter(activity)
|
visitCounterPref = RateAppCounter(activity)
|
||||||
tempVisitCount = visitCounterPref?.count!!
|
tempVisitCount = visitCounterPref?.count ?: 0
|
||||||
++tempVisitCount
|
++tempVisitCount
|
||||||
visitCounterPref?.count = tempVisitCount
|
visitCounterPref?.count = tempVisitCount
|
||||||
if (shouldShowRateDialog() && NetworkUtils.isNetworkAvailable(activity)) {
|
if (shouldShowRateDialog() && NetworkUtils.isNetworkAvailable(activity)) {
|
||||||
|
@ -136,9 +136,9 @@ object FileUtils {
|
|||||||
null
|
null
|
||||||
}
|
}
|
||||||
} else if (uri.scheme != null) {
|
} else if (uri.scheme != null) {
|
||||||
if ("content".equals(uri.scheme!!, ignoreCase = true)) {
|
if ("content".equals(uri.scheme, ignoreCase = true)) {
|
||||||
return contentQuery(context, uri)
|
return contentQuery(context, uri)
|
||||||
} else if ("file".equals(uri.scheme!!, ignoreCase = true)) {
|
} else if ("file".equals(uri.scheme, ignoreCase = true)) {
|
||||||
return uri.path
|
return uri.path
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -59,7 +59,9 @@ class CustomDownloadViewModel @Inject constructor(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun reducer() = actions.map { reduce(it, state.value!!) }
|
private fun reducer() = actions.map {
|
||||||
|
state.value?.let { value -> reduce(it, value) }
|
||||||
|
}
|
||||||
.distinctUntilChanged()
|
.distinctUntilChanged()
|
||||||
.subscribe(state::postValue, Throwable::printStackTrace)
|
.subscribe(state::postValue, Throwable::printStackTrace)
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ class CustomReaderFragment : CoreReaderFragment() {
|
|||||||
toolbarToc?.isEnabled = false
|
toolbarToc?.isEnabled = false
|
||||||
}
|
}
|
||||||
with(activity as AppCompatActivity) {
|
with(activity as AppCompatActivity) {
|
||||||
supportActionBar!!.setDisplayHomeAsUpEnabled(true)
|
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
||||||
toolbar?.let { setupDrawerToggle(it) }
|
toolbar?.let { setupDrawerToggle(it) }
|
||||||
}
|
}
|
||||||
loadPageFromNavigationArguments()
|
loadPageFromNavigationArguments()
|
||||||
@ -187,8 +187,9 @@ class CustomReaderFragment : CoreReaderFragment() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun createMainMenu(menu: Menu?): MainMenu? {
|
override fun createMainMenu(menu: Menu?): MainMenu? {
|
||||||
return menuFactory?.create(
|
return menu?.let {
|
||||||
menu!!,
|
menuFactory?.create(
|
||||||
|
it,
|
||||||
webViewList,
|
webViewList,
|
||||||
urlIsValid(),
|
urlIsValid(),
|
||||||
this,
|
this,
|
||||||
@ -196,6 +197,7 @@ class CustomReaderFragment : CoreReaderFragment() {
|
|||||||
BuildConfig.DISABLE_TABS
|
BuildConfig.DISABLE_TABS
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun showOpenInNewTabDialog(url: String) {
|
override fun showOpenInNewTabDialog(url: String) {
|
||||||
if (BuildConfig.DISABLE_TABS) return
|
if (BuildConfig.DISABLE_TABS) return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user