feat(ui): Add new interaction buttons and icons for voice assistant overlay
This commit is contained in:
@@ -10,20 +10,48 @@ import android.app.assist.AssistContent
|
|||||||
class ConduitVoiceInteractionSession(context: Context) : VoiceInteractionSession(context) {
|
class ConduitVoiceInteractionSession(context: Context) : VoiceInteractionSession(context) {
|
||||||
|
|
||||||
private var capturedContext: String? = null
|
private var capturedContext: String? = null
|
||||||
private var summarizeButton: android.widget.Button? = null
|
|
||||||
|
|
||||||
override fun onCreateContentView(): android.view.View {
|
override fun onCreateContentView(): android.view.View {
|
||||||
val view = layoutInflater.inflate(app.cogwheel.conduit.R.layout.assistant_overlay, null)
|
val view = layoutInflater.inflate(app.cogwheel.conduit.R.layout.assistant_overlay, null)
|
||||||
summarizeButton = view.findViewById(app.cogwheel.conduit.R.id.btn_summarize)
|
|
||||||
|
// Share screen button
|
||||||
|
val shareScreenButton = view.findViewById<android.view.View>(app.cogwheel.conduit.R.id.btn_share_screen)
|
||||||
|
shareScreenButton?.setOnClickListener {
|
||||||
|
// TODO: Implement share screen functionality
|
||||||
|
launchAppWithContext()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Summarize page button
|
||||||
|
val summarizeButton = view.findViewById<android.view.View>(app.cogwheel.conduit.R.id.btn_summarize)
|
||||||
summarizeButton?.setOnClickListener {
|
summarizeButton?.setOnClickListener {
|
||||||
launchAppWithContext()
|
launchAppWithContext()
|
||||||
}
|
}
|
||||||
|
|
||||||
val closeButton = view.findViewById<android.view.View>(app.cogwheel.conduit.R.id.btn_close)
|
// Ask about page button
|
||||||
closeButton?.setOnClickListener {
|
val askAboutButton = view.findViewById<android.view.View>(app.cogwheel.conduit.R.id.btn_ask_about)
|
||||||
finish()
|
askAboutButton?.setOnClickListener {
|
||||||
|
launchAppWithContext()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Input area (opens text input)
|
||||||
|
val inputArea = view.findViewById<android.view.View>(app.cogwheel.conduit.R.id.input_area)
|
||||||
|
inputArea?.setOnClickListener {
|
||||||
|
launchAppWithContext()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Voice button
|
||||||
|
val voiceButton = view.findViewById<android.view.View>(app.cogwheel.conduit.R.id.btn_voice)
|
||||||
|
voiceButton?.setOnClickListener {
|
||||||
|
// TODO: Implement voice input functionality
|
||||||
|
launchAppWithContext()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sparkle button (AI actions)
|
||||||
|
val sparkleButton = view.findViewById<android.view.View>(app.cogwheel.conduit.R.id.btn_sparkle)
|
||||||
|
sparkleButton?.setOnClickListener {
|
||||||
|
launchAppWithContext()
|
||||||
|
}
|
||||||
|
|
||||||
return view
|
return view
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle">
|
||||||
|
<solid android:color="#1F1F1F" />
|
||||||
|
<corners android:radius="28dp" />
|
||||||
|
</shape>
|
||||||
10
android/app/src/main/res/drawable/ic_add.xml
Normal file
10
android/app/src/main/res/drawable/ic_add.xml
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24">
|
||||||
|
<path
|
||||||
|
android:fillColor="#FFFFFF"
|
||||||
|
android:pathData="M19,13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/>
|
||||||
|
</vector>
|
||||||
10
android/app/src/main/res/drawable/ic_ask.xml
Normal file
10
android/app/src/main/res/drawable/ic_ask.xml
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24">
|
||||||
|
<path
|
||||||
|
android:fillColor="#FFFFFF"
|
||||||
|
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM13,19h-2v-2h2V19zM15.07,11.25l-0.9,0.92C13.45,12.9 13,13.5 13,15h-2v-0.5c0,-1.1 0.45,-2.1 1.17,-2.83l1.24,-1.26c0.37,-0.36 0.59,-0.86 0.59,-1.41 0,-1.1 -0.9,-2 -2,-2s-2,0.9 -2,2H8c0,-2.21 1.79,-4 4,-4s4,1.79 4,4c0,0.88 -0.36,1.68 -0.93,2.25z"/>
|
||||||
|
</vector>
|
||||||
10
android/app/src/main/res/drawable/ic_share.xml
Normal file
10
android/app/src/main/res/drawable/ic_share.xml
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24">
|
||||||
|
<path
|
||||||
|
android:fillColor="#FFFFFF"
|
||||||
|
android:pathData="M18,16.08c-0.76,0 -1.44,0.3 -1.96,0.77L8.91,12.7c0.05,-0.23 0.09,-0.46 0.09,-0.7s-0.04,-0.47 -0.09,-0.7l7.05,-4.11c0.54,0.5 1.25,0.81 2.04,0.81 1.66,0 3,-1.34 3,-3s-1.34,-3 -3,-3 -3,1.34 -3,3c0,0.24 0.04,0.47 0.09,0.7L8.04,9.81C7.5,9.31 6.79,9 6,9c-1.66,0 -3,1.34 -3,3s1.34,3 3,3c0.79,0 1.5,-0.31 2.04,-0.81l7.12,4.16c-0.05,0.21 -0.08,0.43 -0.08,0.65 0,1.61 1.31,2.92 2.92,2.92 1.61,0 2.92,-1.31 2.92,-2.92s-1.31,-2.92 -2.92,-2.92z"/>
|
||||||
|
</vector>
|
||||||
13
android/app/src/main/res/drawable/ic_sparkle.xml
Normal file
13
android/app/src/main/res/drawable/ic_sparkle.xml
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24">
|
||||||
|
<path
|
||||||
|
android:fillColor="#FFFFFF"
|
||||||
|
android:pathData="M12,2l1.5,5.5L19,9l-5.5,1.5L12,16l-1.5,-5.5L5,9l5.5,-1.5L12,2z"/>
|
||||||
|
<path
|
||||||
|
android:fillColor="#FFFFFF"
|
||||||
|
android:pathData="M19,15l0.94,2.06L22,18l-2.06,0.94L19,21l-0.94,-2.06L16,18l2.06,-0.94L19,15z"/>
|
||||||
|
</vector>
|
||||||
10
android/app/src/main/res/drawable/ic_summarize.xml
Normal file
10
android/app/src/main/res/drawable/ic_summarize.xml
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24">
|
||||||
|
<path
|
||||||
|
android:fillColor="#FFFFFF"
|
||||||
|
android:pathData="M14,2H6C4.9,2 4,2.9 4,4v16c0,1.1 0.89,2 1.99,2H18c1.1,0 2,-0.9 2,-2V8L14,2zM16,18H8v-2h8V18zM16,14H8v-2h8V14zM13,9V3.5L18.5,9H13z"/>
|
||||||
|
</vector>
|
||||||
10
android/app/src/main/res/drawable/ic_voice.xml
Normal file
10
android/app/src/main/res/drawable/ic_voice.xml
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24">
|
||||||
|
<path
|
||||||
|
android:fillColor="#FFFFFF"
|
||||||
|
android:pathData="M12,14c1.66,0 2.99,-1.34 2.99,-3L15,5c0,-1.66 -1.34,-3 -3,-3S9,3.34 9,5v6c0,1.66 1.34,3 3,3zM17.3,11c0,3 -2.54,5.1 -5.3,5.1S6.7,14 6.7,11H5c0,3.41 2.72,6.23 6,6.72V21h2v-3.28c3.28,-0.48 6,-3.3 6,-6.72h-1.7z"/>
|
||||||
|
</vector>
|
||||||
6
android/app/src/main/res/drawable/input_bar_bg.xml
Normal file
6
android/app/src/main/res/drawable/input_bar_bg.xml
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle">
|
||||||
|
<solid android:color="#2D2D2D" />
|
||||||
|
<corners android:radius="28dp" />
|
||||||
|
</shape>
|
||||||
5
android/app/src/main/res/drawable/voice_button_bg.xml
Normal file
5
android/app/src/main/res/drawable/voice_button_bg.xml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="oval">
|
||||||
|
<solid android:color="#3D3D3D" />
|
||||||
|
</shape>
|
||||||
@@ -1,67 +1,205 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="match_parent"
|
||||||
android:padding="16dp">
|
android:background="#99000000">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="bottom"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:background="@drawable/rounded_overlay_bg"
|
android:padding="20dp"
|
||||||
android:padding="24dp"
|
android:layout_margin="16dp">
|
||||||
android:elevation="8dp"
|
|
||||||
android:layout_marginBottom="16dp">
|
|
||||||
|
|
||||||
|
<!-- Action Buttons -->
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal"
|
android:orientation="vertical"
|
||||||
android:gravity="center_vertical"
|
android:layout_gravity="start"
|
||||||
android:layout_marginBottom="24dp">
|
android:layout_marginBottom="16dp">
|
||||||
|
|
||||||
<!-- App Icon Placeholder (optional) -->
|
|
||||||
<!-- <ImageView ... /> -->
|
|
||||||
|
|
||||||
<TextView
|
<!-- Share screen with Live button -->
|
||||||
android:layout_width="0dp"
|
<LinearLayout
|
||||||
|
android:id="@+id/btn_share_screen"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:orientation="horizontal"
|
||||||
android:text="Conduit"
|
android:background="@drawable/dark_rounded_button_bg"
|
||||||
android:textSize="20sp"
|
android:paddingStart="16dp"
|
||||||
android:textStyle="bold"
|
android:paddingEnd="20dp"
|
||||||
android:textColor="@android:color/black"
|
android:paddingTop="14dp"
|
||||||
android:fontFamily="sans-serif-medium"/>
|
android:paddingBottom="14dp"
|
||||||
|
android:gravity="center_vertical"
|
||||||
<!-- Close Button (X) -->
|
android:layout_marginBottom="12dp"
|
||||||
<ImageView
|
android:clickable="true"
|
||||||
android:id="@+id/btn_close"
|
android:focusable="true">
|
||||||
android:layout_width="24dp"
|
|
||||||
android:layout_height="24dp"
|
<ImageView
|
||||||
android:src="@android:drawable/ic_menu_close_clear_cancel"
|
android:layout_width="24dp"
|
||||||
android:alpha="0.5"/>
|
android:layout_height="24dp"
|
||||||
|
android:src="@drawable/ic_share"
|
||||||
|
android:layout_marginEnd="12dp"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Share screen with Live"
|
||||||
|
android:textColor="@android:color/white"
|
||||||
|
android:textSize="16sp"/>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<!-- Summarize page button -->
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/btn_summarize"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:background="@drawable/dark_rounded_button_bg"
|
||||||
|
android:paddingStart="16dp"
|
||||||
|
android:paddingEnd="20dp"
|
||||||
|
android:paddingTop="14dp"
|
||||||
|
android:paddingBottom="14dp"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:layout_marginBottom="12dp"
|
||||||
|
android:clickable="true"
|
||||||
|
android:focusable="true">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="24dp"
|
||||||
|
android:layout_height="24dp"
|
||||||
|
android:src="@drawable/ic_summarize"
|
||||||
|
android:layout_marginEnd="12dp"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Summarize page"
|
||||||
|
android:textColor="@android:color/white"
|
||||||
|
android:textSize="16sp"/>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<!-- Ask about page button -->
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/btn_ask_about"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:background="@drawable/dark_rounded_button_bg"
|
||||||
|
android:paddingStart="16dp"
|
||||||
|
android:paddingEnd="20dp"
|
||||||
|
android:paddingTop="14dp"
|
||||||
|
android:paddingBottom="14dp"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:clickable="true"
|
||||||
|
android:focusable="true">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="24dp"
|
||||||
|
android:layout_height="24dp"
|
||||||
|
android:src="@drawable/ic_ask"
|
||||||
|
android:layout_marginEnd="12dp"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Ask about page"
|
||||||
|
android:textColor="@android:color/white"
|
||||||
|
android:textSize="16sp"/>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<TextView
|
<!-- Bottom Input Bar -->
|
||||||
android:layout_width="match_parent"
|
<RelativeLayout
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="I can read your screen to help you."
|
|
||||||
android:textSize="16sp"
|
|
||||||
android:textColor="#5F6368"
|
|
||||||
android:layout_marginBottom="24dp"/>
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/btn_summarize"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="56dp"
|
android:layout_height="56dp"
|
||||||
android:text="Summarize this screen"
|
android:background="@drawable/input_bar_bg"
|
||||||
android:textAllCaps="false"
|
android:paddingStart="20dp"
|
||||||
android:textSize="16sp"
|
android:paddingEnd="8dp">
|
||||||
android:textStyle="bold"
|
|
||||||
android:textColor="@android:color/white"
|
<!-- Plus button -->
|
||||||
android:background="@drawable/rounded_button_bg"
|
<ImageView
|
||||||
android:stateListAnimator="@null"
|
android:id="@+id/btn_add"
|
||||||
android:elevation="0dp"/>
|
android:layout_width="28dp"
|
||||||
|
android:layout_height="28dp"
|
||||||
|
android:layout_alignParentStart="true"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:src="@drawable/ic_add"
|
||||||
|
android:alpha="0.7"
|
||||||
|
android:clickable="true"
|
||||||
|
android:focusable="true"/>
|
||||||
|
|
||||||
|
<!-- Ask Conduit text with security icon -->
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/input_area"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_toEndOf="@id/btn_add"
|
||||||
|
android:layout_toStartOf="@id/btn_voice"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_marginStart="12dp"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:clickable="true"
|
||||||
|
android:focusable="true">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="16dp"
|
||||||
|
android:layout_height="16dp"
|
||||||
|
android:src="@android:drawable/ic_secure"
|
||||||
|
android:alpha="0.5"
|
||||||
|
android:layout_marginEnd="6dp"
|
||||||
|
android:tint="@android:color/white"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Ask Conduit"
|
||||||
|
android:textColor="@android:color/white"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:alpha="0.6"/>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<!-- Voice button -->
|
||||||
|
<FrameLayout
|
||||||
|
android:id="@+id/btn_voice"
|
||||||
|
android:layout_width="40dp"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
android:layout_toStartOf="@id/btn_sparkle"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_marginEnd="8dp"
|
||||||
|
android:background="@drawable/voice_button_bg"
|
||||||
|
android:clickable="true"
|
||||||
|
android:focusable="true">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="20dp"
|
||||||
|
android:layout_height="20dp"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:src="@drawable/ic_voice"/>
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
|
<!-- Sparkle button -->
|
||||||
|
<FrameLayout
|
||||||
|
android:id="@+id/btn_sparkle"
|
||||||
|
android:layout_width="40dp"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
android:layout_alignParentEnd="true"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:background="@drawable/voice_button_bg"
|
||||||
|
android:clickable="true"
|
||||||
|
android:focusable="true">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="20dp"
|
||||||
|
android:layout_height="20dp"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:src="@drawable/ic_sparkle"/>
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|||||||
Reference in New Issue
Block a user