From 401f73c4c5f070ffc0b83130ca65929cf0e5a050 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frans-Lukas=20L=C3=B6venvald?= Date: Thu, 4 Jun 2020 11:07:42 +0200 Subject: [PATCH 01/78] Added link to DESIGN.md --- CONTRIBUTING.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 872427730..868686fb0 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -54,6 +54,10 @@ All branches should have distinct history and should be visually easy to follow, If you wish to rebase you should be following the [Golden Rule](https://www.atlassian.com/git/tutorials/merging-vs-rebasing#the-golden-rule-of-rebasing) and ahere to the advice in the heading [Aside: Rebase as cleanup is awesome in the coding lifecycle](https://www.atlassian.com/git/articles/git-team-workflows-merge-or-rebase). +### Design and style + +For an overview of how to make design changes to Kiwix Android, check out [DESIGN.md](https://github.com/kiwix/kiwix-android/edit/develop/DESIGN.md). + ### Building The Kiwix app is split into 3 modules From 616103420f7ffd91a39957145b16d324be931576 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frans-Lukas=20L=C3=B6venvald?= Date: Thu, 4 Jun 2020 11:49:05 +0200 Subject: [PATCH 02/78] First draft of DESIGN.md --- DESIGN.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 DESIGN.md diff --git a/DESIGN.md b/DESIGN.md new file mode 100644 index 000000000..d53aaa328 --- /dev/null +++ b/DESIGN.md @@ -0,0 +1,30 @@ +# Design + +This file intends to provide links to design resources, display kiwix colors and how to use them and present accessibility. + +## Colors + +drawing + +The Kiwix colors are black and white with different colored accents. For Kiwix Android, black is accented by different shades of blue: + +- ![#000000](https://via.placeholder.com/15/000000/000000?text=+) `#000000`/`black` +- ![#1565c0](https://via.placeholder.com/15/1565c0/000000?text=+) `#1565c0`/`color_primary` +- ![#2196F3](https://via.placeholder.com/15/2196F3/000000?text=+) `#2196F3`/`accent` +- ![#42a5f5](https://via.placeholder.com/15/42a5f5/000000?text=+) `#42a5f5`/`blue400` + +> Color indicates which elements are interactive, how they relate to other elements, and their level of prominence. Important elements should stand out the most [1]. + +For a guide on how to apply colors to UI, see [Applying color to UI - Material Design](https://material.io/design/color/applying-color-to-ui.html#backdrop). + +## Resources +Following is a list of resources that can and should be used to support a design decsion. + +1. [Material Design](https://material.io/) - Googles design guide that should be followed to keep Android applications consistent. +2. [Design for Android](https://developer.android.com/design) - Another design guide by Google, this one is specifically for Android while Material Design is more general. +3. [Figma](https://www.figma.com) - A tool that can be used to mock design ideas. + +## Accessibility + + +[1] https://material.io/design/color/the-color-system.html 2020-06-04 From e92aa29bd6a586ebc4ebfbea798ccb5f82c5fad7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frans-Lukas=20L=C3=B6venvald?= Date: Thu, 4 Jun 2020 11:52:15 +0200 Subject: [PATCH 03/78] #2111 Spelling fix and re-phrasing. --- DESIGN.md | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/DESIGN.md b/DESIGN.md index d53aaa328..33f5fc9b3 100644 --- a/DESIGN.md +++ b/DESIGN.md @@ -1,30 +1,32 @@ # Design -This file intends to provide links to design resources, display kiwix colors and how to use them and present accessibility. +This file intends to provide links to design resources, display the Kiwix colors, as well as presenting accessibility. ## Colors drawing -The Kiwix colors are black and white with different colored accents. For Kiwix Android, black is accented by different shades of blue: +The Kiwix colors are black and white with different colored accents. For Kiwix Android, black is accented by different shades of blue: - ![#000000](https://via.placeholder.com/15/000000/000000?text=+) `#000000`/`black` -- ![#1565c0](https://via.placeholder.com/15/1565c0/000000?text=+) `#1565c0`/`color_primary` +- ![#1565c0](https://via.placeholder.com/15/1565c0/000000?text=+) `#1565c0`/`color_primary` - ![#2196F3](https://via.placeholder.com/15/2196F3/000000?text=+) `#2196F3`/`accent` -- ![#42a5f5](https://via.placeholder.com/15/42a5f5/000000?text=+) `#42a5f5`/`blue400` +- ![#42a5f5](https://via.placeholder.com/15/42a5f5/000000?text=+) `#42a5f5`/`blue400` > Color indicates which elements are interactive, how they relate to other elements, and their level of prominence. Important elements should stand out the most [1]. For a guide on how to apply colors to UI, see [Applying color to UI - Material Design](https://material.io/design/color/applying-color-to-ui.html#backdrop). ## Resources -Following is a list of resources that can and should be used to support a design decsion. +Following is a list of resources that can and should be used to support a design decision. -1. [Material Design](https://material.io/) - Googles design guide that should be followed to keep Android applications consistent. -2. [Design for Android](https://developer.android.com/design) - Another design guide by Google, this one is specifically for Android while Material Design is more general. +1. [Material Design](https://material.io/) - Googles design guide that should be followed to keep Android applications consistent. +2. [Design for Android](https://developer.android.com/design) - Another design guide by Google, this one is specifically for Android while Material Design is more general. 3. [Figma](https://www.figma.com) - A tool that can be used to mock design ideas. -## Accessibility +## Accessibility [1] https://material.io/design/color/the-color-system.html 2020-06-04 + + From bfd16cf22d6b00de3275595b29c34de91ff345a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frans-Lukas=20L=C3=B6venvald?= Date: Thu, 4 Jun 2020 13:36:07 +0200 Subject: [PATCH 04/78] #2111 Added Accessibility section of DESIGN.md --- DESIGN.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/DESIGN.md b/DESIGN.md index 33f5fc9b3..452eabb1c 100644 --- a/DESIGN.md +++ b/DESIGN.md @@ -15,7 +15,7 @@ The Kiwix colors are black and white with different colored accents. For Kiwix A > Color indicates which elements are interactive, how they relate to other elements, and their level of prominence. Important elements should stand out the most [1]. -For a guide on how to apply colors to UI, see [Applying color to UI - Material Design](https://material.io/design/color/applying-color-to-ui.html#backdrop). +For a guide on how to apply colors to UI, see ["Applying color to UI - Material Design"](https://material.io/design/color/applying-color-to-ui.html#backdrop). ## Resources Following is a list of resources that can and should be used to support a design decision. @@ -25,7 +25,15 @@ Following is a list of resources that can and should be used to support a design 3. [Figma](https://www.figma.com) - A tool that can be used to mock design ideas. ## Accessibility +Accessibility is an important part of Android applications. Especially applications that are as widely used as Kiwix. As such, accessibility should be a part of the argument for most if not all design decisions for Kiwix Android. This can include choices such as: +- Having text with a large font and good contrast ratio. +- Large simple controls. +- Consistent controls and navigation. (consistent to Kiwix, and other Android applications.) + +Kiwix does not yet contain content descriptions for its UI elements. This can prohibit users with for example poor eyesight to use Kiwix successfully. Therefore, newly introduced interactive elements should contain content descriptions (boy scout rule applies here too!). + +See ["Make apps more accessible"](https://developer.android.com/guide/topics/ui/accessibility/apps) for a more detailed guide on accessibility. [Firefox Fenix](https://github.com/mozilla-mobile/shared-docs/blob/master/android/accessibility_guide.md) also has a great concise description of accessibility. [1] https://material.io/design/color/the-color-system.html 2020-06-04 From 429341715876505a06041dfe52050dd004ceb982 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frans-Lukas=20L=C3=B6venvald?= Date: Thu, 4 Jun 2020 13:38:30 +0200 Subject: [PATCH 05/78] #2111 small rephrasing --- DESIGN.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESIGN.md b/DESIGN.md index 452eabb1c..e084e7a38 100644 --- a/DESIGN.md +++ b/DESIGN.md @@ -25,7 +25,7 @@ Following is a list of resources that can and should be used to support a design 3. [Figma](https://www.figma.com) - A tool that can be used to mock design ideas. ## Accessibility -Accessibility is an important part of Android applications. Especially applications that are as widely used as Kiwix. As such, accessibility should be a part of the argument for most if not all design decisions for Kiwix Android. This can include choices such as: +Accessibility is an important part of Android applications. Especially applications that are as widely used as Kiwix. As such, accessibility should be part of design decisions. This can include choices such as: - Having text with a large font and good contrast ratio. - Large simple controls. From ee496e02c6f23da8b4d34a8a57a6a74b9f4d4307 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frans-Lukas=20L=C3=B6venvald?= Date: Thu, 4 Jun 2020 13:43:29 +0200 Subject: [PATCH 06/78] #2111 Added link to accessibility step by step --- DESIGN.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESIGN.md b/DESIGN.md index e084e7a38..2969a00fa 100644 --- a/DESIGN.md +++ b/DESIGN.md @@ -33,7 +33,7 @@ Accessibility is an important part of Android applications. Especially applicati Kiwix does not yet contain content descriptions for its UI elements. This can prohibit users with for example poor eyesight to use Kiwix successfully. Therefore, newly introduced interactive elements should contain content descriptions (boy scout rule applies here too!). -See ["Make apps more accessible"](https://developer.android.com/guide/topics/ui/accessibility/apps) for a more detailed guide on accessibility. [Firefox Fenix](https://github.com/mozilla-mobile/shared-docs/blob/master/android/accessibility_guide.md) also has a great concise description of accessibility. +See ["Make apps more accessible"](https://developer.android.com/guide/topics/ui/accessibility/apps) for a more detailed guide on accessibility. [Firefox Fenix](https://github.com/mozilla-mobile/shared-docs/blob/master/android/accessibility_guide.md) also has a great concise description of accessibility. A third accessibility resource is googles [list of key steps](https://android-developers.googleblog.com/2012/04/accessibility-are-you-serving-all-your.html) for making sure an Android application is accessible. [1] https://material.io/design/color/the-color-system.html 2020-06-04 From 54cda8194fd73a3548512fd8f17db08b66db2671 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frans-Lukas=20L=C3=B6venvald?= Date: Thu, 4 Jun 2020 13:46:42 +0200 Subject: [PATCH 07/78] #2111 Added string resource md link --- CONTRIBUTING.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 868686fb0..a563ca547 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -58,6 +58,10 @@ If you wish to rebase you should be following the [Golden Rule](https://www.atla For an overview of how to make design changes to Kiwix Android, check out [DESIGN.md](https://github.com/kiwix/kiwix-android/edit/develop/DESIGN.md). +### Adding new string resources + +To add a new string resource see [STRING_RESOURCES.md](https://github.com/kiwix/kiwix-android/edit/develop/STRING_RESOURCES.md). + ### Building The Kiwix app is split into 3 modules From fc5d44b3b1e2a344e94677401e7b103b1715d50a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frans-Lukas=20L=C3=B6venvald?= Date: Thu, 4 Jun 2020 14:04:20 +0200 Subject: [PATCH 08/78] #2111 Created STRING_RESOURCES.md --- STRING_RESOURCES.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 STRING_RESOURCES.md diff --git a/STRING_RESOURCES.md b/STRING_RESOURCES.md new file mode 100644 index 000000000..d6fead918 --- /dev/null +++ b/STRING_RESOURCES.md @@ -0,0 +1,20 @@ +# String resources +All user visible strings in an Android application should be listed in strings.xml files to allow for easy translation, replacement and modification. Newly added string resources are imported by translatewiki and are then manually translated. After translations are complete the translations are merged with Kiwix Android. + +## How do I add a new string resource? +Start by adding your new string resource `new_string` to `values/strings.xml` in English. That is: +``` +... +New String +... +``` +You will now have to describe the string in `values-qq/strings.xml` with where and how the new string is used. E.x. for the string `On`: + +`values-qq/strings.xml:` +``` +... +This is used in the settings screen to turn on the night mode. +... +``` +- The values in `values/strings.xml` are the strings that are going to be displayed in the Kiwix application to the user. +- The values in `values-qq/strings.xml` are only visible to the translator and are only there to help them make a correct translation. From a2fbbc650244e70f8705d8525066970219a949cb Mon Sep 17 00:00:00 2001 From: Sean Mac Gillicuddy Date: Wed, 17 Jun 2020 17:18:33 +0100 Subject: [PATCH 09/78] Bump version --- app/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 3a0f91671..fd339c4a7 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -11,7 +11,7 @@ apply(from = rootProject.file("jacoco.gradle")) ext { set("versionMajor", 3) set("versionMinor", 3) - set("versionPatch", 1) + set("versionPatch", 2) } fun generateVersionName() = "${ext["versionMajor"]}.${ext["versionMinor"]}.${ext["versionPatch"]}" From e8c68a7eb2532a6e13077548ce623f13b6fb38af Mon Sep 17 00:00:00 2001 From: s-ayush2903 Date: Fri, 19 Jun 2020 13:33:17 +0530 Subject: [PATCH 10/78] Extracted fileLogger to Utils --- .../org/kiwix/kiwixmobile/core/CoreApp.kt | 33 +------------------ .../kiwixmobile/core/main/AddNoteDialog.java | 4 ++- .../core/settings/CorePrefsFragment.java | 3 +- .../kiwixmobile/core/utils/files/FileUtils.kt | 31 +++++++++++++++++ 4 files changed, 37 insertions(+), 34 deletions(-) diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/CoreApp.kt b/core/src/main/java/org/kiwix/kiwixmobile/core/CoreApp.kt index 0ced8db4c..4f59d2878 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/CoreApp.kt +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/CoreApp.kt @@ -20,10 +20,8 @@ package org.kiwix.kiwixmobile.core import android.app.Application import android.content.Context import android.os.Build -import android.os.Environment import android.os.StrictMode import android.os.StrictMode.VmPolicy -import android.util.Log import androidx.appcompat.app.AppCompatDelegate import androidx.multidex.MultiDex import com.jakewharton.threetenabp.AndroidThreeTen @@ -31,8 +29,7 @@ import org.kiwix.kiwixmobile.core.data.local.KiwixDatabase import org.kiwix.kiwixmobile.core.di.components.CoreComponent import org.kiwix.kiwixmobile.core.di.components.DaggerCoreComponent import org.kiwix.kiwixmobile.core.downloader.DownloadMonitor -import java.io.File -import java.io.IOException +import org.kiwix.kiwixmobile.core.utils.files.FileUtils.writeLogFile import javax.inject.Inject abstract class CoreApp : Application() { @@ -127,32 +124,4 @@ abstract class CoreApp : Application() { ) } } - - private fun writeLogFile() { - if (isExternalStorageWritable) { - val appDirectory = - File(Environment.getExternalStorageDirectory().toString() + "/Kiwix") - val logFile = File(appDirectory, "logcat.txt") - Log.d("KIWIX", "Writing all logs into [" + logFile.path + "]") - // create app folder - if (!appDirectory.exists()) { - appDirectory.mkdir() - } - if (logFile.exists() && logFile.isFile) { - logFile.delete() - } - // clear the previous logcat and then write the new one to the file - try { - logFile.createNewFile() - Runtime.getRuntime().exec("logcat -c") - Runtime.getRuntime().exec("logcat -f " + logFile.path + " -s kiwix") - } catch (e: IOException) { - Log.e("KIWIX", "Error while writing logcat.txt", e) - } - } - } - - /* Checks if external storage is available for read and write */ - val isExternalStorageWritable: Boolean - get() = Environment.MEDIA_MOUNTED == Environment.getExternalStorageState() } diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/main/AddNoteDialog.java b/core/src/main/java/org/kiwix/kiwixmobile/core/main/AddNoteDialog.java index da2bc171e..d5f55a8c6 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/main/AddNoteDialog.java +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/main/AddNoteDialog.java @@ -61,6 +61,8 @@ import org.kiwix.kiwixmobile.core.utils.AlertDialogShower; import org.kiwix.kiwixmobile.core.utils.KiwixDialog; import org.kiwix.kiwixmobile.core.utils.SharedPreferenceUtil; +import static org.kiwix.kiwixmobile.core.utils.files.FileUtils.isExternalStorageWritable; + /** * Created by @author Aditya-Sood (21/05/19) as a part of GSoC 2019 * @@ -324,7 +326,7 @@ public class AddNoteDialog extends DialogFragment { * "{External Storage}/Kiwix/Notes/ZimFileTitle/ArticleTitle.txt" * */ - if (CoreApp.getInstance().isExternalStorageWritable()) { + if (isExternalStorageWritable()) { if (ContextCompat.checkSelfPermission(getContext(), Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) { diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/settings/CorePrefsFragment.java b/core/src/main/java/org/kiwix/kiwixmobile/core/settings/CorePrefsFragment.java index 2beb09112..2f3beb9a0 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/settings/CorePrefsFragment.java +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/settings/CorePrefsFragment.java @@ -54,6 +54,7 @@ import org.kiwix.kiwixmobile.core.utils.SharedPreferenceUtil; import static org.kiwix.kiwixmobile.core.utils.ConstantsKt.RESULT_RESTART; import static org.kiwix.kiwixmobile.core.utils.SharedPreferenceUtil.PREF_NIGHT_MODE; import static org.kiwix.kiwixmobile.core.utils.SharedPreferenceUtil.PREF_STORAGE; +import static org.kiwix.kiwixmobile.core.utils.files.FileUtils.isExternalStorageWritable; public abstract class CorePrefsFragment extends PreferenceFragmentCompat implements SettingsContract.View, @@ -217,7 +218,7 @@ public abstract class CorePrefsFragment extends PreferenceFragmentCompat impleme } private void clearAllNotes() { - if (CoreApp.getInstance().isExternalStorageWritable()) { + if (isExternalStorageWritable()) { if (ContextCompat.checkSelfPermission(getActivity(), Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) { diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/utils/files/FileUtils.kt b/core/src/main/java/org/kiwix/kiwixmobile/core/utils/files/FileUtils.kt index 315a4c6b9..f9fcc871b 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/utils/files/FileUtils.kt +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/utils/files/FileUtils.kt @@ -31,6 +31,7 @@ import org.kiwix.kiwixmobile.core.entity.LibraryNetworkEntity.Book import org.kiwix.kiwixmobile.core.extensions.get import java.io.File import java.io.IOException +import java.lang.Runtime.getRuntime import java.util.ArrayList object FileUtils { @@ -219,4 +220,34 @@ object FileUtils { File("$fileName.part").exists() -> "$fileName.part" else -> "${fileName}aa" } + + @JvmStatic fun writeLogFile() { + if (isExternalStorageWritable) { + val appDirectory = + File(Environment.getExternalStorageDirectory().toString() + "/Kiwix") + val logFile = File(appDirectory, "logcat.txt") + Log.d("KIWIX", "Writing all logs into [" + logFile.path + "]") + + // create a new app folder + if (!appDirectory.exists()) { + appDirectory.mkdir() + } + + if (logFile.exists() && logFile.isFile) { + logFile.delete() + } + // clear the previous logcat and then write the new one to the file + try { + logFile.createNewFile() + getRuntime().exec("logcat -c") + Runtime.getRuntime().exec("logcat -f " + logFile.path + " -s kiwix") + } catch (e: IOException) { + Log.e("KIWIX", "Error while writing logcat.txt", e) + } + } + } + + /* Checks if external storage is available for read and write */ + @JvmStatic val isExternalStorageWritable: Boolean + get() = Environment.MEDIA_MOUNTED == Environment.getExternalStorageState() } From e985bab6f6c6cca918f47861cc973027d965794c Mon Sep 17 00:00:00 2001 From: s-ayush2903 Date: Sat, 20 Jun 2020 01:48:16 +0530 Subject: [PATCH 11/78] Separated File-Logging Concern --- .../org/kiwix/kiwixmobile/core/CoreApp.kt | 6 +- .../kiwixmobile/core/main/AddNoteDialog.java | 6 +- .../core/settings/CorePrefsFragment.java | 5 +- .../core/utils/files/FileLogger.kt | 58 +++++++++++++++++++ .../kiwixmobile/core/utils/files/FileUtils.kt | 31 ---------- 5 files changed, 68 insertions(+), 38 deletions(-) create mode 100644 core/src/main/java/org/kiwix/kiwixmobile/core/utils/files/FileLogger.kt diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/CoreApp.kt b/core/src/main/java/org/kiwix/kiwixmobile/core/CoreApp.kt index 4f59d2878..d2e9a9549 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/CoreApp.kt +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/CoreApp.kt @@ -29,7 +29,7 @@ import org.kiwix.kiwixmobile.core.data.local.KiwixDatabase import org.kiwix.kiwixmobile.core.di.components.CoreComponent import org.kiwix.kiwixmobile.core.di.components.DaggerCoreComponent import org.kiwix.kiwixmobile.core.downloader.DownloadMonitor -import org.kiwix.kiwixmobile.core.utils.files.FileUtils.writeLogFile +import org.kiwix.kiwixmobile.core.utils.files.FileLogger import javax.inject.Inject abstract class CoreApp : Application() { @@ -61,6 +61,8 @@ abstract class CoreApp : Application() { @Inject internal lateinit var jniInitialiser: JNIInitialiser + private lateinit var fileLogger: FileLogger + override fun attachBaseContext(base: Context) { super.attachBaseContext(base) if (BuildConfig.DEBUG) { @@ -75,7 +77,7 @@ abstract class CoreApp : Application() { .context(this) .build() AndroidThreeTen.init(this) - writeLogFile() + fileLogger.writeLogFile() coreComponent.inject(this) kiwixDatabase.forceMigration() downloadMonitor.init() diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/main/AddNoteDialog.java b/core/src/main/java/org/kiwix/kiwixmobile/core/main/AddNoteDialog.java index d5f55a8c6..7e35d068b 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/main/AddNoteDialog.java +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/main/AddNoteDialog.java @@ -60,8 +60,7 @@ import org.kiwix.kiwixmobile.core.reader.ZimReaderContainer; import org.kiwix.kiwixmobile.core.utils.AlertDialogShower; import org.kiwix.kiwixmobile.core.utils.KiwixDialog; import org.kiwix.kiwixmobile.core.utils.SharedPreferenceUtil; - -import static org.kiwix.kiwixmobile.core.utils.files.FileUtils.isExternalStorageWritable; +import org.kiwix.kiwixmobile.core.utils.files.FileLogger; /** * Created by @author Aditya-Sood (21/05/19) as a part of GSoC 2019 @@ -100,6 +99,7 @@ public class AddNoteDialog extends DialogFragment { @Inject SharedPreferenceUtil sharedPreferenceUtil; @Inject ZimReaderContainer zimReaderContainer; @Inject protected AlertDialogShower alertDialogShower; + FileLogger fileLogger; @Override public void onCreate(@Nullable Bundle savedInstanceState) { @@ -326,7 +326,7 @@ public class AddNoteDialog extends DialogFragment { * "{External Storage}/Kiwix/Notes/ZimFileTitle/ArticleTitle.txt" * */ - if (isExternalStorageWritable()) { + if (fileLogger.isExternalStorageWritable()) { if (ContextCompat.checkSelfPermission(getContext(), Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) { diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/settings/CorePrefsFragment.java b/core/src/main/java/org/kiwix/kiwixmobile/core/settings/CorePrefsFragment.java index 2f3beb9a0..70bfbae09 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/settings/CorePrefsFragment.java +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/settings/CorePrefsFragment.java @@ -50,11 +50,11 @@ import org.kiwix.kiwixmobile.core.utils.DialogShower; import org.kiwix.kiwixmobile.core.utils.KiwixDialog; import org.kiwix.kiwixmobile.core.utils.LanguageUtils; import org.kiwix.kiwixmobile.core.utils.SharedPreferenceUtil; +import org.kiwix.kiwixmobile.core.utils.files.FileLogger; import static org.kiwix.kiwixmobile.core.utils.ConstantsKt.RESULT_RESTART; import static org.kiwix.kiwixmobile.core.utils.SharedPreferenceUtil.PREF_NIGHT_MODE; import static org.kiwix.kiwixmobile.core.utils.SharedPreferenceUtil.PREF_STORAGE; -import static org.kiwix.kiwixmobile.core.utils.files.FileUtils.isExternalStorageWritable; public abstract class CorePrefsFragment extends PreferenceFragmentCompat implements SettingsContract.View, @@ -77,6 +77,7 @@ public abstract class CorePrefsFragment extends PreferenceFragmentCompat impleme protected NightModeConfig nightModeConfig; @Inject protected DialogShower alertDialogShower; + FileLogger fileLogger; @Override public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { @@ -218,7 +219,7 @@ public abstract class CorePrefsFragment extends PreferenceFragmentCompat impleme } private void clearAllNotes() { - if (isExternalStorageWritable()) { + if (fileLogger.isExternalStorageWritable()) { if (ContextCompat.checkSelfPermission(getActivity(), Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) { diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/utils/files/FileLogger.kt b/core/src/main/java/org/kiwix/kiwixmobile/core/utils/files/FileLogger.kt new file mode 100644 index 000000000..fea89ab96 --- /dev/null +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/utils/files/FileLogger.kt @@ -0,0 +1,58 @@ +/* + * Kiwix Android + * Copyright (c) 2020 Kiwix + * 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 . + * + */ + +package org.kiwix.kiwixmobile.core.utils.files + +import android.os.Environment +import android.util.Log +import java.io.File +import java.io.IOException + +class FileLogger { + + fun writeLogFile() { + if (isExternalStorageWritable) { + val appDirectory = + File(Environment.getExternalStorageDirectory().toString() + "/Kiwix") + val logFile = File(appDirectory, "logcat.txt") + Log.d("KIWIX", "Writing all logs into [" + logFile.path + "]") + + // create a new app folder + if (!appDirectory.exists()) { + appDirectory.mkdir() + } + + if (logFile.exists() && logFile.isFile) { + logFile.delete() + } + // clear the previous logcat and then write the new one to the file + try { + logFile.createNewFile() + Runtime.getRuntime().exec("logcat -c") + Runtime.getRuntime().exec("logcat -f " + logFile.path + " -s kiwix") + } catch (e: IOException) { + Log.e("KIWIX", "Error while writing logcat.txt", e) + } + } + } + + /* Checks if external storage is available for read and write */ + val isExternalStorageWritable: Boolean + /** private modifier is temp */ + get() = Environment.MEDIA_MOUNTED == Environment.getExternalStorageState() +} diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/utils/files/FileUtils.kt b/core/src/main/java/org/kiwix/kiwixmobile/core/utils/files/FileUtils.kt index f9fcc871b..315a4c6b9 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/utils/files/FileUtils.kt +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/utils/files/FileUtils.kt @@ -31,7 +31,6 @@ import org.kiwix.kiwixmobile.core.entity.LibraryNetworkEntity.Book import org.kiwix.kiwixmobile.core.extensions.get import java.io.File import java.io.IOException -import java.lang.Runtime.getRuntime import java.util.ArrayList object FileUtils { @@ -220,34 +219,4 @@ object FileUtils { File("$fileName.part").exists() -> "$fileName.part" else -> "${fileName}aa" } - - @JvmStatic fun writeLogFile() { - if (isExternalStorageWritable) { - val appDirectory = - File(Environment.getExternalStorageDirectory().toString() + "/Kiwix") - val logFile = File(appDirectory, "logcat.txt") - Log.d("KIWIX", "Writing all logs into [" + logFile.path + "]") - - // create a new app folder - if (!appDirectory.exists()) { - appDirectory.mkdir() - } - - if (logFile.exists() && logFile.isFile) { - logFile.delete() - } - // clear the previous logcat and then write the new one to the file - try { - logFile.createNewFile() - getRuntime().exec("logcat -c") - Runtime.getRuntime().exec("logcat -f " + logFile.path + " -s kiwix") - } catch (e: IOException) { - Log.e("KIWIX", "Error while writing logcat.txt", e) - } - } - } - - /* Checks if external storage is available for read and write */ - @JvmStatic val isExternalStorageWritable: Boolean - get() = Environment.MEDIA_MOUNTED == Environment.getExternalStorageState() } From c7c28a43143b0c9af444b672e77a74ad60b81b5d Mon Sep 17 00:00:00 2001 From: s-ayush2903 Date: Sat, 20 Jun 2020 02:58:49 +0530 Subject: [PATCH 12/78] Injected in-file logging class --- .../main/java/org/kiwix/kiwixmobile/core/CoreApp.kt | 3 ++- .../kiwixmobile/core/di/components/CoreComponent.kt | 2 ++ .../core/di/modules/ApplicationModule.kt | 5 +++++ .../kiwix/kiwixmobile/core/main/AddNoteDialog.java | 2 +- .../core/settings/CorePrefsFragment.java | 2 +- .../kiwixmobile/core/utils/files/FileLogger.kt | 13 ++++++++----- 6 files changed, 19 insertions(+), 8 deletions(-) diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/CoreApp.kt b/core/src/main/java/org/kiwix/kiwixmobile/core/CoreApp.kt index d2e9a9549..a79ec7187 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/CoreApp.kt +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/CoreApp.kt @@ -61,7 +61,8 @@ abstract class CoreApp : Application() { @Inject internal lateinit var jniInitialiser: JNIInitialiser - private lateinit var fileLogger: FileLogger + @Inject + lateinit var fileLogger: FileLogger override fun attachBaseContext(base: Context) { super.attachBaseContext(base) diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/di/components/CoreComponent.kt b/core/src/main/java/org/kiwix/kiwixmobile/core/di/components/CoreComponent.kt index a9edd38ec..32b2422eb 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/di/components/CoreComponent.kt +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/di/components/CoreComponent.kt @@ -52,6 +52,7 @@ import org.kiwix.kiwixmobile.core.search.SearchActivity import org.kiwix.kiwixmobile.core.settings.CoreSettingsActivity import org.kiwix.kiwixmobile.core.utils.BookUtils import org.kiwix.kiwixmobile.core.utils.SharedPreferenceUtil +import org.kiwix.kiwixmobile.core.utils.files.FileLogger import javax.inject.Singleton @Singleton @@ -105,4 +106,5 @@ interface CoreComponent { fun inject(searchActivity: SearchActivity) fun inject(helpActivity: HelpActivity) fun inject(settingsActivity: CoreSettingsActivity) + fun inject(fileLogger: FileLogger) } diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/di/modules/ApplicationModule.kt b/core/src/main/java/org/kiwix/kiwixmobile/core/di/modules/ApplicationModule.kt index cf5460579..11b36a5c4 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/di/modules/ApplicationModule.kt +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/di/modules/ApplicationModule.kt @@ -36,6 +36,7 @@ import org.kiwix.kiwixmobile.core.downloader.DownloadMonitor import org.kiwix.kiwixmobile.core.downloader.fetch.FetchDownloadMonitor import org.kiwix.kiwixmobile.core.reader.ZimFileReader import org.kiwix.kiwixmobile.core.utils.BookUtils +import org.kiwix.kiwixmobile.core.utils.files.FileLogger import javax.inject.Singleton @Module( @@ -96,4 +97,8 @@ class ApplicationModule { @Singleton fun provideConnectivityManager(context: Context): ConnectivityManager = context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager + + @Provides + @Singleton + fun provideFileLogger(): FileLogger = FileLogger() } diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/main/AddNoteDialog.java b/core/src/main/java/org/kiwix/kiwixmobile/core/main/AddNoteDialog.java index 7e35d068b..f960be016 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/main/AddNoteDialog.java +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/main/AddNoteDialog.java @@ -99,7 +99,7 @@ public class AddNoteDialog extends DialogFragment { @Inject SharedPreferenceUtil sharedPreferenceUtil; @Inject ZimReaderContainer zimReaderContainer; @Inject protected AlertDialogShower alertDialogShower; - FileLogger fileLogger; + @Inject FileLogger fileLogger; @Override public void onCreate(@Nullable Bundle savedInstanceState) { diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/settings/CorePrefsFragment.java b/core/src/main/java/org/kiwix/kiwixmobile/core/settings/CorePrefsFragment.java index 70bfbae09..6414cb8ca 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/settings/CorePrefsFragment.java +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/settings/CorePrefsFragment.java @@ -77,7 +77,7 @@ public abstract class CorePrefsFragment extends PreferenceFragmentCompat impleme protected NightModeConfig nightModeConfig; @Inject protected DialogShower alertDialogShower; - FileLogger fileLogger; + @Inject FileLogger fileLogger; @Override public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/utils/files/FileLogger.kt b/core/src/main/java/org/kiwix/kiwixmobile/core/utils/files/FileLogger.kt index fea89ab96..91c9cf29a 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/utils/files/FileLogger.kt +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/utils/files/FileLogger.kt @@ -22,9 +22,17 @@ import android.os.Environment import android.util.Log import java.io.File import java.io.IOException +import javax.inject.Inject +import javax.inject.Singleton +@Singleton class FileLogger { + /* Checks if external storage is available for read and write */ + val isExternalStorageWritable: Boolean = + Environment.MEDIA_MOUNTED == Environment.getExternalStorageState() + + @Inject fun writeLogFile() { if (isExternalStorageWritable) { val appDirectory = @@ -50,9 +58,4 @@ class FileLogger { } } } - - /* Checks if external storage is available for read and write */ - val isExternalStorageWritable: Boolean - /** private modifier is temp */ - get() = Environment.MEDIA_MOUNTED == Environment.getExternalStorageState() } From d1359959d7af4add86452d88bf67f6e7183d0e5f Mon Sep 17 00:00:00 2001 From: s-ayush2903 Date: Sat, 20 Jun 2020 04:37:00 +0530 Subject: [PATCH 13/78] modified logging a bit --- .../kiwixmobile/core/utils/files/FileLogger.kt | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/utils/files/FileLogger.kt b/core/src/main/java/org/kiwix/kiwixmobile/core/utils/files/FileLogger.kt index 91c9cf29a..e6418fda4 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/utils/files/FileLogger.kt +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/utils/files/FileLogger.kt @@ -25,6 +25,9 @@ import java.io.IOException import javax.inject.Inject import javax.inject.Singleton +/** Authored by s-ayush2903 on 19 June 2020 + * + * A class for writing logs to the file in the device */ @Singleton class FileLogger { @@ -35,12 +38,14 @@ class FileLogger { @Inject fun writeLogFile() { if (isExternalStorageWritable) { + val appDirectory = File(Environment.getExternalStorageDirectory().toString() + "/Kiwix") - val logFile = File(appDirectory, "logcat.txt") + + val logFile = File(appDirectory, "logs" + System.currentTimeMillis() + ".txt") Log.d("KIWIX", "Writing all logs into [" + logFile.path + "]") - // create a new app folder + // create a new folder if (!appDirectory.exists()) { appDirectory.mkdir() } @@ -56,6 +61,12 @@ class FileLogger { } catch (e: IOException) { Log.e("KIWIX", "Error while writing logcat.txt", e) } + } else { + Log.e(TAG, "writeLogFile: No write access to the device's storage!") } } + + companion object { + private const val TAG: String = "FileLogger" + } } From 6aed270e99a71f17c5b1fe061b1733f7714fd57f Mon Sep 17 00:00:00 2001 From: s-ayush2903 Date: Mon, 22 Jun 2020 23:20:26 +0530 Subject: [PATCH 14/78] injected correctly --- .../kiwix/kiwixmobile/core/di/components/CoreComponent.kt | 2 -- .../kiwix/kiwixmobile/core/di/modules/ApplicationModule.kt | 5 ----- .../org/kiwix/kiwixmobile/core/utils/files/FileLogger.kt | 3 +-- 3 files changed, 1 insertion(+), 9 deletions(-) diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/di/components/CoreComponent.kt b/core/src/main/java/org/kiwix/kiwixmobile/core/di/components/CoreComponent.kt index 32b2422eb..a9edd38ec 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/di/components/CoreComponent.kt +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/di/components/CoreComponent.kt @@ -52,7 +52,6 @@ import org.kiwix.kiwixmobile.core.search.SearchActivity import org.kiwix.kiwixmobile.core.settings.CoreSettingsActivity import org.kiwix.kiwixmobile.core.utils.BookUtils import org.kiwix.kiwixmobile.core.utils.SharedPreferenceUtil -import org.kiwix.kiwixmobile.core.utils.files.FileLogger import javax.inject.Singleton @Singleton @@ -106,5 +105,4 @@ interface CoreComponent { fun inject(searchActivity: SearchActivity) fun inject(helpActivity: HelpActivity) fun inject(settingsActivity: CoreSettingsActivity) - fun inject(fileLogger: FileLogger) } diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/di/modules/ApplicationModule.kt b/core/src/main/java/org/kiwix/kiwixmobile/core/di/modules/ApplicationModule.kt index 11b36a5c4..cf5460579 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/di/modules/ApplicationModule.kt +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/di/modules/ApplicationModule.kt @@ -36,7 +36,6 @@ import org.kiwix.kiwixmobile.core.downloader.DownloadMonitor import org.kiwix.kiwixmobile.core.downloader.fetch.FetchDownloadMonitor import org.kiwix.kiwixmobile.core.reader.ZimFileReader import org.kiwix.kiwixmobile.core.utils.BookUtils -import org.kiwix.kiwixmobile.core.utils.files.FileLogger import javax.inject.Singleton @Module( @@ -97,8 +96,4 @@ class ApplicationModule { @Singleton fun provideConnectivityManager(context: Context): ConnectivityManager = context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager - - @Provides - @Singleton - fun provideFileLogger(): FileLogger = FileLogger() } diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/utils/files/FileLogger.kt b/core/src/main/java/org/kiwix/kiwixmobile/core/utils/files/FileLogger.kt index e6418fda4..5d9f41c7b 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/utils/files/FileLogger.kt +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/utils/files/FileLogger.kt @@ -29,13 +29,12 @@ import javax.inject.Singleton * * A class for writing logs to the file in the device */ @Singleton -class FileLogger { +class FileLogger @Inject constructor() { /* Checks if external storage is available for read and write */ val isExternalStorageWritable: Boolean = Environment.MEDIA_MOUNTED == Environment.getExternalStorageState() - @Inject fun writeLogFile() { if (isExternalStorageWritable) { From 18b969c7f90a3d1baea420fff54d1991672e6965 Mon Sep 17 00:00:00 2001 From: HissPirat Date: Tue, 23 Jun 2020 15:08:21 +0200 Subject: [PATCH 15/78] #2111 updated color names using "Name that color" tool --- app/src/main/res/layout/activity_intro.xml | 2 +- .../layout/activity_local_file_transfer.xml | 4 +- app/src/main/res/layout/activity_zim_host.xml | 2 +- .../core/main/CoreMainActivity.java | 4 +- .../res/drawable/search_widget_background.xml | 2 +- .../main/res/layout/activity_kiwix_error.xml | 18 ++++---- .../main/res/layout/kiwix_search_widget.xml | 2 +- core/src/main/res/values-night/color.xml | 16 ++++---- core/src/main/res/values/colors.xml | 41 ++++++++++--------- core/src/main/res/values/styles.xml | 4 +- 10 files changed, 49 insertions(+), 46 deletions(-) diff --git a/app/src/main/res/layout/activity_intro.xml b/app/src/main/res/layout/activity_intro.xml index f87159fa5..67d37b8d4 100644 --- a/app/src/main/res/layout/activity_intro.xml +++ b/app/src/main/res/layout/activity_intro.xml @@ -28,7 +28,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="@dimen/activity_vertical_margin" - app:ipi_currentPageIndicatorColor="@color/blue800" + app:ipi_currentPageIndicatorColor="@color/denim_blue800" app:ipi_pageIndicatorColor="@color/blueTransparent" app:layout_constraintBottom_toBottomOf="parent" /> diff --git a/app/src/main/res/layout/activity_local_file_transfer.xml b/app/src/main/res/layout/activity_local_file_transfer.xml index aaefafe4f..8ba06a1b9 100644 --- a/app/src/main/res/layout/activity_local_file_transfer.xml +++ b/app/src/main/res/layout/activity_local_file_transfer.xml @@ -52,7 +52,7 @@ android:layout_height="2dp" android:layout_marginStart="5dp" android:layout_marginEnd="5dp" - android:background="@color/accent" + android:background="@color/dodger_blue" app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toBottomOf="@id/text_view_device_name" /> @@ -113,7 +113,7 @@ android:layout_marginStart="5dp" android:layout_marginTop="200dp" android:layout_marginEnd="5dp" - android:background="@color/accent" + android:background="@color/dodger_blue" app:layout_constraintBottom_toTopOf="@+id/text_view_files_for_transfer" app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent" diff --git a/app/src/main/res/layout/activity_zim_host.xml b/app/src/main/res/layout/activity_zim_host.xml index 281d54d06..e5ef272f8 100644 --- a/app/src/main/res/layout/activity_zim_host.xml +++ b/app/src/main/res/layout/activity_zim_host.xml @@ -42,7 +42,7 @@ android:layout_marginBottom="8dp" android:background="@color/greenTick" android:text="@string/start_server_label" - android:textColor="@color/white" + android:textColor="@color/alabaster_white" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" /> diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/main/CoreMainActivity.java b/core/src/main/java/org/kiwix/kiwixmobile/core/main/CoreMainActivity.java index 3cc973206..aa02d1fbb 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/main/CoreMainActivity.java +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/main/CoreMainActivity.java @@ -1263,7 +1263,7 @@ public abstract class CoreMainActivity extends BaseActivity goToBookmarks(); return Unit.INSTANCE; }, - getResources().getColor(R.color.white) + getResources().getColor(R.color.alabaster_white) ); } else { ContextExtensionsKt.toast(this, R.string.unable_to_add_to_bookmarks, Toast.LENGTH_SHORT); @@ -1718,7 +1718,7 @@ public abstract class CoreMainActivity extends BaseActivity .setAction(getString(R.string.open), v -> { if (webViewList.size() > 1) selectTab(webViewList.size() - 1); }) - .setActionTextColor(getResources().getColor(R.color.white)) + .setActionTextColor(getResources().getColor(R.color.alabaster_white)) .show(); } else { newTab(url); diff --git a/core/src/main/res/drawable/search_widget_background.xml b/core/src/main/res/drawable/search_widget_background.xml index f7bb732aa..39428a2c4 100644 --- a/core/src/main/res/drawable/search_widget_background.xml +++ b/core/src/main/res/drawable/search_widget_background.xml @@ -1,6 +1,6 @@ - + + android:textColor="@color/alabaster_white" /> + android:textColor="@color/alabaster_white" /> + android:textColor="@color/alabaster_white" /> + android:textColor="@color/alabaster_white" /> + android:textColor="@color/alabaster_white" /> + android:textColor="@color/alabaster_white" /> diff --git a/core/src/main/res/layout/kiwix_search_widget.xml b/core/src/main/res/layout/kiwix_search_widget.xml index 332de33a5..666440178 100644 --- a/core/src/main/res/layout/kiwix_search_widget.xml +++ b/core/src/main/res/layout/kiwix_search_widget.xml @@ -23,7 +23,7 @@ android:layout_height="wrap_content" android:layout_weight="0.7" android:text="@string/search_widget_text" - android:textColor="@color/gray" /> + android:textColor="@color/scorpion_gray" /> - @color/blue400 + @color/denim_blue400 - @color/gray900 + @color/mine_shaft_gray900 @color/pink300 - @color/white - @color/white - @color/white + @color/alabaster_white + @color/alabaster_white + @color/alabaster_white - @color/gray350 - @color/gray500 - @color/gray850 + @color/mine_shaft_gray350 + @color/mine_shaft_gray500 + @color/mine_shaft_gray850 diff --git a/core/src/main/res/values/colors.xml b/core/src/main/res/values/colors.xml index 5b57d8896..13b17e112 100644 --- a/core/src/main/res/values/colors.xml +++ b/core/src/main/res/values/colors.xml @@ -1,32 +1,35 @@ #000000 + #ffffff - #2196F3 - #fafafa - #5a5a5a - #212121 - #42a5f5 - #1565c0 + #2196F3 + #fafafa + #5a5a5a + #42a5f5 + #1565c0 #f06292 - #4285F4 - #FFD6D6D6 - #9E9E9E - #616161 - #303030 - @color/white - @color/gray700 - @color/gray500 + #4285F4 + #FFD6D6D6 + #9E9E9E + #212121 + #616161 + #303030 + #b00020 + @color/alabaster_white + @color/mine_shaft_gray700 + @color/mine_shaft_gray500 - @color/blue800 + @color/denim_blue800 + @color/cornflower_blue - @color/white - #b00020 + @color/alabaster_white + @color/monza_red - #ffffff + @color/white @color/black - @color/white + @color/alabaster_white diff --git a/core/src/main/res/values/styles.xml b/core/src/main/res/values/styles.xml index 580cd7a15..f317a2aaf 100644 --- a/core/src/main/res/values/styles.xml +++ b/core/src/main/res/values/styles.xml @@ -34,7 +34,7 @@ From 51b02a3985d73527519e26131da2cd100cbf35d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frans-Lukas=20L=C3=B6venvald?= Date: Tue, 23 Jun 2020 15:13:53 +0200 Subject: [PATCH 16/78] Update DESIGN.md with new color names. --- DESIGN.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/DESIGN.md b/DESIGN.md index 2969a00fa..51cc23511 100644 --- a/DESIGN.md +++ b/DESIGN.md @@ -9,9 +9,9 @@ This file intends to provide links to design resources, display the Kiwix colors The Kiwix colors are black and white with different colored accents. For Kiwix Android, black is accented by different shades of blue: - ![#000000](https://via.placeholder.com/15/000000/000000?text=+) `#000000`/`black` -- ![#1565c0](https://via.placeholder.com/15/1565c0/000000?text=+) `#1565c0`/`color_primary` -- ![#2196F3](https://via.placeholder.com/15/2196F3/000000?text=+) `#2196F3`/`accent` -- ![#42a5f5](https://via.placeholder.com/15/42a5f5/000000?text=+) `#42a5f5`/`blue400` +- ![#1565c0](https://via.placeholder.com/15/1565c0/000000?text=+) `#1565c0`/`denim_blue800` +- ![#42a5f5](https://via.placeholder.com/15/42a5f5/000000?text=+) `#42a5f5`/`denim_blue400` +- ![#2196F3](https://via.placeholder.com/15/2196F3/000000?text=+) `#2196F3`/`dodger_blue` > Color indicates which elements are interactive, how they relate to other elements, and their level of prominence. Important elements should stand out the most [1]. From 678ee2dc27bd44302f62dfe20f041dc53da89a09 Mon Sep 17 00:00:00 2001 From: HissPirat Date: Tue, 23 Jun 2020 16:06:09 +0200 Subject: [PATCH 17/78] #2111 updated night theme to use correct colors instead of relying on night color changes --- core/src/main/res/values-night/color.xml | 3 +-- core/src/main/res/values-night/themes.xml | 7 +++++++ core/src/main/res/values/colors.xml | 5 ++--- core/src/main/res/values/themes.xml | 4 ++-- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/core/src/main/res/values-night/color.xml b/core/src/main/res/values-night/color.xml index c2c24d5c8..7d1036b16 100644 --- a/core/src/main/res/values-night/color.xml +++ b/core/src/main/res/values-night/color.xml @@ -5,10 +5,9 @@ - @color/denim_blue400 @color/mine_shaft_gray900 - @color/pink300 + @color/froly_pink300 @color/alabaster_white @color/alabaster_white diff --git a/core/src/main/res/values-night/themes.xml b/core/src/main/res/values-night/themes.xml index 31d077d1e..29f4229e1 100644 --- a/core/src/main/res/values-night/themes.xml +++ b/core/src/main/res/values-night/themes.xml @@ -4,6 +4,13 @@ diff --git a/core/src/main/res/values/colors.xml b/core/src/main/res/values/colors.xml index 13b17e112..45fe94750 100644 --- a/core/src/main/res/values/colors.xml +++ b/core/src/main/res/values/colors.xml @@ -8,7 +8,7 @@ #5a5a5a #42a5f5 #1565c0 - #f06292 + #f06292 #4285F4 #FFD6D6D6 #9E9E9E @@ -22,10 +22,9 @@ - @color/denim_blue800 @color/cornflower_blue - @color/alabaster_white + @color/monza_red @color/white diff --git a/core/src/main/res/values/themes.xml b/core/src/main/res/values/themes.xml index 9aa52cb15..981144984 100644 --- a/core/src/main/res/values/themes.xml +++ b/core/src/main/res/values/themes.xml @@ -11,7 +11,7 @@ - @color/color_primary + @color/denim_blue800 ?colorPrimary ?colorPrimary ?colorPrimary @@ -23,7 +23,7 @@ - @color/color_surface + @color/alabaster_white ?colorSurface @color/color_error From 11012722a233d7d23d6cd913a7b9b4206d41ae9b Mon Sep 17 00:00:00 2001 From: s-ayush2903 Date: Wed, 24 Jun 2020 02:08:14 +0530 Subject: [PATCH 18/78] Implemented logging class in ErrorActivity --- .../java/org/kiwix/kiwixmobile/core/CoreApp.kt | 1 + .../kiwixmobile/core/error/ErrorActivity.java | 16 ++++++++-------- .../kiwixmobile/core/utils/files/FileLogger.kt | 16 ++++++---------- 3 files changed, 15 insertions(+), 18 deletions(-) diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/CoreApp.kt b/core/src/main/java/org/kiwix/kiwixmobile/core/CoreApp.kt index a79ec7187..8d032bb32 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/CoreApp.kt +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/CoreApp.kt @@ -74,6 +74,7 @@ abstract class CoreApp : Application() { override fun onCreate() { super.onCreate() instance = this + fileLogger = FileLogger() coreComponent = DaggerCoreComponent.builder() .context(this) .build() diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/error/ErrorActivity.java b/core/src/main/java/org/kiwix/kiwixmobile/core/error/ErrorActivity.java index ab78f4529..01ca54c1a 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/error/ErrorActivity.java +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/error/ErrorActivity.java @@ -23,7 +23,6 @@ import android.content.pm.PackageManager; import android.net.Uri; import android.os.Build; import android.os.Bundle; -import android.os.Environment; import android.widget.Button; import android.widget.CheckBox; import androidx.core.content.ContextCompat; @@ -42,6 +41,7 @@ import org.kiwix.kiwixmobile.core.dao.NewBookDao; import org.kiwix.kiwixmobile.core.di.components.CoreComponent; import org.kiwix.kiwixmobile.core.entity.LibraryNetworkEntity; import org.kiwix.kiwixmobile.core.reader.ZimReaderContainer; +import org.kiwix.kiwixmobile.core.utils.files.FileLogger; import org.kiwix.kiwixmobile.core.zim_manager.fileselect_view.adapter.BooksOnDiskListItem.BookOnDisk; import org.kiwix.kiwixmobile.zim_manager.MountInfo; import org.kiwix.kiwixmobile.zim_manager.MountPointProducer; @@ -58,6 +58,8 @@ public class ErrorActivity extends BaseActivity { ZimReaderContainer zimReaderContainer; @Inject MountPointProducer mountPointProducer; + @Inject + FileLogger fileLogger; @BindView(R2.id.reportButton) Button reportButton; @@ -92,6 +94,7 @@ public class ErrorActivity extends BaseActivity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_kiwix_error); + fileLogger = new FileLogger(); Intent callingIntent = getIntent(); Bundle extras = callingIntent.getExtras(); @@ -112,13 +115,10 @@ public class ErrorActivity extends BaseActivity { String body = getBody(); if (allowLogsCheckbox.isChecked()) { - File appDirectory = new File(Environment.getExternalStorageDirectory() + "/Kiwix"); - File logFile = new File(appDirectory, "logcat.txt"); - if (logFile.exists()) { - Uri path = - FileProvider.getUriForFile(this, - getApplicationContext().getPackageName() + ".fileprovider", - logFile); + File file = fileLogger.writeLogFile(); + if (file != null) { + Uri path = FileProvider.getUriForFile(this, + getApplicationContext().getPackageName() + ".fileProvider", file); emailIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); emailIntent.putExtra(Intent.EXTRA_STREAM, path); } diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/utils/files/FileLogger.kt b/core/src/main/java/org/kiwix/kiwixmobile/core/utils/files/FileLogger.kt index 5d9f41c7b..492f6209c 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/utils/files/FileLogger.kt +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/utils/files/FileLogger.kt @@ -35,21 +35,18 @@ class FileLogger @Inject constructor() { val isExternalStorageWritable: Boolean = Environment.MEDIA_MOUNTED == Environment.getExternalStorageState() - fun writeLogFile() { + fun writeLogFile(): File { + val appDirectory = File(Environment.getExternalStorageDirectory().toString() + "/Kiwix") + val logFile = File(appDirectory, "logs" + System.currentTimeMillis() + ".txt") if (isExternalStorageWritable) { - - val appDirectory = - File(Environment.getExternalStorageDirectory().toString() + "/Kiwix") - - val logFile = File(appDirectory, "logs" + System.currentTimeMillis() + ".txt") Log.d("KIWIX", "Writing all logs into [" + logFile.path + "]") - // create a new folder if (!appDirectory.exists()) { + Log.d(TAG, "writeLogFile: Creating new logFile@ $logFile") appDirectory.mkdir() } - if (logFile.exists() && logFile.isFile) { + Log.d(TAG, "writeLogFile: Deleting preExistingFile") logFile.delete() } // clear the previous logcat and then write the new one to the file @@ -60,9 +57,8 @@ class FileLogger @Inject constructor() { } catch (e: IOException) { Log.e("KIWIX", "Error while writing logcat.txt", e) } - } else { - Log.e(TAG, "writeLogFile: No write access to the device's storage!") } + return logFile } companion object { From d71cd7bb4aacfe6882cf9e449839264eae9ac3ae Mon Sep 17 00:00:00 2001 From: HissPirat Date: Wed, 24 Jun 2020 14:22:56 +0200 Subject: [PATCH 19/78] #2111 removed more redundant colors --- core/src/main/res/values-night/color.xml | 7 ------- core/src/main/res/values-night/themes.xml | 6 +++++- core/src/main/res/values/colors.xml | 5 ----- core/src/main/res/values/themes.xml | 8 ++++---- 4 files changed, 9 insertions(+), 17 deletions(-) diff --git a/core/src/main/res/values-night/color.xml b/core/src/main/res/values-night/color.xml index 7d1036b16..5d9c88d55 100644 --- a/core/src/main/res/values-night/color.xml +++ b/core/src/main/res/values-night/color.xml @@ -4,14 +4,7 @@ - - @color/mine_shaft_gray900 - @color/froly_pink300 - - @color/alabaster_white - @color/alabaster_white - @color/alabaster_white @color/mine_shaft_gray350 @color/mine_shaft_gray500 diff --git a/core/src/main/res/values-night/themes.xml b/core/src/main/res/values-night/themes.xml index 29f4229e1..10059ce3f 100644 --- a/core/src/main/res/values-night/themes.xml +++ b/core/src/main/res/values-night/themes.xml @@ -8,9 +8,13 @@ @color/mine_shaft_gray900 @color/froly_pink300 + @color/alabaster_white @color/alabaster_white - @color/alabaster_white + + + @color/black diff --git a/core/src/main/res/values/colors.xml b/core/src/main/res/values/colors.xml index 45fe94750..14ff648de 100644 --- a/core/src/main/res/values/colors.xml +++ b/core/src/main/res/values/colors.xml @@ -25,10 +25,5 @@ @color/cornflower_blue @color/alabaster_white - @color/monza_red - - @color/white - @color/black - @color/alabaster_white diff --git a/core/src/main/res/values/themes.xml b/core/src/main/res/values/themes.xml index 981144984..858214501 100644 --- a/core/src/main/res/values/themes.xml +++ b/core/src/main/res/values/themes.xml @@ -25,15 +25,15 @@ @color/alabaster_white ?colorSurface - @color/color_error + @color/monza_red - @color/color_on_primary + @color/white ?colorOnPrimary - @color/color_on_surface + @color/black ?colorOnSurface - @color/color_on_error + @color/alabaster_white @style/TextAppearance.KiwixTheme.Headline1 From b4d2ca535a7d9e5df31726badc0a84fe99475a95 Mon Sep 17 00:00:00 2001 From: HissPirat Date: Wed, 24 Jun 2020 15:21:48 +0200 Subject: [PATCH 20/78] #2111 made launch_screen use correct colors for night/day mode --- .../org/kiwix/kiwixmobile/main/KiwixMainActivity.kt | 2 +- core/src/main/res/drawable-night/launch_screen.xml | 11 +++++++++++ core/src/main/res/drawable/launch_screen.xml | 2 +- core/src/main/res/values-night/color.xml | 1 - core/src/main/res/values/colors.xml | 1 - 5 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 core/src/main/res/drawable-night/launch_screen.xml diff --git a/app/src/main/java/org/kiwix/kiwixmobile/main/KiwixMainActivity.kt b/app/src/main/java/org/kiwix/kiwixmobile/main/KiwixMainActivity.kt index 1efe858e3..c20d6ffdf 100644 --- a/app/src/main/java/org/kiwix/kiwixmobile/main/KiwixMainActivity.kt +++ b/app/src/main/java/org/kiwix/kiwixmobile/main/KiwixMainActivity.kt @@ -33,8 +33,8 @@ import org.kiwix.kiwixmobile.core.main.CoreMainActivity import org.kiwix.kiwixmobile.core.main.WebViewCallback import org.kiwix.kiwixmobile.core.reader.ZimFileReader import org.kiwix.kiwixmobile.core.reader.ZimReaderContainer -import org.kiwix.kiwixmobile.core.utils.SharedPreferenceUtil.PREF_KIWIX_MOBILE import org.kiwix.kiwixmobile.core.utils.EXTRA_ZIM_FILE +import org.kiwix.kiwixmobile.core.utils.SharedPreferenceUtil.PREF_KIWIX_MOBILE import org.kiwix.kiwixmobile.core.utils.TAG_CURRENT_ARTICLES import org.kiwix.kiwixmobile.core.utils.TAG_CURRENT_FILE import org.kiwix.kiwixmobile.core.utils.TAG_CURRENT_POSITIONS diff --git a/core/src/main/res/drawable-night/launch_screen.xml b/core/src/main/res/drawable-night/launch_screen.xml new file mode 100644 index 000000000..e9df7bff5 --- /dev/null +++ b/core/src/main/res/drawable-night/launch_screen.xml @@ -0,0 +1,11 @@ + + + + + + + + diff --git a/core/src/main/res/drawable/launch_screen.xml b/core/src/main/res/drawable/launch_screen.xml index ae7b61922..6021eeb72 100644 --- a/core/src/main/res/drawable/launch_screen.xml +++ b/core/src/main/res/drawable/launch_screen.xml @@ -2,7 +2,7 @@ - + - @color/mine_shaft_gray900 @color/mine_shaft_gray350 @color/mine_shaft_gray500 diff --git a/core/src/main/res/values/colors.xml b/core/src/main/res/values/colors.xml index 14ff648de..370f1acb0 100644 --- a/core/src/main/res/values/colors.xml +++ b/core/src/main/res/values/colors.xml @@ -23,7 +23,6 @@ @color/cornflower_blue - @color/alabaster_white From 00e41f39aaf04568742016331916abfba94c4ed4 Mon Sep 17 00:00:00 2001 From: s-ayush2903 Date: Wed, 24 Jun 2020 19:20:05 +0530 Subject: [PATCH 21/78] Saved log Report to private storage --- .../org/kiwix/kiwixmobile/core/CoreApp.kt | 2 +- .../kiwixmobile/core/error/ErrorActivity.java | 12 +++--- .../core/utils/files/FileLogger.kt | 40 +++++++++---------- 3 files changed, 24 insertions(+), 30 deletions(-) diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/CoreApp.kt b/core/src/main/java/org/kiwix/kiwixmobile/core/CoreApp.kt index 8d032bb32..eb023627e 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/CoreApp.kt +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/CoreApp.kt @@ -79,7 +79,7 @@ abstract class CoreApp : Application() { .context(this) .build() AndroidThreeTen.init(this) - fileLogger.writeLogFile() + fileLogger.writeLogFile(this) coreComponent.inject(this) kiwixDatabase.forceMigration() downloadMonitor.init() diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/error/ErrorActivity.java b/core/src/main/java/org/kiwix/kiwixmobile/core/error/ErrorActivity.java index 01ca54c1a..4f4253f62 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/error/ErrorActivity.java +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/error/ErrorActivity.java @@ -115,13 +115,11 @@ public class ErrorActivity extends BaseActivity { String body = getBody(); if (allowLogsCheckbox.isChecked()) { - File file = fileLogger.writeLogFile(); - if (file != null) { - Uri path = FileProvider.getUriForFile(this, - getApplicationContext().getPackageName() + ".fileProvider", file); - emailIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); - emailIntent.putExtra(Intent.EXTRA_STREAM, path); - } + File file = fileLogger.writeLogFile(this); + Uri path = FileProvider.getUriForFile(this, + getApplicationContext().getPackageName() + ".fileProvider", file); + emailIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); + emailIntent.putExtra(Intent.EXTRA_STREAM, path); } if (allowCrashCheckbox.isChecked() && exception != null) { diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/utils/files/FileLogger.kt b/core/src/main/java/org/kiwix/kiwixmobile/core/utils/files/FileLogger.kt index 492f6209c..6a21c2f66 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/utils/files/FileLogger.kt +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/utils/files/FileLogger.kt @@ -18,10 +18,12 @@ package org.kiwix.kiwixmobile.core.utils.files +import android.content.Context import android.os.Environment import android.util.Log import java.io.File import java.io.IOException +import java.lang.System.currentTimeMillis import javax.inject.Inject import javax.inject.Singleton @@ -35,33 +37,27 @@ class FileLogger @Inject constructor() { val isExternalStorageWritable: Boolean = Environment.MEDIA_MOUNTED == Environment.getExternalStorageState() - fun writeLogFile(): File { - val appDirectory = File(Environment.getExternalStorageDirectory().toString() + "/Kiwix") - val logFile = File(appDirectory, "logs" + System.currentTimeMillis() + ".txt") - if (isExternalStorageWritable) { - Log.d("KIWIX", "Writing all logs into [" + logFile.path + "]") - // create a new folder - if (!appDirectory.exists()) { - Log.d(TAG, "writeLogFile: Creating new logFile@ $logFile") - appDirectory.mkdir() - } - if (logFile.exists() && logFile.isFile) { - Log.d(TAG, "writeLogFile: Deleting preExistingFile") - logFile.delete() - } - // clear the previous logcat and then write the new one to the file - try { - logFile.createNewFile() - Runtime.getRuntime().exec("logcat -c") - Runtime.getRuntime().exec("logcat -f " + logFile.path + " -s kiwix") - } catch (e: IOException) { - Log.e("KIWIX", "Error while writing logcat.txt", e) - } + fun writeLogFile(context: Context): File { + val logFile = File(context.filesDir, fileName) + Log.d("KIWIX", "Writing all logs into [" + logFile.path + "]") + if (logFile.exists() && logFile.isFile) { + Log.d(TAG, "writeLogFile: Deleting preExistingFile") + logFile.delete() + } + // clear the previous logcat and then write the new one to the file + try { + logFile.createNewFile() + Runtime.getRuntime().exec("logcat -c") + Runtime.getRuntime().exec("logcat -f $logFile -s kiwix") + Log.d(TAG, "writeLogFile: Log report written Successfully!") + } catch (e: IOException) { + Log.e("KIWIX", "Error while writing logcat.txt", e) } return logFile } companion object { private const val TAG: String = "FileLogger" + private val fileName = "logs" + currentTimeMillis() + ".txt" } } From 0d78704956e5838029354bf8541ae80a05880acf Mon Sep 17 00:00:00 2001 From: HissPirat Date: Thu, 25 Jun 2020 09:33:36 +0200 Subject: [PATCH 22/78] #2111 replaced bad color names with attributes --- app/src/main/res/layout/item_download.xml | 6 +++--- app/src/main/res/layout/item_library.xml | 14 ++++++------ core/src/main/res/layout/item_book.xml | 8 +++---- core/src/main/res/layout/item_help.xml | 2 +- core/src/main/res/values-night/color.xml | 11 ---------- core/src/main/res/values-night/themes.xml | 3 +++ core/src/main/res/values/attrs.xml | 3 +++ core/src/main/res/values/colors.xml | 26 +++++++---------------- core/src/main/res/values/styles.xml | 2 +- core/src/main/res/values/themes.xml | 6 +++++- 10 files changed, 35 insertions(+), 46 deletions(-) delete mode 100644 core/src/main/res/values-night/color.xml diff --git a/app/src/main/res/layout/item_download.xml b/app/src/main/res/layout/item_download.xml index fcdacaa39..acb99fccf 100644 --- a/app/src/main/res/layout/item_download.xml +++ b/app/src/main/res/layout/item_download.xml @@ -48,7 +48,7 @@ style="@style/list_item_body" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:textColor="@color/text_secondary" + android:textColor="?textSecondary" android:layout_gravity="start" tools:text="Description" /> @@ -71,7 +71,7 @@ style="@style/list_item_body" android:layout_width="0dp" android:layout_height="wrap_content" - android:textColor="@color/text_tertiary" + android:textColor="?textTertiary" android:layout_weight="1" tools:text="In Progress" /> @@ -80,7 +80,7 @@ style="@style/list_item_body" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:textColor="@color/text_tertiary" + android:textColor="?textTertiary" tools:text="1min 10secs" /> diff --git a/app/src/main/res/layout/item_library.xml b/app/src/main/res/layout/item_library.xml index dce98c6a7..c2a1c09d3 100644 --- a/app/src/main/res/layout/item_library.xml +++ b/app/src/main/res/layout/item_library.xml @@ -47,7 +47,7 @@ android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginEnd="@dimen/activity_horizontal_margin" - android:textColor="@color/text_secondary" + android:textColor="?textSecondary" android:maxLines="2" android:ellipsize="end" app:layout_constraintEnd_toEndOf="parent" @@ -60,7 +60,7 @@ style="@style/list_item_body" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:textColor="@color/text_tertiary" + android:textColor="?textTertiary" app:layout_constraintStart_toStartOf="@+id/libraryBookTitle" app:layout_constraintTop_toBottomOf="@+id/libraryBookDescription" tools:text="File Size" /> @@ -70,7 +70,7 @@ style="@style/list_item_body" android:layout_width="0dp" android:layout_height="wrap_content" - android:textColor="@color/text_tertiary" + android:textColor="?textTertiary" android:gravity="start" android:layout_marginRight="10dp" android:layout_marginEnd="10dp" @@ -84,7 +84,7 @@ style="@style/list_item_body" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:textColor="@color/text_tertiary" + android:textColor="?textTertiary" app:layout_constraintStart_toStartOf="@+id/libraryBookCreator" app:layout_constraintTop_toBottomOf="@+id/libraryBookCreator" tools:text="Publisher" /> @@ -95,7 +95,7 @@ style="@style/list_item_body" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:textColor="@color/text_tertiary" + android:textColor="?textTertiary" android:layout_marginEnd="@dimen/activity_horizontal_margin" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="@+id/libraryBookSize" @@ -106,7 +106,7 @@ style="@style/list_item_body" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:textColor="@color/text_tertiary" + android:textColor="?textTertiary" android:layout_marginStart="50dp" app:layout_constraintEnd_toEndOf="@+id/libraryBookDate" app:layout_constraintTop_toBottomOf="@+id/libraryBookDate" @@ -117,7 +117,7 @@ style="@style/list_item_body" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:textColor="@color/text_tertiary" + android:textColor="?textTertiary" app:layout_constraintEnd_toEndOf="@+id/libraryBookLanguage" app:layout_constraintTop_toBottomOf="@+id/libraryBookLanguage" tools:text="File Name" /> diff --git a/core/src/main/res/layout/item_book.xml b/core/src/main/res/layout/item_book.xml index 21034e92d..975616f41 100644 --- a/core/src/main/res/layout/item_book.xml +++ b/core/src/main/res/layout/item_book.xml @@ -65,7 +65,7 @@ android:layout_marginEnd="8dp" android:ellipsize="end" android:maxLines="2" - android:textColor="@color/text_secondary" + android:textColor="?textSecondary" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="@id/item_book_title" app:layout_constraintTop_toBottomOf="@id/item_book_title" @@ -76,7 +76,7 @@ style="@style/list_item_body" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:textColor="@color/text_tertiary" + android:textColor="?textTertiary" app:layout_constraintStart_toStartOf="@id/item_book_title" app:layout_constraintTop_toBottomOf="@id/item_book_description" tools:text="1 Jan 2018" /> @@ -88,7 +88,7 @@ android:layout_height="wrap_content" android:layout_marginStart="@dimen/activity_horizontal_margin" android:layout_marginEnd="@dimen/activity_horizontal_margin" - android:textColor="@color/text_tertiary" + android:textColor="?textTertiary" app:layout_constraintStart_toEndOf="@id/item_book_date" app:layout_constraintTop_toTopOf="@id/item_book_date" tools:text="20 GB" /> @@ -100,7 +100,7 @@ android:layout_height="wrap_content" android:layout_marginStart="@dimen/activity_horizontal_margin" android:layout_marginEnd="@dimen/activity_horizontal_margin" - android:textColor="@color/text_tertiary" + android:textColor="?textTertiary" app:layout_constraintStart_toEndOf="@id/item_book_size" app:layout_constraintTop_toTopOf="@id/item_book_size" tools:text="10.1 K articles" /> diff --git a/core/src/main/res/layout/item_help.xml b/core/src/main/res/layout/item_help.xml index 223aa5400..12cc0e52b 100644 --- a/core/src/main/res/layout/item_help.xml +++ b/core/src/main/res/layout/item_help.xml @@ -33,8 +33,8 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingTop="@dimen/activity_vertical_margin" + android:textColor="?textSecondary" android:visibility="gone" - android:textColor="@color/text_secondary" app:layout_constraintTop_toBottomOf="@id/item_help_title" tools:text="@string/help_3" tools:visibility="visible" /> diff --git a/core/src/main/res/values-night/color.xml b/core/src/main/res/values-night/color.xml deleted file mode 100644 index 9e88115c7..000000000 --- a/core/src/main/res/values-night/color.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - @color/mine_shaft_gray350 - @color/mine_shaft_gray500 - @color/mine_shaft_gray850 - diff --git a/core/src/main/res/values-night/themes.xml b/core/src/main/res/values-night/themes.xml index 10059ce3f..0b372e941 100644 --- a/core/src/main/res/values-night/themes.xml +++ b/core/src/main/res/values-night/themes.xml @@ -7,6 +7,9 @@ @color/denim_blue400 @color/mine_shaft_gray900 @color/froly_pink300 + @color/mine_shaft_gray350 + @color/mine_shaft_gray500 + @color/mine_shaft_gray850 @color/alabaster_white diff --git a/core/src/main/res/values/attrs.xml b/core/src/main/res/values/attrs.xml index 21b933f1e..2d8f75c76 100644 --- a/core/src/main/res/values/attrs.xml +++ b/core/src/main/res/values/attrs.xml @@ -4,5 +4,8 @@ + + + diff --git a/core/src/main/res/values/colors.xml b/core/src/main/res/values/colors.xml index 370f1acb0..1f2437afb 100644 --- a/core/src/main/res/values/colors.xml +++ b/core/src/main/res/values/colors.xml @@ -1,28 +1,18 @@ - #000000 #ffffff - - #2196F3 #fafafa - #5a5a5a - #42a5f5 - #1565c0 - #f06292 - #4285F4 #FFD6D6D6 #9E9E9E - #212121 + #5a5a5a #616161 #303030 + #212121 + #000000 + #42a5f5 + #2196F3 + #4285F4 + #1565c0 + #f06292 #b00020 - @color/alabaster_white - @color/mine_shaft_gray700 - @color/mine_shaft_gray500 - - - - @color/cornflower_blue - - diff --git a/core/src/main/res/values/styles.xml b/core/src/main/res/values/styles.xml index f317a2aaf..28c9b95f6 100644 --- a/core/src/main/res/values/styles.xml +++ b/core/src/main/res/values/styles.xml @@ -57,7 +57,7 @@ - diff --git a/core/src/main/res/values/themes.xml b/core/src/main/res/values/themes.xml index f3ce2b6c8..02af0ca32 100644 --- a/core/src/main/res/values/themes.xml +++ b/core/src/main/res/values/themes.xml @@ -2,16 +2,35 @@ - + + +