2
0

Reset Android counter on long-touch.

This commit is contained in:
Maarten Billemont 2018-06-19 01:54:20 -04:00
parent 3853b6f180
commit 683c0165e6

View File

@ -130,7 +130,7 @@ public class EmergencyActivity extends Activity {
siteNameField.addTextChangedListener( new ValueChangedListener() { siteNameField.addTextChangedListener( new ValueChangedListener() {
@Override @Override
void update() { void update() {
siteCounterButton.setText( MessageFormat.format( "{0}", 1 ) ); siteCounterButton.setText( MessageFormat.format( "{0}", UnsignedInteger.ONE ) );
updateSitePassword(); updateSitePassword();
} }
} ); } );
@ -155,6 +155,17 @@ public class EmergencyActivity extends Activity {
updateSitePassword(); updateSitePassword();
} }
} ); } );
siteCounterButton.setOnLongClickListener( new View.OnLongClickListener() {
@Override
public boolean onLongClick(final View v) {
if (UnsignedInteger.valueOf( siteCounterButton.getText().toString() ).equals( UnsignedInteger.ONE ))
return false;
siteCounterButton.setText( MessageFormat.format( "{0}", UnsignedInteger.ONE ) );
updateSitePassword();
return true;
}
} );
siteVersionButton.setOnClickListener( new View.OnClickListener() { siteVersionButton.setOnClickListener( new View.OnClickListener() {
@Override @Override
public void onClick(final View v) { public void onClick(final View v) {
@ -229,7 +240,7 @@ public class EmergencyActivity extends Activity {
MPAlgorithm.Version defaultVersion = preferences.getDefaultVersion(); MPAlgorithm.Version defaultVersion = preferences.getDefaultVersion();
siteVersionButton.setTag( defaultVersion ); siteVersionButton.setTag( defaultVersion );
siteVersionButton.setText( defaultVersion.name() ); siteVersionButton.setText( defaultVersion.name() );
siteCounterButton.setText( MessageFormat.format( "{0}", 1 ) ); siteCounterButton.setText( MessageFormat.format( "{0}", UnsignedInteger.ONE ) );
if (TextUtils.isEmpty( fullNameField.getText() )) if (TextUtils.isEmpty( fullNameField.getText() ))
fullNameField.requestFocus(); fullNameField.requestFocus();