put back explanatory progress text

This commit is contained in:
Eric House 2019-01-12 09:04:40 -08:00
parent bfbf17252e
commit e378647e36
3 changed files with 18 additions and 15 deletions

View file

@ -30,6 +30,7 @@ import android.text.format.DateUtils;
import android.view.View; import android.view.View;
import android.widget.Button; import android.widget.Button;
import android.widget.ProgressBar; import android.widget.ProgressBar;
import android.widget.TextView;
import org.eehouse.android.xw4.DBUtils.SentInvitesInfo; import org.eehouse.android.xw4.DBUtils.SentInvitesInfo;
import org.eehouse.android.xw4.DlgDelegate.Action; import org.eehouse.android.xw4.DlgDelegate.Action;
@ -176,7 +177,7 @@ public class BTInviteDelegate extends InviteDelegate {
case SCAN_DONE: case SCAN_DONE:
post( new Runnable() { post( new Runnable() {
public void run() { public void run() {
killProgress(); hideProgress();
if ( mPersisted.empty() ) { if ( mPersisted.empty() ) {
makeNotAgainBuilder( R.string.not_again_emptybtscan, makeNotAgainBuilder( R.string.not_again_emptybtscan,
@ -235,8 +236,7 @@ public class BTInviteDelegate extends InviteDelegate {
int count = BTService.getPairedCount( m_activity ); int count = BTService.getPairedCount( m_activity );
if ( 0 < count ) { if ( 0 < count ) {
String msg = getQuantityString( R.plurals.bt_scan_progress_fmt, count, count ); showProgress( count, SCAN_SECONDS );
startProgress( SCAN_SECONDS );
BTService.scan( m_activity, 1000 * SCAN_SECONDS ); BTService.scan( m_activity, 1000 * SCAN_SECONDS );
} else { } else {
makeConfirmThenBuilder( R.string.bt_no_devs, makeConfirmThenBuilder( R.string.bt_no_devs,
@ -257,16 +257,21 @@ public class BTInviteDelegate extends InviteDelegate {
tryEnable(); tryEnable();
} }
private void startProgress( int nSeconds ) private void showProgress( int nDevs, int nSeconds )
{ {
mProgressBar = (ProgressBar)findViewById( R.id.progress ); mProgressBar = (ProgressBar)findViewById( R.id.progress );
mProgressBar.setProgress( 0 ); mProgressBar.setProgress( 0 );
mProgressBar.setMax( nSeconds ); mProgressBar.setMax( nSeconds );
String msg = getQuantityString( R.plurals.bt_scan_progress_fmt,
nDevs, nDevs );
((TextView)findViewById( R.id.progress_msg )).setText( msg );
findViewById( R.id.progress_line ).setVisibility( View.VISIBLE ); findViewById( R.id.progress_line ).setVisibility( View.VISIBLE );
incrementProgressIn( 1 ); incrementProgressIn( 1 );
} }
private void killProgress() private void hideProgress()
{ {
findViewById( R.id.progress_line ).setVisibility( View.GONE ); findViewById( R.id.progress_line ).setVisibility( View.GONE );
mProgressBar = null; mProgressBar = null;
@ -280,7 +285,7 @@ public class BTInviteDelegate extends InviteDelegate {
if ( null != mProgressBar ) { if ( null != mProgressBar ) {
int curProgress = mProgressBar.getProgress(); int curProgress = mProgressBar.getProgress();
if ( curProgress >= mProgressBar.getMax() ) { if ( curProgress >= mProgressBar.getMax() ) {
killProgress(); // create illusion it's done hideProgress(); // create illusion it's done
} else { } else {
mProgressBar.setProgress( curProgress + 1, true ); mProgressBar.setProgress( curProgress + 1, true );
incrementProgressIn( 1 ); incrementProgressIn( 1 );

View file

@ -28,17 +28,18 @@
/> />
<LinearLayout android:id="@+id/progress_line" <LinearLayout android:id="@+id/progress_line"
android:orientation="horizontal" android:orientation="vertical"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:visibility="gone" android:visibility="gone"
android:padding="5dp" android:padding="5dp"
> >
<TextView android:layout_width="wrap_content" <TextView android:id="@+id/progress_msg"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium" android:ellipsize="end"
android:text="@string/scan_progress_label" android:maxLines="1"
android:paddingRight="5dp" android:layout_gravity="center_horizontal"
/> />
<ProgressBar android:id="@+id/progress" <ProgressBar android:id="@+id/progress"
style="@android:style/Widget.ProgressBar.Horizontal" style="@android:style/Widget.ProgressBar.Horizontal"

View file

@ -1833,9 +1833,6 @@
<!-- In the Bluetooth invite device dialog, kick off a new scan of <!-- In the Bluetooth invite device dialog, kick off a new scan of
nearby devices --> nearby devices -->
<string name="button_scan">Rescan</string> <string name="button_scan">Rescan</string>
<!-- Text to the left of the bluetooth-scanning progress bar in BT
invitation dialog -->
<string name="scan_progress_label">Scanning:</string>
<!-- --> <!-- -->
<string name="invite_progress_title">Connecting…</string> <string name="invite_progress_title">Connecting…</string>
@ -1879,7 +1876,7 @@
<plurals name="bt_scan_progress_fmt"> <plurals name="bt_scan_progress_fmt">
<item quantity="one">Scanning for CrossWords</item> <item quantity="one">Scanning for CrossWords</item>
<item quantity="other">Scanning for CrossWords on %1$d paired devices.</item> <item quantity="other">Scanning for CrossWords on %1$d paired devices</item>
</plurals> </plurals>
<!-- --> <!-- -->
<string name="bt_resend_fmt">Bluetooth send to %1$s failed; retry <string name="bt_resend_fmt">Bluetooth send to %1$s failed; retry