mirror of
https://github.com/SimpleMobileTools/Simple-Contacts.git
synced 2025-06-05 21:59:27 +02:00
fix #182, ignore hidden fields during editing instead of removing them
This commit is contained in:
@ -35,7 +35,6 @@ import java.util.*
|
||||
abstract class ContactActivity : SimpleActivity() {
|
||||
protected var contact: Contact? = null
|
||||
protected var currentContactPhotoPath = ""
|
||||
protected var showFields = 0
|
||||
|
||||
fun showPhotoPlaceholder(photoView: ImageView) {
|
||||
val placeholder = resources.getColoredBitmap(R.drawable.ic_person, config.primaryColor.getContrastColor())
|
||||
|
@ -58,7 +58,6 @@ class EditContactActivity : ContactActivity() {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_edit_contact)
|
||||
supportActionBar?.setHomeAsUpIndicator(R.drawable.ic_cross)
|
||||
showFields = config.showContactFields
|
||||
|
||||
val action = intent.action
|
||||
isThirdPartyIntent = action == Intent.ACTION_EDIT || action == Intent.ACTION_INSERT_OR_EDIT || action == Intent.ACTION_INSERT
|
||||
@ -272,6 +271,7 @@ class EditContactActivity : ContactActivity() {
|
||||
}
|
||||
|
||||
private fun setupFieldVisibility() {
|
||||
val showFields = config.showContactFields
|
||||
if (showFields and (SHOW_PREFIX_FIELD or SHOW_FIRST_NAME_FIELD or SHOW_MIDDLE_NAME_FIELD or SHOW_SURNAME_FIELD or SHOW_SUFFIX_FIELD) == 0) {
|
||||
contact_name_image.beInvisible()
|
||||
}
|
||||
@ -352,7 +352,6 @@ class EditContactActivity : ContactActivity() {
|
||||
}
|
||||
|
||||
private fun setupPhoneNumbers() {
|
||||
if (showFields and SHOW_PHONE_NUMBERS_FIELD != 0) {
|
||||
contact!!.phoneNumbers.forEachIndexed { index, number ->
|
||||
var numberHolder = contact_numbers_holder.getChildAt(index)
|
||||
if (numberHolder == null) {
|
||||
@ -366,10 +365,8 @@ class EditContactActivity : ContactActivity() {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupEmails() {
|
||||
if (showFields and SHOW_EMAILS_FIELD != 0) {
|
||||
contact!!.emails.forEachIndexed { index, email ->
|
||||
var emailHolder = contact_emails_holder.getChildAt(index)
|
||||
if (emailHolder == null) {
|
||||
@ -383,10 +380,8 @@ class EditContactActivity : ContactActivity() {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupAddresses() {
|
||||
if (showFields and SHOW_ADDRESSES_FIELD != 0) {
|
||||
contact!!.addresses.forEachIndexed { index, address ->
|
||||
var addressHolder = contact_addresses_holder.getChildAt(index)
|
||||
if (addressHolder == null) {
|
||||
@ -400,23 +395,17 @@ class EditContactActivity : ContactActivity() {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupNotes() {
|
||||
if (showFields and SHOW_NOTES_FIELD != 0) {
|
||||
contact_notes.setText(contact!!.notes)
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupOrganization() {
|
||||
if (showFields and SHOW_ORGANIZATION_FIELD != 0) {
|
||||
contact_organization_company.setText(contact!!.organization.company)
|
||||
contact_organization_job_position.setText(contact!!.organization.jobPosition)
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupWebsites() {
|
||||
if (showFields and SHOW_WEBSITES_FIELD != 0) {
|
||||
contact!!.websites.forEachIndexed { index, website ->
|
||||
var websitesHolder = contact_websites_holder.getChildAt(index)
|
||||
if (websitesHolder == null) {
|
||||
@ -427,10 +416,8 @@ class EditContactActivity : ContactActivity() {
|
||||
websitesHolder!!.contact_website.setText(website)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupEvents() {
|
||||
if (showFields and SHOW_EVENTS_FIELD != 0) {
|
||||
contact!!.events.forEachIndexed { index, event ->
|
||||
var eventHolder = contact_events_holder.getChildAt(index)
|
||||
if (eventHolder == null) {
|
||||
@ -458,10 +445,8 @@ class EditContactActivity : ContactActivity() {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupGroups() {
|
||||
if (showFields and SHOW_GROUPS_FIELD != 0) {
|
||||
contact_groups_holder.removeAllViews()
|
||||
val groups = contact!!.groups
|
||||
groups.forEachIndexed { index, group ->
|
||||
@ -510,7 +495,6 @@ class EditContactActivity : ContactActivity() {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupContactSource() {
|
||||
contact_source.text = getPublicContactSource(contact!!.source)
|
||||
|
@ -23,6 +23,7 @@ import kotlinx.android.synthetic.main.item_website.view.*
|
||||
|
||||
class ViewContactActivity : ContactActivity() {
|
||||
private var isViewIntent = false
|
||||
private var showFields = 0
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
Reference in New Issue
Block a user