diff --git a/app/.gitignore b/app/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/app/arrow-small-left.png b/app/arrow-small-left.png new file mode 100644 index 0000000..66dacf1 Binary files /dev/null and b/app/arrow-small-left.png differ diff --git a/app/build.gradle b/app/build.gradle new file mode 100644 index 0000000..e1c605c --- /dev/null +++ b/app/build.gradle @@ -0,0 +1,31 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 29 + buildToolsVersion "29.0.2" + defaultConfig { + applicationId "com.example.alzapp" + minSdkVersion 22 + targetSdkVersion 29 + versionCode 1 + versionName "1.0" + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar']) + implementation 'androidx.appcompat:appcompat:1.1.0' + implementation 'androidx.constraintlayout:constraintlayout:1.1.3' + testImplementation 'junit:junit:4.12' + androidTestImplementation 'androidx.test.ext:junit:1.1.1' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' + implementation 'com.android.support:cardview-v7:29.0.2' + implementation "androidx.annotation:annotation:1.1.0" +} diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro new file mode 100644 index 0000000..f1b4245 --- /dev/null +++ b/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile diff --git a/app/src/androidTest/java/com/example/alzapp/ExampleInstrumentedTest.java b/app/src/androidTest/java/com/example/alzapp/ExampleInstrumentedTest.java new file mode 100644 index 0000000..37ae810 --- /dev/null +++ b/app/src/androidTest/java/com/example/alzapp/ExampleInstrumentedTest.java @@ -0,0 +1,27 @@ +package com.example.alzapp; + +import android.content.Context; + +import androidx.test.platform.app.InstrumentationRegistry; +import androidx.test.ext.junit.runners.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +/** + * Instrumented test, which will execute on an Android device. + * + * @see Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); + + assertEquals("com.example.alzapp", appContext.getPackageName()); + } +} diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..97f3d4b --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/java/com/example/alzapp/DatabaseHelper.java b/app/src/main/java/com/example/alzapp/DatabaseHelper.java new file mode 100644 index 0000000..ffb84ba --- /dev/null +++ b/app/src/main/java/com/example/alzapp/DatabaseHelper.java @@ -0,0 +1,72 @@ +package com.example.alzapp; + +import androidx.appcompat.app.AppCompatActivity; + +import android.content.Context; +import android.database.Cursor; +import android.database.sqlite.SQLiteDatabase; +import android.database.sqlite.SQLiteOpenHelper; +import android.widget.Toast; +/******* +Created on: 21/01/2020 + + By: B.Priyatham sai chand + + + ********/ + +public class DatabaseHelper extends SQLiteOpenHelper { + + private static final String DATABASE_NAME = "User.db"; + private static final String TABLE_NAME = "tblUser"; + private static final int DATABASE_VERSION = 2; + private Context context; + + DatabaseHelper(Context context){ + super (context, DATABASE_NAME,null, DATABASE_VERSION); + this.context = context; + + } + + @Override + public void onCreate(SQLiteDatabase db) { + + db.execSQL("CREATE TABLE GENDER (GENDER INTEGER PRIMARY KEY, VALUE VARCHAR(20));"); + db.execSQL("CREATE TABLE TBLUSERINFO (USERID INTEGER PRIMARY KEY AUTOINCREMENT,USERNAME TEXT,PASSWORD TEXT,FIRSTNAME VARCHAR(20),LASTNAME VARCHAR(20), DOB TEXT,EMAIL TEXT, GENDER INTEGER,FOREIGN KEY(GENDER) REFERENCES GENDER(GENDER));"); + db.execSQL("CREATE TABLE TBLUSERNAME(ID INTEGER PRIMARY KEY, USERNAME TEXT,PASSWORD TEXT)"); + } + + @Override + public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { + + db.execSQL("DROP TABLE IF EXISTS TBLUSERINFO;"); + onCreate(db); + } + + public Cursor getAllData() { + SQLiteDatabase db = this.getWritableDatabase(); + Cursor res = db.rawQuery("select * from TBLUSERINFO ORDER BY USERID",null); + return res; + } + + public void insertUsername(String username ,String password){ + SQLiteDatabase db = this.getWritableDatabase(); + db.execSQL("INSERT INTO TBLUSERNAME VALUES (username,password);"); + + } + + + public void insertData(String reg_username,String reg_password,String first_name,String Last_name,String dob, String email,int gender) { + SQLiteDatabase db = this.getWritableDatabase(); + db.execSQL("INSERT INTO TBLUSERINFO VALUES (reg_username,reg_password,first_name,last_name,dob,email,gender);"); + + } + + + public Cursor selectData(String firstname) { + SQLiteDatabase db = this.getWritableDatabase(); + Cursor res = db.rawQuery("select * from TBLUSERINFO WHERE FIRSTNAME='" + firstname + "' ORDER BY ID",null); + return res; + } + +} diff --git a/app/src/main/java/com/example/alzapp/DatePickerFragment.java b/app/src/main/java/com/example/alzapp/DatePickerFragment.java new file mode 100644 index 0000000..56988bf --- /dev/null +++ b/app/src/main/java/com/example/alzapp/DatePickerFragment.java @@ -0,0 +1,33 @@ +package com.example.alzapp; + +import androidx.fragment.app.DialogFragment; + +import android.app.DatePickerDialog; +import android.app.Dialog; +import android.os.Bundle; + +import java.util.Calendar; +import androidx.annotation.NonNull; + +/******* + Created on: 21/01/2020 + + By: B.Priyatham sai chand + + + ********/ + + public class DatePickerFragment extends DialogFragment { + + @NonNull + @Override + public Dialog onCreateDialog(Bundle savedInstanceState) { + Calendar c = Calendar.getInstance(); + int year = c.get(Calendar.YEAR); + int month = c.get(Calendar.MONTH); + int day = c.get(Calendar.DAY_OF_MONTH); + + return new DatePickerDialog(getActivity(), (DatePickerDialog.OnDateSetListener) getActivity(), year, month, day); + } + } + diff --git a/app/src/main/java/com/example/alzapp/Jumble.java b/app/src/main/java/com/example/alzapp/Jumble.java new file mode 100644 index 0000000..7736d9e --- /dev/null +++ b/app/src/main/java/com/example/alzapp/Jumble.java @@ -0,0 +1,42 @@ +package com.example.alzapp; + +import java.util.Random; +/******* + Created on: 21/01/2020 + + By: B.Priyatham sai chand + + + ********/ + +public class Jumble { + + + public static final Random RANDOM = new Random(); + public static final String[] WORDS = {"AIM", "BIRD", + "PEN", "SET", "GUN", "FAN", "CUT", "BOOK", "MIC", "ACE", + "FIT", "YES", "ONE", "WORK", "LAP", "PAW", + "BUY", "MET", "SKIP", "JAM", "JAR", "ROW","OIL","SHE","LEG","SAD","DRY","DOT","FOG","HIM","FUN","LAW","SEA","SEE","DAD", + "MOP", "ZOO", "WET", "TRY", "YES","MAIN","MAP","RAT","RISK","KILL","PAWN","LIKE","SIR","MAM","JOY","JUG","HAT","KITE","MEN","NUT","MAX","TAX",}; + + public static String randomWord() { + return WORDS[RANDOM.nextInt(WORDS.length)]; + } + + public static String shuffleWord(String word) { + if (word != null && !"".equals(word)) { + char a[] = word.toCharArray(); + + for (int i = 0; i < a.length; i++) { + int j = RANDOM.nextInt(a.length); + char tmp = a[i]; + a[i] = a[j]; + a[j] = tmp; + } + + return new String(a); + } + + return word; + } +} diff --git a/app/src/main/java/com/example/alzapp/JumbleActivity.java b/app/src/main/java/com/example/alzapp/JumbleActivity.java new file mode 100644 index 0000000..43a2236 --- /dev/null +++ b/app/src/main/java/com/example/alzapp/JumbleActivity.java @@ -0,0 +1,122 @@ +package com.example.alzapp; + +import androidx.appcompat.app.AppCompatActivity; + +import android.content.Intent; +import android.os.Bundle; +import android.os.Bundle; + +import android.os.Handler; +import android.view.View; +import android.widget.Button; +import android.widget.EditText; +import android.widget.TextView; +import android.widget.Toast; + +import java.util.zip.Inflater; +import java.util.zip.Inflater.*; + +/******* + Created on: 21/01/2020 + + By: B.Priyatham sai chand + + + ********/ + + +public class JumbleActivity extends AppCompatActivity implements View.OnClickListener{ + + private TextView wordTv; + private EditText wordEnteredTv; + private Button validate, newGame; + private String wordToFind; + private int score = 0; + private TextView score_dis; + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_jumble); + + + + score_dis = (TextView) findViewById(R.id.score); + wordTv = (TextView) findViewById(R.id.wordTv); + wordEnteredTv = (EditText) findViewById(R.id.wordEnteredTv); + validate = (Button) findViewById(R.id.validate); + validate.setOnClickListener(this); + newGame = (Button) findViewById(R.id.newGame); + newGame.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + reset(); + score_dis.setText("Score : " + score); + } + }); + + newGame(); + + Button back = (Button) findViewById(R.id.back); + + back.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + onBackPressed(); + } + }); + + + } + + @Override + public void onClick(View view) { + if (view == validate) { + + validate(); + } else if (view == newGame) { + score = 0; + newGame(); + + + } + } + + private void validate() { + String w = wordEnteredTv.getText().toString(); + + if (wordToFind.equals(w)) { + Toast.makeText(this, "Congratulations ! You found the word " + wordToFind, Toast.LENGTH_SHORT).show(); + + score += 1; + score_dis.setText("Score : " + score); + newGame(); + + + } else { + Toast.makeText(this, "Retry !", Toast.LENGTH_SHORT).show(); + } + } + + private void newGame() { + wordToFind = Jumble.randomWord(); + String wordShuffled = Jumble.shuffleWord(wordToFind); + wordTv.setText(wordShuffled); + wordEnteredTv.setText(""); + + + + } + private void reset(){ + + score = 0; + newGame(); + + } + + + + + + + } + diff --git a/app/src/main/java/com/example/alzapp/MainActivity.java b/app/src/main/java/com/example/alzapp/MainActivity.java new file mode 100644 index 0000000..2310c1e --- /dev/null +++ b/app/src/main/java/com/example/alzapp/MainActivity.java @@ -0,0 +1,37 @@ +package com.example.alzapp; + +import androidx.appcompat.app.AppCompatActivity; + +import android.content.Intent; +import android.database.sqlite.SQLiteDatabase; +import android.os.Bundle; +import android.view.View; +import android.widget.Button; +import android.widget.TextView; +/******* + Created on: 21/01/2020 + + By: B.Priyatham sai chand, Rishab Kulkarni & Shaik Idrisulla + + + ********/ + + +public class MainActivity extends AppCompatActivity { + + private TextView welcome; + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + + startActivity(new Intent(MainActivity.this, WelcomeActivity.class)); + + + } + + + +} + + diff --git a/app/src/main/java/com/example/alzapp/QuickPlayMenu.java b/app/src/main/java/com/example/alzapp/QuickPlayMenu.java new file mode 100644 index 0000000..58c6d9e --- /dev/null +++ b/app/src/main/java/com/example/alzapp/QuickPlayMenu.java @@ -0,0 +1,63 @@ +package com.example.alzapp; + +import androidx.appcompat.app.AppCompatActivity; + +import android.content.Intent; +import android.os.Bundle; +import android.view.View; +import android.widget.Button; + +/******* + Created on: 21/01/2020 + + By: Rishab Kulkarni & Shaik Idrisulla + + + ********/ + +public class QuickPlayMenu extends AppCompatActivity { + + private Button jumble; + private Button tilematch; + private Button game3; + private Button game4; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_quick_play_menu); + + jumble = (Button) findViewById(R.id.jumble); + tilematch = (Button) findViewById(R.id.tilematch); + + jumble.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent = new Intent(QuickPlayMenu.this,JumbleActivity.class); + startActivity(intent); + + } + }); + + tilematch.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent = new Intent(QuickPlayMenu.this,TileMatchingActivity.class); + startActivity(intent); + + } + }); + + Button back = (Button) findViewById(R.id.back); + + back.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + onBackPressed(); + } + }); + + + + } +} diff --git a/app/src/main/java/com/example/alzapp/TileMatchingActivity.java b/app/src/main/java/com/example/alzapp/TileMatchingActivity.java new file mode 100644 index 0000000..f03d3bd --- /dev/null +++ b/app/src/main/java/com/example/alzapp/TileMatchingActivity.java @@ -0,0 +1,528 @@ +package com.example.alzapp; + +import androidx.appcompat.app.AlertDialog; +import androidx.appcompat.app.AppCompatActivity; + +import android.content.DialogInterface; +import android.os.Bundle; +import android.os.Handler; +import android.view.View; +import android.widget.Button; +import android.widget.ImageView; +import android.widget.TextView; + +import com.example.alzapp.R; + +import java.util.Arrays; +import java.util.Collections; + +/******* + Created on: 21/01/2020 + + By: Rishab Kulkarni & Shaik Idrisulla + + + ********/ + +public class TileMatchingActivity extends AppCompatActivity { + + TextView counter; + ImageView i11,i12,i13,i14; + ImageView i21,i22,i23,i24; + ImageView i31,i32,i33,i34; + ImageView i41,i42,i43,i44; + + Integer[] cardsArray={101,102,103,104,105,106,107,108,201,202,203,204,205,206,207,208}; + + int img101,img102,img103,img104,img105,img106,img107,img108, + img201,img202,img203,img204,img205,img206,img207,img208, + firstCard,secondCard,clickedFirst,clickedSecond,cardNumber=1,playerMoves=0; + + + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_tile_matching); + counter=(TextView) findViewById(R.id.counter1); + + i11=(ImageView) findViewById(R.id.i11); + i12=(ImageView) findViewById(R.id.i12); + i13=(ImageView) findViewById(R.id.i13); + i14=(ImageView) findViewById(R.id.i14); + + i21=(ImageView) findViewById(R.id.i21); + i22=(ImageView) findViewById(R.id.i22); + i23=(ImageView) findViewById(R.id.i23); + i24=(ImageView) findViewById(R.id.i24); + + i31=(ImageView) findViewById(R.id.i31); + i32=(ImageView) findViewById(R.id.i32); + i33=(ImageView) findViewById(R.id.i33); + i34=(ImageView) findViewById(R.id.i34); + + i41=(ImageView) findViewById(R.id.i41); + i42=(ImageView) findViewById(R.id.i42); + i43=(ImageView) findViewById(R.id.i43); + i44=(ImageView) findViewById(R.id.i44); + + i11.setTag("0"); + i12.setTag("1"); + i13.setTag("2"); + i14.setTag("3"); + + i21.setTag("4"); + i22.setTag("5"); + i23.setTag("6"); + i24.setTag("7"); + + i31.setTag("8"); + i32.setTag("9"); + i33.setTag("10"); + i34.setTag("11"); + + i41.setTag("12"); + i42.setTag("13"); + i43.setTag("14"); + i44.setTag("15"); + + frontCards(); + + Collections.shuffle(Arrays.asList(cardsArray)); + + i11.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + int theCard= Integer.parseInt((String) v.getTag()); + doStuff(i11, theCard); + + } + }); + + i12.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + int theCard= Integer.parseInt((String) v.getTag()); + doStuff(i12, theCard); + } + }); + + i13.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + int theCard= Integer.parseInt((String) v.getTag()); + doStuff(i13, theCard); + } + }); + + i14.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + int theCard= Integer.parseInt((String) v.getTag()); + doStuff(i14, theCard); + } + }); + + i21.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + int theCard= Integer.parseInt((String) v.getTag()); + doStuff(i21, theCard); + } + }); + + i22.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + int theCard= Integer.parseInt((String) v.getTag()); + doStuff(i22, theCard); + + } + }); + + i23.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + int theCard= Integer.parseInt((String) v.getTag()); + doStuff(i23, theCard); + } + }); + + i24.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + int theCard= Integer.parseInt((String) v.getTag()); + doStuff(i24, theCard); + } + }); + + i31.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + int theCard= Integer.parseInt((String) v.getTag()); + doStuff(i31, theCard); + } + }); + + i32.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + int theCard= Integer.parseInt((String) v.getTag()); + doStuff(i32, theCard); + } + }); + + i33.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + int theCard= Integer.parseInt((String) v.getTag()); + doStuff(i33, theCard); + } + }); + + i34.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + int theCard= Integer.parseInt((String) v.getTag()); + doStuff(i34, theCard); + + } + }); + + i41.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + int theCard= Integer.parseInt((String) v.getTag()); + doStuff(i41, theCard); + } + }); + + i42.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + int theCard= Integer.parseInt((String) v.getTag()); + doStuff(i42, theCard); + } + }); + + i43.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + int theCard= Integer.parseInt((String) v.getTag()); + doStuff(i43, theCard); } + }); + + i44.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + int theCard= Integer.parseInt((String) v.getTag()); + doStuff(i44, theCard); + } + }); + + + + + + Button back = (Button) findViewById(R.id.back); + + back.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + onBackPressed(); + } + }); + + + } + + private void doStuff(ImageView img,int card){ + if(cardsArray[card]==101){ + img.setImageResource(img101); + } + else if(cardsArray[card]==102){ + img.setImageResource(img102); + } + else if(cardsArray[card]==103){ + img.setImageResource(img103); + } + else if(cardsArray[card]==104){ + img.setImageResource(img104); + } + else if(cardsArray[card]==105){ + img.setImageResource(img105); + } + else if(cardsArray[card]==106){ + img.setImageResource(img106); + } + else if(cardsArray[card]==107){ + img.setImageResource(img107); + } + else if(cardsArray[card]==108){ + img.setImageResource(img108); + } + else if(cardsArray[card]==201){ + img.setImageResource(img201); + } + else if(cardsArray[card]==202){ + img.setImageResource(img202); + } + else if(cardsArray[card]==203){ + img.setImageResource(img203); + } + else if(cardsArray[card]==204){ + img.setImageResource(img204); + } + else if(cardsArray[card]==205){ + img.setImageResource(img205); + } + else if(cardsArray[card]==206){ + img.setImageResource(img206); + } + else if(cardsArray[card]==207){ + img.setImageResource(img207); + } + else if(cardsArray[card]==208){ + img.setImageResource(img208); + } + playerMoves++; + counter.setText("MOVES= "+playerMoves/2); + + if (cardNumber==1){ + firstCard=cardsArray[card]; + if(firstCard>200){ + firstCard=firstCard-100; + } + cardNumber=2; + clickedFirst=card; + img.setEnabled(false); + } + else if(cardNumber==2){ + secondCard=cardsArray[card]; + if(secondCard>200){ + secondCard=secondCard-100; + } + cardNumber=1; + clickedSecond=card; + + i11.setEnabled(false); + i12.setEnabled(false); + i13.setEnabled(false); + i14.setEnabled(false); + i21.setEnabled(false); + i22.setEnabled(false); + i23.setEnabled(false); + i24.setEnabled(false); + i31.setEnabled(false); + i32.setEnabled(false); + i33.setEnabled(false); + i34.setEnabled(false); + i41.setEnabled(false); + i42.setEnabled(false); + i43.setEnabled(false); + i44.setEnabled(false); + + Handler handler=new Handler(); + handler.postDelayed(new Runnable() { + @Override + public void run() { + calculate(); + } + },1000); + + } + + } + + private void calculate(){ + if(firstCard==secondCard){ + if(clickedFirst==0){ + i11.setVisibility(View.INVISIBLE); + } + else if(clickedFirst==1){ + i12.setVisibility(View.INVISIBLE); + } + else if(clickedFirst==2){ + i13.setVisibility(View.INVISIBLE); + } + else if(clickedFirst==3){ + i14.setVisibility(View.INVISIBLE); + } + else if(clickedFirst==4){ + i21.setVisibility(View.INVISIBLE); + } + else if(clickedFirst==5){ + i22.setVisibility(View.INVISIBLE); + } + else if(clickedFirst==6){ + i23.setVisibility(View.INVISIBLE); + } + else if(clickedFirst==7){ + i24.setVisibility(View.INVISIBLE); + } + else if(clickedFirst==8){ + i31.setVisibility(View.INVISIBLE); + } + else if(clickedFirst==9){ + i32.setVisibility(View.INVISIBLE); + } + else if(clickedFirst==10){ + i33.setVisibility(View.INVISIBLE); + } + else if(clickedFirst==11){ + i34.setVisibility(View.INVISIBLE); + } + else if(clickedFirst==12){ + i41.setVisibility(View.INVISIBLE); + } + else if(clickedFirst==13){ + i42.setVisibility(View.INVISIBLE); + } + else if(clickedFirst==14){ + i43.setVisibility(View.INVISIBLE); + } + else if(clickedFirst==15){ + i44.setVisibility(View.INVISIBLE); + } + + + if(clickedSecond==0){ + i11.setVisibility(View.INVISIBLE); + } + else if(clickedSecond==1){ + i12.setVisibility(View.INVISIBLE); + } + else if(clickedSecond==2){ + i13.setVisibility(View.INVISIBLE); + } + else if(clickedSecond==3){ + i14.setVisibility(View.INVISIBLE); + } + else if(clickedSecond==4){ + i21.setVisibility(View.INVISIBLE); + } + else if(clickedSecond==5){ + i22.setVisibility(View.INVISIBLE); + } + else if(clickedSecond==6){ + i23.setVisibility(View.INVISIBLE); + } + else if(clickedSecond==7){ + i24.setVisibility(View.INVISIBLE); + } + else if(clickedSecond==8){ + i31.setVisibility(View.INVISIBLE); + } + else if(clickedSecond==9){ + i32.setVisibility(View.INVISIBLE); + } + else if(clickedSecond==10){ + i33.setVisibility(View.INVISIBLE); + } + else if(clickedSecond==11){ + i34.setVisibility(View.INVISIBLE); + } + else if(clickedSecond==12){ + i41.setVisibility(View.INVISIBLE); + } + else if(clickedSecond==13){ + i42.setVisibility(View.INVISIBLE); + } + else if(clickedSecond==14){ + i43.setVisibility(View.INVISIBLE); + } + else if(clickedSecond==15){ + i44.setVisibility(View.INVISIBLE); + } + + + } + else { + i11.setImageResource(R.drawable.question); + i12.setImageResource(R.drawable.question); + i13.setImageResource(R.drawable.question); + i14.setImageResource(R.drawable.question); + i21.setImageResource(R.drawable.question); + i22.setImageResource(R.drawable.question); + i23.setImageResource(R.drawable.question); + i24.setImageResource(R.drawable.question); + i31.setImageResource(R.drawable.question); + i32.setImageResource(R.drawable.question); + i33.setImageResource(R.drawable.question); + i34.setImageResource(R.drawable.question); + i41.setImageResource(R.drawable.question); + i42.setImageResource(R.drawable.question); + i43.setImageResource(R.drawable.question); + i44.setImageResource(R.drawable.question); + } + + i11.setEnabled(true); + i12.setEnabled(true); + i13.setEnabled(true); + i14.setEnabled(true); + i21.setEnabled(true); + i22.setEnabled(true); + i23.setEnabled(true); + i24.setEnabled(true); + i31.setEnabled(true); + i32.setEnabled(true); + i33.setEnabled(true); + i34.setEnabled(true); + i41.setEnabled(true); + i42.setEnabled(true); + i43.setEnabled(true); + i44.setEnabled(true); + + checkEnd(); + } + + private void checkEnd(){ + if(i11.getVisibility()==View.INVISIBLE && + i12.getVisibility()==View.INVISIBLE && + i13.getVisibility()==View.INVISIBLE && + i14.getVisibility()==View.INVISIBLE && + i21.getVisibility()==View.INVISIBLE && + i22.getVisibility()==View.INVISIBLE && + i23.getVisibility()==View.INVISIBLE && + i24.getVisibility()==View.INVISIBLE && + i31.getVisibility()==View.INVISIBLE && + i32.getVisibility()==View.INVISIBLE && + i33.getVisibility()==View.INVISIBLE && + i34.getVisibility()==View.INVISIBLE && + i41.getVisibility()==View.INVISIBLE && + i42.getVisibility()==View.INVISIBLE && + i43.getVisibility()==View.INVISIBLE && + i44.getVisibility()==View.INVISIBLE + ){ + AlertDialog.Builder message= new AlertDialog.Builder(TileMatchingActivity.this); + message.setMessage("GAME OVER!!\nMOVES= "+counter) + .setCancelable(false) + .setPositiveButton("NEXT", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + finish(); + } + }); + + } + } + + private void frontCards(){ + img101=R.drawable.bear; + img102=R.drawable.dog; + img103=R.drawable.rat; + img104=R.drawable.elephant; + img105=R.drawable.lion; + img106=R.drawable.zebra; + img107=R.drawable.chicken; + img108=R.drawable.cow; + img201=R.drawable.bear; + img202=R.drawable.dog; + img203=R.drawable.rat; + img204=R.drawable.elephant; + img205=R.drawable.lion; + img206=R.drawable.zebra; + img207=R.drawable.chicken; + img208=R.drawable.cow; + } +} diff --git a/app/src/main/java/com/example/alzapp/WelcomeActivity.java b/app/src/main/java/com/example/alzapp/WelcomeActivity.java new file mode 100644 index 0000000..beba791 --- /dev/null +++ b/app/src/main/java/com/example/alzapp/WelcomeActivity.java @@ -0,0 +1,59 @@ +package com.example.alzapp; + +import androidx.appcompat.app.AppCompatActivity; + +import android.os.Bundle; +import android.view.View; +import android.widget.Button; +import android.content.Intent; +/******* + Created on: 21/01/2020 + + By: B.Priyatham sai chand + + + ********/ + +public class WelcomeActivity extends AppCompatActivity { + + private Button wel_login; + private Button wel_register; + private Button wel_quick; + + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_welcome); + + wel_login = (Button) findViewById(R.id.login); + wel_register = (Button) findViewById(R.id.register); + wel_quick = (Button) findViewById(R.id.quick); + + wel_login.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent = new Intent(WelcomeActivity.this,login.class); + startActivity(intent); + } + }); + + wel_register.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent = new Intent(WelcomeActivity.this,registration.class); + startActivity(intent); + } + }); + wel_quick.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent = new Intent(WelcomeActivity.this,QuickPlayMenu.class); + startActivity(intent); + } + }); + + + + } +} diff --git a/app/src/main/java/com/example/alzapp/login.java b/app/src/main/java/com/example/alzapp/login.java new file mode 100644 index 0000000..ff1dbac --- /dev/null +++ b/app/src/main/java/com/example/alzapp/login.java @@ -0,0 +1,57 @@ +package com.example.alzapp; + +import androidx.appcompat.app.AppCompatActivity; + +import android.content.Intent; +import android.os.Bundle; +import android.view.View; +import android.widget.Button; +import android.widget.TextView; + +/******* + Created on: 21/01/2020 + + By: B.Priyatham sai chand + + + ********/ + +public class login extends AppCompatActivity { + private TextView signup; + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_login); + + + signup = (TextView) findViewById(R.id.signUp_text); + + signup.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent1 = new Intent(login.this,registration.class); + startActivity(intent1); + } + + + }); + + + + + + + Button back = (Button) findViewById(R.id.back); + + back.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + onBackPressed(); + } + }); + + } + + + +} diff --git a/app/src/main/java/com/example/alzapp/registration.java b/app/src/main/java/com/example/alzapp/registration.java new file mode 100644 index 0000000..a6090d8 --- /dev/null +++ b/app/src/main/java/com/example/alzapp/registration.java @@ -0,0 +1,199 @@ +package com.example.alzapp; + +import androidx.appcompat.app.AppCompatActivity; +import android.app.DatePickerDialog; +import android.content.Intent; +import android.database.sqlite.SQLiteDatabase; +import android.os.Bundle; +import android.view.View; +import android.widget.EditText; +import android.widget.TextView; +import androidx.fragment.app.DialogFragment; +import android.widget.DatePicker; +import android.widget.RadioButton; +import android.widget.Button; +import android.widget.RadioGroup; +import java.text.DateFormat; +import java.util.Calendar; +import android.view.LayoutInflater; +import android.widget.ImageView; +import android.widget.TextView; +import android.widget.Toast; +import android.view.View; +import android.view.ViewGroup; +import android.view.Gravity; +/******* + Created on: 21/01/2020 + + By: B.Priyatham sai chand + + + ********/ + +public class registration extends AppCompatActivity implements DatePickerDialog.OnDateSetListener { + private TextView signin; + private TextView dob; + com.example.alzapp.DatabaseHelper dal; + SQLiteDatabase sqLiteDatabase; + private RadioGroup radioSexGroup; + private RadioButton radioSexButton; + private EditText username; + private EditText password; + private EditText firstname; + private EditText lastname; + private EditText email_id; + private Button signup; + private Button signup_button; + int sex; + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_registration); + + dal = new DatabaseHelper(registration.this); + username = (EditText) findViewById(R.id.reg_useername); + password = (EditText) findViewById(R.id.reg_password); + firstname = (EditText) findViewById(R.id.firstname); + lastname = (EditText) findViewById(R.id.lastname); + email_id = (EditText) findViewById(R.id.email_id); + signup = (Button) findViewById(R.id.signup_button); + signin = (TextView) findViewById(R.id.signIn_text); + dob = (TextView) findViewById(R.id.dob1); + signup_button = (Button) findViewById(R.id.signup_button); + signin.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + openActivity(); + } + + + }); + + signup.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + + if(isEmpty(username) || isEmpty(password) || isEmpty(firstname) || isEmpty(lastname) || isEmpty(email_id)){ + + Toast.makeText(registration.this, "One or more fields empty.", Toast.LENGTH_SHORT).show(); + + + + } + + else { + + + + insertData(); + + } + } + }); + dob.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + DialogFragment datePicker = new DatePickerFragment(); + datePicker.show(getSupportFragmentManager(), "date picker"); + + } + }); + + Button back = (Button) findViewById(R.id.back); + + back.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + onBackPressed(); + } + }); + + + + + + } + + @Override + public void onDateSet(DatePicker view, int year, int month, int dayOfMonth) { + Calendar c = Calendar.getInstance(); + c.set(Calendar.YEAR, year); + c.set(Calendar.MONTH, month); + c.set(Calendar.DAY_OF_MONTH, dayOfMonth); + String currentDateString = DateFormat.getDateInstance(DateFormat.FULL).format(c.getTime()); + + TextView textView = (TextView) findViewById(R.id.dob1); + textView.setText(currentDateString); + } + + public void openActivity() { + + Intent intent = new Intent(this,login.class); + startActivity(intent); + + + + } + + public void addListenerOnButton() { + + radioSexGroup = (RadioGroup) findViewById(R.id.radioSex); + + + + + + + // get selected radio button from radioGroup + int selectedId = radioSexGroup.getCheckedRadioButtonId(); + + //find the radiobutton by returned id + radioSexButton = (RadioButton) findViewById(selectedId); + + if(radioSexButton.getText() == "Male"){ + sex = 0; + } + else if (radioSexButton.getText() == "Female"){ + + sex = 1; + } + else{ + + sex = -1; + } + + + + + + + } + public void insertData(){ + + dal.insertData(username.getText().toString(),lastname.getText().toString(),firstname.getText().toString(),lastname.getText().toString(),dob.getText().toString(),email_id.getText().toString(),sex); + + + } + public boolean isEmpty(EditText etText) { + return etText.getText().toString().trim().length() == 0; + } + + public void showToast() { + LayoutInflater inflater = getLayoutInflater(); + View layout = inflater.inflate(R.layout.toast, (ViewGroup) findViewById(R.id.toast_root)); + + TextView toastText = layout.findViewById(R.id.toast_text); + ImageView toastImage = layout.findViewById(R.id.toast_image); + + toastText.setText("One of the fields is empty Try again "); + + + Toast toast = new Toast(getApplicationContext()); + toast.setGravity(Gravity.CENTER, 0, 0); + toast.setDuration(Toast.LENGTH_LONG); + toast.setView(layout); + + toast.show(); + } + +} diff --git a/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 0000000..1f6bb29 --- /dev/null +++ b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + diff --git a/app/src/main/res/drawable/app_icon.png b/app/src/main/res/drawable/app_icon.png new file mode 100644 index 0000000..abf5628 Binary files /dev/null and b/app/src/main/res/drawable/app_icon.png differ diff --git a/app/src/main/res/drawable/backgrounderror.jpg b/app/src/main/res/drawable/backgrounderror.jpg new file mode 100644 index 0000000..8b221f6 Binary files /dev/null and b/app/src/main/res/drawable/backgrounderror.jpg differ diff --git a/app/src/main/res/drawable/bear.jpg b/app/src/main/res/drawable/bear.jpg new file mode 100644 index 0000000..76ac18e Binary files /dev/null and b/app/src/main/res/drawable/bear.jpg differ diff --git a/app/src/main/res/drawable/bg_gradient1.xml b/app/src/main/res/drawable/bg_gradient1.xml new file mode 100644 index 0000000..ea13d53 --- /dev/null +++ b/app/src/main/res/drawable/bg_gradient1.xml @@ -0,0 +1,12 @@ + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/bg_gradient2.xml b/app/src/main/res/drawable/bg_gradient2.xml new file mode 100644 index 0000000..a5e7089 --- /dev/null +++ b/app/src/main/res/drawable/bg_gradient2.xml @@ -0,0 +1,12 @@ + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/box_design.xml b/app/src/main/res/drawable/box_design.xml new file mode 100644 index 0000000..f7169ea --- /dev/null +++ b/app/src/main/res/drawable/box_design.xml @@ -0,0 +1,19 @@ + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/button.xml b/app/src/main/res/drawable/button.xml new file mode 100644 index 0000000..af78185 --- /dev/null +++ b/app/src/main/res/drawable/button.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/button_menu.xml b/app/src/main/res/drawable/button_menu.xml new file mode 100644 index 0000000..a352e62 --- /dev/null +++ b/app/src/main/res/drawable/button_menu.xml @@ -0,0 +1,16 @@ + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/chicken.jpg b/app/src/main/res/drawable/chicken.jpg new file mode 100644 index 0000000..195d85a Binary files /dev/null and b/app/src/main/res/drawable/chicken.jpg differ diff --git a/app/src/main/res/drawable/cow.jpg b/app/src/main/res/drawable/cow.jpg new file mode 100644 index 0000000..2b7ef18 Binary files /dev/null and b/app/src/main/res/drawable/cow.jpg differ diff --git a/app/src/main/res/drawable/dog.jpg b/app/src/main/res/drawable/dog.jpg new file mode 100644 index 0000000..4dd71c5 Binary files /dev/null and b/app/src/main/res/drawable/dog.jpg differ diff --git a/app/src/main/res/drawable/edit_text_bottom.xml b/app/src/main/res/drawable/edit_text_bottom.xml new file mode 100644 index 0000000..af78185 --- /dev/null +++ b/app/src/main/res/drawable/edit_text_bottom.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/edit_text_top.xml b/app/src/main/res/drawable/edit_text_top.xml new file mode 100644 index 0000000..3ba8b0e --- /dev/null +++ b/app/src/main/res/drawable/edit_text_top.xml @@ -0,0 +1,11 @@ + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/elephant.jpg b/app/src/main/res/drawable/elephant.jpg new file mode 100644 index 0000000..edf8485 Binary files /dev/null and b/app/src/main/res/drawable/elephant.jpg differ diff --git a/app/src/main/res/drawable/ic_android_black_24dp.xml b/app/src/main/res/drawable/ic_android_black_24dp.xml new file mode 100644 index 0000000..401cbf6 --- /dev/null +++ b/app/src/main/res/drawable/ic_android_black_24dp.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..0d025f9 --- /dev/null +++ b/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/lion.jpg b/app/src/main/res/drawable/lion.jpg new file mode 100644 index 0000000..c3302c3 Binary files /dev/null and b/app/src/main/res/drawable/lion.jpg differ diff --git a/app/src/main/res/drawable/question.jpg b/app/src/main/res/drawable/question.jpg new file mode 100644 index 0000000..6a779e1 Binary files /dev/null and b/app/src/main/res/drawable/question.jpg differ diff --git a/app/src/main/res/drawable/rat.jpg b/app/src/main/res/drawable/rat.jpg new file mode 100644 index 0000000..a2fd052 Binary files /dev/null and b/app/src/main/res/drawable/rat.jpg differ diff --git a/app/src/main/res/drawable/smallleft.png b/app/src/main/res/drawable/smallleft.png new file mode 100644 index 0000000..66dacf1 Binary files /dev/null and b/app/src/main/res/drawable/smallleft.png differ diff --git a/app/src/main/res/drawable/zebra.jpg b/app/src/main/res/drawable/zebra.jpg new file mode 100644 index 0000000..2dfa5ba Binary files /dev/null and b/app/src/main/res/drawable/zebra.jpg differ diff --git a/app/src/main/res/font/fontdiner_swanky.ttf b/app/src/main/res/font/fontdiner_swanky.ttf new file mode 100644 index 0000000..2edc51f Binary files /dev/null and b/app/src/main/res/font/fontdiner_swanky.ttf differ diff --git a/app/src/main/res/font/galada.xml b/app/src/main/res/font/galada.xml new file mode 100644 index 0000000..43dbd19 --- /dev/null +++ b/app/src/main/res/font/galada.xml @@ -0,0 +1,7 @@ + + + diff --git a/app/src/main/res/layout/actionbar.xml b/app/src/main/res/layout/actionbar.xml new file mode 100644 index 0000000..db08100 --- /dev/null +++ b/app/src/main/res/layout/actionbar.xml @@ -0,0 +1,38 @@ + + + + + +