diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 794be99..f16fe63 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -30,8 +30,10 @@ jobs: path: ~/.gradle/caches key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} restore-keys: ${{ runner.os }}-gradle + - name: Make gradlew executable + run: chmod +x ./gradlew - name: Build and analyze env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - run: ./gradlew build sonarqube --info \ No newline at end of file + run: ./gradlew build sonar --info \ No newline at end of file diff --git a/README.md b/README.md index 4e91502..2bf5415 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ # Memory-Game Memory Game for Android. The game consists of some cards which are randomly arranged. The user has to flip the cards to get the correct pairs. +[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=subbramanil_Memory-Game&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=subbramanil_Memory-Game) + ## Screenshots ### Home diff --git a/app/build.gradle b/app/build.gradle index 08cc377..b040dd4 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,13 +1,12 @@ apply plugin: 'com.android.application' apply plugin: 'kotlin-android' -apply plugin: 'kotlin-android-extensions' apply plugin: 'org.sonarqube' android { compileSdkVersion 33 defaultConfig { applicationId "com.android.nikhil.memorygame" - minSdkVersion 15 + minSdkVersion 23 targetSdkVersion 33 versionCode 1 versionName "1.0" @@ -19,6 +18,10 @@ android { proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } + buildFeatures { + viewBinding = true + } + namespace 'com.android.nikhil.memorygame' } @@ -28,18 +31,10 @@ dependencies { implementation 'androidx.constraintlayout:constraintlayout:2.1.4' implementation 'androidx.recyclerview:recyclerview:1.2.1' implementation 'androidx.cardview:cardview:1.0.0' - implementation "com.wajahatkarim3.EasyFlipView:EasyFlipView:$easy_flip_view" + implementation 'com.wajahatkarim:EasyFlipView:3.0.3' testImplementation 'junit:junit:4.13.2' androidTestImplementation 'androidx.test.ext:junit:1.1.5' androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' //noinspection GradleDependency implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" } - -sonarqube { - properties { - property "sonar.projectKey", "subbramanil_Memory-Game" - property "sonar.organization", "subbramanil" - property "sonar.host.url", "https://sonarcloud.io" - } -} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 39c5851..a45c157 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -3,15 +3,19 @@ xmlns:tools="http://schemas.android.com/tools"> + tools:ignore="GoogleAppIndexingWarning" + android:fullBackupContent="false" + android:dataExtractionRules="@xml/data_extraction_rules"> - + diff --git a/app/src/main/java/com/android/nikhil/memorygame/CardAdapter.kt b/app/src/main/java/com/android/nikhil/memorygame/CardAdapter.kt index 0f57344..ad567fd 100644 --- a/app/src/main/java/com/android/nikhil/memorygame/CardAdapter.kt +++ b/app/src/main/java/com/android/nikhil/memorygame/CardAdapter.kt @@ -1,19 +1,18 @@ package com.android.nikhil.memorygame +import android.annotation.SuppressLint import android.content.Context -import androidx.recyclerview.widget.RecyclerView +import android.os.Handler import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.widget.ImageView import android.widget.RelativeLayout import android.widget.TextView -import android.os.Handler +import androidx.recyclerview.widget.RecyclerView import com.android.nikhil.memorygame.R.string +import com.android.nikhil.memorygame.databinding.CardItemBinding import com.wajahatkarim3.easyflipview.EasyFlipView -import kotlinx.android.synthetic.main.card_front.view.cardViewTextView - -import java.util.ArrayList /** * Created by NIKHIL on 08-01-2018. @@ -38,12 +37,12 @@ class CardAdapter( parent: ViewGroup, viewType: Int ): CardViewHolder { - return CardViewHolder(LayoutInflater.from(context).inflate(R.layout.card_item, parent, false)) + return CardViewHolder(CardItemBinding.inflate(LayoutInflater.from(context)).root) } override fun onBindViewHolder( - holder: CardViewHolder, - position: Int + holder: CardViewHolder, + @SuppressLint("RecyclerView") position: Int ) { cardList[position].flipView = holder.flipView holder.textView.text = context.getString(string.question_mark) @@ -107,7 +106,7 @@ class CardAdapter( } inner class CardViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { - val textView = itemView.cardViewTextView as TextView + val textView = itemView.findViewById(R.id.cardViewTextView) as TextView val rootLayout = itemView.findViewById(R.id.cardViewRootLayout) as RelativeLayout val flipView = itemView.findViewById(R.id.flipView) as EasyFlipView val cardImageView = itemView.findViewById(R.id.cardImageView) as ImageView diff --git a/app/src/main/java/com/android/nikhil/memorygame/GameDialog.kt b/app/src/main/java/com/android/nikhil/memorygame/GameDialog.kt index fb6914a..df9c117 100644 --- a/app/src/main/java/com/android/nikhil/memorygame/GameDialog.kt +++ b/app/src/main/java/com/android/nikhil/memorygame/GameDialog.kt @@ -6,7 +6,7 @@ import android.content.DialogInterface import android.graphics.Color import android.graphics.drawable.ColorDrawable import android.os.Bundle -import kotlinx.android.synthetic.main.dialog_game.view.* +import com.android.nikhil.memorygame.databinding.DialogGameBinding class GameDialog : DialogFragment() { @@ -35,9 +35,10 @@ class GameDialog : DialogFragment() { @Deprecated("Deprecated in Java") override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { - val view = activity.layoutInflater.inflate(R.layout.dialog_game, null) + val binding = DialogGameBinding.inflate(activity.layoutInflater) + val view = binding.root val message = arguments.getString("message") - message?.let { view.message.text = it } + message?.let { binding.message.text = it } val dialog = super.onCreateDialog(savedInstanceState) dialog.setContentView(view) dialog.window?.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT)) diff --git a/app/src/main/res/xml/data_extraction_rules.xml b/app/src/main/res/xml/data_extraction_rules.xml new file mode 100644 index 0000000..9dd0bbc --- /dev/null +++ b/app/src/main/res/xml/data_extraction_rules.xml @@ -0,0 +1,35 @@ + + + + + + + + \ No newline at end of file diff --git a/build.gradle b/build.gradle index 2c18118..4e52899 100644 --- a/build.gradle +++ b/build.gradle @@ -19,7 +19,6 @@ plugins { } ext { - easy_flip_view = "2.1.0" support_version = "27.1.1" constraint_version = "1.1.3" } diff --git a/gradle.properties b/gradle.properties index 9e6fce1..9f19d41 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,3 +17,8 @@ org.gradle.jvmargs=-Xmx1536m # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # org.gradle.parallel=true +# gradle.properties +systemProp.sonar.host.url=https://sonarcloud.io +systemProp.sonar.organization=subbramanil +systemProp.sonar.projectKey=subbramanil_Memory-Game +