Skip to content

Commit

Permalink
Improve layout
Browse files Browse the repository at this point in the history
  • Loading branch information
woheller69 committed May 4, 2022
1 parent cc6b8c0 commit b07fd84
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 48 deletions.
7 changes: 3 additions & 4 deletions app/src/main/java/org/woheller69/audiometry/TestData.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ protected void onCreate(Bundle savedInstanceState) {
private void draw() {
String[] names = fileName.split("-");
String time = DateFormat.getTimeInstance(DateFormat.SHORT).format(Long.parseLong(names[1])) + ", " + DateFormat.getDateInstance(DateFormat.SHORT).format(Long.parseLong(names[1]));
String name = getString(R.string.test_at,time);

ImageButton share = (ImageButton) findViewById(R.id.share_button);
share.setOnClickListener(view -> {
Expand Down Expand Up @@ -134,7 +133,7 @@ private void draw() {
delete.setOnClickListener(view -> fileOperations.deleteTestData(fileName,context));

TextView title = (TextView) findViewById(R.id.test_title);
title.setText(name);
title.setText(time);

// Draw Graph
chart = (LineChart) findViewById(R.id.chart);
Expand All @@ -151,7 +150,7 @@ private void draw() {
Entry dataPoint = new Entry( scaleCbr(testFrequencies[i]),(float) (testResults[1][i]-calibrationArray[i]) );
dataLeft.add(dataPoint);
}
LineDataSet setLeft = new LineDataSet(dataLeft, "LEFT");
LineDataSet setLeft = new LineDataSet(dataLeft, getString(R.string.left));
setLeft.setCircleColor(getResources().getColor(R.color.green,getTheme()));
setLeft.setColor(getResources().getColor(R.color.green,getTheme()));
setLeft.setValueTextColor(Color.WHITE);
Expand All @@ -162,7 +161,7 @@ private void draw() {
Entry dataPoint = new Entry( scaleCbr(testFrequencies[i]), (float)(testResults[0][i]-calibrationArray[i]));
dataRight.add(dataPoint);
}
LineDataSet setRight = new LineDataSet(dataRight, "RIGHT");
LineDataSet setRight = new LineDataSet(dataRight, getString(R.string.right));
setRight.setCircleColor(getResources().getColor(R.color.primary_dark,getTheme()));
setRight.setColor(getResources().getColor(R.color.primary_dark,getTheme()));
setRight.setValueTextColor(Color.WHITE);
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/res/drawable/button_static_background.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/orange" />
<corners android:radius="5dp" />
<stroke
android:color="@color/black"
android:width="2dp"/>
</shape>
10 changes: 5 additions & 5 deletions app/src/main/res/layout/activity_performsingletest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,13 @@
<Button
android:id="@+id/freq_minus"
android:layout_width="60dp"
android:padding="10dp"
android:background="@drawable/button_background"
android:layout_height="wrap_content"
android:layout_below="@id/ear"
android:layout_alignParentStart="true"
android:background="@drawable/button_background"
android:padding="10dp"
android:text="-"
android:textSize="40sp"
android:textColor="@color/white"
android:layout_alignParentStart="true"
android:textStyle="bold"/>
android:textSize="40sp"
android:textStyle="bold" />
</RelativeLayout>
80 changes: 41 additions & 39 deletions app/src/main/res/layout/activity_test_data.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,48 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/test_title"
android:textColor="@color/orange"
android:textSize="30sp"
android:textStyle="bold"

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
android:orientation="horizontal">
<ImageButton
android:id="@+id/prev"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:padding="10dp"
android:background="@drawable/button_background"
android:layout_alignParentStart="true"
android:src="@drawable/ic_skip_previous_black_24dp"
android:textColor="@color/black"
android:textStyle="bold"/>

<TextView
android:id="@+id/test_title"
android:textColor="@color/orange"
android:textSize="20sp"
android:textStyle="bold"
android:gravity="center"
android:padding="10dp"
android:textAlignment="gravity"
android:text="Test"
android:layout_toEndOf="@id/prev"
android:layout_toStartOf="@id/next"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />

<ImageButton
android:id="@+id/next"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:padding="10dp"
android:background="@drawable/button_background"
android:layout_alignParentEnd="true"
android:src="@drawable/ic_skip_next_black_24dp"
android:textColor="@color/black"
android:textStyle="bold"/>
</RelativeLayout>

<com.github.mikephil.charting.charts.LineChart
android:id="@+id/chart"
Expand Down Expand Up @@ -74,38 +108,6 @@
android:paddingBottom="10sp"
android:id="@+id/delete_button"/>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:orientation="horizontal">
<ImageButton
android:id="@+id/prev"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:paddingRight="20sp"
android:paddingLeft="20sp"
android:paddingTop="10sp"
android:paddingBottom="10sp"
android:background="@drawable/button_background"
android:layout_alignParentStart="true"
android:src="@drawable/ic_skip_previous_black_24dp"
android:textColor="@color/black"
android:textStyle="bold"/>
<ImageButton
android:id="@+id/next"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:paddingRight="20sp"
android:paddingLeft="20sp"
android:paddingTop="10sp"
android:paddingBottom="10sp"
android:background="@drawable/button_background"
android:layout_alignParentEnd="true"
android:src="@drawable/ic_skip_next_black_24dp"
android:textColor="@color/black"
android:textStyle="bold"/>
</RelativeLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
2 changes: 2 additions & 0 deletions app/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,6 @@
<string name="debug">Debug</string>
<string name="delete">Löschen</string>
<string name="test_at">Test um %s</string>
<string name="left">LINKS</string>
<string name="right">RECHTS</string>
</resources>
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,6 @@
<string name="debug">Debug</string>
<string name="delete">Delete</string>
<string name="test_at">Test at %s</string>
<string name="left">LEFT</string>
<string name="right">RIGHT</string>
</resources>

0 comments on commit b07fd84

Please sign in to comment.