mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-09 15:27:55 -04:00
Refactored the remaining code to remove the Hotspot feature from custom app.
This commit is contained in:
parent
4cb8776644
commit
06ae81b8b0
@ -49,6 +49,7 @@
|
|||||||
<ID>PackageNaming:HotspotStateReceiver.kt$package org.kiwix.kiwixmobile.webserver.wifi_hotspot</ID>
|
<ID>PackageNaming:HotspotStateReceiver.kt$package org.kiwix.kiwixmobile.webserver.wifi_hotspot</ID>
|
||||||
<ID>PackageNaming:IpAddressCallbacks.kt$package org.kiwix.kiwixmobile.webserver.wifi_hotspot</ID>
|
<ID>PackageNaming:IpAddressCallbacks.kt$package org.kiwix.kiwixmobile.webserver.wifi_hotspot</ID>
|
||||||
<ID>PackageNaming:HotspotService.kt$package org.kiwix.kiwixmobile.webserver.wifi_hotspot</ID>
|
<ID>PackageNaming:HotspotService.kt$package org.kiwix.kiwixmobile.webserver.wifi_hotspot</ID>
|
||||||
|
<ID>PackageNaming:ServerStatus.kt$package org.kiwix.kiwixmobile.webserver.wifi_hotspot</ID>
|
||||||
<ID>PackageNaming:ZimManageViewModel.kt$package org.kiwix.kiwixmobile.zimManager</ID>
|
<ID>PackageNaming:ZimManageViewModel.kt$package org.kiwix.kiwixmobile.zimManager</ID>
|
||||||
<ID>ReturnCount:Fat32Checker.kt$Fat32Checker$private fun canCreate4GbFile(storage: String): Boolean</ID>
|
<ID>ReturnCount:Fat32Checker.kt$Fat32Checker$private fun canCreate4GbFile(storage: String): Boolean</ID>
|
||||||
<ID>TooGenericExceptionCaught:FileWritingFileSystemChecker.kt$FileWritingFileSystemChecker$e: Exception</ID>
|
<ID>TooGenericExceptionCaught:FileWritingFileSystemChecker.kt$FileWritingFileSystemChecker$e: Exception</ID>
|
||||||
|
@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
* 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.di.components
|
||||||
|
|
||||||
|
import android.app.Service
|
||||||
|
import dagger.BindsInstance
|
||||||
|
import dagger.Subcomponent
|
||||||
|
import org.kiwix.kiwixmobile.di.ServiceScope
|
||||||
|
import org.kiwix.kiwixmobile.di.modules.ServiceModule
|
||||||
|
import org.kiwix.kiwixmobile.webserver.wifi_hotspot.HotspotService
|
||||||
|
|
||||||
|
@Subcomponent(modules = [ServiceModule::class])
|
||||||
|
@ServiceScope
|
||||||
|
interface ServiceComponent {
|
||||||
|
fun inject(hotspotService: HotspotService)
|
||||||
|
|
||||||
|
@Subcomponent.Builder
|
||||||
|
interface Builder {
|
||||||
|
@BindsInstance fun service(service: Service): Builder
|
||||||
|
fun build(): ServiceComponent
|
||||||
|
}
|
||||||
|
}
|
@ -20,7 +20,6 @@ package org.kiwix.kiwixmobile.di.modules
|
|||||||
|
|
||||||
import dagger.Module
|
import dagger.Module
|
||||||
import org.kiwix.kiwixmobile.core.di.modules.ActivityModule
|
import org.kiwix.kiwixmobile.core.di.modules.ActivityModule
|
||||||
import org.kiwix.kiwixmobile.webserver.ZimHostModule
|
|
||||||
|
|
||||||
@Module(includes = [ActivityModule::class, ZimHostModule::class])
|
@Module(includes = [ActivityModule::class])
|
||||||
class KiwixActivityModule
|
class KiwixActivityModule
|
||||||
|
@ -41,6 +41,7 @@ import com.google.android.material.navigation.NavigationView
|
|||||||
import eu.mhutti1.utils.storage.StorageDeviceUtils
|
import eu.mhutti1.utils.storage.StorageDeviceUtils
|
||||||
import org.kiwix.kiwixmobile.BuildConfig
|
import org.kiwix.kiwixmobile.BuildConfig
|
||||||
import org.kiwix.kiwixmobile.R
|
import org.kiwix.kiwixmobile.R
|
||||||
|
import org.kiwix.kiwixmobile.core.R.id
|
||||||
import org.kiwix.kiwixmobile.core.R.drawable
|
import org.kiwix.kiwixmobile.core.R.drawable
|
||||||
import org.kiwix.kiwixmobile.core.R.mipmap
|
import org.kiwix.kiwixmobile.core.R.mipmap
|
||||||
import org.kiwix.kiwixmobile.core.R.string
|
import org.kiwix.kiwixmobile.core.R.string
|
||||||
@ -273,7 +274,7 @@ class KiwixMainActivity : CoreMainActivity() {
|
|||||||
|
|
||||||
override fun onNavigationItemSelected(item: MenuItem): Boolean {
|
override fun onNavigationItemSelected(item: MenuItem): Boolean {
|
||||||
when (item.itemId) {
|
when (item.itemId) {
|
||||||
R.id.menu_host_books -> openZimHostFragment()
|
id.menu_host_books -> openZimHostFragment()
|
||||||
else -> return super.onNavigationItemSelected(item)
|
else -> return super.onNavigationItemSelected(item)
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
|
@ -382,7 +382,7 @@ class CopyMoveFileHandler @Inject constructor(
|
|||||||
@SuppressLint("InflateParams") fun showPreparingCopyMoveDialog() {
|
@SuppressLint("InflateParams") fun showPreparingCopyMoveDialog() {
|
||||||
if (copyMovePreparingDialog == null) {
|
if (copyMovePreparingDialog == null) {
|
||||||
val dialogView: View =
|
val dialogView: View =
|
||||||
activity.layoutInflater.inflate(R.layout.item_custom_spinner, null)
|
activity.layoutInflater.inflate(layout.item_custom_spinner, null)
|
||||||
copyMovePreparingDialog =
|
copyMovePreparingDialog =
|
||||||
alertDialogShower.create(KiwixDialog.PreparingCopyingFilesDialog { dialogView })
|
alertDialogShower.create(KiwixDialog.PreparingCopyingFilesDialog { dialogView })
|
||||||
}
|
}
|
||||||
|
@ -43,9 +43,9 @@ import androidx.core.app.ActivityCompat
|
|||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
import androidx.fragment.app.FragmentActivity
|
import androidx.fragment.app.FragmentActivity
|
||||||
import org.kiwix.kiwixmobile.core.R
|
import org.kiwix.kiwixmobile.core.R
|
||||||
|
import org.kiwix.kiwixmobile.R.layout
|
||||||
import org.kiwix.kiwixmobile.core.base.BaseActivity
|
import org.kiwix.kiwixmobile.core.base.BaseActivity
|
||||||
import org.kiwix.kiwixmobile.core.base.BaseFragment
|
import org.kiwix.kiwixmobile.core.base.BaseFragment
|
||||||
import org.kiwix.kiwixmobile.core.databinding.ActivityZimHostBinding
|
|
||||||
import org.kiwix.kiwixmobile.core.extensions.ActivityExtensions.hasNotificationPermission
|
import org.kiwix.kiwixmobile.core.extensions.ActivityExtensions.hasNotificationPermission
|
||||||
import org.kiwix.kiwixmobile.core.extensions.ActivityExtensions.isCustomApp
|
import org.kiwix.kiwixmobile.core.extensions.ActivityExtensions.isCustomApp
|
||||||
import org.kiwix.kiwixmobile.core.extensions.ActivityExtensions.isManageExternalStoragePermissionGranted
|
import org.kiwix.kiwixmobile.core.extensions.ActivityExtensions.isManageExternalStoragePermissionGranted
|
||||||
@ -67,6 +67,7 @@ import org.kiwix.kiwixmobile.core.zim_manager.fileselect_view.adapter.BookOnDisk
|
|||||||
import org.kiwix.kiwixmobile.core.zim_manager.fileselect_view.adapter.BooksOnDiskAdapter
|
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.core.zim_manager.fileselect_view.adapter.BooksOnDiskListItem
|
||||||
import org.kiwix.kiwixmobile.core.zim_manager.fileselect_view.adapter.BooksOnDiskListItem.BookOnDisk
|
import org.kiwix.kiwixmobile.core.zim_manager.fileselect_view.adapter.BooksOnDiskListItem.BookOnDisk
|
||||||
|
import org.kiwix.kiwixmobile.databinding.ActivityZimHostBinding
|
||||||
import org.kiwix.kiwixmobile.main.KiwixMainActivity
|
import org.kiwix.kiwixmobile.main.KiwixMainActivity
|
||||||
import org.kiwix.kiwixmobile.webserver.wifi_hotspot.HotspotService
|
import org.kiwix.kiwixmobile.webserver.wifi_hotspot.HotspotService
|
||||||
import org.kiwix.kiwixmobile.webserver.wifi_hotspot.HotspotService.Companion.ACTION_CHECK_IP_ADDRESS
|
import org.kiwix.kiwixmobile.webserver.wifi_hotspot.HotspotService.Companion.ACTION_CHECK_IP_ADDRESS
|
||||||
@ -275,7 +276,7 @@ class ZimHostFragment : BaseFragment(), ZimHostCallbacks, ZimHostContract.View {
|
|||||||
private fun startKiwixHotspot() {
|
private fun startKiwixHotspot() {
|
||||||
if (dialog == null) {
|
if (dialog == null) {
|
||||||
val dialogView: View =
|
val dialogView: View =
|
||||||
layoutInflater.inflate(R.layout.item_custom_spinner, null)
|
layoutInflater.inflate(layout.item_custom_spinner, null)
|
||||||
dialog = alertDialogShower.create(StartServer { dialogView })
|
dialog = alertDialogShower.create(StartServer { dialogView })
|
||||||
}
|
}
|
||||||
dialog?.show()
|
dialog?.show()
|
||||||
|
@ -129,5 +129,5 @@ interface CoreComponent {
|
|||||||
fun inject(objectBoxToRoomMigrator: ObjectBoxToRoomMigrator)
|
fun inject(objectBoxToRoomMigrator: ObjectBoxToRoomMigrator)
|
||||||
|
|
||||||
fun inject(settingsFragment: CoreSettingsFragment)
|
fun inject(settingsFragment: CoreSettingsFragment)
|
||||||
fun coreServiceComponent(): org.kiwix.kiwixmobile.di.components.CoreServiceComponent.Builder
|
fun coreServiceComponent(): CoreServiceComponent.Builder
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,7 @@ import android.app.Service
|
|||||||
import dagger.BindsInstance
|
import dagger.BindsInstance
|
||||||
import dagger.Subcomponent
|
import dagger.Subcomponent
|
||||||
import org.kiwix.kiwixmobile.core.di.CoreServiceScope
|
import org.kiwix.kiwixmobile.core.di.CoreServiceScope
|
||||||
|
import org.kiwix.kiwixmobile.core.di.modules.CoreServiceModule
|
||||||
import org.kiwix.kiwixmobile.core.read_aloud.ReadAloudService
|
import org.kiwix.kiwixmobile.core.read_aloud.ReadAloudService
|
||||||
|
|
||||||
@Subcomponent(modules = [CoreServiceModule::class])
|
@Subcomponent(modules = [CoreServiceModule::class])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user