浏览代码

Fixed lint warnings

Vadik Sirekanyan 6 年之前
父节点
当前提交
7f1e4b210d

+ 1 - 0
app/build.gradle.kts

@@ -51,6 +51,7 @@ dependencies {
     implementation("com.squareup.retrofit2:converter-gson:2.6.2")
 
     // okhttp
+    @Suppress("GradleDependency")
     implementation("com.squareup.okhttp3:logging-interceptor:3.12.6") // use 3.12.x if minSdkVersion < 21
 
     // etc

+ 3 - 0
app/src/main/java/com/sirekanyan/knigopis/common/extensions/String.kt

@@ -1,12 +1,15 @@
 package com.sirekanyan.knigopis.common.extensions
 
 import android.net.Uri
+import java.util.*
 import kotlin.random.Random
 
 val RANDOM_ID = Array(16) { Random.nextInt(0, 16).toString(16) }.joinToString("")
 
 private val HTTP_SCHEMES = setOf("http", "https")
 
+val String.lowercase get() = toLowerCase(Locale.getDefault())
+
 fun String.orDefault(default: String) = if (isEmpty()) default else this
 
 fun String.toUriOrNull() =

+ 2 - 1
app/src/main/java/com/sirekanyan/knigopis/common/functions/StringFactory.kt

@@ -2,6 +2,7 @@ package com.sirekanyan.knigopis.common.functions
 
 import com.sirekanyan.knigopis.BuildConfig.APPLICATION_ID
 import com.sirekanyan.knigopis.STATIC_API
+import com.sirekanyan.knigopis.common.extensions.lowercase
 
 fun extra(name: String) = "$APPLICATION_ID.extra_$name"
 
@@ -10,7 +11,7 @@ fun createUserImageUrl(userId: String): String {
 }
 
 fun createBookImageUrl(bookTitle: String): String {
-    val normalizedTitle = bookTitle.toLowerCase()
+    val normalizedTitle = bookTitle.lowercase
         .replace(Regex("\\W+"), "_")
         .replace(Regex("(^_|_$)"), "")
         .replace("ё", "е")

+ 3 - 1
app/src/main/java/com/sirekanyan/knigopis/repository/cache/CacheKey.kt

@@ -1,9 +1,11 @@
 package com.sirekanyan.knigopis.repository.cache
 
+import com.sirekanyan.knigopis.common.extensions.lowercase
+
 enum class CacheKey {
 
     BOOKS, USERS, NOTES;
 
-    val storeValue get() = name.toLowerCase()
+    val storeValue get() = name.lowercase
 
 }

+ 1 - 1
app/src/main/res/drawable/ic_about_developer.xml

@@ -1,5 +1,5 @@
 <vector android:alpha="0.30" android:height="24dp"
     android:viewportHeight="24.0" android:viewportWidth="24.0"
     android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
-    <path android:fillColor="#FF000000" android:pathData="M19.43,12.98c0.04,-0.32 0.07,-0.64 0.07,-0.98s-0.03,-0.66 -0.07,-0.98l2.11,-1.65c0.19,-0.15 0.24,-0.42 0.12,-0.64l-2,-3.46c-0.12,-0.22 -0.39,-0.3 -0.61,-0.22l-2.49,1c-0.52,-0.4 -1.08,-0.73 -1.69,-0.98l-0.38,-2.65C14.46,2.18 14.25,2 14,2h-4c-0.25,0 -0.46,0.18 -0.49,0.42l-0.38,2.65c-0.61,0.25 -1.17,0.59 -1.69,0.98l-2.49,-1c-0.23,-0.09 -0.49,0 -0.61,0.22l-2,3.46c-0.13,0.22 -0.07,0.49 0.12,0.64l2.11,1.65c-0.04,0.32 -0.07,0.65 -0.07,0.98s0.03,0.66 0.07,0.98l-2.11,1.65c-0.19,0.15 -0.24,0.42 -0.12,0.64l2,3.46c0.12,0.22 0.39,0.3 0.61,0.22l2.49,-1c0.52,0.4 1.08,0.73 1.69,0.98l0.38,2.65c0.03,0.24 0.24,0.42 0.49,0.42h4c0.25,0 0.46,-0.18 0.49,-0.42l0.38,-2.65c0.61,-0.25 1.17,-0.59 1.69,-0.98l2.49,1c0.23,0.09 0.49,0 0.61,-0.22l2,-3.46c0.12,-0.22 0.07,-0.49 -0.12,-0.64l-2.11,-1.65zM12,15.5c-1.93,0 -3.5,-1.57 -3.5,-3.5s1.57,-3.5 3.5,-3.5 3.5,1.57 3.5,3.5 -1.57,3.5 -3.5,3.5z"/>
+    <path android:fillColor="#FF000000" android:pathData="M19.1,12.9a2.8,2.8 0,0 0,0.1 -0.9,2.8 2.8,0 0,0 -0.1,-0.9l2.1,-1.6a0.7,0.7 0,0 0,0.1 -0.6L19.4,5.5a0.7,0.7 0,0 0,-0.6 -0.2l-2.4,1a6.5,6.5 0,0 0,-1.6 -0.9l-0.4,-2.6a0.5,0.5 0,0 0,-0.5 -0.4H10.1a0.5,0.5 0,0 0,-0.5 0.4L9.3,5.4a5.6,5.6 0,0 0,-1.7 0.9l-2.4,-1a0.4,0.4 0,0 0,-0.5 0.2l-2,3.4c-0.1,0.2 0,0.4 0.2,0.6l2,1.6a2.8,2.8 0,0 0,-0.1 0.9,2.8 2.8,0 0,0 0.1,0.9L2.8,14.5a0.7,0.7 0,0 0,-0.1 0.6l1.9,3.4a0.7,0.7 0,0 0,0.6 0.2l2.4,-1a6.5,6.5 0,0 0,1.6 0.9l0.4,2.6a0.5,0.5 0,0 0,0.5 0.4h3.8a0.5,0.5 0,0 0,0.5 -0.4l0.3,-2.6a5.6,5.6 0,0 0,1.7 -0.9l2.4,1a0.4,0.4 0,0 0,0.5 -0.2l2,-3.4c0.1,-0.2 0,-0.4 -0.2,-0.6ZM12,15.6A3.6,3.6 0,1 1,15.6 12,3.6 3.6,0 0,1 12,15.6Z"/>
 </vector>

文件差异内容过多而无法显示
+ 1 - 0
app/src/main/res/drawable/ic_login_in.xml


+ 3 - 1
app/src/main/res/drawable/ic_login_mr.xml

@@ -1,9 +1,11 @@
 <vector xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
     android:width="24dp"
     android:height="24dp"
     android:viewportWidth="32"
     android:viewportHeight="32">
     <path
         android:fillColor="#FF9E00"
-        android:pathData="M20.813,16A4.818,4.818 0,0 1,16 20.813,4.818 4.818,0 0,1 11.187,16 4.818,4.818 0,0 1,16 11.187,4.818 4.818,0 0,1 20.813,16M16,0C7.178,0 0,7.178 0,16c0,8.822 7.178,16 16,16 3.232,0 6.349,-0.962 9.013,-2.783l0.046,-0.032 -2.156,-2.506 -0.036,0.024A12.672,12.672 0,0 1,16 28.72C8.986,28.72 3.28,23.014 3.28,16 3.28,8.986 8.986,3.28 16,3.28c7.014,0 12.72,5.706 12.72,12.72 0,0.909 -0.101,1.829 -0.3,2.734 -0.402,1.651 -1.558,2.157 -2.426,2.09C25.121,20.753 24.1,20.131 24.093,18.609V16c0,-4.463 -3.63,-8.093 -8.093,-8.093 -4.463,0 -8.093,3.63 -8.093,8.093 0,4.463 3.63,8.093 8.093,8.093a8.03,8.03 0,0 0,5.734 -2.389,5.198 5.198,0 0,0 3.997,2.389 5.399,5.399 0,0 0,3.678 -1.078c0.959,-0.728 1.675,-1.781 2.071,-3.046 0.063,-0.204 0.179,-0.672 0.18,-0.675l0.003,-0.017C31.896,18.262 32,17.25 32,16 32,7.178 24.822,0 16,0" />
+        android:pathData="M20.813,16A4.818,4.818 0,0 1,16 20.813,4.818 4.818,0 0,1 11.187,16 4.818,4.818 0,0 1,16 11.187,4.818 4.818,0 0,1 20.813,16M16,0C7.178,0 0,7.178 0,16c0,8.822 7.178,16 16,16 3.232,0 6.349,-0.962 9.013,-2.783l0.046,-0.032 -2.156,-2.506 -0.036,0.024A12.672,12.672 0,0 1,16 28.72C8.986,28.72 3.28,23.014 3.28,16 3.28,8.986 8.986,3.28 16,3.28c7.014,0 12.72,5.706 12.72,12.72 0,0.909 -0.101,1.829 -0.3,2.734 -0.402,1.651 -1.558,2.157 -2.426,2.09C25.121,20.753 24.1,20.131 24.093,18.609V16c0,-4.463 -3.63,-8.093 -8.093,-8.093 -4.463,0 -8.093,3.63 -8.093,8.093 0,4.463 3.63,8.093 8.093,8.093a8.03,8.03 0,0 0,5.734 -2.389,5.198 5.198,0 0,0 3.997,2.389 5.399,5.399 0,0 0,3.678 -1.078c0.959,-0.728 1.675,-1.781 2.071,-3.046 0.063,-0.204 0.179,-0.672 0.18,-0.675l0.003,-0.017C31.896,18.262 32,17.25 32,16 32,7.178 24.822,0 16,0"
+        tools:ignore="VectorPath" />
 </vector>

+ 2 - 1
app/src/main/res/layout/books_page.xml

@@ -4,7 +4,8 @@
     xmlns:tools="http://schemas.android.com/tools"
     android:id="@+id/booksPage"
     android:layout_width="match_parent"
-    android:layout_height="match_parent">
+    android:layout_height="match_parent"
+    tools:ignore="MergeRootFrame">
 
     <androidx.recyclerview.widget.RecyclerView
         android:id="@+id/booksRecyclerView"

+ 2 - 1
app/src/main/res/layout/header.xml

@@ -3,7 +3,8 @@
     xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"
     android:layout_height="48dp"
-    android:background="?android:attr/windowBackground">
+    android:background="?android:attr/windowBackground"
+    tools:ignore="Overdraw">
 
     <View
         android:id="@+id/headerDivider"

+ 2 - 1
app/src/main/res/layout/notes_page.xml

@@ -4,7 +4,8 @@
     xmlns:tools="http://schemas.android.com/tools"
     android:id="@+id/notesPage"
     android:layout_width="match_parent"
-    android:layout_height="match_parent">
+    android:layout_height="match_parent"
+    tools:ignore="MergeRootFrame">
 
     <androidx.recyclerview.widget.RecyclerView
         android:id="@+id/notesRecyclerView"

+ 2 - 1
app/src/main/res/layout/user.xml

@@ -5,7 +5,8 @@
     android:layout_height="56dp"
     android:background="?android:attr/selectableItemBackground"
     android:paddingLeft="16dp"
-    android:paddingRight="16dp">
+    android:paddingRight="16dp"
+    tools:ignore="Overdraw">
 
     <ImageView
         android:id="@+id/userImage"

+ 2 - 1
app/src/main/res/layout/users_page.xml

@@ -4,7 +4,8 @@
     xmlns:tools="http://schemas.android.com/tools"
     android:id="@+id/usersPage"
     android:layout_width="match_parent"
-    android:layout_height="match_parent">
+    android:layout_height="match_parent"
+    tools:ignore="MergeRootFrame">
 
     <androidx.recyclerview.widget.RecyclerView
         android:id="@+id/usersRecyclerView"

+ 2 - 1
app/src/main/res/layout/website_layout.xml

@@ -5,7 +5,8 @@
     android:layout_height="56dp"
     android:background="?android:attr/selectableItemBackground"
     android:clickable="true"
-    android:focusable="true">
+    android:focusable="true"
+    tools:ignore="Overdraw">
 
     <ImageView
         android:id="@+id/websiteLogo"

部分文件因为文件数量过多而无法显示