Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add RewardActivity #29

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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
1 change: 1 addition & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ android {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.github.bumptech.glide:glide:3.7.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
implementation 'io.reactivex.rxjava2:rxjava:2.2.6'
Expand Down
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

<activity android:name=".SOSActivity" />
<activity android:name=".NearAEDActivity" />
<activity android:name=".RewardActivity" />
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand Down
13 changes: 13 additions & 0 deletions app/src/main/java/com/example/pc/caseproject/HeartActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ import android.view.MenuItem
import android.widget.Toast
import android.widget.Toast.LENGTH_LONG
import android.support.v7.widget.Toolbar
import android.view.View
import android.widget.Button
import butterknife.BindView
import butterknife.OnClick
import kotlinx.android.synthetic.main.activity_heart.*


Expand Down Expand Up @@ -52,8 +56,17 @@ class HeartActivity : AppCompatActivity(), CPRButton.PulseUpdateListener, AEDUti
cprButton.pulseUpdateListener = this
cprButton.isClickable = false
cprButton.background = resources.getDrawable(R.drawable.cpr_button_static)
val reward_button = findViewById(R.id.reward_Button) as Button

pauseButton.setOnClickListener { cprButton.stop() }
cprButton.setOnClickListener { cprButton.start() }

reward_button.setOnClickListener {
val intent = Intent(this, RewardActivity::class.java)
intent.putExtra("user_flag", 0)
startActivity(intent)
}

text911()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public class MainActivity extends AppCompatActivity {
Button aedButton;
@BindView(R.id.toolbar)
Toolbar toolbar;

private ArrayList<Integer> missingPermissions;
private String[] permissions = {Manifest.permission.ACCESS_FINE_LOCATION,
Manifest.permission.SEND_SMS};
Expand Down
28 changes: 28 additions & 0 deletions app/src/main/java/com/example/pc/caseproject/RewardActivity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.example.pc.caseproject;

import android.media.Image;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.ImageView;

import com.bumptech.glide.Glide;

public class RewardActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_reward);
ImageView reward_image = (ImageView) findViewById(R.id.reward_money);
int flag = -1;
flag = getIntent().getIntExtra("user_flag", 1);
if(flag == 0) {
Glide.with(this).load(R.drawable.reward_).into(reward_image);
}
else if(flag == 1) {
Glide.with(this).load(R.drawable.reward_suppoter).into(reward_image);
}
else {
Glide.with(this).load(R.drawable.mylocation).into(reward_image);
}
}
}
23 changes: 23 additions & 0 deletions app/src/main/java/com/example/pc/caseproject/SOSActivity.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.example.pc.caseproject;

import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
Expand All @@ -9,6 +10,9 @@
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toolbar;

Expand All @@ -24,6 +28,9 @@
import java.util.List;
import java.util.Locale;

import butterknife.BindView;
import butterknife.OnClick;

public class SOSActivity extends AppCompatActivity implements OnMapReadyCallback {

String sender_address, aed_address, date, sender_token, nowAddress;
Expand Down Expand Up @@ -79,6 +86,14 @@ protected void onCreate(Bundle savedInstanceState) {
myAddress = findViewById(R.id.aedAddress);
myAddress.setText(nowAddress);

Button reward_Button = (Button) findViewById(R.id.reward_Button);
reward_Button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(view.getContext(), RewardActivity.class);
intent.putExtra("user_flag", 1);
view.getContext().startActivity(intent);}
});

FragmentManager fm = getSupportFragmentManager();
SupportMapFragment f = (SupportMapFragment) fm.findFragmentById(R.id.map);
Expand All @@ -100,6 +115,14 @@ public boolean onSupportNavigateUp() {
return true;
}

// @OnClick(R.id.reward_Button)
// public void onRewardButtonClicked(View v) {
// Log.d("reward", "dd");
// Intent intent = new Intent(this, RewardActivity.class);
// intent.putExtra("user_flag", 1);
// startActivity(intent);
// }

@Override
public void onMapReady(final GoogleMap map) {

Expand Down
Binary file added app/src/main/res/drawable/reward_.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable/reward_heart.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable/reward_money.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable/reward_money2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable/reward_suppoter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions app/src/main/res/layout/activity_heart.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,17 @@
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/buttonWrapper" />

<Button
android:id="@+id/reward_Button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="reward 확인"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
android:layout_marginTop="5dp"
app:layout_constraintTop_toBottomOf="@id/pauseButton"
/>

<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,4 @@
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/bottomGuide" />


</android.support.constraint.ConstraintLayout>
32 changes: 32 additions & 0 deletions app/src/main/res/layout/activity_reward.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto">

<ImageView
android:id="@+id/reward_money"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_gravity="center"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
/>

<TextView
android:id="@+id/reward_say"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/reward_money"
android:layout_alignParentTop="true"
android:layout_marginTop="20dp"
android:text=" Good Job! \nYou are Hero!"
android:textStyle="bold"
android:textSize="30dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/reward_money" />

</android.support.constraint.ConstraintLayout>
22 changes: 19 additions & 3 deletions app/src/main/res/layout/activity_sos.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,15 @@
android:layout_height="match_parent"
tools:context=".SOSActivity">

<include
layout="@layout/toolbar"
android:id="@+id/toolbar"
<Toolbar android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:elevation="4dp"
android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
Expand Down Expand Up @@ -89,6 +95,16 @@
app:layout_constraintTop_toTopOf="@id/aedLocationIcon"
app:layout_constraintBottom_toBottomOf="@id/aedLocationIcon"
app:layout_constraintLeft_toRightOf="@id/aedLocationIcon"/>
<Button
android:id="@+id/reward_Button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="reward 확인"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
android:layout_marginTop="5dp"
app:layout_constraintTop_toBottomOf="@id/aedAddress"
/>



Expand Down