Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion android-app/.idea/.name

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

3 changes: 2 additions & 1 deletion android-app/.idea/gradle.xml

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

2 changes: 1 addition & 1 deletion android-app/.idea/vcs.xml

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

4 changes: 3 additions & 1 deletion android-app/android-app.iml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="true">
<component name="NewModuleRootManager" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/build/classes/main" />
<output-test url="file://$MODULE_DIR$/build/classes/test" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
Expand Down
27 changes: 9 additions & 18 deletions android-app/app/app.iml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
<facet type="android" name="Android">
<configuration>
<option name="SELECTED_BUILD_VARIANT" value="debug" />
<option name="SELECTED_TEST_ARTIFACT" value="_android_test_" />
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
<option name="ASSEMBLE_TEST_TASK_NAME" value="assembleDebugTest" />
Expand Down Expand Up @@ -85,32 +84,24 @@
</content>
<orderEntry type="jdk" jdkName="Android API 21 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="google-oauth-client-1.19.0" level="project" />
<orderEntry type="library" exported="" name="droidicon-0.1.6" level="project" />
<orderEntry type="library" exported="" name="sugar-1.3" level="project" />
<orderEntry type="library" exported="" name="picasso-2.5.0" level="project" />
<orderEntry type="library" exported="" name="play-services-6.5.87" level="project" />
<orderEntry type="library" exported="" name="sugar-1.3" level="project" />
<orderEntry type="library" exported="" name="jackson-core-2.1.3" level="project" />
<orderEntry type="library" exported="" name="Parse-1.7.1" level="project" />
<orderEntry type="library" exported="" name="gridlayout-v7-21.0.3" level="project" />
<orderEntry type="library" exported="" name="Parse-1.7.1" level="project" />
<orderEntry type="library" exported="" name="support-v4-21.0.3" level="project" />
<orderEntry type="library" exported="" name="cardview-v7-21.0.3" level="project" />
<orderEntry type="library" exported="" name="aspectjrt-1.7.4" level="project" />
<orderEntry type="library" exported="" name="appcompat-v7-21.0.3" level="project" />
<orderEntry type="library" exported="" name="hugo-annotations-1.1.0" level="project" />
<orderEntry type="library" exported="" name="guava-jdk5-13.0" level="project" />
<orderEntry type="library" exported="" name="google-http-client-jackson2-1.19.0" level="project" />
<orderEntry type="library" exported="" name="jsr305-1.3.9" level="project" />
<orderEntry type="library" exported="" name="droidicon-0.1.6" level="project" />
<orderEntry type="library" exported="" name="google-api-client-1.19.1" level="project" />
<orderEntry type="library" exported="" name="retrofit-1.9.0" level="project" />
<orderEntry type="library" exported="" name="cardview-v7-21.0.3" level="project" />
<orderEntry type="library" exported="" name="hugo-runtime-1.1.0" level="project" />
<orderEntry type="library" exported="" name="recyclerview-v7-21.0.3" level="project" />
<orderEntry type="library" exported="" name="google-api-services-youtube-v3-rev126-1.19.1" level="project" />
<orderEntry type="library" exported="" name="gson-2.3.1" level="project" />
<orderEntry type="library" exported="" name="aspectjrt-1.7.4" level="project" />
<orderEntry type="library" exported="" name="support-v13-21.0.3" level="project" />
<orderEntry type="library" exported="" name="google-http-client-1.19.0" level="project" />
<orderEntry type="library" exported="" name="gson-2.3.1" level="project" />
<orderEntry type="library" exported="" name="appcompat-v7-21.0.3" level="project" />
<orderEntry type="library" exported="" name="hugo-annotations-1.1.0" level="project" />
<orderEntry type="library" exported="" name="support-annotations-21.0.3" level="project" />
<orderEntry type="library" exported="" name="supertoasts-1.3.4" level="project" />
<orderEntry type="library" exported="" name="bolts-android-1.1.4" level="project" />
</component>
</module>

10 changes: 8 additions & 2 deletions android-app/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ apply plugin: 'hugo'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
dexOptions {
jumboMode true
}

