tweak report message screen

This commit is contained in:
Phillip Thelen 2019-04-26 10:28:06 +02:00
parent 40d97c3382
commit 2cb410d203
7 changed files with 63 additions and 41 deletions

View file

@ -2,7 +2,7 @@
android:shape="rectangle"> android:shape="rectangle">
<solid android:color="@color/transparent" /> <solid android:color="@color/transparent" />
<corners android:radius="@dimen/rounded_button_radius" />
<stroke <stroke
android:width="0.5dip" android:width="0.5dip"
android:color="#1f000000"/> android:color="#1f000000"/>

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/blue_100" />
<corners android:radius="@dimen/rounded_button_radius"/>
<padding android:left="0dip" android:top="0dip" android:right="0dip" android:bottom="0dip" />
</shape>

View file

@ -36,12 +36,37 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize" android:minHeight="?attr/actionBarSize"
android:theme="@style/Toolbar" android:theme="@style/Toolbar"
app:title=""
android:background="@color/white" android:background="@color/white"
app:layout_scrollFlags="scroll|enterAlways" app:layout_scrollFlags="scroll|enterAlways"
app:title="@string/report"
app:titleTextColor="@color/gray_50" app:titleTextColor="@color/gray_50"
app:theme="@style/ReportMessageToolbar" app:theme="@style/ReportMessageToolbar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Dark"/> app:popupTheme="@style/ThemeOverlay.AppCompat.Dark">
<ImageButton
android:id="@+id/close_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_close"
android:background="@color/transparent"
android:paddingLeft="@dimen/spacing_small"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/report_violation"
android:textSize="20sp"
android:textColor="@color/gray_50"
android:layout_marginLeft="36dp"
android:id="@+id/toolbar_title" />
<Button
android:id="@+id/report_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/report"
android:textColor="@color/red_50"
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_marginEnd="8dp"
android:layout_gravity="end" />
</androidx.appcompat.widget.Toolbar>
</com.google.android.material.appbar.AppBarLayout> </com.google.android.material.appbar.AppBarLayout>
<androidx.core.widget.NestedScrollView <androidx.core.widget.NestedScrollView
@ -83,6 +108,7 @@
<com.google.android.material.textfield.TextInputLayout <com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:theme="@style/TextInputLayoutAppearanceTheme"
style="@style/TextInputLayoutAppearance" style="@style/TextInputLayoutAppearance"
android:layout_marginTop="@dimen/spacing_large" android:layout_marginTop="@dimen/spacing_large"
android:layout_marginBottom="@dimen/spacing_large"> android:layout_marginBottom="@dimen/spacing_large">
@ -93,7 +119,10 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:hint="@string/reason_for_report" android:hint="@string/reason_for_report"
android:textColor="@color/gray_50" android:textColor="@color/gray_50"
style="@style/TextInputEditText"/> android:paddingBottom="34dp"
android:paddingTop="16dp"
android:paddingStart="@dimen/spacing_large"
android:paddingEnd="@dimen/spacing_large"/>
</com.google.android.material.textfield.TextInputLayout> </com.google.android.material.textfield.TextInputLayout>
<TextView <TextView
@ -104,6 +133,7 @@
tools:text="@string/report_explanation" tools:text="@string/report_explanation"
android:textColor="@color/gray_200" android:textColor="@color/gray_200"
style="@style/Caption3" style="@style/Caption3"
android:textColorLink="@color/brand_400"
/> />
</LinearLayout> </LinearLayout>
</androidx.core.widget.NestedScrollView> </androidx.core.widget.NestedScrollView>

View file

@ -75,7 +75,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:orientation="vertical"
android:background="#cc6133b4" android:background="@color/brand_300"
android:paddingStart="@dimen/spacing_large" android:paddingStart="@dimen/spacing_large"
android:paddingEnd="@dimen/spacing_large" android:paddingEnd="@dimen/spacing_large"
android:paddingTop="@dimen/spacing_large" android:paddingTop="@dimen/spacing_large"

View file

@ -896,4 +896,5 @@
<string name="join_guild">Join Guild</string> <string name="join_guild">Join Guild</string>
<string name="garden">Garden</string> <string name="garden">Garden</string>
<string name="i_agree_to_follow_the_guidelines">I agree to follow the guidelines</string> <string name="i_agree_to_follow_the_guidelines">I agree to follow the guidelines</string>
<string name="report_violation">Report Violation</string>
</resources> </resources>

View file

@ -35,7 +35,7 @@
<item name="actionBarStyle">@color/transparent</item> <item name="actionBarStyle">@color/transparent</item>
<item name="colorPrimary">@color/brand</item> <item name="colorPrimary">@color/brand</item>
<item name="colorPrimaryDark">@color/brand_50</item> <item name="colorPrimaryDark">@color/brand_50</item>
<item name="colorAccent">@color/brand</item> <item name="colorAccent">@color/brand_400</item>
<item name="android:windowContentOverlay">@null</item> <item name="android:windowContentOverlay">@null</item>
</style> </style>
@ -501,25 +501,20 @@
<item name="colorControlNormal">@color/white</item> <item name="colorControlNormal">@color/white</item>
</style> </style>
<style name="TextInputLayoutAppearance" parent="Widget.MaterialComponents.TextInputLayout.FilledBox"> <style name="TextInputLayoutAppearanceTheme">
<item name="android:gravity">top</item>
<item name="boxBackgroundColor">@color/taskform_gray</item> <item name="boxBackgroundColor">@color/taskform_gray</item>
<item name="android:textColor">@color/textColorLight</item> <item name="android:textColor">@color/textColorLight</item>
<item name="android:textColorHint">@color/gray_300</item> <item name="android:textColorHint">@color/gray_300</item>
<item name="colorControlNormal">@color/gray_500</item> <item name="android:colorControlNormal">@color/gray_400</item>
<item name="colorControlActivated">@color/brand_400</item> <item name="android:colorControlActivated">@color/brand_400</item>
<item name="colorControlHighlight">@color/brand_400</item> <item name="android:colorControlHighlight">@color/brand_400</item>
<item name="android:colorAccent">@color/brand_400</item>
</style> </style>
<style name="TextInputEditText"> <style name="TextInputLayoutAppearance" parent="Widget.MaterialComponents.TextInputLayout.FilledBox">
<!-- reference our hint & error styles -->
<item name="android:gravity">top</item>
<item name="boxBackgroundColor">@color/taskform_gray</item> <item name="boxBackgroundColor">@color/taskform_gray</item>
<item name="android:textColor">@color/textColorLight</item> <item name="android:textColor">@color/textColorLight</item>
<item name="android:textColorHint">@color/gray_300</item> <item name="android:textColorHint">@color/gray_300</item>
<item name="colorControlNormal">@color/gray_500</item>
<item name="colorControlActivated">@color/brand_400</item>
<item name="colorControlHighlight">@color/brand_400</item>
</style> </style>
<style name="TaskFormSectionheader"> <style name="TaskFormSectionheader">

