mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-02-18 13:00:18 +03:00
Fix UI issue on BugReportActivity (send button not visible)
This commit is contained in:
parent
51879845f2
commit
53bdd58c1b
7 changed files with 62 additions and 132 deletions
|
@ -332,7 +332,7 @@ abstract class VectorBaseActivity : BaseMvRxActivity() {
|
||||||
open fun getMenuRes() = -1
|
open fun getMenuRes() = -1
|
||||||
|
|
||||||
@AttrRes
|
@AttrRes
|
||||||
open fun getMenuTint() = R.attr.vctr_icon_tint_on_dark_action_bar_color
|
open fun getMenuTint() = R.attr.vctr_icon_tint_on_light_action_bar_color
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a object containing other themes for this activity
|
* Return a object containing other themes for this activity
|
||||||
|
|
|
@ -19,10 +19,8 @@ package im.vector.riotredesign.features.rageshake
|
||||||
import android.text.TextUtils
|
import android.text.TextUtils
|
||||||
import android.view.Menu
|
import android.view.Menu
|
||||||
import android.view.MenuItem
|
import android.view.MenuItem
|
||||||
import android.view.View
|
import android.widget.Toast
|
||||||
import android.widget.*
|
|
||||||
import androidx.core.view.isVisible
|
import androidx.core.view.isVisible
|
||||||
import butterknife.BindView
|
|
||||||
import butterknife.OnCheckedChanged
|
import butterknife.OnCheckedChanged
|
||||||
import butterknife.OnTextChanged
|
import butterknife.OnTextChanged
|
||||||
import im.vector.riotredesign.R
|
import im.vector.riotredesign.R
|
||||||
|
@ -35,48 +33,17 @@ import timber.log.Timber
|
||||||
*/
|
*/
|
||||||
class BugReportActivity : VectorBaseActivity() {
|
class BugReportActivity : VectorBaseActivity() {
|
||||||
|
|
||||||
/* ==========================================================================================
|
|
||||||
* UI
|
|
||||||
* ========================================================================================== */
|
|
||||||
|
|
||||||
@BindView(R.id.bug_report_edit_text)
|
|
||||||
lateinit var mBugReportText: EditText
|
|
||||||
|
|
||||||
@BindView(R.id.bug_report_button_include_logs)
|
|
||||||
lateinit var mIncludeLogsButton: CheckBox
|
|
||||||
|
|
||||||
@BindView(R.id.bug_report_button_include_crash_logs)
|
|
||||||
lateinit var mIncludeCrashLogsButton: CheckBox
|
|
||||||
|
|
||||||
@BindView(R.id.bug_report_button_include_screenshot)
|
|
||||||
lateinit var mIncludeScreenShotButton: CheckBox
|
|
||||||
|
|
||||||
@BindView(R.id.bug_report_screenshot_preview)
|
|
||||||
lateinit var mScreenShotPreview: ImageView
|
|
||||||
|
|
||||||
@BindView(R.id.bug_report_progress_view)
|
|
||||||
lateinit var mProgressBar: ProgressBar
|
|
||||||
|
|
||||||
@BindView(R.id.bug_report_progress_text_view)
|
|
||||||
lateinit var mProgressTextView: TextView
|
|
||||||
|
|
||||||
@BindView(R.id.bug_report_scrollview)
|
|
||||||
lateinit var mScrollView: View
|
|
||||||
|
|
||||||
@BindView(R.id.bug_report_mask_view)
|
|
||||||
lateinit var mMaskView: View
|
|
||||||
|
|
||||||
override fun getLayoutRes() = R.layout.activity_bug_report
|
override fun getLayoutRes() = R.layout.activity_bug_report
|
||||||
|
|
||||||
override fun initUiAndData() {
|
override fun initUiAndData() {
|
||||||
configureToolbar(bugReportToolbar)
|
configureToolbar(bugReportToolbar)
|
||||||
|
|
||||||
if (BugReporter.screenshot != null) {
|
if (BugReporter.screenshot != null) {
|
||||||
mScreenShotPreview.setImageBitmap(BugReporter.screenshot)
|
bug_report_screenshot_preview.setImageBitmap(BugReporter.screenshot)
|
||||||
} else {
|
} else {
|
||||||
mScreenShotPreview.isVisible = false
|
bug_report_screenshot_preview.isVisible = false
|
||||||
mIncludeScreenShotButton.isChecked = false
|
bug_report_button_include_screenshot.isChecked = false
|
||||||
mIncludeScreenShotButton.isEnabled = false
|
bug_report_button_include_screenshot.isEnabled = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,8 +51,8 @@ class BugReportActivity : VectorBaseActivity() {
|
||||||
|
|
||||||
override fun onPrepareOptionsMenu(menu: Menu): Boolean {
|
override fun onPrepareOptionsMenu(menu: Menu): Boolean {
|
||||||
menu.findItem(R.id.ic_action_send_bug_report)?.let {
|
menu.findItem(R.id.ic_action_send_bug_report)?.let {
|
||||||
val isValid = mBugReportText.text.toString().trim().length > 10
|
val isValid = bug_report_edit_text.text.toString().trim().length > 10
|
||||||
&& !mMaskView.isVisible
|
&& !bug_report_mask_view.isVisible
|
||||||
|
|
||||||
it.isEnabled = isValid
|
it.isEnabled = isValid
|
||||||
it.icon.alpha = if (isValid) 255 else 100
|
it.icon.alpha = if (isValid) 255 else 100
|
||||||
|
@ -109,22 +76,22 @@ class BugReportActivity : VectorBaseActivity() {
|
||||||
* Send the bug report
|
* Send the bug report
|
||||||
*/
|
*/
|
||||||
private fun sendBugReport() {
|
private fun sendBugReport() {
|
||||||
mScrollView.alpha = 0.3f
|
bug_report_scrollview.alpha = 0.3f
|
||||||
mMaskView.isVisible = true
|
bug_report_mask_view.isVisible = true
|
||||||
|
|
||||||
invalidateOptionsMenu()
|
invalidateOptionsMenu()
|
||||||
|
|
||||||
mProgressTextView.isVisible = true
|
bug_report_progress_text_view.isVisible = true
|
||||||
mProgressTextView.text = getString(R.string.send_bug_report_progress, 0.toString() + "")
|
bug_report_progress_text_view.text = getString(R.string.send_bug_report_progress, "0")
|
||||||
|
|
||||||
mProgressBar.isVisible = true
|
bug_report_progress_view.isVisible = true
|
||||||
mProgressBar.progress = 0
|
bug_report_progress_view.progress = 0
|
||||||
|
|
||||||
BugReporter.sendBugReport(this,
|
BugReporter.sendBugReport(this,
|
||||||
mIncludeLogsButton.isChecked,
|
bug_report_button_include_logs.isChecked,
|
||||||
mIncludeCrashLogsButton.isChecked,
|
bug_report_button_include_crash_logs.isChecked,
|
||||||
mIncludeScreenShotButton.isChecked,
|
bug_report_button_include_screenshot.isChecked,
|
||||||
mBugReportText.text.toString(),
|
bug_report_edit_text.text.toString(),
|
||||||
object : BugReporter.IMXBugReportListener {
|
object : BugReporter.IMXBugReportListener {
|
||||||
override fun onUploadFailed(reason: String?) {
|
override fun onUploadFailed(reason: String?) {
|
||||||
try {
|
try {
|
||||||
|
@ -136,10 +103,10 @@ class BugReportActivity : VectorBaseActivity() {
|
||||||
Timber.e(e, "## onUploadFailed() : failed to display the toast " + e.message)
|
Timber.e(e, "## onUploadFailed() : failed to display the toast " + e.message)
|
||||||
}
|
}
|
||||||
|
|
||||||
mMaskView.isVisible = false
|
bug_report_mask_view.isVisible = false
|
||||||
mProgressBar.isVisible = false
|
bug_report_progress_view.isVisible = false
|
||||||
mProgressTextView.isVisible = false
|
bug_report_progress_text_view.isVisible = false
|
||||||
mScrollView.alpha = 1.0f
|
bug_report_scrollview.alpha = 1.0f
|
||||||
|
|
||||||
invalidateOptionsMenu()
|
invalidateOptionsMenu()
|
||||||
}
|
}
|
||||||
|
@ -149,17 +116,10 @@ class BugReportActivity : VectorBaseActivity() {
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onProgress(progress: Int) {
|
override fun onProgress(progress: Int) {
|
||||||
var progress = progress
|
val myProgress = progress.coerceIn(0, 100)
|
||||||
if (progress > 100) {
|
|
||||||
Timber.e("## onProgress() : progress > 100")
|
|
||||||
progress = 100
|
|
||||||
} else if (progress < 0) {
|
|
||||||
Timber.e("## onProgress() : progress < 0")
|
|
||||||
progress = 0
|
|
||||||
}
|
|
||||||
|
|
||||||
mProgressBar.progress = progress
|
bug_report_progress_view.progress = myProgress
|
||||||
mProgressTextView.text = getString(R.string.send_bug_report_progress, progress.toString() + "")
|
bug_report_progress_text_view.text = getString(R.string.send_bug_report_progress, "$myProgress")
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onUploadSucceed() {
|
override fun onUploadSucceed() {
|
||||||
|
@ -174,7 +134,6 @@ class BugReportActivity : VectorBaseActivity() {
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
Timber.e(e, "## onUploadSucceed() : failed to dismiss the dialog " + e.message)
|
Timber.e(e, "## onUploadSucceed() : failed to dismiss the dialog " + e.message)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -190,7 +149,7 @@ class BugReportActivity : VectorBaseActivity() {
|
||||||
|
|
||||||
@OnCheckedChanged(R.id.bug_report_button_include_screenshot)
|
@OnCheckedChanged(R.id.bug_report_button_include_screenshot)
|
||||||
internal fun onSendScreenshotChanged() {
|
internal fun onSendScreenshotChanged() {
|
||||||
mScreenShotPreview.isVisible = mIncludeScreenShotButton.isChecked && BugReporter.screenshot != null
|
bug_report_screenshot_preview.isVisible = bug_report_button_include_screenshot.isChecked && BugReporter.screenshot != null
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onBackPressed() {
|
override fun onBackPressed() {
|
||||||
|
@ -199,12 +158,4 @@ class BugReportActivity : VectorBaseActivity() {
|
||||||
|
|
||||||
super.onBackPressed()
|
super.onBackPressed()
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ==========================================================================================
|
|
||||||
* Companion
|
|
||||||
* ========================================================================================== */
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
private val LOG_TAG = BugReportActivity::class.java.simpleName
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
|
|
||||||
<androidx.appcompat.widget.Toolbar
|
<androidx.appcompat.widget.Toolbar
|
||||||
android:id="@+id/bugReportToolbar"
|
android:id="@+id/bugReportToolbar"
|
||||||
|
style="@style/VectorToolbarStyle"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:elevation="4dp" />
|
android:elevation="4dp" />
|
||||||
|
@ -28,6 +29,7 @@
|
||||||
android:layout_marginEnd="10dp"
|
android:layout_marginEnd="10dp"
|
||||||
android:layout_marginRight="10dp"
|
android:layout_marginRight="10dp"
|
||||||
android:text="@string/send_bug_report_progress"
|
android:text="@string/send_bug_report_progress"
|
||||||
|
android:textColor="?riotx_text_primary"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
tools:visibility="visible" />
|
tools:visibility="visible" />
|
||||||
|
|
||||||
|
@ -65,7 +67,8 @@
|
||||||
android:layout_marginLeft="10dp"
|
android:layout_marginLeft="10dp"
|
||||||
android:layout_marginEnd="10dp"
|
android:layout_marginEnd="10dp"
|
||||||
android:layout_marginRight="10dp"
|
android:layout_marginRight="10dp"
|
||||||
android:text="@string/send_bug_report_description" />
|
android:text="@string/send_bug_report_description"
|
||||||
|
android:textColor="?riotx_text_primary" />
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputLayout
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
style="@style/VectorTextInputLayout"
|
style="@style/VectorTextInputLayout"
|
||||||
|
@ -96,6 +99,7 @@
|
||||||
android:layout_marginEnd="10dp"
|
android:layout_marginEnd="10dp"
|
||||||
android:layout_marginRight="10dp"
|
android:layout_marginRight="10dp"
|
||||||
android:text="@string/send_bug_report_description_in_english"
|
android:text="@string/send_bug_report_description_in_english"
|
||||||
|
android:textColor="?riotx_text_secondary"
|
||||||
android:textSize="12sp" />
|
android:textSize="12sp" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
@ -106,67 +110,41 @@
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="10dp"
|
||||||
android:layout_marginEnd="10dp"
|
android:layout_marginEnd="10dp"
|
||||||
android:layout_marginRight="10dp"
|
android:layout_marginRight="10dp"
|
||||||
android:text="@string/send_bug_report_logs_description" />
|
android:text="@string/send_bug_report_logs_description"
|
||||||
|
android:textColor="?riotx_text_primary" />
|
||||||
|
|
||||||
<LinearLayout
|
<com.google.android.material.switchmaterial.SwitchMaterial
|
||||||
|
android:id="@+id/bug_report_button_include_logs"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal">
|
android:layout_marginStart="10dp"
|
||||||
|
android:layout_marginLeft="10dp"
|
||||||
|
android:layout_marginEnd="10dp"
|
||||||
|
android:layout_marginRight="10dp"
|
||||||
|
android:checked="true"
|
||||||
|
android:text="@string/send_bug_report_include_logs" />
|
||||||
|
|
||||||
<CheckBox
|
<com.google.android.material.switchmaterial.SwitchMaterial
|
||||||
android:id="@+id/bug_report_button_include_logs"
|
android:id="@+id/bug_report_button_include_crash_logs"
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:checked="true" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center_vertical"
|
|
||||||
android:layout_marginStart="10dp"
|
|
||||||
android:layout_marginLeft="10dp"
|
|
||||||
android:text="@string/send_bug_report_include_logs" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal">
|
android:layout_marginStart="10dp"
|
||||||
|
android:layout_marginLeft="10dp"
|
||||||
|
android:layout_marginEnd="10dp"
|
||||||
|
android:layout_marginRight="10dp"
|
||||||
|
android:checked="true"
|
||||||
|
android:text="@string/send_bug_report_include_crash_logs" />
|
||||||
|
|
||||||
<CheckBox
|
<com.google.android.material.switchmaterial.SwitchMaterial
|
||||||
android:id="@+id/bug_report_button_include_crash_logs"
|
android:id="@+id/bug_report_button_include_screenshot"
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:checked="true" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center_vertical"
|
|
||||||
android:layout_marginStart="10dp"
|
|
||||||
android:layout_marginLeft="10dp"
|
|
||||||
android:text="@string/send_bug_report_include_crash_logs" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal">
|
android:layout_marginStart="10dp"
|
||||||
|
android:layout_marginLeft="10dp"
|
||||||
<CheckBox
|
android:layout_marginEnd="10dp"
|
||||||
android:id="@+id/bug_report_button_include_screenshot"
|
android:layout_marginRight="10dp"
|
||||||
android:layout_width="wrap_content"
|
android:checked="true"
|
||||||
android:layout_height="wrap_content"
|
android:text="@string/send_bug_report_include_screenshot" />
|
||||||
android:checked="true" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center_vertical"
|
|
||||||
android:layout_marginStart="10dp"
|
|
||||||
android:layout_marginLeft="10dp"
|
|
||||||
android:text="@string/send_bug_report_include_screenshot" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/bug_report_screenshot_preview"
|
android:id="@+id/bug_report_screenshot_preview"
|
||||||
|
@ -189,5 +167,6 @@
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="@android:color/transparent"
|
android:background="@android:color/transparent"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
|
android:focusable="true"
|
||||||
android:visibility="gone" />
|
android:visibility="gone" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
|
@ -2,7 +2,7 @@
|
||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
tools:context="org.matrix.vector.activity.RoomActivity">
|
tools:context=".features.rageshake.BugReportActivity">
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/ic_action_send_bug_report"
|
android:id="@+id/ic_action_send_bug_report"
|
||||||
|
|
|
@ -135,7 +135,7 @@
|
||||||
|
|
||||||
<!-- icon colors -->
|
<!-- icon colors -->
|
||||||
<item name="vctr_settings_icon_tint_color">@android:color/white</item>
|
<item name="vctr_settings_icon_tint_color">@android:color/white</item>
|
||||||
<item name="vctr_icon_tint_on_light_action_bar_color">@android:color/white</item>
|
<item name="vctr_icon_tint_on_light_action_bar_color">@color/riotx_accent</item>
|
||||||
<item name="vctr_icon_tint_on_dark_action_bar_color">@android:color/white</item>
|
<item name="vctr_icon_tint_on_dark_action_bar_color">@android:color/white</item>
|
||||||
|
|
||||||
<!-- theses colours are requested a background cannot be set by an ?att on android < 5 -->
|
<!-- theses colours are requested a background cannot be set by an ?att on android < 5 -->
|
||||||
|
|
|
@ -136,7 +136,7 @@
|
||||||
|
|
||||||
<!-- icon colors -->
|
<!-- icon colors -->
|
||||||
<item name="vctr_settings_icon_tint_color">@android:color/black</item>
|
<item name="vctr_settings_icon_tint_color">@android:color/black</item>
|
||||||
<item name="vctr_icon_tint_on_light_action_bar_color">@android:color/white</item>
|
<item name="vctr_icon_tint_on_light_action_bar_color">@color/riotx_accent</item>
|
||||||
<item name="vctr_icon_tint_on_dark_action_bar_color">@android:color/white</item>
|
<item name="vctr_icon_tint_on_dark_action_bar_color">@android:color/white</item>
|
||||||
|
|
||||||
<!-- theses colours are requested a background cannot be set by an ?att on android < 5 -->
|
<!-- theses colours are requested a background cannot be set by an ?att on android < 5 -->
|
||||||
|
|
|
@ -94,7 +94,7 @@
|
||||||
|
|
||||||
<!-- icon colors -->
|
<!-- icon colors -->
|
||||||
<item name="vctr_settings_icon_tint_color">@color/accent_color_status</item>
|
<item name="vctr_settings_icon_tint_color">@color/accent_color_status</item>
|
||||||
<item name="vctr_icon_tint_on_light_action_bar_color">@android:color/white</item>
|
<item name="vctr_icon_tint_on_light_action_bar_color">@color/riotx_accent</item>
|
||||||
<item name="vctr_icon_tint_on_dark_action_bar_color">@android:color/white</item>
|
<item name="vctr_icon_tint_on_dark_action_bar_color">@android:color/white</item>
|
||||||
|
|
||||||
<!-- theses colours are requested a background cannot be set by an ?att on android < 5 -->
|
<!-- theses colours are requested a background cannot be set by an ?att on android < 5 -->
|
||||||
|
|
Loading…
Add table
Reference in a new issue