Skip to content

Send and receive SMS messages using your Android phone programmatically via a simple HTTP API

Fix layout

Acho Arnoldc36cf5872fe2
diff --git a/android/app/src/main/java/com/httpsms/LoginActivity.kt b/android/app/src/main/java/com/httpsms/LoginActivity.kt
index c878f3b9..5ee497c9 100644
--- a/android/app/src/main/java/com/httpsms/LoginActivity.kt
+++ b/android/app/src/main/java/com/httpsms/LoginActivity.kt
@@ -13,6 +13,7 @@ import timber.log.Timber
class LoginActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
+ redirectToMain()
setContentView(R.layout.activity_login)
registerListeners()
}
diff --git a/android/app/src/main/res/layout/activity_main.xml b/android/app/src/main/res/layout/activity_main.xml
index 90761634..44f0f0e1 100644
--- a/android/app/src/main/res/layout/activity_main.xml
+++ b/android/app/src/main/res/layout/activity_main.xml
@@ -3,71 +3,98 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
+ android:paddingLeft="16dp"
+ android:paddingRight="16dp"
android:layout_height="match_parent"
tools:context=".MainActivity">
+ <ImageView
+ android:id="@+id/imageView"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="16dp"
+ android:contentDescription="@string/img_http_sms_logo"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent"
+ app:srcCompat="@drawable/ic_colored_logo"
+ tools:ignore="ImageContrastCheck" />
+
<com.google.android.material.card.MaterialCardView
android:id="@+id/card"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_margin="8dp"
+ android:elevation="16dp"
+ app:cardCornerRadius="16dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical"
- android:padding="16dp">
-
- <!-- Title, secondary and supporting text -->
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="horizontal">
+ </com.google.android.material.card.MaterialCardView>
- <TextView
- android:id="@+id/cardPhoneNumber"
- android:layout_width="wrap_content"
- android:layout_height="match_parent"
- android:text="@string/phone_number"
- android:textAppearance="?attr/textAppearanceTitleMedium"
- android:textColor="?android:attr/textColorPrimary"
- android:textSize="28sp" />
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="32dp"
+ android:orientation="vertical"
+ android:padding="16dp"
+ android:background="#1E1E1E"
+ app:layout_constraintTop_toBottomOf="@+id/imageView"
+ tools:layout_editor_absoluteX="0dp">
- <com.google.android.material.switchmaterial.SwitchMaterial
- android:id="@+id/cardSwitch"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:minHeight="48dp"
- android:text=""
- tools:ignore="TouchTargetSizeCheck" />
- </LinearLayout>
+ <!-- Title, secondary and supporting text -->
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="horizontal">
<TextView
- android:id="@+id/cardRefreshTime"
+ android:id="@+id/cardPhoneNumber"
android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginTop="8dp"
- android:text="@string/nextRefreshTime"
- android:textAppearance="?attr/textAppearanceBodyMedium"
- android:textColor="?android:attr/textColorSecondary"
- android:textSize="16sp" />
+ android:layout_height="match_parent"
+ android:text="@string/phone_number"
+ android:textAppearance="?attr/textAppearanceTitleMedium"
+ android:textColor="?android:attr/textColorPrimary"
+ android:textSize="28sp" />
+ <com.google.android.material.switchmaterial.SwitchMaterial
+ android:id="@+id/cardSwitch"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:minHeight="48dp"
+ tools:ignore="TouchTargetSizeCheck" />
</LinearLayout>
- </com.google.android.material.card.MaterialCardView>
- <Button
- android:id="@+id/sign_in_button"
+ <TextView
+ android:id="@+id/cardRefreshTime"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="8dp"
+ android:text="@string/nextRefreshTime"
+ android:textAppearance="?attr/textAppearanceBodyMedium"
+ android:textColor="?android:attr/textColorSecondary"
+ android:textSize="16sp" />
+
+ </LinearLayout>
+
+ <com.google.android.material.button.MaterialButton
+ style="@style/Widget.MaterialComponents.Button.Icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_marginTop="32dp"
- android:text="@string/sign_in_button"
+ android:layout_marginBottom="16dp"
+ android:backgroundTint="@color/black"
+ android:drawableTint="@color/white"
+ android:padding="10dp"
+ android:text="@string/main_log_out"
+ android:textColor="@color/white"
+ android:textSize="16sp"
+ app:icon="@drawable/ic_login"
+ app:iconTint="@color/white"
+ app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toBottomOf="@+id/card" />
+ tools:ignore="TextContrastCheck" />
</androidx.constraintlayout.widget.ConstraintLayout>
diff --git a/android/app/src/main/res/values/strings.xml b/android/app/src/main/res/values/strings.xml
index 8c63d073..37072b4b 100644
--- a/android/app/src/main/res/values/strings.xml
+++ b/android/app/src/main/res/values/strings.xml
@@ -9,4 +9,5 @@
<string name="text_area_api_key">API Key</string>
<string name="img_http_sms_logo">HTTP Sms Logo</string>
<string name="get_your_api_key">Open\nhttpsms.com/settings\nto get your API key</string>
+ <string name="main_log_out">Log Out</string>
</resources>