1 |
|
package com.loopback.androidapps.saveapp; |
2 |
|
|
3 |
|
import android.app.Activity; |
4 |
|
import android.content.Intent; |
5 |
|
import android.os.Bundle; |
6 |
|
import android.text.InputType; |
7 |
|
import android.util.Log; |
8 |
|
import android.view.View; |
9 |
|
import android.widget.Button; |
10 |
|
import android.widget.EditText; |
11 |
|
|
|
|
| 92,5% |
Uncovered Elements: 3 (40) |
Complexity: 8 |
Complexity Density: 0,28 |
|
12 |
|
public class NoteActivity extends Activity implements View.OnClickListener { |
13 |
|
|
14 |
|
private EditText edtNote; |
15 |
|
private Button btnSaveNote, btnDiscardNote; |
16 |
|
private String note; |
17 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (10) |
Complexity: 1 |
Complexity Density: 0,1 |
|
18 |
5
|
public void onCreate(Bundle savedInstanceState) {... |
19 |
5
|
super.onCreate(savedInstanceState); |
20 |
5
|
setContentView(R.layout.note); |
21 |
5
|
Bundle bundle = this.getIntent().getExtras(); |
22 |
5
|
note = bundle.getString("Note"); |
23 |
5
|
edtNote = (EditText) findViewById(R.id.edtNote); |
24 |
5
|
btnSaveNote = (Button) findViewById(R.id.btnSaveNote); |
25 |
5
|
btnDiscardNote = (Button) findViewById(R.id.btnDiscardNote); |
26 |
5
|
btnSaveNote.setOnClickListener(this); |
27 |
5
|
btnDiscardNote.setOnClickListener(this); |
28 |
5
|
edtNote.setInputType(InputType.TYPE_TEXT_FLAG_CAP_WORDS); |
29 |
|
} |
30 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 2 |
Complexity Density: 0,5 |
|
31 |
5
|
public void onResume() {... |
32 |
5
|
super.onResume(); |
33 |
5
|
if (note.equals("")) |
34 |
3
|
note = edtNote.getText().toString(); |
35 |
|
else |
36 |
2
|
edtNote.setText(note); |
37 |
|
} |
38 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
39 |
0
|
public void onBackPressed() {... |
40 |
0
|
finishActivity(); |
41 |
|
} |
42 |
|
|
|
|
| 90% |
Uncovered Elements: 1 (10) |
Complexity: 3 |
Complexity Density: 0,5 |
|
43 |
5
|
public void onClick(View v) {... |
44 |
5
|
Log.i("NTA", "Click..."); |
45 |
5
|
if (v == btnSaveNote) { |
46 |
3
|
note = edtNote.getText().toString(); |
47 |
3
|
finishActivity(); |
48 |
2
|
} else if (v == btnDiscardNote) { |
49 |
2
|
finishActivity(); |
50 |
|
} |
51 |
|
} |
52 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (8) |
Complexity: 1 |
Complexity Density: 0,12 |
|
53 |
5
|
private void finishActivity() {... |
54 |
5
|
Log.i("NTA", "Finishing..."); |
55 |
5
|
int RESULT = RESULT_FIRST_USER; |
56 |
5
|
Bundle bundle = new Bundle(); |
57 |
5
|
bundle.putString("Note", note); |
58 |
5
|
Intent intent = new Intent(this.getApplicationContext(), |
59 |
|
OutlayEditActivity.class); |
60 |
5
|
intent.putExtras(bundle); |
61 |
5
|
setResult(RESULT, intent); |
62 |
5
|
finish(); |
63 |
|
} |
64 |
|
} |