Switched to material theme. Added detail to system fragment. Tidied up common fragment a bit.

This commit is contained in:
Graham Jones
2023-09-02 23:17:23 +01:00
parent 3ce91f89ab
commit 26cc18a17d
22 changed files with 632 additions and 129 deletions

View File

@@ -8,10 +8,9 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;
public class FragmentCommon extends FragmentSdDataViewer {
public class FragmentCommon extends FragmentOsdBaseClass {
String TAG = "FragmentCommon";
public FragmentCommon() {
// Required empty public constructor
@@ -80,7 +79,7 @@ public class FragmentCommon extends FragmentSdDataViewer {
@Override
protected void updateUi() {
Log.d(TAG,"updateUi()");
//Log.d(TAG,"updateUi()");
TextView tv;
tv = (TextView)mRootView.findViewById(R.id.fragment_common_tv1);
if (mConnection.mBound) {
@@ -113,6 +112,39 @@ public class FragmentCommon extends FragmentSdDataViewer {
tv.setBackgroundColor(okColour);
tv.setTextColor(okTextColour);
}
tv = (TextView) mRootView.findViewById(R.id.alarmTv);
if ((mConnection.mSdServer.mSdData.alarmState == 0)
&& !mConnection.mSdServer.mSdData.alarmStanding
&& !mConnection.mSdServer.mSdData.fallAlarmStanding) {
tv.setText(getString(R.string.okBtnTxt));
tv.setBackgroundColor(okColour);
tv.setTextColor(okTextColour);
}
if ((mConnection.mSdServer.mSdData.alarmState == 1)
&& !mConnection.mSdServer.mSdData.alarmStanding
&& !mConnection.mSdServer.mSdData.fallAlarmStanding) {
tv.setText(R.string.Warning);
tv.setBackgroundColor(warnColour);
tv.setTextColor(warnTextColour);
}
if (mConnection.mSdServer.mSdData.alarmState == 6) {
tv.setText(R.string.Mute);
tv.setBackgroundColor(warnColour);
tv.setTextColor(warnTextColour);
}
if (mConnection.mSdServer.mSdData.alarmStanding) {
tv.setText(R.string.Alarm);
tv.setBackgroundColor(alarmColour);
tv.setTextColor(alarmTextColour);
}
if (mConnection.mSdServer.mSdData.fallAlarmStanding) {
tv.setText(R.string.Fall);
tv.setBackgroundColor(alarmColour);
tv.setTextColor(alarmTextColour);
}
tv = (TextView) mRootView.findViewById(R.id.algsTv);
tv.setText("Algorithms");
tv.setBackgroundColor(okColour);

View File

@@ -7,7 +7,7 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
public class FragmentDataSharing extends FragmentSdDataViewer {
public class FragmentDataSharing extends FragmentOsdBaseClass {
String TAG = "FragmentDataSharing";
public FragmentDataSharing() {
// Required empty public constructor

View File

@@ -1,27 +1,13 @@
package uk.org.openseizuredetector;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ProgressBar;
import android.widget.TextView;
import com.github.mikephil.charting.charts.BarChart;
import com.github.mikephil.charting.components.XAxis;
import com.github.mikephil.charting.components.YAxis;
import com.github.mikephil.charting.data.BarData;
import com.github.mikephil.charting.data.BarDataSet;
import com.github.mikephil.charting.data.BarEntry;
import com.github.mikephil.charting.utils.ValueFormatter;
import java.text.DecimalFormat;
import java.util.ArrayList;
public class FragmentHrAlg extends FragmentSdDataViewer {
public class FragmentHrAlg extends FragmentOsdBaseClass {
String TAG = "FragmentOsdAlg";
public FragmentHrAlg() {
// Required empty public constructor

View File

@@ -7,7 +7,7 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
public class FragmentMlAlg extends FragmentSdDataViewer {
public class FragmentMlAlg extends FragmentOsdBaseClass {
String TAG = "FragmentMlAlg";
public FragmentMlAlg() {
// Required empty public constructor

View File

@@ -10,8 +10,6 @@ import android.view.ViewGroup;
import android.widget.ProgressBar;
import android.widget.TextView;
import androidx.core.content.res.ResourcesCompat;
import com.github.mikephil.charting.charts.BarChart;
import com.github.mikephil.charting.components.XAxis;
import com.github.mikephil.charting.components.YAxis;
@@ -23,7 +21,7 @@ import com.github.mikephil.charting.utils.ValueFormatter;
import java.text.DecimalFormat;
import java.util.ArrayList;
public class FragmentOsdAlg extends FragmentSdDataViewer {
public class FragmentOsdAlg extends FragmentOsdBaseClass {
String TAG = "FragmentOsdAlg";
public FragmentOsdAlg() {
// Required empty public constructor
@@ -44,7 +42,7 @@ public class FragmentOsdAlg extends FragmentSdDataViewer {
@Override
protected void updateUi() {
Log.d(TAG,"updateUi()");
//Log.d(TAG,"updateUi()");
TextView tv;
tv = (TextView)mRootView.findViewById(R.id.fragment_osdalg_tv1);
if (mConnection.mBound) {

View File

@@ -17,8 +17,8 @@ import java.util.Timer;
import java.util.TimerTask;
public class FragmentSdDataViewer extends Fragment {
String TAG = "FragmentSdDataViewer";
public class FragmentOsdBaseClass extends Fragment {
String TAG = "FragmentOsdBaseClass";
Context mContext;
OsdUtil mUtil;
SdServiceConnection mConnection;
@@ -35,7 +35,7 @@ public class FragmentSdDataViewer extends Fragment {
public FragmentSdDataViewer() {
public FragmentOsdBaseClass() {
// Required empty public constructor
}

View File

@@ -6,12 +6,13 @@ import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.TextView;
public class FragmentSystem extends FragmentSdDataViewer {
String TAG = "FragmentOsdAlg";
import androidx.appcompat.widget.LinearLayoutCompat;
public class FragmentSystem extends FragmentOsdBaseClass {
String TAG = "FragmentSystem";
public FragmentSystem() {
// Required empty public constructor
}
@@ -53,16 +54,128 @@ public class FragmentSystem extends FragmentSdDataViewer {
@Override
protected void updateUi() {
Log.d(TAG,"updateUi()");
//Log.d(TAG,"updateUi()");
TextView tv;
tv = (TextView)mRootView.findViewById(R.id.fragment_system_tv1);
tv = (TextView)mRootView.findViewById(R.id.fragment_bound_to_server_tv);
if (mConnection.mBound) {
tv.setText("Bound to Server");
tv.setTextColor(okTextColour);
} else {
tv.setText("****NOT BOUND TO SERVER***");
tv.setTextColor(warnTextColour);
return;
}
LinearLayoutCompat ll = (LinearLayoutCompat)mRootView.findViewById(R.id.fragment_ll);
if (mUtil.isServerRunning()) {
ll.setBackgroundColor(okColour);
tv = (TextView) mRootView.findViewById(R.id.serverStatusTv);
if (mConnection.mBound) {
if (mConnection.mSdServer.mSdDataSourceName.equals("Phone")) {
if (mConnection.mSdServer.mLogNDA)
tv.setText(getString(R.string.ServerRunningOK) + getString(R.string.DataSource) + " = " + "Phone" + "\n" + "(Demo Mode)" + "\nNDA Logging");
else
tv.setText(getString(R.string.ServerRunningOK) + getString(R.string.DataSource) + " = " + "Phone" + "\n" + "(Demo Mode)");
tv.setBackgroundColor(warnColour);
tv.setTextColor(warnTextColour);
} else {
if (mConnection.mSdServer.mLogNDA)
tv.setText(getString(R.string.ServerRunningOK) + getString(R.string.DataSource) + " = " + mConnection.mSdServer.mSdDataSourceName + "\nNDA Logging");
else
tv.setText(getString(R.string.ServerRunningOK) + getString(R.string.DataSource) + " = " + mConnection.mSdServer.mSdDataSourceName);
tv.setBackgroundColor(okColour);
tv.setTextColor(okTextColour);
}
}
//Log.v(TAG,"UpdateUi() - displaying server IP address");
tv = (TextView) mRootView.findViewById(R.id.serverIpTv);
tv.setText(getString(R.string.AccessServerAt) + " http://"
+ mUtil.getLocalIpAddress()
+ ":8080");
tv.setBackgroundColor(okColour);
tv.setTextColor(okTextColour);
} else {
ll.setBackgroundColor(warnColour);
tv = (TextView) mRootView.findViewById(R.id.serverStatusTv);
tv.setText(R.string.ServerStopped);
tv.setBackgroundColor(warnColour);
tv.setTextColor(warnTextColour);
tv = (TextView) mRootView.findViewById(R.id.serverIpTv);
tv.setText("--");
tv.setBackgroundColor(warnColour);
tv.setTextColor(warnTextColour);
}
try {
if (mConnection.mBound) {
tv = (TextView) mRootView.findViewById(R.id.alarmTv);
if ((mConnection.mSdServer.mSdData.alarmState == 0)
&& !mConnection.mSdServer.mSdData.alarmStanding
&& !mConnection.mSdServer.mSdData.fallAlarmStanding) {
tv.setText(getString(R.string.okBtnTxt));
tv.setBackgroundColor(okColour);
tv.setTextColor(okTextColour);
}
if ((mConnection.mSdServer.mSdData.alarmState == 1)
&& !mConnection.mSdServer.mSdData.alarmStanding
&& !mConnection.mSdServer.mSdData.fallAlarmStanding) {
tv.setText(R.string.Warning);
tv.setBackgroundColor(warnColour);
tv.setTextColor(warnTextColour);
}
if (mConnection.mSdServer.mSdData.alarmState == 6) {
tv.setText(R.string.Mute);
tv.setBackgroundColor(warnColour);
tv.setTextColor(warnTextColour);
}
if (mConnection.mSdServer.mSdData.alarmStanding) {
tv.setText(R.string.Alarm);
tv.setBackgroundColor(alarmColour);
tv.setTextColor(alarmTextColour);
}
if (mConnection.mSdServer.mSdData.fallAlarmStanding) {
tv.setText(R.string.Fall);
tv.setBackgroundColor(alarmColour);
tv.setTextColor(alarmTextColour);
}
tv = (TextView) mRootView.findViewById(R.id.data_time_tv);
tv.setText(mConnection.mSdServer.mSdData.dataTime.format("%H:%M:%S"));
tv.setBackgroundColor(okColour);
tv.setTextColor(okTextColour);
tv = (TextView) mRootView.findViewById(R.id.fragment_watch_app_status_tv);
if (mConnection.mSdServer.mSdData.watchAppRunning) {
tv.setText(R.string.WatchAppOK);
tv.setBackgroundColor(okColour);
tv.setTextColor(okTextColour);
} else {
tv.setText(R.string.WatchAppNotRunning);
tv.setBackgroundColor(warnColour);
tv.setTextColor(warnTextColour);
}
tv = (TextView) mRootView.findViewById(R.id.battTv);
tv.setText(getString(R.string.WatchBatteryEquals) + String.valueOf(mConnection.mSdServer.mSdData.batteryPc) + "%");
if (mConnection.mSdServer.mSdData.batteryPc <= 10) {
tv.setBackgroundColor(alarmColour);
tv.setTextColor(alarmTextColour);
}
if (mConnection.mSdServer.mSdData.batteryPc > 10) {
tv.setBackgroundColor(warnColour);
tv.setTextColor(warnTextColour);
}
if (mConnection.mSdServer.mSdData.batteryPc >= 20) {
tv.setBackgroundColor(okColour);
tv.setTextColor(okTextColour);
}
}
} catch (Exception e) {
Log.e(TAG, "UpdateUi: Exception - ");
e.printStackTrace();
}
}
}

View File

@@ -7,7 +7,7 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
public class FragmentWebServer extends FragmentSdDataViewer {
public class FragmentWebServer extends FragmentOsdBaseClass {
String TAG = "FragmentWebServer";
public FragmentWebServer() {
// Required empty public constructor

View File

@@ -642,7 +642,7 @@ public class MainActivity extends AppCompatActivity {
tv.setTextColor(alarmTextColour);
}
tv = (TextView) findViewById(R.id.pebTimeTv);
tv = (TextView) findViewById(R.id.data_time_tv);
tv.setText(mConnection.mSdServer.mSdData.dataTime.format("%H:%M:%S"));
tv.setBackgroundColor(okColour);
tv.setTextColor(okTextColour);
@@ -690,7 +690,7 @@ public class MainActivity extends AppCompatActivity {
}
*/
tv = (TextView) findViewById(R.id.appTv);
tv = (TextView) findViewById(R.id.fragment_watch_app_status_tv);
if (mConnection.mSdServer.mSdData.watchAppRunning) {
tv.setText(R.string.WatchAppOK);
tv.setBackgroundColor(okColour);
@@ -865,12 +865,12 @@ public class MainActivity extends AppCompatActivity {
tv.setBackgroundColor(warnColour);
tv.setTextColor(warnTextColour);
}
tv = (TextView) findViewById(R.id.pebTimeTv);
tv = (TextView) findViewById(R.id.data_time_tv);
tv.setText(mConnection.mSdServer.mSdData.dataTime.format("%H:%M:%S"));
tv.setBackgroundColor(okColour);
tv.setTextColor(okTextColour);
tv = (TextView) findViewById(R.id.pebTimeTv);
tv = (TextView) findViewById(R.id.data_time_tv);
tv.setText("--:--:--");
tv.setBackgroundColor(warnColour);
tv.setTextColor(warnTextColour);
@@ -880,7 +880,7 @@ public class MainActivity extends AppCompatActivity {
tv.setBackgroundColor(warnColour);
tv.setTextColor(warnTextColour);
tv = (TextView) findViewById(R.id.appTv);
tv = (TextView) findViewById(R.id.fragment_watch_app_status_tv);
tv.setText(getString(R.string.WatchApp) + " ----");
tv.setBackgroundColor(warnColour);
tv.setTextColor(warnTextColour);
@@ -895,12 +895,12 @@ public class MainActivity extends AppCompatActivity {
tv.setText(R.string.Dashes);
tv.setBackgroundColor(warnColour);
tv.setTextColor(warnTextColour);
tv = (TextView) findViewById(R.id.pebTimeTv);
tv = (TextView) findViewById(R.id.data_time_tv);
tv.setText(mConnection.mSdServer.mSdData.dataTime.format("%H:%M:%S"));
tv.setBackgroundColor(okColour);
tv.setTextColor(okTextColour);
tv = (TextView) findViewById(R.id.pebTimeTv);
tv = (TextView) findViewById(R.id.data_time_tv);
tv.setText("--:--:--");
tv.setBackgroundColor(warnColour);
tv.setTextColor(warnTextColour);
@@ -910,7 +910,7 @@ public class MainActivity extends AppCompatActivity {
tv.setBackgroundColor(warnColour);
tv.setTextColor(warnTextColour);
tv = (TextView) findViewById(R.id.appTv);
tv = (TextView) findViewById(R.id.fragment_watch_app_status_tv);
tv.setText(getString(R.string.WatchApp) + " -----");
tv.setBackgroundColor(warnColour);
tv.setTextColor(warnTextColour);

View File

@@ -1,24 +1,71 @@
package uk.org.openseizuredetector;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.view.MenuCompat;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.viewpager2.adapter.FragmentStateAdapter;
import androidx.viewpager2.widget.ViewPager2;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.preference.PreferenceManager;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import com.rohitss.uceh.UCEHandler;
import java.util.Timer;
import java.util.TimerTask;
public class MainActivity2 extends AppCompatActivity {
private String TAG = "MainActivity2";
private int okColour = Color.BLUE;
private int warnColour = Color.MAGENTA;
private int alarmColour = Color.RED;
private int okTextColour = Color.WHITE;
private int warnTextColour = Color.WHITE;
private int alarmTextColour = Color.BLACK;
private ViewPager2 mFragmentPager;
private FragmentStateAdapter mFragmentStateAdapter;
private Context mContext;
private OsdUtil mUtil;
private SdServiceConnection mConnection;
final Handler serverStatusHandler = new Handler();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main2);
Log.i(TAG, "onCreate()");
// Set our custom uncaught exception handler to report issues.
//Thread.setDefaultUncaughtExceptionHandler(new OsdUncaughtExceptionHandler(MainActivity.this));
new UCEHandler.Builder(this)
.addCommaSeparatedEmailAddresses("crashreports@openseizuredetector.org.uk,")
.build();
//int i = 5/0; // Force exception to test handler.
mUtil = new OsdUtil(getApplicationContext(), serverStatusHandler);
mConnection = new SdServiceConnection(getApplicationContext());
mUtil.writeToSysLogFile("");
mUtil.writeToSysLogFile("* MainActivity Started *");
mUtil.writeToSysLogFile("MainActivity.onCreate()");
mContext = this;
if (savedInstanceState == null) {
// Instantiate a ViewPager2 and a PagerAdapter.
mFragmentPager = findViewById(R.id.fragment_pager);
@@ -29,11 +76,72 @@ public class MainActivity2 extends AppCompatActivity {
.add(R.id.fragment_common_container_view, FragmentCommon.class, null)
.commit();
}
}
/**
* Create Action Bar
*/
@Override
public boolean onCreateOptionsMenu(Menu menu) {
Log.i(TAG, "onCreateOptionsMenu()");
getMenuInflater().inflate(R.menu.main_activity_actions, menu);
MenuCompat.setGroupDividerEnabled(menu, true);
return true;
}
@Override
protected void onStart() {
super.onStart();
Log.i(TAG, "onStart()");
mUtil.writeToSysLogFile("MainActivity.onStart()");
SharedPreferences SP = PreferenceManager
.getDefaultSharedPreferences(getBaseContext());
boolean audibleAlarm = SP.getBoolean("AudibleAlarm", true);
Log.v(TAG, "onStart - auidbleAlarm = " + audibleAlarm);
TextView tv;
tv = (TextView) findViewById(R.id.versionTv);
String versionName = mUtil.getAppVersionName();
tv.setText(getString(R.string.AppTitleText) + " " + versionName);
tv.setBackgroundColor(okColour);
tv.setTextColor(okTextColour);
if (mUtil.isServerRunning()) {
mUtil.writeToSysLogFile("MainActivity.onStart - Binding to Server");
mUtil.bindToServer(getApplicationContext(), mConnection);
} else {
Log.i(TAG, "onStart() - Server Not Running");
mUtil.writeToSysLogFile("MainActivity.onStart - Server Not Running");
}
}
@Override
protected void onStop() {
super.onStop();
Log.i(TAG, "onStop() - unbinding from server");
mUtil.writeToSysLogFile("MainActivity.onStop()");
mUtil.unbindFromServer(getApplicationContext(), mConnection);
}
@Override
protected void onPause() {
super.onPause();
Log.i(TAG, "onPause()");
}
@Override
protected void onResume() {
super.onResume();
Log.i(TAG, "onResume()");
}
@Override
public void onBackPressed() {
if (mFragmentPager.getCurrentItem() == 0) {
@@ -46,6 +154,122 @@ public class MainActivity2 extends AppCompatActivity {
}
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
Log.i(TAG, "onOptionsItemSelected() : " + item.getItemId() + " selected");
switch (item.getItemId()) {
/*case R.id.action_launch_pebble_app:
Log.i(TAG, "action_launch_pebble_app");
mConnection.mSdServer.mSdDataSource.startPebbleApp();
return true;
*/
case R.id.action_install_watch_app:
Log.i(TAG, "action_install_watch_app");
mConnection.mSdServer.mSdDataSource.installWatchApp();
return true;
case R.id.action_accept_alarm:
Log.i(TAG, "action_accept_alarm");
if (mConnection.mBound) {
mConnection.mSdServer.acceptAlarm();
}
return true;
case R.id.action_start_stop:
// Respond to the start/stop server menu item.
Log.i(TAG, "action_start_stop");
if (mConnection.mBound) {
Log.i(TAG, "Stopping Server");
mUtil.unbindFromServer(getApplicationContext(), mConnection);
stopServer();
finish();
} else {
Log.i(TAG, "Starting Server");
startServer();
// and bind to it so we can see its data
Log.i(TAG, "Binding to Server");
mUtil.bindToServer(getApplicationContext(), mConnection);
}
return true;
case R.id.action_test_alarm_beep:
Log.i(TAG, "action_test_alarm_beep");
if (mConnection.mBound) {
mConnection.mSdServer.alarmBeep();
}
return true;
case R.id.action_test_warning_beep:
Log.i(TAG, "action_test_warning_beep");
if (mConnection.mBound) {
mConnection.mSdServer.warningBeep();
}
return true;
case R.id.action_test_sms_alarm:
Log.i(TAG, "action_test_sms_alarm");
if (mConnection.mBound) {
mConnection.mSdServer.sendSMSAlarm();
}
return true;
case R.id.action_authenticate_api:
Log.i(TAG, "action_autheticate_api");
try {
Intent i = new Intent(
MainActivity2.this,
AuthenticateActivity.class);
this.startActivity(i);
} catch (Exception ex) {
Log.i(TAG, "exception starting export activity " + ex.toString());
}
return true;
case R.id.action_about_datasharing:
Log.i(TAG, "action_about_datasharing");
showDataSharingDialog();
return true;
case R.id.action_logmanager:
Log.i(TAG, "action_logmanager");
try {
Intent intent = new Intent(
MainActivity2.this,
LogManagerControlActivity.class);
this.startActivity(intent);
} catch (Exception ex) {
Log.i(TAG, "exception starting log manager activity " + ex.toString());
}
return true;
case R.id.action_report_seizure:
Log.i(TAG, "action_report_seizure");
try {
Intent intent = new Intent(
MainActivity2.this,
ReportSeizureActivity.class);
this.startActivity(intent);
} catch (Exception ex) {
Log.i(TAG, "exception starting Report Seizure activity " + ex.toString());
}
return true;
case R.id.action_settings:
Log.i(TAG, "action_settings");
try {
Intent prefsIntent = new Intent(
MainActivity2.this,
PrefActivity.class);
this.startActivity(prefsIntent);
} catch (Exception ex) {
Log.i(TAG, "exception starting settings activity " + ex.toString());
}
return true;
case R.id.action_about:
Log.i(TAG, "action_about");
showAbout();
return true;
default:
return super.onOptionsItemSelected(item);
}
}
/**
* A simple pager adapter that represents 5 ScreenSlidePageFragment objects, in
* sequence.
@@ -66,11 +290,9 @@ public class MainActivity2 extends AppCompatActivity {
case 2:
return new FragmentMlAlg();
case 3:
return new FragmentWebServer();
return new FragmentSystem();
case 4:
return new FragmentDataSharing();
case 5:
return new FragmentSystem();
default:
Log.e(TAG,"createFragment() - invalid Position "+position);
@@ -80,7 +302,87 @@ public class MainActivity2 extends AppCompatActivity {
@Override
public int getItemCount() {
return 6;
return 5;
}
}
private void startServer() {
mUtil.writeToSysLogFile("MainActivity.startServer()");
Log.i(TAG, "startServer(): starting Server...");
mUtil.startServer();
}
private void stopServer() {
mUtil.writeToSysLogFile("MainActivity.stopServer()");
Log.i(TAG, "stopServer(): stopping Server...");
mUtil.stopServer();
}
private void showAbout() {
mUtil.writeToSysLogFile("MainActivity.showAbout()");
View aboutView = getLayoutInflater().inflate(R.layout.about_layout, null, false);
String versionName = mUtil.getAppVersionName();
Log.i(TAG, "showAbout() - version name = " + versionName);
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setIcon(R.drawable.icon_24x24);
builder.setTitle("OpenSeizureDetector V" + versionName);
builder.setNeutralButton(getString(R.string.closeBtnTxt), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
});
builder.setPositiveButton(R.string.privacy_policy_button_title, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
String url = OsdUtil.PRIVACY_POLICY_URL;
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
startActivity(i);
dialog.cancel();
}
});
builder.setNegativeButton(R.string.data_sharing_button_title, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
String url = OsdUtil.DATA_SHARING_URL;
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
startActivity(i);
dialog.cancel();
}
});
builder.setView(aboutView);
builder.create();
builder.show();
}
private void showDataSharingDialog() {
mUtil.writeToSysLogFile("MainActivity.showDataSharingDialog()");
View aboutView = getLayoutInflater().inflate(R.layout.data_sharing_dialog_layout, null, false);
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setIcon(R.drawable.datasharing_fault_24x24);
builder.setTitle(R.string.data_sharing_dialog_title);
builder.setNegativeButton(getString(R.string.cancel), null);
builder.setPositiveButton(getString(R.string.login), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Log.i(TAG, "dataSharingDialog.positiveButton.onClick()");
try {
Intent i = new Intent(
MainActivity2.this,
AuthenticateActivity.class);
mContext.startActivity(i);
} catch (Exception ex) {
Log.i(TAG, "exception starting activity " + ex.toString());
}
}
});
builder.setView(aboutView);
builder.create();
builder.show();
}
}

View File

@@ -3,30 +3,31 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".FragmentSdDataViewer">
tools:context=".FragmentOsdBaseClass">
<!-- TODO: Update blank fragment layout -->
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="253dp"
android:orientation="vertical">
<!-- TODO: Update blank fragment layout -->
<TextView
android:id="@+id/fragment_common_tv1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Fragment_System" />
android:orientation="vertical"
android:background="@color/okBackgroundColor"
>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="OpenSeizureDetector Common Components Status" />
android:text="OpenSeizureDetector Common Components Status"
android:textColor="@color/okTextColor"
/>
<TextView
android:id="@+id/versionTv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/app_name" />
android:text="@string/app_name"
android:textColor="@color/okTextColor"
/>
<LinearLayout
@@ -37,73 +38,84 @@
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal">
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/serverStatusTv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="---" />
<TextView
android:id="@+id/alarmTv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="---"
android:textSize="32sp" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="10dp">
<TextView
android:id="@+id/algsTv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Algorithms" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="---" />
android:orientation="horizontal">
<TextView
android:id="@+id/osdAlgTv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="---" />
<TextView
android:id="@+id/cnnAlgTv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="---" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="10dp">
android:orientation="horizontal">
<TextView
android:id="@+id/algsTv"
android:id="@+id/hrAlgTv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Algorithms" />
android:text="---" />
<LinearLayout
<TextView
android:id="@+id/o2AlgTv"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal">
android:layout_height="wrap_content"
android:text="---" />
<TextView
android:id="@+id/osdAlgTv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="---" />
<TextView
android:id="@+id/cnnAlgTv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="---" />
</LinearLayout>
<LinearLayout
<!--<TextView
android:id="@+id/fallAlgTv"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal">
<TextView
android:id="@+id/hrAlgTv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="---" />
<TextView
android:id="@+id/o2AlgTv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="---" />
<!--<TextView
android:id="@+id/fallAlgTv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:visibility="gone"/>
-->
</LinearLayout>
android:layout_height="wrap_content"
android:text=""
android:visibility="gone"/>
-->
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -132,6 +144,11 @@
android:text="@string/ManualAlarmBtnTxt" />
</LinearLayout>
<TextView
android:id="@+id/fragment_common_tv1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Fragment_System" />
</androidx.appcompat.widget.LinearLayoutCompat>

View File

@@ -3,7 +3,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".FragmentSdDataViewer">
tools:context=".FragmentOsdBaseClass">
<!-- TODO: Update blank fragment layout -->
<androidx.appcompat.widget.LinearLayoutCompat

View File

@@ -3,7 +3,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".FragmentSdDataViewer">
tools:context=".FragmentOsdBaseClass">
<!-- TODO: Update blank fragment layout -->
<androidx.appcompat.widget.LinearLayoutCompat

View File

@@ -3,7 +3,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".FragmentSdDataViewer">
tools:context=".FragmentOsdBaseClass">
<!-- TODO: Update blank fragment layout -->
<androidx.appcompat.widget.LinearLayoutCompat

View File

@@ -3,7 +3,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".FragmentSdDataViewer">
tools:context=".FragmentOsdBaseClass">
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"

View File

@@ -3,7 +3,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".FragmentSdDataViewer">
tools:context=".FragmentOsdBaseClass">
<!-- TODO: Update blank fragment layout -->
<TextView

View File

@@ -4,41 +4,91 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".FragmentSdDataViewer">
tools:context=".FragmentOsdBaseClass">
<!-- TODO: Update blank fragment layout -->
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="253dp"
android:orientation="vertical">
<!-- TODO: Update blank fragment layout -->
<TextView
android:id="@+id/fragment_system_tv1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Fragment_System" />
android:orientation="vertical"
android:id="@+id/fragment_ll">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="OpenSeizureDetector System Status" />
android:text="OpenSeizureDetector System Status"
android:textColor="@color/okTextColor"
android:background="@color/okBackgroundColor"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageButton
android:id="@+id/settingsButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@android:drawable/ic_menu_manage" />
<ImageButton
android:id="@+id/settingsButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@android:drawable/ic_menu_manage" />
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Edit Settings"
android:textColor="@color/okTextColor"
android:background="@color/okBackgroundColor"/>
</LinearLayout>
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:id="@+id/serverStatusTv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Edit Settings" />
</LinearLayout>
android:text="---" />
<TextView
android:id="@+id/fragment_bound_to_server_tv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Fragment_System" />
<TextView
android:id="@+id/data_time_tv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="left"
android:text="---" />
<TextView
android:id="@+id/fragment_watch_app_status_tv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="---" />
<TextView
android:id="@+id/battTv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="---" />
<TextView
android:id="@+id/alarmTv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="---" />
<TextView
android:id="@+id/serverIpTv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="left"
android:text="---" />
</androidx.appcompat.widget.LinearLayoutCompat>

View File

@@ -3,7 +3,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".FragmentSdDataViewer">
tools:context=".FragmentOsdBaseClass">
<!-- TODO: Update blank fragment layout -->
<androidx.appcompat.widget.LinearLayoutCompat

View File

@@ -107,7 +107,7 @@
android:orientation="vertical">
<TextView
android:id="@+id/pebTimeTv"
android:id="@+id/data_time_tv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
@@ -135,7 +135,7 @@
android:text="---" />
<TextView
android:id="@+id/appTv"
android:id="@+id/fragment_watch_app_status_tv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="---" />

View File

@@ -3,4 +3,6 @@
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color>
<color name="okBackgroundColor">#0000ff</color>
<color name="okTextColor">#ffffff</color>
</resources>

View File

@@ -1,7 +1,7 @@
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<style name="AppTheme" parent="Theme.MaterialComponents.DayNight">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
@@ -9,3 +9,5 @@
</style>
</resources>