correct core packaging, alter pre-commit hook and travis for multimodule build

This commit is contained in:
Sean Mac Gillicuddy 2019-10-01 13:32:25 +01:00
parent 449d47ca3f
commit 26c203f287
284 changed files with 2080 additions and 1968 deletions

View File

@ -23,11 +23,6 @@ install:
- pip install --user 'requests[security]'
- wget -r -nH -nd -np -R index.html* robots.txt* http://download.kiwix.org/dev/android/api/licenses/ -e robots=off -P $ANDROID_HOME/licenses || true
addons:
apt:
packages:
- lynx
before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
@ -57,23 +52,15 @@ before_script:
- adb shell input keyevent 82 &
script:
- ./gradlew createKiwixDebugCoverageReport lintKiwixDebug jacocoTestKiwixDebugUnitTestReport assemble
- ./gradlew createDebugCoverageReport ktlintCheck lint jacocoTestReport assembleRelease
after_success:
- bash <(curl -s https://codecov.io/bash)
- ./gradlew kiwixtestUploadKiwix
after_failure:
- export REPORT_DIR=${TRAVIS_HOME}/build/kiwix/kiwix-android/app/build/outputs/reports/
- export LOG_DIR=${REPORT_DIR}androidTests/connected/flavors/KIWIX/
- lynx -dump ${LOG_DIR}index.html
- lynx -dump ${REPORT_DIR}lint-results-kiwixDebug.html
before_deploy:
# - export APP_CHANGELOG=$(cat app/src/kiwix/play/release-notes/en-US/default.txt)
- export DATE=$(date +%Y-%m-%d)
- export OUTPUT_DIR=app/build/outputs/apk/kiwix
- export OUTPUT_DIR=app/build/outputs/apk
- export UNIVERSAL_RELEASE_APK=$OUTPUT_DIR/release/*universal*.apk
- export UNIVERSAL_DEBUG_APK=$OUTPUT_DIR/debug/*universal*.apk
- export SSH_KEY=travisci_builder_id_key
@ -96,7 +83,7 @@ deploy:
#publish on play store
- provider: script
skip_cleanup: true
script: ./gradlew publishKiwixRelease
script: ./gradlew publishRelease
on:
tags: true

View File

@ -9,9 +9,7 @@ buildscript {
dependencies {
dependencies {
classpath Libs.com_android_tools_build_gradle
classpath Libs.kotlin_gradle_plugin
classpath Libs.ktlint_gradle
}
}
}
@ -27,13 +25,7 @@ apply plugin: 'kotlin-kapt'
apply plugin: 'jacoco-android'
apply plugin: "org.jlleitschuh.gradle.ktlint"
jacoco {
toolVersion = "0.8.3"
}
tasks.withType(Test) {
jacoco.includeNoLocationClasses = true
}
def buildNumber = System.getenv('TRAVIS_BUILD_NUMBER') ?: "dev"
@ -76,14 +68,23 @@ android {
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
archivesBaseName = "$buildNumber"
// Set vanilla config
buildConfigField "boolean", "IS_CUSTOM_APP", "false"
buildConfigField "boolean", "HAS_EMBEDDED_ZIM", "false"
buildConfigField "String", "ZIM_FILE_NAME", "\"\""
buildConfigField "long", "ZIM_FILE_SIZE", "0"
buildConfigField "int", "CONTENT_VERSION_CODE", "0"
buildConfigField "String", "ENFORCED_LANG", "\"\""
resValue "string", "app_name", "Kiwix"
resValue "string", "app_search_string", "Search Kiwix"
versionCode generateVersionCode()
versionName generateVersionName()
}
aaptOptions {
cruncherEnabled true
}
testBuildType "debug"
lintOptions {
abortOnError true
checkAllWarnings true
@ -117,8 +118,6 @@ android {
}
}
flavorDimensions "default"
signingConfigs {
release {
storeFile file("../kiwix-android.keystore")
@ -149,33 +148,6 @@ android {
}
}
productFlavors {
// Vanilla Kiwix app
kiwix {
println "Configuring Kiwix"
// Set vanilla config
buildConfigField "boolean", "IS_CUSTOM_APP", "false"
buildConfigField "boolean", "HAS_EMBEDDED_ZIM", "false"
buildConfigField "String", "ZIM_FILE_NAME", "\"\""
buildConfigField "long", "ZIM_FILE_SIZE", "0"
buildConfigField "int", "CONTENT_VERSION_CODE", "0"
buildConfigField "String", "ENFORCED_LANG", "\"\""
resValue "string", "app_name", "Kiwix"
resValue "string", "app_search_string", "Search Kiwix"
if (project.hasProperty("version_code")) {
def version_code = project.property("version_code")
versionCode version_code.toInteger()
} else {
versionCode generateVersionCode()
}
if (project.hasProperty("version_name")) {
versionName project.property("version_name")
} else {
versionName generateVersionName()
}
}
}
compileOptions {
encoding = "UTF-8"
sourceCompatibility JavaVersion.VERSION_1_8
@ -229,35 +201,43 @@ ktlint {
android = true
}
jacoco {
toolVersion = "0.8.3"
}
tasks.withType(Test) {
jacoco.includeNoLocationClasses = true
}
apply from: "${rootDir}/team-props/git-hooks.gradle"
dependencies {
implementation project(":core")
implementation(Libs.appcompat)
androidTestImplementation(Libs.espresso_core)
androidTestImplementation(Libs.espresso_web)
androidTestImplementation(Libs.espresso_intents)
androidTestImplementation(Libs.barista) {
exclude group: "com.android.support.test.uiautomator"
}
androidTestImplementation(Libs.espresso_contrib)
androidTestImplementation(Libs.androidx_annotation)
androidTestImplementation(Libs.junit)
androidTestImplementation(Libs.androidx_test_runner)
androidTestImplementation(Libs.androidx_test_rules)
androidTestImplementation(Libs.androidx_test_core)
androidTestImplementation(Libs.mockwebserver)
androidTestUtil(Libs.orchestrator)
androidTestImplementation(Libs.mockito_android)
androidTestCompileOnly(Libs.javax_annotation_api)
implementation(Libs.dagger)
kaptAndroidTest(Libs.dagger_compiler)
androidTestImplementation(Libs.mockk_android)
androidTestImplementation(Libs.uiautomator)
androidTestImplementation(Libs.assertj_core)
androidTestImplementation(Libs.simple_xml) {
exclude module: 'stax'
exclude module: 'stax-api'
exclude module: 'xpp3'
}
dependencies {
implementation project(":core")
implementation(Libs.appcompat)
androidTestImplementation(Libs.espresso_core)
androidTestImplementation(Libs.espresso_web)
androidTestImplementation(Libs.espresso_intents)
androidTestImplementation(Libs.barista) {
exclude group: "com.android.support.test.uiautomator"
}
androidTestImplementation(Libs.espresso_contrib)
androidTestImplementation(Libs.androidx_annotation)
androidTestImplementation(Libs.junit)
androidTestImplementation(Libs.androidx_test_runner)
androidTestImplementation(Libs.androidx_test_rules)
androidTestImplementation(Libs.androidx_test_core)
androidTestImplementation(Libs.mockwebserver)
androidTestUtil(Libs.orchestrator)
androidTestImplementation(Libs.mockito_android)
androidTestCompileOnly(Libs.javax_annotation_api)
implementation(Libs.dagger)
kaptAndroidTest(Libs.dagger_compiler)
androidTestImplementation(Libs.mockk_android)
androidTestImplementation(Libs.uiautomator)
androidTestImplementation(Libs.assertj_core)
androidTestImplementation(Libs.simple_xml) {
exclude module: 'stax'
exclude module: 'stax-api'
exclude module: 'xpp3'
}
}

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<issues format="5" by="lint 3.5.0" client="gradle" variant="all" version="3.5.0">
<issues format="5" by="lint 3.5.0" client="gradle" variant="debug" version="3.5.0">
<issue
id="ObsoleteLintCustomCheck"
@ -8,6 +8,17 @@
file="..\..\..\.android\lint\customlint.jar"/>
</issue>
<issue
id="MissingRegistered"
message="Class referenced in the manifest, `org.kiwix.kiwixmobile.zim_manager.ZimManageActivity`, was not found in the project or the libraries"
errorLine1=" &lt;activity"
errorLine2=" ^">
<location
file="src\main\AndroidManifest.xml"
line="143"
column="5"/>
</issue>
<issue
id="OldTargetApi"
message="Not targeting the latest versions of Android; compatibility modes apply. Consider testing and updating this version. Consult the android.os.Build.VERSION_CODES javadoc for details."
@ -15,7 +26,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~">
<location
file="build.gradle"
line="74"
line="68"
column="5"/>
</issue>

View File

@ -37,7 +37,7 @@ import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.kiwix.kiwixmobile.main.MainActivity;
import org.kiwix.kiwixmobile.core.main.MainActivity;
import org.kiwix.kiwixmobile.utils.KiwixIdlingResource;
import static androidx.test.espresso.Espresso.onData;

View File

@ -4,6 +4,7 @@ import okhttp3.mockwebserver.Dispatcher
import okhttp3.mockwebserver.MockResponse
import okhttp3.mockwebserver.MockWebServer
import okhttp3.mockwebserver.RecordedRequest
import org.kiwix.kiwixmobile.core.TEST_PORT
import org.simpleframework.xml.core.Persister
import java.io.StringWriter
import java.util.Stack

View File

@ -36,10 +36,11 @@ import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.kiwix.kiwixmobile.data.ZimContentProvider;
import org.kiwix.kiwixmobile.core.KiwixApplication;
import org.kiwix.kiwixmobile.core.data.ZimContentProvider;
import org.kiwix.kiwixmobile.di.components.DaggerTestComponent;
import org.kiwix.kiwixmobile.di.components.TestComponent;
import org.kiwix.kiwixmobile.main.MainActivity;
import org.kiwix.kiwixmobile.core.main.MainActivity;
import org.kiwix.kiwixmobile.testutils.TestUtils;
import org.kiwix.kiwixmobile.utils.KiwixIdlingResource;

View File

@ -7,6 +7,7 @@ import androidx.test.rule.GrantPermissionRule;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.kiwix.kiwixmobile.core.bookmark.BookmarksActivity;
@RunWith(AndroidJUnit4.class)
public class BookmarksActivityTest {

View File

@ -34,6 +34,7 @@ import java.io.Writer;
import java.util.ArrayList;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.kiwix.kiwixmobile.core.data.local.KiwixDatabase;
import org.kiwix.kiwixmobile.data.local.entity.Bookmark;
import static org.junit.Assert.assertArrayEquals;

View File

@ -26,13 +26,14 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.kiwix.kiwixmobile.data.local.KiwixDatabase;
import org.kiwix.kiwixmobile.core.data.local.KiwixDatabase;
import org.kiwix.kiwixmobile.core.data.local.dao.BookDao;
import org.kiwix.kiwixmobile.data.local.entity.BookDatabaseEntity;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import static org.junit.Assert.assertEquals;
import static org.kiwix.kiwixmobile.library.entity.LibraryNetworkEntity.Book;
import static org.kiwix.kiwixmobile.core.entity.LibraryNetworkEntity.Book;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;

View File

@ -23,7 +23,8 @@ import com.yahoo.squidb.sql.Query;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.kiwix.kiwixmobile.data.local.KiwixDatabase;
import org.kiwix.kiwixmobile.core.data.local.KiwixDatabase;
import org.kiwix.kiwixmobile.core.data.local.dao.RecentSearchDao;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;

View File

@ -22,9 +22,10 @@ import dagger.BindsInstance
import dagger.Component
import org.kiwix.kiwixmobile.NetworkTest
import org.kiwix.kiwixmobile.ZimTest
import org.kiwix.kiwixmobile.data.DataModule
import org.kiwix.kiwixmobile.di.modules.ApplicationModule
import org.kiwix.kiwixmobile.di.modules.JNIModule
import org.kiwix.kiwixmobile.core.data.DataModule
import org.kiwix.kiwixmobile.core.di.components.ApplicationComponent
import org.kiwix.kiwixmobile.core.di.modules.ApplicationModule
import org.kiwix.kiwixmobile.core.di.modules.JNIModule
import org.kiwix.kiwixmobile.di.modules.TestNetworkModule
import javax.inject.Singleton

View File

@ -19,8 +19,9 @@ package org.kiwix.kiwixmobile.di.modules
import dagger.Module
import okhttp3.OkHttpClient
import org.kiwix.kiwixmobile.MOCK_BASE_URL
import org.kiwix.kiwixmobile.data.remote.KiwixService
import org.kiwix.kiwixmobile.core.MOCK_BASE_URL
import org.kiwix.kiwixmobile.core.data.remote.KiwixService
import org.kiwix.kiwixmobile.core.di.modules.NetworkModule
/**
* Created by mhutti1 on 14/04/17.

View File

@ -22,6 +22,7 @@ import androidx.test.filters.SdkSuppress
import androidx.test.rule.ActivityTestRule
import org.junit.Test
import org.kiwix.kiwixmobile.BaseActivityTest
import org.kiwix.kiwixmobile.core.help.HelpActivity
@SdkSuppress(minSdkVersion = Build.VERSION_CODES.JELLY_BEAN_MR2)
class HelpActivityTest : BaseActivityTest<HelpActivity>() {

View File

@ -21,6 +21,7 @@ import android.os.Build
import androidx.test.filters.SdkSuppress
import org.junit.Test
import org.kiwix.kiwixmobile.BaseActivityTest
import org.kiwix.kiwixmobile.core.intro.IntroActivity
@SdkSuppress(minSdkVersion = Build.VERSION_CODES.JELLY_BEAN_MR2)
class IntroActivityTest : BaseActivityTest<IntroActivity>() {

View File

@ -30,6 +30,7 @@ import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.kiwix.kiwixmobile.core.R;
import org.kiwix.kiwixmobile.core.main.MainActivity;
import static com.schibsted.spain.barista.interaction.BaristaClickInteractions.clickOn;
import static org.kiwix.kiwixmobile.testutils.TestUtils.TEST_PAUSE_MS;

View File

@ -8,6 +8,7 @@ import androidx.test.rule.GrantPermissionRule;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.kiwix.kiwixmobile.core.search.SearchActivity;
@LargeTest
@RunWith(AndroidJUnit4.class)

View File

@ -23,7 +23,7 @@ import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.kiwix.kiwixmobile.core.R;
import org.kiwix.kiwixmobile.main.MainActivity;
import org.kiwix.kiwixmobile.core.main.MainActivity;
import static androidx.test.espresso.Espresso.onData;
import static androidx.test.espresso.action.ViewActions.click;

View File

@ -34,15 +34,16 @@ import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.kiwix.kiwixmobile.intro.IntroActivity;
import org.kiwix.kiwixmobile.main.MainActivity;
import org.kiwix.kiwixmobile.core.intro.IntroActivity;
import org.kiwix.kiwixmobile.core.main.MainActivity;
import org.kiwix.kiwixmobile.core.splash.SplashActivity;
import static androidx.test.InstrumentationRegistry.getInstrumentation;
import static androidx.test.espresso.intent.Intents.intended;
import static androidx.test.espresso.intent.matcher.IntentMatchers.hasComponent;
import static org.junit.Assert.assertEquals;
import static org.kiwix.kiwixmobile.testutils.TestUtils.TEST_PAUSE_MS;
import static org.kiwix.kiwixmobile.utils.SharedPreferenceUtil.PREF_SHOW_INTRO;
import static org.kiwix.kiwixmobile.core.utils.SharedPreferenceUtil.PREF_SHOW_INTRO;
@LargeTest
@RunWith(AndroidJUnit4.class)

View File

@ -40,7 +40,7 @@ import java.text.SimpleDateFormat;
import java.util.Date;
import org.hamcrest.Description;
import org.hamcrest.Matcher;
import org.kiwix.kiwixmobile.library.entity.LibraryNetworkEntity.Book;
import org.kiwix.kiwixmobile.core.entity.LibraryNetworkEntity.Book;
/**
* Created by mhutti1 on 07/04/17.

View File

@ -18,7 +18,8 @@
package org.kiwix.kiwixmobile.utils;
import androidx.test.espresso.IdlingResource;
import org.kiwix.kiwixmobile.utils.TestingUtils.IdleListener;
import org.kiwix.kiwixmobile.core.utils.TestingUtils;
import org.kiwix.kiwixmobile.core.utils.TestingUtils.IdleListener;
/**
* Created by mhutti1 on 19/04/17.

View File

@ -9,7 +9,8 @@ import java.util.Random;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.kiwix.kiwixmobile.library.entity.LibraryNetworkEntity.Book;
import org.kiwix.kiwixmobile.core.entity.LibraryNetworkEntity.Book;
import org.kiwix.kiwixmobile.core.utils.files.FileUtils;
import static org.junit.Assert.assertEquals;

View File

@ -5,14 +5,14 @@ import androidx.test.filters.SdkSuppress
import okhttp3.mockwebserver.MockResponse
import org.junit.Test
import org.kiwix.kiwixmobile.BaseActivityTest
import org.kiwix.kiwixmobile.KiwixApplication
import org.kiwix.kiwixmobile.core.KiwixApplication
import org.kiwix.kiwixmobile.KiwixMockServer
import org.kiwix.kiwixmobile.book
import org.kiwix.kiwixmobile.data.remote.KiwixService.LIBRARY_NETWORK_PATH
import org.kiwix.kiwixmobile.library.entity.LibraryNetworkEntity
import org.kiwix.kiwixmobile.libraryNetworkEntity
import org.kiwix.kiwixmobile.metaLinkNetworkEntity
import org.kiwix.kiwixmobile.utils.SharedPreferenceUtil
import org.kiwix.kiwixmobile.core.book
import org.kiwix.kiwixmobile.core.data.remote.KiwixService.LIBRARY_NETWORK_PATH
import org.kiwix.kiwixmobile.core.entity.LibraryNetworkEntity
import org.kiwix.kiwixmobile.core.libraryNetworkEntity
import org.kiwix.kiwixmobile.core.metaLinkNetworkEntity
import org.kiwix.kiwixmobile.core.utils.SharedPreferenceUtil
import java.util.concurrent.TimeUnit.SECONDS
@SdkSuppress(minSdkVersion = Build.VERSION_CODES.JELLY_BEAN_MR2)

View File

@ -25,7 +25,7 @@ import org.kiwix.kiwixmobile.Findable.ViewId
import org.kiwix.kiwixmobile.core.R
import org.kiwix.kiwixmobile.language.LanguageRobot
import org.kiwix.kiwixmobile.language.language
import org.kiwix.kiwixmobile.library.entity.LibraryNetworkEntity.Book
import org.kiwix.kiwixmobile.core.entity.LibraryNetworkEntity.Book
fun zimManage(func: ZimManageRobot.() -> Unit) =
ZimManageRobot().applyWithViewHierarchyPrinting(func)

View File

@ -17,7 +17,7 @@
<application
android:name=".KiwixApplication"
android:name=".core.KiwixApplication"
android:allowBackup="true"
android:hardwareAccelerated="true"
android:icon="@mipmap/kiwix_icon"
@ -28,7 +28,7 @@
android:theme="@style/AppTheme">
<activity
android:name=".splash.SplashActivity"
android:name=".core.splash.SplashActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.Launcher">
<intent-filter>
@ -43,7 +43,7 @@
android:resource="@xml/shortcuts" />
</activity>
<activity
android:name=".main.MainActivity"
android:name=".core.main.MainActivity"
android:configChanges="orientation|keyboardHidden|screenSize|locale"
android:label="@string/app_name"
android:windowSoftInputMode="adjustPan">
@ -160,17 +160,17 @@
<action android:name="org.kiwix.kiwixmobile.utils.KiwixSearchWidget.STAR_CLICKED" />
</intent-filter>
</activity>
<activity android:name=".settings.KiwixSettingsActivity" />
<activity android:name=".search.SearchActivity" />
<activity android:name=".bookmark.BookmarksActivity" />
<activity android:name=".webserver.ZimHostActivity" />
<activity android:name=".core.settings.KiwixSettingsActivity" />
<activity android:name=".core.search.SearchActivity" />
<activity android:name=".core.bookmark.BookmarksActivity" />
<activity android:name=".core.webserver.ZimHostActivity" />
<provider
android:name=".data.ZimContentProvider"
android:name=".core.data.ZimContentProvider"
android:authorities="${applicationId}.zim.base"
android:exported="true" />
<receiver android:name=".main.KiwixSearchWidget">
<receiver android:name=".core.main.KiwixSearchWidget">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
<action android:name="org.kiwix.kiwixmobile.utils.KiwixSearchWidget.TEXT_CLICKED" />
@ -184,10 +184,10 @@
android:resource="@xml/kiwix_widget_provider_info" />
</receiver>
<service android:name=".wifi_hotspot.HotspotService" />
<service android:name=".core.wifi_hotspot.HotspotService" />
<activity
android:name=".error.ErrorActivity"
android:name=".core.error.ErrorActivity"
android:process=":error_activity" />
<provider
@ -200,16 +200,16 @@
android:resource="@xml/provider_paths" />
</provider>
<activity android:name=".intro.IntroActivity" />
<activity android:name=".language.LanguageActivity" />
<activity android:name=".history.HistoryActivity" />
<activity android:name=".help.HelpActivity">
<activity android:name=".core.intro.IntroActivity" />
<activity android:name=".core.language.LanguageActivity" />
<activity android:name=".core.history.HistoryActivity" />
<activity android:name=".core.help.HelpActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="main.MainActivity" />
android:value=".core.main.MainActivity" />
</activity>
<activity
android:name=".zim_manager.local_file_transfer.LocalFileTransferActivity"
android:name=".core.zim_manager.local_file_transfer.LocalFileTransferActivity"
android:label="Send to nearby device"
android:screenOrientation="portrait">
<intent-filter>

View File

@ -4,9 +4,10 @@ buildscript {
jcenter()
}
dependencies {
classpath("com.android.tools.build:gradle:3.5.0")
classpath("com.dicedmelon.gradle:jacoco-android:0.1.4")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.50")
classpath(Libs.com_android_tools_build_gradle)
classpath(Libs.kotlin_gradle_plugin)
classpath(Libs.ktlint_gradle)
classpath(Libs.jacoco_android)
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}

View File

@ -64,6 +64,19 @@ android {
androidExtensions {
experimental = true
}
testOptions {
execution 'ANDROIDX_TEST_ORCHESTRATOR'
unitTests.returnDefaultValues = true
unitTests.all {
useJUnitPlatform()
testLogging {
events "passed", "skipped", "failed", "standardOut", "standardError"
outputs.upToDateWhen { false }
showStandardStreams = true
}
}
}
lintOptions {
abortOnError true
checkAllWarnings true

File diff suppressed because it is too large Load Diff

View File

@ -8,7 +8,6 @@ import android.util.AttributeSet;
import android.util.Log;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import java.util.Map;
/**

View File

@ -27,12 +27,10 @@ import android.widget.ArrayAdapter
import kotlinx.android.extensions.LayoutContainer
import kotlinx.android.synthetic.main.device_item.file_name
import kotlinx.android.synthetic.main.device_item.file_size
import org.kiwix.kiwixmobile.core.R.string
import org.kiwix.kiwixmobile.core.R
import org.kiwix.kiwixmobile.core.R2.id.file_name
import org.kiwix.kiwixmobile.core.R2.id.file_size
import org.kiwix.kiwixmobile.extensions.inflate
import org.kiwix.kiwixmobile.settings.StorageCalculator
import org.kiwix.kiwixmobile.core.R.string
import org.kiwix.kiwixmobile.core.extensions.ViewGroupExtensions.inflate
import org.kiwix.kiwixmobile.core.settings.StorageCalculator
internal class StorageSelectArrayAdapter(
context: Context,

View File

@ -31,10 +31,10 @@ import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
import kotlinx.android.synthetic.main.storage_select_dialog.device_list
import kotlinx.android.synthetic.main.storage_select_dialog.title
import org.kiwix.kiwixmobile.KiwixApplication
import org.kiwix.kiwixmobile.core.KiwixApplication
import org.kiwix.kiwixmobile.core.R
import org.kiwix.kiwixmobile.settings.StorageCalculator
import org.kiwix.kiwixmobile.utils.StyleUtils
import org.kiwix.kiwixmobile.core.settings.StorageCalculator
import org.kiwix.kiwixmobile.core.utils.StyleUtils
import javax.inject.Inject
class StorageSelectDialog : DialogFragment() {

View File

@ -15,7 +15,7 @@
* 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;
package org.kiwix.kiwixmobile.core;
import android.app.Activity;
import android.content.Context;
@ -32,11 +32,10 @@ import dagger.android.HasActivityInjector;
import java.io.File;
import java.io.IOException;
import javax.inject.Inject;
import org.kiwix.kiwixmobile.core.BuildConfig;
import org.kiwix.kiwixmobile.data.local.KiwixDatabase;
import org.kiwix.kiwixmobile.di.components.ApplicationComponent;
import org.kiwix.kiwixmobile.di.components.DaggerApplicationComponent;
import org.kiwix.kiwixmobile.downloader.DownloadMonitor;
import org.kiwix.kiwixmobile.core.data.local.KiwixDatabase;
import org.kiwix.kiwixmobile.core.di.components.ApplicationComponent;
import org.kiwix.kiwixmobile.core.di.components.DaggerApplicationComponent;
import org.kiwix.kiwixmobile.core.downloader.DownloadMonitor;
public class KiwixApplication extends MultiDexApplication implements HasActivityInjector {

View File

@ -1,4 +1,4 @@
package org.kiwix.kiwixmobile;
package org.kiwix.kiwixmobile.core;
import androidx.lifecycle.ViewModel;
import androidx.lifecycle.ViewModelProvider;

View File

@ -15,7 +15,7 @@
* 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.base;
package org.kiwix.kiwixmobile.core.base;
import android.content.res.Resources;
import android.os.Bundle;
@ -27,8 +27,8 @@ import butterknife.Unbinder;
import dagger.android.AndroidInjection;
import javax.inject.Inject;
import org.kiwix.kiwixmobile.core.R;
import org.kiwix.kiwixmobile.utils.LanguageUtils;
import org.kiwix.kiwixmobile.utils.SharedPreferenceUtil;
import org.kiwix.kiwixmobile.core.utils.LanguageUtils;
import org.kiwix.kiwixmobile.core.utils.SharedPreferenceUtil;
public abstract class BaseActivity extends AppCompatActivity {

View File

@ -1,4 +1,4 @@
package org.kiwix.kiwixmobile.base;
package org.kiwix.kiwixmobile.core.base;
public class BaseContract {
@ -25,4 +25,4 @@ public class BaseContract {
*/
void detachView();
}
}
}

