Show overlay on compose activity when attaching

This commit is contained in:
Moez Bhatti
2018-06-27 18:33:20 -04:00
parent 72f561b00f
commit a0074d9fab
2 changed files with 89 additions and 72 deletions
@@ -59,6 +59,7 @@ import com.moez.QKSMS.model.Message
import com.uber.autodispose.kotlin.autoDisposable
import dagger.android.AndroidInjection
import io.reactivex.Observable
import io.reactivex.rxkotlin.Observables
import io.reactivex.subjects.PublishSubject
import io.reactivex.subjects.Subject
import kotlinx.android.synthetic.main.compose_activity.*
@@ -96,7 +97,7 @@ class ComposeActivity : QkThemedActivity(), ComposeView {
override val cancelSendingIntent: Subject<Message> by lazy { messageAdapter.cancelSending }
override val attachmentDeletedIntent: Subject<Attachment> by lazy { attachmentAdapter.attachmentDeleted }
override val textChangedIntent by lazy { message.textChanges() }
override val attachIntent by lazy { attach.clicks() }
override val attachIntent by lazy { Observable.merge(attach.clicks(), attachingBackground.clicks()) }
override val cameraIntent by lazy { camera.clicks() }
override val galleryIntent by lazy { gallery.clicks() }
override val scheduleIntent by lazy { schedule.clicks() }
@@ -224,10 +225,8 @@ class ComposeActivity : QkThemedActivity(), ComposeView {
attachments.setVisible(state.attachments.isNotEmpty())
attachmentAdapter.data = state.attachments
attach.animate().rotation(if (state.attaching) 135f else 0f).start()
camera.setVisible(state.attaching)
gallery.setVisible(state.attaching)
schedule.setVisible(state.attaching)
attach.animate().rotation(if (state.attaching) 45f else 0f).start()
attaching.isVisible = state.attaching
counter.text = state.remaining
counter.setVisible(counter.text.isNotBlank())
@@ -164,73 +164,6 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@id/messageBackground" />
<ImageView
android:id="@+id/schedule"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginBottom="12dp"
android:background="@drawable/circle"
android:backgroundTint="?attr/bubbleColor"
android:contentDescription="@string/compose_schedule_cd"
android:elevation="4dp"
android:padding="10dp"
android:src="@drawable/ic_event_black_24dp"
android:tint="?android:attr/textColorSecondary"
android:visibility="visible"
app:layout_constraintBottom_toTopOf="@id/gallery"
app:layout_constraintEnd_toEndOf="@id/attach"
app:layout_constraintStart_toStartOf="@id/attach" />
<ImageView
android:id="@+id/gallery"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginBottom="12dp"
android:background="@drawable/circle"
android:backgroundTint="?attr/bubbleColor"
android:contentDescription="@string/compose_gallery_cd"
android:elevation="4dp"
android:padding="10dp"
android:src="@drawable/ic_insert_photo_black_24dp"
android:tint="?android:attr/textColorSecondary"
android:visibility="visible"
app:layout_constraintBottom_toTopOf="@id/camera"
app:layout_constraintEnd_toEndOf="@id/attach"
app:layout_constraintStart_toStartOf="@id/attach" />
<ImageView
android:id="@+id/camera"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginBottom="16dp"
android:background="@drawable/circle"
android:backgroundTint="?attr/bubbleColor"
android:contentDescription="@string/compose_camera_cd"
android:elevation="4dp"
android:padding="10dp"
android:src="@drawable/ic_camera_alt_black_24dp"
android:tint="?android:attr/textColorSecondary"
android:visibility="visible"
app:layout_constraintBottom_toTopOf="@id/attach"
app:layout_constraintEnd_toEndOf="@id/attach"
app:layout_constraintStart_toStartOf="@id/attach" />
<ImageView
android:id="@+id/attach"
android:layout_width="44dp"
android:layout_height="44dp"
android:layout_marginBottom="8dp"
android:layout_marginStart="8dp"
android:background="@drawable/circle"
android:contentDescription="@string/compose_attach_cd"
android:elevation="4dp"
android:padding="10dp"
android:src="@drawable/ic_add_black_24dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
tools:backgroundTint="@color/tools_theme"
tools:tint="@color/textPrimaryDark" />
<View
android:id="@+id/messageBackground"
android:layout_width="0dp"
@@ -457,4 +390,89 @@
android:background="?android:attr/divider"
app:layout_constraintBottom_toBottomOf="parent" />
<androidx.constraintlayout.widget.Group
android:id="@+id/attaching"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
app:constraint_referenced_ids="schedule, gallery, camera, attachingBackground" />
<View
android:id="@+id/attachingBackground"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="#44000000"
android:elevation="4dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/schedule"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginBottom="12dp"
android:background="@drawable/circle"
android:backgroundTint="?attr/bubbleColor"
android:contentDescription="@string/compose_schedule_cd"
android:elevation="4dp"
android:padding="10dp"
android:src="@drawable/ic_event_black_24dp"
android:tint="?android:attr/textColorSecondary"
android:visibility="visible"
app:layout_constraintBottom_toTopOf="@id/gallery"
app:layout_constraintEnd_toEndOf="@id/attach"
app:layout_constraintStart_toStartOf="@id/attach" />
<ImageView
android:id="@+id/gallery"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginBottom="12dp"
android:background="@drawable/circle"
android:backgroundTint="?attr/bubbleColor"
android:contentDescription="@string/compose_gallery_cd"
android:elevation="4dp"
android:padding="10dp"
android:src="@drawable/ic_insert_photo_black_24dp"
android:tint="?android:attr/textColorSecondary"
android:visibility="visible"
app:layout_constraintBottom_toTopOf="@id/camera"
app:layout_constraintEnd_toEndOf="@id/attach"
app:layout_constraintStart_toStartOf="@id/attach" />
<ImageView
android:id="@+id/camera"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginBottom="16dp"
android:background="@drawable/circle"
android:backgroundTint="?attr/bubbleColor"
android:contentDescription="@string/compose_camera_cd"
android:elevation="4dp"
android:padding="10dp"
android:src="@drawable/ic_camera_alt_black_24dp"
android:tint="?android:attr/textColorSecondary"
android:visibility="visible"
app:layout_constraintBottom_toTopOf="@id/attach"
app:layout_constraintEnd_toEndOf="@id/attach"
app:layout_constraintStart_toStartOf="@id/attach" />
<ImageView
android:id="@+id/attach"
android:layout_width="44dp"
android:layout_height="44dp"
android:layout_marginBottom="8dp"
android:layout_marginStart="8dp"
android:background="@drawable/circle"
android:contentDescription="@string/compose_attach_cd"
android:elevation="4dp"
android:padding="10dp"
android:src="@drawable/ic_add_black_24dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
tools:backgroundTint="@color/tools_theme"
tools:tint="@color/textPrimaryDark" />
</androidx.constraintlayout.widget.ConstraintLayout>