diff --git a/.gradle/4.6/fileHashes/fileHashes.bin b/.gradle/4.6/fileHashes/fileHashes.bin
index f066f39..20798bd 100644
Binary files a/.gradle/4.6/fileHashes/fileHashes.bin and b/.gradle/4.6/fileHashes/fileHashes.bin differ
diff --git a/.gradle/4.6/fileHashes/fileHashes.lock b/.gradle/4.6/fileHashes/fileHashes.lock
index 8aea4ef..11904b7 100644
Binary files a/.gradle/4.6/fileHashes/fileHashes.lock and b/.gradle/4.6/fileHashes/fileHashes.lock differ
diff --git a/.gradle/4.6/fileHashes/resourceHashesCache.bin b/.gradle/4.6/fileHashes/resourceHashesCache.bin
index e3658d5..f988ddd 100644
Binary files a/.gradle/4.6/fileHashes/resourceHashesCache.bin and b/.gradle/4.6/fileHashes/resourceHashesCache.bin differ
diff --git a/.gradle/4.6/javaCompile/classAnalysis.bin b/.gradle/4.6/javaCompile/classAnalysis.bin
index b6a90b2..35967b3 100644
Binary files a/.gradle/4.6/javaCompile/classAnalysis.bin and b/.gradle/4.6/javaCompile/classAnalysis.bin differ
diff --git a/.gradle/4.6/javaCompile/jarAnalysis.bin b/.gradle/4.6/javaCompile/jarAnalysis.bin
index 931e607..0b4cdc7 100644
Binary files a/.gradle/4.6/javaCompile/jarAnalysis.bin and b/.gradle/4.6/javaCompile/jarAnalysis.bin differ
diff --git a/.gradle/4.6/javaCompile/javaCompile.lock b/.gradle/4.6/javaCompile/javaCompile.lock
index a1d6687..9c40f12 100644
Binary files a/.gradle/4.6/javaCompile/javaCompile.lock and b/.gradle/4.6/javaCompile/javaCompile.lock differ
diff --git a/.gradle/4.6/javaCompile/taskHistory.bin b/.gradle/4.6/javaCompile/taskHistory.bin
index 76c794a..419926c 100644
Binary files a/.gradle/4.6/javaCompile/taskHistory.bin and b/.gradle/4.6/javaCompile/taskHistory.bin differ
diff --git a/.gradle/4.6/javaCompile/taskJars.bin b/.gradle/4.6/javaCompile/taskJars.bin
index 74e3fd1..609f13d 100644
Binary files a/.gradle/4.6/javaCompile/taskJars.bin and b/.gradle/4.6/javaCompile/taskJars.bin differ
diff --git a/.gradle/4.6/taskHistory/taskHistory.bin b/.gradle/4.6/taskHistory/taskHistory.bin
index f6a0763..3a649e0 100644
Binary files a/.gradle/4.6/taskHistory/taskHistory.bin and b/.gradle/4.6/taskHistory/taskHistory.bin differ
diff --git a/.gradle/4.6/taskHistory/taskHistory.lock b/.gradle/4.6/taskHistory/taskHistory.lock
index 6f5c668..f36723a 100644
Binary files a/.gradle/4.6/taskHistory/taskHistory.lock and b/.gradle/4.6/taskHistory/taskHistory.lock differ
diff --git a/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/.gradle/buildOutputCleanup/buildOutputCleanup.lock
index c766982..0a57eaa 100644
Binary files a/.gradle/buildOutputCleanup/buildOutputCleanup.lock and b/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ
diff --git a/.idea/caches/build_file_checksums.ser b/.idea/caches/build_file_checksums.ser
index 6b1d455..bae4520 100644
Binary files a/.idea/caches/build_file_checksums.ser and b/.idea/caches/build_file_checksums.ser differ
diff --git a/.idea/libraries/Gradle__com_google_android_gms_play_services_ads_17_0_0.xml b/.idea/libraries/Gradle__com_google_android_gms_play_services_ads_17_0_0.xml
new file mode 100644
index 0000000..e60aa84
--- /dev/null
+++ b/.idea/libraries/Gradle__com_google_android_gms_play_services_ads_17_0_0.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__com_google_android_gms_play_services_ads_base_17_0_0.xml b/.idea/libraries/Gradle__com_google_android_gms_play_services_ads_base_17_0_0.xml
new file mode 100644
index 0000000..fda8a90
--- /dev/null
+++ b/.idea/libraries/Gradle__com_google_android_gms_play_services_ads_base_17_0_0.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__com_google_android_gms_play_services_ads_identifier_16_0_0.xml b/.idea/libraries/Gradle__com_google_android_gms_play_services_ads_identifier_16_0_0.xml
new file mode 100644
index 0000000..fec0a36
--- /dev/null
+++ b/.idea/libraries/Gradle__com_google_android_gms_play_services_ads_identifier_16_0_0.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__com_google_android_gms_play_services_ads_lite_17_0_0.xml b/.idea/libraries/Gradle__com_google_android_gms_play_services_ads_lite_17_0_0.xml
new file mode 100644
index 0000000..2db352b
--- /dev/null
+++ b/.idea/libraries/Gradle__com_google_android_gms_play_services_ads_lite_17_0_0.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__com_google_android_gms_play_services_gass_17_0_0.xml b/.idea/libraries/Gradle__com_google_android_gms_play_services_gass_17_0_0.xml
new file mode 100644
index 0000000..4295acb
--- /dev/null
+++ b/.idea/libraries/Gradle__com_google_android_gms_play_services_gass_17_0_0.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__com_google_android_gms_play_services_measurement_base_16_0_3.xml b/.idea/libraries/Gradle__com_google_android_gms_play_services_measurement_base_16_0_3.xml
new file mode 100644
index 0000000..e93d444
--- /dev/null
+++ b/.idea/libraries/Gradle__com_google_android_gms_play_services_measurement_base_16_0_3.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__com_google_android_gms_play_services_measurement_sdk_api_16_0_2.xml b/.idea/libraries/Gradle__com_google_android_gms_play_services_measurement_sdk_api_16_0_2.xml
new file mode 100644
index 0000000..8ee8cc4
--- /dev/null
+++ b/.idea/libraries/Gradle__com_google_android_gms_play_services_measurement_sdk_api_16_0_2.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index 17426a4..3386629 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -29,7 +29,7 @@
-
+
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index dec45ed..839a45a 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -8,7 +8,7 @@
-
+
@@ -17,7 +17,14 @@
-
+
+
+
+
+
+
+
+
@@ -49,11 +56,14 @@
-
-
+
+
-
-
+
+
+
+
+
@@ -61,74 +71,53 @@
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
-
-
-
-
-
+
+
-
-
-
-
-
-
+
+
-
-
-
-
-
+
+
-
-
+
+
-
-
-
-
-
+
+
-
-
+
+
+
+
+
-
-
+
+
+
+
+
-
-
-
-
-
+
+
@@ -140,17 +129,29 @@
+
queue
- editor
username
callback
- intent
mBuilder
+ Button
+ option
+ editor
+ shared
+ MyPref
+ bookmarkPg
+ jsonObj
+ quizePg
+ intent
+ bookmark_sp
+ jsonObjBookmark
+ bookmark
+ SharedPreferences
@@ -2432,16 +2433,55 @@
@@ -2455,8 +2495,7 @@
-
-
+
@@ -2480,29 +2519,18 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
@@ -2511,6 +2539,11 @@
+
+
+
+
+
@@ -2669,28 +2702,29 @@
-
+
-
+
+
-
+
-
+
-
+
-
+
-
-
-
+
+
+
+
+
-
-
@@ -2698,329 +2732,355 @@
-
+
+
+
+
+
-
- file://$PROJECT_DIR$/app/src/main/java/com/example/msq/quizzy/registerPg.java
- 418
-
-
+
+ file://C:/Android(SDK)/sources/android-28/android/view/animation/Animation.java
+ 1178
+
+
+
+
-
+
-
+
+
+
+
+
+
+
-
-
+
+
-
+
-
-
-
-
-
+
+
-
-
-
-
+
+
+
+
-
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
-
+
+
+
+
+
+
+
+
-
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
+
+
-
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
+
-
-
+
+
+
+
+
-
-
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
+
+
-
-
-
-
+
+
-
+
-
-
+
+
-
-
-
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
+
+
-
+
+
+
+
-
-
+
+
-
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
+
+
+
-
+
+
+
+
-
-
+
+
+
+
-
-
-
-
+
+
-
+
+
+
+
-
-
+
+
+
+
+
-
+
-
+
+
+
-
-
-
-
-
+
+
+
+
+
-
-
-
-
+
+
-
-
+
+
+
+
+
+
-
+
-
-
+
+
-
-
+
+
+
+
+
+
-
+
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
+
-
-
+
+
+
+
+
-
-
-
-
+
-
-
+
+
+
+
+
-
+
-
-
-
-
-
+
+
diff --git a/app/app.iml b/app/app.iml
index 2080b45..4b8f5db 100644
--- a/app/app.iml
+++ b/app/app.iml
@@ -135,8 +135,10 @@
+
+
@@ -163,10 +165,12 @@
+
+
@@ -179,10 +183,12 @@
+
+
@@ -201,5 +207,6 @@
+
\ No newline at end of file
diff --git a/app/build.gradle b/app/build.gradle
index faa8dc0..0d3a4cb 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -20,6 +20,7 @@ android {
}
dependencies {
+
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.facebook.android:facebook-android-sdk:4.37.0'
implementation 'com.android.support:appcompat-v7:28.0.0'
@@ -33,6 +34,7 @@ dependencies {
implementation 'com.android.volley:volley:1.1.1'
implementation 'com.twitter.sdk.android:twitter:3.1.0'
implementation 'com.twitter.sdk.android:twitter-core:3.1.0'
+ implementation 'com.google.android.gms:play-services-ads:17.0.0'
}
@@ -45,4 +47,4 @@ configurations.all {
}
}
}
-}
\ No newline at end of file
+}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index fd9fc06..188a3f3 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -3,6 +3,7 @@
package="com.example.msq.quizzy">
+
-
+
-
+
-
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/java/com/example/msq/quizzy/JsonObj.java b/app/src/main/java/com/example/msq/quizzy/JsonObj.java
new file mode 100644
index 0000000..22cb5ba
--- /dev/null
+++ b/app/src/main/java/com/example/msq/quizzy/JsonObj.java
@@ -0,0 +1,102 @@
+package com.example.msq.quizzy;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+
+public class JsonObj implements Parcelable {
+ String question;
+ String QID;
+ String options[];
+ String answer;
+ String qNo;
+
+ public JsonObj(String question, String QID, String[] options, String answer, String qNo) {
+ this.question = question;
+ this.QID = QID;
+ this.options = options;
+ this.answer = answer;
+ this.qNo = qNo;
+ }
+
+ public JsonObj() {
+ this.question = "not found!";
+ this.QID = "not found!";
+ this.options = new String[]{"not found!"};
+ this.answer = "not found!";
+ this.qNo = "not found!";
+ }
+
+ protected JsonObj(Parcel in) {
+ question = in.readString();
+ QID = in.readString();
+ options = in.createStringArray();
+ answer = in.readString();
+ qNo = in.readString();
+ }
+
+ public static final Creator CREATOR = new Creator() {
+ @Override
+ public JsonObj createFromParcel(Parcel in) {
+ return new JsonObj(in);
+ }
+
+ @Override
+ public JsonObj[] newArray(int size) {
+ return new JsonObj[size];
+ }
+ };
+
+ public String getQuestion() {
+ return question;
+ }
+
+ public void setQuestion(String question) {
+ this.question = question;
+ }
+
+ public String getQID() {
+ return QID;
+ }
+
+ public void setQID(String QID) {
+ this.QID = QID;
+ }
+
+ public String[] getOptions() {
+ return options;
+ }
+
+ public void setOptions(String[] options) {
+ this.options = options;
+ }
+
+ public String getAnswer() {
+ return answer;
+ }
+
+ public void setAnswer(String answer) {
+ this.answer = answer;
+ }
+
+ public String getqNo() {
+ return qNo;
+ }
+
+ public void setqNo(String qNo) {
+ this.qNo = qNo;
+ }
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ @Override
+ public void writeToParcel(Parcel parcel, int i) {
+ parcel.writeString(question);
+ parcel.writeString(QID);
+ parcel.writeStringArray(options);
+ parcel.writeString(answer);
+ parcel.writeString(qNo);
+ }
+}
diff --git a/app/src/main/java/com/example/msq/quizzy/bookmarkPg.java b/app/src/main/java/com/example/msq/quizzy/bookmarkPg.java
new file mode 100644
index 0000000..26761f1
--- /dev/null
+++ b/app/src/main/java/com/example/msq/quizzy/bookmarkPg.java
@@ -0,0 +1,463 @@
+package com.example.msq.quizzy;
+
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.graphics.Typeface;
+import android.support.v7.app.AppCompatActivity;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.GestureDetector;
+import android.view.MotionEvent;
+import android.view.View;
+import android.view.animation.Animation;
+import android.view.animation.AnimationUtils;
+import android.widget.Button;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import com.google.android.gms.ads.AdRequest;
+import com.google.android.gms.ads.AdView;
+import com.google.android.gms.ads.MobileAds;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+public class bookmarkPg extends AppCompatActivity implements GestureDetector.OnGestureListener, View.OnClickListener, Animation.AnimationListener{
+
+ private Set bookmarkIDs = new HashSet<>();
+ private Button option_[] = new Button[4];
+ private Button option[] = new Button[4];
+ private TextView answers[] = new TextView[4];
+ private TextView questionL, questionNo, prevQuestion, nextQuestion, questionR;
+ private LinearLayout options[] = new LinearLayout[4];
+ private Button dashboard, bookmark;
+ private GestureDetector gestureDetector;
+ private static int index;
+ private AdView mAdView;
+ private ArrayList jsonObjBookmark = new ArrayList<>();
+ private ArrayList bookmarked_Qs = new ArrayList<>();
+ private ImageView hintBulb;
+ private String bookmark_IDs[] = new String[100];
+
+ Animation animFadeIn, quesAnimIn, quesAnimOut, quesFadeIn, quesFadeOut;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_bookmark_pg);
+
+ //app id for admob = ca-app-pub-2174142312533088~2596900768
+ //ad unit id = ca-app-pub-2174142312533088/7653786328
+ MobileAds.initialize(this, "ca-app-pub-3940256099942544~3347511713");
+ //MobileAds.initialize(this, "ca-app-pub-2174142312533088~2596900768");
+ mAdView = findViewById(R.id.adView);
+ AdRequest adRequest = new AdRequest.Builder().build();
+ mAdView.loadAd(adRequest);
+
+ index = 1;
+
+ SharedPreferences pref = getApplicationContext().getSharedPreferences("bookmark_sp", MODE_PRIVATE);
+ bookmarkIDs = pref.getStringSet("bookmark_id", null);
+
+ option_[0] = findViewById(R.id.option_A);
+ option_[1] = findViewById(R.id.option_B);
+ option_[2] = findViewById(R.id.option_C);
+ option_[3] = findViewById(R.id.option_D);
+
+ option[0] = findViewById(R.id.optionA);
+ option[1] = findViewById(R.id.optionB);
+ option[2] = findViewById(R.id.optionC);
+ option[3] = findViewById(R.id.optionD);
+
+ options[0] = findViewById(R.id.option1);
+ options[1] = findViewById(R.id.option2);
+ options[2] = findViewById(R.id.option3);
+ options[3] = findViewById(R.id.option4);
+
+ answers[0] = findViewById(R.id.answer_1);
+ answers[1] = findViewById(R.id.answer_2);
+ answers[2] = findViewById(R.id.answer_3);
+ answers[3] = findViewById(R.id.answer_4);
+
+ option[0].setOnClickListener(this);
+ option[1].setOnClickListener(this);
+ option[2].setOnClickListener(this);
+ option[3].setOnClickListener(this);
+
+ option_[0].setOnClickListener(this);
+ option_[1].setOnClickListener(this);
+ option_[2].setOnClickListener(this);
+ option_[3].setOnClickListener(this);
+
+ prevQuestion = findViewById(R.id.prev_question);
+ questionL = findViewById(R.id.question_left);
+ questionR = findViewById(R.id.question_right);
+ nextQuestion = findViewById(R.id.next_question);
+ questionNo = findViewById(R.id.questionNo);
+
+ dashboard = findViewById(R.id.dashboard);
+ bookmark = findViewById(R.id.bookmark);
+
+ hintBulb = findViewById(R.id.hintBulb);
+
+ bookmark.setOnClickListener(this);
+
+ Typeface typefaceProxima = Typeface.createFromAsset(getAssets(), "fonts/proxima.ttf");
+ questionL.setTypeface(typefaceProxima);
+ questionR.setTypeface(typefaceProxima);
+ prevQuestion.setTypeface(typefaceProxima);
+ nextQuestion.setTypeface(typefaceProxima);
+
+ for(int i=0;i<4;i++)
+ answers[i].setTypeface(typefaceProxima);
+
+ int n=0;
+ if(bookmarkIDs != null) {
+ for (String str : bookmarkIDs) {
+ bookmark_IDs[n] = str;
+ n++;
+ }
+ }
+
+ Log.i("In quizePg Total Q's: ", String.valueOf(bookmark_IDs.length));
+
+ jsonObjBookmark = getIntent().getParcelableArrayListExtra("jsonObjBookmark");
+
+ SharedPreferences pref1 = getApplicationContext().getSharedPreferences("bookmark_sp", MODE_PRIVATE);
+ bookmarkIDs = pref1.getStringSet("bookmark_id", null);
+
+ for (String s : bookmarkIDs) {
+ JsonObj j;
+ for(int i=0;i 100 && Math.abs(velocityX) > 100) {
+ //Toast.makeText(this, "left", Toast.LENGTH_SHORT).show();
+ swipeLeft();
+ return true;
+ } else if (e2.getX() - e1.getX() > 100 && Math.abs(velocityX) > 100) {
+ //Toast.makeText(this, "right", Toast.LENGTH_SHORT).show();
+ swipeRight();
+ return true;
+ }
+ else if(e1.getY() - e2.getY() > 100 && Math.abs(velocityY) > 100){
+ swipeUp();
+ }
+ } catch (Exception e) {
+ // nothing
+ }
+ return false;
+ }
+
+ @Override
+ public boolean onTouchEvent(MotionEvent event) {
+ gestureDetector.onTouchEvent(event);
+ return super.onTouchEvent(event);
+ }
+
+ private void swipeRight() {
+
+ hintBulb.setBackgroundResource(R.drawable.bulb_off);
+ String Q_id = bookmarked_Qs.get(index-1).getQID();
+ Iterator iter = bookmarkIDs.iterator();
+ while (iter.hasNext()) {
+ String s = iter.next();
+
+ if (s.equals(Q_id))
+ bookmark.setBackgroundResource(R.drawable.star_two);
+ else
+ bookmark.setBackgroundResource(R.drawable.star);
+ }
+
+ nextQuestion.setAlpha(0);
+ prevQuestion.setAlpha(1);
+
+ for (int i = 0; i < 4; i++) {
+ option[i].setEnabled(true);
+ option_[i].setEnabled(true);
+
+ option[i].setBackgroundResource(R.drawable.options_btn);
+ option_[i].setBackgroundResource(R.drawable.abcd_btn);
+ }
+
+ index--;
+ if (index < 1) {
+ index = 1;
+ return;
+ }
+
+ if (index > bookmarked_Qs.size())
+ index = bookmarked_Qs.size();
+
+
+ if (index >= 1) {
+ questionNo.setText(new StringBuilder().append(String.valueOf(index)).append("/").append(String.valueOf(bookmarked_Qs.size())).toString());
+
+ questionR.startAnimation(quesAnimIn);
+ prevQuestion.startAnimation(quesFadeIn);
+
+ prevQuestion.setText(bookmarked_Qs.get(index - 1).getQuestion());
+ //questionR.setText(jsonObj.get(index - 1).getQuestion());
+
+ String opt[] = bookmarked_Qs.get(index - 1).getOptions();
+ String str;
+ for (int i = 0; i < 4; i++) {
+ str = String.valueOf(opt[i]);
+ answers[i].setText(str);
+ answers[i].startAnimation(quesFadeOut);
+ answers[i].startAnimation(animFadeIn);
+ }
+ }
+
+ }
+
+ private void swipeLeft() {
+
+ hintBulb.setBackgroundResource(R.drawable.bulb_off);
+ String Q_id = bookmarked_Qs.get(index-1).getQID();
+ Iterator iter = bookmarkIDs.iterator();
+ while (iter.hasNext()) {
+ String s = iter.next();
+
+ if (s.equals(Q_id))
+ bookmark.setBackgroundResource(R.drawable.star_two);
+ else
+ bookmark.setBackgroundResource(R.drawable.star);
+
+ }
+
+ prevQuestion.setAlpha(0);
+ nextQuestion.setAlpha(1);
+
+ for(int i=0;i<4;i++){
+ option[i].setEnabled(true);
+ option_[i].setEnabled(true);
+
+ option[i].setBackgroundResource(R.drawable.options_btn);
+ option_[i].setBackgroundResource(R.drawable.abcd_btn);
+ }
+
+ index++;
+ if(index < 1)
+ index = 1;
+
+ if(index > bookmarked_Qs.size()) {
+ index = bookmarked_Qs.size();
+ return;
+ }
+
+ if(index <= bookmarked_Qs.size()) {
+ questionNo.setText(new StringBuilder().append(String.valueOf(index)).append("/").append(String.valueOf(bookmarked_Qs.size())).toString());
+
+ questionL.startAnimation(quesAnimOut);
+ nextQuestion.startAnimation(quesFadeIn);
+
+ nextQuestion.setText(bookmarked_Qs.get(index - 1).getQuestion());
+ //questionL.setText(jsonObj.get(index - 1).getQuestion());
+
+ String opt[] = bookmarked_Qs.get(index - 1).getOptions();
+ String str;
+ for (int i = 0; i < 4; i++) {
+ str = String.valueOf(opt[i]);
+ answers[i].setText(str);
+ answers[i].startAnimation(quesFadeOut);
+ answers[i].startAnimation(animFadeIn);
+ }
+
+ }
+
+ }
+
+ private void swipeUp() {
+ hintBulb.setBackgroundResource(R.drawable.bulb_on);
+
+ option[index - 1].setBackgroundResource(R.drawable.options_btn_yellow);
+ option_[index - 1].setBackgroundResource(R.drawable.abcd_btn_yellow);
+ }
+
+ @Override
+ public void onClick(View view) {
+
+ String qNum = questionNo.getText().toString();
+ String[] parts = qNum.split("/");
+ int currQnNo = Integer.valueOf(parts[0]);
+ String ans = bookmarked_Qs.get(currQnNo-1).getAnswer();
+ int optNo = Integer.valueOf(ans);
+
+ switch(view.getId()){
+ case R.id.option_A:
+ updateButton(optNo, 1);
+ break;
+ case R.id.optionA:
+ updateButton(optNo, 1);
+ break;
+
+ case R.id.option_B:
+ updateButton(optNo, 2);
+ break;
+ case R.id.optionB:
+ updateButton(optNo, 2);
+ break;
+
+ case R.id.option_C:
+ updateButton(optNo, 3);
+ break;
+ case R.id.optionC:
+ updateButton(optNo, 3);
+ break;
+
+ case R.id.option_D:
+ updateButton(optNo, 4);
+ break;
+ case R.id.optionD:
+ updateButton(optNo, 4);
+ break;
+ case R.id.bookmark:
+ unbookmarkQues(index);
+ }
+ }
+
+ private void unbookmarkQues(int index) {
+ bookmark.setBackgroundResource(R.drawable.star);
+ String Q_id = bookmarked_Qs.get(index-1).getQID();
+
+ Iterator iter = bookmarkIDs.iterator();
+
+ while (iter.hasNext()) {
+ String s = iter.next();
+
+ if (s.equals(Q_id))
+ iter.remove();
+ }
+
+ SharedPreferences pref = getApplicationContext().getSharedPreferences("bookmark_sp", MODE_PRIVATE);
+ SharedPreferences.Editor editor = pref.edit();
+ editor.putStringSet("bookmark_id", bookmarkIDs);
+ editor.apply();
+ }
+
+ public void updateButton(int correctOptNo, int choosenOptNo){
+
+ Animation shake = AnimationUtils.loadAnimation(this, R.anim.shake);
+
+ if(correctOptNo != choosenOptNo){
+ option[choosenOptNo-1].setBackgroundResource(R.drawable.options_btn_red);
+ option_[choosenOptNo-1].setBackgroundResource(R.drawable.abcd_btn_red);
+
+ options[choosenOptNo-1].startAnimation(shake);
+
+ option[correctOptNo-1].setBackgroundResource(R.drawable.options_btn_green);
+ option_[correctOptNo-1].setBackgroundResource(R.drawable.abcd_btn_green);
+
+ for(int i=0;i<4;i++){
+ option[i].setEnabled(false);
+ option_[i].setEnabled(false);
+ }
+
+ } else {
+ option[choosenOptNo-1].setBackgroundResource(R.drawable.options_btn_green);
+ option_[choosenOptNo-1].setBackgroundResource(R.drawable.abcd_btn_green);
+
+ for(int i=0;i<4;i++){
+ option[i].setEnabled(false);
+ option_[i].setEnabled(false);
+ }
+ }
+
+ }
+
+ @Override
+ public void onAnimationStart(Animation animation) {
+ if(animation == quesAnimOut)
+ questionL.setAlpha(1);
+ if(animation == quesAnimIn)
+ questionR.setAlpha(1);
+ }
+
+ @Override
+ public void onAnimationEnd(Animation animation) {
+ if(animation == quesAnimOut) {
+ questionL.setText(bookmarked_Qs.get(index - 1).getQuestion());
+ questionL.setAlpha(0);
+ }
+ if(animation == quesAnimIn) {
+ questionR.setAlpha(0);
+ questionR.setText(bookmarked_Qs.get(index - 1).getQuestion());
+ }
+ }
+
+ @Override
+ public void onAnimationRepeat(Animation animation) {
+
+ }
+}
diff --git a/app/src/main/java/com/example/msq/quizzy/homePg.java b/app/src/main/java/com/example/msq/quizzy/homePg.java
index af5ba99..add6945 100644
--- a/app/src/main/java/com/example/msq/quizzy/homePg.java
+++ b/app/src/main/java/com/example/msq/quizzy/homePg.java
@@ -3,7 +3,6 @@
import android.app.ProgressDialog;
import android.content.Intent;
import android.content.SharedPreferences;
-import android.content.pm.ActivityInfo;
import android.graphics.Color;
import android.graphics.Typeface;
import android.graphics.drawable.ColorDrawable;
@@ -17,6 +16,7 @@
import android.webkit.CookieManager;
import android.webkit.CookieSyncManager;
import android.widget.Button;
+import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
@@ -25,6 +25,7 @@
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.JsonArrayRequest;
+import com.android.volley.toolbox.JsonObjectRequest;
import com.android.volley.toolbox.Volley;
import com.facebook.login.LoginManager;
import com.google.android.gms.auth.api.Auth;
@@ -39,10 +40,18 @@
import org.json.JSONException;
import org.json.JSONObject;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Set;
+
+import static android.icu.lang.UCharacter.GraphemeClusterBreak.T;
+
public class homePg extends AppCompatActivity implements View.OnClickListener {
private TextView swiftText, cppText, cLangText, javaText, pythonText, javascriptText, phpText, rubyText, toolbartitle, welcomeNote, confirmationText;
- private Button signOut, yesSignOut, noSignOut;
+ private Button signOut, yesSignOut, noSignOut, swift, cpp, cLang, java, ruby, python, javascript, php, bookmarkPg;
+ private Set bookmarkIDs = new HashSet<>();
+
private RequestQueue requestQueue;
private GoogleApiClient mGoogleApiClient;
@@ -56,6 +65,15 @@ protected void onCreate(Bundle savedInstanceState) {
SharedPreferences pref = getApplicationContext().getSharedPreferences("MyPref", MODE_PRIVATE);
+ swift = findViewById(R.id.swiftIcon);
+ cpp = findViewById(R.id.cppIcon);
+ cLang = findViewById(R.id.cIcon);
+ java = findViewById(R.id.javaIcon);
+ ruby = findViewById(R.id.rubyIcon);
+ python = findViewById(R.id.pythonIcon);
+ javascript = findViewById(R.id.jsIcon);
+ php = findViewById(R.id.phpIcon);
+
swiftText = findViewById(R.id.swiftText);
cppText = findViewById(R.id.cppText);
cLangText = findViewById(R.id.cText);
@@ -69,6 +87,9 @@ protected void onCreate(Bundle savedInstanceState) {
welcomeNote = findViewById(R.id.welcomeNote);
toolbartitle = findViewById(R.id.toolbar_title);
+ bookmarkPg = findViewById(R.id.bookmarkPg);
+ bookmarkPg.setOnClickListener(this);
+
String username = pref.getString("username", null);
if(username == null || username == "coder") {
@@ -90,79 +111,259 @@ protected void onCreate(Bundle savedInstanceState) {
Typeface customFont1 = Typeface.createFromAsset(getAssets(), "fonts/proxima.ttf");
toolbartitle.setTypeface(customFont1);
- requestQueue = Volley.newRequestQueue(this);
+
+ signOut.setOnClickListener(this);
+
+ swift.setOnClickListener(this);
+ cLang.setOnClickListener(this);
+ cpp.setOnClickListener(this);
+ java.setOnClickListener(this);
+ javascript.setOnClickListener(this);
+ php.setOnClickListener(this);
+ python.setOnClickListener(this);
+ ruby.setOnClickListener(this);
+
+ }
+
+ @Override
+ protected void onStart() {
+ GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
+ .requestEmail()
+ .build();
+ mGoogleApiClient = new GoogleApiClient.Builder(this)
+ .addApi(Auth.GOOGLE_SIGN_IN_API, gso)
+ .build();
+ mGoogleApiClient.connect();
+ super.onStart();
+ }
+
+ @Override
+ public void onClick(View view) {
+
+ SharedPreferences pref = getApplicationContext().getSharedPreferences("MyPref", MODE_PRIVATE);
+ SharedPreferences.Editor editor = pref.edit();
+
+ switch(view.getId()){
+
+ case R.id.signOutBtn:
+ editor.putBoolean("isLoggedIn", false);
+ editor.putString("username", "Coder");
+ editor.apply();
+
+ animate();
+ break;
+
+ case R.id.swiftIcon:
+ questions("Swift");
+ break;
+
+ case R.id.cppIcon:
+ questions("C++");
+ break;
+
+ case R.id.cIcon:
+ questions("C");
+ break;
+
+ case R.id.phpIcon:
+ questions("PHP");
+ break;
+
+ case R.id.pythonIcon:
+ questions("Python");
+ break;
+
+ case R.id.rubyIcon:
+ questions("Ruby");
+ break;
+
+ case R.id.javaIcon:
+ questions("Java");
+ break;
+
+ case R.id.jsIcon:
+ questions("Javascript");
+ break;
+ case R.id.bookmarkPg:
+ goToBookmarks();
+ break;
+
+ }
+
+ }
+
+ private void goToBookmarks() {
+
+ final ProgressDialog progressDialog = new ProgressDialog(this);
+ progressDialog.setMessage("Loading...");
+ progressDialog.show();
+
+ final Intent intent = new Intent(homePg.this, bookmarkPg.class);
+ final ArrayList jsonObjBookmark = new ArrayList<>();
+
+ requestQueue = Volley.newRequestQueue(getApplicationContext());
final String url = "http://quizzy-api.herokuapp.com/api/quizzyqa";
//prepare the request
- JsonArrayRequest jsonArrayRequest = new JsonArrayRequest(Request.Method.GET, url, null,
+ final JsonArrayRequest jsonArrayRequest = new JsonArrayRequest(Request.Method.GET, url, null,
new Response.Listener() {
@Override
public void onResponse(JSONArray response) {
// display response
- //Log.d("API Response", response.toString());
-
+ Log.i("Initial API Response", response.toString());
// Process the JSON
try{
// Loop through the array elements
for(int i=0;i jsonObj = new ArrayList<>();
- switch(view.getId()){
+ requestQueue = Volley.newRequestQueue(getApplicationContext());
- case R.id.signOutBtn:
- editor.putBoolean("isLoggedIn", false);
- editor.putString("username", "Coder");
- editor.apply();
+ final String url = "http://quizzy-api.herokuapp.com/api/quizzyqa";
- animate();
- break;
+ //prepare the request
+ final JsonArrayRequest jsonArrayRequest = new JsonArrayRequest(Request.Method.GET, url, null,
+ new Response.Listener() {
+ @Override
+ public void onResponse(JSONArray response) {
+ // display response
+ Log.i("Initial API Response", response.toString());
+ // Process the JSON
+ try{
+ // Loop through the array elements
+ for(int i=0;i() {
@@ -251,6 +449,9 @@ public void onResult(Status status) {
finish();
}
+ //Facebook Logout
+ LoginManager.getInstance().logOut();
+
progressDialog.dismiss();
Intent intent = new Intent(homePg.this, registerPg.class);
diff --git a/app/src/main/java/com/example/msq/quizzy/quizPg.java b/app/src/main/java/com/example/msq/quizzy/quizPg.java
new file mode 100644
index 0000000..6b07940
--- /dev/null
+++ b/app/src/main/java/com/example/msq/quizzy/quizPg.java
@@ -0,0 +1,454 @@
+package com.example.msq.quizzy;
+
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.graphics.Typeface;
+import android.support.v7.app.AppCompatActivity;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.GestureDetector;
+import android.view.MotionEvent;
+import android.view.View;
+import android.widget.Button;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+import android.view.animation.Animation;
+import android.view.animation.AnimationUtils;
+
+import com.google.android.gms.ads.AdRequest;
+import com.google.android.gms.ads.AdView;
+import com.google.android.gms.ads.MobileAds;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+public class quizPg extends AppCompatActivity implements GestureDetector.OnGestureListener, View.OnClickListener, Animation.AnimationListener {
+
+ private LinearLayout options[] = new LinearLayout[4];
+ private TextView questionL, questionNo, lang, prevQuestion, nextQuestion, questionR;
+ private Button option_[] = new Button[4];
+ private Button option[] = new Button[4];
+ private TextView answers[] = new TextView[4];
+ private Button dashboard, bookmark;
+ private GestureDetector gestureDetector;
+ private static int index;
+ private ArrayList jsonObj;
+ private AdView mAdView;
+ private ImageView hintBulb;
+ private Set bookmarkIDs = new HashSet<>();
+ private Set temp = new HashSet<>();
+
+ Animation animFadeIn, quesAnimIn, quesAnimOut, quesFadeIn, quesFadeOut;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState){
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_quiz_pg);
+
+ //app id for admob = ca-app-pub-2174142312533088~2596900768
+ //ad unit id = ca-app-pub-2174142312533088/7653786328
+ MobileAds.initialize(this, "ca-app-pub-3940256099942544~3347511713");
+ //MobileAds.initialize(this, "ca-app-pub-2174142312533088~2596900768");
+ mAdView = findViewById(R.id.adView);
+ AdRequest adRequest = new AdRequest.Builder().build();
+ mAdView.loadAd(adRequest);
+
+ temp.add("abcd");
+ SharedPreferences pref1 = getApplicationContext().getSharedPreferences("bookmark_sp", MODE_PRIVATE);
+ bookmarkIDs = pref1.getStringSet("bookmark_id", temp);
+
+ index = 1;
+
+ option_[0] = findViewById(R.id.option_A);
+ option_[1] = findViewById(R.id.option_B);
+ option_[2] = findViewById(R.id.option_C);
+ option_[3] = findViewById(R.id.option_D);
+
+ option[0] = findViewById(R.id.optionA);
+ option[1] = findViewById(R.id.optionB);
+ option[2] = findViewById(R.id.optionC);
+ option[3] = findViewById(R.id.optionD);
+
+ options[0] = findViewById(R.id.option1);
+ options[1] = findViewById(R.id.option2);
+ options[2] = findViewById(R.id.option3);
+ options[3] = findViewById(R.id.option4);
+
+ answers[0] = findViewById(R.id.answer_1);
+ answers[1] = findViewById(R.id.answer_2);
+ answers[2] = findViewById(R.id.answer_3);
+ answers[3] = findViewById(R.id.answer_4);
+
+ option[0].setOnClickListener(this);
+ option[1].setOnClickListener(this);
+ option[2].setOnClickListener(this);
+ option[3].setOnClickListener(this);
+
+ option_[0].setOnClickListener(this);
+ option_[1].setOnClickListener(this);
+ option_[2].setOnClickListener(this);
+ option_[3].setOnClickListener(this);
+
+ prevQuestion = findViewById(R.id.prev_question);
+ questionL = findViewById(R.id.question_left);
+ questionR = findViewById(R.id.question_right);
+ nextQuestion = findViewById(R.id.next_question);
+ questionNo = findViewById(R.id.questionNo);
+ lang = findViewById(R.id.language);
+
+ dashboard = findViewById(R.id.dashboard);
+ bookmark = findViewById(R.id.bookmark);
+
+ hintBulb = findViewById(R.id.hintBulb);
+
+ bookmark.setOnClickListener(this);
+
+ Typeface typefaceProxima = Typeface.createFromAsset(getAssets(), "fonts/proxima.ttf");
+ questionL.setTypeface(typefaceProxima);
+ questionR.setTypeface(typefaceProxima);
+ prevQuestion.setTypeface(typefaceProxima);
+ nextQuestion.setTypeface(typefaceProxima);
+
+ for(int i=0;i<4;i++)
+ answers[i].setTypeface(typefaceProxima);
+ lang.setTypeface(typefaceProxima);
+
+ jsonObj = getIntent().getParcelableArrayListExtra("jsonObj");
+
+ String Q_id = jsonObj.get(index-1).getQID();
+ Iterator iter = bookmarkIDs.iterator();
+ while (iter.hasNext()) {
+ String s = iter.next();
+
+ if (s.equals(Q_id))
+ bookmark.setBackgroundResource(R.drawable.star_two);
+ else
+ bookmark.setBackgroundResource(R.drawable.star);
+ }
+
+ Log.i("In quizePg Total Q's: ", String.valueOf(jsonObj.size()));
+
+ String language = getIntent().getStringExtra("language");
+
+
+ lang.setText(language);
+ questionNo.setText(new StringBuilder().append(String.valueOf(index)).append("/").append(String.valueOf(jsonObj.size())).toString());
+
+ questionL.setText(jsonObj.get(index-1).getQuestion());
+
+ String opt[] = jsonObj.get(index-1).getOptions();
+ for(int i=0;i<4;i++)
+ answers[i].setText(String.valueOf(opt[i]));
+
+ animFadeIn = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.fade_in);
+ quesAnimIn = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.prev_ques_anim);
+ quesAnimOut = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.next_ques_anim);
+ quesFadeIn = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.ques_fade_in);
+ quesFadeOut = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.ques_fade_out);
+
+ animFadeIn.setAnimationListener(this);
+ quesAnimIn.setAnimationListener(this);
+ quesAnimOut.setAnimationListener(this);
+ quesFadeIn.setAnimationListener(this);
+ quesFadeOut.setAnimationListener(this);
+
+ gestureDetector = new GestureDetector(this);
+ dashboard.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ Intent intent = new Intent(quizPg.this, homePg.class);
+ startActivity(intent);
+ finish();
+ }
+ });
+ }
+
+ @Override
+ public boolean onDown(MotionEvent motionEvent) {
+ return false;
+ }
+
+ @Override
+ public void onShowPress(MotionEvent motionEvent) {
+
+ }
+
+ @Override
+ public boolean onSingleTapUp(MotionEvent motionEvent) {
+ return false;
+ }
+
+ @Override
+ public boolean onScroll(MotionEvent motionEvent, MotionEvent motionEvent1, float v, float v1) {
+ return false;
+ }
+
+ @Override
+ public void onLongPress(MotionEvent motionEvent) {
+
+ }
+
+ @Override
+ public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
+
+ try {
+ if(e1.getX() - e2.getX() > 100 && Math.abs(velocityX) > 100) {
+ //Toast.makeText(this, "left", Toast.LENGTH_SHORT).show();
+ swipeLeft();
+ return true;
+ } else if (e2.getX() - e1.getX() > 100 && Math.abs(velocityX) > 100) {
+ //Toast.makeText(this, "right", Toast.LENGTH_SHORT).show();
+ swipeRight();
+ return true;
+ }
+ else if(e1.getY() - e2.getY() > 100 && Math.abs(velocityY) > 100){
+ swipeUp();
+ }
+ } catch (Exception e) {
+ // nothing
+ }
+ return false;
+ }
+
+ @Override
+ public boolean onTouchEvent(MotionEvent event) {
+ gestureDetector.onTouchEvent(event);
+ return super.onTouchEvent(event);
+ }
+
+ @Override
+ public void onClick(View view) {
+
+ String qNum = questionNo.getText().toString();
+ String[] parts = qNum.split("/");
+ int currQnNo = Integer.valueOf(parts[0]);
+ String ans = jsonObj.get(currQnNo-1).getAnswer();
+ int optNo = Integer.valueOf(ans);
+
+ switch(view.getId()){
+ case R.id.option_A:
+ updateButton(optNo, 1);
+ break;
+ case R.id.optionA:
+ updateButton(optNo, 1);
+ break;
+
+ case R.id.option_B:
+ updateButton(optNo, 2);
+ break;
+ case R.id.optionB:
+ updateButton(optNo, 2);
+ break;
+
+ case R.id.option_C:
+ updateButton(optNo, 3);
+ break;
+ case R.id.optionC:
+ updateButton(optNo, 3);
+ break;
+
+ case R.id.option_D:
+ updateButton(optNo, 4);
+ break;
+ case R.id.optionD:
+ updateButton(optNo, 4);
+ break;
+ case R.id.bookmark:
+ bookmarkQues();
+ }
+ }
+
+ private void bookmarkQues() {
+ bookmark.setBackgroundResource(R.drawable.star_two);
+ String ID = jsonObj.get(index - 1).getQID();
+ bookmarkIDs.add(ID);
+
+ SharedPreferences pref = getApplicationContext().getSharedPreferences("bookmark_sp", MODE_PRIVATE);
+ SharedPreferences.Editor editor = pref.edit();
+ editor.putStringSet("bookmark_id", bookmarkIDs);
+ editor.apply();
+ }
+
+ private void swipeRight() {
+
+ hintBulb.setBackgroundResource(R.drawable.bulb_off);
+
+ String Q_id = jsonObj.get(index-1).getQID();
+ Iterator iter = bookmarkIDs.iterator();
+ while (iter.hasNext()) {
+ String s = iter.next();
+
+ if (s.equals(Q_id))
+ bookmark.setBackgroundResource(R.drawable.star_two);
+ else
+ bookmark.setBackgroundResource(R.drawable.star);
+
+ }
+
+ nextQuestion.setAlpha(0);
+ prevQuestion.setAlpha(1);
+
+ for (int i = 0; i < 4; i++) {
+ option[i].setEnabled(true);
+ option_[i].setEnabled(true);
+
+ option[i].setBackgroundResource(R.drawable.options_btn);
+ option_[i].setBackgroundResource(R.drawable.abcd_btn);
+ }
+
+ index--;
+ if (index < 1) {
+ index = 1;
+ return;
+ }
+
+ if (index > jsonObj.size())
+ index = jsonObj.size();
+
+
+ if (index >= 1) {
+ questionNo.setText(new StringBuilder().append(String.valueOf(index)).append("/").append(String.valueOf(jsonObj.size())).toString());
+
+ questionR.startAnimation(quesAnimIn);
+ prevQuestion.startAnimation(quesFadeIn);
+
+ prevQuestion.setText(jsonObj.get(index - 1).getQuestion());
+ //questionR.setText(jsonObj.get(index - 1).getQuestion());
+
+ String opt[] = jsonObj.get(index - 1).getOptions();
+ String str;
+ for (int i = 0; i < 4; i++) {
+ str = String.valueOf(opt[i]);
+ answers[i].setText(str);
+ answers[i].startAnimation(quesFadeOut);
+ answers[i].startAnimation(animFadeIn);
+ }
+ }
+
+ }
+
+ private void swipeLeft() {
+
+ hintBulb.setBackgroundResource(R.drawable.bulb_off);
+
+ String Q_id = jsonObj.get(index-1).getQID();
+ Iterator iter = bookmarkIDs.iterator();
+ while (iter.hasNext()) {
+ String s = iter.next();
+
+ if (s.equals(Q_id))
+ bookmark.setBackgroundResource(R.drawable.star_two);
+ else
+ bookmark.setBackgroundResource(R.drawable.star);
+
+ }
+
+ prevQuestion.setAlpha(0);
+ nextQuestion.setAlpha(1);
+
+ for(int i=0;i<4;i++){
+ option[i].setEnabled(true);
+ option_[i].setEnabled(true);
+
+ option[i].setBackgroundResource(R.drawable.options_btn);
+ option_[i].setBackgroundResource(R.drawable.abcd_btn);
+ }
+
+ index++;
+ if(index < 1)
+ index = 1;
+
+ if(index > jsonObj.size()) {
+ index = jsonObj.size();
+ return;
+ }
+
+ if(index <= jsonObj.size()) {
+ questionNo.setText(new StringBuilder().append(String.valueOf(index)).append("/").append(String.valueOf(jsonObj.size())).toString());
+
+ questionL.startAnimation(quesAnimOut);
+ nextQuestion.startAnimation(quesFadeIn);
+
+ nextQuestion.setText(jsonObj.get(index - 1).getQuestion());
+ //questionL.setText(jsonObj.get(index - 1).getQuestion());
+
+ String opt[] = jsonObj.get(index - 1).getOptions();
+ String str;
+ for (int i = 0; i < 4; i++) {
+ str = String.valueOf(opt[i]);
+ answers[i].setText(str);
+ answers[i].startAnimation(quesFadeOut);
+ answers[i].startAnimation(animFadeIn);
+ }
+
+ }
+
+ }
+
+ private void swipeUp() {
+ hintBulb.setBackgroundResource(R.drawable.bulb_on);
+
+ option[index - 1].setBackgroundResource(R.drawable.options_btn_yellow);
+ option_[index - 1].setBackgroundResource(R.drawable.abcd_btn_yellow);
+ }
+
+ public void updateButton(int correctOptNo, int choosenOptNo){
+
+ Animation shake = AnimationUtils.loadAnimation(this, R.anim.shake);
+
+ if(correctOptNo != choosenOptNo){
+ option[choosenOptNo-1].setBackgroundResource(R.drawable.options_btn_red);
+ option_[choosenOptNo-1].setBackgroundResource(R.drawable.abcd_btn_red);
+
+ options[choosenOptNo-1].startAnimation(shake);
+
+ option[correctOptNo-1].setBackgroundResource(R.drawable.options_btn_green);
+ option_[correctOptNo-1].setBackgroundResource(R.drawable.abcd_btn_green);
+
+ for(int i=0;i<4;i++){
+ option[i].setEnabled(false);
+ option_[i].setEnabled(false);
+ }
+
+ } else {
+ option[choosenOptNo-1].setBackgroundResource(R.drawable.options_btn_green);
+ option_[choosenOptNo-1].setBackgroundResource(R.drawable.abcd_btn_green);
+
+ for(int i=0;i<4;i++){
+ option[i].setEnabled(false);
+ option_[i].setEnabled(false);
+ }
+ }
+
+ }
+
+ @Override
+ public void onAnimationStart(Animation animation) {
+ if(animation == quesAnimOut)
+ questionL.setAlpha(1);
+ if(animation == quesAnimIn)
+ questionR.setAlpha(1);
+ }
+
+ @Override
+ public void onAnimationEnd(Animation animation) {
+ if(animation == quesAnimOut) {
+ questionL.setText(jsonObj.get(index - 1).getQuestion());
+ questionL.setAlpha(0);
+ }
+ if(animation == quesAnimIn) {
+ questionR.setAlpha(0);
+ questionR.setText(jsonObj.get(index - 1).getQuestion());
+ }
+ }
+
+ @Override
+ public void onAnimationRepeat(Animation animation) {
+
+ }
+
+}
diff --git a/app/src/main/java/com/example/msq/quizzy/registerPg.java b/app/src/main/java/com/example/msq/quizzy/registerPg.java
index 85bee63..4c0301b 100644
--- a/app/src/main/java/com/example/msq/quizzy/registerPg.java
+++ b/app/src/main/java/com/example/msq/quizzy/registerPg.java
@@ -451,7 +451,7 @@ public void onResponse(String response) {
progressDialog.dismiss();
editor.putBoolean("isLoggedIn", true);
- editor.putString("username", QuizzerNameL.getText().toString());
+ editor.putString("username", QuizzerNameR.getText().toString());
editor.apply();
Intent intent = new Intent(registerPg.this, homePg.class);
diff --git a/app/src/main/res/anim/fade_in.xml b/app/src/main/res/anim/fade_in.xml
new file mode 100644
index 0000000..e103445
--- /dev/null
+++ b/app/src/main/res/anim/fade_in.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/anim/fade_out.xml b/app/src/main/res/anim/fade_out.xml
new file mode 100644
index 0000000..4ebd4e2
--- /dev/null
+++ b/app/src/main/res/anim/fade_out.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/anim/next_ques_anim.xml b/app/src/main/res/anim/next_ques_anim.xml
new file mode 100644
index 0000000..2fd79c0
--- /dev/null
+++ b/app/src/main/res/anim/next_ques_anim.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/anim/prev_ques_anim.xml b/app/src/main/res/anim/prev_ques_anim.xml
new file mode 100644
index 0000000..6d0b192
--- /dev/null
+++ b/app/src/main/res/anim/prev_ques_anim.xml
@@ -0,0 +1,7 @@
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/anim/ques_fade_in.xml b/app/src/main/res/anim/ques_fade_in.xml
new file mode 100644
index 0000000..9011992
--- /dev/null
+++ b/app/src/main/res/anim/ques_fade_in.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/anim/ques_fade_out.xml b/app/src/main/res/anim/ques_fade_out.xml
new file mode 100644
index 0000000..8355d6f
--- /dev/null
+++ b/app/src/main/res/anim/ques_fade_out.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/anim/shake.xml b/app/src/main/res/anim/shake.xml
new file mode 100644
index 0000000..a7e7b02
--- /dev/null
+++ b/app/src/main/res/anim/shake.xml
@@ -0,0 +1,8 @@
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/abcd_btn.xml b/app/src/main/res/drawable/abcd_btn.xml
new file mode 100644
index 0000000..ee1223f
--- /dev/null
+++ b/app/src/main/res/drawable/abcd_btn.xml
@@ -0,0 +1,10 @@
+
+
+ -
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/abcd_btn_green.xml b/app/src/main/res/drawable/abcd_btn_green.xml
new file mode 100644
index 0000000..01b6b57
--- /dev/null
+++ b/app/src/main/res/drawable/abcd_btn_green.xml
@@ -0,0 +1,10 @@
+
+
+ -
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/abcd_btn_red.xml b/app/src/main/res/drawable/abcd_btn_red.xml
new file mode 100644
index 0000000..28dbffe
--- /dev/null
+++ b/app/src/main/res/drawable/abcd_btn_red.xml
@@ -0,0 +1,10 @@
+
+
+ -
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/abcd_btn_yellow.xml b/app/src/main/res/drawable/abcd_btn_yellow.xml
new file mode 100644
index 0000000..03f2cb9
--- /dev/null
+++ b/app/src/main/res/drawable/abcd_btn_yellow.xml
@@ -0,0 +1,10 @@
+
+
+ -
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/bulb_off.png b/app/src/main/res/drawable/bulb_off.png
new file mode 100644
index 0000000..28d2a93
Binary files /dev/null and b/app/src/main/res/drawable/bulb_off.png differ
diff --git a/app/src/main/res/drawable/bulb_on.png b/app/src/main/res/drawable/bulb_on.png
new file mode 100644
index 0000000..43e06a3
Binary files /dev/null and b/app/src/main/res/drawable/bulb_on.png differ
diff --git a/app/src/main/res/drawable/options_btn.xml b/app/src/main/res/drawable/options_btn.xml
new file mode 100644
index 0000000..82069d6
--- /dev/null
+++ b/app/src/main/res/drawable/options_btn.xml
@@ -0,0 +1,12 @@
+
+
+ -
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/options_btn_green.xml b/app/src/main/res/drawable/options_btn_green.xml
new file mode 100644
index 0000000..136f558
--- /dev/null
+++ b/app/src/main/res/drawable/options_btn_green.xml
@@ -0,0 +1,12 @@
+
+
+ -
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/options_btn_red.xml b/app/src/main/res/drawable/options_btn_red.xml
new file mode 100644
index 0000000..8119117
--- /dev/null
+++ b/app/src/main/res/drawable/options_btn_red.xml
@@ -0,0 +1,12 @@
+
+
+ -
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/options_btn_yellow.xml b/app/src/main/res/drawable/options_btn_yellow.xml
new file mode 100644
index 0000000..63a4846
--- /dev/null
+++ b/app/src/main/res/drawable/options_btn_yellow.xml
@@ -0,0 +1,12 @@
+
+
+ -
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/quiz_pg_bg.png b/app/src/main/res/drawable/quiz_pg_bg.png
new file mode 100644
index 0000000..bda5a12
Binary files /dev/null and b/app/src/main/res/drawable/quiz_pg_bg.png differ
diff --git a/app/src/main/res/drawable/star.png b/app/src/main/res/drawable/star.png
new file mode 100644
index 0000000..3f166fe
Binary files /dev/null and b/app/src/main/res/drawable/star.png differ
diff --git a/app/src/main/res/drawable/star_two.png b/app/src/main/res/drawable/star_two.png
new file mode 100644
index 0000000..a9c25f4
Binary files /dev/null and b/app/src/main/res/drawable/star_two.png differ
diff --git a/app/src/main/res/layout/activity_bookmark_pg.xml b/app/src/main/res/layout/activity_bookmark_pg.xml
new file mode 100644
index 0000000..dc3beec
--- /dev/null
+++ b/app/src/main/res/layout/activity_bookmark_pg.xml
@@ -0,0 +1,359 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_home_pg.xml b/app/src/main/res/layout/activity_home_pg.xml
index ba7f4ad..8dcae4f 100644
--- a/app/src/main/res/layout/activity_home_pg.xml
+++ b/app/src/main/res/layout/activity_home_pg.xml
@@ -382,7 +382,7 @@
android:contentDescription="@string/bookmarkicon"/>