Made progress bars wider so they are easier to see.

This commit is contained in:
Graham Jones
2015-12-09 21:47:02 +00:00
parent a5af07b4cf
commit 159430f745
6 changed files with 109 additions and 11 deletions

View File

@@ -38,6 +38,7 @@ import android.content.ServiceConnection;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.graphics.Color; import android.graphics.Color;
import android.graphics.PorterDuff; import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
@@ -390,21 +391,26 @@ public class MainActivity extends Activity {
" (threshold = " + mConnection.mSdServer.mSdData.alarmRatioThresh + ")"); " (threshold = " + mConnection.mSdServer.mSdData.alarmRatioThresh + ")");
ProgressBar pb; ProgressBar pb;
Drawable pbDrawable;
pb = ((ProgressBar) findViewById(R.id.powerProgressBar)); pb = ((ProgressBar) findViewById(R.id.powerProgressBar));
pb.setMax(100); pb.setMax(100);
pb.setProgress((int) powerPc); pb.setProgress((int) powerPc);
int colour = Color.BLUE; pbDrawable = getResources().getDrawable(R.drawable.progress_bar_blue);
if (powerPc > 75) colour = Color.YELLOW; if (powerPc > 75) pbDrawable = getResources().getDrawable(R.drawable.progress_bar_yellow);
if (powerPc > 100) colour = Color.RED; if (powerPc > 100) pbDrawable = getResources().getDrawable(R.drawable.progress_bar_red);
pb.getProgressDrawable().setColorFilter(colour, PorterDuff.Mode.SRC_IN);
//pb.getProgressDrawable().setColorFilter(colour, PorterDuff.Mode.SRC_IN);
pb.setProgressDrawable(pbDrawable);
pb = ((ProgressBar) findViewById(R.id.spectrumProgressBar)); pb = ((ProgressBar) findViewById(R.id.spectrumProgressBar));
pb.setMax(100); pb.setMax(100);
pb.setProgress((int) specPc); pb.setProgress((int) specPc);
colour = Color.BLUE; pbDrawable = getResources().getDrawable(R.drawable.progress_bar_blue);
if (specPc > 75) colour = Color.YELLOW; if (specPc > 75) pbDrawable = getResources().getDrawable(R.drawable.progress_bar_yellow);
if (specPc > 100) colour = Color.RED; if (specPc > 100) pbDrawable = getResources().getDrawable(R.drawable.progress_bar_red);
pb.getProgressDrawable().setColorFilter(colour, PorterDuff.Mode.SRC_IN); //pb.getProgressDrawable().setColorFilter(colour, PorterDuff.Mode.SRC_IN);
pb.setProgressDrawable(pbDrawable);
} else { } else {
tv = (TextView) findViewById(R.id.alarmTv); tv = (TextView) findViewById(R.id.alarmTv);
tv.setText("Not Connected to Server"); tv.setText("Not Connected to Server");

View File

@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Define the background properties like color etc -->
<item android:id="@android:id/background">
<shape>
<gradient
android:startColor="#000000"
android:centerColor="#000000"
android:centerY="1.0"
android:endColor="#000000"
android:angle="270"
/>
</shape>
</item>
<!-- Define the progress properties like start color, end color etc -->
<item android:id="@android:id/progress">
<clip>
<shape>
<gradient
android:startColor="#0000ff"
android:centerColor="#8080ff"
android:centerY="0.5"
android:endColor="#0000ff"
android:angle="270"
/>
</shape>
</clip>
</item>
</layer-list>

View File

@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Define the background properties like color etc -->
<item android:id="@android:id/background">
<shape>
<gradient
android:startColor="#000000"
android:centerColor="#000000"
android:centerY="1.0"
android:endColor="#000000"
android:angle="270"
/>
</shape>
</item>
<!-- Define the progress properties like start color, end color etc -->
<item android:id="@android:id/progress">
<clip>
<shape>
<gradient
android:startColor="#ff0000"
android:centerColor="#ffa0a0"
android:centerY="0.5"
android:endColor="#ff0000"
android:angle="270"
/>
</shape>
</clip>
</item>
</layer-list>

View File

@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Define the background properties like color etc -->
<item android:id="@android:id/background">
<shape>
<gradient
android:startColor="#000000"
android:centerColor="#000000"
android:centerY="1.0"
android:endColor="#000000"
android:angle="270"
/>
</shape>
</item>
<!-- Define the progress properties like start color, end color etc -->
<item android:id="@android:id/progress">
<clip>
<shape>
<gradient
android:startColor="#ffff00"
android:centerColor="#ffffa0"
android:centerY="0.5"
android:endColor="#ffff00"
android:angle="270"
/>
</shape>
</clip>
</item>
</layer-list>

View File

@@ -98,7 +98,8 @@
style="?android:attr/progressBarStyleHorizontal" style="?android:attr/progressBarStyleHorizontal"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@+id/powerProgressBar" /> android:id="@+id/powerProgressBar"
android:minHeight="20dp" />
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
@@ -111,7 +112,8 @@
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@+id/spectrumProgressBar" android:id="@+id/spectrumProgressBar"
android:indeterminate="false" /> android:indeterminate="false"
android:minHeight="20dp" />
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<string name="app_name">OpenSeizureDetector Server</string> <string name="app_name">OpenSeizureDetector</string>
</resources> </resources>