Skip to content

Commit

Permalink
-Scanning qr codes will now generate reward points
Browse files Browse the repository at this point in the history
-Account activity updated
-Reward activity updated
  • Loading branch information
yazyyyyy committed Mar 21, 2020
1 parent 8e86f91 commit 0f09ebf
Show file tree
Hide file tree
Showing 76 changed files with 1,949 additions and 35 deletions.
116 changes: 116 additions & 0 deletions .idea/codeStyles/Project.xml

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

13 changes: 13 additions & 0 deletions _gitignore.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
1 change: 1 addition & 0 deletions app/_gitignore.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
1 change: 1 addition & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@ dependencies {
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'com.google.android.gms:play-services-auth:16.0.0'
implementation 'me.dm7.barcodescanner:zxing:1.9'
implementation 'androidx.cardview:cardview:1.0.0'
}
10 changes: 9 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,22 @@
package="com.example.rotg">

<uses-permission android:name="android.permission.CAMERA"></uses-permission>

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".abt_activity"></activity>
<activity android:name=".earphones"></activity>
<activity android:name=".watches" />
<activity android:name=".movie" />
<activity android:name=".smartphones" />
<activity android:name=".cashback" />
<activity android:name=".rewardshomepage" />
<activity android:name=".Login_activity" />
<activity android:name=".abt_activity" />
<activity android:name=".fb_activity" />
<activity android:name=".acc_activity" />
<activity android:name=".loc_activity" />
Expand Down
32 changes: 32 additions & 0 deletions app/src/main/java/com/example/rotg/Login_activity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.example.rotg;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class Login_activity extends AppCompatActivity {
private Button login;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login_activity);

login=findViewById(R.id.login);
login.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
welcome();
}
});
}

private void welcome() {
Intent welintent=new Intent(getApplicationContext(),welcomeActivity.class);
startActivity(welintent);
}
}

5 changes: 2 additions & 3 deletions app/src/main/java/com/example/rotg/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@ protected void onCreate(Bundle savedInstanceState) {
@Override
public void run()
{
Intent welcomeIntent = new Intent(MainActivity.this, welcomeActivity.class);
Intent welcomeIntent = new Intent(MainActivity.this, Login_activity.class);
startActivity(welcomeIntent);
finish();
}
},SPLASH_TIME_OUT);

}, SPLASH_TIME_OUT);
}
}
9 changes: 9 additions & 0 deletions app/src/main/java/com/example/rotg/acc_activity.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,21 @@
import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.widget.TextView;

public class acc_activity extends AppCompatActivity {
public static int rp;
TextView accPoints;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_acc_activity);

accPoints=findViewById(R.id.accPoints);

rp=getIntent().getIntExtra("points",rp);

accPoints.setText("Reward points = "+rp);
}
}
14 changes: 14 additions & 0 deletions app/src/main/java/com/example/rotg/cashback.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.example.rotg;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;

public class cashback extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_cashback);
}
}
14 changes: 14 additions & 0 deletions app/src/main/java/com/example/rotg/earphones.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.example.rotg;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;

public class earphones extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_earphones);
}
}
14 changes: 14 additions & 0 deletions app/src/main/java/com/example/rotg/movie.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.example.rotg;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;

public class movie extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_movie);
}
}
86 changes: 83 additions & 3 deletions app/src/main/java/com/example/rotg/qr_activity.java
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
package com.example.rotg;

import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;

import android.Manifest;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.widget.Toast;

import com.google.zxing.Result;

import me.dm7.barcodescanner.zxing.ZXingScannerView;

