Skip to content
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
4 changes: 3 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
run: ./gradlew build sonar --info
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
17 changes: 6 additions & 11 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -19,6 +18,10 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
buildFeatures {
viewBinding = true
}

namespace 'com.android.nikhil.memorygame'
}

Expand All @@ -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"
}
}
10 changes: 7 additions & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,19 @@
xmlns:tools="http://schemas.android.com/tools">

<application
android:allowBackup="true"
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:usesCleartextTraffic="false"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.AppCompat.Light.NoActionBar"
tools:ignore="GoogleAppIndexingWarning">
tools:ignore="GoogleAppIndexingWarning"
android:fullBackupContent="false"
android:dataExtractionRules="@xml/data_extraction_rules">

<activity android:name=".MainActivity" >
<activity android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand Down
17 changes: 8 additions & 9 deletions app/src/main/java/com/android/nikhil/memorygame/CardAdapter.kt
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions app/src/main/java/com/android/nikhil/memorygame/GameDialog.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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() {

Expand Down Expand Up @@ -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))
Expand Down
35 changes: 35 additions & 0 deletions app/src/main/res/xml/data_extraction_rules.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Sample data extraction rules file; uncomment and customize as necessary.
See https://developer.android.com/about/versions/12/backup-restore#xml-changes
for details.
-->
<data-extraction-rules>
<cloud-backup>
<!--
The domain can be file, database, sharedpref, external or root.
Examples:

<include domain="file" path="file_to_include"/>
<exclude domain="file" path="file_to_exclude"/>
<include domain="file" path="include_folder"/>
<exclude domain="file" path="include_folder/file_to_exclude"/>
<exclude domain="file" path="exclude_folder"/>
<include domain="file" path="exclude_folder/file_to_include"/>

<include domain="sharedpref" path="include_shared_pref1.xml"/>
<include domain="database" path="db_name/file_to_include"/>
<exclude domain="database" path="db_name/include_folder/file_to_exclude"/>
<include domain="external" path="file_to_include"/>
<exclude domain="external" path="file_to_exclude"/>
<include domain="root" path="file_to_include"/>
<exclude domain="root" path="file_to_exclude"/>
-->
</cloud-backup>
<!--
<device-transfer>
<include .../>
<exclude .../>
</device-transfer>
-->
</data-extraction-rules>
1 change: 0 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ plugins {
}

ext {
easy_flip_view = "2.1.0"
support_version = "27.1.1"
constraint_version = "1.1.3"
}
Expand Down
5 changes: 5 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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