View File

@ -1,9 +1,9 @@
package org.kiwix.kiwixmobile.base
package org.kiwix.kiwixmobile.core.base
import android.content.Context
import androidx.fragment.app.Fragment
import org.kiwix.kiwixmobile.KiwixApplication
import org.kiwix.kiwixmobile.di.components.ActivityComponent
import org.kiwix.kiwixmobile.core.KiwixApplication
import org.kiwix.kiwixmobile.core.di.components.ActivityComponent
/**
* All fragments should inherit from this fragment.

View File

@ -15,7 +15,7 @@
* 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.base;
package org.kiwix.kiwixmobile.core.base;
import io.reactivex.disposables.CompositeDisposable;

View File

@ -1,7 +1,7 @@
package org.kiwix.kiwixmobile.bookmark
package org.kiwix.kiwixmobile.core.bookmark
import org.kiwix.kiwixmobile.database.newdb.entities.BookmarkEntity
import org.kiwix.kiwixmobile.zim_manager.ZimFileReader
import org.kiwix.kiwixmobile.core.newdb.entities.BookmarkEntity
import org.kiwix.kiwixmobile.core.zim_manager.ZimFileReader
data class BookmarkItem(
val databaseId: Long = 0L,

View File

@ -1,4 +1,4 @@
package org.kiwix.kiwixmobile.bookmark;
package org.kiwix.kiwixmobile.core.bookmark;
import android.content.Intent;
import android.net.Uri;
@ -19,14 +19,14 @@ import java.util.ArrayList;
import java.util.List;
import javax.inject.Inject;
import org.kiwix.kiwixmobile.core.R;
import org.kiwix.kiwixmobile.base.BaseActivity;
import org.kiwix.kiwixmobile.core.R2;
import org.kiwix.kiwixmobile.extensions.ImageViewExtensionsKt;
import org.kiwix.kiwixmobile.main.MainActivity;
import org.kiwix.kiwixmobile.zim_manager.ZimReaderContainer;
import org.kiwix.kiwixmobile.core.base.BaseActivity;
import org.kiwix.kiwixmobile.core.extensions.ImageViewExtensionsKt;
import org.kiwix.kiwixmobile.core.main.MainActivity;
import org.kiwix.kiwixmobile.core.zim_manager.ZimReaderContainer;
import static org.kiwix.kiwixmobile.utils.Constants.EXTRA_CHOSE_X_TITLE;
import static org.kiwix.kiwixmobile.utils.Constants.EXTRA_CHOSE_X_URL;
import static org.kiwix.kiwixmobile.core.utils.Constants.EXTRA_CHOSE_X_TITLE;
import static org.kiwix.kiwixmobile.core.utils.Constants.EXTRA_CHOSE_X_URL;
public class BookmarksActivity extends BaseActivity implements BookmarksContract.View,
BookmarksAdapter.OnItemClickListener {

View File

@ -1,4 +1,4 @@
package org.kiwix.kiwixmobile.bookmark;
package org.kiwix.kiwixmobile.core.bookmark;
import android.view.LayoutInflater;
import android.view.View;
@ -13,7 +13,7 @@ import butterknife.ButterKnife;
import java.util.List;
import org.kiwix.kiwixmobile.core.R;
import org.kiwix.kiwixmobile.core.R2;
import org.kiwix.kiwixmobile.extensions.ImageViewExtensionsKt;
import org.kiwix.kiwixmobile.core.extensions.ImageViewExtensionsKt;
class BookmarksAdapter extends RecyclerView.Adapter<BookmarksAdapter.Item> {
private final List<BookmarkItem> bookmarkList;

View File

@ -1,7 +1,7 @@
package org.kiwix.kiwixmobile.bookmark;
package org.kiwix.kiwixmobile.core.bookmark;
import java.util.List;
import org.kiwix.kiwixmobile.base.BaseContract;
import org.kiwix.kiwixmobile.core.base.BaseContract;
interface BookmarksContract {
interface View extends BaseContract.View<Presenter> {

View File

@ -1,8 +1,8 @@
package org.kiwix.kiwixmobile.bookmark;
package org.kiwix.kiwixmobile.core.bookmark;
import dagger.Module;
import dagger.Provides;
import org.kiwix.kiwixmobile.di.ActivityScope;
import org.kiwix.kiwixmobile.core.di.ActivityScope;
@Module
public class BookmarksModule {

View File

@ -1,4 +1,4 @@
package org.kiwix.kiwixmobile.bookmark;
package org.kiwix.kiwixmobile.core.bookmark;
import android.util.Log;
import io.reactivex.CompletableObserver;
@ -8,11 +8,11 @@ import io.reactivex.SingleObserver;
import io.reactivex.disposables.Disposable;
import java.util.List;
import javax.inject.Inject;
import org.kiwix.kiwixmobile.base.BasePresenter;
import org.kiwix.kiwixmobile.data.DataSource;
import org.kiwix.kiwixmobile.di.ActivityScope;
import org.kiwix.kiwixmobile.di.qualifiers.Computation;
import org.kiwix.kiwixmobile.di.qualifiers.MainThread;
import org.kiwix.kiwixmobile.core.base.BasePresenter;
import org.kiwix.kiwixmobile.core.data.DataSource;
import org.kiwix.kiwixmobile.core.di.ActivityScope;
import org.kiwix.kiwixmobile.core.di.qualifiers.Computation;
import org.kiwix.kiwixmobile.core.di.qualifiers.MainThread;
@ActivityScope
class BookmarksPresenter extends BasePresenter<BookmarksContract.View>

View File

@ -1,4 +1,4 @@
package org.kiwix.kiwixmobile.data
package org.kiwix.kiwixmobile.core.data
import android.content.ContentProvider
import android.content.ContentValues

View File

@ -1,4 +1,4 @@
package org.kiwix.kiwixmobile.data;
package org.kiwix.kiwixmobile.core.data;
import dagger.Module;
import dagger.Provides;

View File

@ -1,13 +1,13 @@
package org.kiwix.kiwixmobile.data;
package org.kiwix.kiwixmobile.core.data;
import io.reactivex.Completable;
import io.reactivex.Flowable;
import io.reactivex.Single;
import java.util.List;
import org.kiwix.kiwixmobile.bookmark.BookmarkItem;
import org.kiwix.kiwixmobile.history.HistoryListItem;
import org.kiwix.kiwixmobile.zim_manager.Language;
import org.kiwix.kiwixmobile.zim_manager.fileselect_view.adapter.BooksOnDiskListItem;
import org.kiwix.kiwixmobile.core.bookmark.BookmarkItem;
import org.kiwix.kiwixmobile.core.history.HistoryListItem;
import org.kiwix.kiwixmobile.core.zim_manager.Language;
import org.kiwix.kiwixmobile.core.zim_manager.fileselect_view.adapter.BooksOnDiskListItem;
/**
* Defines the set of methods which are required to provide the presenter with the requisite data.

View File

@ -1,25 +1,25 @@
package org.kiwix.kiwixmobile.data
package org.kiwix.kiwixmobile.core.data
import io.reactivex.Completable
import io.reactivex.Flowable
import io.reactivex.Scheduler
import io.reactivex.Single
import org.kiwix.kiwixmobile.bookmark.BookmarkItem
import org.kiwix.kiwixmobile.database.newdb.dao.HistoryDao
import org.kiwix.kiwixmobile.database.newdb.dao.NewBookDao
import org.kiwix.kiwixmobile.database.newdb.dao.NewBookmarksDao
import org.kiwix.kiwixmobile.database.newdb.dao.NewLanguagesDao
import org.kiwix.kiwixmobile.database.newdb.dao.NewRecentSearchDao
import org.kiwix.kiwixmobile.di.qualifiers.IO
import org.kiwix.kiwixmobile.di.qualifiers.MainThread
import org.kiwix.kiwixmobile.history.HistoryListItem
import org.kiwix.kiwixmobile.history.HistoryListItem.DateItem
import org.kiwix.kiwixmobile.history.HistoryListItem.HistoryItem
import org.kiwix.kiwixmobile.zim_manager.Language
import org.kiwix.kiwixmobile.zim_manager.ZimReaderContainer
import org.kiwix.kiwixmobile.zim_manager.fileselect_view.adapter.BooksOnDiskListItem
import org.kiwix.kiwixmobile.zim_manager.fileselect_view.adapter.BooksOnDiskListItem.BookOnDisk
import org.kiwix.kiwixmobile.zim_manager.fileselect_view.adapter.BooksOnDiskListItem.LanguageItem
import org.kiwix.kiwixmobile.core.bookmark.BookmarkItem
import org.kiwix.kiwixmobile.core.di.qualifiers.IO
import org.kiwix.kiwixmobile.core.di.qualifiers.MainThread
import org.kiwix.kiwixmobile.core.history.HistoryListItem
import org.kiwix.kiwixmobile.core.history.HistoryListItem.DateItem
import org.kiwix.kiwixmobile.core.history.HistoryListItem.HistoryItem
import org.kiwix.kiwixmobile.core.newdb.dao.HistoryDao
import org.kiwix.kiwixmobile.core.newdb.dao.NewBookDao
import org.kiwix.kiwixmobile.core.newdb.dao.NewBookmarksDao
import org.kiwix.kiwixmobile.core.newdb.dao.NewLanguagesDao
import org.kiwix.kiwixmobile.core.newdb.dao.NewRecentSearchDao
import org.kiwix.kiwixmobile.core.zim_manager.Language
import org.kiwix.kiwixmobile.core.zim_manager.ZimReaderContainer
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.LanguageItem
import javax.inject.Inject
import javax.inject.Singleton

View File

@ -17,7 +17,7 @@
* MA 02110-1301, USA.
*/
package org.kiwix.kiwixmobile.data;
package org.kiwix.kiwixmobile.core.data;
import android.content.Context;
import android.net.Uri;
@ -29,10 +29,10 @@ import java.io.InputStream;
import java.io.OutputStream;
import javax.inject.Inject;
import org.kiwix.kiwixlib.JNIKiwix;
import org.kiwix.kiwixmobile.KiwixApplication;
import org.kiwix.kiwixmobile.zim_manager.ZimReaderContainer;
import org.kiwix.kiwixmobile.core.KiwixApplication;
import org.kiwix.kiwixmobile.core.zim_manager.ZimReaderContainer;
import static org.kiwix.kiwixmobile.utils.Constants.TAG_KIWIX;
import static org.kiwix.kiwixmobile.core.utils.Constants.TAG_KIWIX;
public class ZimContentProvider extends AbstractContentProvider {

View File

@ -17,7 +17,7 @@
* MA 02110-1301, USA.
*/
package org.kiwix.kiwixmobile.data.local;
package org.kiwix.kiwixmobile.core.data.local;
import android.content.Context;
import android.util.Log;
@ -31,22 +31,22 @@ import java.io.InputStream;
import java.io.InputStreamReader;
import javax.inject.Inject;
import javax.inject.Singleton;
import org.kiwix.kiwixmobile.data.local.dao.BookDao;
import org.kiwix.kiwixmobile.data.local.dao.BookmarksDao;
import org.kiwix.kiwixmobile.data.local.dao.NetworkLanguageDao;
import org.kiwix.kiwixmobile.data.local.dao.RecentSearchDao;
import org.kiwix.kiwixmobile.data.local.entity.BookDatabaseEntity;
import org.kiwix.kiwixmobile.data.local.entity.Bookmark;
import org.kiwix.kiwixmobile.data.local.entity.LibraryDatabaseEntity;
import org.kiwix.kiwixmobile.data.local.entity.NetworkLanguageDatabaseEntity;
import org.kiwix.kiwixmobile.data.local.entity.RecentSearch;
import org.kiwix.kiwixmobile.database.newdb.dao.NewBookDao;
import org.kiwix.kiwixmobile.database.newdb.dao.NewBookmarksDao;
import org.kiwix.kiwixmobile.database.newdb.dao.NewLanguagesDao;
import org.kiwix.kiwixmobile.database.newdb.dao.NewRecentSearchDao;
import org.kiwix.kiwixmobile.utils.UpdateUtils;
import org.kiwix.kiwixmobile.core.data.local.dao.BookDao;
import org.kiwix.kiwixmobile.core.data.local.dao.BookmarksDao;
import org.kiwix.kiwixmobile.core.data.local.dao.NetworkLanguageDao;
import org.kiwix.kiwixmobile.core.data.local.dao.RecentSearchDao;
import org.kiwix.kiwixmobile.core.data.local.entity.BookDatabaseEntity;
import org.kiwix.kiwixmobile.core.data.local.entity.Bookmark;
import org.kiwix.kiwixmobile.core.data.local.entity.LibraryDatabaseEntity;
import org.kiwix.kiwixmobile.core.data.local.entity.NetworkLanguageDatabaseEntity;
import org.kiwix.kiwixmobile.core.data.local.entity.RecentSearch;
import org.kiwix.kiwixmobile.core.newdb.dao.NewBookDao;
import org.kiwix.kiwixmobile.core.newdb.dao.NewBookmarksDao;
import org.kiwix.kiwixmobile.core.newdb.dao.NewLanguagesDao;
import org.kiwix.kiwixmobile.core.newdb.dao.NewRecentSearchDao;
import org.kiwix.kiwixmobile.core.utils.UpdateUtils;
import static org.kiwix.kiwixmobile.utils.Constants.TAG_KIWIX;
import static org.kiwix.kiwixmobile.core.utils.Constants.TAG_KIWIX;
@Singleton
@Deprecated //delete once migrations are no longer needed

View File

@ -15,17 +15,17 @@
* 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.data.local.dao;
package org.kiwix.kiwixmobile.core.data.local.dao;
import com.yahoo.squidb.data.SquidCursor;
import com.yahoo.squidb.sql.Query;
import java.io.File;
import java.util.ArrayList;
import javax.inject.Inject;
import org.kiwix.kiwixmobile.data.local.KiwixDatabase;
import org.kiwix.kiwixmobile.data.local.entity.BookDatabaseEntity;
import org.kiwix.kiwixmobile.library.entity.LibraryNetworkEntity.Book;
import org.kiwix.kiwixmobile.utils.files.FileUtils;
import org.kiwix.kiwixmobile.core.data.local.KiwixDatabase;
import org.kiwix.kiwixmobile.core.data.local.entity.BookDatabaseEntity;
import org.kiwix.kiwixmobile.core.entity.LibraryNetworkEntity.Book;
import org.kiwix.kiwixmobile.core.utils.files.FileUtils;
/**
* Dao class for books

View File

@ -15,7 +15,7 @@
* 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.data.local.dao;
package org.kiwix.kiwixmobile.core.data.local.dao;
import com.yahoo.squidb.data.SquidCursor;
import com.yahoo.squidb.sql.Query;
@ -23,8 +23,8 @@ import com.yahoo.squidb.sql.Update;
import java.util.ArrayList;
import java.util.List;
import javax.inject.Inject;
import org.kiwix.kiwixmobile.data.local.KiwixDatabase;
import org.kiwix.kiwixmobile.data.local.entity.Bookmark;
import org.kiwix.kiwixmobile.core.data.local.KiwixDatabase;
import org.kiwix.kiwixmobile.core.data.local.entity.Bookmark;
/**
* Dao class for bookmarks.

View File

@ -17,15 +17,15 @@
* MA 02110-1301, USA.
*/
package org.kiwix.kiwixmobile.data.local.dao;
package org.kiwix.kiwixmobile.core.data.local.dao;
import com.yahoo.squidb.data.SquidCursor;
import com.yahoo.squidb.sql.Query;
import java.util.ArrayList;
import javax.inject.Inject;
import org.kiwix.kiwixmobile.data.local.KiwixDatabase;
import org.kiwix.kiwixmobile.data.local.entity.NetworkLanguageDatabaseEntity;
import org.kiwix.kiwixmobile.zim_manager.Language;
import org.kiwix.kiwixmobile.core.data.local.KiwixDatabase;
import org.kiwix.kiwixmobile.core.data.local.entity.NetworkLanguageDatabaseEntity;
import org.kiwix.kiwixmobile.core.zim_manager.Language;
@Deprecated
public class NetworkLanguageDao {

View File

@ -15,15 +15,15 @@
* 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.data.local.dao;
package org.kiwix.kiwixmobile.core.data.local.dao;
import com.yahoo.squidb.data.SquidCursor;
import com.yahoo.squidb.sql.Query;
import java.util.ArrayList;
import java.util.List;
import javax.inject.Inject;
import org.kiwix.kiwixmobile.data.local.KiwixDatabase;
import org.kiwix.kiwixmobile.data.local.entity.RecentSearch;
import org.kiwix.kiwixmobile.core.data.local.KiwixDatabase;
import org.kiwix.kiwixmobile.core.data.local.entity.RecentSearch;
/**
* Dao class for recent searches.

View File

@ -17,7 +17,7 @@
* MA 02110-1301, USA.
*/
package org.kiwix.kiwixmobile.data.local.entity;
package org.kiwix.kiwixmobile.core.data.local.entity;
import com.yahoo.squidb.annotations.TableModelSpec;

View File

@ -15,7 +15,7 @@
* 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.data.local.entity;
package org.kiwix.kiwixmobile.core.data.local.entity;
import com.yahoo.squidb.annotations.ColumnSpec;
import com.yahoo.squidb.annotations.TableModelSpec;

View File

@ -17,7 +17,7 @@
* MA 02110-1301, USA.
*/
package org.kiwix.kiwixmobile.data.local.entity;
package org.kiwix.kiwixmobile.core.data.local.entity;
import com.yahoo.squidb.annotations.TableModelSpec;

View File

@ -17,7 +17,7 @@
* MA 02110-1301, USA.
*/
package org.kiwix.kiwixmobile.data.local.entity;
package org.kiwix.kiwixmobile.core.data.local.entity;
import com.yahoo.squidb.annotations.TableModelSpec;

View File

@ -15,7 +15,7 @@
* 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.data.local.entity;
package org.kiwix.kiwixmobile.core.data.local.entity;
import com.yahoo.squidb.annotations.ColumnSpec;
import com.yahoo.squidb.annotations.TableModelSpec;

View File

@ -15,14 +15,14 @@
* 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.data.remote;
package org.kiwix.kiwixmobile.core.data.remote;
import io.reactivex.Observable;
import io.reactivex.Single;
import io.reactivex.schedulers.Schedulers;
import okhttp3.OkHttpClient;
import org.kiwix.kiwixmobile.library.entity.LibraryNetworkEntity;
import org.kiwix.kiwixmobile.library.entity.MetaLinkNetworkEntity;
import org.kiwix.kiwixmobile.core.entity.LibraryNetworkEntity;
import org.kiwix.kiwixmobile.core.entity.MetaLinkNetworkEntity;
import retrofit2.Retrofit;
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
import retrofit2.converter.simplexml.SimpleXmlConverterFactory;

View File

@ -15,7 +15,7 @@
* 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.data.remote;
package org.kiwix.kiwixmobile.core.data.remote;
import java.io.IOException;
import okhttp3.Interceptor;

View File

@ -1,4 +1,4 @@
package org.kiwix.kiwixmobile.di
package org.kiwix.kiwixmobile.core.di
import javax.inject.Scope

View File

@ -15,7 +15,7 @@
* 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
package org.kiwix.kiwixmobile.core.di
import javax.inject.Scope
import kotlin.annotation.AnnotationRetention.RUNTIME

View File

@ -1,4 +1,4 @@
package org.kiwix.kiwixmobile.di;
package org.kiwix.kiwixmobile.core.di;
import androidx.lifecycle.ViewModel;
import dagger.MapKey;

View File

@ -15,18 +15,18 @@
* 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
package org.kiwix.kiwixmobile.core.di.components
import android.app.Activity
import dagger.BindsInstance
import dagger.Subcomponent
import org.kiwix.kiwixmobile.di.ActivityScope
import org.kiwix.kiwixmobile.di.modules.ActivityModule
import org.kiwix.kiwixmobile.downloader.DownloadFragment
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
import org.kiwix.kiwixmobile.zim_manager.local_file_transfer.LocalFileTransferActivity
import org.kiwix.kiwixmobile.core.di.ActivityScope
import org.kiwix.kiwixmobile.core.di.modules.ActivityModule
import org.kiwix.kiwixmobile.core.downloader.DownloadFragment
import org.kiwix.kiwixmobile.core.zim_manager.fileselect_view.ZimFileSelectFragment
import org.kiwix.kiwixmobile.core.zim_manager.fileselect_view.effects.DeleteFiles
import org.kiwix.kiwixmobile.core.zim_manager.library_view.LibraryFragment
import org.kiwix.kiwixmobile.core.zim_manager.local_file_transfer.LocalFileTransferActivity
@ActivityScope
@Subcomponent(modules = [ActivityModule::class])

View File

@ -15,7 +15,7 @@
* 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;
package org.kiwix.kiwixmobile.core.di.components;
import android.content.Context;
import dagger.BindsInstance;
@ -23,18 +23,18 @@ import dagger.Component;
import eu.mhutti1.utils.storage.StorageSelectDialog;
import javax.inject.Singleton;
import org.jetbrains.annotations.NotNull;
import org.kiwix.kiwixmobile.KiwixApplication;
import org.kiwix.kiwixmobile.data.DataModule;
import org.kiwix.kiwixmobile.data.ZimContentProvider;
import org.kiwix.kiwixmobile.di.modules.ApplicationModule;
import org.kiwix.kiwixmobile.di.modules.JNIModule;
import org.kiwix.kiwixmobile.di.modules.NetworkModule;
import org.kiwix.kiwixmobile.language.LanguageActivity;
import org.kiwix.kiwixmobile.main.AddNoteDialog;
import org.kiwix.kiwixmobile.main.KiwixWebView;
import org.kiwix.kiwixmobile.search.AutoCompleteAdapter;
import org.kiwix.kiwixmobile.settings.PrefsFragment;
import org.kiwix.kiwixmobile.zim_manager.ZimManageActivity;
import org.kiwix.kiwixmobile.core.KiwixApplication;
import org.kiwix.kiwixmobile.core.data.DataModule;
import org.kiwix.kiwixmobile.core.data.ZimContentProvider;
import org.kiwix.kiwixmobile.core.di.modules.ApplicationModule;
import org.kiwix.kiwixmobile.core.di.modules.JNIModule;
import org.kiwix.kiwixmobile.core.di.modules.NetworkModule;
import org.kiwix.kiwixmobile.core.language.LanguageActivity;
import org.kiwix.kiwixmobile.core.main.AddNoteDialog;
import org.kiwix.kiwixmobile.core.main.KiwixWebView;
import org.kiwix.kiwixmobile.core.search.AutoCompleteAdapter;
import org.kiwix.kiwixmobile.core.settings.PrefsFragment;
import org.kiwix.kiwixmobile.core.zim_manager.ZimManageActivity;
@Singleton
@Component(modules = {

View File

@ -1,11 +1,11 @@
package org.kiwix.kiwixmobile.di.components
package org.kiwix.kiwixmobile.core.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.wifi_hotspot.HotspotService
import org.kiwix.kiwixmobile.core.di.ServiceScope
import org.kiwix.kiwixmobile.core.di.modules.ServiceModule
import org.kiwix.kiwixmobile.core.wifi_hotspot.HotspotService
@Subcomponent(modules = [ServiceModule::class])
@ServiceScope

View File

@ -1,25 +1,25 @@
package org.kiwix.kiwixmobile.di.modules;
package org.kiwix.kiwixmobile.core.di.modules;
import dagger.Module;
import dagger.android.ContributesAndroidInjector;
import org.kiwix.kiwixmobile.bookmark.BookmarksActivity;
import org.kiwix.kiwixmobile.bookmark.BookmarksModule;
import org.kiwix.kiwixmobile.di.ActivityScope;
import org.kiwix.kiwixmobile.error.ErrorActivity;
import org.kiwix.kiwixmobile.help.HelpActivity;
import org.kiwix.kiwixmobile.history.HistoryActivity;
import org.kiwix.kiwixmobile.history.HistoryModule;
import org.kiwix.kiwixmobile.intro.IntroActivity;
import org.kiwix.kiwixmobile.intro.IntroModule;
import org.kiwix.kiwixmobile.language.LanguageActivity;
import org.kiwix.kiwixmobile.main.MainActivity;
import org.kiwix.kiwixmobile.main.MainModule;
import org.kiwix.kiwixmobile.search.SearchActivity;
import org.kiwix.kiwixmobile.settings.KiwixSettingsActivity;
import org.kiwix.kiwixmobile.splash.SplashActivity;
import org.kiwix.kiwixmobile.webserver.ZimHostActivity;
import org.kiwix.kiwixmobile.webserver.ZimHostModule;
import org.kiwix.kiwixmobile.zim_manager.ZimManageActivity;
import org.kiwix.kiwixmobile.core.bookmark.BookmarksActivity;
import org.kiwix.kiwixmobile.core.bookmark.BookmarksModule;
import org.kiwix.kiwixmobile.core.di.ActivityScope;
import org.kiwix.kiwixmobile.core.error.ErrorActivity;
import org.kiwix.kiwixmobile.core.help.HelpActivity;
import org.kiwix.kiwixmobile.core.history.HistoryActivity;
import org.kiwix.kiwixmobile.core.history.HistoryModule;
import org.kiwix.kiwixmobile.core.intro.IntroActivity;
import org.kiwix.kiwixmobile.core.intro.IntroModule;
import org.kiwix.kiwixmobile.core.language.LanguageActivity;
import org.kiwix.kiwixmobile.core.main.MainActivity;
import org.kiwix.kiwixmobile.core.main.MainModule;
import org.kiwix.kiwixmobile.core.search.SearchActivity;
import org.kiwix.kiwixmobile.core.settings.KiwixSettingsActivity;
import org.kiwix.kiwixmobile.core.splash.SplashActivity;
import org.kiwix.kiwixmobile.core.webserver.ZimHostActivity;
import org.kiwix.kiwixmobile.core.webserver.ZimHostModule;
import org.kiwix.kiwixmobile.core.zim_manager.ZimManageActivity;
/**
* Dagger.Android annotation processor will create the sub-components. We also specify the modules

View File

@ -15,13 +15,13 @@
* 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.modules
package org.kiwix.kiwixmobile.core.di.modules
import dagger.Binds
import dagger.Module
import org.kiwix.kiwixmobile.di.ActivityScope
import org.kiwix.kiwixmobile.utils.AlertDialogShower
import org.kiwix.kiwixmobile.utils.DialogShower
import org.kiwix.kiwixmobile.core.di.ActivityScope
import org.kiwix.kiwixmobile.core.utils.AlertDialogShower
import org.kiwix.kiwixmobile.core.utils.DialogShower
@Module
abstract class ActivityModule {

View File

@ -15,7 +15,7 @@
* 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.modules;
package org.kiwix.kiwixmobile.core.di.modules;
import android.app.Application;
import android.app.DownloadManager;
@ -30,14 +30,14 @@ import io.reactivex.Scheduler;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
import javax.inject.Singleton;
import org.kiwix.kiwixmobile.di.qualifiers.Computation;
import org.kiwix.kiwixmobile.di.qualifiers.IO;
import org.kiwix.kiwixmobile.di.qualifiers.MainThread;
import org.kiwix.kiwixmobile.downloader.DownloadMonitor;
import org.kiwix.kiwixmobile.downloader.fetch.FetchDownloadMonitor;
import org.kiwix.kiwixmobile.utils.BookUtils;
import org.kiwix.kiwixmobile.utils.SharedPreferenceUtil;
import org.kiwix.kiwixmobile.zim_manager.ZimFileReader;
import org.kiwix.kiwixmobile.core.di.qualifiers.Computation;
import org.kiwix.kiwixmobile.core.di.qualifiers.IO;
import org.kiwix.kiwixmobile.core.di.qualifiers.MainThread;
import org.kiwix.kiwixmobile.core.downloader.DownloadMonitor;
import org.kiwix.kiwixmobile.core.downloader.fetch.FetchDownloadMonitor;
import org.kiwix.kiwixmobile.core.utils.BookUtils;
import org.kiwix.kiwixmobile.core.utils.SharedPreferenceUtil;
import org.kiwix.kiwixmobile.core.zim_manager.ZimFileReader;
@Module(includes = {
ActivityBindingModule.class,

View File

@ -15,20 +15,20 @@
* 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.modules
package org.kiwix.kiwixmobile.core.di.modules
import android.content.Context
import dagger.Module
import dagger.Provides
import io.objectbox.BoxStore
import io.objectbox.kotlin.boxFor
import org.kiwix.kiwixmobile.database.newdb.dao.FetchDownloadDao
import org.kiwix.kiwixmobile.database.newdb.dao.HistoryDao
import org.kiwix.kiwixmobile.database.newdb.dao.NewBookDao
import org.kiwix.kiwixmobile.database.newdb.dao.NewBookmarksDao
import org.kiwix.kiwixmobile.database.newdb.dao.NewLanguagesDao
import org.kiwix.kiwixmobile.database.newdb.dao.NewRecentSearchDao
import org.kiwix.kiwixmobile.database.newdb.entities.MyObjectBox
import org.kiwix.kiwixmobile.core.newdb.dao.FetchDownloadDao
import org.kiwix.kiwixmobile.core.newdb.dao.HistoryDao
import org.kiwix.kiwixmobile.core.newdb.dao.NewBookDao
import org.kiwix.kiwixmobile.core.newdb.dao.NewBookmarksDao
import org.kiwix.kiwixmobile.core.newdb.dao.NewLanguagesDao
import org.kiwix.kiwixmobile.core.newdb.dao.NewRecentSearchDao
import org.kiwix.kiwixmobile.core.newdb.entities.MyObjectBox
import javax.inject.Singleton
@Module

View File

@ -15,7 +15,7 @@
* 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.modules
package org.kiwix.kiwixmobile.core.di.modules
import android.content.Context
import com.tonyodev.fetch2.Fetch
@ -27,14 +27,14 @@ import dagger.Module
import dagger.Provides
import okhttp3.OkHttpClient
import org.kiwix.kiwixmobile.core.BuildConfig
import org.kiwix.kiwixmobile.data.remote.KiwixService
import org.kiwix.kiwixmobile.database.newdb.dao.FetchDownloadDao
import org.kiwix.kiwixmobile.downloader.DownloadRequester
import org.kiwix.kiwixmobile.downloader.Downloader
import org.kiwix.kiwixmobile.downloader.DownloaderImpl
import org.kiwix.kiwixmobile.downloader.fetch.FetchDownloadNotificationManager
import org.kiwix.kiwixmobile.downloader.fetch.FetchDownloadRequester
import org.kiwix.kiwixmobile.utils.SharedPreferenceUtil
import org.kiwix.kiwixmobile.core.data.remote.KiwixService
import org.kiwix.kiwixmobile.core.downloader.DownloadRequester
import org.kiwix.kiwixmobile.core.downloader.Downloader
import org.kiwix.kiwixmobile.core.downloader.DownloaderImpl
import org.kiwix.kiwixmobile.core.downloader.fetch.FetchDownloadNotificationManager
import org.kiwix.kiwixmobile.core.downloader.fetch.FetchDownloadRequester
import org.kiwix.kiwixmobile.core.newdb.dao.FetchDownloadDao
import org.kiwix.kiwixmobile.core.utils.SharedPreferenceUtil
import javax.inject.Singleton
@Module
@ -46,7 +46,12 @@ object DownloaderModule {
downloadRequester: DownloadRequester,
downloadDao: FetchDownloadDao,
kiwixService: KiwixService
): Downloader = DownloaderImpl(downloadRequester, downloadDao, kiwixService)
): Downloader =
DownloaderImpl(
downloadRequester,
downloadDao,
kiwixService
)
@JvmStatic
@Provides
@ -54,7 +59,8 @@ object DownloaderModule {
fun providesDownloadRequester(
fetch: Fetch,
sharedPreferenceUtil: SharedPreferenceUtil
): DownloadRequester = FetchDownloadRequester(fetch, sharedPreferenceUtil)
): DownloadRequester =
FetchDownloadRequester(fetch, sharedPreferenceUtil)
@JvmStatic
@Provides

View File

@ -15,7 +15,7 @@
* 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.modules;
package org.kiwix.kiwixmobile.core.di.modules;
import android.content.Context;
import androidx.annotation.NonNull;

View File

@ -15,7 +15,7 @@
* 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.modules;
package org.kiwix.kiwixmobile.core.di.modules;
import android.content.Context;
import android.net.ConnectivityManager;
@ -27,8 +27,8 @@ import okhttp3.OkHttpClient;
import okhttp3.logging.HttpLoggingInterceptor;
import okhttp3.logging.HttpLoggingInterceptor.Level;
import org.kiwix.kiwixmobile.core.BuildConfig;
import org.kiwix.kiwixmobile.data.remote.KiwixService;
import org.kiwix.kiwixmobile.data.remote.UserAgentInterceptor;
import org.kiwix.kiwixmobile.core.data.remote.KiwixService;
import org.kiwix.kiwixmobile.core.data.remote.UserAgentInterceptor;
@Module public class NetworkModule {

View File

@ -1,4 +1,4 @@
package org.kiwix.kiwixmobile.di.modules
package org.kiwix.kiwixmobile.core.di.modules
import android.app.NotificationManager
import android.app.Service
@ -7,12 +7,12 @@ import dagger.Module
import dagger.Provides
import org.kiwix.kiwixlib.JNIKiwixLibrary
import org.kiwix.kiwixlib.JNIKiwixServer
import org.kiwix.kiwixmobile.di.ServiceScope
import org.kiwix.kiwixmobile.webserver.WebServerHelper
import org.kiwix.kiwixmobile.wifi_hotspot.HotspotNotificationManager
import org.kiwix.kiwixmobile.wifi_hotspot.HotspotStateReceiver
import org.kiwix.kiwixmobile.wifi_hotspot.HotspotStateReceiver.Callback
import org.kiwix.kiwixmobile.wifi_hotspot.IpAddressCallbacks
import org.kiwix.kiwixmobile.core.di.ServiceScope
import org.kiwix.kiwixmobile.core.webserver.WebServerHelper
import org.kiwix.kiwixmobile.core.wifi_hotspot.HotspotNotificationManager
import org.kiwix.kiwixmobile.core.wifi_hotspot.HotspotStateReceiver
import org.kiwix.kiwixmobile.core.wifi_hotspot.HotspotStateReceiver.Callback
import org.kiwix.kiwixmobile.core.wifi_hotspot.IpAddressCallbacks
@Module
class ServiceModule {
@ -23,7 +23,12 @@ class ServiceModule {
jniKiwixLibrary: JNIKiwixLibrary,
kiwixServer: JNIKiwixServer,
ipAddressCallbacks: IpAddressCallbacks
): WebServerHelper = WebServerHelper(jniKiwixLibrary, kiwixServer, ipAddressCallbacks)
): WebServerHelper =
WebServerHelper(
jniKiwixLibrary,
kiwixServer,
ipAddressCallbacks
)
@Provides
@ServiceScope
@ -51,7 +56,8 @@ class ServiceModule {
@ServiceScope
fun providesHotspotStateReceiver(
callback: Callback
): HotspotStateReceiver = HotspotStateReceiver(callback)
): HotspotStateReceiver =
HotspotStateReceiver(callback)
@Provides
@ServiceScope

View File

@ -1,14 +1,14 @@
package org.kiwix.kiwixmobile.di.modules
package org.kiwix.kiwixmobile.core.di.modules
import androidx.lifecycle.ViewModel
import androidx.lifecycle.ViewModelProvider
import dagger.Binds
import dagger.Module
import dagger.multibindings.IntoMap
import org.kiwix.kiwixmobile.KiwixViewModelFactory
import org.kiwix.kiwixmobile.di.ViewModelKey
import org.kiwix.kiwixmobile.language.viewmodel.LanguageViewModel
import org.kiwix.kiwixmobile.zim_manager.ZimManageViewModel
import org.kiwix.kiwixmobile.core.KiwixViewModelFactory
import org.kiwix.kiwixmobile.core.di.ViewModelKey
import org.kiwix.kiwixmobile.core.language.viewmodel.LanguageViewModel
import org.kiwix.kiwixmobile.core.zim_manager.ZimManageViewModel
/*
* Kiwix Android

View File

@ -1,4 +1,4 @@
package org.kiwix.kiwixmobile.di.qualifiers;
package org.kiwix.kiwixmobile.core.di.qualifiers;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

View File

@ -1,4 +1,4 @@
package org.kiwix.kiwixmobile.di.qualifiers;
package org.kiwix.kiwixmobile.core.di.qualifiers;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

View File

@ -1,4 +1,4 @@
package org.kiwix.kiwixmobile.di.qualifiers;
package org.kiwix.kiwixmobile.core.di.qualifiers;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

View File

@ -15,7 +15,7 @@
* 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.downloader;
package org.kiwix.kiwixmobile.core.downloader;
public class Chunk {

View File

@ -15,12 +15,12 @@
* 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.downloader;
package org.kiwix.kiwixmobile.core.downloader;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import org.kiwix.kiwixmobile.utils.StorageUtils;
import org.kiwix.kiwixmobile.core.utils.StorageUtils;
public class ChunkUtils {

View File

@ -15,13 +15,13 @@
* 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.downloader
package org.kiwix.kiwixmobile.core.downloader
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import org.kiwix.kiwixmobile.core.R
import org.kiwix.kiwixmobile.downloader.model.DownloadItem
import org.kiwix.kiwixmobile.extensions.inflate
import org.kiwix.kiwixmobile.core.R.layout
import org.kiwix.kiwixmobile.core.downloader.model.DownloadItem
import org.kiwix.kiwixmobile.core.extensions.ViewGroupExtensions.inflate
class DownloadAdapter(private val itemClickListener: (DownloadItem) -> Unit) :
RecyclerView.Adapter<DownloadViewHolder>() {
@ -41,7 +41,12 @@ class DownloadAdapter(private val itemClickListener: (DownloadItem) -> Unit) :
override fun onCreateViewHolder(
parent: ViewGroup,
viewType: Int
) = DownloadViewHolder(parent.inflate(R.layout.download_item, false))
) = DownloadViewHolder(
parent.inflate(
layout.download_item,
false
)
)
override fun getItemCount() = itemList.size

View File

@ -15,7 +15,7 @@
* 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.downloader
package org.kiwix.kiwixmobile.core.downloader
import android.os.Bundle
import android.view.LayoutInflater
@ -27,15 +27,15 @@ import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import kotlinx.android.synthetic.main.layout_download_management.download_management_no_downloads
import kotlinx.android.synthetic.main.layout_download_management.zim_downloader_list
import org.kiwix.kiwixmobile.base.BaseFragment
import org.kiwix.kiwixmobile.core.R
import org.kiwix.kiwixmobile.di.components.ActivityComponent
import org.kiwix.kiwixmobile.downloader.model.DownloadItem
import org.kiwix.kiwixmobile.extensions.viewModel
import org.kiwix.kiwixmobile.utils.DialogShower
import org.kiwix.kiwixmobile.utils.KiwixDialog.YesNoDialog.StopDownload
import org.kiwix.kiwixmobile.utils.SharedPreferenceUtil
import org.kiwix.kiwixmobile.zim_manager.ZimManageViewModel
import org.kiwix.kiwixmobile.core.base.BaseFragment
import org.kiwix.kiwixmobile.core.di.components.ActivityComponent
import org.kiwix.kiwixmobile.core.downloader.model.DownloadItem
import org.kiwix.kiwixmobile.core.extensions.viewModel
import org.kiwix.kiwixmobile.core.utils.DialogShower
import org.kiwix.kiwixmobile.core.utils.KiwixDialog.YesNoDialog.StopDownload
import org.kiwix.kiwixmobile.core.utils.SharedPreferenceUtil
import org.kiwix.kiwixmobile.core.zim_manager.ZimManageViewModel
import javax.inject.Inject
class DownloadFragment : BaseFragment() {

View File

@ -15,7 +15,7 @@
* 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.downloader;
package org.kiwix.kiwixmobile.core.downloader;
public class DownloadIntent {
public static final String DOWNLOAD_URL_PARAMETER = "DOWNLOAD_URL_PARAMETER";

View File

@ -15,7 +15,7 @@
* 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.downloader
package org.kiwix.kiwixmobile.core.downloader
interface DownloadMonitor {
fun init()

View File

@ -15,10 +15,10 @@
* 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.downloader
package org.kiwix.kiwixmobile.core.downloader
import org.kiwix.kiwixmobile.downloader.model.DownloadItem
import org.kiwix.kiwixmobile.downloader.model.DownloadRequest
import org.kiwix.kiwixmobile.core.downloader.model.DownloadItem
import org.kiwix.kiwixmobile.core.downloader.model.DownloadRequest
interface DownloadRequester {
fun enqueue(downloadRequest: DownloadRequest): Long

View File

@ -15,7 +15,7 @@
* 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.downloader
package org.kiwix.kiwixmobile.core.downloader
import android.content.Context
@ -29,14 +29,14 @@ import kotlinx.android.synthetic.main.download_item.eta
import kotlinx.android.synthetic.main.download_item.favicon
import kotlinx.android.synthetic.main.download_item.stop
import kotlinx.android.synthetic.main.download_item.title
import org.kiwix.kiwixmobile.downloader.model.DownloadItem
import org.kiwix.kiwixmobile.downloader.model.DownloadState
import org.kiwix.kiwixmobile.downloader.model.DownloadState.Failed
import org.kiwix.kiwixmobile.downloader.model.DownloadState.Paused
import org.kiwix.kiwixmobile.downloader.model.DownloadState.Pending
import org.kiwix.kiwixmobile.downloader.model.DownloadState.Running
import org.kiwix.kiwixmobile.downloader.model.DownloadState.Successful
import org.kiwix.kiwixmobile.extensions.setBitmap
import org.kiwix.kiwixmobile.core.downloader.model.DownloadItem
import org.kiwix.kiwixmobile.core.downloader.model.DownloadState
import org.kiwix.kiwixmobile.core.downloader.model.DownloadState.Failed
import org.kiwix.kiwixmobile.core.downloader.model.DownloadState.Paused
import org.kiwix.kiwixmobile.core.downloader.model.DownloadState.Pending
import org.kiwix.kiwixmobile.core.downloader.model.DownloadState.Running
import org.kiwix.kiwixmobile.core.downloader.model.DownloadState.Successful
import org.kiwix.kiwixmobile.core.extensions.setBitmap
class DownloadViewHolder(override val containerView: View) : RecyclerView.ViewHolder(containerView),
LayoutContainer {

View File

@ -15,10 +15,10 @@
* 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.downloader
package org.kiwix.kiwixmobile.core.downloader
import org.kiwix.kiwixmobile.downloader.model.DownloadItem
import org.kiwix.kiwixmobile.library.entity.LibraryNetworkEntity
import org.kiwix.kiwixmobile.core.downloader.model.DownloadItem
import org.kiwix.kiwixmobile.core.entity.LibraryNetworkEntity
interface Downloader {
fun download(book: LibraryNetworkEntity.Book)

View File

@ -16,12 +16,12 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.kiwix.kiwixmobile.downloader
package org.kiwix.kiwixmobile.core.downloader
import org.kiwix.kiwixmobile.data.remote.KiwixService
import org.kiwix.kiwixmobile.database.newdb.dao.FetchDownloadDao
import org.kiwix.kiwixmobile.downloader.model.DownloadItem
import org.kiwix.kiwixmobile.library.entity.LibraryNetworkEntity
import org.kiwix.kiwixmobile.core.data.remote.KiwixService
import org.kiwix.kiwixmobile.core.downloader.model.DownloadItem
import org.kiwix.kiwixmobile.core.entity.LibraryNetworkEntity
import org.kiwix.kiwixmobile.core.newdb.dao.FetchDownloadDao
import javax.inject.Inject
class DownloaderImpl @Inject constructor(

View File

@ -15,7 +15,7 @@
* 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.downloader.fetch
package org.kiwix.kiwixmobile.core.downloader.fetch
import com.tonyodev.fetch2.Download
import com.tonyodev.fetch2.Error
@ -24,8 +24,8 @@ import com.tonyodev.fetch2.FetchListener
import com.tonyodev.fetch2core.DownloadBlock
import io.reactivex.schedulers.Schedulers
import io.reactivex.subjects.PublishSubject
import org.kiwix.kiwixmobile.database.newdb.dao.FetchDownloadDao
import org.kiwix.kiwixmobile.downloader.DownloadMonitor
import org.kiwix.kiwixmobile.core.downloader.DownloadMonitor
import org.kiwix.kiwixmobile.core.newdb.dao.FetchDownloadDao
import javax.inject.Inject
class FetchDownloadMonitor @Inject constructor(fetch: Fetch, fetchDownloadDao: FetchDownloadDao) :

View File

@ -15,7 +15,7 @@
* 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.downloader.fetch
package org.kiwix.kiwixmobile.core.downloader.fetch
import android.app.NotificationChannel
import android.app.NotificationManager

View File

@ -15,16 +15,16 @@
* 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.downloader.fetch
package org.kiwix.kiwixmobile.core.downloader.fetch
import com.tonyodev.fetch2.Fetch
import com.tonyodev.fetch2.NetworkType.ALL
import com.tonyodev.fetch2.NetworkType.WIFI_ONLY
import com.tonyodev.fetch2.Request
import org.kiwix.kiwixmobile.downloader.DownloadRequester
import org.kiwix.kiwixmobile.downloader.model.DownloadItem
import org.kiwix.kiwixmobile.downloader.model.DownloadRequest
import org.kiwix.kiwixmobile.utils.SharedPreferenceUtil
import org.kiwix.kiwixmobile.core.downloader.DownloadRequester
import org.kiwix.kiwixmobile.core.downloader.model.DownloadItem
import org.kiwix.kiwixmobile.core.downloader.model.DownloadRequest
import org.kiwix.kiwixmobile.core.utils.SharedPreferenceUtil
import javax.inject.Inject
class FetchDownloadRequester @Inject constructor(

View File

@ -1,4 +1,4 @@
package org.kiwix.kiwixmobile.downloader.model
package org.kiwix.kiwixmobile.core.downloader.model
import android.graphics.Bitmap
import android.graphics.BitmapFactory

View File

@ -15,7 +15,7 @@
* 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.downloader.model
package org.kiwix.kiwixmobile.core.downloader.model
import com.tonyodev.fetch2.Error
import com.tonyodev.fetch2.Status
@ -52,7 +52,10 @@ data class DownloadItem(
downloadModel.totalSizeOfDownload,
downloadModel.progress,
Seconds(downloadModel.etaInMilliSeconds / 1000L),
DownloadState.from(downloadModel.state, downloadModel.error)
DownloadState.from(
downloadModel.state,
downloadModel.error
)
)
}

View File

@ -15,13 +15,13 @@
* 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.downloader.model
package org.kiwix.kiwixmobile.core.downloader.model
import com.tonyodev.fetch2.Error
import com.tonyodev.fetch2.Status
import org.kiwix.kiwixmobile.database.newdb.entities.FetchDownloadEntity
import org.kiwix.kiwixmobile.library.entity.LibraryNetworkEntity.Book
import org.kiwix.kiwixmobile.utils.StorageUtils
import org.kiwix.kiwixmobile.core.entity.LibraryNetworkEntity.Book
import org.kiwix.kiwixmobile.core.newdb.entities.FetchDownloadEntity
import org.kiwix.kiwixmobile.core.utils.StorageUtils
data class DownloadModel(
val databaseId: Long,

View File

@ -15,13 +15,13 @@
* 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.downloader.model
package org.kiwix.kiwixmobile.core.downloader.model
import android.net.Uri
import org.kiwix.kiwixmobile.library.entity.LibraryNetworkEntity
import org.kiwix.kiwixmobile.library.entity.MetaLinkNetworkEntity
import org.kiwix.kiwixmobile.utils.SharedPreferenceUtil
import org.kiwix.kiwixmobile.utils.StorageUtils
import org.kiwix.kiwixmobile.core.entity.LibraryNetworkEntity
import org.kiwix.kiwixmobile.core.entity.MetaLinkNetworkEntity
import org.kiwix.kiwixmobile.core.utils.SharedPreferenceUtil
import org.kiwix.kiwixmobile.core.utils.StorageUtils
data class DownloadRequest(
val urlString: String,

View File

@ -1,6 +1,6 @@
package org.kiwix.kiwixmobile.downloader.model
package org.kiwix.kiwixmobile.core.downloader.model
import org.kiwix.kiwixmobile.KiwixApplication
import org.kiwix.kiwixmobile.core.KiwixApplication
import org.kiwix.kiwixmobile.core.R
import java.util.Locale
import kotlin.math.roundToLong

View File

@ -16,7 +16,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
package org.kiwix.kiwixmobile.library.entity;
package org.kiwix.kiwixmobile.core.entity;
import java.io.File;
import java.io.Serializable;

View File

@ -15,7 +15,7 @@
* 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.library.entity;
package org.kiwix.kiwixmobile.core.entity;
import java.util.List;
import java.util.Map;

View File

@ -1,4 +1,4 @@
package org.kiwix.kiwixmobile.error;
package org.kiwix.kiwixmobile.core.error;
import android.content.Context;
import android.content.Intent;
@ -16,15 +16,15 @@ import java.io.StringWriter;
import java.util.List;
import javax.inject.Inject;
import org.kiwix.kiwixmobile.core.R;
import org.kiwix.kiwixmobile.base.BaseActivity;
import org.kiwix.kiwixmobile.core.R2;
import org.kiwix.kiwixmobile.database.newdb.dao.NewBookDao;
import org.kiwix.kiwixmobile.library.entity.LibraryNetworkEntity;
import org.kiwix.kiwixmobile.splash.SplashActivity;
import org.kiwix.kiwixmobile.zim_manager.ZimReaderContainer;
import org.kiwix.kiwixmobile.zim_manager.fileselect_view.adapter.BooksOnDiskListItem.BookOnDisk;
import org.kiwix.kiwixmobile.core.base.BaseActivity;
import org.kiwix.kiwixmobile.core.entity.LibraryNetworkEntity;
import org.kiwix.kiwixmobile.core.newdb.dao.NewBookDao;
import org.kiwix.kiwixmobile.core.splash.SplashActivity;
import org.kiwix.kiwixmobile.core.zim_manager.ZimReaderContainer;
import org.kiwix.kiwixmobile.core.zim_manager.fileselect_view.adapter.BooksOnDiskListItem.BookOnDisk;
import static org.kiwix.kiwixmobile.utils.LanguageUtils.getCurrentLocale;
import static org.kiwix.kiwixmobile.core.utils.LanguageUtils.getCurrentLocale;
public class ErrorActivity extends BaseActivity {

View File

@ -1,4 +1,4 @@
package org.kiwix.kiwixmobile.extensions
package org.kiwix.kiwixmobile.core.extensions
import android.app.Activity
import android.content.Intent

View File

@ -1,9 +1,9 @@
package org.kiwix.kiwixmobile.extensions
package org.kiwix.kiwixmobile.core.extensions
import org.kiwix.kiwixmobile.KiwixApplication
import org.kiwix.kiwixmobile.library.entity.LibraryNetworkEntity.Book
import org.kiwix.kiwixmobile.utils.BookUtils
import org.kiwix.kiwixmobile.utils.NetworkUtils
import org.kiwix.kiwixmobile.core.KiwixApplication
import org.kiwix.kiwixmobile.core.entity.LibraryNetworkEntity.Book
import org.kiwix.kiwixmobile.core.utils.BookUtils
import org.kiwix.kiwixmobile.core.utils.NetworkUtils
fun Book.calculateSearchMatches(
filter: String,

Some files were not shown because too many files have changed in this diff Show More