diff --git a/examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/CheckInActivity.java b/examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/CheckInActivity.java index 4dd5c54..8cf2959 100644 --- a/examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/CheckInActivity.java +++ b/examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/CheckInActivity.java @@ -4,9 +4,12 @@ import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; +import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.ImageView; +import android.widget.PopupMenu; +import android.widget.Toast; import ru.visionlab.femdemo.login.LoginActivity; import ru.visionlab.femdemo.register.RegisterActivityNew; @@ -14,6 +17,7 @@ import ru.visionlab.femdemo.register.RegisterActivityNew; public class CheckInActivity extends AppCompatActivity { ImageView logout; + ImageView menu; @Override protected void onCreate(Bundle savedInstanceState) { @@ -29,5 +33,24 @@ public class CheckInActivity extends AppCompatActivity { startActivity(intent); } }); + + menu = findViewById(R.id.menu); + menu.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + PopupMenu popupMenu = new PopupMenu(CheckInActivity.this, menu); + popupMenu.getMenuInflater().inflate(R.menu.navigation_menu, popupMenu.getMenu()); + popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() { + @Override + public boolean onMenuItemClick(MenuItem menuItem) { + // Toast message on menu item clicked + Toast.makeText(CheckInActivity.this, "You Clicked " + menuItem.getTitle(), Toast.LENGTH_SHORT).show(); + return true; + } + }); + // Showing the popup menu + popupMenu.show(); + } + }); } } \ No newline at end of file diff --git a/examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/login/LoginActivity.java b/examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/login/LoginActivity.java index 8b9ff12..7587df0 100644 --- a/examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/login/LoginActivity.java +++ b/examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/login/LoginActivity.java @@ -455,4 +455,9 @@ public class LoginActivity extends BaseActivity { } } + + @Override + public void onBackPressed () { + + } } \ No newline at end of file diff --git a/examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/login/LoginActivityNew.java b/examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/login/LoginActivityNew.java index 3a2a600..fda4370 100644 --- a/examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/login/LoginActivityNew.java +++ b/examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/login/LoginActivityNew.java @@ -6,7 +6,9 @@ import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; +import android.widget.EditText; import android.widget.ImageButton; +import android.widget.Toast; import ru.visionlab.femdemo.CheckInActivity; import ru.visionlab.femdemo.R; @@ -18,18 +20,37 @@ public class LoginActivityNew extends AppCompatActivity { ImageButton back; + EditText edt_empId,edt_pass; + String empId = "", pass = ""; + + boolean isAllFieldsChecked = false; + + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_login_new); + edt_empId = findViewById(R.id.edt_empId); + edt_pass = findViewById(R.id.edt_pass); + + empId = edt_empId.getText().toString().trim(); + pass = edt_pass.getText().toString().trim(); + + System.out.println("value of emp and pass " + empId + " " + pass); + btnSignin = findViewById(R.id.btnSignin); btnSignin.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - Intent intent = new Intent(LoginActivityNew.this, CheckInActivity.class); - startActivity(intent); + + isAllFieldsChecked = CheckAllFields(); + if(isAllFieldsChecked) { + Intent intent = new Intent(LoginActivityNew.this, CheckInActivity.class); + startActivity(intent); + + } } }); @@ -41,5 +62,22 @@ public class LoginActivityNew extends AppCompatActivity { startActivity(intent); } }); + + + } + + + private boolean CheckAllFields() { + if (edt_empId.length() == 0) { + edt_empId.setError("This field is required"); + return false; + } + + if (edt_pass.length() == 0) { + edt_pass.setError("This field is required"); + return false; + } + // after all validation return true. + return true; } } \ No newline at end of file diff --git a/examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/register/RegisterActivityNew.java b/examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/register/RegisterActivityNew.java index 199417b..571edd8 100644 --- a/examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/register/RegisterActivityNew.java +++ b/examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/register/RegisterActivityNew.java @@ -5,20 +5,46 @@ import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; import android.view.View; +import android.widget.Button; +import android.widget.EditText; import android.widget.ImageButton; +import ru.visionlab.femdemo.CheckInActivity; import ru.visionlab.femdemo.R; import ru.visionlab.femdemo.login.LoginActivity; +import ru.visionlab.femdemo.login.LoginActivityNew; public class RegisterActivityNew extends AppCompatActivity { ImageButton back_img; + EditText edt_comp,edt_emp,edt_otp; + + boolean isAllFieldsChecked = false; + + Button verifynproceed; + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_register_new); + edt_comp = findViewById(R.id.edt_comp); + edt_emp = findViewById(R.id.edt_emp); + edt_otp = findViewById(R.id.edt_otp); + + verifynproceed = findViewById(R.id.verifynproceed); + verifynproceed.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + isAllFieldsChecked = CheckAllFields(); + if(isAllFieldsChecked) { + + + } + } + }); + back_img = findViewById(R.id.back_img); back_img.setOnClickListener(new View.OnClickListener() { @Override @@ -28,4 +54,23 @@ public class RegisterActivityNew extends AppCompatActivity { } }); } + + private boolean CheckAllFields() { + if (edt_comp.length() == 0) { + edt_comp.setError("This field is required"); + return false; + } + + if (edt_emp.length() == 0) { + edt_emp.setError("This field is required"); + return false; + } + + if (edt_otp.length() == 0) { + edt_otp.setError("This field is required"); + return false; + } + // after all validation return true. + return true; + } } \ No newline at end of file diff --git a/examples/example_bestshot/example/app/src/main/res/drawable/andrew.png b/examples/example_bestshot/example/app/src/main/res/drawable/andrew.png new file mode 100644 index 0000000..c1f35fa Binary files /dev/null and b/examples/example_bestshot/example/app/src/main/res/drawable/andrew.png differ diff --git a/examples/example_bestshot/example/app/src/main/res/drawable/clear.xml b/examples/example_bestshot/example/app/src/main/res/drawable/clear.xml new file mode 100644 index 0000000..fef02df --- /dev/null +++ b/examples/example_bestshot/example/app/src/main/res/drawable/clear.xml @@ -0,0 +1,5 @@ + + + diff --git a/examples/example_bestshot/example/app/src/main/res/drawable/home.xml b/examples/example_bestshot/example/app/src/main/res/drawable/home.xml new file mode 100644 index 0000000..d8194f7 --- /dev/null +++ b/examples/example_bestshot/example/app/src/main/res/drawable/home.xml @@ -0,0 +1,5 @@ + + + diff --git a/examples/example_bestshot/example/app/src/main/res/layout/activity_checkin.xml b/examples/example_bestshot/example/app/src/main/res/layout/activity_checkin.xml index cbac271..c1d6a27 100644 --- a/examples/example_bestshot/example/app/src/main/res/layout/activity_checkin.xml +++ b/examples/example_bestshot/example/app/src/main/res/layout/activity_checkin.xml @@ -10,6 +10,7 @@ android:padding="15dp"> - + android:icon="@drawable/otp" + android:title="Home" + app:showAsAction="always" /> + android:id="@+id/profile" + android:icon="@drawable/lock" + android:title="Profile" + /> +--> + + + android:id="@+id/overflowMenu" + android:icon="@drawable/phone" + android:title="Menu" + app:showAsAction="always"> + + + + + + + + \ No newline at end of file