Skip to content
Snippets Groups Projects
Commit c4b4514f authored by viveksvdy2014's avatar viveksvdy2014
Browse files

Made OIN Accepting Automatic

''
parent dc9dc3ae
No related branches found
No related tags found
No related merge requests found
...@@ -24,14 +24,15 @@ public class confirmationScreen extends AppCompatActivity { ...@@ -24,14 +24,15 @@ public class confirmationScreen extends AppCompatActivity {
public static String file1 = "MyPREFERENCES"; public static String file1 = "MyPREFERENCES";
public static String file2 = "PREFERENCES"; public static String file2 = "PREFERENCES";
public static String file3 = "COUNT"; public static String file3 = "COUNT";
Handler handler; Handler handler,handler2;
Intent alarmIntent ; Intent alarmIntent ;
Runnable run; Runnable run,run2;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_confirmation_screen); setContentView(R.layout.activity_confirmation_screen);
handler=new Handler(); handler=new Handler();
handler2 = new Handler();
alarmIntent = new Intent(confirmationScreen.this,alarmService.class); alarmIntent = new Intent(confirmationScreen.this,alarmService.class);
textView= (TextView)findViewById(R.id.countDown); textView= (TextView)findViewById(R.id.countDown);
editText=(EditText)findViewById(R.id.editTextPIN); editText=(EditText)findViewById(R.id.editTextPIN);
...@@ -51,7 +52,27 @@ public class confirmationScreen extends AppCompatActivity { ...@@ -51,7 +52,27 @@ public class confirmationScreen extends AppCompatActivity {
handler.postDelayed(this,1000); handler.postDelayed(this,1000);
} }
}; };
run2=new Runnable() {
@Override
public void run() {
if((!editText.getText().toString().equals("2020"))&&textView.getText().toString().equals("0")) {
distressCall();
}
else if(editText.getText().toString().equals("2020")){
handler.removeCallbacks(run);
handler2.removeCallbacks(this);
Toast.makeText(confirmationScreen.this, "Distress Calls Cancelled!", Toast.LENGTH_SHORT).show();
Intent main = new Intent(confirmationScreen.this,MainActivity.class);
stopService(alarmIntent);
startActivity(main);
}
else if ((!editText.getText().toString().equals("2020")))
handler2.post(this);
}
};
handler2.post(run2);
handler.post(run); handler.post(run);
} }
public void onCancel(View view){ public void onCancel(View view){
......
...@@ -49,20 +49,8 @@ ...@@ -49,20 +49,8 @@
android:textStyle="normal|bold" android:textStyle="normal|bold"
android:textColor="@android:color/holo_red_dark" /> android:textColor="@android:color/holo_red_dark" />
<Button
android:text="CANCEL"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:id="@+id/buttonCANCEL"
android:layout_below="@+id/editTextPIN"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
style="@android:style/Widget.Holo.Button"
android:onClick="onCancel" />
<TextView <TextView
android:text="If this is a FALSEALARM OR ACCIDENT, please ENTER THE PIN AND press CANCEL!" android:text="If this is a FALSEALARM OR ACCIDENT, please ENTER THE PIN to CANCEL!"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@+id/textView3" android:id="@+id/textView3"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment