Browse Source

Changed menu order, better history

Martin Herbers 6 years ago
parent
commit
88022f04fe
41 changed files with 793 additions and 317 deletions
  1. 7 6
      app/src/main/AndroidManifest.xml
  2. 235 0
      app/src/main/java/de/tu_darmstadt/informatik/tk/olir/HistoryActivity.java
  3. 45 11
      app/src/main/java/de/tu_darmstadt/informatik/tk/olir/ObjectsActivity.java
  4. 2 2
      app/src/main/java/de/tu_darmstadt/informatik/tk/olir/ReadingActivity.java
  5. 2 3
      app/src/main/java/de/tu_darmstadt/informatik/tk/olir/ResultActivity.java
  6. 40 0
      app/src/main/java/de/tu_darmstadt/informatik/tk/olir/SettingsActivity.java
  7. BIN
      app/src/main/offline_launch_icons-web.png
  8. BIN
      app/src/main/res/drawable-hdpi/ic_menu_white_24dp.png
  9. BIN
      app/src/main/res/drawable-hdpi/ic_menu_white_48dp.png
  10. BIN
      app/src/main/res/drawable-mdpi/ic_menu_white_24dp.png
  11. BIN
      app/src/main/res/drawable-mdpi/ic_menu_white_48dp.png
  12. BIN
      app/src/main/res/drawable-xhdpi/ic_menu_white_24dp.png
  13. BIN
      app/src/main/res/drawable-xhdpi/ic_menu_white_48dp.png
  14. BIN
      app/src/main/res/drawable-xxhdpi/ic_menu_white_24dp.png
  15. BIN
      app/src/main/res/drawable-xxhdpi/ic_menu_white_48dp.png
  16. BIN
      app/src/main/res/drawable-xxxhdpi/ic_menu_white_24dp.png
  17. BIN
      app/src/main/res/drawable-xxxhdpi/ic_menu_white_48dp.png
  18. 32 0
      app/src/main/res/layout/activity_history.xml
  19. 312 294
      app/src/main/res/layout/activity_objects.xml
  20. 91 0
      app/src/main/res/layout/activity_settings.xml
  21. 12 0
      app/src/main/res/menu/drawer.xml
  22. 5 0
      app/src/main/res/mipmap-anydpi-v26/offline_launch_icons.xml
  23. 5 0
      app/src/main/res/mipmap-anydpi-v26/offline_launch_icons_round.xml
  24. BIN
      app/src/main/res/mipmap-hdpi/offline_icon.png
  25. BIN
      app/src/main/res/mipmap-hdpi/offline_launch_icons.png
  26. BIN
      app/src/main/res/mipmap-hdpi/offline_launch_icons_round.png
  27. BIN
      app/src/main/res/mipmap-mdpi/offline_icon.png
  28. BIN
      app/src/main/res/mipmap-mdpi/offline_launch_icons.png
  29. BIN
      app/src/main/res/mipmap-mdpi/offline_launch_icons_round.png
  30. BIN
      app/src/main/res/mipmap-xhdpi/offline_icon.png
  31. BIN
      app/src/main/res/mipmap-xhdpi/offline_launch_icons.png
  32. BIN
      app/src/main/res/mipmap-xhdpi/offline_launch_icons_round.png
  33. BIN
      app/src/main/res/mipmap-xxhdpi/offline_icon.png
  34. BIN
      app/src/main/res/mipmap-xxhdpi/offline_launch_icons.png
  35. BIN
      app/src/main/res/mipmap-xxhdpi/offline_launch_icons_round.png
  36. BIN
      app/src/main/res/mipmap-xxxhdpi/offline_icon.png
  37. BIN
      app/src/main/res/mipmap-xxxhdpi/offline_launch_icons.png
  38. BIN
      app/src/main/res/mipmap-xxxhdpi/offline_launch_icons_round.png
  39. BIN
      app/src/main/res/mipmap-xxxhdpi/ofline_icon.png
  40. 4 0
      app/src/main/res/values/ic_launcher_background.xml
  41. 1 1
      build.gradle

+ 7 - 6
app/src/main/AndroidManifest.xml

@@ -7,12 +7,15 @@
 
     <application
         android:allowBackup="true"
-        android:icon="@drawable/vorschl1"
+        android:icon="@mipmap/offline_launch_icons"
         android:label="@string/app_name"
         android:supportsRtl="true"
         android:theme="@style/Theme.AppCompat.Light.DarkActionBar">
         <activity
-            android:name=".MainActivity"
+            android:name=".HistoryActivity"
+            android:label="OLIR"></activity>
+        <activity
+            android:name=".ObjectsActivity"
             android:label="OLIR">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
@@ -20,11 +23,9 @@
                 <category android:name="android.intent.category.LAUNCHER" />
             </intent-filter>
         </activity>
-        <activity
-            android:name=".ObjectsActivity"
-            android:label="@string/title_activity_objects" />
         <activity android:name=".ReadingActivity" />
-        <activity android:name=".ResultActivity"></activity>
+        <activity android:name=".ResultActivity" />
+        <activity android:name=".SettingsActivity"></activity>
     </application>
 
 </manifest>

