Browse Source

add entry to share location

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
Marcel Hibbe 4 years ago
parent
commit
c6d3abf421

+ 4 - 0
app/src/main/java/com/nextcloud/talk/controllers/ChatController.kt

@@ -793,6 +793,10 @@ class ChatController(args: Bundle) :
         )
     }
 
+    fun showShareLocationScreen(){
+        Log.d(TAG, "showShareLocationScreen")
+    }
+
     private fun showConversationInfoScreen() {
         val bundle = Bundle()
         bundle.putParcelable(BundleKeys.KEY_USER_ENTITY, conversationUser)

+ 9 - 0
app/src/main/java/com/nextcloud/talk/ui/dialog/AttachmentDialog.kt

@@ -35,6 +35,10 @@ import com.nextcloud.talk.models.database.CapabilitiesUtil
 
 class AttachmentDialog(val activity: Activity, var chatController: ChatController) : BottomSheetDialog(activity) {
 
+    @BindView(R.id.txt_share_location)
+    @JvmField
+    var shareLocation: AppCompatTextView? = null
+
     @BindView(R.id.txt_attach_file_from_local)
     @JvmField
     var attachFromLocal: AppCompatTextView? = null
@@ -60,6 +64,11 @@ class AttachmentDialog(val activity: Activity, var chatController: ChatControlle
             String.format(it.getString(R.string.nc_upload_from_cloud), serverName)
         }
 
+        shareLocation?.setOnClickListener {
+            chatController.showShareLocationScreen()
+            dismiss()
+        }
+
         attachFromLocal?.setOnClickListener {
             chatController.sendSelectLocalFileIntent()
             dismiss()

+ 10 - 0
app/src/main/res/drawable/ic_baseline_location_on_24.xml

@@ -0,0 +1,10 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:width="24dp"
+    android:height="24dp"
+    android:viewportWidth="24"
+    android:viewportHeight="24"
+    android:tint="?attr/colorControlNormal">
+  <path
+      android:fillColor="#757575"
+      android:pathData="M12,2C8.13,2 5,5.13 5,9c0,5.25 7,13 7,13s7,-7.75 7,-13c0,-3.87 -3.13,-7 -7,-7zM12,11.5c-1.38,0 -2.5,-1.12 -2.5,-2.5s1.12,-2.5 2.5,-2.5 2.5,1.12 2.5,2.5 -1.12,2.5 -2.5,2.5z"/>
+</vector>

+ 32 - 0
app/src/main/res/layout/dialog_attachment.xml

@@ -38,6 +38,38 @@
         android:textColor="@color/medium_emphasis_text"
         android:textSize="@dimen/bottom_sheet_text_size" />
 
+    <LinearLayout
+        android:id="@+id/menu_share_location"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:background="?android:attr/selectableItemBackground"
+        android:orientation="horizontal"
+        android:paddingLeft="@dimen/standard_padding"
+        android:paddingTop="@dimen/standard_half_padding"
+        android:paddingRight="@dimen/standard_padding"
+        android:paddingBottom="@dimen/standard_half_padding"
+        tools:ignore="UseCompoundDrawables">
+
+        <ImageView
+            android:id="@+id/menu_icon_share_location"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:contentDescription="@null"
+            android:src="@drawable/ic_baseline_location_on_24"
+            app:tint="@color/colorPrimary" />
+
+        <androidx.appcompat.widget.AppCompatTextView
+            android:id="@+id/txt_share_location"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_gravity="center_vertical"
+            android:layout_marginStart="@dimen/standard_margin"
+            android:text="@string/nc_share_location"
+            android:textColor="@color/high_emphasis_text"
+            android:textSize="@dimen/bottom_sheet_text_size" />
+
+    </LinearLayout>
+
     <LinearLayout
         android:id="@+id/menu_attach_file_from_local"
         android:layout_width="match_parent"

+ 3 - 0
app/src/main/res/values/strings.xml

@@ -371,6 +371,9 @@
     <string name="nc_upload_confirm_send_single">Send this file to %1$s?</string>
     <string name="nc_upload_in_progess">Uploading</string>
 
+    <!-- location sharing -->
+    <string name="nc_share_location">Share location</string>
+
     <!-- Phonebook Integration -->
     <string name="nc_settings_phone_book_integration_key" translatable="false">phone_book_integration</string>
     <string name="nc_settings_phone_book_integration_desc">Match contacts based on phone number to integrate Talk shortcut into system contacts app</string>