mirror of
				https://github.com/SimpleMobileTools/Simple-Contacts.git
				synced 2025-06-05 21:59:27 +02:00 
			
		
		
		
	adding ContactActivity
This commit is contained in:
		| @@ -32,5 +32,5 @@ android { | ||||
| } | ||||
|  | ||||
| dependencies { | ||||
|     implementation 'com.simplemobiletools:commons:3.2.6' | ||||
|     implementation 'com.simplemobiletools:commons:3.2.13' | ||||
| } | ||||
|   | ||||
| @@ -37,6 +37,11 @@ | ||||
|             android:label="@string/settings" | ||||
|             android:parentActivityName=".activities.MainActivity"/> | ||||
|  | ||||
|         <activity | ||||
|             android:name=".activities.ContactActivity" | ||||
|             android:label="@string/new_contact" | ||||
|             android:parentActivityName=".activities.MainActivity"/> | ||||
|  | ||||
|         <activity | ||||
|             android:name="com.simplemobiletools.commons.activities.AboutActivity" | ||||
|             android:label="@string/about" | ||||
|   | ||||
| @@ -0,0 +1,36 @@ | ||||
| package com.simplemobiletools.contacts.activities | ||||
|  | ||||
| import android.graphics.drawable.ColorDrawable | ||||
| import android.os.Bundle | ||||
| import com.simplemobiletools.commons.extensions.applyColorFilter | ||||
| import com.simplemobiletools.commons.extensions.getContrastColor | ||||
| import com.simplemobiletools.commons.extensions.updateTextColors | ||||
| import com.simplemobiletools.contacts.R | ||||
| import com.simplemobiletools.contacts.extensions.config | ||||
| import kotlinx.android.synthetic.main.activity_contact.* | ||||
|  | ||||
| class ContactActivity : SimpleActivity() { | ||||
|     override fun onCreate(savedInstanceState: Bundle?) { | ||||
|         super.onCreate(savedInstanceState) | ||||
|         setContentView(R.layout.activity_contact) | ||||
|         supportActionBar?.setHomeAsUpIndicator(R.drawable.ic_cross) | ||||
|  | ||||
|         contact_photo.applyColorFilter(config.primaryColor.getContrastColor()) | ||||
|         contact_photo.background = ColorDrawable(config.primaryColor) | ||||
|  | ||||
|         val textColor = config.textColor | ||||
|         contact_sms.applyColorFilter(textColor) | ||||
|         contact_call.applyColorFilter(textColor) | ||||
|         contact_email.applyColorFilter(textColor) | ||||
|         contact_name_image.applyColorFilter(textColor) | ||||
|         contact_number_image.applyColorFilter(textColor) | ||||
|         contact_email_image.applyColorFilter(textColor) | ||||
|  | ||||
|         contact_photo.setOnClickListener { } | ||||
|         contact_sms.setOnClickListener { } | ||||
|         contact_call.setOnClickListener { } | ||||
|         contact_email.setOnClickListener { } | ||||
|  | ||||
|         updateTextColors(contact_scrollview) | ||||
|     } | ||||
| } | ||||
| @@ -142,7 +142,9 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener { | ||||
|     } | ||||
|  | ||||
|     private fun addNewContact() { | ||||
|  | ||||
|         Intent(applicationContext, ContactActivity::class.java).apply { | ||||
|             startActivity(this) | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     override fun refreshItems() { | ||||
|   | ||||
							
								
								
									
										145
									
								
								app/src/main/res/layout/activity_contact.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										145
									
								
								app/src/main/res/layout/activity_contact.xml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,145 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <ScrollView | ||||
|     xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|     android:id="@+id/contact_scrollview" | ||||
|     android:layout_width="match_parent" | ||||
|     android:layout_height="wrap_content" | ||||
|     android:padding="@dimen/activity_margin"> | ||||
|  | ||||
|     <RelativeLayout | ||||
|         android:id="@+id/contact_holder" | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="wrap_content"> | ||||
|  | ||||
|         <ImageView | ||||
|             android:id="@+id/contact_photo" | ||||
|             android:layout_width="@dimen/contact_photo_size" | ||||
|             android:layout_height="@dimen/contact_photo_size" | ||||
|             android:padding="@dimen/activity_margin" | ||||
|             android:src="@drawable/ic_person"/> | ||||
|  | ||||
|         <ImageView | ||||
|             android:id="@+id/contact_sms" | ||||
|             style="@style/MyBorderlessBackgroundStyle" | ||||
|             android:layout_width="wrap_content" | ||||
|             android:layout_height="wrap_content" | ||||
|             android:layout_alignBottom="@id/contact_photo" | ||||
|             android:layout_alignParentEnd="true" | ||||
|             android:layout_alignTop="@+id/contact_photo" | ||||
|             android:layout_centerVertical="true" | ||||
|             android:adjustViewBounds="true" | ||||
|             android:paddingLeft="@dimen/activity_margin" | ||||
|             android:paddingRight="@dimen/activity_margin" | ||||
|             android:scaleType="center" | ||||
|             android:src="@drawable/ic_sms"/> | ||||
|  | ||||
|         <ImageView | ||||
|             android:id="@+id/contact_call" | ||||
|             style="@style/MyBorderlessBackgroundStyle" | ||||
|             android:layout_width="wrap_content" | ||||
|             android:layout_height="wrap_content" | ||||
|             android:layout_alignBottom="@id/contact_photo" | ||||
|             android:layout_alignTop="@+id/contact_photo" | ||||
|             android:layout_centerVertical="true" | ||||
|             android:layout_toLeftOf="@+id/contact_sms" | ||||
|             android:adjustViewBounds="true" | ||||
|             android:paddingLeft="@dimen/activity_margin" | ||||
|             android:paddingRight="@dimen/activity_margin" | ||||
|             android:scaleType="center" | ||||
|             android:src="@drawable/ic_phone"/> | ||||
|  | ||||
|         <ImageView | ||||
|             android:id="@+id/contact_email" | ||||
|             style="@style/MyBorderlessBackgroundStyle" | ||||
|             android:layout_width="wrap_content" | ||||
|             android:layout_height="wrap_content" | ||||
|             android:layout_alignBottom="@id/contact_photo" | ||||
|             android:layout_alignTop="@+id/contact_photo" | ||||
|             android:layout_centerVertical="true" | ||||
|             android:layout_toLeftOf="@+id/contact_call" | ||||
|             android:adjustViewBounds="true" | ||||
|             android:paddingLeft="@dimen/activity_margin" | ||||
|             android:paddingRight="@dimen/activity_margin" | ||||
|             android:scaleType="center" | ||||
|             android:src="@drawable/ic_email"/> | ||||
|  | ||||
|         <ImageView | ||||
|             android:id="@+id/contact_name_image" | ||||
|             android:layout_width="wrap_content" | ||||
|             android:layout_height="match_parent" | ||||
|             android:layout_alignBottom="@+id/contact_name_value" | ||||
|             android:layout_alignTop="@+id/contact_name_value" | ||||
|             android:paddingBottom="@dimen/medium_margin" | ||||
|             android:paddingTop="@dimen/medium_margin" | ||||
|             android:src="@drawable/ic_person"/> | ||||
|  | ||||
|         <com.simplemobiletools.commons.views.MyEditText | ||||
|             android:id="@+id/contact_name_value" | ||||
|             android:layout_width="match_parent" | ||||
|             android:layout_height="wrap_content" | ||||
|             android:layout_below="@+id/contact_photo" | ||||
|             android:layout_centerVertical="true" | ||||
|             android:layout_marginStart="@dimen/medium_margin" | ||||
|             android:layout_marginTop="@dimen/activity_margin" | ||||
|             android:layout_toRightOf="@+id/contact_name_image" | ||||
|             android:hint="@string/name" | ||||
|             android:inputType="textCapWords" | ||||
|             android:lines="1" | ||||
|             android:maxLines="1" | ||||
|             android:singleLine="true" | ||||
|             android:textSize="@dimen/big_text_size"/> | ||||
|  | ||||
|         <ImageView | ||||
|             android:id="@+id/contact_number_image" | ||||
|             android:layout_width="wrap_content" | ||||
|             android:layout_height="match_parent" | ||||
|             android:layout_alignBottom="@+id/contact_number_value" | ||||
|             android:layout_alignTop="@+id/contact_number_value" | ||||
|             android:paddingBottom="@dimen/medium_margin" | ||||
|             android:paddingTop="@dimen/medium_margin" | ||||
|             android:src="@drawable/ic_phone"/> | ||||
|  | ||||
|         <com.simplemobiletools.commons.views.MyEditText | ||||
|             android:id="@+id/contact_number_value" | ||||
|             android:layout_width="match_parent" | ||||
|             android:layout_height="wrap_content" | ||||
|             android:layout_below="@+id/contact_name_value" | ||||
|             android:layout_centerVertical="true" | ||||
|             android:layout_marginStart="@dimen/medium_margin" | ||||
|             android:layout_marginTop="@dimen/activity_margin" | ||||
|             android:layout_toRightOf="@+id/contact_name_image" | ||||
|             android:hint="@string/number" | ||||
|             android:inputType="phone" | ||||
|             android:lines="1" | ||||
|             android:maxLines="1" | ||||
|             android:singleLine="true" | ||||
|             android:textSize="@dimen/big_text_size"/> | ||||
|  | ||||
|         <ImageView | ||||
|             android:id="@+id/contact_email_image" | ||||
|             android:layout_width="wrap_content" | ||||
|             android:layout_height="match_parent" | ||||
|             android:layout_alignBottom="@+id/contact_email_value" | ||||
|             android:layout_alignTop="@+id/contact_email_value" | ||||
|             android:paddingBottom="@dimen/medium_margin" | ||||
|             android:paddingTop="@dimen/medium_margin" | ||||
|             android:src="@drawable/ic_email"/> | ||||
|  | ||||
|         <com.simplemobiletools.commons.views.MyEditText | ||||
|             android:id="@+id/contact_email_value" | ||||
|             android:layout_width="match_parent" | ||||
|             android:layout_height="wrap_content" | ||||
|             android:layout_below="@+id/contact_number_value" | ||||
|             android:layout_centerVertical="true" | ||||
|             android:layout_marginStart="@dimen/medium_margin" | ||||
|             android:layout_marginTop="@dimen/activity_margin" | ||||
|             android:layout_toRightOf="@+id/contact_name_image" | ||||
|             android:hint="@string/email" | ||||
|             android:inputType="textEmailAddress" | ||||
|             android:lines="1" | ||||
|             android:maxLines="1" | ||||
|             android:singleLine="true" | ||||
|             android:textSize="@dimen/big_text_size"/> | ||||
|  | ||||
|     </RelativeLayout> | ||||
| </ScrollView> | ||||
| @@ -33,6 +33,7 @@ | ||||
|             android:maxLines="1" | ||||
|             android:paddingLeft="@dimen/small_margin" | ||||
|             android:paddingTop="@dimen/small_margin" | ||||
|             android:textSize="@dimen/normal_text_size" | ||||
|             tools:text="John Doe"/> | ||||
|  | ||||
|         <TextView | ||||
| @@ -43,7 +44,7 @@ | ||||
|             android:layout_toRightOf="@+id/contact_tmb" | ||||
|             android:maxLines="1" | ||||
|             android:paddingLeft="@dimen/small_margin" | ||||
|             android:textSize="@dimen/smaller_text_size" | ||||
|             android:textSize="@dimen/normal_text_size" | ||||
|             tools:text="0123 456 789"/> | ||||
|  | ||||
|     </RelativeLayout> | ||||
|   | ||||
| @@ -2,4 +2,13 @@ | ||||
|     <string name="app_name">Jednoduché kontakty</string> | ||||
|     <string name="app_launcher_name">Kontakty</string> | ||||
|     <string name="number">Číslo</string> | ||||
|  | ||||
|     <string name="new_contact">Nový kontakt</string> | ||||
|     <string name="edit_contact">Upraviť kontakt</string> | ||||
|     <string name="email">Email</string> | ||||
|  | ||||
|     <!-- | ||||
|         Haven't found some strings? There's more at | ||||
|         https://github.com/SimpleMobileTools/Simple-Commons/tree/master/commons/src/main/res | ||||
|     --> | ||||
| </resources> | ||||
|   | ||||
							
								
								
									
										4
									
								
								app/src/main/res/values/dimens.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								app/src/main/res/values/dimens.xml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,4 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <resources> | ||||
|     <dimen name="contact_photo_size">80dp</dimen> | ||||
| </resources> | ||||
| @@ -2,4 +2,13 @@ | ||||
|     <string name="app_name">Simple Contacts</string> | ||||
|     <string name="app_launcher_name">Contacts</string> | ||||
|     <string name="number">Number</string> | ||||
|  | ||||
|     <string name="new_contact">New contact</string> | ||||
|     <string name="edit_contact">Edit contact</string> | ||||
|     <string name="email">Email</string> | ||||
|  | ||||
|     <!-- | ||||
|         Haven't found some strings? There's more at | ||||
|         https://github.com/SimpleMobileTools/Simple-Commons/tree/master/commons/src/main/res | ||||
|     --> | ||||
| </resources> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user