+ 235 - 0
app/src/main/java/de/tu_darmstadt/informatik/tk/olir/HistoryActivity.java

@@ -0,0 +1,235 @@
+package de.tu_darmstadt.informatik.tk.olir;
+
+import android.content.ContextWrapper;
+import android.content.Intent;
+import android.graphics.Color;
+import android.graphics.drawable.Drawable;
+import android.support.v7.app.AppCompatActivity;
+import android.os.Bundle;
+import android.view.Gravity;
+import android.view.KeyEvent;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
+import android.view.View;
+import android.widget.LinearLayout;
+import android.widget.TableLayout;
+import android.widget.TableRow;
+import android.widget.TextView;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+
+
+public class HistoryActivity extends AppCompatActivity {
+
+    private ArrayList<String> lines;
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.activity_history);
+
+        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
+        getSupportActionBar().setTitle("Previous Sensors");
+
+        parseHistory();
+    }
+
+    @Override
+    public boolean onCreateOptionsMenu(Menu menu) {
+        MenuInflater inflater = getMenuInflater();
+        inflater.inflate(R.menu.menu, menu);
+        return true;
+    }
+
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+
+        if (item.getItemId() == R.id.clear_history) {
+            try {
+                OutputStreamWriter writer = new OutputStreamWriter(openFileOutput("history.txt", MODE_PRIVATE));
+                String content = "";
+                writer.write(content);
+                writer.flush();
+                writer.close();
+            } catch (FileNotFoundException e) {
+                e.printStackTrace();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+            TableLayout table = findViewById(R.id.tableLayout);
+            table.removeAllViews();
+        }
+        else if (item.getItemId() == android.R.id.home) {
+            Intent intent = new Intent(this, ObjectsActivity.class);
+            startActivity(intent);
+            return true;
+        }
+
+        return true;
+    }
+
+    private void parseHistory() {
+        lines = new ArrayList<>();
+        ContextWrapper cw = new ContextWrapper(this);
+        File file = new File(cw.getFilesDir(), "history.txt");
+
+        TableLayout table = findViewById(R.id.tableLayout);
+
+        try {
+            if (file.exists()) {
+                FileInputStream is = new FileInputStream(file);
+
+                BufferedReader reader = new BufferedReader(new InputStreamReader(is));
+                String line = reader.readLine();
+                while (line != null) {
+                    lines.add(line);
+
+                    line = reader.readLine();
+                }
+            }
+        } catch (FileNotFoundException e) {
+            e.printStackTrace();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        for (int i = lines.size()-1; i >= 0; i--) {
+            String line = lines.get(i);
+
+            String time = line.substring(0, line.indexOf("|"));
+            line = line.substring(line.indexOf("|") + 1);
+            String name = line.substring(0, line.indexOf("|"));
+            String result = line.substring(line.indexOf("|") + 1);
+
+            TableRow row = new TableRow(this);
+            row.setPadding(20,30,20,30);
+            row.setTag(i);
+            row.setOnClickListener(new View.OnClickListener() {
+                @Override
+                public void onClick(View v) {
+                    openHistoryEntry(v);
+                }
+            });
+            TextView textView = new TextView(this);
+            textView.setText(name);
+            textView.setTextSize(20);
+
+            Drawable drawable;
+
+            if (name.toLowerCase().contains("weight")) {
+                drawable = getResources().getDrawable(R.mipmap.weight);
+            } else if (name.toLowerCase().contains("temperature")) {
+                drawable = getResources().getDrawable(R.mipmap.temperature);
+            } else if (name.toLowerCase().contains("acceleration")) {
+                drawable = getResources().getDrawable(R.mipmap.acceleration);
+            } else if (name.toLowerCase().contains("tilt")) {
+                drawable = getResources().getDrawable(R.mipmap.rotation);
+            } else if (name.toLowerCase().contains("squeeze")) {
+                drawable = getResources().getDrawable(R.mipmap.pressure);
+            } else {
+                drawable = getResources().getDrawable(R.mipmap.cog);
+            }
+
+
+            float factor = getResources().getDisplayMetrics().density;
+            drawable.setBounds(0, 0, (int) (20 * factor), (int) (20 * factor));
+            textView.setCompoundDrawables(drawable, null, null, null);
+            textView.setCompoundDrawablePadding(10);
+            textView.setPadding(10, 10, 10, 10);
+            row.addView(textView);
+
+
+        /*    TextView result = new TextView(this);
+            result.setText("Result: Test");
+            result.setTextSize(16);
+            result.setGravity(Gravity.RIGHT);
+            TableRow.LayoutParams params2 = new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.WRAP_CONTENT);
+            params2.weight = 1;
+            params2.gravity = Gravity.TOP;
+            result.setLayoutParams(params2);
+            row.addView(result);*/
+
+
+            try {
+                SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddhhmmss");
+                Date date = sdf.parse(time);
+                sdf.applyPattern("yyyy/MM/dd hh:mm:ss");
+                time = sdf.format(date);
+            } catch (ParseException e) {
+                e.printStackTrace();
+            }
+
+            if (Boolean.parseBoolean(result))
+                result = "state changed";
+            else
+                result = "state unchanged";
+
+            TextView dateTV = new TextView(this);
+            dateTV.setText("Result: " + result + "\n" + time);
+            dateTV.setTextSize(16);
+            dateTV.setMaxLines(2);
+            dateTV.setGravity(Gravity.RIGHT);
+            TableRow.LayoutParams params = new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.WRAP_CONTENT);
+            params.weight = 1;
+            params.gravity = Gravity.BOTTOM;
+            dateTV.setLayoutParams(params);
+            row.addView(dateTV);
+
+
+            table.addView(row);
+
+
+            View v = new View(this);
+            v.setLayoutParams(new LinearLayout.LayoutParams(
+                    LinearLayout.LayoutParams.MATCH_PARENT,
+                    2
+            ));
+            v.setBackgroundColor(Color.parseColor("#000000"));
+            table.addView(v);
+        }
+    }
+
+
+    public void addObject(View view) {
+        Intent intent = new Intent(this, ObjectsActivity.class);
+        startActivity(intent);
+    }
+
+    @Override
+    public boolean onKeyDown(int keyCode, KeyEvent event)  {
+        if (keyCode == KeyEvent.KEYCODE_BACK
+                && event.getRepeatCount() == 0) {
+            Intent intent = new Intent(this, ObjectsActivity.class);
+            startActivity(intent);
+            return true;
+        }
+        return super.onKeyDown(keyCode, event);
+    }
+
+
+    public void openHistoryEntry(View view) {
+        TableRow row = (TableRow) view;
+        int index = Integer.valueOf((Integer) row.getTag());
+        String line = lines.get(index);
+        String date = line.substring(0, line.indexOf("|"));
+        line = line.substring(line.indexOf("|") + 1);
+        String name = line.substring(0, line.indexOf("|"));
+        String result = line.substring(line.indexOf("|") + 1);
+
+        Intent intent = new Intent(this, ResultActivity.class);
+        intent.putExtra("time", date);
+        intent.putExtra("name", name);
+        intent.putExtra("result", Boolean.parseBoolean(result));
+        startActivity(intent);
+    }
+}

