Added Accept Alarm button to main screen as it is hard to find in the menu.

This commit is contained in:
Graham Jones
2015-11-11 20:58:39 +00:00
parent 3b240e3a54
commit 9619375b49
2 changed files with 21 additions and 1 deletions

View File

@@ -57,6 +57,7 @@ import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.WindowManager;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Button;
@@ -130,6 +131,19 @@ public class MainActivity extends Activity
Log.v(TAG,"menubar fiddle exception: "+e.toString());
}
// Force the screen to stay on when the app is running
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
// Deal with the 'AcceptAlarm Button'
Button button = (Button) findViewById(R.id.acceptAlarmButton);
button.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Log.v(TAG, "acceptAlarmButton.onClick()");
if (mBound) {
mSdServer.acceptAlarm();
}
}
});
// start timer to refresh user interface every second.
Timer uiTimer = new Timer();

View File

@@ -94,6 +94,12 @@
android:text="battTv"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Accept Alarm"
android:id="@+id/acceptAlarmButton" />
<com.github.mikephil.charting.charts.LineChart
android:id="@+id/chart1"
android:layout_width="match_parent"