Skip to content
This repository has been archived by the owner on Aug 2, 2024. It is now read-only.

Fix several project lint report warnings #498

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ android {
kotlinOptions {
jvmTarget = "1.8"
}
lintOptions {
disable 'GoogleAppIndexingWarning'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't prefer to ignore GoogleAppIndexingWarning, the purpose of sunflower project is a demo for different Android features of jetpack or androidX, the GoogleAppIndexingWarning can be one part of them.

Let the warning there is OK.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My intension was to force warnings as errors by warningsAsErrors attribute, with that all changes has verify by CI on PR forcing to failure if was introduces new lint warnings (forcing contributors to check them). That was the only reason for why I added the disable 'GoogleAppIndexWarning'.

If you consider that isn't necessary I remove that also. Please confirm me, for make these changes on PR

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @tiembo

disable 'IconLauncherShape'
warningsAsErrors true
}
}

dependencies {
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

<application
android:allowBackup="true"
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ class PlantDetailFragment : Fragment() {
getString(R.string.share_text_plant, plant.name)
}
}
val shareIntent = ShareCompat.IntentBuilder.from(activity)
ShareCompat.IntentBuilder.from(requireActivity())
.setText(shareText)
.setType("text/plain")
.createChooserIntent()
Expand All @@ -136,8 +136,7 @@ class PlantDetailFragment : Fragment() {
// Else, we will use the old CLEAR_WHEN_TASK_RESET flag
addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET)
}
}
startActivity(shareIntent)
}.also { startActivity(it) }
}

// FloatingActionButtons anchored to AppBarLayouts have their visibility controlled by the scroll position.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ import android.graphics.Canvas
import android.util.AttributeSet
import com.google.android.material.R
import com.google.android.material.card.MaterialCardView
import com.google.android.material.shape.ShapeAppearanceModel
import com.google.android.material.shape.ShapeAppearancePathProvider
import android.annotation.SuppressLint
import android.graphics.Path
import android.graphics.RectF
import com.google.android.material.shape.ShapeAppearanceModel

