forked from hush/SilentDragonAndroid-old
![nickas.gehlen@gmail.com](/assets/img/avatar_default.png)
5 changed files with 34 additions and 51 deletions
@ -1,43 +1,7 @@ |
|||
package org.myhush.silentdragon |
|||
|
|||
class Addressbook { |
|||
private val data = ArrayList<Contact>() |
|||
object Addressbook { |
|||
class Contact(){ var firstName = ""; var lastName = ""; var zAddress = "" } |
|||
|
|||
fun addContact(contact: Contact){ |
|||
data.add(contact) |
|||
} |
|||
|
|||
fun getContactByAddress(address: String): Contact? { |
|||
data.forEach { |
|||
if (it.zaddress == address) |
|||
return it |
|||
} |
|||
return null |
|||
} |
|||
|
|||
fun getContactsByFirstName(firstName: String): ArrayList<Contact> { |
|||
val list = ArrayList<Contact>() |
|||
data.forEach { |
|||
if (it.firstName == firstName) |
|||
list.add(it) |
|||
} |
|||
return list |
|||
} |
|||
|
|||
fun getContactsByLastName(lastName: String): ArrayList<Contact> { |
|||
val list = ArrayList<Contact>() |
|||
data.forEach { |
|||
if (it.lastName == lastName) |
|||
list.add(it) |
|||
} |
|||
return list } |
|||
|
|||
fun getContactsByFullName(firstName: String, lastName: String): ArrayList<Contact> { |
|||
val list = ArrayList<Contact>() |
|||
data.forEach { |
|||
if (it.firstName == firstName && it.lastName == lastName) |
|||
list.add(it) |
|||
} |
|||
return list |
|||
} |
|||
val contactList = ArrayList<Contact>() |
|||
} |
@ -1,7 +0,0 @@ |
|||
package org.myhush.silentdragon |
|||
|
|||
class Contact { |
|||
var firstName = "" |
|||
var lastName = "" |
|||
var zaddress = "" |
|||
} |
@ -0,0 +1,7 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<menu xmlns:android="http://schemas.android.com/apk/res/android"> |
|||
|
|||
<item |
|||
android:id="@+id/action_addChat" |
|||
android:title="AddChat" /> |
|||
</menu> |
Loading…
Reference in new issue