1598 Move IntroActivity to app module

This commit is contained in:
Sean Mac Gillicuddy 2019-11-21 14:14:54 +00:00
parent ec4525560f
commit 50ec685319
70 changed files with 256 additions and 264 deletions

View File

@ -82,7 +82,7 @@ deploy:
#publish on play store
- provider: script
skip_cleanup: true
script: ./gradlew publishRelease
script: ./gradlew publishReleaseApk
on:
tags: true

View File

@ -78,5 +78,6 @@ play {
dependencies {
implementation(Libs.squidb)
implementation(Libs.squidb_annotations)
implementation(Libs.ink_page_indicator)
kapt(Libs.squidb_processor)
}

View File

@ -21,7 +21,6 @@ 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

@ -34,13 +34,11 @@ import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.kiwix.kiwixmobile.core.intro.IntroActivity;
import org.kiwix.kiwixmobile.core.main.CoreMainActivity;
import org.kiwix.kiwixmobile.core.splash.SplashActivity;
import org.kiwix.kiwixmobile.intro.IntroActivity;
import org.kiwix.kiwixmobile.main.KiwixMainActivity;
import static androidx.test.InstrumentationRegistry.getInstrumentation;
import static androidx.test.espresso.intent.Intents.intended;
import static androidx.test.espresso.intent.matcher.IntentMatchers.hasAction;
import static androidx.test.espresso.intent.matcher.IntentMatchers.hasComponent;
import static org.junit.Assert.assertEquals;
import static org.kiwix.kiwixmobile.core.utils.SharedPreferenceUtil.PREF_SHOW_INTRO;
@ -48,10 +46,10 @@ import static org.kiwix.kiwixmobile.testutils.TestUtils.TEST_PAUSE_MS;
@LargeTest
@RunWith(AndroidJUnit4.class)
public class SplashActivityTest {
public class KiwixSplashActivityTest {
private ActivityTestRule<SplashActivity> activityTestRule =
new ActivityTestRule<>(SplashActivity.class, true, false);
private ActivityTestRule<KiwixSplashActivity> activityTestRule =
new ActivityTestRule<>(KiwixSplashActivity.class, true, false);
@Rule
public GrantPermissionRule readPermissionRule =
GrantPermissionRule.grant(Manifest.permission.READ_EXTERNAL_STORAGE);
@ -72,7 +70,6 @@ public class SplashActivityTest {
activityTestRule.launchActivity(new Intent());
BaristaSleepInteractions.sleep(TEST_PAUSE_MS);
// Verify that the SplashActivity is followed by IntroActivity
intended(hasComponent(IntroActivity.class.getName()));
// Verify that the value of the "intro shown" boolean inside the SharedPreferences Database is not changed until the "Get started" button is pressed
@ -87,8 +84,7 @@ public class SplashActivityTest {
activityTestRule.launchActivity(new Intent());
BaristaSleepInteractions.sleep(TEST_PAUSE_MS);
// Verify that the SplashActivity is followed by CoreMainActivity
intended(hasAction(CoreMainActivity.class.getCanonicalName()));
intended(hasComponent(KiwixMainActivity.class.getCanonicalName()));
}
@After

View File

@ -1 +0,0 @@
contact+android@kiwix.org

View File

@ -1 +0,0 @@
http://www.kiwix.org

View File

@ -1 +0,0 @@
en-US

View File

@ -1,9 +0,0 @@
Die ganze Wikipedia auf deinem Mobilgerät!
Kiwix ist eine Programm, daß das Lesen der Wikipedia und anderer Inhalte (Ubuntu Dokumentation, WikiLeaks, WikiVoyage, WikiSource, etc) ohne Internetverbindung erlaubt.
Sobald du die Inhaltsdateien heruntergeladen hast, die sehr groß sein können, benötigst du keine Internetverbindung um sie zu verwenden.
Siehe die Hilfe in der App und unsere Webseite für Informationen über verfügbare Inhalte.
Anmerkung: Kiwix existiert auch für PCs (Windows, Mac, Linux) verfügbar..

View File

@ -1 +0,0 @@
Die Wikipedia immer dabei; ohne Internetverbindung!

View File

@ -1 +0,0 @@
Kiwix, Wikipedia offline

View File

@ -1,7 +0,0 @@
The whole of Wikipedia on your device!
The app is a lightweight piece of software reading bigger files stored on your device or SD card: once it is installed, you can select which additional content you would like to download (Wikipedia, Wiktionary, TED talks, etc.) and be ready for when your internet connexion is bad (or need to be in airplane mode)!
Please read the instructions inside the App or on the website (www.kiwix.org) to learn about the various contents that are available for download.
Note: Kiwix is also available on regular computers (Windows, Mac, Linux).

Binary file not shown.

Before

Width:  |  Height:  |  Size: 253 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 522 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 491 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 212 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 185 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 491 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 145 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 323 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 491 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 522 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 KiB

View File

@ -1 +0,0 @@
Wikipedia (and a lot more) at hand everywhere. No internet required!

View File

@ -1 +0,0 @@
Kiwix, Wikipedia offline

View File

@ -1,11 +0,0 @@
Tout Wikipédia dans votre mobile !
Kiwix est un lecteur de contenus hors-ligne qui peut être utilisé pour Wikipédia ainsi que d'autres contenus (Documentation Ubuntu, WikiLeaks, WikiVoyage, WikiSource, etc).
Une fois que vous avez téléchargé le fichier de contenu (potentiellement très gros), vous n'avez plus du tout besoin de connexion pour l'utiliser.
Kiwix est une application légère utilisant des fichiers ZIM que vous aurez préalablement téléchargé et stocké sur la mémoire externe (carte SD).
Merci de consulter les instructions d'utilisations dans l'application ainsi que sur le site web pour en savoir plus sur les contenus disponibles.
Note: Kiwix est aussi disponible sur ordinateur (Windows, Mac, Linux).

View File

@ -1 +0,0 @@
Emportez la Wikipédia partout avec vous ; sans connexion !

View File

@ -1 +0,0 @@
Kiwix, Wikipédia sans Internet

View File

@ -1,11 +0,0 @@
L'intera Wikipedia sempre con te!
Kiwix è un lettore non in linea di contenuti e siti di ogni genere, Wikipedia ma non solo (documentazione di Ubuntu, WikiLeaks, Wikisource, Wikivoyage ecc.).
Una volta scaricato l'archivio ZIM contenente il tutto (potenzialmente molto grande), non serve alcuna connessione a internet per navigarlo.
Kiwix è leggero e gli archivi ZIM si possono scaricare e conservare nel tuo apparecchio android o memoria esterna (scheda SD).
Controlla le istruzioni nell'applicazione e nel sito per sapere di più sui contenuti disponibili.
Nota, Kiwix è disponibile anche per computer normali (Windows, Mac e Linux).

View File

@ -1 +0,0 @@
Wikipedia sempre con te!

View File

@ -1 +0,0 @@
Kiwix

View File

@ -1,5 +0,0 @@
Vikipedi'nin tamamı cihazınızda!
Uygulama, cihazınızda veya SD kartta depolanan büyük dosyalar okuyan hafif bir yazılım parçasıdır: yükledikten sonra, hangi ek içerikler indirmek istediğinizi seçebilirsiniz (Vikipedi, Vikisözlük, TED Konferansları, v.b.) ve ne zaman internet bağlantınız kötü olsa, hazır olabilirsiniz (veya uçak modunda olmanız gerekiyorsa) !
Indirmek için hazır olan çeşitli içerikler hakkında bilgi edinmek için, lütfen uygulama içindeki veya web sitemizindeki talimatları okuyun (www.kiwix.org)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 379 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 809 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 278 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 502 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 121 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 670 KiB

View File

@ -1 +0,0 @@
Kiwix ile, Vikipedi tamamıyla telefonunuza veya tabletinize indirin

View File

@ -1 +0,0 @@
Kiwix - offline Vikipedi

View File

@ -1,4 +0,0 @@
BUGFIX: Some users language was causing a crash due to unstable ISO codes
BUGFIX: Some unstable zim files were crashing when opened
BUGFIX: Long titles were rendering off screen on home page
BUGFIX: Issues when opening a file externally

View File

@ -3,6 +3,23 @@
package="org.kiwix.kiwixmobile">
<application android:name=".KiwixApp">
<activity
android:name=".splash.KiwixSplashActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.Launcher">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.MONKEY" />
</intent-filter>
<meta-data
android:name="android.app.shortcuts"
android:resource="@xml/shortcuts" />
</activity>
<activity android:name=".intro.IntroActivity" />
<activity
android:name=".main.KiwixMainActivity"
android:configChanges="orientation|keyboardHidden|screenSize|locale"

View File

@ -22,10 +22,13 @@ import dagger.BindsInstance
import dagger.Subcomponent
import org.kiwix.kiwixmobile.core.di.ActivityScope
import org.kiwix.kiwixmobile.di.modules.KiwixActivityModule
import org.kiwix.kiwixmobile.intro.IntroActivity
import org.kiwix.kiwixmobile.intro.IntroModule
import org.kiwix.kiwixmobile.language.LanguageActivity
import org.kiwix.kiwixmobile.local_file_transfer.LocalFileTransferActivity
import org.kiwix.kiwixmobile.main.KiwixMainActivity
import org.kiwix.kiwixmobile.settings.KiwixSettingsActivity
import org.kiwix.kiwixmobile.splash.KiwixSplashActivity
import org.kiwix.kiwixmobile.zim_manager.ZimManageActivity
import org.kiwix.kiwixmobile.zim_manager.download_view.DownloadFragment
import org.kiwix.kiwixmobile.zim_manager.fileselect_view.ZimFileSelectFragment
@ -33,7 +36,7 @@ import org.kiwix.kiwixmobile.zim_manager.fileselect_view.effects.DeleteFiles
import org.kiwix.kiwixmobile.zim_manager.library_view.LibraryFragment
@ActivityScope
@Subcomponent(modules = [KiwixActivityModule::class])
@Subcomponent(modules = [KiwixActivityModule::class, IntroModule::class])
interface KiwixActivityComponent {
fun inject(downloadFragment: DownloadFragment)
fun inject(libraryFragment: LibraryFragment)
@ -44,6 +47,8 @@ interface KiwixActivityComponent {
fun inject(languageActivity: LanguageActivity)
fun inject(kiwixMainActivity: KiwixMainActivity)
fun inject(kiwixSettingsActivity: KiwixSettingsActivity)
fun inject(introActivity: IntroActivity)
fun inject(kiwixSplashActivity: KiwixSplashActivity)
@Subcomponent.Builder
interface Builder {

View File

@ -16,7 +16,7 @@
*
*/
package org.kiwix.kiwixmobile.core.intro;
package org.kiwix.kiwixmobile.intro;
import android.content.Context;
import android.util.AttributeSet;

View File

@ -16,7 +16,7 @@
*
*/
package org.kiwix.kiwixmobile.core.intro;
package org.kiwix.kiwixmobile.intro;
import android.os.Bundle;
import android.os.Handler;
@ -30,9 +30,9 @@ import com.pixelcan.inkpageindicator.InkPageIndicator;
import java.util.Timer;
import java.util.TimerTask;
import javax.inject.Inject;
import org.kiwix.kiwixmobile.ActivityExtensionsKt;
import org.kiwix.kiwixmobile.R;
import org.kiwix.kiwixmobile.core.Intents;
import org.kiwix.kiwixmobile.core.R;
import org.kiwix.kiwixmobile.core.R2;
import org.kiwix.kiwixmobile.core.base.BaseActivity;
import org.kiwix.kiwixmobile.core.main.CoreMainActivity;
@ -40,9 +40,9 @@ public class IntroActivity extends BaseActivity implements IntroContract.View {
private final Handler handler = new Handler();
private final Timer timer = new Timer();
@BindView(R2.id.view_pager)
@BindView(R.id.view_pager)
ViewPager viewPager;
@BindView(R2.id.tab_indicator)
@BindView(R.id.tab_indicator)
InkPageIndicator tabIndicator;
@Inject
IntroContract.Presenter presenter;
@ -79,6 +79,10 @@ public class IntroActivity extends BaseActivity implements IntroContract.View {
};
private View[] views;
@Override protected void injection() {
ActivityExtensionsKt.getKiwixActivityComponent(this).inject(this);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@ -122,7 +126,7 @@ public class IntroActivity extends BaseActivity implements IntroContract.View {
}
}
@OnClick(R2.id.get_started)
@OnClick(R.id.get_started)
void startMainActivity() {
dismissAutoRotate();
startActivity(Intents.internal(CoreMainActivity.class));

View File

@ -16,11 +16,11 @@
*
*/
package org.kiwix.kiwixmobile.core.intro;
package org.kiwix.kiwixmobile.intro;
import org.kiwix.kiwixmobile.core.base.BaseContract;
interface IntroContract {
public interface IntroContract {
interface View extends BaseContract.View<Presenter> {

View File

@ -15,18 +15,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package org.kiwix.kiwixmobile.intro
package org.kiwix.kiwixmobile.core.intro;
import dagger.Module;
import dagger.Provides;
import org.kiwix.kiwixmobile.core.di.ActivityScope;
import dagger.Binds
import dagger.Module
import org.kiwix.kiwixmobile.core.di.ActivityScope
@Module
public class IntroModule {
@ActivityScope
@Provides
IntroContract.Presenter provideIntroPresenter(IntroPresenter presenter) {
return presenter;
}
abstract class IntroModule {
@ActivityScope @Binds
abstract fun bindsPresenter(presenter: IntroPresenter): IntroContract.Presenter
}

View File

@ -16,7 +16,7 @@
*
*/
package org.kiwix.kiwixmobile.core.intro;
package org.kiwix.kiwixmobile.intro;
import android.view.View;
import android.view.ViewGroup;

View File

@ -16,7 +16,7 @@
*
*/
package org.kiwix.kiwixmobile.core.intro;
package org.kiwix.kiwixmobile.intro;
import javax.inject.Inject;
import org.kiwix.kiwixmobile.core.base.BasePresenter;
@ -24,7 +24,8 @@ import org.kiwix.kiwixmobile.core.di.ActivityScope;
import org.kiwix.kiwixmobile.core.utils.SharedPreferenceUtil;
@ActivityScope
class IntroPresenter extends BasePresenter<IntroContract.View> implements IntroContract.Presenter {
public class IntroPresenter extends BasePresenter<IntroContract.View>
implements IntroContract.Presenter {
private final SharedPreferenceUtil preferences;
@Inject IntroPresenter(SharedPreferenceUtil preferences) {

View File

@ -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.splash
import android.content.Intent
import org.kiwix.kiwixmobile.core.splash.CoreSplashActivity
import org.kiwix.kiwixmobile.intro.IntroActivity
import org.kiwix.kiwixmobile.kiwixActivityComponent
import org.kiwix.kiwixmobile.main.KiwixMainActivity
class KiwixSplashActivity : CoreSplashActivity() {
override fun injection() {
kiwixActivityComponent.inject(this)
}
override val intentForNextScreen: Intent
get() = if (sharedPreferenceUtil.showIntro())
Intent(this, IntroActivity::class.java)
else
Intent(this, KiwixMainActivity::class.java)
}

View File

@ -4,16 +4,14 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".intro.IntroActivity"
>
tools:context=".intro.IntroActivity">
<org.kiwix.kiwixmobile.core.intro.CustomViewPager
<org.kiwix.kiwixmobile.intro.CustomViewPager
android:id="@+id/view_pager"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toTopOf="@id/get_started"
app:layout_constraintTop_toTopOf="parent"
/>
app:layout_constraintTop_toTopOf="parent" />
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/get_started"
@ -25,8 +23,7 @@
app:backgroundTint="@android:color/white"
app:layout_constraintBottom_toTopOf="@id/tab_indicator"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
/>
app:layout_constraintStart_toStartOf="parent" />
<com.pixelcan.inkpageindicator.InkPageIndicator
android:id="@+id/tab_indicator"
@ -35,6 +32,5 @@
android:layout_marginBottom="@dimen/activity_vertical_margin"
app:ipi_currentPageIndicatorColor="@color/blue800"
app:ipi_pageIndicatorColor="@color/blueTransparent"
app:layout_constraintBottom_toBottomOf="parent"
/>
app:layout_constraintBottom_toBottomOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -8,7 +8,7 @@
android:shortcutShortLabel="@string/new_tab_shortcut_label">
<intent
android:action="NEW_TAB"
android:targetClass="org.kiwix.kiwixmobile.core.main.CoreMainActivity"
android:targetClass="org.kiwix.kiwixmobile.main.KiwixMainActivity"
android:targetPackage="org.kiwix.kiwixmobile" />
</shortcut>
@ -21,7 +21,7 @@
android:shortcutShortLabel="@string/get_content_shortcut_label">
<intent
android:action="GET_CONTENT"
android:targetClass="org.kiwix.kiwixmobile.core.zim_manager.ZimManageActivity"
android:targetClass="org.kiwix.kiwixmobile.zim_manager.ZimManageActivity"
android:targetPackage="org.kiwix.kiwixmobile" />
</shortcut>
</shortcuts>

View File

@ -16,8 +16,6 @@
*
*/
import kotlin.String
/**
* Generated by https://github.com/jmfayard/buildSrcVersions
*
@ -26,72 +24,72 @@ import kotlin.String
*/
object Libs {
const val de_fayard_buildsrcversions_gradle_plugin: String =
"de.fayard.buildSrcVersions:de.fayard.buildSrcVersions.gradle.plugin:" +
"de.fayard.buildSrcVersions:de.fayard.buildSrcVersions.gradle.plugin:" +
Versions.de_fayard_buildsrcversions_gradle_plugin
const val com_github_triplet_play_gradle_plugin: String =
"com.github.triplet.play:com.github.triplet.play.gradle.plugin:" +
"com.github.triplet.play:com.github.triplet.play.gradle.plugin:" +
Versions.com_github_triplet_play_gradle_plugin
/**
* https://developer.android.com/topic/libraries/architecture/index.html
*/
const val android_arch_lifecycle_extensions: String = "android.arch.lifecycle:extensions:" +
Versions.android_arch_lifecycle_extensions
Versions.android_arch_lifecycle_extensions
/**
* https://developer.android.com/studio
*/
const val com_android_tools_build_gradle: String = "com.android.tools.build:gradle:" +
Versions.com_android_tools_build_gradle
Versions.com_android_tools_build_gradle
const val androidx_multidex_multidex: String = "androidx.multidex:multidex:" +
Versions.androidx_multidex_multidex
Versions.androidx_multidex_multidex
/**
* https://github.com/JakeWharton/butterknife/
*/
const val butterknife_gradle_plugin: String = "com.jakewharton:butterknife-gradle-plugin:" +
Versions.butterknife_gradle_plugin
Versions.butterknife_gradle_plugin
const val multidex_instrumentation: String = "androidx.multidex:multidex-instrumentation:" +
Versions.multidex_instrumentation
Versions.multidex_instrumentation
/**
* https://developer.android.com/testing
*/
const val espresso_contrib: String = "androidx.test.espresso:espresso-contrib:" +
Versions.androidx_test_espresso
Versions.androidx_test_espresso
/**
* https://developer.android.com/testing
*/
const val espresso_core: String = "androidx.test.espresso:espresso-core:" +
Versions.androidx_test_espresso
Versions.androidx_test_espresso
/**
* https://developer.android.com/testing
*/
const val espresso_intents: String = "androidx.test.espresso:espresso-intents:" +
Versions.androidx_test_espresso
Versions.androidx_test_espresso
/**
* https://developer.android.com/testing
*/
const val espresso_web: String = "androidx.test.espresso:espresso-web:" +
Versions.androidx_test_espresso
Versions.androidx_test_espresso
/**
* https://github.com/square/retrofit/
*/
const val adapter_rxjava2: String = "com.squareup.retrofit2:adapter-rxjava2:" +
Versions.com_squareup_retrofit2
Versions.com_squareup_retrofit2
/**
* https://github.com/square/retrofit/
*/
const val converter_simplexml: String = "com.squareup.retrofit2:converter-simplexml:" +
Versions.com_squareup_retrofit2
Versions.com_squareup_retrofit2
/**
* https://github.com/square/retrofit/
@ -99,7 +97,7 @@ object Libs {
const val retrofit: String = "com.squareup.retrofit2:retrofit:" + Versions.com_squareup_retrofit2
const val play_services_location: String = "com.google.android.gms:play-services-location:" +
Versions.play_services_location
Versions.play_services_location
/**
* https://developer.android.com/testing
@ -110,43 +108,43 @@ object Libs {
* https://github.com/JakeWharton/butterknife/
*/
const val butterknife_compiler: String = "com.jakewharton:butterknife-compiler:" +
Versions.butterknife_compiler
Versions.butterknife_compiler
/**
* http://jcp.org/en/jsr/detail?id=250
*/
const val javax_annotation_api: String = "javax.annotation:javax.annotation-api:" +
Versions.javax_annotation_api
Versions.javax_annotation_api
/**
* https://kotlinlang.org/
*/
const val kotlin_android_extensions: String = "org.jetbrains.kotlin:kotlin-android-extensions:" +
Versions.org_jetbrains_kotlin
Versions.org_jetbrains_kotlin
/**
* https://kotlinlang.org/
*/
const val kotlin_android_extensions_runtime: String =
"org.jetbrains.kotlin:kotlin-android-extensions-runtime:" + Versions.org_jetbrains_kotlin
"org.jetbrains.kotlin:kotlin-android-extensions-runtime:" + Versions.org_jetbrains_kotlin
/**
* https://kotlinlang.org/
*/
const val kotlin_annotation_processing_gradle: String =
"org.jetbrains.kotlin:kotlin-annotation-processing-gradle:" + Versions.org_jetbrains_kotlin
"org.jetbrains.kotlin:kotlin-annotation-processing-gradle:" + Versions.org_jetbrains_kotlin
/**
* https://kotlinlang.org/
*/
const val kotlin_gradle_plugin: String = "org.jetbrains.kotlin:kotlin-gradle-plugin:" +
Versions.org_jetbrains_kotlin
Versions.org_jetbrains_kotlin
/**
* https://kotlinlang.org/
*/
const val kotlin_stdlib_jdk7: String = "org.jetbrains.kotlin:kotlin-stdlib-jdk7:" +
Versions.org_jetbrains_kotlin
Versions.org_jetbrains_kotlin
/**
* https://developer.android.com/testing
@ -157,27 +155,21 @@ object Libs {
* https://github.com/square/okhttp
*/
const val logging_interceptor: String = "com.squareup.okhttp3:logging-interceptor:" +
Versions.logging_interceptor
Versions.logging_interceptor
/**
* https://developer.android.com/testing
*/
const val androidx_test_core: String = "androidx.test:core:" + Versions.androidx_test_core
/**
* http://hc.apache.org/httpcomponents-client/
*/
const val httpclient_android: String = "org.apache.httpcomponents:httpclient-android:" +
Versions.httpclient_android
const val ink_page_indicator: String = "com.pacioianu.david:ink-page-indicator:" +
Versions.ink_page_indicator
Versions.ink_page_indicator
/**
* http://github.com/square/leakcanary/
*/
const val leakcanary_android: String = "com.squareup.leakcanary:leakcanary-android:" +
Versions.leakcanary_android
Versions.leakcanary_android
/**
* https://github.com/google/dagger
@ -188,19 +180,19 @@ object Libs {
* https://github.com/google/dagger
*/
const val dagger_android: String = "com.google.dagger:dagger-android:" +
Versions.com_google_dagger
Versions.com_google_dagger
/**
* https://github.com/google/dagger
*/
const val dagger_android_processor: String = "com.google.dagger:dagger-android-processor:" +
Versions.com_google_dagger
Versions.com_google_dagger
/**
* https://github.com/google/dagger
*/
const val dagger_compiler: String = "com.google.dagger:dagger-compiler:" +
Versions.com_google_dagger
Versions.com_google_dagger
/**
* https://github.com/yahoo/squidb
@ -211,19 +203,19 @@ object Libs {
* https://github.com/yahoo/squidb
*/
const val squidb_annotations: String = "com.yahoo.squidb:squidb-annotations:" +
Versions.com_yahoo_squidb
Versions.com_yahoo_squidb
/**
* https://github.com/yahoo/squidb
*/
const val squidb_processor: String = "com.yahoo.squidb:squidb-processor:" +
Versions.com_yahoo_squidb
Versions.com_yahoo_squidb
/**
* http://tools.android.com
*/
const val constraintlayout: String = "androidx.constraintlayout:constraintlayout:" +
Versions.constraintlayout
Versions.constraintlayout
/**
* https://github.com/mockito/mockito
@ -236,7 +228,7 @@ object Libs {
const val collection_ktx: String = "androidx.collection:collection-ktx:" + Versions.collection_ktx
const val jacoco_android: String = "com.dicedmelon.gradle:jacoco-android:" +
Versions.jacoco_android
Versions.jacoco_android
/**
* https://junit.org/junit5/
@ -256,7 +248,7 @@ object Libs {
const val testdroid_api: String = "com.testdroid:testdroid-api:" + Versions.testdroid_api
const val xfetch2okhttp: String = "androidx.tonyodev.fetch2okhttp:xfetch2okhttp:" +
Versions.xfetch2okhttp
Versions.xfetch2okhttp
/**
* http://assertj.org
@ -282,7 +274,7 @@ object Libs {
* https://objectbox.io
*/
const val objectbox_gradle_plugin: String = "io.objectbox:objectbox-gradle-plugin:" +
Versions.io_objectbox
Versions.io_objectbox
/**
* http://objectbox.io
@ -293,7 +285,7 @@ object Libs {
* https://objectbox.io
*/
const val objectbox_processor: String = "io.objectbox:objectbox-processor:" +
Versions.io_objectbox
Versions.io_objectbox
/**
* http://objectbox.io

View File

@ -16,7 +16,6 @@
*
*/
import kotlin.String
import org.gradle.plugin.use.PluginDependenciesSpec
import org.gradle.plugin.use.PluginDependencySpec
@ -52,7 +51,7 @@ object Versions {
const val androidx_test_runner: String = "1.2.0"
const val butterknife_compiler: String = "10.1.0" // available: "10.2.0"
const val butterknife_compiler: String = "10.2.0"
const val javax_annotation_api: String = "1.3.2"
@ -64,8 +63,6 @@ object Versions {
const val androidx_test_core: String = "1.2.0"
const val httpclient_android: String = "4.3.3" // available: "4.3.5.1"
const val ink_page_indicator: String = "1.3.0"
const val leakcanary_android: String = "2.0-alpha-2"
@ -102,7 +99,7 @@ object Versions {
const val orchestrator: String = "1.1.0" // available: "1.2.0"
const val butterknife: String = "10.1.0" // available: "10.2.0"
const val butterknife: String = "10.2.0"
const val lint_gradle: String = "26.5.0"
@ -160,4 +157,4 @@ object Versions {
*/
val PluginDependenciesSpec.buildSrcVersions: PluginDependencySpec
inline get() =
id("de.fayard.buildSrcVersions").version(Versions.de_fayard_buildsrcversions_gradle_plugin)
id("de.fayard.buildSrcVersions").version(Versions.de_fayard_buildsrcversions_gradle_plugin)

View File

@ -47,8 +47,6 @@ dependencies {
// Android Support
implementation(Libs.cardview)
// Tab indicator
implementation(Libs.ink_page_indicator)
// SquiDB
implementation(Libs.squidb)

View File

@ -27,24 +27,6 @@
android:usesCleartextTraffic="true"
tools:targetApi="m">
<activity
android:name=".splash.SplashActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.Launcher">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.MONKEY" />
</intent-filter>
<meta-data
android:name="android.app.shortcuts"
android:resource="@xml/shortcuts" />
</activity>
<activity android:name=".search.SearchActivity" />
<activity android:name=".bookmark.BookmarksActivity" />
<activity android:name=".webserver.ZimHostActivity" />
@ -84,8 +66,6 @@
android:resource="@xml/provider_paths" />
</provider>
<activity android:name=".intro.IntroActivity" />
<activity android:name=".history.HistoryActivity" />
<activity android:name=".help.HelpActivity">
<meta-data

View File

@ -27,10 +27,8 @@ 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.search.SearchActivity;
import org.kiwix.kiwixmobile.core.splash.SplashActivity;
import org.kiwix.kiwixmobile.core.splash.CoreSplashActivity;
import org.kiwix.kiwixmobile.core.webserver.ZimHostActivity;
import org.kiwix.kiwixmobile.core.webserver.ZimHostModule;
@ -55,14 +53,6 @@ public abstract class ActivityBindingModule {
@ContributesAndroidInjector
public abstract ErrorActivity provideErrorActivity();
@ActivityScope
@ContributesAndroidInjector(modules = IntroModule.class)
public abstract IntroActivity provideIntroActivity();
@ActivityScope
@ContributesAndroidInjector
public abstract SplashActivity provideSplashActivity();
@ActivityScope
@ContributesAndroidInjector(modules = HistoryModule.class)
public abstract HistoryActivity provideHistoryActivity();

View File

@ -38,7 +38,7 @@ import org.kiwix.kiwixmobile.core.R2;
import org.kiwix.kiwixmobile.core.base.BaseActivity;
import org.kiwix.kiwixmobile.core.entity.LibraryNetworkEntity;
import org.kiwix.kiwixmobile.core.dao.NewBookDao;
import org.kiwix.kiwixmobile.core.splash.SplashActivity;
import org.kiwix.kiwixmobile.core.splash.CoreSplashActivity;
import org.kiwix.kiwixmobile.core.reader.ZimReaderContainer;
import org.kiwix.kiwixmobile.core.zim_manager.fileselect_view.adapter.BooksOnDiskListItem.BookOnDisk;
@ -171,15 +171,7 @@ public class ErrorActivity extends BaseActivity {
}
void restartApp() {
Context context = this;
Intent intent = new Intent(context, SplashActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK
| Intent.FLAG_ACTIVITY_CLEAR_TASK
| Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
intent.setAction(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_LAUNCHER);
context.startActivity(intent);
startActivity(getPackageManager().getLaunchIntentForPackage(getPackageName()));
finish();
killCurrentProcess();
}

View File

@ -1025,7 +1025,7 @@ public abstract class CoreMainActivity extends BaseActivity implements WebViewCa
.show();
}
protected void openZimFile(File file) {
protected void openZimFile(@NonNull File file) {
if (hasPermission(Manifest.permission.READ_EXTERNAL_STORAGE)) {
if (file.exists()) {
openAndSetInContainer(file);
@ -1089,7 +1089,9 @@ public abstract class CoreMainActivity extends BaseActivity implements WebViewCa
switch (requestCode) {
case REQUEST_STORAGE_PERMISSION: {
if (hasPermission(Manifest.permission.READ_EXTERNAL_STORAGE)) {
openZimFile(file);
if (file != null) {
openZimFile(file);
}
} else {
AlertDialog.Builder builder = new AlertDialog.Builder(this, dialogStyle());
builder.setMessage(getResources().getString(R.string.reboot_message));

View File

@ -0,0 +1,50 @@
/*
* 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.core.splash
import android.content.Intent
import android.os.Bundle
import android.os.Process
import org.kiwix.kiwixmobile.core.BuildConfig
import org.kiwix.kiwixmobile.core.base.BaseActivity
import org.kiwix.kiwixmobile.core.error.ErrorActivity
import kotlin.system.exitProcess
abstract class CoreSplashActivity : BaseActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
if (!BuildConfig.DEBUG) {
val appContext = applicationContext
Thread.setDefaultUncaughtExceptionHandler { paramThread: Thread?,
paramThrowable: Throwable? ->
val intent = Intent(appContext, ErrorActivity::class.java)
val extras = Bundle()
extras.putSerializable("exception", paramThrowable)
intent.putExtras(extras)
appContext.startActivity(intent)
finish()
Process.killProcess(Process.myPid())
exitProcess(10)
}
}
startActivity(intentForNextScreen)
finish()
}
protected abstract val intentForNextScreen: Intent
}

View File

@ -1,64 +0,0 @@
/*
* Kiwix Android
* Copyright (c) 2019 Kiwix <android.kiwix.org>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package org.kiwix.kiwixmobile.core.splash;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import org.kiwix.kiwixmobile.core.BuildConfig;
import org.kiwix.kiwixmobile.core.Intents;
import org.kiwix.kiwixmobile.core.base.BaseActivity;
import org.kiwix.kiwixmobile.core.error.ErrorActivity;
import org.kiwix.kiwixmobile.core.intro.IntroActivity;
import org.kiwix.kiwixmobile.core.main.CoreMainActivity;
public class SplashActivity extends BaseActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (!BuildConfig.DEBUG) {
Context appContext = getApplicationContext();
Thread.setDefaultUncaughtExceptionHandler((paramThread, paramThrowable) -> {
final Intent intent = new Intent(appContext, ErrorActivity.class);
Bundle extras = new Bundle();
extras.putSerializable("exception", paramThrowable);
intent.putExtras(extras);
appContext.startActivity(intent);
finish();
android.os.Process.killProcess(android.os.Process.myPid());
System.exit(10);
});
}
Intent intent;
if (!sharedPreferenceUtil.showIntro()) {
intent = Intents.internal(CoreMainActivity.class);
} else {
intent = new Intent(this, IntroActivity.class);
}
startActivity(intent);
finish();
}
}

View File

@ -4,7 +4,22 @@
<application android:name=".CustomApp">
<activity
android:name=".splash.CustomSplashActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.Launcher">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.MONKEY" />
</intent-filter>
<meta-data
android:name="android.app.shortcuts"
android:resource="@xml/shortcuts" />
</activity>
<activity
android:name=".main.CustomMainActivity"
android:configChanges="orientation|keyboardHidden|screenSize|locale"

View File

@ -25,6 +25,7 @@ import org.kiwix.kiwixmobile.core.di.ActivityScope
import org.kiwix.kiwixmobile.custom.download.CustomDownloadActivity
import org.kiwix.kiwixmobile.custom.main.CustomMainActivity
import org.kiwix.kiwixmobile.custom.settings.CustomSettingsActivity
import org.kiwix.kiwixmobile.custom.splash.CustomSplashActivity
@ActivityScope
@Subcomponent(modules = [CustomActivityModule::class])
@ -32,6 +33,7 @@ interface CustomActivityComponent {
fun inject(customMainActivity: CustomMainActivity)
fun inject(customSettingsActivity: CustomSettingsActivity)
fun inject(customDownloadActivity: CustomDownloadActivity)
fun inject(customSplashActivity: CustomSplashActivity)
@Subcomponent.Builder
interface Builder {

View File

@ -0,0 +1,32 @@
/*
* Kiwix Android
* Copyright (c) 2019 Kiwix <android.kiwix.org>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package org.kiwix.kiwixmobile.custom.splash
import android.content.Intent
import org.kiwix.kiwixmobile.core.splash.CoreSplashActivity
import org.kiwix.kiwixmobile.custom.customActivityComponent
import org.kiwix.kiwixmobile.custom.main.CustomMainActivity
class CustomSplashActivity : CoreSplashActivity() {
override fun injection() {
customActivityComponent.inject(this)
}
override val intentForNextScreen: Intent
get() = Intent(this, CustomMainActivity::class.java)
}

View File

@ -0,0 +1,13 @@
<shortcuts xmlns:android="http://schemas.android.com/apk/res/android">
<shortcut
android:enabled="true"
android:icon="@drawable/ic_shortcut_new_tab"
android:shortcutDisabledMessage="@string/shortcut_disabled_message"
android:shortcutId="new_tab"
android:shortcutLongLabel="@string/new_tab_shortcut_label"
android:shortcutShortLabel="@string/new_tab_shortcut_label">
<intent
android:action="NEW_TAB"
android:targetClass="org.kiwix.kiwixmobile.custom.main.CustomMainActivity" />
</shortcut>
</shortcuts>