forked from GitHub-Mirror/riotX-android
WIP
This commit is contained in:
@ -17,6 +17,7 @@
|
||||
package im.vector.riotx.features.home
|
||||
|
||||
import android.app.ProgressDialog
|
||||
import android.app.TimePickerDialog
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
@ -24,6 +25,7 @@ import android.view.MenuItem
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.appcompat.widget.Toolbar
|
||||
import androidx.core.view.GravityCompat
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.drawerlayout.widget.DrawerLayout
|
||||
import androidx.fragment.app.FragmentManager
|
||||
import androidx.lifecycle.Observer
|
||||
@ -45,6 +47,8 @@ import im.vector.riotx.features.rageshake.VectorUncaughtExceptionHandler
|
||||
import im.vector.riotx.features.workers.signout.SignOutViewModel
|
||||
import im.vector.riotx.push.fcm.FcmHelper
|
||||
import kotlinx.android.synthetic.main.activity_home.*
|
||||
import kotlinx.android.synthetic.main.merge_overlay_waiting_view.*
|
||||
import timber.log.Timber
|
||||
import javax.inject.Inject
|
||||
|
||||
|
||||
@ -114,6 +118,25 @@ class HomeActivity : VectorBaseActivity(), ToolbarConfigurable {
|
||||
notificationDrawerManager.clearAllEvents()
|
||||
intent.removeExtra(EXTRA_CLEAR_EXISTING_NOTIFICATION)
|
||||
}
|
||||
|
||||
activeSessionHolder.getSafeActiveSession()?.getLiveStatus()?.observe(this, Observer {
|
||||
Timber.e("${it?.statusText?.let { getString(it) }} ${it?.percentProgress}")
|
||||
if (it == null) {
|
||||
waiting_view.isVisible = false
|
||||
} else {
|
||||
waiting_view_status_horizontal_progress.apply {
|
||||
isIndeterminate = false
|
||||
max = 100
|
||||
progress = it.percentProgress
|
||||
isVisible = true
|
||||
}
|
||||
waiting_view_status_text.apply {
|
||||
text = it.statusText?.let { res -> getString(res) }
|
||||
isVisible = true
|
||||
}
|
||||
waiting_view.isVisible = true
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
override fun onNewIntent(intent: Intent?) {
|
||||
|
@ -30,7 +30,7 @@ import kotlinx.android.synthetic.main.activity_bug_report.*
|
||||
import timber.log.Timber
|
||||
|
||||
/**
|
||||
* Form to send a bug report
|
||||
* Form to send a bug reportSubtask
|
||||
*/
|
||||
class BugReportActivity : VectorBaseActivity() {
|
||||
|
||||
@ -56,7 +56,7 @@ class BugReportActivity : VectorBaseActivity() {
|
||||
|
||||
forSuggestion = intent.getBooleanExtra("FOR_SUGGESTION", false)
|
||||
|
||||
// Default screen is for bug report, so modify it for suggestion
|
||||
// Default screen is for bug reportSubtask, so modify it for suggestion
|
||||
if (forSuggestion) {
|
||||
supportActionBar?.setTitle(R.string.send_suggestion)
|
||||
|
||||
@ -101,7 +101,7 @@ class BugReportActivity : VectorBaseActivity() {
|
||||
|
||||
|
||||
/**
|
||||
* Send the bug report
|
||||
* Send the bug reportSubtask
|
||||
*/
|
||||
private fun sendBugReport() {
|
||||
bug_report_scrollview.alpha = 0.3f
|
||||
|
@ -68,11 +68,11 @@ class BugReporter @Inject constructor(private val activeSessionHolder: ActiveSes
|
||||
// the http client
|
||||
private val mOkHttpClient = OkHttpClient()
|
||||
|
||||
// the pending bug report call
|
||||
// the pending bug reportSubtask call
|
||||
private var mBugReportCall: Call? = null
|
||||
|
||||
|
||||
// boolean to cancel the bug report
|
||||
// boolean to cancel the bug reportSubtask
|
||||
private val mIsCancelled = false
|
||||
|
||||
/**
|
||||
@ -96,16 +96,16 @@ class BugReporter @Inject constructor(private val activeSessionHolder: ActiveSes
|
||||
private val LOGCAT_CMD_DEBUG = arrayOf("logcat", "-d", "-v", "threadtime", "*:*")
|
||||
|
||||
/**
|
||||
* Bug report upload listener
|
||||
* Bug reportSubtask upload listener
|
||||
*/
|
||||
interface IMXBugReportListener {
|
||||
/**
|
||||
* The bug report has been cancelled
|
||||
* The bug reportSubtask has been cancelled
|
||||
*/
|
||||
fun onUploadCancelled()
|
||||
|
||||
/**
|
||||
* The bug report upload failed.
|
||||
* The bug reportSubtask upload failed.
|
||||
*
|
||||
* @param reason the failure reason
|
||||
*/
|
||||
@ -119,13 +119,13 @@ class BugReporter @Inject constructor(private val activeSessionHolder: ActiveSes
|
||||
fun onProgress(progress: Int)
|
||||
|
||||
/**
|
||||
* The bug report upload succeeded.
|
||||
* The bug reportSubtask upload succeeded.
|
||||
*/
|
||||
fun onUploadSucceed()
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a bug report.
|
||||
* Send a bug reportSubtask.
|
||||
*
|
||||
* @param context the application context
|
||||
* @param forSuggestion true to send a suggestion
|
||||
@ -407,7 +407,7 @@ class BugReporter @Inject constructor(private val activeSessionHolder: ActiveSes
|
||||
override fun onPostExecute(reason: String?) {
|
||||
mBugReportCall = null
|
||||
|
||||
// delete when the bug report has been successfully sent
|
||||
// delete when the bug reportSubtask has been successfully sent
|
||||
for (file in mBugReportFiles) {
|
||||
file.delete()
|
||||
}
|
||||
@ -431,7 +431,7 @@ class BugReporter @Inject constructor(private val activeSessionHolder: ActiveSes
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a bug report either with email or with Vector.
|
||||
* Send a bug reportSubtask either with email or with Vector.
|
||||
*/
|
||||
fun openBugReportScreen(activity: Activity, forSuggestion: Boolean = false) {
|
||||
screenshot = takeScreenshot(activity)
|
||||
@ -442,7 +442,7 @@ class BugReporter @Inject constructor(private val activeSessionHolder: ActiveSes
|
||||
}
|
||||
|
||||
//==============================================================================================================
|
||||
// crash report management
|
||||
// crash reportSubtask management
|
||||
//==============================================================================================================
|
||||
|
||||
/**
|
||||
@ -472,7 +472,7 @@ class BugReporter @Inject constructor(private val activeSessionHolder: ActiveSes
|
||||
}
|
||||
|
||||
/**
|
||||
* Save the crash report
|
||||
* Save the crash reportSubtask
|
||||
*
|
||||
* @param context the context
|
||||
* @param crashDescription teh crash description
|
||||
|
@ -22,66 +22,6 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/toolbar" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/waiting_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?vctr_waiting_background_color"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/waiting_view_content"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/layout_horizontal_margin"
|
||||
android:background="?attr/colorBackgroundFloating"
|
||||
android:orientation="vertical"
|
||||
android:padding="@dimen/layout_horizontal_margin"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintWidth_percent="@dimen/dialog_width_ratio">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/waiting_view_status_circular_progress"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="6dp"
|
||||
android:layout_marginRight="6dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/waiting_view_status_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:textColor="?riotx_text_secondary"
|
||||
android:visibility="gone"
|
||||
tools:text="Waiting status..."
|
||||
tools:visibility="visible" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/waiting_view_status_horizontal_progress"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="20dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:visibility="gone"
|
||||
tools:max="100"
|
||||
tools:progress="30"
|
||||
tools:visibility="visible" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
<include layout="@layout/merge_overlay_waiting_view"/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
@ -15,6 +15,8 @@
|
||||
android:id="@+id/homeDetailFragmentContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<include layout="@layout/merge_overlay_waiting_view" />
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
|
||||
|
||||
@ -24,4 +26,5 @@
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="start" />
|
||||
|
||||
|
||||
</androidx.drawerlayout.widget.DrawerLayout>
|
71
vector/src/main/res/layout/merge_overlay_waiting_view.xml
Normal file
71
vector/src/main/res/layout/merge_overlay_waiting_view.xml
Normal file
@ -0,0 +1,71 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
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">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/waiting_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?vctr_waiting_background_color"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/waiting_view_content"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/layout_horizontal_margin"
|
||||
android:background="?attr/colorBackgroundFloating"
|
||||
android:orientation="vertical"
|
||||
android:padding="@dimen/layout_horizontal_margin"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintWidth_percent="@dimen/dialog_width_ratio">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/waiting_view_status_circular_progress"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="6dp"
|
||||
android:layout_marginRight="6dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/waiting_view_status_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:textColor="?riotx_text_secondary"
|
||||
android:visibility="gone"
|
||||
tools:text="Waiting status..."
|
||||
tools:visibility="visible" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/waiting_view_status_horizontal_progress"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="20dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:visibility="gone"
|
||||
tools:max="100"
|
||||
tools:progress="30"
|
||||
tools:visibility="visible" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</merge>
|
Reference in New Issue
Block a user