Identity: cleanup UI

This commit is contained in:
Benoit Marty 2020-05-07 03:01:44 +02:00
parent 3aa6de7cf5
commit 8dd5f88dba
15 changed files with 38 additions and 35 deletions

View file

@ -31,10 +31,12 @@ interface IdentityService {
fun getCurrentIdentityServer(): String?
/**
* Update the identity server url.
* @param url the new url. Set to null to disconnect from the identity server
*/
fun setNewIdentityServer(url: String?, callback: MatrixCallback<Unit>): Cancelable
fun disconnect()
fun startBindSession(threePid: ThreePid, nothing: Nothing?, matrixCallback: MatrixCallback<ThreePid>)
fun finalizeBindSessionFor3PID(threePid: ThreePid, matrixCallback: MatrixCallback<Unit>)
fun submitValidationToken(pid: ThreePid, code: String, matrixCallback: MatrixCallback<Unit>)

View file

@ -114,10 +114,6 @@ internal class DefaultIdentityService @Inject constructor(
return identityServiceStore.get()?.identityServerUrl
}
override fun disconnect() {
TODO("Not yet implemented")
}
override fun startBindSession(threePid: ThreePid, nothing: Nothing?, matrixCallback: MatrixCallback<ThreePid>) {
TODO("Not yet implemented")
}

View file

@ -17,11 +17,13 @@
package im.vector.matrix.android.internal.session.identity.db
import im.vector.matrix.android.internal.di.IdentityDatabase
import im.vector.matrix.android.internal.session.SessionScope
import im.vector.matrix.android.internal.session.identity.model.IdentityHashDetailResponse
import io.realm.Realm
import io.realm.RealmConfiguration
import javax.inject.Inject
@SessionScope
internal class RealmIdentityServerStore @Inject constructor(
@IdentityDatabase
private val realmConfiguration: RealmConfiguration

View file

@ -23,7 +23,7 @@ import retrofit2.Call
import retrofit2.http.GET
import retrofit2.http.Path
interface ProfileAPI {
internal interface ProfileAPI {
/**
* Get the combined profile information for this user.

View file

@ -55,10 +55,10 @@ abstract class SettingsButtonItem : EpoxyModelWithHolder<SettingsButtonItem.Hold
when (buttonStyle) {
SettingsTextButtonItem.ButtonStyle.POSITIVE -> {
holder.button.setTextColor(colorProvider.getColorFromAttribute(R.attr.colorAccent))
holder.button.setTextColor(colorProvider.getColor(R.color.riotx_accent))
}
SettingsTextButtonItem.ButtonStyle.DESTRUCTIVE -> {
holder.button.setTextColor(colorProvider.getColor(R.color.vector_error_color))
holder.button.setTextColor(colorProvider.getColor(R.color.riotx_destructive_accent))
}
}

View file

@ -42,7 +42,7 @@ class SetIdentityServerFragment @Inject constructor(
override fun getLayoutResId() = R.layout.fragment_set_identity_server
override fun getMenuRes() = R.menu.menu_phone_number_addition
override fun getMenuRes() = R.menu.menu_submit
@BindView(R.id.discovery_identity_server_enter_til)
lateinit var mKeyInputLayout: TextInputLayout
@ -73,17 +73,16 @@ class SetIdentityServerFragment @Inject constructor(
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {
when (item.itemId) {
// TODO Create another menu
R.id.action_add_phone_number -> {
return when (item.itemId) {
R.id.action_submit -> {
withState(viewModel) { state ->
if (!state.isVerifyingServer) {
viewModel.handle(SetIdentityServerAction.DoChangeServerName)
}
}
return true
true
}
else -> return super.onOptionsItemSelected(item)
else -> super.onOptionsItemSelected(item)
}
}

View file

@ -3,8 +3,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
android:layout_height="match_parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
@ -12,6 +11,7 @@
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/discovery_identity_server_enter_til"
style="@style/VectorTextInputLayout"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
@ -41,6 +41,7 @@
android:id="@+id/discovery_identity_server_loading"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="32dp"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"

View file

@ -2,11 +2,12 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:minHeight="64dp"
android:layout_height="wrap_content">
<Button
android:id="@+id/settings_item_button"
style="@style/VectorButtonStyle"
style="@style/VectorButtonStyleText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"

View file

@ -7,9 +7,9 @@
android:foreground="?attr/selectableItemBackground"
android:orientation="vertical"
android:paddingStart="@dimen/layout_horizontal_margin"
android:paddingTop="8dp"
android:paddingTop="@dimen/layout_vertical_margin"
android:paddingEnd="@dimen/layout_horizontal_margin"
android:paddingBottom="8dp">
android:paddingBottom="@dimen/layout_vertical_margin">
<LinearLayout
@ -40,7 +40,7 @@
<Button
android:id="@+id/settings_item_button"
style="@style/VectorButtonStyle"
style="@style/VectorButtonStyleText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="invisible"

View file

@ -7,9 +7,9 @@
android:background="?attr/colorBackgroundFloating"
android:orientation="vertical"
android:paddingStart="@dimen/layout_horizontal_margin"
android:paddingTop="8dp"
android:paddingTop="@dimen/layout_vertical_margin"
android:paddingEnd="@dimen/layout_horizontal_margin"
android:paddingBottom="8dp">
android:paddingBottom="@dimen/layout_vertical_margin">
<LinearLayout
android:layout_width="match_parent"
@ -27,7 +27,7 @@
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/settings_item_enter_til"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
style="@style/VectorTextInputLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:errorEnabled="true">
@ -47,7 +47,7 @@
<Button
android:id="@+id/settings_item_enter_button"
style="@style/VectorButtonStyle"
style="@style/VectorButtonStyleText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"

View file

@ -6,9 +6,10 @@
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
android:drawablePadding="8dp"
android:orientation="vertical"
android:paddingStart="@dimen/layout_horizontal_margin"
android:paddingTop="8dp"
android:paddingEnd="@dimen/layout_horizontal_margin"
android:paddingBottom="8dp"
android:textColor="?android:textColorSecondary"
android:textSize="14sp"
tools:drawableStart="@drawable/vector_warning_red"

View file

@ -6,9 +6,9 @@
android:background="?attr/colorBackgroundFloating"
android:orientation="horizontal"
android:paddingStart="@dimen/layout_horizontal_margin"
android:paddingTop="8dp"
android:paddingTop="@dimen/layout_vertical_margin"
android:paddingEnd="@dimen/layout_horizontal_margin"
android:paddingBottom="8dp">
android:paddingBottom="@dimen/layout_vertical_margin">
<FrameLayout

View file

@ -4,8 +4,8 @@
android:id="@+id/settings_section_title_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginBottom="4dp"
android:layout_marginTop="@dimen/layout_vertical_margin"
android:layout_marginBottom="@dimen/layout_vertical_margin"
android:orientation="vertical"
android:paddingStart="@dimen/layout_horizontal_margin"
android:paddingEnd="@dimen/layout_horizontal_margin"

View file

@ -6,9 +6,9 @@
android:background="?attr/colorBackgroundFloating"
android:orientation="horizontal"
android:paddingStart="@dimen/layout_horizontal_margin"
android:paddingTop="8dp"
android:paddingTop="@dimen/layout_vertical_margin"
android:paddingEnd="@dimen/layout_horizontal_margin"
android:paddingBottom="8dp">
android:paddingBottom="@dimen/layout_vertical_margin">
<LinearLayout
android:layout_width="0dp"

View file

@ -3,9 +3,10 @@
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/action_add_phone_number"
android:icon="@drawable/ic_material_done_white"
android:title="@string/settings_add_phone_number"
android:id="@+id/action_submit"
android:icon="@drawable/ic_material_done"
android:title="@string/ok"
app:iconTint="@color/riotx_accent"
app:showAsAction="always" />
</menu>