diff --git a/UI/.idea/.name b/UI/.idea/.name deleted file mode 100644 index fe0515136..000000000 --- a/UI/.idea/.name +++ /dev/null @@ -1 +0,0 @@ -Capstone \ No newline at end of file diff --git a/UI/.idea/compiler.xml b/UI/.idea/compiler.xml deleted file mode 100644 index 61a9130cd..000000000 --- a/UI/.idea/compiler.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/UI/.idea/gradle.xml b/UI/.idea/gradle.xml index 9bba60dad..d291b3d7c 100644 --- a/UI/.idea/gradle.xml +++ b/UI/.idea/gradle.xml @@ -1,20 +1,15 @@ - diff --git a/UI/.idea/jarRepositories.xml b/UI/.idea/jarRepositories.xml deleted file mode 100644 index a5f05cd8c..000000000 --- a/UI/.idea/jarRepositories.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/UI/.idea/misc.xml b/UI/.idea/misc.xml index d5d35ec44..37a750962 100644 --- a/UI/.idea/misc.xml +++ b/UI/.idea/misc.xml @@ -1,6 +1,6 @@ - + diff --git a/UI/.idea/vcs.xml b/UI/.idea/vcs.xml index 288b36b1e..94a25f7f4 100644 --- a/UI/.idea/vcs.xml +++ b/UI/.idea/vcs.xml @@ -1,7 +1,6 @@ - \ No newline at end of file diff --git a/UI/app/src/main/AndroidManifest.xml b/UI/app/src/main/AndroidManifest.xml index 059cfcafd..3c57a8e95 100644 --- a/UI/app/src/main/AndroidManifest.xml +++ b/UI/app/src/main/AndroidManifest.xml @@ -11,6 +11,7 @@ android:label="Keyless Auto" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" + android:usesCleartextTraffic="true" android:theme="@style/AppTheme"> diff --git a/UI/app/src/main/java/com/example/capstone/About.java b/UI/app/src/main/java/com/example/capstone/About.java index e7eeb3eb3..90fda0489 100644 --- a/UI/app/src/main/java/com/example/capstone/About.java +++ b/UI/app/src/main/java/com/example/capstone/About.java @@ -9,9 +9,12 @@ import android.view.View; import android.widget.TextView; import com.google.firebase.auth.FirebaseAuth; +import com.google.firebase.database.DatabaseReference; +import com.google.firebase.database.FirebaseDatabase; public class About extends AppCompatActivity { FirebaseAuth fAuth; + DatabaseReference reff; private TextView web; @Override protected void onCreate(Bundle savedInstanceState) { @@ -32,6 +35,11 @@ public class About extends AppCompatActivity { public void logout(View view){ fAuth.signOut(); + reff = FirebaseDatabase.getInstance().getReference().child("signal"); + reff.child("1").child("camera").setValue("off"); + reff.child("1").child("power").setValue("off"); + reff.child("1").child("motor").setValue("off"); + reff.child("1").child("alarm").setValue("off"); startActivity(new Intent(getApplicationContext(), Login.class)); finish(); } diff --git a/UI/app/src/main/java/com/example/capstone/Apps.java b/UI/app/src/main/java/com/example/capstone/Apps.java index 7de9c793e..f26e85d44 100644 --- a/UI/app/src/main/java/com/example/capstone/Apps.java +++ b/UI/app/src/main/java/com/example/capstone/Apps.java @@ -9,10 +9,13 @@ import android.widget.Button; import android.widget.ImageButton; import com.google.firebase.auth.FirebaseAuth; +import com.google.firebase.database.DatabaseReference; +import com.google.firebase.database.FirebaseDatabase; public class Apps extends AppCompatActivity { FirebaseAuth fAuth; Button remote, thief; + DatabaseReference reff; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -38,6 +41,11 @@ public class Apps extends AppCompatActivity { public void logout(View view){ fAuth.signOut(); + reff = FirebaseDatabase.getInstance().getReference().child("signal"); + reff.child("1").child("camera").setValue("off"); + reff.child("1").child("power").setValue("off"); + reff.child("1").child("motor").setValue("off"); + reff.child("1").child("alarm").setValue("off"); startActivity(new Intent(getApplicationContext(), Login.class)); finish(); } diff --git a/UI/app/src/main/java/com/example/capstone/Drivers.java b/UI/app/src/main/java/com/example/capstone/Drivers.java index 5c56fbd6e..76aeea71b 100644 --- a/UI/app/src/main/java/com/example/capstone/Drivers.java +++ b/UI/app/src/main/java/com/example/capstone/Drivers.java @@ -168,6 +168,11 @@ public class Drivers extends AppCompatActivity{ public void logout(View view){ fAuth.signOut(); + reff = FirebaseDatabase.getInstance().getReference().child("signal"); + reff.child("1").child("camera").setValue("off"); + reff.child("1").child("power").setValue("off"); + reff.child("1").child("motor").setValue("off"); + reff.child("1").child("alarm").setValue("off"); startActivity(new Intent(getApplicationContext(), Login.class)); finish(); } diff --git a/UI/app/src/main/java/com/example/capstone/Enrollment.java b/UI/app/src/main/java/com/example/capstone/Enrollment.java index 77a797f18..592fad977 100644 --- a/UI/app/src/main/java/com/example/capstone/Enrollment.java +++ b/UI/app/src/main/java/com/example/capstone/Enrollment.java @@ -23,6 +23,8 @@ import android.widget.Toast; import com.google.android.gms.tasks.OnFailureListener; import com.google.android.gms.tasks.OnSuccessListener; import com.google.firebase.auth.FirebaseAuth; +import com.google.firebase.database.DatabaseReference; +import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.storage.FirebaseStorage; import com.google.firebase.storage.StorageReference; import com.google.firebase.storage.UploadTask; @@ -40,6 +42,7 @@ public class Enrollment extends AppCompatActivity { ImageView preview; Button upload; Uri imageUri; + DatabaseReference reff; @Override protected void onCreate(Bundle savedInstanceState) { @@ -77,6 +80,11 @@ public class Enrollment extends AppCompatActivity { public void logout(View view){ fAuth.signOut(); + reff = FirebaseDatabase.getInstance().getReference().child("signal"); + reff.child("1").child("camera").setValue("off"); + reff.child("1").child("power").setValue("off"); + reff.child("1").child("motor").setValue("off"); + reff.child("1").child("alarm").setValue("off"); startActivity(new Intent(getApplicationContext(), Login.class)); finish(); } diff --git a/UI/app/src/main/java/com/example/capstone/Login.java b/UI/app/src/main/java/com/example/capstone/Login.java index 168b53683..9feced19d 100644 --- a/UI/app/src/main/java/com/example/capstone/Login.java +++ b/UI/app/src/main/java/com/example/capstone/Login.java @@ -21,6 +21,7 @@ import com.google.android.gms.tasks.Task; import com.google.firebase.auth.AuthResult; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.auth.FirebaseUser; +import com.google.firebase.database.DatabaseReference; public class Login extends AppCompatActivity { private EditText email, password; @@ -28,6 +29,7 @@ public class Login extends AppCompatActivity { private TextView account, pass; FirebaseAuth fAuth; private String em, pw; + DatabaseReference reff; @Override protected void onCreate(Bundle savedInstanceState) { diff --git a/UI/app/src/main/java/com/example/capstone/Password.java b/UI/app/src/main/java/com/example/capstone/Password.java index ff65eaa78..0d2dc85e9 100644 --- a/UI/app/src/main/java/com/example/capstone/Password.java +++ b/UI/app/src/main/java/com/example/capstone/Password.java @@ -15,11 +15,14 @@ import android.widget.Toast; import com.google.android.gms.tasks.OnFailureListener; import com.google.android.gms.tasks.OnSuccessListener; import com.google.firebase.auth.FirebaseAuth; +import com.google.firebase.database.DatabaseReference; +import com.google.firebase.database.FirebaseDatabase; public class Password extends AppCompatActivity { FirebaseAuth fAuth; private Button reset, backb; private EditText email; + DatabaseReference reff; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -57,6 +60,11 @@ public class Password extends AppCompatActivity { public void logout(View view){ fAuth.signOut(); + reff = FirebaseDatabase.getInstance().getReference().child("signal"); + reff.child("1").child("camera").setValue("off"); + reff.child("1").child("power").setValue("off"); + reff.child("1").child("motor").setValue("off"); + reff.child("1").child("alarm").setValue("off"); startActivity(new Intent(getApplicationContext(), Login.class)); finish(); } diff --git a/UI/app/src/main/java/com/example/capstone/Settings.java b/UI/app/src/main/java/com/example/capstone/Settings.java index 8c4be7834..aa05cbac6 100644 --- a/UI/app/src/main/java/com/example/capstone/Settings.java +++ b/UI/app/src/main/java/com/example/capstone/Settings.java @@ -9,10 +9,13 @@ import android.widget.Button; import android.widget.EditText; import com.google.firebase.auth.FirebaseAuth; +import com.google.firebase.database.DatabaseReference; +import com.google.firebase.database.FirebaseDatabase; public class Settings extends AppCompatActivity { FirebaseAuth fAuth; private Button dri, enr, sup, pas, abu; + DatabaseReference reff; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -64,6 +67,11 @@ public class Settings extends AppCompatActivity { public void logout(View view){ fAuth.signOut(); + reff = FirebaseDatabase.getInstance().getReference().child("signal"); + reff.child("1").child("camera").setValue("off"); + reff.child("1").child("power").setValue("off"); + reff.child("1").child("motor").setValue("off"); + reff.child("1").child("alarm").setValue("off"); startActivity(new Intent(getApplicationContext(), Login.class)); finish(); } diff --git a/UI/app/src/main/java/com/example/capstone/Support.java b/UI/app/src/main/java/com/example/capstone/Support.java index 6544f7d7c..47a21eea7 100644 --- a/UI/app/src/main/java/com/example/capstone/Support.java +++ b/UI/app/src/main/java/com/example/capstone/Support.java @@ -7,9 +7,12 @@ import android.os.Bundle; import android.view.View; import com.google.firebase.auth.FirebaseAuth; +import com.google.firebase.database.DatabaseReference; +import com.google.firebase.database.FirebaseDatabase; public class Support extends AppCompatActivity { FirebaseAuth fAuth; + DatabaseReference reff; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -20,6 +23,11 @@ public class Support extends AppCompatActivity { public void logout(View view){ fAuth.signOut(); + reff = FirebaseDatabase.getInstance().getReference().child("signal"); + reff.child("1").child("camera").setValue("off"); + reff.child("1").child("power").setValue("off"); + reff.child("1").child("motor").setValue("off"); + reff.child("1").child("alarm").setValue("off"); startActivity(new Intent(getApplicationContext(), Login.class)); finish(); } diff --git a/UI/app/src/main/java/com/example/capstone/VThiefPictures.java b/UI/app/src/main/java/com/example/capstone/VThiefPictures.java index cdae75159..f18a2db4a 100644 --- a/UI/app/src/main/java/com/example/capstone/VThiefPictures.java +++ b/UI/app/src/main/java/com/example/capstone/VThiefPictures.java @@ -19,6 +19,8 @@ import android.widget.ImageView; import com.google.android.gms.tasks.OnFailureListener; import com.google.android.gms.tasks.OnSuccessListener; import com.google.firebase.auth.FirebaseAuth; +import com.google.firebase.database.DatabaseReference; +import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.storage.FileDownloadTask; import com.google.firebase.storage.FirebaseStorage; import com.google.firebase.storage.StorageReference; @@ -32,6 +34,7 @@ public class VThiefPictures extends AppCompatActivity { private ImageView mImageView; private FirebaseStorage storage=FirebaseStorage.getInstance(); ImageView img1, img2, img3; + DatabaseReference reff; @Override protected void onCreate(Bundle savedInstanceState) { @@ -79,6 +82,11 @@ public class VThiefPictures extends AppCompatActivity { public void logout(View view){ fAuth.signOut(); + reff = FirebaseDatabase.getInstance().getReference().child("signal"); + reff.child("1").child("camera").setValue("off"); + reff.child("1").child("power").setValue("off"); + reff.child("1").child("motor").setValue("off"); + reff.child("1").child("alarm").setValue("off"); startActivity(new Intent(getApplicationContext(), Login.class)); finish(); } diff --git a/UI/app/src/main/java/com/example/capstone/add.java b/UI/app/src/main/java/com/example/capstone/add.java index aba41fb73..b472d8194 100644 --- a/UI/app/src/main/java/com/example/capstone/add.java +++ b/UI/app/src/main/java/com/example/capstone/add.java @@ -158,6 +158,11 @@ public class add extends AppCompatActivity { public void logout(View view){ fAuth.signOut(); + reff = FirebaseDatabase.getInstance().getReference().child("signal"); + reff.child("1").child("camera").setValue("off"); + reff.child("1").child("power").setValue("off"); + reff.child("1").child("motor").setValue("off"); + reff.child("1").child("alarm").setValue("off"); startActivity(new Intent(getApplicationContext(), Login.class)); finish(); } diff --git a/UI/app/src/main/java/com/example/capstone/addDriver.java b/UI/app/src/main/java/com/example/capstone/addDriver.java index 106e37ad6..a70698aba 100644 --- a/UI/app/src/main/java/com/example/capstone/addDriver.java +++ b/UI/app/src/main/java/com/example/capstone/addDriver.java @@ -13,10 +13,12 @@ import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AppCompatDialogFragment; import com.google.firebase.auth.FirebaseAuth; +import com.google.firebase.database.DatabaseReference; public class addDriver extends AppCompatDialogFragment { private EditText fn, ln, ph, em; private addDriverListener listener; + DatabaseReference reff; @Override public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); diff --git a/UI/app/src/main/java/com/example/capstone/homepage.java b/UI/app/src/main/java/com/example/capstone/homepage.java index ee2ca9be9..694731011 100644 --- a/UI/app/src/main/java/com/example/capstone/homepage.java +++ b/UI/app/src/main/java/com/example/capstone/homepage.java @@ -109,6 +109,11 @@ public class homepage extends AppCompatActivity { public void logout(View view){ fAuth.signOut(); + reff = FirebaseDatabase.getInstance().getReference().child("signal"); + reff.child("1").child("camera").setValue("off"); + reff.child("1").child("power").setValue("off"); + reff.child("1").child("motor").setValue("off"); + reff.child("1").child("alarm").setValue("off"); startActivity(new Intent(getApplicationContext(), Login.class)); finish(); } diff --git a/UI/app/src/main/java/com/example/capstone/remotecamera.java b/UI/app/src/main/java/com/example/capstone/remotecamera.java index 92a62f31d..1201d8f23 100644 --- a/UI/app/src/main/java/com/example/capstone/remotecamera.java +++ b/UI/app/src/main/java/com/example/capstone/remotecamera.java @@ -8,8 +8,11 @@ import android.media.MediaPlayer; import android.net.Uri; import android.os.Bundle; import android.view.View; +import android.webkit.WebView; +import android.webkit.WebViewClient; import android.widget.ImageButton; import android.widget.ImageView; +import android.widget.MediaController; import android.widget.VideoView; import com.google.firebase.auth.FirebaseAuth; @@ -18,64 +21,47 @@ import com.google.firebase.database.FirebaseDatabase; public class remotecamera extends AppCompatActivity { FirebaseAuth fAuth; - ProgressDialog mDialog; - VideoView videoView; + WebView videoView; ImageButton btnPlayPause; DatabaseReference reff; - String videoURL = "http://llycanada.51vip.biz:15000"; + int check = 0; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_remotecamera); fAuth = FirebaseAuth.getInstance(); - videoView = (VideoView)findViewById(R.id.remotecameravideo); + videoView = (WebView) findViewById(R.id.remotecameravideo); btnPlayPause = (ImageButton)findViewById(R.id.btn_play_pause); reff = FirebaseDatabase.getInstance().getReference().child("signal"); btnPlayPause.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - reff.child("1").child("camera").setValue("on"); - mDialog = new ProgressDialog(remotecamera.this); - mDialog.setMessage("Please wait..."); - mDialog.setCanceledOnTouchOutside(true); - mDialog.show(); - - try{ - if(!videoView.isPlaying()) { - Uri uri = Uri.parse(videoURL); - videoView.setVideoURI(uri); - videoView.setOnCompletionListener(new MediaPlayer.OnCompletionListener() { - @Override - public void onCompletion(MediaPlayer mp) { - btnPlayPause.setImageResource(R.drawable.ic_play); - } - }); - } else { - videoView.pause(); - btnPlayPause.setImageResource(R.drawable.ic_play); - } - }catch (Exception ex){ - + if (check == 0) { + reff.child("1").child("camera").setValue("on"); + videoView.setWebViewClient(new WebViewClient()); + videoView.loadUrl("http://lileyao1998.synology.me:15000"); + videoView.getSettings().setLoadWithOverviewMode(true); + videoView.getSettings().setUseWideViewPort(true); + btnPlayPause.setImageResource(R.drawable.ic_play); + check = 1; + } else { + btnPlayPause.setImageResource(R.drawable.ic_pause); + reff.child("1").child("camera").setValue("off"); + check = 0; } - videoView.requestFocus(); - videoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() { - @Override - public void onPrepared(MediaPlayer mp) { - mDialog.dismiss(); - mp.setLooping(true); - videoView.start(); - btnPlayPause.setImageResource(R.drawable.ic_pause); - reff.child("1").child("camera").setValue("off"); - } - }); } }); } public void logout(View view){ fAuth.signOut(); + reff = FirebaseDatabase.getInstance().getReference().child("signal"); + reff.child("1").child("camera").setValue("off"); + reff.child("1").child("power").setValue("off"); + reff.child("1").child("motor").setValue("off"); + reff.child("1").child("alarm").setValue("off"); startActivity(new Intent(getApplicationContext(), Login.class)); finish(); } @@ -83,4 +69,5 @@ public class remotecamera extends AppCompatActivity { public void back(View view){ startActivity(new Intent(getApplicationContext(), homepage.class)); } + } diff --git a/UI/app/src/main/java/com/example/capstone/update.java b/UI/app/src/main/java/com/example/capstone/update.java index 1cc4b3ee2..3b334b993 100644 --- a/UI/app/src/main/java/com/example/capstone/update.java +++ b/UI/app/src/main/java/com/example/capstone/update.java @@ -146,6 +146,11 @@ public class update extends AppCompatActivity { public void logout(View view){ fAuth.signOut(); + reff = FirebaseDatabase.getInstance().getReference().child("signal"); + reff.child("1").child("camera").setValue("off"); + reff.child("1").child("power").setValue("off"); + reff.child("1").child("motor").setValue("off"); + reff.child("1").child("alarm").setValue("off"); startActivity(new Intent(getApplicationContext(), Login.class)); finish(); } diff --git a/UI/app/src/main/res/layout/activity_remotecamera.xml b/UI/app/src/main/res/layout/activity_remotecamera.xml index 627999e79..67c2c22a4 100644 --- a/UI/app/src/main/res/layout/activity_remotecamera.xml +++ b/UI/app/src/main/res/layout/activity_remotecamera.xml @@ -26,7 +26,7 @@ app:layout_constraintStart_toStartOf="@id/guideline" app:layout_constraintEnd_toEndOf="@id/guideline1" /> -