public class qr_activity extends AppCompatActivity implements ZXingScannerView.ResultHandler {
int MY_PERMISSIONS_REQUEST_CAMERA=0;

ZXingScannerView Scannerview;
@Override
Expand All @@ -21,9 +27,72 @@ protected void onCreate(Bundle savedInstanceState) {

@Override
public void handleResult(Result result) {
reward_activity.resultTextView.setText(result.getText());
Intent rewardintent=new Intent(this,reward_activity.class);
startActivity(rewardintent);
String qrtext=result.getText();//string to accept qr code
if(qrtext.equals("rctPqlm1x7GamWGhRAg+QrnfmuPVa5Jnqyh3G2b3XOc="))
{
acc_activity.rp=acc_activity.rp+50;
Toast.makeText(qr_activity.this,"50 reward points added",Toast.LENGTH_SHORT).show();
onBackPressed();
}
else if(qrtext.equals("pULFw7o4/pW3aIjE/3KOR/d8bpVzFWelxrH7oT9lYO8="))
{
acc_activity.rp=acc_activity.rp+100;
Toast.makeText(qr_activity.this,"100 reward points added",Toast.LENGTH_SHORT).show();
onBackPressed();
}
else if(qrtext.equals("+Fz7aM9M2u9xqIENqyBH8uHEuF3hB73fZs8EltPbnUI="))
{
acc_activity.rp=acc_activity.rp+150;
Toast.makeText(qr_activity.this,"150 reward points added",Toast.LENGTH_SHORT).show();
onBackPressed();
}
else if(qrtext.equals("ieWyA6ND5Vs9q1koUuRDmum0NM+SxdV4ozUTvkzA3WE="))
{
acc_activity.rp=acc_activity.rp+200;
Toast.makeText(qr_activity.this,"200 reward points added",Toast.LENGTH_SHORT).show();
onBackPressed();
}
else if(qrtext.equals("Ga/8mzhJnNA4ONk/j225Ksii2w8lrxXroW0u5lxYt7w="))
{
acc_activity.rp=acc_activity.rp+250;
Toast.makeText(qr_activity.this,"250 reward points added",Toast.LENGTH_SHORT).show();
onBackPressed();
}
else if(qrtext.equals("qvQmeM026ReEHtC3Ckj1/Mi+jn4lVvazkxZVoaH8YMM="))
{
acc_activity.rp=acc_activity.rp+300;
Toast.makeText(qr_activity.this,"300 reward points added",Toast.LENGTH_SHORT).show();
onBackPressed();
}
else if(qrtext.equals("y+FL6DdRfSlslZlGqzVb7Qe/Lkib241l7+Qa5PCtRAs="))
{
acc_activity.rp=acc_activity.rp+350;
Toast.makeText(qr_activity.this,"350 reward points added",Toast.LENGTH_SHORT).show();
onBackPressed();
}
else if(qrtext.equals("+p15WUwFmvSYQFNum8r0a32gu/GP9psWjByWoZNcM5U="))
{
acc_activity.rp=acc_activity.rp+400;
Toast.makeText(qr_activity.this,"400 reward points added",Toast.LENGTH_SHORT).show();
onBackPressed();
}
else if(qrtext.equals("PUHwXt6bdAmkMrGnbPHrWDQQsgfualous6kYsN382CQ="))
{
acc_activity.rp=acc_activity.rp+450;
Toast.makeText(qr_activity.this,"450 reward points added",Toast.LENGTH_SHORT).show();
onBackPressed();
}
else if(qrtext.equals("Fq6MtMvgtroOP4COS1q4k6byJGz7xD253AWZZvWxUtM="))
{
acc_activity.rp=acc_activity.rp+500;
Toast.makeText(qr_activity.this,"500 reward points added",Toast.LENGTH_SHORT).show();
onBackPressed();
}
else
{
Toast.makeText(qr_activity.this,"INVALID_ERROR",Toast.LENGTH_SHORT).show();
onBackPressed();
}
}

@Override
Expand All @@ -40,4 +109,15 @@ protected void onResume() {
Scannerview.setResultHandler(this);
Scannerview.startCamera();
}

@Override
protected void onPostResume() {
super.onPostResume();
if (ContextCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.CAMERA}, MY_PERMISSIONS_REQUEST_CAMERA);
}
Scannerview.setResultHandler(this);
Scannerview.startCamera();
}

}
1 change: 0 additions & 1 deletion app/src/main/java/com/example/rotg/reward_activity.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,5 @@ protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_reward_activity);

resultTextView=(TextView)findViewById(R.id.result_text);
}
}
Loading

0 comments on commit 0f09ebf

Please sign in to comment.