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
6 changes: 6 additions & 0 deletions .idea/compiler.xml

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

12 changes: 9 additions & 3 deletions .idea/gradle.xml

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

25 changes: 25 additions & 0 deletions .idea/jarRepositories.xml

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

2 changes: 1 addition & 1 deletion .idea/misc.xml

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

16 changes: 7 additions & 9 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,29 @@
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="com.google.android.gms.permission.ACTIVITY_RECOGNITION" />



<application
android:usesCleartextTraffic="true"
android:allowBackup="true"
android:hardwareAccelerated="false"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:largeHeap="true"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:label="@string/app_name"
android:theme="@style/AppTheme">
<activity android:name=".MindfulnessMeditationGame_R"></activity>
<activity android:name=".MindfulnessMeditationGame_R9" />
android:theme="@style/AppTheme"
android:usesCleartextTraffic="true">
<activity android:name=".ARScreen"></activity>
<activity android:name=".MindfulnessMeditationGame_R" />
<activity android:name=".ReceiptPage" />
<activity android:name=".EndOfMindfulnessGamePage" />
<activity android:name=".PollenStoreDailyQuestPage" />
<activity android:name=".PollenShopPage" />
<activity android:name=".DailyQuestPage" />
<activity android:name=".MindfullnessWalking" />
<activity android:name=".BackendTest" />
<activity android:name=".MindfullnessWalkingGame" />
<activity android:name=".MindfullnessWalkingGame"
android:screenOrientation="portrait"/>
<activity android:name=".MindfullnessMeditation" />
<activity android:name=".MindfullnessFeatherSelection" />
<activity android:name=".MindfullnessMeditationGame" />
<activity android:name=".MindfullnessBreathingGame" />
<activity android:name=".MindfullnessBreathing" />
<activity android:name=".ButterflyDetailsPage" />
Expand Down
116 changes: 116 additions & 0 deletions app/src/main/java/com/example/aorora/ARScreen.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
package com.example.aorora;

import android.content.Context;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.GestureDetector;
import android.view.View;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.Toast;

import com.example.aorora.network.GetDataService;
import com.example.aorora.network.NetworkCalls;
import com.example.aorora.network.RetrofitClientInstance;

public class ARScreen extends AppCompatActivity implements View.OnClickListener {
//User account info
Integer userPollen;
Integer userId;

//Retrofit network object
GetDataService service;

Context arScreen;
ImageButton home_button_bottombar;
ImageButton profile_button_bottombar;
ImageButton community_button_bottombar;
ImageButton quest_button_bottombar;
Button spendPollenBtn;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//User account info
userPollen = MainActivity.user_info.getUser_pollen();
userId = MainActivity.user_info.getUser_id();

//Retrofit objects
//Init our backend service
service = RetrofitClientInstance.getRetrofitInstance().create(GetDataService.class);

setContentView(R.layout.activity_ar_screen);
arScreen = this;
home_button_bottombar = (ImageButton) findViewById(R.id.home_button_bottom_bar);
profile_button_bottombar = (ImageButton) findViewById(R.id.profile_button_bottom_bar);
community_button_bottombar = (ImageButton) findViewById(R.id.community_button_bottom_bar);
quest_button_bottombar = (ImageButton) findViewById(R.id.quest_button_bottom_bar);
spendPollenBtn = (Button) findViewById(R.id.spend_pollen_btn);


//Onclicklisteners for this class.
home_button_bottombar.setOnClickListener(this);
profile_button_bottombar.setOnClickListener(this);
community_button_bottombar.setOnClickListener(this);
quest_button_bottombar.setOnClickListener(this);



spendPollenBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(!hasEnoughPollen()){
Toast.makeText(ARScreen.this, "Sorry! Not enough pollen! Complete some quests!", Toast.LENGTH_SHORT).show();
return;
}
//Otherwise, we have enough pollen, decrement it and update the backend.
userPollen -= 10;
Toast.makeText(ARScreen.this, "Spending pollen to access AR butterflies for one day.", Toast.LENGTH_SHORT).show();
//TODO: Add one day activation of butterfly activity, perhaps in MainActivity or UserInfo?
//Finally do the PUT request with the new pollen value. May need to refresh the UI.
//This is not updating the backend, need to use a network call.
MainActivity.user_info.setUser_pollen(userPollen);
//This will update the backend and set the current pollen to our decremented value.
NetworkCalls.updateUserCurrentPoints(userId, userPollen,ARScreen.this);
}
});

}

public boolean hasEnoughPollen() {
return userPollen >= 10;
}

@Override
public void onClick(View v) {
int view_id = v.getId();
Intent to_navigate;

if(view_id == profile_button_bottombar.getId())
{
to_navigate = new Intent(arScreen, ProfilePage.class);
startActivity(to_navigate);
}
else if(view_id == community_button_bottombar.getId())
{
to_navigate = new Intent(arScreen, CommunityPage.class);
startActivity(to_navigate);
}
else if(view_id == quest_button_bottombar.getId())
{
to_navigate = new Intent(arScreen, MindfullnessSelection.class);
startActivity(to_navigate);

}
else if(view_id == home_button_bottombar.getId())
{
to_navigate = new Intent(arScreen, HomeScreen.class);
startActivity(to_navigate);
}

}


}
Loading