diff --git a/.gitattributes b/.gitattributes
deleted file mode 100644
index dfe0770..0000000
--- a/.gitattributes
+++ /dev/null
@@ -1,2 +0,0 @@
-# Auto detect text files and perform LF normalization
-* text=auto
diff --git a/.idea/.gitignore b/.idea/.gitignore
deleted file mode 100644
index 26d3352..0000000
--- a/.idea/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-# Default ignored files
-/shelf/
-/workspace.xml
diff --git a/.idea/deploymentTargetDropDown.xml b/.idea/deploymentTargetDropDown.xml
index b60c4cf..c4f7daf 100644
--- a/.idea/deploymentTargetDropDown.xml
+++ b/.idea/deploymentTargetDropDown.xml
@@ -12,6 +12,6 @@
-
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index af1c49f..95c4741 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -1,52 +1,44 @@
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
index 139f31e..94a25f7 100644
--- a/.idea/vcs.xml
+++ b/.idea/vcs.xml
@@ -2,6 +2,5 @@
-
\ No newline at end of file
diff --git a/README.md b/README.md
deleted file mode 100644
index 066a910..0000000
--- a/README.md
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/app/build.gradle b/app/build.gradle
index 118cdd0..0f35ed5 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -7,7 +7,7 @@ android {
defaultConfig {
applicationId "appcom.example.regsplashscreen"
- minSdkVersion 23
+ minSdkVersion 25
targetSdkVersion 31
versionCode 1
versionName "1.0"
@@ -33,16 +33,16 @@ dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
- implementation 'com.google.android.material:material:1.7.0-alpha01'
+ implementation 'com.google.android.material:material:1.6.0-alpha02'
// retrofit, gson
implementation 'com.squareup.picasso:picasso:2.5.2'
- implementation 'com.squareup.retrofit2:retrofit:2.9.0'
- implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
- implementation 'com.google.firebase:firebase-database:20.0.4'
- implementation 'com.google.firebase:firebase-auth:21.0.3'
+ implementation 'com.squareup.retrofit2:retrofit:2.1.0'
+ implementation 'com.squareup.retrofit2:converter-gson:2.1.0'
+ implementation 'com.google.firebase:firebase-database:20.0.3'
+ implementation 'com.google.firebase:firebase-auth:21.0.1'
implementation 'com.google.firebase:firebase-storage'
implementation platform('com.google.firebase:firebase-bom:29.0.4')
- testImplementation 'junit:junit:4.13.2'
+ testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
diff --git a/app/google-services.json b/app/google-services.json
index f9f81fa..13bf7cc 100644
--- a/app/google-services.json
+++ b/app/google-services.json
@@ -1,26 +1,36 @@
{
"project_info": {
- "project_number": "438081056179",
- "project_id": "reg-splashscreen",
- "storage_bucket": "reg-splashscreen.appspot.com"
+ "project_number": "254507971791",
+ "project_id": "reg-splashscreen-df5ab",
+ "storage_bucket": "reg-splashscreen-df5ab.appspot.com"
},
"client": [
{
"client_info": {
- "mobilesdk_app_id": "1:438081056179:android:675f2c259ca923e600afc6",
+ "mobilesdk_app_id": "1:254507971791:android:1d915699b89f85e1dfb3ba",
"android_client_info": {
"package_name": "appcom.example.regsplashscreen"
}
},
- "oauth_client": [],
+ "oauth_client": [
+ {
+ "client_id": "254507971791-8hijjjck12rrl3o9nhli79vjr581ibji.apps.googleusercontent.com",
+ "client_type": 3
+ }
+ ],
"api_key": [
{
- "current_key": "AIzaSyAVm8i7B41zEI30SNtuUW6iLkgIyMihYpQ"
+ "current_key": "AIzaSyDA-Xr4uHWZ0rJmawV_MYLpsNBIkM37ROA"
}
],
"services": {
"appinvite_service": {
- "other_platform_oauth_client": []
+ "other_platform_oauth_client": [
+ {
+ "client_id": "254507971791-8hijjjck12rrl3o9nhli79vjr581ibji.apps.googleusercontent.com",
+ "client_type": 3
+ }
+ ]
}
}
}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index e90baf9..2a973fb 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -9,9 +9,9 @@
@@ -27,15 +27,6 @@
-
-
-
\ No newline at end of file
diff --git a/app/src/main/ic_launcher_new_icon-playstore.png b/app/src/main/ic_launcher_new_icon-playstore.png
deleted file mode 100644
index c91a539..0000000
Binary files a/app/src/main/ic_launcher_new_icon-playstore.png and /dev/null differ
diff --git a/app/src/main/java/appcom/example/regsplashscreen/AdminScreenActivity.java b/app/src/main/java/appcom/example/regsplashscreen/AdminScreenActivity.java
index e6bd4e7..e6c2230 100644
--- a/app/src/main/java/appcom/example/regsplashscreen/AdminScreenActivity.java
+++ b/app/src/main/java/appcom/example/regsplashscreen/AdminScreenActivity.java
@@ -1,134 +1,134 @@
-package appcom.example.regsplashscreen;
-
-import android.app.ProgressDialog;
-import android.content.Context;
-import android.os.Bundle;
-import android.view.LayoutInflater;
-import android.widget.CompoundButton;
-import android.widget.LinearLayout;
-import android.widget.TextView;
-
-import androidx.annotation.NonNull;
-import androidx.appcompat.app.AppCompatActivity;
-import androidx.appcompat.widget.SwitchCompat;
-import androidx.cardview.widget.CardView;
-
-import com.google.firebase.database.DataSnapshot;
-import com.google.firebase.database.DatabaseError;
-import com.google.firebase.database.DatabaseReference;
-import com.google.firebase.database.FirebaseDatabase;
-import com.google.firebase.database.ValueEventListener;
-
-import appcom.example.regsplashscreen.model.User;
-
-public class AdminScreenActivity extends AppCompatActivity {
-
- private ProgressDialog progressDialog;
- private FirebaseDatabase mDatabase;
- private LinearLayout addInfoCardSectionLayout;
- private int viewTagCounter = 0;
- private CompoundButton.OnCheckedChangeListener listener;
-
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_admin_screen);
-
- addInfoCardSectionLayout = findViewById(R.id.as_view_info_card_section);
-
- //INITIALIZE PROGRESS DIALOG BOX
- progressDialog = new ProgressDialog(AdminScreenActivity.this);
- progressDialog.setTitle("Loading data");
- progressDialog.setMessage("Loading data");
- progressDialog.show();
-
- // FIREBASE DETAILS
- mDatabase = FirebaseDatabase.getInstance();
- DatabaseReference databaseReference = mDatabase.getReference().child("users");
-
- // LOAD DATA IN VIEWS
- databaseReference.addValueEventListener(new ValueEventListener() {
- @Override
- public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
- addInfoCardSectionLayout.removeAllViewsInLayout();
- for (DataSnapshot item : dataSnapshot.getChildren()) {
- User user = item.getValue(User.class);
- addUserInfoCard(user);
- }
- progressDialog.dismiss();
- }
-
- @Override
- public void onCancelled(@NonNull DatabaseError error) {
- progressDialog.dismiss();
- }
- });
-
- listener = (buttonView, isChecked) -> {
- String tagId = buttonView.getTag().toString();
- TextView tvUid = (TextView) addInfoCardSectionLayout.findViewWithTag(tagId.substring(0,4));
- String userId = tvUid.getText().toString();
- if (isChecked) {
- // The toggle is enabled
- if(tagId.endsWith("_ED")) {
- mDatabase.getReference().child("users").child(userId).child("userActive").setValue("Y");
- }
- else if(tagId.endsWith("_ADM")) {
- mDatabase.getReference().child("users").child(userId).child("userAdmin").setValue("Y");
- }
- } else {
- // The toggle is disabled
- if(tagId.endsWith("_ED")) {
- mDatabase.getReference().child("users").child(userId).child("userActive").setValue("N");
- }
- else if(tagId.endsWith("_ADM")) {
- mDatabase.getReference().child("users").child(userId).child("userAdmin").setValue("N");
- }
- }
- };
-
- }
-
- private void addUserInfoCard(User user) {
- // GENERATE DYNAMIC LAYOUT
- LayoutInflater layoutInflater = (LayoutInflater) getBaseContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
-
- // USE card_layout_add_info.xml TO CREATE LAYOUT
- CardView clasrCardView = (CardView) layoutInflater.inflate(R.layout.card_layout_admin_screen_row, null);
- TextView tvUserName = (TextView) clasrCardView.findViewById(R.id.clasr_tv_username);
- TextView tvUserId = (TextView) clasrCardView.findViewById(R.id.clasr_tv_userId);
- SwitchCompat userStateSwitchCompat = (SwitchCompat) clasrCardView.findViewById(R.id.clasr_enable_disable_switch);
- userStateSwitchCompat.setOnCheckedChangeListener(listener);
- SwitchCompat adminToggleSwitchCompat = (SwitchCompat) clasrCardView.findViewById(R.id.clasr_admin_toggle_switch);
- adminToggleSwitchCompat.setOnCheckedChangeListener(listener);
- if (null != user) {
- if (!user.getUserName().isEmpty()) {
- tvUserName.setText(user.getUserName());
- }
-
- if (!user.getUid().isEmpty()) {
- tvUserId.setText(user.getUid());
- }
- if (!user.getUserActive().isEmpty() && !user.getUserActive().equals("Y")) {
- userStateSwitchCompat.setOnCheckedChangeListener(null);
- userStateSwitchCompat.setChecked(false);
- userStateSwitchCompat.setOnCheckedChangeListener(listener);
- }
- if (!user.getUserAdmin().isEmpty() && !user.getUserAdmin().equals("N")) {
- adminToggleSwitchCompat.setOnCheckedChangeListener(null);
- adminToggleSwitchCompat.setChecked(true);
- adminToggleSwitchCompat.setOnCheckedChangeListener(listener);
- }
-
- // SETUP TAGS
- ++viewTagCounter;
- tvUserId.setTag("TAG"+viewTagCounter);
- tvUserName.setTag("TAG"+viewTagCounter);
- userStateSwitchCompat.setTag("TAG"+viewTagCounter+"_ED");
- adminToggleSwitchCompat.setTag("TAG"+viewTagCounter+"_ADM");
- // ADD CARD VIEW TO MAIN VIEW
- addInfoCardSectionLayout.addView(clasrCardView);
- }
- }
-}
+package appcom.example.regsplashscreen;
+
+import android.app.ProgressDialog;
+import android.content.Context;
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.widget.CompoundButton;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+
+import androidx.annotation.NonNull;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.appcompat.widget.SwitchCompat;
+import androidx.cardview.widget.CardView;
+
+import com.google.firebase.database.DataSnapshot;
+import com.google.firebase.database.DatabaseError;
+import com.google.firebase.database.DatabaseReference;
+import com.google.firebase.database.FirebaseDatabase;
+import com.google.firebase.database.ValueEventListener;
+
+import appcom.example.regsplashscreen.model.User;
+
+public class AdminScreenActivity extends AppCompatActivity {
+
+ private ProgressDialog progressDialog;
+ private FirebaseDatabase mDatabase;
+ private LinearLayout addInfoCardSectionLayout;
+ private int viewTagCounter = 0;
+ private CompoundButton.OnCheckedChangeListener listener;
+
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_admin_screen);
+
+ addInfoCardSectionLayout = findViewById(R.id.as_view_info_card_section);
+
+ //INITIALIZE PROGRESS DIALOG BOX
+ progressDialog = new ProgressDialog(AdminScreenActivity.this);
+ progressDialog.setTitle("Loading data");
+ progressDialog.setMessage("Loading data");
+ progressDialog.show();
+
+ // FIREBASE DETAILS
+ mDatabase = FirebaseDatabase.getInstance();
+ DatabaseReference databaseReference = mDatabase.getReference().child("users");
+
+ // LOAD DATA IN VIEWS
+ databaseReference.addValueEventListener(new ValueEventListener() {
+ @Override
+ public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
+ addInfoCardSectionLayout.removeAllViewsInLayout();
+ for (DataSnapshot item : dataSnapshot.getChildren()) {
+ User user = item.getValue(User.class);
+ addUserInfoCard(user);
+ }
+ progressDialog.dismiss();
+ }
+
+ @Override
+ public void onCancelled(@NonNull DatabaseError error) {
+ progressDialog.dismiss();
+ }
+ });
+
+ listener = (buttonView, isChecked) -> {
+ String tagId = buttonView.getTag().toString();
+ TextView tvUid = (TextView) addInfoCardSectionLayout.findViewWithTag(tagId.substring(0,4));
+ String userId = tvUid.getText().toString();
+ if (isChecked) {
+ // The toggle is enabled
+ if(tagId.endsWith("_ED")) {
+ mDatabase.getReference().child("users").child(userId).child("userActive").setValue("Y");
+ }
+ else if(tagId.endsWith("_ADM")) {
+ mDatabase.getReference().child("users").child(userId).child("userAdmin").setValue("Y");
+ }
+ } else {
+ // The toggle is disabled
+ if(tagId.endsWith("_ED")) {
+ mDatabase.getReference().child("users").child(userId).child("userActive").setValue("N");
+ }
+ else if(tagId.endsWith("_ADM")) {
+ mDatabase.getReference().child("users").child(userId).child("userAdmin").setValue("N");
+ }
+ }
+ };
+
+ }
+
+ private void addUserInfoCard(User user) {
+ // GENERATE DYNAMIC LAYOUT
+ LayoutInflater layoutInflater = (LayoutInflater) getBaseContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+
+ // USE card_layout_add_info.xml TO CREATE LAYOUT
+ CardView clasrCardView = (CardView) layoutInflater.inflate(R.layout.card_layout_admin_screen_row, null);
+ TextView tvUserName = (TextView) clasrCardView.findViewById(R.id.clasr_tv_username);
+ TextView tvUserId = (TextView) clasrCardView.findViewById(R.id.clasr_tv_userId);
+ SwitchCompat userStateSwitchCompat = (SwitchCompat) clasrCardView.findViewById(R.id.clasr_enable_disable_switch);
+ userStateSwitchCompat.setOnCheckedChangeListener(listener);
+ SwitchCompat adminToggleSwitchCompat = (SwitchCompat) clasrCardView.findViewById(R.id.clasr_admin_toggle_switch);
+ adminToggleSwitchCompat.setOnCheckedChangeListener(listener);
+ if (null != user) {
+ if (!user.getUserName().isEmpty()) {
+ tvUserName.setText(user.getUserName());
+ }
+
+ if (!user.getUid().isEmpty()) {
+ tvUserId.setText(user.getUid());
+ }
+ if (!user.getUserActive().isEmpty() && !user.getUserActive().equals("Y")) {
+ userStateSwitchCompat.setOnCheckedChangeListener(null);
+ userStateSwitchCompat.setChecked(false);
+ userStateSwitchCompat.setOnCheckedChangeListener(listener);
+ }
+ if (!user.getUserAdmin().isEmpty() && !user.getUserAdmin().equals("N")) {
+ adminToggleSwitchCompat.setOnCheckedChangeListener(null);
+ adminToggleSwitchCompat.setChecked(true);
+ adminToggleSwitchCompat.setOnCheckedChangeListener(listener);
+ }
+
+ // SETUP TAGS
+ ++viewTagCounter;
+ tvUserId.setTag("TAG"+viewTagCounter);
+ tvUserName.setTag("TAG"+viewTagCounter);
+ userStateSwitchCompat.setTag("TAG"+viewTagCounter+"_ED");
+ adminToggleSwitchCompat.setTag("TAG"+viewTagCounter+"_ADM");
+ // ADD CARD VIEW TO MAIN VIEW
+ addInfoCardSectionLayout.addView(clasrCardView);
+ }
+ }
+}
diff --git a/app/src/main/java/appcom/example/regsplashscreen/DashboardDynamicActivity.java b/app/src/main/java/appcom/example/regsplashscreen/DashboardDynamicActivity.java
index 01fcf65..d577912 100644
--- a/app/src/main/java/appcom/example/regsplashscreen/DashboardDynamicActivity.java
+++ b/app/src/main/java/appcom/example/regsplashscreen/DashboardDynamicActivity.java
@@ -1,233 +1,228 @@
-package appcom.example.regsplashscreen;
-
-import android.app.ProgressDialog;
-import android.content.Context;
-import android.content.Intent;
-import android.graphics.Bitmap;
-import android.os.Build;
-import android.os.Bundle;
-import android.view.LayoutInflater;
-import android.view.Menu;
-import android.view.MenuInflater;
-import android.view.MenuItem;
-import android.view.View;
-import android.widget.Button;
-import android.widget.ImageButton;
-import android.widget.ImageView;
-import android.widget.LinearLayout;
-import android.widget.TextView;
-import android.widget.Toast;
-
-import androidx.annotation.NonNull;
-import androidx.annotation.RequiresApi;
-import androidx.appcompat.app.AlertDialog;
-import androidx.appcompat.app.AppCompatActivity;
-import androidx.cardview.widget.CardView;
-
-import com.google.firebase.auth.FirebaseAuth;
-import com.google.firebase.database.DataSnapshot;
-import com.google.firebase.database.DatabaseError;
-import com.google.firebase.database.DatabaseReference;
-import com.google.firebase.database.FirebaseDatabase;
-import com.google.firebase.database.ValueEventListener;
-
-import java.util.Objects;
-
-import appcom.example.regsplashscreen.model.DocumentDetails;
-import appcom.example.regsplashscreen.model.User;
-import appcom.example.regsplashscreen.util.LocalBase64Util;
-
-public class DashboardDynamicActivity extends AppCompatActivity {
-
- private FirebaseAuth mAuth;
- private ProgressDialog progressDialog;
- private boolean isAdmin = false;
- private LinearLayout addInfoCardSectionLayout;
- private int viewTagCounter = 0;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_dashboard_dynamic_screen);
- addInfoCardSectionLayout = (LinearLayout) findViewById(R.id.dds_view_info_card_section);
-
- // INITIALIZE PROGRESS DIALOG BOX
- progressDialog = new ProgressDialog(DashboardDynamicActivity.this);
- progressDialog.setTitle("Fetching details");
- progressDialog.setMessage("Fetching details");
- progressDialog.show();
-
- // FIREBASE AUTH DETAILS
- FirebaseDatabase mDatabase = FirebaseDatabase.getInstance();
- mAuth = FirebaseAuth.getInstance();
- String uid = mAuth.getUid();
- DatabaseReference databaseReference = mDatabase.getReference().child("users");
-
- // INITIALIZE BUTTONS
- ImageButton editProfileButton = findViewById(R.id.dds_edit_profile_button);
-
- // INITIALIZE VIEWS
- ImageView profilePicture = findViewById(R.id.dds_profile_picture);
- TextView tvUserName = findViewById(R.id.dds_username);
- TextView tvEmailId = findViewById(R.id.dds_email_id);
- TextView tvDob = findViewById(R.id.dds_dob);
-
- databaseReference.addValueEventListener(new ValueEventListener() {
- @RequiresApi(api = Build.VERSION_CODES.N)
- @Override
- public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
- for (DataSnapshot item : dataSnapshot.getChildren()) {
- if (Objects.equals(item.getKey(), uid)) {
- User user = item.getValue(User.class);
- if (null == user.getUserActive() || !user.getUserActive().equals("Y")) {
- Toast.makeText(DashboardDynamicActivity.this, "User disabled. Please contact administrator", Toast.LENGTH_SHORT).show();
- mAuth.signOut();
- Intent intent = new Intent(DashboardDynamicActivity.this, SignInScreenActivity.class);
- startActivity(intent);
- break;
- }
- if (null != user.getUserAdmin() && user.getUserAdmin().equals("Y")) {
- isAdmin = true;
- invalidateOptionsMenu();
- }
- tvUserName.setText(Objects.requireNonNull(user).getUserName());
- tvEmailId.setText(user.getEmailId());
- tvDob.setText(user.getDob());
- profilePicture.setImageBitmap(LocalBase64Util.decodeBase64StringToImage(user.getEncodedImage()));
- if (null != user.getDocumentDetailsList()) {
- for (DocumentDetails documentDetails : user.getDocumentDetailsList()) {
- addDocumentInDashboard(documentDetails);
- }
- }
- progressDialog.dismiss();
- }
- }
- }
-
- @Override
- public void onCancelled(@NonNull DatabaseError error) {
- progressDialog.dismiss();
- }
- });
-
- editProfileButton.setOnClickListener(v -> {
- Intent intent = new Intent(DashboardDynamicActivity.this, EditProfileDynamicActivity.class);
- startActivity(intent);
- });
-
- }
-
- // ADD DYNAMIC LAYOUT
- private void addDocumentInDashboard(DocumentDetails documentDetails) {
- // GENERATE DYNAMIC LAYOUT
- LayoutInflater layoutInflater = (LayoutInflater) getBaseContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
-
- // USE card_layout_view_info.xml TO CREATE LAYOUT
- CardView clviCardView = (CardView) layoutInflater.inflate(R.layout.card_layout_view_info, null);
- TextView tvDocumentName = (TextView) clviCardView.findViewById(R.id.clvi_doc_name);
- tvDocumentName.setText(documentDetails.getDocName());
- TextView tvDocumentId = (TextView) clviCardView.findViewById(R.id.clvi_doc_id);
- tvDocumentId.setText(documentDetails.getDocId());
- TextView tvDocImageString = (TextView) clviCardView.findViewById(R.id.clvi_doc_encoded_image);
- tvDocImageString.setText(documentDetails.getDocEncodedImage());
-
- // INITIALIZE IMAGE BUTTONS
- ImageButton viewDocImageButton = (ImageButton) clviCardView.findViewById(R.id.clvi_view_doc_button);
- viewDocImageButton.setOnClickListener(buttonView -> {
- openDocImageDialog(tvDocImageString);
- });
-
- ImageButton shareDocDetailsButton = (ImageButton) clviCardView.findViewById(R.id.clvi_share_button);
- shareDocDetailsButton.setOnClickListener(buttonView -> {
- shareDocDetails(documentDetails);
- });
-
- ++viewTagCounter;
- tvDocumentName.setTag("TAG_" +viewTagCounter+"_TVDN");
- tvDocumentId.setTag("TAG_" +viewTagCounter+"_TVDID");
- tvDocImageString.setTag("TAG_" +viewTagCounter+"_TVDIMG");
- viewDocImageButton.setTag("TAG_"+viewTagCounter+"_BTDOC");
-
- // ADD CARD VIEW TO MAIN VIEW
- addInfoCardSectionLayout.addView(clviCardView);
- }
-
- // SHARE DOCUMENT DETAILS
- private void shareDocDetails(DocumentDetails documentDetails) {
- Intent sharingIntent = new Intent(Intent.ACTION_SEND);
- // TYPE OF THE CONTENT TO BE SHARED
- sharingIntent.setType("text/plain");
-
- // BODY OF THE CONTENT
- String shareBody = documentDetails.getDocName() + " : " + documentDetails.getDocId();
-
- // SUBJECT OF THE CONTENT. YOU CAN SHARE ANYTHING
- String shareSubject = "Sharing " + documentDetails.getDocName() + " details";
-
- // PASSING BODY OF THE CONTENT
- sharingIntent.putExtra(Intent.EXTRA_TEXT, shareBody);
-
- // PASSING SUBJECT OF THE CONTENT
- sharingIntent.putExtra(Intent.EXTRA_SUBJECT, shareSubject);
- startActivity(Intent.createChooser(sharingIntent, "Share using"));
- }
-
- private void openDocImageDialog(TextView tvDocImageString) {
- // INITIALIZE ALERT BOX
- AlertDialog.Builder docImageDialogBox = new AlertDialog.Builder(DashboardDynamicActivity.this);
-
- // INFLATE CUSTOM DIALOG BOX
- View dialogView = getLayoutInflater().inflate(R.layout.dialog_layout_view_doc_image, null);
-
- // INITIALIZE DIALOG BOX BUTTONS & VIEWS
- ImageView ivDocImage = (ImageView) dialogView.findViewById(R.id.dlvdi_doc_img);
- Bitmap docImageBmp = LocalBase64Util.decodeBase64StringToImage(tvDocImageString.getText().toString());
- ivDocImage.setImageBitmap(docImageBmp);
-
- Button dialogCloseBtn = (Button) dialogView.findViewById(R.id.dlvdi_btn_close);
-
- // ALERT DIALOG BOX SETTINGS
- docImageDialogBox.setView(dialogView);
- AlertDialog addDocImageDialog = docImageDialogBox.create();
- addDocImageDialog.setCanceledOnTouchOutside(false);
-
- // DIALOG CLOSE BUTTON ACTION
- dialogCloseBtn.setOnClickListener(view -> {
- addDocImageDialog.dismiss();
- });
- addDocImageDialog.show();
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- MenuInflater inflater = getMenuInflater();
- getMenuInflater().inflate(R.menu.menu_dashboard, menu);
- if (isAdmin) {
- menu.getItem(2).setEnabled(true);
- menu.getItem(2).setVisible(true);
- }
- return super.onCreateOptionsMenu(menu);
- }
-
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
-
- switch (item.getItemId()) {
- case R.id.edit_profile:
- Intent ed_intent = new Intent(DashboardDynamicActivity.this, EditProfileDynamicActivity.class);
- startActivity(ed_intent);
- return true;
- case R.id.sign_out:
- mAuth.signOut();
- Intent si_intent = new Intent(DashboardDynamicActivity.this, SignInScreenActivity.class);
- startActivity(si_intent);
- return true;
- case R.id.admin_screen:
- Intent as_intent = new Intent(DashboardDynamicActivity.this, AdminScreenActivity.class);
- startActivity(as_intent);
- return true;
- default:
- return super.onContextItemSelected(item);
- }
- }
-}
+package appcom.example.regsplashscreen;
+
+import android.app.ProgressDialog;
+import android.content.Context;
+import android.content.Intent;
+import android.graphics.Bitmap;
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
+import android.view.View;
+import android.widget.Button;
+import android.widget.ImageButton;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import androidx.annotation.NonNull;
+import androidx.appcompat.app.AlertDialog;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.cardview.widget.CardView;
+
+import com.google.firebase.auth.FirebaseAuth;
+import com.google.firebase.database.DataSnapshot;
+import com.google.firebase.database.DatabaseError;
+import com.google.firebase.database.DatabaseReference;
+import com.google.firebase.database.FirebaseDatabase;
+import com.google.firebase.database.ValueEventListener;
+
+import java.util.Objects;
+
+import appcom.example.regsplashscreen.model.DocumentDetails;
+import appcom.example.regsplashscreen.model.User;
+import appcom.example.regsplashscreen.util.LocalBase64Util;
+
+public class DashboardDynamicActivity extends AppCompatActivity {
+
+ private FirebaseAuth mAuth;
+ private ProgressDialog progressDialog;
+ private boolean isAdmin = false;
+ private LinearLayout addInfoCardSectionLayout;
+ private int viewTagCounter = 0;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_dashboard_dynamic_screen);
+ addInfoCardSectionLayout = (LinearLayout) findViewById(R.id.dds_view_info_card_section);
+
+ // INITIALIZE PROGRESS DIALOG BOX
+ progressDialog = new ProgressDialog(DashboardDynamicActivity.this);
+ progressDialog.setTitle("Fetching details");
+ progressDialog.setMessage("Fetching details");
+ progressDialog.show();
+
+ // FIREBASE AUTH DETAILS
+ FirebaseDatabase mDatabase = FirebaseDatabase.getInstance();
+ mAuth = FirebaseAuth.getInstance();
+ String uid = mAuth.getUid();
+ DatabaseReference databaseReference = mDatabase.getReference().child("users");
+
+ // INITIALIZE BUTTONS
+ ImageButton editProfileButton = findViewById(R.id.dds_edit_profile_button);
+
+ // INITIALIZE VIEWS
+ ImageView profilePicture = findViewById(R.id.dds_profile_picture);
+ TextView tvUserName = findViewById(R.id.dds_username);
+ TextView tvEmailId = findViewById(R.id.dds_email_id);
+ TextView tvDob = findViewById(R.id.dds_dob);
+
+ databaseReference.addValueEventListener(new ValueEventListener() {
+ @Override
+ public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
+ for (DataSnapshot item : dataSnapshot.getChildren()) {
+ if (Objects.equals(item.getKey(), uid)) {
+ User user = item.getValue(User.class);
+ if (null == user.getUserActive() || !user.getUserActive().equals("Y")) {
+ Toast.makeText(DashboardDynamicActivity.this, "User disabled. Please contact administrator", Toast.LENGTH_SHORT).show();
+ mAuth.signOut();
+ Intent intent = new Intent(DashboardDynamicActivity.this, SignInScreenActivity.class);
+ startActivity(intent);
+ break;
+ }
+ if (null != user.getUserAdmin() && user.getUserAdmin().equals("Y")) {
+ isAdmin = true;
+ invalidateOptionsMenu();
+ }
+ tvUserName.setText(Objects.requireNonNull(user).getUserName());
+ tvEmailId.setText(user.getEmailId());
+ tvDob.setText(user.getDob());
+ profilePicture.setImageBitmap(LocalBase64Util.decodeBase64StringToImage(user.getEncodedImage()));
+ if (null != user.getDocumentDetailsList()) {
+ user.getDocumentDetailsList().forEach(documentDetails -> addDocumentInDashboard(documentDetails));
+ }
+ progressDialog.dismiss();
+ }
+ }
+ }
+
+ @Override
+ public void onCancelled(@NonNull DatabaseError error) {
+ progressDialog.dismiss();
+ }
+ });
+
+ editProfileButton.setOnClickListener(v -> {
+ Intent intent = new Intent(DashboardDynamicActivity.this, EditProfileDynamicActivity.class);
+ startActivity(intent);
+ });
+
+ }
+
+ // ADD DYNAMIC LAYOUT
+ private void addDocumentInDashboard(DocumentDetails documentDetails) {
+ // GENERATE DYNAMIC LAYOUT
+ LayoutInflater layoutInflater = (LayoutInflater) getBaseContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+
+ // USE card_layout_view_info.xml TO CREATE LAYOUT
+ CardView clviCardView = (CardView) layoutInflater.inflate(R.layout.card_layout_view_info, null);
+ TextView tvDocumentName = (TextView) clviCardView.findViewById(R.id.clvi_doc_name);
+ tvDocumentName.setText(documentDetails.getDocName());
+ TextView tvDocumentId = (TextView) clviCardView.findViewById(R.id.clvi_doc_id);
+ tvDocumentId.setText(documentDetails.getDocId());
+ TextView tvDocImageString = (TextView) clviCardView.findViewById(R.id.clvi_doc_encoded_image);
+ tvDocImageString.setText(documentDetails.getDocEncodedImage());
+
+ // INITIALIZE IMAGE BUTTONS
+ ImageButton viewDocImageButton = (ImageButton) clviCardView.findViewById(R.id.clvi_view_doc_button);
+ viewDocImageButton.setOnClickListener(buttonView -> {
+ openDocImageDialog(tvDocImageString);
+ });
+
+ ImageButton shareDocDetailsButton = (ImageButton) clviCardView.findViewById(R.id.clvi_share_button);
+ shareDocDetailsButton.setOnClickListener(buttonView -> {
+ shareDocDetails(documentDetails);
+ });
+
+ ++viewTagCounter;
+ tvDocumentName.setTag("TAG_" +viewTagCounter+"_TVDN");
+ tvDocumentId.setTag("TAG_" +viewTagCounter+"_TVDID");
+ tvDocImageString.setTag("TAG_" +viewTagCounter+"_TVDIMG");
+ viewDocImageButton.setTag("TAG_"+viewTagCounter+"_BTDOC");
+
+ // ADD CARD VIEW TO MAIN VIEW
+ addInfoCardSectionLayout.addView(clviCardView);
+ }
+
+ // SHARE DOCUMENT DETAILS
+ private void shareDocDetails(DocumentDetails documentDetails) {
+ Intent sharingIntent = new Intent(Intent.ACTION_SEND);
+ // TYPE OF THE CONTENT TO BE SHARED
+ sharingIntent.setType("text/plain");
+
+ // BODY OF THE CONTENT
+ String shareBody = documentDetails.getDocName() + " : " + documentDetails.getDocId();
+
+ // SUBJECT OF THE CONTENT. YOU CAN SHARE ANYTHING
+ String shareSubject = "Sharing " + documentDetails.getDocName() + " details";
+
+ // PASSING BODY OF THE CONTENT
+ sharingIntent.putExtra(Intent.EXTRA_TEXT, shareBody);
+
+ // PASSING SUBJECT OF THE CONTENT
+ sharingIntent.putExtra(Intent.EXTRA_SUBJECT, shareSubject);
+ startActivity(Intent.createChooser(sharingIntent, "Share using"));
+ }
+
+ private void openDocImageDialog(TextView tvDocImageString) {
+ // INITIALIZE ALERT BOX
+ AlertDialog.Builder docImageDialogBox = new AlertDialog.Builder(DashboardDynamicActivity.this);
+
+ // INFLATE CUSTOM DIALOG BOX
+ View dialogView = getLayoutInflater().inflate(R.layout.dialog_layout_view_doc_image, null);
+
+ // INITIALIZE DIALOG BOX BUTTONS & VIEWS
+ ImageView ivDocImage = (ImageView) dialogView.findViewById(R.id.dlvdi_doc_img);
+ Bitmap docImageBmp = LocalBase64Util.decodeBase64StringToImage(tvDocImageString.getText().toString());
+ ivDocImage.setImageBitmap(docImageBmp);
+
+ Button dialogCloseBtn = (Button) dialogView.findViewById(R.id.dlvdi_btn_close);
+
+ // ALERT DIALOG BOX SETTINGS
+ docImageDialogBox.setView(dialogView);
+ AlertDialog addDocImageDialog = docImageDialogBox.create();
+ addDocImageDialog.setCanceledOnTouchOutside(false);
+
+ // DIALOG CLOSE BUTTON ACTION
+ dialogCloseBtn.setOnClickListener(view -> {
+ addDocImageDialog.dismiss();
+ });
+ addDocImageDialog.show();
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ MenuInflater inflater = getMenuInflater();
+ getMenuInflater().inflate(R.menu.menu_dashboard, menu);
+ if (isAdmin) {
+ menu.getItem(2).setEnabled(true);
+ menu.getItem(2).setVisible(true);
+ }
+ return super.onCreateOptionsMenu(menu);
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+
+ switch (item.getItemId()) {
+ case R.id.edit_profile:
+ Intent ed_intent = new Intent(DashboardDynamicActivity.this, EditProfileDynamicActivity.class);
+ startActivity(ed_intent);
+ return true;
+ case R.id.sign_out:
+ mAuth.signOut();
+ Intent si_intent = new Intent(DashboardDynamicActivity.this, SignInScreenActivity.class);
+ startActivity(si_intent);
+ return true;
+ case R.id.admin_screen:
+ Intent as_intent = new Intent(DashboardDynamicActivity.this, AdminScreenActivity.class);
+ startActivity(as_intent);
+ return true;
+ default:
+ return super.onContextItemSelected(item);
+ }
+ }
+}
diff --git a/app/src/main/java/appcom/example/regsplashscreen/EditProfileDynamicActivity.java b/app/src/main/java/appcom/example/regsplashscreen/EditProfileDynamicActivity.java
index 0adbea8..49a4ce6 100644
--- a/app/src/main/java/appcom/example/regsplashscreen/EditProfileDynamicActivity.java
+++ b/app/src/main/java/appcom/example/regsplashscreen/EditProfileDynamicActivity.java
@@ -1,547 +1,492 @@
-package appcom.example.regsplashscreen;
-
-import android.Manifest;
-import android.app.Activity;
-import android.app.ProgressDialog;
-import android.content.ContentValues;
-import android.content.Context;
-import android.content.Intent;
-import android.content.pm.PackageManager;
-import android.graphics.Bitmap;
-import android.graphics.BitmapFactory;
-import android.graphics.drawable.BitmapDrawable;
-import android.net.Uri;
-import android.os.Build;
-import android.os.Bundle;
-import android.provider.MediaStore;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.Button;
-import android.widget.EditText;
-import android.widget.ImageButton;
-import android.widget.ImageView;
-import android.widget.LinearLayout;
-import android.widget.TextView;
-import android.widget.Toast;
-
-import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
-import androidx.annotation.RequiresApi;
-import androidx.appcompat.app.AlertDialog;
-import androidx.appcompat.app.AppCompatActivity;
-import androidx.cardview.widget.CardView;
-import androidx.core.content.ContextCompat;
-import androidx.core.content.FileProvider;
-
-import com.google.firebase.auth.FirebaseAuth;
-import com.google.firebase.database.DataSnapshot;
-import com.google.firebase.database.DatabaseError;
-import com.google.firebase.database.DatabaseReference;
-import com.google.firebase.database.FirebaseDatabase;
-import com.google.firebase.database.ValueEventListener;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Objects;
-
-import appcom.example.regsplashscreen.model.DocumentDetails;
-import appcom.example.regsplashscreen.model.User;
-import appcom.example.regsplashscreen.util.LocalBase64Util;
-
-public class EditProfileDynamicActivity extends AppCompatActivity {
- //TODO Work on Admin Access
-
- private static final int CAMERA_REQUEST = 100;
- private static final int STORAGE_REQUEST = 200;
- private static final int IMAGEPICK_GALLERY_REQUEST = 300;
- private static final int IMAGE_PICKCAMERA_REQUEST = 400;
- private static final String SELECT_PROFILE_PIC = "Select Profile pic";
- private static final String SELECT_DOCUMENT_PIC = "Select Document pic";
- private LinearLayout addInfoCardSectionLayout;
- private int viewTagCounter = 0;
- private FirebaseDatabase mDatabase;
- private FirebaseAuth mAuth;
- private ProgressDialog progressDialog;
- private String emailId;
- private String[] cameraPermission;
- private String[] storagePermission;
- private Uri imageUri;
- private ImageView profilePic;
- private Bundle savedState;
- private String selectPicType;
- private ImageView ivDocImage;
- private String docImageBase64String = null;
- Bitmap sharingImage;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_edit_profile_dynamic_screen);
- addInfoCardSectionLayout = (LinearLayout) findViewById(R.id.epd_add_info_card_section);
-
- // INITIALIZE PROGRESS DIALOG BOX
- progressDialog = new ProgressDialog(EditProfileDynamicActivity.this);
- progressDialog.setTitle("Updating Profile");
- progressDialog.setMessage("Updating Profile");
-
- // FIREBASE AUTH DETAILS
- mAuth = FirebaseAuth.getInstance();
- mDatabase = FirebaseDatabase.getInstance();
- String uid = mAuth.getUid();
- DatabaseReference databaseReference = mDatabase.getReference().child("users");
-
- // INITIALIZE BUTTONS
- Button addDocumentButton = findViewById(R.id.epd_add_doc_button);
- Button saveProfileButton = findViewById(R.id.epd_save_profile_button);
- Button forgotPasswordButton = findViewById(R.id.epd_forgot_password_button);
- ImageButton editProfilePicButton = findViewById(R.id.epd_edit_profile_pic_button);
-
- // INITIALIZE VIEW ELEMENTS
- EditText edtEmailId = findViewById(R.id.epd_edtxt_email_id);
- EditText edtUserName = findViewById(R.id.epd_edtxt_username);
- EditText edtDOB = findViewById(R.id.epd_edtxt_dob);
- profilePic = findViewById(R.id.epd_profile_pic);
-
- // LOAD DATA IN VIEWS
- databaseReference.addValueEventListener(new ValueEventListener() {
- @RequiresApi(api = Build.VERSION_CODES.N)
- @Override
- public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
- addInfoCardSectionLayout.removeAllViewsInLayout();
- for (DataSnapshot item : dataSnapshot.getChildren()) {
- if (Objects.equals(item.getKey(), uid)) {
- User user = item.getValue(User.class);
- edtUserName.setText(Objects.requireNonNull(user).getUserName());
- edtEmailId.setText(user.getEmailId());
- edtDOB.setText(user.getDob());
- profilePic.setImageBitmap(LocalBase64Util.decodeBase64StringToImage(user.getEncodedImage()));
- emailId = user.getEmailId();
- if (null != user.getDocumentDetailsList()) {
- for (DocumentDetails documentDetails : user.getDocumentDetailsList()) {
- addDocumentInEditProfileScreen(documentDetails);
- }
- }
- }
- }
- }
-
- @Override
- public void onCancelled(@NonNull DatabaseError error) {
- // Toast.makeText(EditProfileDynamicActivity.this, "Something Went Wrong", Toast.LENGTH_LONG).show();
- }
- });
-
- // ADD DOCUMENT BUTTON
- addDocumentButton.setOnClickListener(view -> {
- addDocument();
- });
-
- // EDIT PROFILE PICTURE BUTTON
- editProfilePicButton.setOnClickListener(v -> {
- selectPicType = SELECT_PROFILE_PIC;
- showCameraGallerySelectorDialogBox();
- });
-
- // SAVE PROFILE BUTTON
- saveProfileButton.setOnClickListener(v -> {
- progressDialog.show();
- User userDetails = User.Builder.newInstance()
- .setUid(mAuth.getUid())
- .setUserName(edtUserName.getText().toString())
- .setEmailId(edtEmailId.getText().toString())
- .setDob(edtDOB.getText().toString())
- .setEncodedImage(LocalBase64Util.encodeImageToBase64String(profilePic.getDrawable() != null ?
- ((BitmapDrawable) profilePic.getDrawable()).getBitmap() : null))
- .setDocumentDetailsList(fetchDocumentDetails())
- .setUserActive("Y")
- .build();
- mDatabase.getReference().child("users").child(uid).setValue(userDetails);
- Intent intent = new Intent(EditProfileDynamicActivity.this, DashboardDynamicActivity.class);
- startActivity(intent);
- progressDialog.dismiss();
- });
-
- // FORGOT PASSWORD BUTTON
- forgotPasswordButton.setOnClickListener(v -> {
- mAuth.sendPasswordResetEmail(emailId).addOnCompleteListener(task -> {
- if (task.isSuccessful()) {
- Toast.makeText(EditProfileDynamicActivity.this, "Email sent.", Toast.LENGTH_LONG).show();
- }
- });
- });
- }
-
- // GATHER UP DOC DETAILS FROM SCREEN
- private List fetchDocumentDetails() {
- List documentDetails = new ArrayList<>();
- for (int i = 1; i <= viewTagCounter; i++) {
- TextView docName = (TextView) addInfoCardSectionLayout.findViewWithTag("TAG_" + i + "_TVDC");
- if (null != docName) {
- EditText docId = (EditText) addInfoCardSectionLayout.findViewWithTag("TAG_" + i + "_EDID");
- TextView docImageString = (TextView) addInfoCardSectionLayout.findViewWithTag("TAG_" + i + "_TVDIMG");
- documentDetails.add(DocumentDetails.Builder.newInstance()
- .setDocName(docName.getText().toString())
- .setDocId(null != docId.getText() ? docId.getText().toString() : null)
- .setDocEncodedImage(null != docImageString.getText() ? docImageString.getText().toString() : null)
- .build());
- }
- }
- return documentDetails;
- }
-
- // GENERATE CARDS FOR EDIT PROFILE SCREEN
- private void addDocumentInEditProfileScreen(DocumentDetails documentDetails) {
- // GENERATE DYNAMIC LAYOUT
- LayoutInflater layoutInflater = (LayoutInflater) getBaseContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
-
- ++viewTagCounter;
-
- // USE card_layout_view_info.xml TO CREATE LAYOUT
- CardView claiCardView = (CardView) layoutInflater.inflate(R.layout.card_layout_add_info, null);
- TextView tvDocumentName = (TextView) claiCardView.findViewById(R.id.clai_doc_name);
- tvDocumentName.setText(documentDetails.getDocName());
- tvDocumentName.setTag("TAG_" + viewTagCounter + "_TVDC");
- EditText edTextDocumentId = (EditText) claiCardView.findViewById(R.id.clai_edtxt_doc_id);
- edTextDocumentId.setText(documentDetails.getDocId());
- edTextDocumentId.setTag("TAG_" + viewTagCounter + "_EDID");
- TextView tvDocumentImageString = (TextView) claiCardView.findViewById(R.id.clai_doc_encoded_image);
- tvDocumentImageString.setText(documentDetails.getDocEncodedImage());
- tvDocumentImageString.setTag("TAG_" + viewTagCounter + "_TVDIMG");
-
- // INITIALIZE & DEFINE IMAGE BUTTONS FOR CARD ACTIONS
- ImageButton viewDocImageButton = (ImageButton) claiCardView.findViewById(R.id.clai_view_doc_button);
- viewDocImageButton.setOnClickListener(buttonView -> openDocImageDialog(tvDocumentImageString));
-
- ImageButton deleteCardButton = (ImageButton) claiCardView.findViewById(R.id.clai_delete_card_button);
- deleteCardButton.setOnClickListener(buttonView -> {
- ViewGroup cardView = (ViewGroup) buttonView.getParent().getParent().getParent();
- ViewGroup parentView = (ViewGroup) cardView.getParent();
- parentView.removeView(cardView);
- });
-
- ImageButton shareDocDetailsButton = (ImageButton) claiCardView.findViewById(R.id.clai_share_button);
- shareDocDetailsButton.setOnClickListener(buttonView -> {
- shareDocDetails(documentDetails);
- });
- ImageButton shareImageDetailsButton = claiCardView.findViewById(R.id.clai_share_button_image);
- shareImageDetailsButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- Toast.makeText(EditProfileDynamicActivity.this, "Sharing Image", Toast.LENGTH_LONG).show();
- Intent intentImageShare = new Intent(Intent.ACTION_SEND);
- intentImageShare.setType("Image");
- //TODO first convert the image.
- sharingImage = LocalBase64Util.decodeBase64StringToImage(documentDetails.getDocEncodedImage());
- File imagefolder = new File(getCacheDir(), "images");
- Uri uri = null;
- try {
- imagefolder.mkdirs();
- File file = new File(imagefolder, "shared_image.png");
- FileOutputStream outputStream = new FileOutputStream(file);
- sharingImage.compress(Bitmap.CompressFormat.PNG, 90, outputStream);
- outputStream.flush();
- outputStream.close();
- uri = FileProvider.getUriForFile(getApplicationContext(), "com.mydomain.fileprovider", file);
-
-
- }catch (Exception e){
- Toast.makeText(EditProfileDynamicActivity.this, e.getMessage(), Toast.LENGTH_SHORT).show();
- }
- Intent intent = new Intent(Intent.ACTION_SEND);
-
- // putting uri of image to be shared
- intent.putExtra(Intent.EXTRA_STREAM, uri);
-
- // adding text to share
- intent.putExtra(Intent.EXTRA_TEXT, "Sharing Image");
-
- // Add subject Here
- intent.putExtra(Intent.EXTRA_SUBJECT, "Information Image");
-
- // setting type to image
- intent.setType("image/png");
-
- // calling startactivity() to share
- startActivity(Intent.createChooser(intent, "Share Via"));
-
-
-
- }
- });
-
- // ADD CARD VIEW TO MAIN VIEW
- addInfoCardSectionLayout.addView(claiCardView);
- }
-
- // SHARE DOCUMENT DETAILS
- private void shareDocDetails(DocumentDetails documentDetails) {
- Intent sharingIntent = new Intent(Intent.ACTION_SEND);
- // TYPE OF THE CONTENT TO BE SHARED
- sharingIntent.setType("text/plain");
-
- // BODY OF THE CONTENT
- String shareBody = documentDetails.getDocName() + " : " + documentDetails.getDocId();
-
- // SUBJECT OF THE CONTENT. YOU CAN SHARE ANYTHING
- String shareSubject = "Sharing " + documentDetails.getDocName() + " details";
-
- // PASSING BODY OF THE CONTENT
- sharingIntent.putExtra(Intent.EXTRA_TEXT, shareBody);
-
- // PASSING SUBJECT OF THE CONTENT
- sharingIntent.putExtra(Intent.EXTRA_SUBJECT, shareSubject);
- startActivity(Intent.createChooser(sharingIntent, "Share using"));
- }
-
- // OPEN DOCUMENT IMAGE
- private void openDocImageDialog(TextView tvDocumentImageString) {
- // INITIALIZE ALERT BOX
- AlertDialog.Builder docImageDialogBox = new AlertDialog.Builder(EditProfileDynamicActivity.this);
-
- // INFLATE CUSTOM DIALOG BOX
- View dialogView = getLayoutInflater().inflate(R.layout.dialog_layout_view_doc_image, null);
-
- // INITIALIZE DIALOG BOX BUTTONS & VIEWS
- ImageView ivDocImage = (ImageView) dialogView.findViewById(R.id.dlvdi_doc_img);
- Bitmap docImageBmp = LocalBase64Util.decodeBase64StringToImage(tvDocumentImageString.getText().toString());
- ivDocImage.setImageBitmap(docImageBmp);
-
- Button dialogCloseBtn = (Button) dialogView.findViewById(R.id.dlvdi_btn_close);
-
- // ALERT DIALOG BOX SETTINGS
- docImageDialogBox.setView(dialogView);
- AlertDialog addDocImageDialog = docImageDialogBox.create();
- addDocImageDialog.setCanceledOnTouchOutside(false);
-
- // DIALOG CLOSE BUTTON ACTION
- dialogCloseBtn.setOnClickListener(view -> {
- addDocImageDialog.dismiss();
- });
- addDocImageDialog.show();
- }
-
- // ADD NEW DOCUMENT
- private void addDocument() {
- // INITIALIZE ALERT BOX
- AlertDialog.Builder addDocDetailsDialogBox = new AlertDialog.Builder(EditProfileDynamicActivity.this);
-
- // INFLATE CUSTOM DIALOG BOX
- View dialogView = getLayoutInflater().inflate(R.layout.dialog_layout_add_doc, null);
-
- // INITIALIZE DIALOG BOX BUTTONS & EDIT TEXT BOXES
- EditText edtDocName = (EditText) dialogView.findViewById(R.id.dlad_edtxt_doc_name);
- EditText edtDocId = (EditText) dialogView.findViewById(R.id.dlad_edtxt_doc_id);
- Button dialogOkayBtn = (Button) dialogView.findViewById(R.id.dlad_btn_okay);
- Button dialogCancelBtn = (Button) dialogView.findViewById(R.id.dlad_btn_cancel);
-
- // INITIALIZE IMAGE VIEWS & DOC UPLOAD BUTTON
- ivDocImage = (ImageView) dialogView.findViewById(R.id.dlad_doc_img);
- ImageButton ivDocImageUploadButton = (ImageButton) dialogView.findViewById(R.id.dlad_upload_doc_img_button);
- ivDocImageUploadButton.setOnClickListener(v -> {
- selectPicType = SELECT_DOCUMENT_PIC;
- showCameraGallerySelectorDialogBox();
- });
- // SHOW ALERT DIALOG BOX
- addDocDetailsDialogBox.setView(dialogView);
- AlertDialog addDocDialog = addDocDetailsDialogBox.create();
- addDocDialog.setCanceledOnTouchOutside(false);
-
- // DIALOG CANCEL BUTTON ACTION
- dialogCancelBtn.setOnClickListener(view -> {
- addDocDialog.dismiss();
- });
-
- // DIALOG OKAY BUTTON ACTION
- dialogOkayBtn.setOnClickListener(view -> {
- addDocumentCardSection(edtDocName, edtDocId);
- addDocDialog.dismiss();
- });
- addDocDialog.show();
- }
-
- // ADD NEW DOCUMENT CARD VIEW
- private void addDocumentCardSection(EditText edtDocName, EditText edtDocId) {
- // GENERATE DYNAMIC LAYOUT
- LayoutInflater layoutInflater = (LayoutInflater) getBaseContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
-
- // USE card_layout_add_info.xml TO CREATE LAYOUT
- CardView claiCardView = (CardView) layoutInflater.inflate(R.layout.card_layout_add_info, null);
- TextView tvDocumentName = (TextView) claiCardView.findViewById(R.id.clai_doc_name);
- tvDocumentName.setText(edtDocName.getText());
- EditText edtDocumentName = (EditText) claiCardView.findViewById(R.id.clai_edtxt_doc_id);
- edtDocumentName.setText(edtDocId.getText());
- TextView tvDocImageString = (TextView) claiCardView.findViewById(R.id.clai_doc_encoded_image);
- tvDocImageString.setText(docImageBase64String);
- if (!edtDocName.getText().toString().isEmpty()) {
- ++viewTagCounter;
- tvDocumentName.setTag("TAG_" + viewTagCounter + "_TVDC");
- edtDocumentName.setTag("TAG_" + viewTagCounter + "_EDID");
- tvDocImageString.setTag("TAG_" + viewTagCounter + "_TVDIMG");
-
- // ADD CARD VIEW TO MAIN VIEW
- addInfoCardSectionLayout.addView(claiCardView);
- }
- }
-
- // CHOOSE GALLERY OR CAMERA
- private void showCameraGallerySelectorDialogBox() {
- String[] options = {"Camera", "Gallery"};
- android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(this);
- builder.setTitle("Pick Image From");
- builder.setItems(options, (dialog, which) -> {
- // if access is not given then we will request for permission
- if (which == 0) {
- if (!checkCameraPermission()) {
- requestCameraPermission();
- } else {
- pickFromCamera();
- }
- } else if (which == 1) {
- if (!checkStoragePermission()) {
- requestStoragePermission();
- } else {
- pickFromGallery();
- }
- }
- });
- builder.create().show();
- }
-
- // CHECK IF PERMISSION TO ACCESS CAMERA EXISTS
- private boolean checkCameraPermission() {
- boolean result = ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA) == (PackageManager.PERMISSION_GRANTED);
- boolean result1 = ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) == (PackageManager.PERMISSION_GRANTED);
- return result && result1;
- }
-
- // REQUEST PERMISSION TO ACCESS CAMERA
- private void requestCameraPermission() {
- requestPermissions(cameraPermission, CAMERA_REQUEST);
- }
-
- // CHECK IF PERMISSION TO ACCESS INTERNAL STORAGE EXISTS
- private boolean checkStoragePermission() {
- return ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) == (PackageManager.PERMISSION_GRANTED);
- }
-
- // REQUEST PERMISSION TO ACCESS INTERNAL STORAGE
- private void requestStoragePermission() {
- requestPermissions(storagePermission, STORAGE_REQUEST);
- }
-
- // TO CHECK IF PERMISSIONS REQUESTED IS GRANTED OR NOT
- @Override
- public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
- super.onRequestPermissionsResult(requestCode, permissions, grantResults);
- switch (requestCode) {
- case CAMERA_REQUEST: {
- if (grantResults.length > 0) {
- boolean cameraAccepted = grantResults[0] == PackageManager.PERMISSION_GRANTED;
- boolean writeStorageAccepted = grantResults[1] == PackageManager.PERMISSION_GRANTED;
- if (cameraAccepted && writeStorageAccepted) {
- pickFromCamera();
- } else {
- Toast.makeText(this, "Please Enable Camera and Storage Permissions", Toast.LENGTH_LONG).show();
- }
- }
- }
- break;
- case STORAGE_REQUEST: {
- if (grantResults.length > 0) {
- boolean writeStorageAccepted = grantResults[0] == PackageManager.PERMISSION_GRANTED;
- if (writeStorageAccepted) {
- pickFromGallery();
- } else {
- Toast.makeText(this, "Please Enable Storage Permissions", Toast.LENGTH_LONG).show();
- }
- }
- }
- break;
- }
- }
-
- // TAKE A PHOTO FROM PHONE CAMERA
- private void pickFromCamera() {
- ContentValues contentValues = new ContentValues();
- contentValues.put(MediaStore.Images.Media.TITLE, "Temp_pic");
- contentValues.put(MediaStore.Images.Media.DESCRIPTION, "Temp Description");
- imageUri = this.getContentResolver().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, contentValues);
- Intent cameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
- cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, imageUri);
- startActivityForResult(cameraIntent, IMAGE_PICKCAMERA_REQUEST);
- }
-
- // TAKE A PHOTO FROM GALLERY
- private void pickFromGallery() {
- Intent galleryIntent = new Intent();
- galleryIntent.setType("image/*");
- galleryIntent.setAction(Intent.ACTION_GET_CONTENT);
- startActivityForResult(Intent.createChooser(galleryIntent, "Select file"), IMAGEPICK_GALLERY_REQUEST);
- }
-
- // ON SELECTION OF A PHOTO
- @Override
- public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
- if (resultCode == Activity.RESULT_OK && selectPicType.equals(SELECT_PROFILE_PIC)) {
- if (requestCode == IMAGEPICK_GALLERY_REQUEST) {
- imageUri = data.getData();
- uploadProfileCoverPhoto(imageUri);
- }
- if (requestCode == IMAGE_PICKCAMERA_REQUEST && savedState != null) {
- uploadProfileCoverPhoto((Uri) savedState.getParcelable("imageUri"));
- }
- } else if (resultCode == Activity.RESULT_OK && selectPicType.equals(SELECT_DOCUMENT_PIC)) {
- if (requestCode == IMAGEPICK_GALLERY_REQUEST) {
- imageUri = data.getData();
- uploadDocumentPicture(imageUri);
- }
- if (requestCode == IMAGE_PICKCAMERA_REQUEST && savedState != null) {
- uploadDocumentPicture((Uri) savedState.getParcelable("imageUri"));
- }
- }
- super.onActivityResult(requestCode, resultCode, data);
- }
-
- // UPLOAD PROFILE PICTURE
- private void uploadProfileCoverPhoto(Uri imageUri) {
- InputStream imageStream = null;
- if (imageUri != null) {
- try {
- imageStream = this.getContentResolver().openInputStream(imageUri);
- Bitmap bitmapImage = BitmapFactory.decodeStream(imageStream);
- profilePic.setImageBitmap(bitmapImage);
- } catch (IOException e) {
- Toast.makeText(this, e.getMessage(), Toast.LENGTH_LONG).show();
- }
- }
- }
-
- // UPLOAD DOCUMENT IMAGE
- private void uploadDocumentPicture(Uri imageUri) {
- InputStream imageStream = null;
- if (imageUri != null) {
- try {
- imageStream = this.getContentResolver().openInputStream(imageUri);
- Bitmap bitmapImage = BitmapFactory.decodeStream(imageStream);
- ivDocImage.setImageBitmap(bitmapImage);
- docImageBase64String = LocalBase64Util.encodeImageToBase64String(bitmapImage);
- } catch (IOException e) {
- Toast.makeText(this, e.getMessage(), Toast.LENGTH_LONG).show();
- }
- }
- }
-
- // SAVING STATE FOR WHEN APP SWITCHES TO CAMERA SO THAT IMAGE UR CAN BE FETCHED
- @Override
- public void onSaveInstanceState(Bundle instanceData) {
- super.onSaveInstanceState(instanceData);
- instanceData.putParcelable("imageUri", imageUri);
- savedState = instanceData;
- }
-
-}
+package appcom.example.regsplashscreen;
+
+import android.Manifest;
+import android.app.Activity;
+import android.app.ProgressDialog;
+import android.content.ContentValues;
+import android.content.Context;
+import android.content.Intent;
+import android.content.pm.PackageManager;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import android.graphics.drawable.BitmapDrawable;
+import android.net.Uri;
+import android.os.Bundle;
+import android.provider.MediaStore;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.ImageButton;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.appcompat.app.AlertDialog;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.cardview.widget.CardView;
+import androidx.core.content.ContextCompat;
+
+import com.google.firebase.auth.FirebaseAuth;
+import com.google.firebase.database.DataSnapshot;
+import com.google.firebase.database.DatabaseError;
+import com.google.firebase.database.DatabaseReference;
+import com.google.firebase.database.FirebaseDatabase;
+import com.google.firebase.database.ValueEventListener;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+
+import appcom.example.regsplashscreen.model.DocumentDetails;
+import appcom.example.regsplashscreen.model.User;
+import appcom.example.regsplashscreen.util.LocalBase64Util;
+
+public class EditProfileDynamicActivity extends AppCompatActivity {
+
+ private static final int CAMERA_REQUEST = 100;
+ private static final int STORAGE_REQUEST = 200;
+ private static final int IMAGEPICK_GALLERY_REQUEST = 300;
+ private static final int IMAGE_PICKCAMERA_REQUEST = 400;
+ private static final String SELECT_PROFILE_PIC = "Select Profile pic";
+ private static final String SELECT_DOCUMENT_PIC = "Select Document pic";
+ private LinearLayout addInfoCardSectionLayout;
+ private int viewTagCounter = 0;
+ private FirebaseDatabase mDatabase;
+ private FirebaseAuth mAuth;
+ private ProgressDialog progressDialog;
+ private String emailId;
+ private String[] cameraPermission;
+ private String[] storagePermission;
+ private Uri imageUri;
+ private ImageView profilePic;
+ private Bundle savedState;
+ private String selectPicType;
+ private ImageView ivDocImage;
+ private String docImageBase64String = null;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_edit_profile_dynamic_screen);
+ addInfoCardSectionLayout = (LinearLayout) findViewById(R.id.epd_add_info_card_section);
+
+ // INITIALIZE PROGRESS DIALOG BOX
+ progressDialog = new ProgressDialog(EditProfileDynamicActivity.this);
+ progressDialog.setTitle("Updating Profile");
+ progressDialog.setMessage("Updating Profile");
+
+ // FIREBASE AUTH DETAILS
+ mAuth = FirebaseAuth.getInstance();
+ mDatabase = FirebaseDatabase.getInstance();
+ String uid = mAuth.getUid();
+ DatabaseReference databaseReference = mDatabase.getReference().child("users");
+
+ // INITIALIZE BUTTONS
+ Button addDocumentButton = findViewById(R.id.epd_add_doc_button);
+ Button saveProfileButton = findViewById(R.id.epd_save_profile_button);
+ Button forgotPasswordButton = findViewById(R.id.epd_forgot_password_button);
+ ImageButton editProfilePicButton = findViewById(R.id.epd_edit_profile_pic_button);
+
+ // INITIALIZE VIEW ELEMENTS
+ EditText edtEmailId = findViewById(R.id.epd_edtxt_email_id);
+ EditText edtUserName = findViewById(R.id.epd_edtxt_username);
+ EditText edtDOB = findViewById(R.id.epd_edtxt_dob);
+ profilePic = findViewById(R.id.epd_profile_pic);
+
+ // LOAD DATA IN VIEWS
+ databaseReference.addValueEventListener(new ValueEventListener() {
+ @Override
+ public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
+ addInfoCardSectionLayout.removeAllViewsInLayout();
+ for (DataSnapshot item : dataSnapshot.getChildren()) {
+ if (Objects.equals(item.getKey(), uid)) {
+ User user = item.getValue(User.class);
+ edtUserName.setText(Objects.requireNonNull(user).getUserName());
+ edtEmailId.setText(user.getEmailId());
+ edtDOB.setText(user.getDob());
+ profilePic.setImageBitmap(LocalBase64Util.decodeBase64StringToImage(user.getEncodedImage()));
+ emailId = user.getEmailId();
+ if (null != user.getDocumentDetailsList()) {
+ user.getDocumentDetailsList().forEach(documentDetails -> addDocumentInEditProfileScreen(documentDetails));
+ }
+ }
+ }
+ }
+
+ @Override
+ public void onCancelled(@NonNull DatabaseError error) {
+ // Toast.makeText(EditProfileDynamicActivity.this, "Something Went Wrong", Toast.LENGTH_LONG).show();
+ }
+ });
+
+ // ADD DOCUMENT BUTTON
+ addDocumentButton.setOnClickListener(view -> {
+ addDocument();
+ });
+
+ // EDIT PROFILE PICTURE BUTTON
+ editProfilePicButton.setOnClickListener(v -> {
+ selectPicType = SELECT_PROFILE_PIC;
+ showCameraGallerySelectorDialogBox();
+ });
+
+ // SAVE PROFILE BUTTON
+ saveProfileButton.setOnClickListener(v -> {
+ progressDialog.show();
+ User userDetails = User.Builder.newInstance()
+ .setUid(mAuth.getUid())
+ .setUserName(edtUserName.getText().toString())
+ .setEmailId(edtEmailId.getText().toString())
+ .setDob(edtDOB.getText().toString())
+ .setEncodedImage(LocalBase64Util.encodeImageToBase64String(profilePic.getDrawable() != null ?
+ ((BitmapDrawable) profilePic.getDrawable()).getBitmap() : null))
+ .setDocumentDetailsList(fetchDocumentDetails())
+ .setUserActive("Y")
+ .build();
+ mDatabase.getReference().child("users").child(uid).setValue(userDetails);
+ Intent intent = new Intent(EditProfileDynamicActivity.this, DashboardDynamicActivity.class);
+ startActivity(intent);
+ progressDialog.dismiss();
+ });
+
+ // FORGOT PASSWORD BUTTON
+ forgotPasswordButton.setOnClickListener(v -> {
+ mAuth.sendPasswordResetEmail(emailId).addOnCompleteListener(task -> {
+ if (task.isSuccessful()) {
+ Toast.makeText(EditProfileDynamicActivity.this, "Email sent.", Toast.LENGTH_LONG).show();
+ }
+ });
+ });
+ }
+
+ // GATHER UP DOC DETAILS FROM SCREEN
+ private List fetchDocumentDetails() {
+ List documentDetails = new ArrayList<>();
+ for (int i = 1; i <= viewTagCounter; i++) {
+ TextView docName = (TextView) addInfoCardSectionLayout.findViewWithTag("TAG_" + i + "_TVDC");
+ if (null != docName) {
+ EditText docId = (EditText) addInfoCardSectionLayout.findViewWithTag("TAG_" + i + "_EDID");
+ TextView docImageString = (TextView) addInfoCardSectionLayout.findViewWithTag("TAG_" + i + "_TVDIMG");
+ documentDetails.add(DocumentDetails.Builder.newInstance()
+ .setDocName(docName.getText().toString())
+ .setDocId(null != docId.getText() ? docId.getText().toString() : null)
+ .setDocEncodedImage(null != docImageString.getText() ? docImageString.getText().toString() : null)
+ .build());
+ }
+ }
+ return documentDetails;
+ }
+
+ // GENERATE CARDS FOR EDIT PROFILE SCREEN
+ private void addDocumentInEditProfileScreen(DocumentDetails documentDetails) {
+ // GENERATE DYNAMIC LAYOUT
+ LayoutInflater layoutInflater = (LayoutInflater) getBaseContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+
+ ++viewTagCounter;
+
+ // USE card_layout_view_info.xml TO CREATE LAYOUT
+ CardView claiCardView = (CardView) layoutInflater.inflate(R.layout.card_layout_add_info, null);
+ TextView tvDocumentName = (TextView) claiCardView.findViewById(R.id.clai_doc_name);
+ tvDocumentName.setText(documentDetails.getDocName());
+ tvDocumentName.setTag("TAG_" + viewTagCounter + "_TVDC");
+ EditText edTextDocumentId = (EditText) claiCardView.findViewById(R.id.clai_edtxt_doc_id);
+ edTextDocumentId.setText(documentDetails.getDocId());
+ edTextDocumentId.setTag("TAG_" + viewTagCounter + "_EDID");
+ TextView tvDocumentImageString = (TextView) claiCardView.findViewById(R.id.clai_doc_encoded_image);
+ tvDocumentImageString.setText(documentDetails.getDocEncodedImage());
+ tvDocumentImageString.setTag("TAG_" + viewTagCounter + "_TVDIMG");
+
+ // INITIALIZE & DEFINE IMAGE BUTTONS FOR CARD ACTIONS
+ ImageButton viewDocImageButton = (ImageButton) claiCardView.findViewById(R.id.clai_view_doc_button);
+ viewDocImageButton.setOnClickListener(buttonView -> openDocImageDialog(tvDocumentImageString));
+
+ ImageButton deleteCardButton = (ImageButton) claiCardView.findViewById(R.id.clai_delete_card_button);
+ deleteCardButton.setOnClickListener(buttonView -> {
+ ViewGroup cardView = (ViewGroup) buttonView.getParent().getParent().getParent();
+ ViewGroup parentView = (ViewGroup) cardView.getParent();
+ parentView.removeView(cardView);
+ });
+
+ ImageButton shareDocDetailsButton = (ImageButton) claiCardView.findViewById(R.id.clai_share_button);
+ shareDocDetailsButton.setOnClickListener(buttonView -> {
+ shareDocDetails(documentDetails);
+ });
+
+ // ADD CARD VIEW TO MAIN VIEW
+ addInfoCardSectionLayout.addView(claiCardView);
+ }
+
+ // SHARE DOCUMENT DETAILS
+ private void shareDocDetails(DocumentDetails documentDetails) {
+ Intent sharingIntent = new Intent(Intent.ACTION_SEND);
+ // TYPE OF THE CONTENT TO BE SHARED
+ sharingIntent.setType("text/plain");
+
+ // BODY OF THE CONTENT
+ String shareBody = documentDetails.getDocName() + " : " + documentDetails.getDocId();
+
+ // SUBJECT OF THE CONTENT. YOU CAN SHARE ANYTHING
+ String shareSubject = "Sharing " + documentDetails.getDocName() + " details";
+
+ // PASSING BODY OF THE CONTENT
+ sharingIntent.putExtra(Intent.EXTRA_TEXT, shareBody);
+
+ // PASSING SUBJECT OF THE CONTENT
+ sharingIntent.putExtra(Intent.EXTRA_SUBJECT, shareSubject);
+ startActivity(Intent.createChooser(sharingIntent, "Share using"));
+ }
+
+ // OPEN DOCUMENT IMAGE
+ private void openDocImageDialog(TextView tvDocumentImageString) {
+ // INITIALIZE ALERT BOX
+ AlertDialog.Builder docImageDialogBox = new AlertDialog.Builder(EditProfileDynamicActivity.this);
+
+ // INFLATE CUSTOM DIALOG BOX
+ View dialogView = getLayoutInflater().inflate(R.layout.dialog_layout_view_doc_image, null);
+
+ // INITIALIZE DIALOG BOX BUTTONS & VIEWS
+ ImageView ivDocImage = (ImageView) dialogView.findViewById(R.id.dlvdi_doc_img);
+ Bitmap docImageBmp = LocalBase64Util.decodeBase64StringToImage(tvDocumentImageString.getText().toString());
+ ivDocImage.setImageBitmap(docImageBmp);
+
+ Button dialogCloseBtn = (Button) dialogView.findViewById(R.id.dlvdi_btn_close);
+
+ // ALERT DIALOG BOX SETTINGS
+ docImageDialogBox.setView(dialogView);
+ AlertDialog addDocImageDialog = docImageDialogBox.create();
+ addDocImageDialog.setCanceledOnTouchOutside(false);
+
+ // DIALOG CLOSE BUTTON ACTION
+ dialogCloseBtn.setOnClickListener(view -> {
+ addDocImageDialog.dismiss();
+ });
+ addDocImageDialog.show();
+ }
+
+ // ADD NEW DOCUMENT
+ private void addDocument() {
+ // INITIALIZE ALERT BOX
+ AlertDialog.Builder addDocDetailsDialogBox = new AlertDialog.Builder(EditProfileDynamicActivity.this);
+
+ // INFLATE CUSTOM DIALOG BOX
+ View dialogView = getLayoutInflater().inflate(R.layout.dialog_layout_add_doc, null);
+
+ // INITIALIZE DIALOG BOX BUTTONS & EDIT TEXT BOXES
+ EditText edtDocName = (EditText) dialogView.findViewById(R.id.dlad_edtxt_doc_name);
+ EditText edtDocId = (EditText) dialogView.findViewById(R.id.dlad_edtxt_doc_id);
+ Button dialogOkayBtn = (Button) dialogView.findViewById(R.id.dlad_btn_okay);
+ Button dialogCancelBtn = (Button) dialogView.findViewById(R.id.dlad_btn_cancel);
+
+ // INITIALIZE IMAGE VIEWS & DOC UPLOAD BUTTON
+ ivDocImage = (ImageView) dialogView.findViewById(R.id.dlad_doc_img);
+ ImageButton ivDocImageUploadButton = (ImageButton) dialogView.findViewById(R.id.dlad_upload_doc_img_button);
+ ivDocImageUploadButton.setOnClickListener(v -> {
+ selectPicType = SELECT_DOCUMENT_PIC;
+ showCameraGallerySelectorDialogBox();
+ });
+ // SHOW ALERT DIALOG BOX
+ addDocDetailsDialogBox.setView(dialogView);
+ AlertDialog addDocDialog = addDocDetailsDialogBox.create();
+ addDocDialog.setCanceledOnTouchOutside(false);
+
+ // DIALOG CANCEL BUTTON ACTION
+ dialogCancelBtn.setOnClickListener(view -> {
+ addDocDialog.dismiss();
+ });
+
+ // DIALOG OKAY BUTTON ACTION
+ dialogOkayBtn.setOnClickListener(view -> {
+ addDocumentCardSection(edtDocName, edtDocId);
+ addDocDialog.dismiss();
+ });
+ addDocDialog.show();
+ }
+
+ // ADD NEW DOCUMENT CARD VIEW
+ private void addDocumentCardSection(EditText edtDocName, EditText edtDocId) {
+ // GENERATE DYNAMIC LAYOUT
+ LayoutInflater layoutInflater = (LayoutInflater) getBaseContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+
+ // USE card_layout_add_info.xml TO CREATE LAYOUT
+ CardView claiCardView = (CardView) layoutInflater.inflate(R.layout.card_layout_add_info, null);
+ TextView tvDocumentName = (TextView) claiCardView.findViewById(R.id.clai_doc_name);
+ tvDocumentName.setText(edtDocName.getText());
+ EditText edtDocumentName = (EditText) claiCardView.findViewById(R.id.clai_edtxt_doc_id);
+ edtDocumentName.setText(edtDocId.getText());
+ TextView tvDocImageString = (TextView) claiCardView.findViewById(R.id.clai_doc_encoded_image);
+ tvDocImageString.setText(docImageBase64String);
+ if (!edtDocName.getText().toString().isEmpty()) {
+ ++viewTagCounter;
+ tvDocumentName.setTag("TAG_" + viewTagCounter + "_TVDC");
+ edtDocumentName.setTag("TAG_" + viewTagCounter + "_EDID");
+ tvDocImageString.setTag("TAG_" + viewTagCounter + "_TVDIMG");
+
+ // ADD CARD VIEW TO MAIN VIEW
+ addInfoCardSectionLayout.addView(claiCardView);
+ }
+ }
+
+ // CHOOSE GALLERY OR CAMERA
+ private void showCameraGallerySelectorDialogBox() {
+ String[] options = {"Camera", "Gallery"};
+ android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(this);
+ builder.setTitle("Pick Image From");
+ builder.setItems(options, (dialog, which) -> {
+ // if access is not given then we will request for permission
+ if (which == 0) {
+ if (!checkCameraPermission()) {
+ requestCameraPermission();
+ } else {
+ pickFromCamera();
+ }
+ } else if (which == 1) {
+ if (!checkStoragePermission()) {
+ requestStoragePermission();
+ } else {
+ pickFromGallery();
+ }
+ }
+ });
+ builder.create().show();
+ }
+
+ // CHECK IF PERMISSION TO ACCESS CAMERA EXISTS
+ private boolean checkCameraPermission() {
+ boolean result = ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA) == (PackageManager.PERMISSION_GRANTED);
+ boolean result1 = ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) == (PackageManager.PERMISSION_GRANTED);
+ return result && result1;
+ }
+
+ // REQUEST PERMISSION TO ACCESS CAMERA
+ private void requestCameraPermission() {
+ requestPermissions(cameraPermission, CAMERA_REQUEST);
+ }
+
+ // CHECK IF PERMISSION TO ACCESS INTERNAL STORAGE EXISTS
+ private boolean checkStoragePermission() {
+ return ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) == (PackageManager.PERMISSION_GRANTED);
+ }
+
+ // REQUEST PERMISSION TO ACCESS INTERNAL STORAGE
+ private void requestStoragePermission() {
+ requestPermissions(storagePermission, STORAGE_REQUEST);
+ }
+
+ // TO CHECK IF PERMISSIONS REQUESTED IS GRANTED OR NOT
+ @Override
+ public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
+ super.onRequestPermissionsResult(requestCode, permissions, grantResults);
+ switch (requestCode) {
+ case CAMERA_REQUEST: {
+ if (grantResults.length > 0) {
+ boolean cameraAccepted = grantResults[0] == PackageManager.PERMISSION_GRANTED;
+ boolean writeStorageAccepted = grantResults[1] == PackageManager.PERMISSION_GRANTED;
+ if (cameraAccepted && writeStorageAccepted) {
+ pickFromCamera();
+ } else {
+ Toast.makeText(this, "Please Enable Camera and Storage Permissions", Toast.LENGTH_LONG).show();
+ }
+ }
+ }
+ break;
+ case STORAGE_REQUEST: {
+ if (grantResults.length > 0) {
+ boolean writeStorageAccepted = grantResults[0] == PackageManager.PERMISSION_GRANTED;
+ if (writeStorageAccepted) {
+ pickFromGallery();
+ } else {
+ Toast.makeText(this, "Please Enable Storage Permissions", Toast.LENGTH_LONG).show();
+ }
+ }
+ }
+ break;
+ }
+ }
+
+ // TAKE A PHOTO FROM PHONE CAMERA
+ private void pickFromCamera() {
+ ContentValues contentValues = new ContentValues();
+ contentValues.put(MediaStore.Images.Media.TITLE, "Temp_pic");
+ contentValues.put(MediaStore.Images.Media.DESCRIPTION, "Temp Description");
+ imageUri = this.getContentResolver().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, contentValues);
+ Intent cameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
+ cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, imageUri);
+ startActivityForResult(cameraIntent, IMAGE_PICKCAMERA_REQUEST);
+ }
+
+ // TAKE A PHOTO FROM GALLERY
+ private void pickFromGallery() {
+ Intent galleryIntent = new Intent();
+ galleryIntent.setType("image/*");
+ galleryIntent.setAction(Intent.ACTION_GET_CONTENT);
+ startActivityForResult(Intent.createChooser(galleryIntent, "Select file"), IMAGEPICK_GALLERY_REQUEST);
+ }
+
+ // ON SELECTION OF A PHOTO
+ @Override
+ public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
+ if (resultCode == Activity.RESULT_OK && selectPicType.equals(SELECT_PROFILE_PIC)) {
+ if (requestCode == IMAGEPICK_GALLERY_REQUEST) {
+ imageUri = data.getData();
+ uploadProfileCoverPhoto(imageUri);
+ }
+ if (requestCode == IMAGE_PICKCAMERA_REQUEST && savedState != null) {
+ uploadProfileCoverPhoto((Uri) savedState.getParcelable("imageUri"));
+ }
+ } else if (resultCode == Activity.RESULT_OK && selectPicType.equals(SELECT_DOCUMENT_PIC)) {
+ if (requestCode == IMAGEPICK_GALLERY_REQUEST) {
+ imageUri = data.getData();
+ uploadDocumentPicture(imageUri);
+ }
+ if (requestCode == IMAGE_PICKCAMERA_REQUEST && savedState != null) {
+ uploadDocumentPicture((Uri) savedState.getParcelable("imageUri"));
+ }
+ }
+ super.onActivityResult(requestCode, resultCode, data);
+ }
+
+ // UPLOAD PROFILE PICTURE
+ private void uploadProfileCoverPhoto(Uri imageUri) {
+ InputStream imageStream = null;
+ if (imageUri != null) {
+ try {
+ imageStream = this.getContentResolver().openInputStream(imageUri);
+ Bitmap bitmapImage = BitmapFactory.decodeStream(imageStream);
+ profilePic.setImageBitmap(bitmapImage);
+ } catch (IOException e) {
+ Toast.makeText(this, e.getMessage(), Toast.LENGTH_LONG).show();
+ }
+ }
+ }
+
+ // UPLOAD DOCUMENT IMAGE
+ private void uploadDocumentPicture(Uri imageUri) {
+ InputStream imageStream = null;
+ if (imageUri != null) {
+ try {
+ imageStream = this.getContentResolver().openInputStream(imageUri);
+ Bitmap bitmapImage = BitmapFactory.decodeStream(imageStream);
+ ivDocImage.setImageBitmap(bitmapImage);
+ docImageBase64String = LocalBase64Util.encodeImageToBase64String(bitmapImage);
+ } catch (IOException e) {
+ Toast.makeText(this, e.getMessage(), Toast.LENGTH_LONG).show();
+ }
+ }
+ }
+
+ // SAVING STATE FOR WHEN APP SWITCHES TO CAMERA SO THAT IMAGE UR CAN BE FETCHED
+ @Override
+ public void onSaveInstanceState(Bundle instanceData) {
+ super.onSaveInstanceState(instanceData);
+ instanceData.putParcelable("imageUri", imageUri);
+ savedState = instanceData;
+ }
+
+}
diff --git a/app/src/main/java/appcom/example/regsplashscreen/SignUpScreenDynamicActivity.java b/app/src/main/java/appcom/example/regsplashscreen/SignUpScreenDynamicActivity.java
index 88be8d3..e93981d 100644
--- a/app/src/main/java/appcom/example/regsplashscreen/SignUpScreenDynamicActivity.java
+++ b/app/src/main/java/appcom/example/regsplashscreen/SignUpScreenDynamicActivity.java
@@ -1,422 +1,422 @@
-package appcom.example.regsplashscreen;
-
-import android.Manifest;
-import android.app.Activity;
-import android.app.ProgressDialog;
-import android.content.ContentValues;
-import android.content.Context;
-import android.content.Intent;
-import android.content.pm.PackageManager;
-import android.graphics.Bitmap;
-import android.graphics.BitmapFactory;
-import android.net.Uri;
-import android.os.Bundle;
-import android.provider.MediaStore;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.Button;
-import android.widget.EditText;
-import android.widget.ImageButton;
-import android.widget.ImageView;
-import android.widget.LinearLayout;
-import android.widget.TextView;
-import android.widget.Toast;
-
-import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
-import androidx.appcompat.app.AlertDialog;
-import androidx.appcompat.app.AppCompatActivity;
-import androidx.cardview.widget.CardView;
-import androidx.core.content.ContextCompat;
-
-import com.google.firebase.auth.FirebaseAuth;
-import com.google.firebase.database.FirebaseDatabase;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Objects;
-
-import appcom.example.regsplashscreen.model.DocumentDetails;
-import appcom.example.regsplashscreen.model.User;
-import appcom.example.regsplashscreen.util.LocalBase64Util;
-
-public class SignUpScreenDynamicActivity extends AppCompatActivity {
-
- private LinearLayout addInfoCardSectionLayout;
- private int viewTagCounter = 0;
- private ProgressDialog progressDialog;
- private FirebaseAuth mAuth;
- private String[] cameraPermission;
- private String[] storagePermission;
- private Uri imageUri;
- private String base64EncodedImage = null;
- private ImageView profilePic;
- private Bundle savedState;
- // private final List documentDetailsList = new ArrayList<>();
- private String selectPicType;
- private ImageView ivDocImage;
- private String docImageBase64String = null;
-
- private static final int CAMERA_REQUEST = 100;
- private static final int STORAGE_REQUEST = 200;
- private static final int IMAGEPICK_GALLERY_REQUEST = 300;
- private static final int IMAGE_PICKCAMERA_REQUEST = 400;
- private static final String SELECT_PROFILE_PIC = "Select Profile pic";
- private static final String SELECT_DOCUMENT_PIC = "Select Document pic";
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_sign_up_dynamic_screen);
- addInfoCardSectionLayout = (LinearLayout) findViewById(R.id.sud_add_info_card_section);
-
- // INITIALIZE PROGRESS DIALOG BOX
- progressDialog = new ProgressDialog(SignUpScreenDynamicActivity.this);
- progressDialog.setTitle("Creating Account");
- progressDialog.setMessage("Creating Account");
-
- // INITIALIZE BUTTONS
- Button addDocumentButton = findViewById(R.id.sud_add_doc_button);
- Button signUpButton = findViewById(R.id.sud_sign_up_button);
- ImageButton editProfilePicButton = findViewById(R.id.sud_edit_profile_pic_button);
-
- // INITIALIZE VIEW ELEMENTS
- EditText edtEmailId = findViewById(R.id.sud_edtxt_email_id);
- EditText edtPassword = findViewById(R.id.sud_edtxt_password);
- EditText edtUserName = findViewById(R.id.sud_edtxt_username);
- EditText edtDOB = findViewById(R.id.sud_edtxt_dob);
-
- profilePic = findViewById(R.id.sud_profile_pic);
-
- // FIREBASE DETAILS
- FirebaseDatabase mDatabase = FirebaseDatabase.getInstance();
- mAuth = FirebaseAuth.getInstance();
-
- cameraPermission = new String[]{Manifest.permission.CAMERA, Manifest.permission.WRITE_EXTERNAL_STORAGE};
- storagePermission = new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE};
-
- // ADD DOCUMENT BUTTON ACTION
- addDocumentButton.setOnClickListener(view -> {
- addDocument();
- });
-
- // EDIT PROFILE PIC BUTTON
- editProfilePicButton.setOnClickListener(v -> {
- selectPicType = SELECT_PROFILE_PIC;
- showCameraGallerySelectorDialogBox();
- });
-
- // SIGN UP BUTTON ACTION
- signUpButton.setOnClickListener(view -> {
- progressDialog.show();
- mAuth.createUserWithEmailAndPassword(edtEmailId.getText().toString(), edtPassword.getText().toString()).addOnCompleteListener(task -> {
- if (task.isSuccessful()) {
- // STORE USER DETAILS IN MODEL
- User user = User.Builder.newInstance()
- .setUid(mAuth.getUid())
- .setUserName(edtUserName.getText().toString())
- .setEmailId(edtEmailId.getText().toString())
- .setDob(edtDOB.getText().toString())
- .setEncodedImage(base64EncodedImage)
- .setDocumentDetailsList(fetchDocumentDetails())
- .setUserActive("Y")
- .setUserAdmin("N")
- .build();
- String userId = Objects.requireNonNull(Objects.requireNonNull(task.getResult()).getUser()).getUid();
- // SET VALUE IN DATABASE
- mDatabase.getReference().child("users").child(userId).setValue(user);
- progressDialog.dismiss();
- // SWITCH TO SIGN IN SCREEN ONCE USER IS REGISTERED IN THE DATABASE
- Intent intent = new Intent(getApplicationContext(), SignInScreenActivity.class);
- startActivity(intent);
- Toast.makeText(SignUpScreenDynamicActivity.this, "User signed up successfully", Toast.LENGTH_LONG).show();
- } else
- Toast.makeText(SignUpScreenDynamicActivity.this, Objects.requireNonNull(task.getException()).getMessage(), Toast.LENGTH_LONG).show();
- });
- });
- }
-
- // GATHER UP DOC DETAILS FROM SCREEN
- private List fetchDocumentDetails() {
- List documentDetails = new ArrayList<>();
- for(int i = 1; i <= viewTagCounter; i++) {
- TextView docName = (TextView) addInfoCardSectionLayout.findViewWithTag("TAG_"+i+"_TVDC");
- if (null != docName) {
- EditText docId = (EditText) addInfoCardSectionLayout.findViewWithTag("TAG_"+i+"_EDID");
- TextView docImageString = (TextView) addInfoCardSectionLayout.findViewWithTag("TAG_"+i+"_TVDIMG");
- documentDetails.add(DocumentDetails.Builder.newInstance()
- .setDocName(docName.getText().toString())
- .setDocId(null != docId.getText() ? docId.getText().toString() : null)
- .setDocEncodedImage(null != docImageString.getText() ? docImageString.getText().toString() : null)
- .build());
- }
- }
- return documentDetails;
- }
-
- // ADD DOCUMENT DIALOG BOX
- private void addDocument() {
- // INITIALIZE ALERT BOX
- AlertDialog.Builder addDocDetailsDialogBox = new AlertDialog.Builder(SignUpScreenDynamicActivity.this);
-
- // INFLATE CUSTOM DIALOG BOX
- View dialogView = getLayoutInflater().inflate(R.layout.dialog_layout_add_doc, null);
-
- // INITIALIZE DIALOG BOX BUTTONS & EDIT TEXT BOXES
- EditText edtDocName = (EditText) dialogView.findViewById(R.id.dlad_edtxt_doc_name);
- EditText edtDocId = (EditText) dialogView.findViewById(R.id.dlad_edtxt_doc_id);
- Button dialogOkayBtn = (Button) dialogView.findViewById(R.id.dlad_btn_okay);
- Button dialogCancelBtn = (Button) dialogView.findViewById(R.id.dlad_btn_cancel);
-
- // INITIALIZE IMAGE VIEWS & DOC UPLOAD BUTTON
- ivDocImage = (ImageView) dialogView.findViewById(R.id.dlad_doc_img);
- ImageButton ivDocImageUploadButton = (ImageButton) dialogView.findViewById(R.id.dlad_upload_doc_img_button);
- ivDocImageUploadButton.setOnClickListener(v -> {
- selectPicType = SELECT_DOCUMENT_PIC;
- showCameraGallerySelectorDialogBox();
- });
-
- // SHOW ALERT DIALOG BOX
- addDocDetailsDialogBox.setView(dialogView);
- AlertDialog addDocDialog = addDocDetailsDialogBox.create();
- addDocDialog.setCanceledOnTouchOutside(false);
-
- // DIALOG CANCEL BUTTON ACTION
- dialogCancelBtn.setOnClickListener(view -> {
- addDocDialog.dismiss();
- });
-
- // DIALOG OKAY BUTTON ACTION
- dialogOkayBtn.setOnClickListener(view -> {
- addDocumentCardSection(edtDocName, edtDocId);
- addDocDialog.dismiss();
- });
- addDocDialog.show();
- }
-
- // ADD DOCUMENT CARD SECTION
- private void addDocumentCardSection(EditText edtDocName, EditText edtDocId) {
- // GENERATE DYNAMIC LAYOUT
- LayoutInflater layoutInflater = (LayoutInflater) getBaseContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
-
- // USE card_layout_add_info.xml TO CREATE LAYOUT
- CardView claiCardView = (CardView) layoutInflater.inflate(R.layout.card_layout_add_info, null);
- TextView tvDocumentName = (TextView) claiCardView.findViewById(R.id.clai_doc_name);
- tvDocumentName.setText(edtDocName.getText());
- EditText edtDocumentName = (EditText) claiCardView.findViewById(R.id.clai_edtxt_doc_id);
- edtDocumentName.setText(edtDocId.getText());
- TextView tvDocImageString = (TextView) claiCardView.findViewById(R.id.clai_doc_encoded_image);
- tvDocImageString.setText(docImageBase64String);
-
- // INITIALIZE IMAGE BUTTONS
- ImageButton viewDocImageButton = (ImageButton) claiCardView.findViewById(R.id.clai_view_doc_button);
- viewDocImageButton.setOnClickListener(buttonView -> {
- openDocImageDialog(tvDocImageString);
- });
-
- ImageButton deleteCardButton = (ImageButton) claiCardView.findViewById(R.id.clai_delete_card_button);
- deleteCardButton.setOnClickListener(buttonView -> {
- ViewGroup cardView = (ViewGroup) buttonView.getParent().getParent().getParent();
- ViewGroup parentView = (ViewGroup) cardView.getParent();
- parentView.removeView(cardView);
- });
-
- ImageButton shareDocDetailsButton = (ImageButton) claiCardView.findViewById(R.id.clai_share_button);
- shareDocDetailsButton.setVisibility(View.GONE);
-
- if(!edtDocName.getText().toString().isEmpty()) {
- ++viewTagCounter;
- tvDocumentName.setTag("TAG_" +viewTagCounter+"_TVDC");
- edtDocumentName.setTag("TAG_" +viewTagCounter+"_EDID");
- tvDocImageString.setTag("TAG_" +viewTagCounter+"_TVDIMG");
-
- // ADD CARD VIEW TO MAIN VIEW
- addInfoCardSectionLayout.addView(claiCardView);
- }
- }
-
- private void openDocImageDialog(TextView tvDocImageString) {
- // INITIALIZE ALERT BOX
- AlertDialog.Builder docImageDialogBox = new AlertDialog.Builder(SignUpScreenDynamicActivity.this);
-
- // INFLATE CUSTOM DIALOG BOX
- View dialogView = getLayoutInflater().inflate(R.layout.dialog_layout_view_doc_image, null);
-
- // INITIALIZE DIALOG BOX BUTTONS & VIEWS
- ImageView ivDocImage = (ImageView) dialogView.findViewById(R.id.dlvdi_doc_img);
- Bitmap docImageBmp = LocalBase64Util.decodeBase64StringToImage(tvDocImageString.getText().toString());
- ivDocImage.setImageBitmap(docImageBmp);
-
- Button dialogCloseBtn = (Button) dialogView.findViewById(R.id.dlvdi_btn_close);
-
- // ALERT DIALOG BOX SETTINGS
- docImageDialogBox.setView(dialogView);
- AlertDialog addDocImageDialog = docImageDialogBox.create();
- addDocImageDialog.setCanceledOnTouchOutside(false);
-
- // DIALOG CLOSE BUTTON ACTION
- dialogCloseBtn.setOnClickListener(view -> {
- addDocImageDialog.dismiss();
- });
- addDocImageDialog.show();
- }
-
- // CAMERA/GALLERY SELECTOR DIALOG BOX
- private void showCameraGallerySelectorDialogBox() {
- String[] options = {"Camera", "Gallery"};
- android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(this);
- builder.setTitle("Pick Image From");
- builder.setItems(options, (dialog, which) -> {
- // if access is not given then we will request for permission
- if (which == 0) {
- if (!checkCameraPermission()) {
- requestCameraPermission();
- } else {
- pickFromCamera();
- }
- } else if (which == 1) {
- if (!checkStoragePermission()) {
- requestStoragePermission();
- } else {
- pickFromGallery();
- }
- }
- });
- builder.create().show();
- }
-
- // CHECK IF PERMISSION TO ACCESS CAMERA EXISTS
- private boolean checkCameraPermission() {
- boolean result = ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA) == (PackageManager.PERMISSION_GRANTED);
- boolean result1 = ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) == (PackageManager.PERMISSION_GRANTED);
- return result && result1;
- }
-
- // REQUEST PERMISSION TO ACCESS CAMERA
- private void requestCameraPermission() {
- requestPermissions(cameraPermission, CAMERA_REQUEST);
- }
-
- // CHECK IF PERMISSION TO ACCESS INTERNAL STORAGE EXISTS
- private boolean checkStoragePermission() {
- return ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) == (PackageManager.PERMISSION_GRANTED);
- }
-
- // REQUEST PERMISSION TO ACCESS INTERNAL STORAGE
- private void requestStoragePermission() { requestPermissions(storagePermission, STORAGE_REQUEST); }
-
- // TO CHECK IF PERMISSIONS REQUESTED IS GRANTED OR NOT
- @Override
- public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
- super.onRequestPermissionsResult(requestCode, permissions, grantResults);
- switch (requestCode) {
- case CAMERA_REQUEST: {
- if (grantResults.length > 0) {
- boolean cameraAccepted = grantResults[0] == PackageManager.PERMISSION_GRANTED;
- boolean writeStorageAccepted = grantResults[1] == PackageManager.PERMISSION_GRANTED;
- if (cameraAccepted && writeStorageAccepted) {
- pickFromCamera();
- } else {
- Toast.makeText(this, "Please Enable Camera and Storage Permissions", Toast.LENGTH_LONG).show();
- }
- }
- }
- break;
- case STORAGE_REQUEST: {
- if (grantResults.length > 0) {
- boolean writeStorageAccepted = grantResults[0] == PackageManager.PERMISSION_GRANTED;
- if (writeStorageAccepted) {
- pickFromGallery();
- } else {
- Toast.makeText(this, "Please Enable Storage Permissions", Toast.LENGTH_LONG).show();
- }
- }
- }
- break;
- }
- }
-
- // TAKE A PHOTO FROM PHONE CAMERA
- private void pickFromCamera() {
- ContentValues contentValues = new ContentValues();
- contentValues.put(MediaStore.Images.Media.TITLE, "Temp_pic");
- contentValues.put(MediaStore.Images.Media.DESCRIPTION, "Temp Description");
- imageUri = this.getContentResolver().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, contentValues);
- Intent cameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
- cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, imageUri);
- startActivityForResult(cameraIntent, IMAGE_PICKCAMERA_REQUEST);
- }
-
- // TAKE A PHOTO FROM GALLERY
- private void pickFromGallery() {
- Intent galleryIntent = new Intent();
- galleryIntent.setType("image/*");
- galleryIntent.setAction(Intent.ACTION_GET_CONTENT);
- startActivityForResult(Intent.createChooser(galleryIntent, "Select file"), IMAGEPICK_GALLERY_REQUEST);
- }
-
- // ON SELECTION OF A PHOTO
- @Override
- public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
- if (resultCode == Activity.RESULT_OK && selectPicType.equals(SELECT_PROFILE_PIC)) {
- if (requestCode == IMAGEPICK_GALLERY_REQUEST) {
- imageUri = data.getData();
- uploadProfileCoverPhoto(imageUri);
- }
- if (requestCode == IMAGE_PICKCAMERA_REQUEST && savedState != null) {
- uploadProfileCoverPhoto((Uri) savedState.getParcelable("imageUri"));
- }
- } else if (resultCode == Activity.RESULT_OK && selectPicType.equals(SELECT_DOCUMENT_PIC)) {
- if (requestCode == IMAGEPICK_GALLERY_REQUEST) {
- imageUri = data.getData();
- uploadDocumentPicture(imageUri);
- }
- if (requestCode == IMAGE_PICKCAMERA_REQUEST && savedState != null) {
- uploadDocumentPicture((Uri) savedState.getParcelable("imageUri"));
- }
- }
- super.onActivityResult(requestCode, resultCode, data);
- }
-
- // UPLOAD IMAGE
- private void uploadProfileCoverPhoto(Uri imageUri) {
- InputStream imageStream = null;
- if (imageUri != null) {
- try {
- imageStream = this.getContentResolver().openInputStream(imageUri);
- Bitmap bitmapImage = BitmapFactory.decodeStream(imageStream);
- profilePic.setImageBitmap(bitmapImage);
- base64EncodedImage = LocalBase64Util.encodeImageToBase64String(bitmapImage);
- } catch (IOException e) {
- Toast.makeText(this, e.getMessage(), Toast.LENGTH_LONG).show();
- }
- }
- }
-
- // UPLOAD DOCUMENT IMAGE
- private void uploadDocumentPicture(Uri imageUri) {
- InputStream imageStream = null;
- if (imageUri != null) {
- try {
- imageStream = this.getContentResolver().openInputStream(imageUri);
- Bitmap bitmapImage = BitmapFactory.decodeStream(imageStream);
- ivDocImage.setImageBitmap(bitmapImage);
- docImageBase64String = LocalBase64Util.encodeImageToBase64String(bitmapImage);
- } catch (IOException e) {
- Toast.makeText(this, e.getMessage(), Toast.LENGTH_LONG).show();
- }
- }
- }
-
- // SAVING STATE FOR WHEN APP SWITCHES TO CAMERA SO THAT IMAGE UR CAN BE FETCHED
- @Override
- public void onSaveInstanceState(Bundle instanceData) {
- super.onSaveInstanceState(instanceData);
- instanceData.putParcelable("imageUri", imageUri);
- savedState = instanceData;
- }
-
-}
+package appcom.example.regsplashscreen;
+
+import android.Manifest;
+import android.app.Activity;
+import android.app.ProgressDialog;
+import android.content.ContentValues;
+import android.content.Context;
+import android.content.Intent;
+import android.content.pm.PackageManager;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import android.net.Uri;
+import android.os.Bundle;
+import android.provider.MediaStore;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.ImageButton;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.appcompat.app.AlertDialog;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.cardview.widget.CardView;
+import androidx.core.content.ContextCompat;
+
+import com.google.firebase.auth.FirebaseAuth;
+import com.google.firebase.database.FirebaseDatabase;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+
+import appcom.example.regsplashscreen.model.DocumentDetails;
+import appcom.example.regsplashscreen.model.User;
+import appcom.example.regsplashscreen.util.LocalBase64Util;
+
+public class SignUpScreenDynamicActivity extends AppCompatActivity {
+
+ private LinearLayout addInfoCardSectionLayout;
+ private int viewTagCounter = 0;
+ private ProgressDialog progressDialog;
+ private FirebaseAuth mAuth;
+ private String[] cameraPermission;
+ private String[] storagePermission;
+ private Uri imageUri;
+ private String base64EncodedImage = null;
+ private ImageView profilePic;
+ private Bundle savedState;
+ // private final List documentDetailsList = new ArrayList<>();
+ private String selectPicType;
+ private ImageView ivDocImage;
+ private String docImageBase64String = null;
+
+ private static final int CAMERA_REQUEST = 100;
+ private static final int STORAGE_REQUEST = 200;
+ private static final int IMAGEPICK_GALLERY_REQUEST = 300;
+ private static final int IMAGE_PICKCAMERA_REQUEST = 400;
+ private static final String SELECT_PROFILE_PIC = "Select Profile pic";
+ private static final String SELECT_DOCUMENT_PIC = "Select Document pic";
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_sign_up_dynamic_screen);
+ addInfoCardSectionLayout = (LinearLayout) findViewById(R.id.sud_add_info_card_section);
+
+ // INITIALIZE PROGRESS DIALOG BOX
+ progressDialog = new ProgressDialog(SignUpScreenDynamicActivity.this);
+ progressDialog.setTitle("Creating Account");
+ progressDialog.setMessage("Creating Account");
+
+ // INITIALIZE BUTTONS
+ Button addDocumentButton = findViewById(R.id.sud_add_doc_button);
+ Button signUpButton = findViewById(R.id.sud_sign_up_button);
+ ImageButton editProfilePicButton = findViewById(R.id.sud_edit_profile_pic_button);
+
+ // INITIALIZE VIEW ELEMENTS
+ EditText edtEmailId = findViewById(R.id.sud_edtxt_email_id);
+ EditText edtPassword = findViewById(R.id.sud_edtxt_password);
+ EditText edtUserName = findViewById(R.id.sud_edtxt_username);
+ EditText edtDOB = findViewById(R.id.sud_edtxt_dob);
+
+ profilePic = findViewById(R.id.sud_profile_pic);
+
+ // FIREBASE DETAILS
+ FirebaseDatabase mDatabase = FirebaseDatabase.getInstance();
+ mAuth = FirebaseAuth.getInstance();
+
+ cameraPermission = new String[]{Manifest.permission.CAMERA, Manifest.permission.WRITE_EXTERNAL_STORAGE};
+ storagePermission = new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE};
+
+ // ADD DOCUMENT BUTTON ACTION
+ addDocumentButton.setOnClickListener(view -> {
+ addDocument();
+ });
+
+ // EDIT PROFILE PIC BUTTON
+ editProfilePicButton.setOnClickListener(v -> {
+ selectPicType = SELECT_PROFILE_PIC;
+ showCameraGallerySelectorDialogBox();
+ });
+
+ // SIGN UP BUTTON ACTION
+ signUpButton.setOnClickListener(view -> {
+ progressDialog.show();
+ mAuth.createUserWithEmailAndPassword(edtEmailId.getText().toString(), edtPassword.getText().toString()).addOnCompleteListener(task -> {
+ if (task.isSuccessful()) {
+ // STORE USER DETAILS IN MODEL
+ User user = User.Builder.newInstance()
+ .setUid(mAuth.getUid())
+ .setUserName(edtUserName.getText().toString())
+ .setEmailId(edtEmailId.getText().toString())
+ .setDob(edtDOB.getText().toString())
+ .setEncodedImage(base64EncodedImage)
+ .setDocumentDetailsList(fetchDocumentDetails())
+ .setUserActive("Y")
+ .setUserAdmin("N")
+ .build();
+ String userId = Objects.requireNonNull(Objects.requireNonNull(task.getResult()).getUser()).getUid();
+ // SET VALUE IN DATABASE
+ mDatabase.getReference().child("users").child(userId).setValue(user);
+ progressDialog.dismiss();
+ // SWITCH TO SIGN IN SCREEN ONCE USER IS REGISTERED IN THE DATABASE
+ Intent intent = new Intent(getApplicationContext(), SignInScreenActivity.class);
+ startActivity(intent);
+ Toast.makeText(SignUpScreenDynamicActivity.this, "User signed up successfully", Toast.LENGTH_LONG).show();
+ } else
+ Toast.makeText(SignUpScreenDynamicActivity.this, Objects.requireNonNull(task.getException()).getMessage(), Toast.LENGTH_LONG).show();
+ });
+ });
+ }
+
+ // GATHER UP DOC DETAILS FROM SCREEN
+ private List fetchDocumentDetails() {
+ List documentDetails = new ArrayList<>();
+ for(int i = 1; i <= viewTagCounter; i++) {
+ TextView docName = (TextView) addInfoCardSectionLayout.findViewWithTag("TAG_"+i+"_TVDC");
+ if (null != docName) {
+ EditText docId = (EditText) addInfoCardSectionLayout.findViewWithTag("TAG_"+i+"_EDID");
+ TextView docImageString = (TextView) addInfoCardSectionLayout.findViewWithTag("TAG_"+i+"_TVDIMG");
+ documentDetails.add(DocumentDetails.Builder.newInstance()
+ .setDocName(docName.getText().toString())
+ .setDocId(null != docId.getText() ? docId.getText().toString() : null)
+ .setDocEncodedImage(null != docImageString.getText() ? docImageString.getText().toString() : null)
+ .build());
+ }
+ }
+ return documentDetails;
+ }
+
+ // ADD DOCUMENT DIALOG BOX
+ private void addDocument() {
+ // INITIALIZE ALERT BOX
+ AlertDialog.Builder addDocDetailsDialogBox = new AlertDialog.Builder(SignUpScreenDynamicActivity.this);
+
+ // INFLATE CUSTOM DIALOG BOX
+ View dialogView = getLayoutInflater().inflate(R.layout.dialog_layout_add_doc, null);
+
+ // INITIALIZE DIALOG BOX BUTTONS & EDIT TEXT BOXES
+ EditText edtDocName = (EditText) dialogView.findViewById(R.id.dlad_edtxt_doc_name);
+ EditText edtDocId = (EditText) dialogView.findViewById(R.id.dlad_edtxt_doc_id);
+ Button dialogOkayBtn = (Button) dialogView.findViewById(R.id.dlad_btn_okay);
+ Button dialogCancelBtn = (Button) dialogView.findViewById(R.id.dlad_btn_cancel);
+
+ // INITIALIZE IMAGE VIEWS & DOC UPLOAD BUTTON
+ ivDocImage = (ImageView) dialogView.findViewById(R.id.dlad_doc_img);
+ ImageButton ivDocImageUploadButton = (ImageButton) dialogView.findViewById(R.id.dlad_upload_doc_img_button);
+ ivDocImageUploadButton.setOnClickListener(v -> {
+ selectPicType = SELECT_DOCUMENT_PIC;
+ showCameraGallerySelectorDialogBox();
+ });
+
+ // SHOW ALERT DIALOG BOX
+ addDocDetailsDialogBox.setView(dialogView);
+ AlertDialog addDocDialog = addDocDetailsDialogBox.create();
+ addDocDialog.setCanceledOnTouchOutside(false);
+
+ // DIALOG CANCEL BUTTON ACTION
+ dialogCancelBtn.setOnClickListener(view -> {
+ addDocDialog.dismiss();
+ });
+
+ // DIALOG OKAY BUTTON ACTION
+ dialogOkayBtn.setOnClickListener(view -> {
+ addDocumentCardSection(edtDocName, edtDocId);
+ addDocDialog.dismiss();
+ });
+ addDocDialog.show();
+ }
+
+ // ADD DOCUMENT CARD SECTION
+ private void addDocumentCardSection(EditText edtDocName, EditText edtDocId) {
+ // GENERATE DYNAMIC LAYOUT
+ LayoutInflater layoutInflater = (LayoutInflater) getBaseContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+
+ // USE card_layout_add_info.xml TO CREATE LAYOUT
+ CardView claiCardView = (CardView) layoutInflater.inflate(R.layout.card_layout_add_info, null);
+ TextView tvDocumentName = (TextView) claiCardView.findViewById(R.id.clai_doc_name);
+ tvDocumentName.setText(edtDocName.getText());
+ EditText edtDocumentName = (EditText) claiCardView.findViewById(R.id.clai_edtxt_doc_id);
+ edtDocumentName.setText(edtDocId.getText());
+ TextView tvDocImageString = (TextView) claiCardView.findViewById(R.id.clai_doc_encoded_image);
+ tvDocImageString.setText(docImageBase64String);
+
+ // INITIALIZE IMAGE BUTTONS
+ ImageButton viewDocImageButton = (ImageButton) claiCardView.findViewById(R.id.clai_view_doc_button);
+ viewDocImageButton.setOnClickListener(buttonView -> {
+ openDocImageDialog(tvDocImageString);
+ });
+
+ ImageButton deleteCardButton = (ImageButton) claiCardView.findViewById(R.id.clai_delete_card_button);
+ deleteCardButton.setOnClickListener(buttonView -> {
+ ViewGroup cardView = (ViewGroup) buttonView.getParent().getParent().getParent();
+ ViewGroup parentView = (ViewGroup) cardView.getParent();
+ parentView.removeView(cardView);
+ });
+
+ ImageButton shareDocDetailsButton = (ImageButton) claiCardView.findViewById(R.id.clai_share_button);
+ shareDocDetailsButton.setVisibility(View.GONE);
+
+ if(!edtDocName.getText().toString().isEmpty()) {
+ ++viewTagCounter;
+ tvDocumentName.setTag("TAG_" +viewTagCounter+"_TVDC");
+ edtDocumentName.setTag("TAG_" +viewTagCounter+"_EDID");
+ tvDocImageString.setTag("TAG_" +viewTagCounter+"_TVDIMG");
+
+ // ADD CARD VIEW TO MAIN VIEW
+ addInfoCardSectionLayout.addView(claiCardView);
+ }
+ }
+
+ private void openDocImageDialog(TextView tvDocImageString) {
+ // INITIALIZE ALERT BOX
+ AlertDialog.Builder docImageDialogBox = new AlertDialog.Builder(SignUpScreenDynamicActivity.this);
+
+ // INFLATE CUSTOM DIALOG BOX
+ View dialogView = getLayoutInflater().inflate(R.layout.dialog_layout_view_doc_image, null);
+
+ // INITIALIZE DIALOG BOX BUTTONS & VIEWS
+ ImageView ivDocImage = (ImageView) dialogView.findViewById(R.id.dlvdi_doc_img);
+ Bitmap docImageBmp = LocalBase64Util.decodeBase64StringToImage(tvDocImageString.getText().toString());
+ ivDocImage.setImageBitmap(docImageBmp);
+
+ Button dialogCloseBtn = (Button) dialogView.findViewById(R.id.dlvdi_btn_close);
+
+ // ALERT DIALOG BOX SETTINGS
+ docImageDialogBox.setView(dialogView);
+ AlertDialog addDocImageDialog = docImageDialogBox.create();
+ addDocImageDialog.setCanceledOnTouchOutside(false);
+
+ // DIALOG CLOSE BUTTON ACTION
+ dialogCloseBtn.setOnClickListener(view -> {
+ addDocImageDialog.dismiss();
+ });
+ addDocImageDialog.show();
+ }
+
+ // CAMERA/GALLERY SELECTOR DIALOG BOX
+ private void showCameraGallerySelectorDialogBox() {
+ String[] options = {"Camera", "Gallery"};
+ android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(this);
+ builder.setTitle("Pick Image From");
+ builder.setItems(options, (dialog, which) -> {
+ // if access is not given then we will request for permission
+ if (which == 0) {
+ if (!checkCameraPermission()) {
+ requestCameraPermission();
+ } else {
+ pickFromCamera();
+ }
+ } else if (which == 1) {
+ if (!checkStoragePermission()) {
+ requestStoragePermission();
+ } else {
+ pickFromGallery();
+ }
+ }
+ });
+ builder.create().show();
+ }
+
+ // CHECK IF PERMISSION TO ACCESS CAMERA EXISTS
+ private boolean checkCameraPermission() {
+ boolean result = ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA) == (PackageManager.PERMISSION_GRANTED);
+ boolean result1 = ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) == (PackageManager.PERMISSION_GRANTED);
+ return result && result1;
+ }
+
+ // REQUEST PERMISSION TO ACCESS CAMERA
+ private void requestCameraPermission() {
+ requestPermissions(cameraPermission, CAMERA_REQUEST);
+ }
+
+ // CHECK IF PERMISSION TO ACCESS INTERNAL STORAGE EXISTS
+ private boolean checkStoragePermission() {
+ return ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) == (PackageManager.PERMISSION_GRANTED);
+ }
+
+ // REQUEST PERMISSION TO ACCESS INTERNAL STORAGE
+ private void requestStoragePermission() { requestPermissions(storagePermission, STORAGE_REQUEST); }
+
+ // TO CHECK IF PERMISSIONS REQUESTED IS GRANTED OR NOT
+ @Override
+ public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
+ super.onRequestPermissionsResult(requestCode, permissions, grantResults);
+ switch (requestCode) {
+ case CAMERA_REQUEST: {
+ if (grantResults.length > 0) {
+ boolean cameraAccepted = grantResults[0] == PackageManager.PERMISSION_GRANTED;
+ boolean writeStorageAccepted = grantResults[1] == PackageManager.PERMISSION_GRANTED;
+ if (cameraAccepted && writeStorageAccepted) {
+ pickFromCamera();
+ } else {
+ Toast.makeText(this, "Please Enable Camera and Storage Permissions", Toast.LENGTH_LONG).show();
+ }
+ }
+ }
+ break;
+ case STORAGE_REQUEST: {
+ if (grantResults.length > 0) {
+ boolean writeStorageAccepted = grantResults[0] == PackageManager.PERMISSION_GRANTED;
+ if (writeStorageAccepted) {
+ pickFromGallery();
+ } else {
+ Toast.makeText(this, "Please Enable Storage Permissions", Toast.LENGTH_LONG).show();
+ }
+ }
+ }
+ break;
+ }
+ }
+
+ // TAKE A PHOTO FROM PHONE CAMERA
+ private void pickFromCamera() {
+ ContentValues contentValues = new ContentValues();
+ contentValues.put(MediaStore.Images.Media.TITLE, "Temp_pic");
+ contentValues.put(MediaStore.Images.Media.DESCRIPTION, "Temp Description");
+ imageUri = this.getContentResolver().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, contentValues);
+ Intent cameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
+ cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, imageUri);
+ startActivityForResult(cameraIntent, IMAGE_PICKCAMERA_REQUEST);
+ }
+
+ // TAKE A PHOTO FROM GALLERY
+ private void pickFromGallery() {
+ Intent galleryIntent = new Intent();
+ galleryIntent.setType("image/*");
+ galleryIntent.setAction(Intent.ACTION_GET_CONTENT);
+ startActivityForResult(Intent.createChooser(galleryIntent, "Select file"), IMAGEPICK_GALLERY_REQUEST);
+ }
+
+ // ON SELECTION OF A PHOTO
+ @Override
+ public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
+ if (resultCode == Activity.RESULT_OK && selectPicType.equals(SELECT_PROFILE_PIC)) {
+ if (requestCode == IMAGEPICK_GALLERY_REQUEST) {
+ imageUri = data.getData();
+ uploadProfileCoverPhoto(imageUri);
+ }
+ if (requestCode == IMAGE_PICKCAMERA_REQUEST && savedState != null) {
+ uploadProfileCoverPhoto((Uri) savedState.getParcelable("imageUri"));
+ }
+ } else if (resultCode == Activity.RESULT_OK && selectPicType.equals(SELECT_DOCUMENT_PIC)) {
+ if (requestCode == IMAGEPICK_GALLERY_REQUEST) {
+ imageUri = data.getData();
+ uploadDocumentPicture(imageUri);
+ }
+ if (requestCode == IMAGE_PICKCAMERA_REQUEST && savedState != null) {
+ uploadDocumentPicture((Uri) savedState.getParcelable("imageUri"));
+ }
+ }
+ super.onActivityResult(requestCode, resultCode, data);
+ }
+
+ // UPLOAD IMAGE
+ private void uploadProfileCoverPhoto(Uri imageUri) {
+ InputStream imageStream = null;
+ if (imageUri != null) {
+ try {
+ imageStream = this.getContentResolver().openInputStream(imageUri);
+ Bitmap bitmapImage = BitmapFactory.decodeStream(imageStream);
+ profilePic.setImageBitmap(bitmapImage);
+ base64EncodedImage = LocalBase64Util.encodeImageToBase64String(bitmapImage);
+ } catch (IOException e) {
+ Toast.makeText(this, e.getMessage(), Toast.LENGTH_LONG).show();
+ }
+ }
+ }
+
+ // UPLOAD DOCUMENT IMAGE
+ private void uploadDocumentPicture(Uri imageUri) {
+ InputStream imageStream = null;
+ if (imageUri != null) {
+ try {
+ imageStream = this.getContentResolver().openInputStream(imageUri);
+ Bitmap bitmapImage = BitmapFactory.decodeStream(imageStream);
+ ivDocImage.setImageBitmap(bitmapImage);
+ docImageBase64String = LocalBase64Util.encodeImageToBase64String(bitmapImage);
+ } catch (IOException e) {
+ Toast.makeText(this, e.getMessage(), Toast.LENGTH_LONG).show();
+ }
+ }
+ }
+
+ // SAVING STATE FOR WHEN APP SWITCHES TO CAMERA SO THAT IMAGE UR CAN BE FETCHED
+ @Override
+ public void onSaveInstanceState(Bundle instanceData) {
+ super.onSaveInstanceState(instanceData);
+ instanceData.putParcelable("imageUri", imageUri);
+ savedState = instanceData;
+ }
+
+}
diff --git a/app/src/main/java/appcom/example/regsplashscreen/model/DocumentDetails.java b/app/src/main/java/appcom/example/regsplashscreen/model/DocumentDetails.java
index f8dc28f..ccc62d6 100644
--- a/app/src/main/java/appcom/example/regsplashscreen/model/DocumentDetails.java
+++ b/app/src/main/java/appcom/example/regsplashscreen/model/DocumentDetails.java
@@ -1,72 +1,72 @@
-package appcom.example.regsplashscreen.model;
-
-public class DocumentDetails {
-
- private String docName;
- private String docId;
- private String docEncodedImage;
-
- private DocumentDetails() {
- }
-
- public DocumentDetails(Builder builder) {
- this.docName = builder.docName;
- this.docId = builder.docId;
- this.docEncodedImage = builder.docEncodedImage;
- }
-
- public String getDocName() {
- return docName;
- }
-
- public String getDocId() {
- return docId;
- }
-
- public String getDocEncodedImage() {
- return docEncodedImage;
- }
-
- public static class Builder {
- private String docName;
- private String docId;
- private String docEncodedImage;
-
- @Override
- public String toString() {
- return "Builder{" +
- "docName='" + docName + '\'' +
- ", docId='" + docId + '\'' +
- ", docEncodedImage='" + docEncodedImage + '\'' +
- '}';
- }
-
- private Builder() {
- }
-
- public static DocumentDetails.Builder newInstance() {
- return new DocumentDetails.Builder();
- }
-
- public DocumentDetails build() {
- return new DocumentDetails(this);
- }
-
- // SETTERS
- public Builder setDocName(String docName) {
- this.docName = docName;
- return this;
- }
-
- public Builder setDocId(String docId) {
- this.docId = docId;
- return this;
- }
-
- public Builder setDocEncodedImage(String docEncodedImage) {
- this.docEncodedImage = docEncodedImage;
- return this;
- }
- }
-
-}
+package appcom.example.regsplashscreen.model;
+
+public class DocumentDetails {
+
+ private String docName;
+ private String docId;
+ private String docEncodedImage;
+
+ private DocumentDetails() {
+ }
+
+ public DocumentDetails(Builder builder) {
+ this.docName = builder.docName;
+ this.docId = builder.docId;
+ this.docEncodedImage = builder.docEncodedImage;
+ }
+
+ public String getDocName() {
+ return docName;
+ }
+
+ public String getDocId() {
+ return docId;
+ }
+
+ public String getDocEncodedImage() {
+ return docEncodedImage;
+ }
+
+ public static class Builder {
+ private String docName;
+ private String docId;
+ private String docEncodedImage;
+
+ @Override
+ public String toString() {
+ return "Builder{" +
+ "docName='" + docName + '\'' +
+ ", docId='" + docId + '\'' +
+ ", docEncodedImage='" + docEncodedImage + '\'' +
+ '}';
+ }
+
+ private Builder() {
+ }
+
+ public static DocumentDetails.Builder newInstance() {
+ return new DocumentDetails.Builder();
+ }
+
+ public DocumentDetails build() {
+ return new DocumentDetails(this);
+ }
+
+ // SETTERS
+ public Builder setDocName(String docName) {
+ this.docName = docName;
+ return this;
+ }
+
+ public Builder setDocId(String docId) {
+ this.docId = docId;
+ return this;
+ }
+
+ public Builder setDocEncodedImage(String docEncodedImage) {
+ this.docEncodedImage = docEncodedImage;
+ return this;
+ }
+ }
+
+}
diff --git a/app/src/main/java/appcom/example/regsplashscreen/util/LocalBase64Util.java b/app/src/main/java/appcom/example/regsplashscreen/util/LocalBase64Util.java
index 929fd6e..723c8e3 100644
--- a/app/src/main/java/appcom/example/regsplashscreen/util/LocalBase64Util.java
+++ b/app/src/main/java/appcom/example/regsplashscreen/util/LocalBase64Util.java
@@ -1,31 +1,31 @@
-package appcom.example.regsplashscreen.util;
-
-import android.graphics.Bitmap;
-import android.graphics.BitmapFactory;
-import android.util.Base64;
-import android.util.Log;
-
-import java.io.ByteArrayOutputStream;
-
-public class LocalBase64Util {
-
- // CONVERT BITMAP IMAGE TO A BASE64 ENCODED STRING
- public static String encodeImageToBase64String(Bitmap image) {
- Bitmap bitmapImage = image;
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- bitmapImage.compress(Bitmap.CompressFormat.JPEG, 100, baos);
- byte[] imageByteArray = baos.toByteArray();
- String imageEncoded = Base64.encodeToString(imageByteArray, Base64.DEFAULT);
- Log.d("BASE64 ENCODED STRING", imageEncoded);
- return imageEncoded;
- }
-
- // CONVERT BASE64 ENCODED STRING TO A BITMAP IMAGE
- public static Bitmap decodeBase64StringToImage(String encodedImageString) {
- if (null == encodedImageString || encodedImageString.isEmpty()) {
- return null;
- }
- byte[] decodedString = Base64.decode(encodedImageString, Base64.DEFAULT);
- return BitmapFactory.decodeByteArray(decodedString, 0, decodedString.length);
- }
-}
+package appcom.example.regsplashscreen.util;
+
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import android.util.Base64;
+import android.util.Log;
+
+import java.io.ByteArrayOutputStream;
+
+public class LocalBase64Util {
+
+ // CONVERT BITMAP IMAGE TO A BASE64 ENCODED STRING
+ public static String encodeImageToBase64String(Bitmap image) {
+ Bitmap bitmapImage = image;
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ bitmapImage.compress(Bitmap.CompressFormat.JPEG, 100, baos);
+ byte[] imageByteArray = baos.toByteArray();
+ String imageEncoded = Base64.encodeToString(imageByteArray, Base64.DEFAULT);
+ Log.d("BASE64 ENCODED STRING", imageEncoded);
+ return imageEncoded;
+ }
+
+ // CONVERT BASE64 ENCODED STRING TO A BITMAP IMAGE
+ public static Bitmap decodeBase64StringToImage(String encodedImageString) {
+ if (null == encodedImageString || encodedImageString.isEmpty()) {
+ return null;
+ }
+ byte[] decodedString = Base64.decode(encodedImageString, Base64.DEFAULT);
+ return BitmapFactory.decodeByteArray(decodedString, 0, decodedString.length);
+ }
+}
diff --git a/app/src/main/res/drawable/ic_baseline_mobile_screen_share_24.xml b/app/src/main/res/drawable/ic_baseline_mobile_screen_share_24.xml
deleted file mode 100644
index 74e5164..0000000
--- a/app/src/main/res/drawable/ic_baseline_mobile_screen_share_24.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
diff --git a/app/src/main/res/drawable/ic_launcher_new_icon_background.xml b/app/src/main/res/drawable/ic_launcher_new_icon_background.xml
deleted file mode 100644
index ca3826a..0000000
--- a/app/src/main/res/drawable/ic_launcher_new_icon_background.xml
+++ /dev/null
@@ -1,74 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/app/src/main/res/drawable/info_img.png b/app/src/main/res/drawable/info_img.png
deleted file mode 100644
index f1f0330..0000000
Binary files a/app/src/main/res/drawable/info_img.png and /dev/null differ
diff --git a/app/src/main/res/drawable/shape_user.xml b/app/src/main/res/drawable/shape_user.xml
index 24835e3..be7a39a 100644
--- a/app/src/main/res/drawable/shape_user.xml
+++ b/app/src/main/res/drawable/shape_user.xml
@@ -1,11 +1,11 @@
-
-
-
-
-
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_admin_screen.xml b/app/src/main/res/layout/activity_admin_screen.xml
index 5336058..588f4d3 100644
--- a/app/src/main/res/layout/activity_admin_screen.xml
+++ b/app/src/main/res/layout/activity_admin_screen.xml
@@ -1,84 +1,84 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_dashboard_dynamic_screen.xml b/app/src/main/res/layout/activity_dashboard_dynamic_screen.xml
index f9e72b7..637bf5b 100644
--- a/app/src/main/res/layout/activity_dashboard_dynamic_screen.xml
+++ b/app/src/main/res/layout/activity_dashboard_dynamic_screen.xml
@@ -1,93 +1,93 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_edit_profile_dynamic_screen.xml b/app/src/main/res/layout/activity_edit_profile_dynamic_screen.xml
index f3cf89b..af71a0e 100644
--- a/app/src/main/res/layout/activity_edit_profile_dynamic_screen.xml
+++ b/app/src/main/res/layout/activity_edit_profile_dynamic_screen.xml
@@ -1,183 +1,183 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_sign_up_dynamic_screen.xml b/app/src/main/res/layout/activity_sign_up_dynamic_screen.xml
index 8b467c7..91ecbdb 100644
--- a/app/src/main/res/layout/activity_sign_up_dynamic_screen.xml
+++ b/app/src/main/res/layout/activity_sign_up_dynamic_screen.xml
@@ -1,223 +1,223 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_splash_screen.xml b/app/src/main/res/layout/activity_splash_screen.xml
index dd7bfb2..fc4b306 100644
--- a/app/src/main/res/layout/activity_splash_screen.xml
+++ b/app/src/main/res/layout/activity_splash_screen.xml
@@ -17,7 +17,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/guideline2"
app:layout_constraintVertical_bias="0.264"
- app:srcCompat="@drawable/info_img" />
+ app:srcCompat="@drawable/registered" />
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/card_layout_admin_screen_row.xml b/app/src/main/res/layout/card_layout_admin_screen_row.xml
index 16a614e..91cced5 100644
--- a/app/src/main/res/layout/card_layout_admin_screen_row.xml
+++ b/app/src/main/res/layout/card_layout_admin_screen_row.xml
@@ -1,68 +1,68 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/card_layout_view_info.xml b/app/src/main/res/layout/card_layout_view_info.xml
index 47fdb89..2c3e4b8 100644
--- a/app/src/main/res/layout/card_layout_view_info.xml
+++ b/app/src/main/res/layout/card_layout_view_info.xml
@@ -1,77 +1,77 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/dialog_layout_add_doc.xml b/app/src/main/res/layout/dialog_layout_add_doc.xml
index 8183656..39375ca 100644
--- a/app/src/main/res/layout/dialog_layout_add_doc.xml
+++ b/app/src/main/res/layout/dialog_layout_add_doc.xml
@@ -1,112 +1,112 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/dialog_layout_view_doc_image.xml b/app/src/main/res/layout/dialog_layout_view_doc_image.xml
index cc4d4da..d3e3d63 100644
--- a/app/src/main/res/layout/dialog_layout_view_doc_image.xml
+++ b/app/src/main/res/layout/dialog_layout_view_doc_image.xml
@@ -1,32 +1,32 @@
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_new_icon.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_new_icon.xml
deleted file mode 100644
index 4c078b9..0000000
--- a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_new_icon.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_new_icon_round.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_new_icon_round.xml
deleted file mode 100644
index 4c078b9..0000000
--- a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_new_icon_round.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_new_icon.png b/app/src/main/res/mipmap-hdpi/ic_launcher_new_icon.png
deleted file mode 100644
index 3aafe08..0000000
Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher_new_icon.png and /dev/null differ
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_new_icon_foreground.png b/app/src/main/res/mipmap-hdpi/ic_launcher_new_icon_foreground.png
deleted file mode 100644
index 7ed1055..0000000
Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher_new_icon_foreground.png and /dev/null differ
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_new_icon_round.png b/app/src/main/res/mipmap-hdpi/ic_launcher_new_icon_round.png
deleted file mode 100644
index b8d05c8..0000000
Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher_new_icon_round.png and /dev/null differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_new_icon.png b/app/src/main/res/mipmap-mdpi/ic_launcher_new_icon.png
deleted file mode 100644
index 80822cb..0000000
Binary files a/app/src/main/res/mipmap-mdpi/ic_launcher_new_icon.png and /dev/null differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_new_icon_foreground.png b/app/src/main/res/mipmap-mdpi/ic_launcher_new_icon_foreground.png
deleted file mode 100644
index 3dd2a80..0000000
Binary files a/app/src/main/res/mipmap-mdpi/ic_launcher_new_icon_foreground.png and /dev/null differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_new_icon_round.png b/app/src/main/res/mipmap-mdpi/ic_launcher_new_icon_round.png
deleted file mode 100644
index 800ffb5..0000000
Binary files a/app/src/main/res/mipmap-mdpi/ic_launcher_new_icon_round.png and /dev/null differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_new_icon.png b/app/src/main/res/mipmap-xhdpi/ic_launcher_new_icon.png
deleted file mode 100644
index 6663c13..0000000
Binary files a/app/src/main/res/mipmap-xhdpi/ic_launcher_new_icon.png and /dev/null differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_new_icon_foreground.png b/app/src/main/res/mipmap-xhdpi/ic_launcher_new_icon_foreground.png
deleted file mode 100644
index 738eea8..0000000
Binary files a/app/src/main/res/mipmap-xhdpi/ic_launcher_new_icon_foreground.png and /dev/null differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_new_icon_round.png b/app/src/main/res/mipmap-xhdpi/ic_launcher_new_icon_round.png
deleted file mode 100644
index aacc8bc..0000000
Binary files a/app/src/main/res/mipmap-xhdpi/ic_launcher_new_icon_round.png and /dev/null differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_new_icon.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher_new_icon.png
deleted file mode 100644
index 822ebe9..0000000
Binary files a/app/src/main/res/mipmap-xxhdpi/ic_launcher_new_icon.png and /dev/null differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_new_icon_foreground.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher_new_icon_foreground.png
deleted file mode 100644
index c41d3a6..0000000
Binary files a/app/src/main/res/mipmap-xxhdpi/ic_launcher_new_icon_foreground.png and /dev/null differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_new_icon_round.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher_new_icon_round.png
deleted file mode 100644
index 8df51a8..0000000
Binary files a/app/src/main/res/mipmap-xxhdpi/ic_launcher_new_icon_round.png and /dev/null differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_new_icon.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_new_icon.png
deleted file mode 100644
index 75c3297..0000000
Binary files a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_new_icon.png and /dev/null differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_new_icon_foreground.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_new_icon_foreground.png
deleted file mode 100644
index 20464d2..0000000
Binary files a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_new_icon_foreground.png and /dev/null differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_new_icon_round.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_new_icon_round.png
deleted file mode 100644
index cc87809..0000000
Binary files a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_new_icon_round.png and /dev/null differ
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
index ef59ba2..95ea33d 100644
--- a/app/src/main/res/values/colors.xml
+++ b/app/src/main/res/values/colors.xml
@@ -1,9 +1,9 @@
-
-
- #6200EE
- #3700B3
- #03DAC5
- #D500F9
- #FFFFFF
- #DCDCDC
+
+
+ #6200EE
+ #3700B3
+ #03DAC5
+ #D500F9
+ #FFFFFF
+ #DCDCDC
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 5186682..1993cff 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -1,5 +1,5 @@
- PIRSS
+ My Login
Name
Enter Your Name
Email Id
diff --git a/app/src/main/res/xml/provider_path.xml b/app/src/main/res/xml/provider_path.xml
deleted file mode 100644
index 27c9b7a..0000000
--- a/app/src/main/res/xml/provider_path.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file