/**
* A Card view that clips the content of any shape, this should be done upstream in card,
Expand All @@ -39,8 +39,9 @@ class MaskedCardView @JvmOverloads constructor(
@SuppressLint("RestrictedApi")
private val pathProvider = ShapeAppearancePathProvider()
private val path: Path = Path()
private val shapeAppearance: ShapeAppearanceModel =
ShapeAppearanceModel(context, attrs, defStyle, R.style.Widget_MaterialComponents_CardView)
private val shapeAppearance: ShapeAppearanceModel = ShapeAppearanceModel
.builder(context, attrs, defStyle, R.style.Widget_MaterialComponents_CardView)
.build()
private val rectF = RectF(0f, 0f, 0f, 0f)

override fun onDraw(canvas: Canvas) {
Expand Down
129 changes: 0 additions & 129 deletions app/src/main/res/drawable/ic_launcher_background.xml

This file was deleted.

3 changes: 2 additions & 1 deletion app/src/main/res/layout/fragment_plant_detail.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
android:stateListAnimator="@animator/show_toolbar"
android:background="?attr/colorSurface"
android:animateLayoutChanges="true">
android:animateLayoutChanges="true"
tools:targetApi="lollipop">

<com.google.android.material.appbar.CollapsingToolbarLayout
android:id="@+id/toolbar_layout"
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
<string name="plant_detail_image_content_description">Bild der Pflanze</string>
<string name="my_garden_title">Mein Garten</string>
<string name="plant_list_title">Pflanzenliste</string>
<string name="available">Verfügbare Pflanzen</string>
<string name="plant_details_title">Details zur Pflanze</string>
<string name="add_plant">Pflanze hinzufügen</string>
<string name="added_plant_to_garden">Pflanze wurde zum Garten hinzugefügt</string>
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/values-fr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
<string name="my_garden_title">Mon jardin</string>
<string name="plant_detail_image_content_description">Image de plante</string>
<string name="plant_list_title">Liste des plantes</string>
<string name="available">(translate me) Available Plants</string>
<string name="plant_details_title">Détails sur la plante</string>
<string name="add_plant">(translate me) Add plant</string>
<string name="added_plant_to_garden">Plante ajoutée à votre jardin</string>
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/values-it/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
<string name="plant_detail_image_content_description">Immagine della pianta</string>
<string name="my_garden_title">Il mio giardino</string>
<string name="plant_list_title">Lista delle piante</string>
<string name="available">(translate me) Available Plants</string>
<string name="plant_details_title">Dettagli della pianta</string>
<string name="menu_item_share_plant">Condividi</string>
<string name="plant_date_header">(translate me) Planted</string>
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/values-ja/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
<string name="plant_detail_image_content_description">植物のイメージ</string>
<string name="my_garden_title">私の庭</string>
<string name="plant_list_title">植物のリスト</string>
<string name="available">(translate me) Available Plants</string>
<string name="plant_details_title">植物の詳細</string>
<string name="add_plant">(translate me) Add plant</string>
<string name="added_plant_to_garden">植物が庭に追加されました</string>
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/values-tr-rTR/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
<string name="plant_detail_image_content_description">Bitkinin görüntüsü</string>
<string name="my_garden_title">Bahçem</string>
<string name="plant_list_title">Bitki listesi</string>
<string name="available">(translate me) Available Plants</string>
<string name="plant_details_title">Bitki detayları</string>
<string name="add_plant">(translate me) Add plant</string>
<string name="added_plant_to_garden">Bitki bahçeye eklendi</string>
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
<string name="plant_detail_image_content_description">植物图片</string>
<string name="my_garden_title">我的花园</string>
<string name="plant_list_title">植物目录</string>
<string name="available">植物品种</string>
<string name="plant_details_title">植物介绍</string>
<string name="add_plant">添加植物</string>
<string name="added_plant_to_garden">添加了新植物</string>
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/values-zh-rTW/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
<string name="plant_detail_image_content_description">植物圖片</string>
<string name="my_garden_title">我的花園</string>
<string name="plant_list_title">植物目錄</string>
<string name="available">植物品種</string>
<string name="plant_details_title">植物介紹</string>
<string name="add_plant">添加植物</string>
<string name="added_plant_to_garden">添加了新植物</string>
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/values/dimens.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@

<dimen name="margin_normal">16dp</dimen>
<dimen name="margin_small">8dp</dimen>
<dimen name="margin_extra_small">4dp</dimen>

<dimen name="plant_item_image_height">95dp</dimen>

Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
<string name="plant_detail_image_content_description" translation_description="Content description for the header / hero image that is show at the top of the plant detail screen.">Image of plant</string>
<string name="my_garden_title" translation_description="Title for the 'My garden' screen where the user can see the list of plants that have been added to their garden.">My garden</string>
<string name="plant_list_title" translation_description="Title for the plant list screen where the user can see a list of plants available to add to their garden.">Plant list</string>
<string name="available" translation_description="Text for the header of the plant list page indicating the available plants for users to choose from.">Available Plants</string>
<string name="plant_details_title" translation_description="Title for the plant details screen where the user can see the details for a specific plant.">Plant details</string>
<string name="add_plant" translation_description="Button text that prompts user to navigate to the Plant List to add plants to their empty garden.">Add plant</string>
<string name="added_plant_to_garden" translation_description="Confirmation text that is shown when a user adds a plant to their empty garden.">Added plant to garden</string>
Expand Down
20 changes: 10 additions & 10 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,30 +23,30 @@ buildscript {
targetSdkVersion = 28

// App dependencies
appCompatVersion = '1.1.0-beta01'
constraintLayoutVersion = '2.0.0-beta1'
appCompatVersion = '1.1.0'
constraintLayoutVersion = '2.0.0-beta2'
coreTestingVersion = '2.0.0'
coroutinesVersion = "1.3.0-M2"
espressoVersion = '3.1.1'
fragmentVersion = '1.1.0-alpha09'
fragmentVersion = '1.2.0-alpha03'
glideVersion = '4.9.0'
gradleVersion = '3.5.0'
gsonVersion = '2.8.2'
junitVersion = '4.12'
kotlinVersion = '1.3.41'
ktlintVersion = '0.33.0'
ktxVersion = '1.0.2'
lifecycleVersion = '2.2.0-alpha01'
materialVersion = '1.1.0-alpha09'
navigationVersion = '2.0.0'
recyclerViewVersion = '1.1.0-alpha05'
ktxVersion = '1.2.0-alpha04'
lifecycleVersion = '2.2.0-alpha04'
materialVersion = '1.1.0-alpha10'
navigationVersion = '2.1.0'
recyclerViewVersion = '1.1.0-beta04'
roomVersion = '2.1.0'
runnerVersion = '1.0.1'
truthVersion = '0.42'
testExtJunit = '1.1.0'
uiAutomatorVersion = '2.2.0'
viewPagerVersion = '1.0.0-beta03'
workVersion = '2.1.0'
viewPagerVersion = '1.0.0-beta04'
workVersion = '2.2.0'
}

repositories {
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
#Thu Aug 22 10:20:57 PDT 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists