Skip to content
This repository has been archived by the owner on Oct 3, 2022. It is now read-only.

Commit

Permalink
- Optimizations
Browse files Browse the repository at this point in the history
  • Loading branch information
doomsdayrs committed Jan 2, 2020
1 parent ed1827d commit 3f2bfad
Show file tree
Hide file tree
Showing 17 changed files with 7 additions and 66 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -333,15 +333,6 @@ object Utilities {
return if (activeNetwork != null) activeNetwork.type == ConnectivityManager.TYPE_WIFI || activeNetwork.type == ConnectivityManager.TYPE_MOBILE else false
}//TODO: Check this also, this doesn't seem to be a nice way to do things.

/**
* Is reader in night mode
*
* @return true if so, otherwise false
*/
val isReaderNightMode: Boolean
get() =//TODO: Check this also, this doesn't seem to be a nice way to do things.
Settings.ReaderTextColor == Color.WHITE


fun setNightNode() {
setReaderColor(Color.WHITE, Color.BLACK)
Expand Down Expand Up @@ -387,17 +378,6 @@ object Utilities {
}
}

/**
* Swaps the reader colors
*/
fun swapReaderColor() {
if (isReaderNightMode) {
setReaderColor(Color.BLACK, Color.WHITE)
} else {
setReaderColor(Color.WHITE, Color.BLACK)
}
}

/**
* Toggles bookmark
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -706,6 +706,7 @@ public static String getSavedNovelPassage(int chapterID) {
* @param chapterURL chapter url
* @return if present
*/
@SuppressWarnings("BooleanMethodIsAlwaysInverted")
public static boolean isNotInChapters(@NonNull String chapterURL) {
Cursor cursor = sqLiteDatabase.rawQuery("SELECT " + Columns.IS_SAVED + " from " + Tables.CHAPTERS + " where " + Columns.ID + " =" + DatabaseIdentification.getChapterIDFromChapterURL(chapterURL), null);
int a = cursor.getCount();
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ class CatalogueSearchQuery(private val catalogueFragment: CatalogueFragment) : S
catalogueFragment.isQuery = true
val recycleCards = ArrayList(catalogueFragment.catalogueNovelCards)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
recycleCards.removeIf { recycleCard: CatalogueNovelCard? -> !recycleCard!!.title.toLowerCase().contains(newText.toLowerCase()) }
recycleCards.removeIf { recycleCard: CatalogueNovelCard? -> !recycleCard!!.title.toLowerCase(Locale.ROOT).contains(newText.toLowerCase(Locale.ROOT)) }
} else {
for (x in recycleCards.indices.reversed()) {
if (!recycleCards[x]!!.title.toLowerCase().contains(newText.toLowerCase())) {
if (!recycleCards[x]!!.title.toLowerCase(Locale.ROOT).contains(newText.toLowerCase(Locale.ROOT))) {
recycleCards.removeAt(x)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,11 @@ import android.view.ViewGroup
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentPagerAdapter
import com.github.doomsdayrs.api.shosetsu.services.core.dep.Formatter
import com.github.doomsdayrs.api.shosetsu.services.core.objects.Novel
import com.github.doomsdayrs.api.shosetsu.services.core.objects.NovelChapter
import com.github.doomsdayrs.api.shosetsu.services.core.objects.NovelPage
import com.github.doomsdayrs.apps.shosetsu.R
import com.github.doomsdayrs.apps.shosetsu.backend.Utilities
import com.github.doomsdayrs.apps.shosetsu.backend.database.Database
import com.github.doomsdayrs.apps.shosetsu.backend.database.Database.DatabaseChapter
import com.github.doomsdayrs.apps.shosetsu.backend.database.Database.DatabaseChapter.getChapter
import com.github.doomsdayrs.apps.shosetsu.backend.database.Database.DatabaseChapter.getStatus
import com.github.doomsdayrs.apps.shosetsu.backend.database.Database.DatabaseIdentification.getChapterIDFromChapterURL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import android.view.*
import android.widget.SearchView
import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.LinearLayoutManager
import com.github.doomsdayrs.api.shosetsu.services.core.objects.Novel
import com.github.doomsdayrs.apps.shosetsu.R
import com.github.doomsdayrs.apps.shosetsu.R.layout.search_activity
import com.github.doomsdayrs.apps.shosetsu.backend.Utilities.setActivityTitle
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.github.doomsdayrs.api.shosetsu.services.core.dep.Formatter
import com.github.doomsdayrs.api.shosetsu.services.core.objects.Novel
import com.github.doomsdayrs.apps.shosetsu.R
import com.github.doomsdayrs.apps.shosetsu.backend.database.Database
import com.github.doomsdayrs.apps.shosetsu.ui.main.MainActivity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class SearchViewHolder(itemView: View, val searchFragment: SearchFragment) : Rec
if (!searchFragment.containsData(id)) {
val intArray: ArrayList<Int> = getIntLibrary()
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
intArray.removeIf { novelID: Int? -> !DatabaseNovels.getNovelTitle(novelID!!).toLowerCase().contains(query.toLowerCase(Locale.ROOT)) }
intArray.removeIf { novelID: Int? -> !DatabaseNovels.getNovelTitle(novelID!!).toLowerCase(Locale.ROOT).contains(query.toLowerCase(Locale.ROOT)) }
} else {
for (x in intArray.indices.reversed()) if (!DatabaseNovels.getNovelTitle(intArray[x]).toLowerCase(Locale.ROOT).contains(query.toLowerCase(Locale.ROOT))) intArray.removeAt(x)
}
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/layout/fragment_catalogue.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@

<TextView
android:visibility="gone"
android:id="@+id/fragment_catalogue_empty"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/no_results_found"
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/layout/updated_novel_card.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="2dp">
Expand Down Expand Up @@ -82,7 +81,8 @@
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
app:layout_constraintStart_toStartOf="parent"
android:contentDescription="@string/todo" />

</androidx.constraintlayout.widget.ConstraintLayout>

Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 0 additions & 2 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@
<string name="novel_title">Novel Title:</string>
<string name="novel_author">Novel Author(s):</string>
<string name="novel_description">Novel Description</string>
<string name="anilist">Anilist</string>
<string name="download">Download</string>
<string name="myanimelist">Myanimelist</string>
<string name="download_directory">Download directory</string>
<string name="position">Position:</string>
<string name="backup_now">Backup Now</string>
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ buildscript {

}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.0-alpha06'
classpath 'com.android.tools.build:gradle:4.0.0-alpha07'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down

0 comments on commit 3f2bfad

Please sign in to comment.