Added the main fragments for the new main activity - still need to populate them and add the main menu, but swiping between them works
This commit is contained in:
227
app/src/main/java/uk/org/openseizuredetector/FragmentCommon.java
Normal file
227
app/src/main/java/uk/org/openseizuredetector/FragmentCommon.java
Normal file
@@ -0,0 +1,227 @@
|
|||||||
|
package uk.org.openseizuredetector;
|
||||||
|
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.graphics.Paint;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.util.Log;
|
||||||
|
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 {
|
||||||
|
String TAG = "FragmentCommon";
|
||||||
|
public FragmentCommon() {
|
||||||
|
// 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_common, container, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||||
|
super.onViewCreated(view, savedInstanceState);
|
||||||
|
// Deal with the 'AcceptAlarm Button'
|
||||||
|
Button button = (Button) mRootView.findViewById(R.id.acceptAlarmButton);
|
||||||
|
button.setOnClickListener(new View.OnClickListener() {
|
||||||
|
public void onClick(View v) {
|
||||||
|
Log.v(TAG, "acceptAlarmButton.onClick()");
|
||||||
|
if (mConnection.mBound) {
|
||||||
|
if ((mConnection.mSdServer.mSmsTimer != null)
|
||||||
|
&& (mConnection.mSdServer.mSmsTimer.mTimeLeft > 0)) {
|
||||||
|
Log.i(TAG, "acceptAlarmButton.onClick() - Stopping SMS Timer");
|
||||||
|
mUtil.showToast(getString(R.string.SMSAlarmCancelledMsg));
|
||||||
|
mConnection.mSdServer.stopSmsTimer();
|
||||||
|
} else {
|
||||||
|
Log.v(TAG, "acceptAlarmButton.onClick() - Accepting Alarm");
|
||||||
|
mConnection.mSdServer.acceptAlarm();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Deal with the 'Cancel Audible Button'
|
||||||
|
button = (Button) mRootView.findViewById(R.id.cancelAudibleButton);
|
||||||
|
button.setOnClickListener(new View.OnClickListener() {
|
||||||
|
public void onClick(View v) {
|
||||||
|
Log.v(TAG, "cancelAudibleButton.onClick()");
|
||||||
|
if (mConnection.mBound) {
|
||||||
|
mConnection.mSdServer.cancelAudible();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Deal with the 'Raise Alarm'
|
||||||
|
button = (Button) mRootView.findViewById(R.id.manualAlarmButton);
|
||||||
|
button.setOnClickListener(new View.OnClickListener() {
|
||||||
|
public void onClick(View v) {
|
||||||
|
Log.v(TAG, "manualAlarmButton.onClick()");
|
||||||
|
if (mConnection.mBound) {
|
||||||
|
mConnection.mSdServer.raiseManualAlarm();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void updateUi() {
|
||||||
|
Log.d(TAG,"updateUi()");
|
||||||
|
TextView tv;
|
||||||
|
tv = (TextView)mRootView.findViewById(R.id.fragment_common_tv1);
|
||||||
|
if (mConnection.mBound) {
|
||||||
|
tv.setText("Bound to Server");
|
||||||
|
} else {
|
||||||
|
tv.setText("****NOT BOUND TO SERVER***");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mUtil.isServerRunning()) {
|
||||||
|
//LinearLayout ll = (LinearLayout) findViewById(R.id.statusLayout);
|
||||||
|
//ll.setBackgroundColor(okColour);
|
||||||
|
//ll = (LinearLayout) findViewById(R.id.watchStatusLl);
|
||||||
|
//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);
|
||||||
|
}
|
||||||
|
tv = (TextView) mRootView.findViewById(R.id.algsTv);
|
||||||
|
tv.setText("Algorithms");
|
||||||
|
tv.setBackgroundColor(okColour);
|
||||||
|
tv.setTextColor(okTextColour);
|
||||||
|
tv = (TextView) mRootView.findViewById(R.id.osdAlgTv);
|
||||||
|
tv.setText("OSD ");
|
||||||
|
if (mConnection.mSdServer.mSdData.mOsdAlarmActive) {
|
||||||
|
tv.setBackgroundColor(okColour);
|
||||||
|
tv.setTextColor(okTextColour);
|
||||||
|
tv.setPaintFlags(tv.getPaintFlags() & ~Paint.STRIKE_THRU_TEXT_FLAG);
|
||||||
|
} else {
|
||||||
|
tv.setBackgroundColor(warnColour);
|
||||||
|
tv.setTextColor(warnTextColour);
|
||||||
|
tv.setPaintFlags(tv.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
|
||||||
|
}
|
||||||
|
tv = (TextView) mRootView.findViewById(R.id.cnnAlgTv);
|
||||||
|
tv.setText("CNN ");
|
||||||
|
if (mConnection.mSdServer.mSdData.mCnnAlarmActive) {
|
||||||
|
tv.setBackgroundColor(okColour);
|
||||||
|
tv.setTextColor(okTextColour);
|
||||||
|
tv.setPaintFlags(tv.getPaintFlags() & ~Paint.STRIKE_THRU_TEXT_FLAG);
|
||||||
|
} else {
|
||||||
|
tv.setBackgroundColor(okColour);
|
||||||
|
tv.setTextColor(okTextColour);
|
||||||
|
tv.setPaintFlags(tv.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
|
||||||
|
}
|
||||||
|
tv = (TextView) mRootView.findViewById(R.id.hrAlgTv);
|
||||||
|
tv.setText("HR ");
|
||||||
|
if (mConnection.mSdServer.mSdData.mHRAlarmActive) {
|
||||||
|
tv.setBackgroundColor(okColour);
|
||||||
|
tv.setTextColor(okTextColour);
|
||||||
|
tv.setPaintFlags(tv.getPaintFlags() & ~Paint.STRIKE_THRU_TEXT_FLAG);
|
||||||
|
} else {
|
||||||
|
tv.setBackgroundColor(okColour);
|
||||||
|
tv.setTextColor(okTextColour);
|
||||||
|
tv.setPaintFlags(tv.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
|
||||||
|
}
|
||||||
|
tv = (TextView) mRootView.findViewById(R.id.o2AlgTv);
|
||||||
|
tv.setText("O2 ");
|
||||||
|
if (mConnection.mSdServer.mSdData.mO2SatAlarmActive) {
|
||||||
|
tv.setBackgroundColor(okColour);
|
||||||
|
tv.setTextColor(okTextColour);
|
||||||
|
tv.setPaintFlags(tv.getPaintFlags() & ~Paint.STRIKE_THRU_TEXT_FLAG);
|
||||||
|
} else {
|
||||||
|
tv.setBackgroundColor(okColour);
|
||||||
|
tv.setTextColor(okTextColour);
|
||||||
|
tv.setPaintFlags(tv.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
// deal with latch alarms button
|
||||||
|
Button acceptAlarmButton = (Button) mRootView.findViewById(R.id.acceptAlarmButton);
|
||||||
|
|
||||||
|
if (mConnection.mBound) {
|
||||||
|
if ((mConnection.mSdServer.mSmsTimer != null)
|
||||||
|
&& (mConnection.mSdServer.mSmsTimer.mTimeLeft > 0)) {
|
||||||
|
acceptAlarmButton.setText(getString(R.string.SMSWillBeSentIn) + " " +
|
||||||
|
mConnection.mSdServer.mSmsTimer.mTimeLeft / 1000 +
|
||||||
|
" s - " + getString(R.string.Cancel));
|
||||||
|
acceptAlarmButton.setBackgroundColor(alarmColour);
|
||||||
|
acceptAlarmButton.setEnabled(true);
|
||||||
|
} else {
|
||||||
|
acceptAlarmButton.setText(R.string.AcceptAlarm);
|
||||||
|
acceptAlarmButton.setBackgroundColor(Color.GRAY);
|
||||||
|
if (mConnection.mBound)
|
||||||
|
if ((mConnection.mSdServer.isLatchAlarms())
|
||||||
|
|| mConnection.mSdServer.mSdData.mFallActive) {
|
||||||
|
acceptAlarmButton.setEnabled(true);
|
||||||
|
} else {
|
||||||
|
acceptAlarmButton.setEnabled(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
acceptAlarmButton.setText(getString(R.string.AcceptAlarm));
|
||||||
|
acceptAlarmButton.setBackgroundColor(Color.DKGRAY);
|
||||||
|
acceptAlarmButton.setEnabled(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deal with Cancel Audible button
|
||||||
|
Button cancelAudibleButton =
|
||||||
|
(Button) mRootView.findViewById(R.id.cancelAudibleButton);
|
||||||
|
if (mConnection.mBound)
|
||||||
|
if (mConnection.mSdServer.isAudibleCancelled()) {
|
||||||
|
cancelAudibleButton.setText(getString(R.string.AudibleAlarmsCancelledFor)
|
||||||
|
+ " " + mConnection.mSdServer.
|
||||||
|
cancelAudibleTimeRemaining()
|
||||||
|
+ " sec");
|
||||||
|
cancelAudibleButton.setEnabled(true);
|
||||||
|
} else {
|
||||||
|
if (mConnection.mSdServer.mAudibleAlarm) {
|
||||||
|
cancelAudibleButton.setText(R.string.CancelAudibleAlarms);
|
||||||
|
cancelAudibleButton.setEnabled(true);
|
||||||
|
} else {
|
||||||
|
cancelAudibleButton.setText(R.string.AudibleAlarmsOff);
|
||||||
|
cancelAudibleButton.setEnabled(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package uk.org.openseizuredetector;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
public class FragmentDataSharing extends FragmentSdDataViewer {
|
||||||
|
String TAG = "FragmentDataSharing";
|
||||||
|
public FragmentDataSharing() {
|
||||||
|
// 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_data_sharing, container, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void updateUi() {
|
||||||
|
Log.d(TAG,"updateUi()");
|
||||||
|
TextView tv;
|
||||||
|
tv = (TextView)mRootView.findViewById(R.id.fragment_data_sharing_tv1);
|
||||||
|
if (mConnection.mBound) {
|
||||||
|
tv.setText("Bound to Server");
|
||||||
|
} else {
|
||||||
|
tv.setText("****NOT BOUND TO SERVER***");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -37,14 +37,14 @@ public class FragmentHrAlg extends FragmentSdDataViewer {
|
|||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
Bundle savedInstanceState) {
|
Bundle savedInstanceState) {
|
||||||
// Inflate the layout for this fragment
|
// Inflate the layout for this fragment
|
||||||
return inflater.inflate(R.layout.fragment_osdalg, container, false);
|
return inflater.inflate(R.layout.fragment_hr_alg, container, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void updateUi() {
|
protected void updateUi() {
|
||||||
Log.d(TAG,"updateUi()");
|
Log.d(TAG,"updateUi()");
|
||||||
TextView tv;
|
TextView tv;
|
||||||
tv = (TextView)mRootView.findViewById(R.id.fragment_osdalg_tv1);
|
tv = (TextView)mRootView.findViewById(R.id.fragment_hr_alg_tv1);
|
||||||
if (mConnection.mBound) {
|
if (mConnection.mBound) {
|
||||||
tv.setText("Bound to Server");
|
tv.setText("Bound to Server");
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package uk.org.openseizuredetector;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
public class FragmentMlAlg extends FragmentSdDataViewer {
|
||||||
|
String TAG = "FragmentMlAlg";
|
||||||
|
public FragmentMlAlg() {
|
||||||
|
// 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_ml_alg, container, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void updateUi() {
|
||||||
|
Log.d(TAG,"updateUi()");
|
||||||
|
TextView tv;
|
||||||
|
tv = (TextView)mRootView.findViewById(R.id.fragment_ml_alg_tv1);
|
||||||
|
if (mConnection.mBound) {
|
||||||
|
tv.setText("Bound to Server");
|
||||||
|
} else {
|
||||||
|
tv.setText("****NOT BOUND TO SERVER***");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
package uk.org.openseizuredetector;
|
package uk.org.openseizuredetector;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.graphics.Color;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
@@ -25,6 +26,14 @@ public class FragmentSdDataViewer extends Fragment {
|
|||||||
Timer mUiTimer;
|
Timer mUiTimer;
|
||||||
protected View mRootView;
|
protected View mRootView;
|
||||||
|
|
||||||
|
protected int okColour = Color.BLUE;
|
||||||
|
protected int warnColour = Color.MAGENTA;
|
||||||
|
protected int alarmColour = Color.RED;
|
||||||
|
protected int okTextColour = Color.WHITE;
|
||||||
|
protected int warnTextColour = Color.WHITE;
|
||||||
|
protected int alarmTextColour = Color.BLACK;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public FragmentSdDataViewer() {
|
public FragmentSdDataViewer() {
|
||||||
// Required empty public constructor
|
// Required empty public constructor
|
||||||
|
|||||||
@@ -0,0 +1,68 @@
|
|||||||
|
package uk.org.openseizuredetector;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
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";
|
||||||
|
public FragmentSystem() {
|
||||||
|
// 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_system, container, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||||
|
super.onViewCreated(view, savedInstanceState);
|
||||||
|
// Handle Edit Settings Button
|
||||||
|
ImageButton button = (ImageButton) mRootView.findViewById(R.id.settingsButton);
|
||||||
|
button.setOnClickListener(new View.OnClickListener() {
|
||||||
|
public void onClick(View v) {
|
||||||
|
Log.i(TAG, "settingsButton.onClick()");
|
||||||
|
try {
|
||||||
|
Intent prefsIntent = new Intent(
|
||||||
|
mContext,
|
||||||
|
PrefActivity.class);
|
||||||
|
mContext.startActivity(prefsIntent);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
Log.i(TAG, "exception starting settings activity " + ex.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void updateUi() {
|
||||||
|
Log.d(TAG,"updateUi()");
|
||||||
|
TextView tv;
|
||||||
|
tv = (TextView)mRootView.findViewById(R.id.fragment_system_tv1);
|
||||||
|
if (mConnection.mBound) {
|
||||||
|
tv.setText("Bound to Server");
|
||||||
|
} else {
|
||||||
|
tv.setText("****NOT BOUND TO SERVER***");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package uk.org.openseizuredetector;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
public class FragmentWebServer extends FragmentSdDataViewer {
|
||||||
|
String TAG = "FragmentWebServer";
|
||||||
|
public FragmentWebServer() {
|
||||||
|
// 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_web_server, container, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void updateUi() {
|
||||||
|
Log.d(TAG,"updateUi()");
|
||||||
|
TextView tv;
|
||||||
|
tv = (TextView)mRootView.findViewById(R.id.fragment_web_server_tv1);
|
||||||
|
if (mConnection.mBound) {
|
||||||
|
tv.setText("Bound to Server");
|
||||||
|
} else {
|
||||||
|
tv.setText("****NOT BOUND TO SERVER***");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,6 +8,8 @@ import androidx.viewpager2.widget.ViewPager2;
|
|||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.Button;
|
||||||
|
|
||||||
public class MainActivity2 extends AppCompatActivity {
|
public class MainActivity2 extends AppCompatActivity {
|
||||||
private String TAG = "MainActivity2";
|
private String TAG = "MainActivity2";
|
||||||
@@ -22,11 +24,14 @@ public class MainActivity2 extends AppCompatActivity {
|
|||||||
mFragmentPager = findViewById(R.id.fragment_pager);
|
mFragmentPager = findViewById(R.id.fragment_pager);
|
||||||
mFragmentStateAdapter = new ScreenSlideFragmentPagerAdapter(this);
|
mFragmentStateAdapter = new ScreenSlideFragmentPagerAdapter(this);
|
||||||
mFragmentPager.setAdapter(mFragmentStateAdapter);
|
mFragmentPager.setAdapter(mFragmentStateAdapter);
|
||||||
//getSupportFragmentManager().beginTransaction()
|
getSupportFragmentManager().beginTransaction()
|
||||||
// .setReorderingAllowed(true)
|
.setReorderingAllowed(true)
|
||||||
// .add(R.id.fragment_container_view, FragmentOsdAlg.class, null)
|
.add(R.id.fragment_common_container_view, FragmentCommon.class, null)
|
||||||
// .commit();
|
.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -58,6 +63,15 @@ public class MainActivity2 extends AppCompatActivity {
|
|||||||
return new FragmentOsdAlg();
|
return new FragmentOsdAlg();
|
||||||
case 1:
|
case 1:
|
||||||
return new FragmentHrAlg();
|
return new FragmentHrAlg();
|
||||||
|
case 2:
|
||||||
|
return new FragmentMlAlg();
|
||||||
|
case 3:
|
||||||
|
return new FragmentWebServer();
|
||||||
|
case 4:
|
||||||
|
return new FragmentDataSharing();
|
||||||
|
case 5:
|
||||||
|
return new FragmentSystem();
|
||||||
|
|
||||||
default:
|
default:
|
||||||
Log.e(TAG,"createFragment() - invalid Position "+position);
|
Log.e(TAG,"createFragment() - invalid Position "+position);
|
||||||
return null;
|
return null;
|
||||||
@@ -66,7 +80,7 @@ public class MainActivity2 extends AppCompatActivity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getItemCount() {
|
public int getItemCount() {
|
||||||
return 2;
|
return 6;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -517,7 +517,7 @@ public class SdServer extends Service implements SdDataReceiver {
|
|||||||
soundUri = null;
|
soundUri = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
Intent i = new Intent(getApplicationContext(), MainActivity.class);
|
Intent i = new Intent(getApplicationContext(), MainActivity2.class);
|
||||||
i.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
i.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
||||||
PendingIntent contentIntent =
|
PendingIntent contentIntent =
|
||||||
PendingIntent.getActivity(this,
|
PendingIntent.getActivity(this,
|
||||||
@@ -569,7 +569,7 @@ public class SdServer extends Service implements SdDataReceiver {
|
|||||||
mUtil.writeToSysLogFile("SdServer.showMainActivity - Activity is already shown on top, not doing anything");
|
mUtil.writeToSysLogFile("SdServer.showMainActivity - Activity is already shown on top, not doing anything");
|
||||||
} else {
|
} else {
|
||||||
Log.i(TAG, "showMainActivity(): Showing Main Activity");
|
Log.i(TAG, "showMainActivity(): Showing Main Activity");
|
||||||
Intent i = new Intent(getApplicationContext(), MainActivity.class);
|
Intent i = new Intent(getApplicationContext(), MainActivity2.class);
|
||||||
i.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT | Intent.FLAG_ACTIVITY_NEW_TASK);
|
i.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT | Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
this.startActivity(i);
|
this.startActivity(i);
|
||||||
}
|
}
|
||||||
@@ -1733,7 +1733,7 @@ public class SdServer extends Service implements SdDataReceiver {
|
|||||||
iconId = R.drawable.datasharing_fault_24x24;
|
iconId = R.drawable.datasharing_fault_24x24;
|
||||||
titleStr = getString(R.string.datasharing_notification_title);
|
titleStr = getString(R.string.datasharing_notification_title);
|
||||||
|
|
||||||
Intent i = new Intent(getApplicationContext(), MainActivity.class);
|
Intent i = new Intent(getApplicationContext(), MainActivity2.class);
|
||||||
i.putExtra("action", "showDataSharingDialog");
|
i.putExtra("action", "showDataSharingDialog");
|
||||||
i.setAction("showDataSharingDialog");
|
i.setAction("showDataSharingDialog");
|
||||||
i.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
i.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
||||||
|
|||||||
@@ -1,21 +1,26 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?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"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:id="@+id/fragment_container_view"
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/versionTv"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
/>
|
android:text="@string/app_name" />
|
||||||
-->
|
|
||||||
|
|
||||||
|
<androidx.fragment.app.FragmentContainerView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:id="@+id/fragment_common_container_view"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
|
||||||
<androidx.viewpager2.widget.ViewPager2
|
<androidx.viewpager2.widget.ViewPager2
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:id="@+id/fragment_pager"
|
android:id="@+id/fragment_pager"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent" />
|
android:layout_height="match_parent" />
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</LinearLayout>
|
||||||
139
app/src/main/res/layout/fragment_common.xml
Normal file
139
app/src/main/res/layout/fragment_common.xml
Normal file
@@ -0,0 +1,139 @@
|
|||||||
|
<?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 -->
|
||||||
|
<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" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="OpenSeizureDetector Common Components Status" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/versionTv"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/app_name" />
|
||||||
|
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/statusLayout"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/serverStatusTv"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:text="---" />
|
||||||
|
|
||||||
|
<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: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="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>
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:baselineAligned="false">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/acceptAlarmButton"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="@string/AcceptAlarmBtnTxt" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/cancelAudibleButton"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="@string/CancelAudibleButtonTxt" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/manualAlarmButton"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:backgroundTint="#ff0000"
|
||||||
|
android:text="@string/ManualAlarmBtnTxt" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||||
|
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
28
app/src/main/res/layout/fragment_data_sharing.xml
Normal file
28
app/src/main/res/layout/fragment_data_sharing.xml
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
<?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 -->
|
||||||
|
<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_data_sharing_tv1"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Fragment_Data_Sharing" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Data Sharing Status" />
|
||||||
|
|
||||||
|
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||||
|
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
28
app/src/main/res/layout/fragment_ml_alg.xml
Normal file
28
app/src/main/res/layout/fragment_ml_alg.xml
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
<?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 -->
|
||||||
|
<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_ml_alg_tv1"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Fragment_MlAlg" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Machine Learning Algorithm Status" />
|
||||||
|
|
||||||
|
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||||
|
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
46
app/src/main/res/layout/fragment_system.xml
Normal file
46
app/src/main/res/layout/fragment_system.xml
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<FrameLayout 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=".FragmentSdDataViewer">
|
||||||
|
|
||||||
|
<!-- 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" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="OpenSeizureDetector System Status" />
|
||||||
|
|
||||||
|
<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" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Edit Settings" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||||
|
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
28
app/src/main/res/layout/fragment_web_server.xml
Normal file
28
app/src/main/res/layout/fragment_web_server.xml
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
<?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 -->
|
||||||
|
<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_web_server_tv1"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Fragment_WebServer" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Web Server Status" />
|
||||||
|
|
||||||
|
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||||
|
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
Reference in New Issue
Block a user