Skip to content
Merged
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
File renamed without changes.
24 changes: 24 additions & 0 deletions .idea/ProjectCode.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
2 changes: 2 additions & 0 deletions MyApplication2/.idea/gradle.xml → .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
4 changes: 3 additions & 1 deletion MyApplication2/.idea/modules.xml → .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
2 changes: 1 addition & 1 deletion MyApplication2/.idea/vcs.xml → .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5,393 changes: 5,393 additions & 0 deletions .idea/workspace.xml

Large diffs are not rendered by default.

22 changes: 22 additions & 0 deletions MyApplication/.idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions MyApplication/.idea/copyright/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions MyApplication/.idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ public class UserPreferences {
private boolean sound;
private String color;


public UserPreferences()
{
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(ProjectActivity.getAppContext());
sound = prefs.getBoolean("Sound",true);
color = prefs.getString("Color","white");

}

public void setColor(String newcolor)
Expand All @@ -42,6 +42,7 @@ public void setSound(boolean vol)
this.sound = vol;
}


public boolean checkSound()
{
return sound;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ public class Questions {

public Questions() {
//empty constructor


}

public Questions (String Question, String PA1, String PA2, String PA3, String PA4, String Answer){
Expand All @@ -31,22 +33,42 @@ public Questions (String Question, String PA1, String PA2, String PA3, String PA
public String getQuestion(){
return Question;
}
{
PA1 = "This is a test";
}


public String getPA1(){
return PA1;
}
{
PA1 = "This is a test";
}

public String getPA2(){
return PA2;
}

{
PA2 = "This is a test";
}

public String getPA3(){
return PA3;
}

{
PA3 = "This is a test";
}

public String getPA4(){
return PA4;
}
{
PA4 = "This is a test";
}


public String getAnswer(){
return Answer;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,154 @@
PROJECT CODE
*/

import android.support.annotation.IdRes;
import android.support.v4.app.Fragment;
import android.view.View;
import android.view.ViewGroup;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.widget.Button;
import android.widget.CompoundButton;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.Toast;
import android.widget.ToggleButton;


public class Tab3Quiz extends Fragment{

Questions question;
int questionnum;
RadioButton ans1;
RadioButton ans2;
RadioButton ans3;
RadioButton ans4;

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.tab3_quiz, container, false);
// Handling View
final View rootView = inflater.inflate(R.layout.tab3_quiz, container, false);


Button submit = (Button) rootView.findViewById(R.id.submit);

ans1 = (RadioButton) rootView.findViewById(R.id.ans1);
ans2 = (RadioButton) rootView.findViewById(R.id.ans2);
ans3 = (RadioButton) rootView.findViewById(R.id.ans3);
ans4 = (RadioButton) rootView.findViewById(R.id.ans4);

//GET QUESTION NUM FROM SHARED PREFEREENCES


// getNextQuestion();
question = new Questions("How's the best?","Dude","Other","Gal","Friend","Dude");
// get question/possible answer from db

ans1.setText(question.getPA1());
ans2.setText(question.getPA2());
ans3.setText(question.getPA3());
ans4.setText(question.getPA4());

submit.setOnClickListener(new View.OnClickListener()
{
public void onClick(View v)
{


if( ans1.isChecked())
{
if(question.getAnswer().equals(ans1.getText().toString()))
{
// Right answer
Toast.makeText(Tutorial.getAppContext(), R.string.right, Toast.LENGTH_SHORT).show();
}
else{
//Wrong Answer
Toast.makeText(Tutorial.getAppContext(),R.string.wrong, Toast.LENGTH_SHORT).show();
}
}

else if( ans2.isChecked())
{
if(question.getAnswer().equals(ans2.getText().toString()))
{
// Right answer
Toast.makeText(Tutorial.getAppContext(), R.string.right, Toast.LENGTH_SHORT).show();
}
else{
//Wrong Answer
Toast.makeText(Tutorial.getAppContext(),R.string.wrong, Toast.LENGTH_SHORT).show();
}
}
else if( ans3.isChecked())
{
if(question.getAnswer().equals(ans3.getText().toString()))
{
// Right answer
Toast.makeText(Tutorial.getAppContext(), R.string.right, Toast.LENGTH_SHORT).show();
}
else{
//Wrong Answer
Toast.makeText(Tutorial.getAppContext(),R.string.wrong, Toast.LENGTH_SHORT).show();
}
}
else if( ans4.isChecked())
{
if(question.getAnswer().equals(ans4.getText().toString()))
{
// Right answer
Toast.makeText(Tutorial.getAppContext(), R.string.right, Toast.LENGTH_SHORT).show();
}
else{
//Wrong Answer
Toast.makeText(Tutorial.getAppContext(),R.string.wrong, Toast.LENGTH_SHORT).show();
}
}
}
});



/* ToggleButton tog = (ToggleButton) view.findViewById(R.id.soundtog);
tog.setChecked(prefs.checkSound());
tog.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) {
// The toggle is enabled
prefs.setSound(true);

} else {
// The toggle is disabled
prefs.setSound(false);

}
}*/
// });


return rootView;
}

public void questionRight()
{
questionnum ++;
// Store new questionnum to Shared Preferences
}

public void getNextQuestions()
{
// Get new questions from DB Call DB
// DBHandler.getQuestion(questionnum);

// public Questions getQuestion(int qu1estionnum){ }

Questions newquest = new Questions(); // make it equal to the information pulled from the db
question = newquest;
ans1.setText(question.getPA1());
ans2.setText(question.getPA2());
ans3.setText(question.getPA3());
ans4.setText(question.getPA4());
}

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.example.tutorials;

import android.content.Context;
import android.support.design.widget.TabLayout;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
Expand Down Expand Up @@ -42,11 +43,13 @@ public class Tutorial extends AppCompatActivity {
* The {@link ViewPager} that will host the section contents.
*/
private ViewPager mViewPager;
private static Context context;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_tutorial);
Tutorial.context = getApplicationContext();

Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
Expand All @@ -73,6 +76,10 @@ public void onClick(View view) {
});

}
public static Context getAppContext()
{
return Tutorial.context;
}


@Override
Expand Down
4 changes: 2 additions & 2 deletions MyApplication/tutorials/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
<string name="letters">Letters</string>
<string name="numbers">Numbers</string>
<string name="quiz">Quiz Time!</string>
<string name="letters">Letters</string>
<string name="numbers">Numbers</string>
<string name="quizstring">Quiz</string>
<string name="right">Right</string>
<string name="wrong">Wrong</string>

</resources>
10 changes: 0 additions & 10 deletions MyApplication2/.idea/inspectionProfiles/Project_Default.xml

This file was deleted.

7 changes: 0 additions & 7 deletions MyApplication2/.idea/inspectionProfiles/profiles_settings.xml

This file was deleted.

Loading