View file

@ -2,6 +2,7 @@ package com.habitrpg.android.habitica.ui.activities
import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.graphics.Color import android.graphics.Color
import android.graphics.Typeface
import android.os.Build import android.os.Build
import android.os.Build.VERSION_CODES import android.os.Build.VERSION_CODES
import android.os.Bundle import android.os.Bundle
@ -9,7 +10,9 @@ import android.view.Menu
import android.view.MenuItem import android.view.MenuItem
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.Button
import android.widget.EditText import android.widget.EditText
import android.widget.ImageButton
import android.widget.TextView import android.widget.TextView
import androidx.annotation.RequiresApi import androidx.annotation.RequiresApi
import androidx.appcompat.widget.Toolbar import androidx.appcompat.widget.Toolbar
@ -35,6 +38,9 @@ class ReportMessageActivity : BaseActivity() {
lateinit var socialRepository: SocialRepository lateinit var socialRepository: SocialRepository
private val toolbar: Toolbar by bindView(R.id.toolbar) private val toolbar: Toolbar by bindView(R.id.toolbar)
private val toolbarTextView: TextView by bindView(R.id.toolbar_title)
private val closeButton: ImageButton by bindView(R.id.close_button)
private val reportButton: Button by bindView(R.id.report_button)
private val appBar: AppBarLayout by bindView(R.id.app_bar) private val appBar: AppBarLayout by bindView(R.id.app_bar)
private val bottomSheetView: View by bindView(R.id.bottom_sheet) private val bottomSheetView: View by bindView(R.id.bottom_sheet)
private val contentContainer: ViewGroup by bindView(R.id.content_container) private val contentContainer: ViewGroup by bindView(R.id.content_container)
@ -61,6 +67,7 @@ class ReportMessageActivity : BaseActivity() {
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
setSupportActionBar(toolbar) setSupportActionBar(toolbar)
supportActionBar?.title = ""
raisedElevation = appBar.elevation raisedElevation = appBar.elevation
setStatusBarDim(true) setStatusBarDim(true)
@ -94,26 +101,9 @@ class ReportMessageActivity : BaseActivity() {
chatMessage = it chatMessage = it
}, RxErrorHandler.handleEmptyError())) }, RxErrorHandler.handleEmptyError()))
} }
}
override fun onCreateOptionsMenu(menu: Menu?): Boolean { reportButton.setOnClickListener { reportMessage() }
menuInflater.inflate(R.menu.report_message, menu) closeButton.setOnClickListener { finish() }
return true
}
@Suppress("ReturnCount")
override fun onOptionsItemSelected(item: MenuItem): Boolean {
when (item.itemId) {
R.id.menu_report -> {
reportMessage()
return true
}
android.R.id.home -> {
finish()
return true
}
}
return super.onOptionsItemSelected(item)
} }
override fun onBackPressed() { override fun onBackPressed() {
@ -139,13 +129,13 @@ class ReportMessageActivity : BaseActivity() {
if (dim) { if (dim) {
appBar.elevation = 0f appBar.elevation = 0f
window.statusBarColor = Color.TRANSPARENT window.statusBarColor = Color.TRANSPARENT
supportActionBar?.setDisplayHomeAsUpEnabled(false) closeButton.visibility = View.GONE
supportActionBar?.setHomeAsUpIndicator(null) toolbarTextView.setTypeface(null, Typeface.BOLD)
} else { } else {
appBar.elevation = 8f appBar.elevation = 8f
window.statusBarColor = ContextCompat.getColor(this, R.color.gray_600) window.statusBarColor = ContextCompat.getColor(this, R.color.gray_600)
supportActionBar?.setDisplayHomeAsUpEnabled(true) closeButton.visibility = View.VISIBLE
supportActionBar?.setHomeAsUpIndicator(R.drawable.ic_close) toolbarTextView.setTypeface(null, Typeface.NORMAL)
} }
if (Build.VERSION.SDK_INT >= VERSION_CODES.M) { if (Build.VERSION.SDK_INT >= VERSION_CODES.M) {
@ -158,7 +148,7 @@ class ReportMessageActivity : BaseActivity() {
super.finish() super.finish()
} }
@RequiresApi(api = Build.VERSION_CODES.M) @RequiresApi(api = VERSION_CODES.M)
fun setSystemBarTheme(isDark: Boolean) { fun setSystemBarTheme(isDark: Boolean) {
// Fetch the current flags. // Fetch the current flags.
val lFlags = window.decorView.systemUiVisibility val lFlags = window.decorView.systemUiVisibility