defaultConfig {
applicationId "com.mateoj.hacku3"
Expand All @@ -27,6 +30,10 @@ android {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

Expand All @@ -48,8 +55,7 @@ dependencies {
compile 'com.squareup.picasso:picasso:2.5.0'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.github.satyan:sugar:1.3'
compile 'com.github.johnpersano:supertoasts:1.3.4@aar'
compile 'com.github.theDazzler:droidicon:0.1.6@aar'
compile 'com.google.apis:google-api-services-youtube:v3-rev126-1.19.1'
compile files('libs/Parse-1.7.1.jar')
compile 'com.parse.bolts:bolts-android:1.+'
}
3 changes: 3 additions & 0 deletions android-app/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:name=".MyApp"
android:theme="@style/AppTheme"
tools:replace="android:icon " >
<activity
Expand Down
108 changes: 108 additions & 0 deletions android-app/app/src/main/java/com/mateoj/hacku3/Assessment.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
package com.mateoj.hacku3;

import com.mateoj.hacku3.models.Question;
import com.mateoj.hacku3.models.Topic;
import com.mateoj.hacku3.models.Video;

import java.util.List;

/**
* Created by jose on 2/12/15.
*/
public class Assessment {
public enum Mode{
Practice,
ForReals
}

private static Assessment currentAssessment;

public static Assessment getCurrentAssessment() {
if( currentAssessment == null) {
currentAssessment = new Assessment();
}

return currentAssessment;
}

List<Question> questionsAnswered;

List<Video> videos;

Mode currentMode;

Topic topic;


/**
* Gets topic.
*
* @return Value of topic.
*/
public Topic getTopic() {
return topic;
}

/**
* Sets new topic.
*
* @param topic New value of topic.
*/
public void setTopic(Topic topic) {
this.topic = topic;
}

/**
* Gets questionsAnswered.
*
* @return Value of questionsAnswered.
*/
public List<Question> getQuestionsAnswered() {
return questionsAnswered;
}

/**
* Sets new videos.
*
* @param videos New value of videos.
*/
public void setVideos(List<Video> videos) {
this.videos = videos;
}

/**
* Gets videos.
*
* @return Value of videos.
*/
public List<Video> getVideos() {
return videos;
}

/**
* Sets new questionsAnswered.
*
* @param questionsAnswered New value of questionsAnswered.
*/
public void setQuestionsAnswered(List<Question> questionsAnswered) {
this.questionsAnswered = questionsAnswered;
}

/**
* Sets new currentMode.
*
* @param currentMode New value of currentMode.
*/
public void setCurrentMode(Mode currentMode) {
this.currentMode = currentMode;
}

/**
* Gets currentMode.
*
* @return Value of currentMode.
*/
public Mode getCurrentMode() {
return currentMode;
}
}
59 changes: 52 additions & 7 deletions android-app/app/src/main/java/com/mateoj/hacku3/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.widget.CardView;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.AlphaAnimation;
import android.widget.TextView;
import android.widget.Toast;

Expand Down Expand Up @@ -78,23 +80,66 @@ public ViewHolder(View itemView) {
}
}

private void fade(View outgoing, View incoming) {
AlphaAnimation fadeOut = new AlphaAnimation(1, 0);
AlphaAnimation fadeIn = new AlphaAnimation(0, 1);
fadeIn.setDuration(500);
fadeOut.setDuration(500);
outgoing.setAnimation(fadeOut);
incoming.setAnimation(fadeIn);
outgoing.setVisibility(View.INVISIBLE);
incoming.setVisibility(View.VISIBLE);
}

@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.category_row, parent, false);
final View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.category_row, parent, false);
final ViewHolder viewHolder = new ViewHolder(view);
view.setOnClickListener(new View.OnClickListener() {
final CardView topicSelection = (CardView) view.findViewById(R.id.topicSelection);
topicSelection.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Topic topic = allCategories.get(viewHolder.getPosition());
Intent intent = new Intent(MainActivity.this, QuestionActivity.class);
intent.putExtra("categoryId", topic.getId());
intent.putExtra("categoryName", topic.getName());
startActivity(intent);
final CardView modeSelection = (CardView) view.findViewById(R.id.modeSelection);
fade(topicSelection, modeSelection);
modeSelection.findViewById(R.id.dismissModeSelection).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
fade(modeSelection, topicSelection);
}
});
modeSelection.findViewById(R.id.assessmentButton).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
fade(modeSelection, topicSelection);
Assessment.getCurrentAssessment().setCurrentMode(Assessment.Mode.ForReals);
Assessment.getCurrentAssessment().setTopic(items.get(viewHolder.getPosition()));
startAssessment();
}
});
modeSelection.findViewById(R.id.practiceButton).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
fade(modeSelection, topicSelection);
Assessment.getCurrentAssessment().setCurrentMode(Assessment.Mode.Practice);
Assessment.getCurrentAssessment().setTopic(items.get(viewHolder.getPosition()));
startAssessment();
}
});
// Topic topic = allCategories.get(viewHolder.getPosition());
// Intent intent = new Intent(MainActivity.this, QuestionActivity.class);
// intent.putExtra("categoryId", topic.getId());
// intent.putExtra("categoryName", topic.getName());
// startActivity(intent);
}
});
return viewHolder;
}

private void startAssessment() {
Intent intent = new Intent(MainActivity.this, QuestionActivity.class);
startActivity(intent);
}

@Override
public void onBindViewHolder(ViewHolder holder, int position) {
Topic topic = items.get(position);
Expand Down
20 changes: 20 additions & 0 deletions android-app/app/src/main/java/com/mateoj/hacku3/MyApp.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.mateoj.hacku3;

import android.app.Application;

import com.parse.Parse;

/**
* Created by jose on 2/12/15.
*/
public class MyApp extends Application {
@Override
public void onCreate() {
super.onCreate();
// Enable Local Datastore.
Parse.enableLocalDatastore(this);

Parse.initialize(this, "1szB5VAWP1Zy3XQ8soea34thR6L1QdugCBLLTmHw", "2bTcQGBP6u64ylYQmC58eQoK0C7RHKpjFRLxp0q9");

}
}
Loading