+ 45 - 11
app/src/main/java/de/tu_darmstadt/informatik/tk/olir/ObjectsActivity.java

@@ -3,7 +3,13 @@ package de.tu_darmstadt.informatik.tk.olir;
 import android.content.Intent;
 import android.net.Uri;
 import android.os.Bundle;
+import android.support.design.widget.NavigationView;
+import android.support.v4.view.GravityCompat;
+import android.support.v4.widget.DrawerLayout;
 import android.support.v7.app.AppCompatActivity;
+import android.view.KeyEvent;
+import android.view.Menu;
+import android.view.MenuInflater;
 import android.view.MenuItem;
 import android.view.View;
 
@@ -26,22 +32,30 @@ public class ObjectsActivity extends AppCompatActivity {
         super.onCreate(savedInstanceState);
         setContentView(R.layout.activity_objects);
 
-        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
         getSupportActionBar().setTitle("1. Choose a Sensor");
-    }
+        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
+        getSupportActionBar().setHomeAsUpIndicator(R.drawable.ic_menu_white_24dp);
+
+        NavigationView navigationView = findViewById(R.id.nav_view);
+        navigationView.setNavigationItemSelectedListener(
+                new NavigationView.OnNavigationItemSelectedListener() {
+                    @Override
+                    public boolean onNavigationItemSelected(MenuItem menuItem) {
+
+                        if (menuItem.getItemId() == R.id.show_history) {
+                            Intent intent = new Intent(ObjectsActivity.this, HistoryActivity.class);
+                            startActivity(intent);
+                        } else if (menuItem.getItemId() == R.id.settings) {
+                            Intent intent = new Intent(ObjectsActivity.this, SettingsActivity.class);
+                            startActivity(intent);
+                        }
 
-    @Override
-    public boolean onOptionsItemSelected(MenuItem item) {
-        if (item.getItemId() == android.R.id.home) {
-            Intent intent = new Intent(this, MainActivity.class);
-            startActivity(intent);
-            return true;
-        }
-        return false;
+                        return true;
+                    }
+                });
     }
 
     public void openFile(View view) {
-
         Intent chooseFile = new Intent(Intent.ACTION_GET_CONTENT);
         chooseFile.setType("*/*");
         chooseFile = Intent.createChooser(chooseFile, "Choose a file");
@@ -123,4 +137,24 @@ public class ObjectsActivity extends AppCompatActivity {
         intent.putExtra("file", content);
         startActivity(intent);
     }
+
+    @Override
+    public boolean onKeyDown(int keyCode, KeyEvent event)  {
+        if (keyCode == KeyEvent.KEYCODE_BACK
+                && event.getRepeatCount() == 0) {
+            finishAffinity();
+            return true;
+        }
+        return super.onKeyDown(keyCode, event);
+    }
+
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+        if (item.getItemId() == android.R.id.home) {
+            DrawerLayout drawer = findViewById(R.id.drawer_layout);
+            drawer.openDrawer(GravityCompat.START);
+            return true;
+        }
+        return false;
+    }
 }

+ 2 - 2
app/src/main/java/de/tu_darmstadt/informatik/tk/olir/ReadingActivity.java

