Skip to content

Commit cea75fc

Browse files
committed
Initial commit
0 parents  commit cea75fc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1134
-0
lines changed

.gitignore

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
*.iml
2+
.gradle
3+
/local.properties
4+
/.idea/workspace.xml
5+
/.idea/libraries
6+
.DS_Store
7+
/build
8+
/captures
9+
.externalNativeBuild

.idea/gradle.xml

+18
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

+33
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

+9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/runConfigurations.xml

+12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

app/build.gradle

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
apply plugin: 'com.android.application'
2+
3+
android {
4+
compileSdkVersion 27
5+
defaultConfig {
6+
applicationId "com.daw.jp.genioquiz"
7+
minSdkVersion 17
8+
targetSdkVersion 27
9+
versionCode 1
10+
versionName "1.0"
11+
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
12+
}
13+
buildTypes {
14+
release {
15+
minifyEnabled false
16+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
17+
}
18+
}
19+
}
20+
21+
dependencies {
22+
implementation fileTree(dir: 'libs', include: ['*.jar'])
23+
implementation 'com.android.support:appcompat-v7:27.1.1'
24+
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
25+
testImplementation 'junit:junit:4.12'
26+
androidTestImplementation 'com.android.support.test:runner:1.0.2'
27+
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
28+
}

app/proguard-rules.pro

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package com.daw.jp.genioquiz;
2+
3+
import android.content.Context;
4+
import android.support.test.InstrumentationRegistry;
5+
import android.support.test.runner.AndroidJUnit4;
6+
7+
import org.junit.Test;
8+
import org.junit.runner.RunWith;
9+
10+
import static org.junit.Assert.*;
11+
12+
/**
13+
* Instrumented test, which will execute on an Android device.
14+
*
15+
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
16+
*/
17+
@RunWith(AndroidJUnit4.class)
18+
public class ExampleInstrumentedTest {
19+
@Test
20+
public void useAppContext() throws Exception {
21+
// Context of the app under test.
22+
Context appContext = InstrumentationRegistry.getTargetContext();
23+
24+
assertEquals("com.daw.jp.genioquiz", appContext.getPackageName());
25+
}
26+
}

