Repository navigation
Expand file tree
/
Copy pathMainActivity.java
More file actions
120 lines (112 loc) · 4.07 KB
/
Copy pathMainActivity.java
File metadata and controls
120 lines (112 loc) · 4.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
package com.zackwillson.zworkouts;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.view.Gravity;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
TextView title;
Button workout, view, edit, Info;
int on = 0;
boolean important;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
SharedPreferences sp = getApplicationContext().getSharedPreferences("FitData", Context.MODE_PRIVATE);
String weightTest = sp.getString("weight", "");
String feetTest = sp.getString("feet", "");
String inchesTest = sp.getString("inches", "");
String ageTest = sp.getString("age", "");
String stretchTest = sp.getString("Stretch", "");
String fitnessTest = sp.getString("fitnessString", "");
weightTest = weightTest + "test";
feetTest = feetTest + "test";
inchesTest = inchesTest + "test";
ageTest = ageTest + "test";
stretchTest = stretchTest + "test";
fitnessTest = fitnessTest + "test";
if (weightTest.equals("test") || feetTest.equals("test") || inchesTest.equals("test") || stretchTest.equals("test") || fitnessTest.equals("test") || ageTest.equals("test"))
{
important = true;
}
else
{
important = false;
}
title = findViewById(R.id.textView2);
title.setGravity(Gravity.CENTER);
title.setBackground(getResources().getDrawable(R.drawable.round));
workout = findViewById(R.id.button2);
workout.setBackground(getResources().getDrawable(R.drawable.smallround));
workout.setGravity(Gravity.CENTER);
view = findViewById(R.id.button3);
edit = findViewById(R.id.button4);
view.setBackground(getResources().getDrawable(R.drawable.left));
edit.setBackground(getResources().getDrawable(R.drawable.right));
Info = findViewById(R.id.Info44);
Info.setBackground(getResources().getDrawable(R.drawable.round));
Info.setGravity(Gravity.CENTER);
}
public void sendMessage(View view) {
if (!important)
{
Intent intent = new Intent(this, workoutSelect.class);
startActivity(intent);
}
else
{
if (on == 0)
{
on = 1;
Toast.makeText(MainActivity.this, "Go to EditInfo and input all your Fitness Info before you go Workout", Toast.LENGTH_SHORT).show();
}
new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
@Override
public void run() {
on = 0;
}
}, 2700);
}
}
public void goToEdit(View view){
Intent intent2 = new Intent(this, editInfo.class);
startActivity(intent2);
}
public void goToView(View view){
if (!important)
{
Intent intent3 = new Intent(this, viewInfo.class);
startActivity(intent3);
}
else
{
if (on == 0)
{
on = 1;
Toast.makeText(MainActivity.this, "Go to EditInfo and input all your Fitness Info before you go to ViewInfo", Toast.LENGTH_SHORT).show();
}
new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
@Override
public void run() {
on = 0;
}
}, 2700);
}
}
public void goToCredits(View view){
Intent intent = new Intent(this, Credits.class);
startActivity(intent);
}
public void goToInfo(View view){
Intent intent = new Intent(this, Info.class);
startActivity(intent);
}
}