-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCongratulationActivity.java
45 lines (35 loc) · 1.31 KB
/
CongratulationActivity.java
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
package com.diplom.nck.externaltesting;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.TextView;
/**
* Created by N!ck on 03.04.2017.
*/
public class CongratulationActivity extends AppCompatActivity {
int maxPoints = 0;
int actualPoints = 0;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_congratulations);
Bundle b = getIntent().getExtras();
maxPoints = b.getInt("maxPoints");
actualPoints = b.getInt("actualPoints");
TextView actualView = (TextView) findViewById(R.id.actual_points);
if (actualView != null) {
actualView.setText(actualPoints + "");
}
TextView maxView = (TextView) findViewById(R.id.max_points);
if (maxView != null) {
maxView.setText(maxPoints + "");
}
TextView congrat = (TextView) findViewById(R.id.congrat);
if (congrat != null) {
if (actualPoints <= maxPoints / 2) {
congrat.setText(getString(R.string.sorry));
} else if (actualPoints == maxPoints) {
congrat.setText(getString(R.string.perfect));
}
}
}
}