@@ -39,7 +39,7 @@ public class ReadingActivity extends AppCompatActivity {
     public boolean onKeyDown(int keyCode, KeyEvent event)  {
         if (keyCode == KeyEvent.KEYCODE_BACK
                 && event.getRepeatCount() == 0) {
-            Intent intent = new Intent(this, MainActivity.class);
+            Intent intent = new Intent(this, ObjectsActivity.class);
             startActivity(intent);
             return true;
         }
@@ -49,7 +49,7 @@ public class ReadingActivity extends AppCompatActivity {
     @Override
     public boolean onOptionsItemSelected(MenuItem item) {
         if (item.getItemId() == android.R.id.home) {
-            Intent intent = new Intent(this, MainActivity.class);
+            Intent intent = new Intent(this, ObjectsActivity.class);
             startActivity(intent);
             return true;
         }

+ 2 - 3
app/src/main/java/de/tu_darmstadt/informatik/tk/olir/ResultActivity.java

@@ -78,7 +78,6 @@ public class ResultActivity extends AppCompatActivity {
 
     private void saveToHistory(boolean result) {
 
-        ContextWrapper cw = new ContextWrapper(this);
         Date date = new Date();
         String dateFormat = new SimpleDateFormat("yyyyMMddhhmmss").format(date);
         try {
@@ -96,7 +95,7 @@ public class ResultActivity extends AppCompatActivity {
     public boolean onKeyDown(int keyCode, KeyEvent event)  {
         if (keyCode == KeyEvent.KEYCODE_BACK
                 && event.getRepeatCount() == 0) {
-            Intent intent = new Intent(this, MainActivity.class);
+            Intent intent = new Intent(this, ObjectsActivity.class);
             startActivity(intent);
             return true;
         }
@@ -106,7 +105,7 @@ public class ResultActivity extends AppCompatActivity {
     @Override
     public boolean onOptionsItemSelected(MenuItem item) {
         if (item.getItemId() == android.R.id.home) {
-            Intent intent = new Intent(this, MainActivity.class);
+            Intent intent = new Intent(this, ObjectsActivity.class);
             startActivity(intent);
             return true;
         }

+ 40 - 0
app/src/main/java/de/tu_darmstadt/informatik/tk/olir/SettingsActivity.java

@@ -0,0 +1,40 @@
+package de.tu_darmstadt.informatik.tk.olir;
+
+import android.content.Intent;
+import android.support.v7.app.AppCompatActivity;
+import android.os.Bundle;
+import android.view.KeyEvent;
+import android.view.MenuItem;
+
+public class SettingsActivity extends AppCompatActivity {
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.activity_settings);
+
+        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
+        getSupportActionBar().setTitle("Settings");
+    }
+
+    @Override
+    public boolean onKeyDown(int keyCode, KeyEvent event)  {
+        if (keyCode == KeyEvent.KEYCODE_BACK
+                && event.getRepeatCount() == 0) {
+            Intent intent = new Intent(this, ObjectsActivity.class);
+            startActivity(intent);
+            return true;
+        }
+        return super.onKeyDown(keyCode, event);
+    }
+
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+        if (item.getItemId() == android.R.id.home) {
+            Intent intent = new Intent(this, ObjectsActivity.class);
+            startActivity(intent);
+            return true;
+        }
+        return false;
+    }
+}

BIN
app/src/main/offline_launch_icons-web.png


BIN
app/src/main/res/drawable-hdpi/ic_menu_white_24dp.png


BIN
app/src/main/res/drawable-hdpi/ic_menu_white_48dp.png


BIN
app/src/main/res/drawable-mdpi/ic_menu_white_24dp.png


BIN
app/src/main/res/drawable-mdpi/ic_menu_white_48dp.png


BIN
app/src/main/res/drawable-xhdpi/ic_menu_white_24dp.png


BIN
app/src/main/res/drawable-xhdpi/ic_menu_white_48dp.png


BIN
app/src/main/res/drawable-xxhdpi/ic_menu_white_24dp.png


BIN
app/src/main/res/drawable-xxhdpi/ic_menu_white_48dp.png


BIN
app/src/main/res/drawable-xxxhdpi/ic_menu_white_24dp.png


BIN
app/src/main/res/drawable-xxxhdpi/ic_menu_white_48dp.png


+ 32 - 0
app/src/main/res/layout/activity_history.xml

@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:id="@+id/constraintLayout"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    tools:context="de.tu_darmstadt.informatik.tk.olir.HistoryActivity"
+    tools:layout_editor_absoluteX="0dp"
+    tools:layout_editor_absoluteY="81dp">
+
+    <ScrollView
+        android:layout_width="fill_parent"
+        android:layout_height="fill_parent"
+        android:scrollbars="none"
+        android:layout_weight="1">
+
+        <TableLayout
+            android:id="@+id/tableLayout"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            app:layout_constraintBottom_toBottomOf="parent"
+            app:layout_constraintEnd_toEndOf="parent"
+            app:layout_constraintHorizontal_bias="1.0"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintTop_toTopOf="parent"
+            app:layout_constraintVertical_bias="0.0">
+
+        </TableLayout>
+
+    </ScrollView>
+</android.support.constraint.ConstraintLayout>

+ 312 - 294
app/src/main/res/layout/activity_objects.xml

@@ -1,306 +1,324 @@
 <?xml version="1.0" encoding="utf-8"?>
-<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+
+<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:app="http://schemas.android.com/apk/res-auto"
-    xmlns:tools="http://schemas.android.com/tools"
+    android:id="@+id/drawer_layout"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
-    tools:context="de.tu_darmstadt.informatik.tk.olir.ObjectsActivity">
-
-    <TableLayout
-        android:layout_width="0dp"
-        android:layout_height="0dp"
-        app:layout_constraintBottom_toBottomOf="parent"
-        app:layout_constraintEnd_toEndOf="parent"
-        app:layout_constraintHorizontal_bias="0.0"
-        app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintTop_toTopOf="parent"
-        app:layout_constraintVertical_bias="0.0">
-
-        <TableRow
-            android:layout_width="match_parent"
-            android:layout_height="match_parent"
-            android:gravity="left|center_vertical"
-            android:minHeight="50dp"
-            android:onClick="openAcceleration"
-            android:padding="10dp">
-
-            <ImageView
-                android:id="@+id/imageView3"
-                android:layout_width="40dp"
-                android:layout_height="40dp"
-                android:src="@mipmap/acceleration" />
-
-            <TextView
-                android:id="@+id/textView3"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:paddingLeft="5dp"
-                android:text="Acceleration"
-                android:textSize="20sp" />
-        </TableRow>
-
-        <TableRow
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content" >
-
-            <View
-                android:id="@+id/line1"
+    android:fitsSystemWindows="true">
+
+    <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+        xmlns:app="http://schemas.android.com/apk/res-auto"
+        xmlns:tools="http://schemas.android.com/tools"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        tools:context="de.tu_darmstadt.informatik.tk.olir.ObjectsActivity">
+
+        <TableLayout
+            android:layout_width="0dp"
+            android:layout_height="0dp"
+            app:layout_constraintBottom_toBottomOf="parent"
+            app:layout_constraintEnd_toEndOf="parent"
+            app:layout_constraintHorizontal_bias="0.0"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintTop_toTopOf="parent"
+            app:layout_constraintVertical_bias="0.0">
+
+            <TableRow
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:gravity="left|center_vertical"
+                android:minHeight="50dp"
+                android:onClick="openAcceleration"
+                android:padding="10dp">
+
+                <ImageView
+                    android:id="@+id/imageView3"
+                    android:layout_width="40dp"
+                    android:layout_height="40dp"
+                    android:src="@mipmap/acceleration" />
+
+                <TextView
+                    android:id="@+id/textView3"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:paddingLeft="5dp"
+                    android:text="Acceleration"
+                    android:textSize="20sp" />
+            </TableRow>
+
+            <TableRow
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content" >
+
+                <View
+                    android:id="@+id/line0"
+                    android:layout_width="match_parent"
+                    android:layout_height="1dip"
+                    android:layout_weight="1"
+                    android:background="#FF909090"
+                    android:padding="2dip" />
+            </TableRow>
+
+            <TableRow
+                android:layout_width="match_parent"
+                android:layout_height="50dp"
+                android:gravity="left|center_vertical"
+                android:minHeight="50dp"
+                android:onClick="openLoad"
+                android:padding="10dp">
+
+                <ImageView
+                    android:id="@+id/imageView"
+                    android:layout_width="40dp"
+                    android:layout_height="40dp"
+                    android:src="@mipmap/weight" />
+
+                <TextView
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:paddingLeft="5dp"
+                    android:text="Load"
+                    android:textSize="20sp" />
+            </TableRow>
+
+            <TableRow
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content" >
+
+                <View
+                    android:id="@+id/line1"
+                    android:layout_width="match_parent"
+                    android:layout_height="1dip"
+                    android:layout_weight="1"
+                    android:background="#FF909090"
+                    android:padding="2dip" />
+            </TableRow>
+
+            <TableRow
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:gravity="left|center_vertical"
+                android:minHeight="50dp"
+                android:onClick="openTempRising"
+                android:padding="10dp">
+
+                <ImageView
+                    android:id="@+id/imageView6"
+                    android:layout_width="40dp"
+                    android:layout_height="40dp"
+                    android:src="@mipmap/temperature" />
+
+                <TextView
+                    android:id="@+id/textView6"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:paddingLeft="5dp"
+                    android:text="Rising Temperature"
+                    android:textSize="20sp" />
+            </TableRow>
+
+            <TableRow
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content" >
+
+                <View
+                    android:id="@+id/line2"
+                    android:layout_width="match_parent"
+                    android:layout_height="1dip"
+                    android:layout_weight="1"
+                    android:background="#FF909090"
+                    android:padding="2dip" />
+            </TableRow>
+
+            <TableRow
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:gravity="left|center_vertical"
+                android:minHeight="50dp"
+                android:onClick="openTempFalling"
+                android:padding="10dp">
+
+                <ImageView
+                    android:id="@+id/imageView7"
+                    android:layout_width="40dp"
+                    android:layout_height="40dp"
+                    android:src="@mipmap/temperature" />
+
+                <TextView
+                    android:id="@+id/textView7"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:paddingLeft="5dp"
+                    android:text="Falling Temperature"
+                    android:textSize="20sp" />
+            </TableRow>
+
+            <TableRow
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content" >
+
+                <View
+                    android:id="@+id/line3"
+                    android:layout_width="match_parent"
+                    android:layout_height="1dip"
+                    android:layout_weight="1"
+                    android:background="#FF909090"
+                    android:padding="2dip" />
+            </TableRow>
+
+            <TableRow
                 android:layout_width="match_parent"
-                android:layout_height="1dip"
-                android:layout_weight="1"
-                android:background="#FF909090"
-                android:padding="2dip" />
-        </TableRow>
-
-        <TableRow
-            android:layout_width="match_parent"
-            android:layout_height="50dp"
-            android:gravity="left|center_vertical"
-            android:minHeight="50dp"
-            android:onClick="openLoad"
-            android:padding="10dp">
-
-            <ImageView
-                android:id="@+id/imageView"
-                android:layout_width="40dp"
-                android:layout_height="40dp"
-                android:src="@mipmap/weight" />
-
-            <TextView
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:paddingLeft="5dp"
-                android:text="Load"
-                android:textSize="20sp" />
-        </TableRow>
-
-        <TableRow
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content" >
-
-            <View
-                android:id="@+id/line1"
+                android:layout_height="match_parent"
+                android:gravity="left|center_vertical"
+                android:minHeight="50dp"
+                android:onClick="openTilt90"
+                android:padding="10dp">
+
+                <ImageView
+                    android:id="@+id/imageView4"
+                    android:layout_width="40dp"
+                    android:layout_height="40dp"
+                    android:src="@mipmap/rotation" />
+
+                <TextView
+                    android:id="@+id/textView4"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:paddingLeft="5dp"
+                    android:text="Tilting (90°)"
+                    android:textSize="20sp" />
+            </TableRow>
+
+            <TableRow
                 android:layout_width="match_parent"
-                android:layout_height="1dip"
-                android:layout_weight="1"
-                android:background="#FF909090"
-                android:padding="2dip" />
-        </TableRow>
-
-        <TableRow
-            android:layout_width="match_parent"
-            android:layout_height="match_parent"
-            android:gravity="left|center_vertical"
-            android:minHeight="50dp"
-            android:onClick="openTempRising"
-            android:padding="10dp">
-
-            <ImageView
-                android:id="@+id/imageView6"
-                android:layout_width="40dp"
-                android:layout_height="40dp"
-                android:src="@mipmap/temperature" />
-
-            <TextView
-                android:id="@+id/textView6"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:paddingLeft="5dp"
-                android:text="Rising Temperature"
-                android:textSize="20sp" />
-        </TableRow>
-
-        <TableRow
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content" >
-
-            <View
-                android:id="@+id/line2"
+                android:layout_height="wrap_content" >
+
+                <View
+                    android:id="@+id/line4"
+                    android:layout_width="match_parent"
+                    android:layout_height="1dip"
+                    android:layout_weight="1"
+                    android:background="#FF909090"
+                    android:padding="2dip" />
+            </TableRow>
+
+            <TableRow
                 android:layout_width="match_parent"
-                android:layout_height="1dip"
-                android:layout_weight="1"
-                android:background="#FF909090"
-                android:padding="2dip" />
-        </TableRow>
-
-        <TableRow
-            android:layout_width="match_parent"
-            android:layout_height="match_parent"
-            android:gravity="left|center_vertical"
-            android:minHeight="50dp"
-            android:onClick="openTempFalling"
-            android:padding="10dp">
-
-            <ImageView
-                android:id="@+id/imageView7"
-                android:layout_width="40dp"
-                android:layout_height="40dp"
-                android:src="@mipmap/temperature" />
-
-            <TextView
-                android:id="@+id/textView7"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:paddingLeft="5dp"
-                android:text="Falling Temperature"
-                android:textSize="20sp" />
-        </TableRow>
-
-        <TableRow
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content" >
-
-            <View
-                android:id="@+id/line3"
+                android:layout_height="match_parent"
+                android:gravity="left|center_vertical"
+                android:minHeight="50dp"
+                android:onClick="openTilt180"
+                android:padding="10dp">
+
+                <ImageView
+                    android:id="@+id/imageView5"
+                    android:layout_width="40dp"
+                    android:layout_height="40dp"
+                    android:src="@mipmap/rotation" />
+
+                <TextView
+                    android:id="@+id/textView5"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:paddingLeft="5dp"
+                    android:text="Tilting (180°)"
+                    android:textSize="20sp" />
+            </TableRow>
+
+            <TableRow
                 android:layout_width="match_parent"
-                android:layout_height="1dip"
-                android:layout_weight="1"
-                android:background="#FF909090"
-                android:padding="2dip" />
-        </TableRow>
-
-        <TableRow
-            android:layout_width="match_parent"
-            android:layout_height="match_parent"
-            android:gravity="left|center_vertical"
-            android:minHeight="50dp"
-            android:onClick="openTilt90"
-            android:padding="10dp">
-
-            <ImageView
-                android:id="@+id/imageView4"
-                android:layout_width="40dp"
-                android:layout_height="40dp"
-                android:src="@mipmap/rotation" />
-
-            <TextView
-                android:id="@+id/textView4"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:paddingLeft="5dp"
-                android:text="Tilting (90°)"
-                android:textSize="20sp" />
-        </TableRow>
-
-        <TableRow
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content" >
-
-            <View
-                android:id="@+id/line4"
+                android:layout_height="wrap_content" >
+
+                <View
+                    android:id="@+id/line5"
+                    android:layout_width="match_parent"
+                    android:layout_height="1dip"
+                    android:layout_weight="1"
+                    android:background="#FF909090"
+                    android:padding="2dip" />
+            </TableRow>
+
+            <TableRow
                 android:layout_width="match_parent"
-                android:layout_height="1dip"
-                android:layout_weight="1"
-                android:background="#FF909090"
-                android:padding="2dip" />
-        </TableRow>
-
-        <TableRow
-            android:layout_width="match_parent"
-            android:layout_height="match_parent"
-            android:gravity="left|center_vertical"
-            android:minHeight="50dp"
-            android:onClick="openTilt180"
-            android:padding="10dp">
-
-            <ImageView
-                android:id="@+id/imageView5"
-                android:layout_width="40dp"
-                android:layout_height="40dp"
-                android:src="@mipmap/rotation" />
-
-            <TextView
-                android:id="@+id/textView5"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:paddingLeft="5dp"
-                android:text="Tilting (180°)"
-                android:textSize="20sp" />
-        </TableRow>
-
-        <TableRow
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content" >
-
-            <View
-                android:id="@+id/line5"
+                android:layout_height="match_parent"
+                android:gravity="left|center_vertical"
+                android:minHeight="50dp"
+                android:onClick="openPressure"
+                android:padding="10dp">
+
+                <ImageView
+                    android:id="@+id/imageView2"
+                    android:layout_width="40dp"
+                    android:layout_height="40dp"
+                    android:src="@mipmap/pressure" />
+
+                <TextView
+                    android:id="@+id/textView2"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:paddingLeft="5dp"
+                    android:text="Pressure"
+                    android:textSize="20sp" />
+            </TableRow>
+
+            <TableRow
                 android:layout_width="match_parent"
-                android:layout_height="1dip"
-                android:layout_weight="1"
-                android:background="#FF909090"
-                android:padding="2dip" />
-        </TableRow>
-
-        <TableRow
-            android:layout_width="match_parent"
-            android:layout_height="match_parent"
-            android:gravity="left|center_vertical"
-            android:minHeight="50dp"
-            android:onClick="openPressure"
-            android:padding="10dp">
-
-            <ImageView
-                android:id="@+id/imageView2"
-                android:layout_width="40dp"
-                android:layout_height="40dp"
-                android:src="@mipmap/pressure" />
-
-            <TextView
-                android:id="@+id/textView2"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:paddingLeft="5dp"
-                android:text="Pressure"
-                android:textSize="20sp" />
-        </TableRow>
-
-        <TableRow
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content" >
-
-            <View
-                android:id="@+id/line6"
+                android:layout_height="wrap_content" >
+
+                <View
+                    android:id="@+id/line6"
+                    android:layout_width="match_parent"
+                    android:layout_height="1dip"
+                    android:layout_weight="1"
+                    android:background="#FF909090"
+                    android:padding="2dip" />
+            </TableRow>
+
+            <TableRow
                 android:layout_width="match_parent"
-                android:layout_height="1dip"
-                android:layout_weight="1"
-                android:background="#FF909090"
-                android:padding="2dip" />
-        </TableRow>
-
-        <TableRow
-            android:layout_width="match_parent"
-            android:layout_height="match_parent"
-            android:gravity="left|center_vertical"
-            android:minHeight="50dp"
-            android:onClick="openFile"
-            android:padding="10dp">
-
-            <ImageView
-                android:id="@+id/imageView8"
-                android:layout_width="40dp"
-                android:layout_height="40dp"
-                android:src="@mipmap/cog" />
-
-            <TextView
-                android:id="@+id/textView8"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:paddingLeft="5dp"
-                android:text="Choose Custom Object"
-                android:textSize="20sp" />
-        </TableRow>
-
-        <TableRow
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content" >
-
-            <View
-                android:id="@+id/line7"
+                android:layout_height="match_parent"
+                android:gravity="left|center_vertical"
+                android:minHeight="50dp"
+                android:onClick="openFile"
+                android:padding="10dp">
+
+                <ImageView
+                    android:id="@+id/imageView8"
+                    android:layout_width="40dp"
+                    android:layout_height="40dp"
+                    android:src="@mipmap/cog" />
+
+                <TextView
+                    android:id="@+id/textView8"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:paddingLeft="5dp"
+                    android:text="Choose Custom Object"
+                    android:textSize="20sp" />
+            </TableRow>
+
+            <TableRow
                 android:layout_width="match_parent"
-                android:layout_height="1dip"
-                android:layout_weight="1"
-                android:background="#FF909090"
-                android:padding="2dip" />
-        </TableRow>
-    </TableLayout>
-</android.support.constraint.ConstraintLayout>
+                android:layout_height="wrap_content" >
+
+                <View
+                    android:id="@+id/line7"
+                    android:layout_width="match_parent"
+                    android:layout_height="1dip"
+                    android:layout_weight="1"
+                    android:background="#FF909090"
+                    android:padding="2dip" />
+            </TableRow>
+        </TableLayout>
+    </android.support.constraint.ConstraintLayout>
+
+    <android.support.design.widget.NavigationView
+        android:id="@+id/nav_view"
+        android:layout_width="wrap_content"
+        android:layout_height="match_parent"
+        android:layout_gravity="start"
+        android:fitsSystemWindows="true"
+        app:menu="@menu/drawer"/>
+
+</android.support.v4.widget.DrawerLayout>

+ 91 - 0
app/src/main/res/layout/activity_settings.xml

@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="utf-8"?>
+<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    tools:context=".SettingsActivity">
+
+    <TableLayout
+        android:layout_width="0dp"
+        android:layout_height="0dp"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toTopOf="parent">
+
+        <TableRow
+            android:layout_width="fill_parent"
+            android:layout_height="match_parent"
+            android:padding="10dp">
+
+            <TextView
+                android:id="@+id/textView9"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:text="Settings1" />
+
+            <Switch
+                android:id="@+id/switch1"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_gravity="right"
+                android:layout_weight="1" />
+        </TableRow>
+
+        <TableRow
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:padding="10dp">
+
+            <TextView
+                android:id="@+id/textView10"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:text="Settings2" />
+
+            <Switch
+                android:id="@+id/switch2"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_weight="1" />
+        </TableRow>
+
+        <TableRow
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:padding="10dp">
+
+            <TextView
+                android:id="@+id/textView11"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:text="Settings3" />
+
+            <Switch
+                android:id="@+id/switch3"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_weight="1" />
+        </TableRow>
+
+        <TableRow
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:padding="10dp">
+
+            <TextView
+                android:id="@+id/textView12"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:text="Settings4" />
+
+            <Switch
+                android:id="@+id/switch4"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_weight="1" />
+        </TableRow>
+
+    </TableLayout>
+</android.support.constraint.ConstraintLayout>

+ 12 - 0
app/src/main/res/menu/drawer.xml

@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<menu xmlns:app="http://schemas.android.com/apk/res-auto"
+    xmlns:android="http://schemas.android.com/apk/res/android">
+
+    <item android:id="@+id/show_history"
+        android:title="Readout History"
+        app:showAsAction="never"/>
+
+    <item android:id="@+id/settings"
+        android:title="Settings"
+        app:showAsAction="never"/>
+</menu>

+ 5 - 0
app/src/main/res/mipmap-anydpi-v26/offline_launch_icons.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
+    <background android:drawable="@color/ic_launcher_background"/>
+    <foreground android:drawable="@mipmap/offline_icon"/>
+</adaptive-icon>

+ 5 - 0
app/src/main/res/mipmap-anydpi-v26/offline_launch_icons_round.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
+    <background android:drawable="@color/ic_launcher_background"/>
+    <foreground android:drawable="@mipmap/offline_icon"/>
+</adaptive-icon>

BIN
app/src/main/res/mipmap-hdpi/offline_icon.png


BIN
app/src/main/res/mipmap-hdpi/offline_launch_icons.png


BIN
app/src/main/res/mipmap-hdpi/offline_launch_icons_round.png


BIN
app/src/main/res/mipmap-mdpi/offline_icon.png


BIN
app/src/main/res/mipmap-mdpi/offline_launch_icons.png


BIN
app/src/main/res/mipmap-mdpi/offline_launch_icons_round.png


BIN
app/src/main/res/mipmap-xhdpi/offline_icon.png


BIN
app/src/main/res/mipmap-xhdpi/offline_launch_icons.png


BIN
app/src/main/res/mipmap-xhdpi/offline_launch_icons_round.png


BIN
app/src/main/res/mipmap-xxhdpi/offline_icon.png


BIN
app/src/main/res/mipmap-xxhdpi/offline_launch_icons.png


BIN
app/src/main/res/mipmap-xxhdpi/offline_launch_icons_round.png


BIN
app/src/main/res/mipmap-xxxhdpi/offline_icon.png


BIN
app/src/main/res/mipmap-xxxhdpi/offline_launch_icons.png


BIN
app/src/main/res/mipmap-xxxhdpi/offline_launch_icons_round.png


BIN
app/src/main/res/mipmap-xxxhdpi/ofline_icon.png


+ 4 - 0
app/src/main/res/values/ic_launcher_background.xml

@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+    <color name="ic_launcher_background">#781421</color>
+</resources>

+ 1 - 1
build.gradle

@@ -6,7 +6,7 @@ buildscript {
         google()
     }
     dependencies {
-        classpath 'com.android.tools.build:gradle:3.1.0'
+        classpath 'com.android.tools.build:gradle:3.1.1'
 
         // NOTE: Do not place your application dependencies here; they belong
         // in the individual module build.gradle files