Started on new main activity that will be based on fragments so user can select what information to display rather than having everything on one complicated screen.

This commit is contained in:
Graham Jones
2023-08-31 15:23:29 +01:00
parent 328dfedcbe
commit baf679489a
9 changed files with 141 additions and 7 deletions

View File

@@ -3,7 +3,6 @@
xmlns:tools="http://schemas.android.com/tools"
android:versionCode="128"
android:versionName="4.2.1b">
<!-- android:allowBackup="false" -->
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
@@ -22,10 +21,13 @@
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<!-- AD_ID seems to be added automatically as part of google play services. We don't use ads,
so explicitly remove it to keep Google Play store happy. -->
<uses-permission android:name="com.google.android.gms.permission.AD_ID" tools:node="remove"/>
<!--
AD_ID seems to be added automatically as part of google play services. We don't use ads,
so explicitly remove it to keep Google Play store happy.
-->
<uses-permission
android:name="com.google.android.gms.permission.AD_ID"
tools:node="remove" />
<uses-feature
android:name="android.hardware.telephony"
@@ -39,6 +41,9 @@
android:label="@string/app_name"
android:networkSecurityConfig="@xml/network_security_config"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity2"
android:exported="false" />
<activity
android:name=".MlModelManager"
android:exported="false"
@@ -61,7 +66,7 @@
android:exported="true"
android:icon="@drawable/star_of_life_48x48"
android:label="@string/app_name" />
<activity
g <activity
android:name=".PrefActivity"
android:label="OpenSeizureDetector Preferences" />
<activity

View File

@@ -0,0 +1,25 @@
package uk.org.openseizuredetector;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
public class FragmentOsdAlg extends FragmentSdDataViewer {
public FragmentOsdAlg() {
// Required empty public constructor
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_osdalg, container, false);
}
}

View File

@@ -0,0 +1,35 @@
package uk.org.openseizuredetector;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
/**
* A simple {@link Fragment} subclass.
* Use the {@link FragmentSdDataViewer#newInstance} factory method to
* create an instance of this fragment.
*/
public class FragmentSdDataViewer extends Fragment {
public FragmentSdDataViewer() {
// Required empty public constructor
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_sd_data_viewer, container, false);
}
}

View File

@@ -0,0 +1,20 @@
package uk.org.openseizuredetector;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity2 extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main2);
if (savedInstanceState == null) {
getSupportFragmentManager().beginTransaction()
.setReorderingAllowed(true)
.add(R.id.fragment_container_view, FragmentOsdAlg.class, null)
.commit();
}
}
}

View File

@@ -430,7 +430,7 @@ public class StartupActivity extends AppCompatActivity {
try {
Intent intent = new Intent(
getApplicationContext(),
MainActivity.class);
MainActivity2.class);
intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
startActivity(intent);
mStartedMainActivity = true;

View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.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=".MainActivity2">
<androidx.fragment.app.FragmentContainerView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/fragment_container_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".FragmentSdDataViewer">
<!-- TODO: Update blank fragment layout -->
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Fragment_OsdAlg" />
</FrameLayout>

View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".FragmentSdDataViewer">
<!-- TODO: Update blank fragment layout -->
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/hello_blank_fragment" />
</FrameLayout>

View File

@@ -555,4 +555,9 @@
libero vel nunc consequat, quis tincidunt nisl eleifend. Cras bibendum enim a justo luctus
vestibulum. Fusce dictum libero quis erat maximus, vitae volutpat diam dignissim.
</string>
<string name="title_activity_main2">MainActivity2</string>
<string name="tab_text_1">Tab 1</string>
<string name="tab_text_2">Tab 2</string>
<!-- TODO: Remove or change this placeholder text -->
<string name="hello_blank_fragment">Hello blank fragment</string>
</resources>