-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBCardObject.java
More file actions
123 lines (93 loc) · 2.89 KB
/
BCardObject.java
File metadata and controls
123 lines (93 loc) · 2.89 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
121
122
123
package com.example.nfcapp.BCardObject;
import android.graphics.Bitmap;
import android.graphics.Picture;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
public class BCardObject {
private int id; //
private Bitmap bitmapImage;
private String name;
private String position;
private List<String> phoneNumber = new ArrayList<>();
private List<String> email = new ArrayList<>();
BCardObject() {
this.id = new Random().nextInt();
this.name = new Integer(new Random().nextInt()).toString();
this.position = new Integer(new Random().nextInt()).toString();
}
public BCardObject(int id, String name, String position) {
this.id = id;
this.name = name;
this.position = position;
}
public int getId() {
return id;
}
public String getName() {
return name;
}
public void editName(String name) {
this.name = name;
}
public void setName(String name) {
this.name = name;
}
public String getPosition() {
return position;
}
public void setPosition(String position) {
this.position = position;
}
public String[] getmail() {
return email.toArray(new String[email.size()]);
}
public String[] getPhoneNumber() {
return phoneNumber.toArray(new String[phoneNumber.size()]);
}
public void addMail(String email) {
this.email.add(email);
}
public void addNumber(String phoneNumber) {
this.phoneNumber.add(phoneNumber);
}
public void addPicture(File picture) {
}
boolean hasPicture() {
if (bitmapImage == null)
return false;
return true;
}
public String getNumber1() { return phoneNumber.get(0); }
public String getEmail1() { return email.get(0); }
@Override
public String toString() {
return "BCardObject{" +
"id=" + id +
", picture=" + bitmapImage +
", name='" + name + '\'' +
", position='" + position + '\'' +
", phoneNumber=" + phoneNumber +
", email=" + email +
'}';
}
public String toTerminalString() {
StringBuilder sb = new StringBuilder();
sb.append("ID : " + id + "\n");
sb.append("Name : " + name + "\n");
sb.append("Position : "+ position + "\n");
sb.append("hasPicture : " + hasPicture() + "\n");
//PhoneNumber
sb.append("phoneNumbers : \n");
for (int i = 0; i < phoneNumber.size(); i++) {
sb.append(" " + (i+1) + " | " + phoneNumber.get(i) + "\n");
}
//email
sb.append("email : " + "\n");
for (int i = 0; i < email.size(); i++) {
sb.append(" " + (i+1) + " | " + email.get(i) + "\n");
}
return sb.toString();
}
}