app/src/main/AndroidManifest.xml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="com.daw.jp.genioquiz">
4+
5+
<application
6+
android:allowBackup="true"
7+
android:icon="@mipmap/ic_launcher"
8+
android:label="@string/app_name"
9+
android:roundIcon="@mipmap/ic_launcher_round"
10+
android:supportsRtl="true"
11+
android:theme="@style/AppTheme">
12+
<activity android:name=".MainActivity">
13+
<intent-filter>
14+
<action android:name="android.intent.action.MAIN" />
15+
16+
<category android:name="android.intent.category.LAUNCHER" />
17+
</intent-filter>
18+
</activity>
19+
<activity android:name=".TelaPergunta"/>
20+
</application>
21+
22+
</manifest>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
package com.daw.jp.genioquiz;
2+
3+
import java.util.ArrayList;
4+
import java.util.Random;
5+
6+
public class GerenciadorPergunta {
7+
private ArrayList<Pergunta> perguntas;
8+
private Pergunta atual;
9+
10+
public GerenciadorPergunta() {
11+
perguntas = new ArrayList<>();
12+
ArrayList<Integer> valores = new ArrayList<Integer>() {
13+
{
14+
add(0);
15+
add(1);
16+
add(0);
17+
add(1);
18+
}
19+
};
20+
perguntas.add(new Pergunta("(Nanatsu No Taizai) Qual desses são Pecados?", "Meliodas", "Zeldris", "Diane", "Hawk", valores));
21+
valores = new ArrayList<Integer>() {
22+
{
23+
add(0);
24+
add(1);
25+
add(1);
26+
add(1);
27+
}
28+
};
29+
perguntas.add(new Pergunta("(Nanatsu No Taizai) Qual desses são Mandamentos?", "Ban", "Grayroad", "Estarossa", "Fraudrin", valores));
30+
valores = new ArrayList<Integer>() {
31+
{
32+
add(1);
33+
add(0);
34+
add(0);
35+
add(1);
36+
}
37+
};
38+
perguntas.add(new Pergunta("(Nanatsu No Taizai) Qual desses são Tesouros Sagrados?", "Chastiefol", "King", "Aranak", "Rhitta", valores));
39+
valores = new ArrayList<Integer>() {
40+
{
41+
add(0);
42+
add(1);
43+
add(0);
44+
add(0);
45+
}
46+
};
47+
perguntas.add(new Pergunta("(Nanatsu No Taizai) Qual desses são membro do Clã dos Gigantes?", "Gloxinia", "Drole", "Gowther", "Gideon", valores));
48+
valores = new ArrayList<Integer>() {
49+
{
50+
add(1);
51+
add(0);
52+
add(1);
53+
add(0);
54+
}
55+
};
56+
perguntas.add(new Pergunta("(Nanatsu No Taizai) Qual desses são membro do Clã das Fadas?", "Elaine", "Gideon", "Gloxinia", "Galand", valores));
57+
valores = new ArrayList<Integer>() {
58+
{
59+
add(1);
60+
add(0);
61+
add(0);
62+
add(1);
63+
}
64+
};
65+
perguntas.add(new Pergunta("(Boku No Hero) Qual desses são alunos da U.A?", "Midoriya", "Aizawa", "Shigaraki", "Bakugo", valores));
66+
valores = new ArrayList<Integer>() {
67+
{
68+
add(0);
69+
add(1);
70+
add(1);
71+
add(0);
72+
}
73+
};
74+
perguntas.add(new Pergunta("(Boku No Hero) Quais individualidades o Nomu que enfrenta All Might possui?", "Teletransposte", "Regeneração", "Absorvição de impacto", "Gelo e Fogo", valores));
75+
76+
}
77+
78+
public Pergunta novaPergunta(){
79+
int local = new Random().nextInt(perguntas.size());
80+
this.atual = perguntas.remove(local);
81+
return this.atual;
82+
}
83+
84+
public int verificarResposta(int r1, int r2, int r3, int r4){
85+
int cont = 0;
86+
if (atual.getCorretas().get(0) == r1){
87+
cont += 5;
88+
}
89+
if (atual.getCorretas().get(1) == r2){
90+
cont += 5;
91+
}
92+
if (atual.getCorretas().get(2) == r3){
93+
cont += 5;
94+
}
95+
if (atual.getCorretas().get(3) == r4){
96+
cont += 5;
97+
}
98+
return cont;
99+
}
100+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package com.daw.jp.genioquiz;
2+
3+
import android.content.Intent;
4+
import android.support.v7.app.AppCompatActivity;
5+
import android.os.Bundle;
6+
import android.view.View;
7+
import android.widget.ImageButton;
8+
9+
public class MainActivity extends AppCompatActivity {
10+
11+
ImageButton btn;
12+
13+
@Override
14+
protected void onCreate(Bundle savedInstanceState) {
15+
super.onCreate(savedInstanceState);
16+
setContentView(R.layout.activity_main);
17+
btn = findViewById(R.id.btn_comecar);
18+
19+
btn.setOnClickListener(new View.OnClickListener() {
20+
21+
@Override
22+
public void onClick(View v) {
23+
Intent it = new Intent(v.getContext(), TelaPergunta.class);
24+
startActivity(it);
25+
}
26+
});
27+
}
28+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
package com.daw.jp.genioquiz;
2+
3+
import java.util.ArrayList;
4+
5+
/**
6+
* Created by Aluno on 27/04/2018.
7+
*/
8+
9+
public class Pergunta {
10+
private String pergunta;
11+
private String alt1;
12+
private String alt2;
13+
private String alt3;
14+
private String alt4;
15+
private ArrayList<Integer> corretas;
16+
17+
public Pergunta(String pergunta, String alt1, String alt2, String alt3, String alt4, ArrayList<Integer> corretas) {
18+
this.pergunta = pergunta;
19+
this.alt1 = alt1;
20+
this.alt2 = alt2;
21+
this.alt3 = alt3;
22+
this.alt4 = alt4;
23+
this.corretas = corretas;
24+
}
25+
26+
public String getPergunta() {
27+
return pergunta;
28+
}
29+
30+
public void setPergunta(String pergunta) {
31+
this.pergunta = pergunta;
32+
}
33+
34+
public String getAlt1() {
35+
return alt1;
36+
}
37+
38+
public void setAlt1(String alt1) {
39+
this.alt1 = alt1;
40+
}
41+
42+
public String getAlt2() {
43+
return alt2;
44+
}
45+
46+
public void setAlt2(String alt2) {
47+
this.alt2 = alt2;
48+
}
49+
50+
public String getAlt3() {
51+
return alt3;
52+
}
53+
54+
public void setAlt3(String alt3) {
55+
this.alt3 = alt3;
56+
}
57+
58+
public String getAlt4() {
59+
return alt4;
60+
}
61+
62+
public void setAlt4(String alt4) {
63+
this.alt4 = alt4;
64+
}
65+
66+
public ArrayList<Integer> getCorretas() {
67+
return corretas;
68+
}
69+
70+
public void setCorretas(ArrayList<Integer> corretas) {
71+
this.corretas = corretas;
72+
}
73+
}

0 commit comments

Comments
 (0)