diff --git a/Application/app/src/main/AndroidManifest.xml b/Application/app/src/main/AndroidManifest.xml
index 2f6bbac..13d5ef3 100644
--- a/Application/app/src/main/AndroidManifest.xml
+++ b/Application/app/src/main/AndroidManifest.xml
@@ -10,7 +10,7 @@
-
+
-
+
+
+
-
task) {
FirebaseUser user = auth.getCurrentUser();
String email = user.getEmail();
/*if (Validators.isVerified(user))*/
- checkMode(email);
- //else startAccountVerificationActivity();
+ checkMode(email);
+ /*else
+ startAccountVerificationActivity();*/
} else {
String errorCode;
try {
@@ -283,6 +285,11 @@ private void startChildSignedInActivity() {
startActivity(intent);
}
+ private void startAccountVerificationActivity() {
+ Intent intent = new Intent(this, AccountVerificationActivity.class);
+ startActivity(intent);
+ }
+
private void startModeSelectionActivity() {
Intent intent = new Intent(this, ModeSelectionActivity.class);
startActivity(intent);
@@ -302,15 +309,11 @@ private void signInWithGoogle() {
GoogleSignInClient googleSignInClient = GoogleSignIn.getClient(this, googleSignInOptions);
Intent signInIntent = googleSignInClient.getSignInIntent();
startActivityForResult(signInIntent, Constant.RC_SIGN_IN);
- } else startInformationDialogFragment(getResources().getString(R.string.you_re_offline_ncheck_your_connection_and_try_again));
+ } else
+ startInformationDialogFragment(getResources().getString(R.string.you_re_offline_ncheck_your_connection_and_try_again));
}
- private void startAccountVerificationActivity() {
- Intent intent = new Intent(this, AccountVerificationActivity.class);
- startActivity(intent);
- }
-
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
diff --git a/Application/app/src/main/java/com/mansourappdevelopment/androidapp/kidsafe/activities/SettingsActivity.java b/Application/app/src/main/java/com/mansourappdevelopment/androidapp/kidsafe/activities/SettingsActivity.java
index c587a6f..4ffa68e 100644
--- a/Application/app/src/main/java/com/mansourappdevelopment/androidapp/kidsafe/activities/SettingsActivity.java
+++ b/Application/app/src/main/java/com/mansourappdevelopment/androidapp/kidsafe/activities/SettingsActivity.java
@@ -1,175 +1,234 @@
package com.mansourappdevelopment.androidapp.kidsafe.activities;
-import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
+import android.net.Uri;
import android.os.Build;
-import android.preference.ListPreference;
-import android.preference.Preference;
-import android.preference.PreferenceFragment;
-import android.preference.PreferenceManager;
import android.os.Bundle;
-import android.util.Log;
-import android.view.MenuItem;
+import android.support.v7.app.AppCompatActivity;
+import android.view.View;
+import android.widget.Button;
+import android.widget.FrameLayout;
+import android.widget.ImageButton;
+import android.widget.TextView;
+import android.widget.Toast;
-import com.mansourappdevelopment.androidapp.kidsafe.AppCompatPreferenceActivity;
+import com.mansourappdevelopment.androidapp.kidsafe.R;
+import com.mansourappdevelopment.androidapp.kidsafe.dialogfragments.AccountDeleteDialogFragment;
+import com.mansourappdevelopment.androidapp.kidsafe.dialogfragments.ConfirmationDialogFragment;
+import com.mansourappdevelopment.androidapp.kidsafe.dialogfragments.LanguageSelectionDialogFragment;
+import com.mansourappdevelopment.androidapp.kidsafe.dialogfragments.PasswordChangingDialogFragment;
+import com.mansourappdevelopment.androidapp.kidsafe.interfaces.OnConfirmationListener;
+import com.mansourappdevelopment.androidapp.kidsafe.interfaces.OnDeleteAccountListener;
+import com.mansourappdevelopment.androidapp.kidsafe.interfaces.OnLanguageSelectionListener;
+import com.mansourappdevelopment.androidapp.kidsafe.interfaces.OnPasswordChangeListener;
import com.mansourappdevelopment.androidapp.kidsafe.utils.AccountUtils;
import com.mansourappdevelopment.androidapp.kidsafe.utils.Constant;
import com.mansourappdevelopment.androidapp.kidsafe.utils.LocaleUtils;
-import com.mansourappdevelopment.androidapp.kidsafe.R;
import com.mansourappdevelopment.androidapp.kidsafe.utils.SharedPrefsUtils;
-public class SettingsActivity extends AppCompatPreferenceActivity {
- private static final String TAG = "SettingsActivityTAG";
- private static Context context;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- //getSupportActionBar().setDisplayHomeAsUpEnabled(true);
- //setTitle(R.string.settings);
- // load settings fragment
- getFragmentManager().beginTransaction().replace(android.R.id.content, new MainPreferenceFragment()).commit();
- }
-
- public static class MainPreferenceFragment extends PreferenceFragment {
- @Override
- public void onCreate(final Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- addPreferencesFromResource(R.xml.pref_main);
- context = getActivity();
-
-
- bindPreferenceSummaryToValue(findPreference(getString(R.string.language_shared_prefs)));
-
- Preference logoutPref = findPreference(getString(R.string.logout_shared_pref));
- logoutPref.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
- @Override
- public boolean onPreferenceClick(Preference preference) {
- AccountUtils.logout(context);
- return true;
- }
- });
-
- Preference changePasswordPref = findPreference(getString(R.string.change_password_shared_prefs));
- changePasswordPref.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
- @Override
- public boolean onPreferenceClick(Preference preference) {
- AccountUtils.changePassword(context);
- return true;
- }
- });
-
- Preference deleteAccountPref = findPreference(getString(R.string.delete_account_shared_prefs));
- deleteAccountPref.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
- @Override
- public boolean onPreferenceClick(Preference preference) {
- AccountUtils.deleteAccount(context);
- return true;
- }
- });
-
- Preference sendFeedbackPref = findPreference(getString(R.string.send_feedback_shared_prefs));
- sendFeedbackPref.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
- public boolean onPreferenceClick(Preference preference) {
- sendFeedback(getActivity());
- return true;
- }
- });
- }
- }
-
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
- if (item.getItemId() == android.R.id.home) {
- onBackPressed();
- }
- return super.onOptionsItemSelected(item);
- }
-
- private static void bindPreferenceSummaryToValue(Preference preference) {
- preference.setOnPreferenceChangeListener(sBindPreferenceSummaryToValueListener);
-
- sBindPreferenceSummaryToValueListener.onPreferenceChange(preference,
- PreferenceManager
- .getDefaultSharedPreferences(preference.getContext())
- .getString(preference.getKey(), ""));
- }
-
- /**
- * A preference value change listener that updates the preference's summary
- * to reflect its new value.
- */
- private static Preference.OnPreferenceChangeListener sBindPreferenceSummaryToValueListener = new Preference.OnPreferenceChangeListener() {
- @Override
- public boolean onPreferenceChange(Preference preference, Object newValue) {
- String stringValue = newValue.toString();
-
- if (preference instanceof ListPreference) {
- // For list preferences, look up the correct display value in
- // the preference's 'entries' list.
- ListPreference listPreference = (ListPreference) preference;
- int index = listPreference.findIndexOfValue(stringValue);
- String appLanguage = SharedPrefsUtils.getStringPreference(context, Constant.APP_LANGUAGE, "en");
-
- if (index == 0) {
- if (!appLanguage.equals("en")) {
- LocaleUtils.setLocale(context, "en");
- restartApp(); //TODO:: best solution ?
-
- }
-
-
- } else if (index == 1) {
- if (!appLanguage.equals("ar")) {
- LocaleUtils.setLocale(context, "ar");
- restartApp();
- }
-
-
- }
-
-
- // Set the summary to reflect the new value.
- preference.setSummary(
- index >= 0
- ? listPreference.getEntries()[index]
- : null);
-
- } else {
- preference.setSummary(stringValue);
- }
-
- return true;
- }
- };
-
- /**
- * Email client intent to send support mail
- * Appends the necessary device information to email body
- * useful when providing support
- */
- public static void sendFeedback(Context context) {
- String body = null;
- try {
- body = context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionName;
- body = "\n\n-----------------------------\nPlease don't remove this information\n Device OS: Android \n Device OS version: " +
- Build.VERSION.RELEASE + "\n App Version: " + body + "\n Device Brand: " + Build.BRAND +
- "\n Device Model: " + Build.MODEL + "\n Device Manufacturer: " + Build.MANUFACTURER;
- } catch (PackageManager.NameNotFoundException e) {
- }
- Intent intent = new Intent(Intent.ACTION_SEND);
- intent.setType("message/rfc822");
- intent.putExtra(Intent.EXTRA_EMAIL, new String[]{"MansourAppDevelopment@gmail.com"});
- intent.putExtra(Intent.EXTRA_SUBJECT, "KidSafe Feedback");
- intent.putExtra(Intent.EXTRA_TEXT, body);
- context.startActivity(Intent.createChooser(intent, context.getString(R.string.choose_email_client)));
- }
-
- private static void restartApp() {
- Intent intent = context.getPackageManager().getLaunchIntentForPackage(context.getPackageName());
- intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
- context.startActivity(intent);
-
- }
+public class SettingsActivity extends AppCompatActivity implements OnLanguageSelectionListener, OnConfirmationListener, OnPasswordChangeListener, OnDeleteAccountListener {
+ private Button btnLanguageSelection;
+ private Button btnLogout;
+ private Button btnChangePassword;
+ private Button btnDeleteAccount;
+ private Button btnAbout;
+ private Button btnRateUs;
+ private Button btnSendFeedBack;
+ private Button btnVisitWebsite;
+ private ImageButton btnBack;
+ private ImageButton btnSettings;
+ private TextView txtTitle;
+ private FrameLayout toolbar;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_settings);
+
+ toolbar = findViewById(R.id.toolbar);
+ btnBack = findViewById(R.id.btnBack);
+ btnBack.setImageDrawable(getResources().getDrawable(R.drawable.ic_arrow_back));
+ btnBack.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ onBackPressed();
+ }
+ });
+ btnSettings = findViewById(R.id.btnSettings);
+ btnSettings.setVisibility(View.GONE);
+ txtTitle = findViewById(R.id.txtTitle);
+ txtTitle.setText(getString(R.string.settings));
+
+ btnLanguageSelection = findViewById(R.id.btnLanguageSelection);
+ btnLanguageSelection.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ selectLanguage();
+ }
+ });
+
+ btnLogout = findViewById(R.id.btnLogout);
+ btnLogout.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ logout();
+ }
+ });
+
+
+ btnChangePassword = findViewById(R.id.btnChangePassword);
+ btnChangePassword.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ changePassword();
+ }
+ });
+
+
+ btnDeleteAccount = findViewById(R.id.btnDeleteAccount);
+ btnDeleteAccount.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ deleteAccount();
+ }
+ });
+
+
+ btnAbout = findViewById(R.id.btnAbout);
+ btnAbout.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ showAbout();
+ }
+ });
+
+
+ btnRateUs = findViewById(R.id.btnRateUs);
+ btnRateUs.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ rateTheApp();
+ }
+ });
+
+
+ btnSendFeedBack = findViewById(R.id.btnSendFeedBack);
+ btnSendFeedBack.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ SendFeedBack();
+ }
+ });
+
+
+ btnVisitWebsite = findViewById(R.id.btnVisitWebsite);
+ btnVisitWebsite.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ visitWebsite();
+ }
+ });
+
+ }
+
+ private void showAbout() {
+ startActivity(new Intent(this, AboutActivity.class));
+ }
+
+ private void rateTheApp() {
+ Toast.makeText(this, "rateTheApp", Toast.LENGTH_SHORT).show();
+
+ }
+
+ private void SendFeedBack() {
+ String body = null;
+ try {
+ body = getPackageManager().getPackageInfo(getPackageName(), 0).versionName;
+ body = "\n\n-----------------------------\nPlease don't remove this information\n Device OS: Android \n Device OS version: " + Build.VERSION.RELEASE + "\n App Version: " + body + "\n Device Brand: " + Build.BRAND + "\n Device Model: " + Build.MODEL + "\n Device Manufacturer: " + Build.MANUFACTURER;
+ } catch (PackageManager.NameNotFoundException e) {
+ e.printStackTrace();
+ }
+ Intent intent = new Intent(Intent.ACTION_SEND);
+ intent.setType("message/rfc822");
+ intent.putExtra(Intent.EXTRA_EMAIL, new String[]{"MansourAppDevelopment@gmail.com"});
+ intent.putExtra(Intent.EXTRA_SUBJECT, "KidSafe Feedback");
+ intent.putExtra(Intent.EXTRA_TEXT, body);
+ startActivity(Intent.createChooser(intent, getString(R.string.choose_email_client)));
+ }
+
+ private void visitWebsite() {
+ Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://xmansour.github.io/KidSafe"));
+ startActivity(intent);
+ }
+
+ private void deleteAccount() {
+ AccountDeleteDialogFragment accountDeleteDialogFragment = new AccountDeleteDialogFragment();
+ accountDeleteDialogFragment.setCancelable(false);
+ accountDeleteDialogFragment.show(getSupportFragmentManager(), Constant.ACCOUNT_DELETE_DIALOG_FRAGMENT_TAG);
+ }
+
+ private void changePassword() {
+ PasswordChangingDialogFragment passwordChangingDialogFragment = new PasswordChangingDialogFragment();
+ passwordChangingDialogFragment.setCancelable(false);
+ passwordChangingDialogFragment.show(getSupportFragmentManager(), Constant.PASSWORD_CHANGING_DIALOG_FRAGMENT_TAG);
+ }
+
+ private void logout() {
+ ConfirmationDialogFragment confirmationDialogFragment = new ConfirmationDialogFragment();
+ Bundle bundle = new Bundle();
+ bundle.putString(Constant.CONFIRMATION_MESSAGE, getString(R.string.do_you_want_to_logout));
+ confirmationDialogFragment.setArguments(bundle);
+ confirmationDialogFragment.setCancelable(false);
+ confirmationDialogFragment.show(getSupportFragmentManager(), Constant.CONFIRMATION_FRAGMENT_TAG);
+ }
+
+ private void selectLanguage() {
+ LanguageSelectionDialogFragment languageSelectionDialogFragment = new LanguageSelectionDialogFragment();
+ languageSelectionDialogFragment.setCancelable(false);
+ languageSelectionDialogFragment.show(getSupportFragmentManager(), Constant.LANGUAGE_SELECTION_DIALOG_FRAGMENT_TAG);
+ }
+
+ @Override
+ public void onLanguageSelection(String language) {
+ String appLanguage = SharedPrefsUtils.getStringPreference(this, Constant.APP_LANGUAGE, "en");
+ if (language.equals("English") && !appLanguage.equals("en")) {
+ LocaleUtils.setLocale(this, "en");
+ } else if (language.equals("Arabic") && !appLanguage.equals("ar")) {
+ LocaleUtils.setLocale(this, "ar");
+
+ }
+
+ restartApp();
+
+ }
+
+ private void restartApp() {
+ Intent intent = getPackageManager().getLaunchIntentForPackage(getPackageName());
+ intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
+ startActivity(intent);
+
+ }
+
+ @Override
+ public void onConfirm() {
+ AccountUtils.logout(this);
+ }
+
+ @Override
+ public void onConfirmationCancel() {
+ //DO NOTHING
+ }
+
+ @Override
+ public void onPasswordChange(String newPassword) {
+ AccountUtils.changePassword(this, newPassword);
+
+ }
+
+ @Override
+ public void onDeleteAccount(String password) {
+ AccountUtils.deleteAccount(this, password);
+
+ }
}
diff --git a/Application/app/src/main/java/com/mansourappdevelopment/androidapp/kidsafe/dialogfragments/AccountDeleteDialogFragment.java b/Application/app/src/main/java/com/mansourappdevelopment/androidapp/kidsafe/dialogfragments/AccountDeleteDialogFragment.java
new file mode 100644
index 0000000..c237fd7
--- /dev/null
+++ b/Application/app/src/main/java/com/mansourappdevelopment/androidapp/kidsafe/dialogfragments/AccountDeleteDialogFragment.java
@@ -0,0 +1,81 @@
+package com.mansourappdevelopment.androidapp.kidsafe.dialogfragments;
+
+import android.graphics.Color;
+import android.graphics.drawable.ColorDrawable;
+import android.os.Bundle;
+import android.support.annotation.NonNull;
+import android.support.annotation.Nullable;
+import android.support.v4.app.DialogFragment;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.Window;
+import android.widget.Button;
+import android.widget.EditText;
+
+import com.mansourappdevelopment.androidapp.kidsafe.R;
+import com.mansourappdevelopment.androidapp.kidsafe.interfaces.OnDeleteAccountListener;
+import com.mansourappdevelopment.androidapp.kidsafe.utils.Constant;
+import com.mansourappdevelopment.androidapp.kidsafe.utils.SharedPrefsUtils;
+import com.mansourappdevelopment.androidapp.kidsafe.utils.Validators;
+
+public class AccountDeleteDialogFragment extends DialogFragment {
+ private EditText txtDeleteAccountPassword;
+ private Button btnDeleteAccount;
+ private Button btnCancelDeleteAccount;
+ private OnDeleteAccountListener onDeleteAccountListener;
+
+
+ @Nullable
+ @Override
+ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
+ return inflater.inflate(R.layout.fragment_dialog_delete_account, container, false);
+ }
+
+ @Override
+ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
+ super.onViewCreated(view, savedInstanceState);
+ getDialog().requestWindowFeature(Window.FEATURE_NO_TITLE);
+ getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
+ onDeleteAccountListener = (OnDeleteAccountListener) getActivity();
+
+ txtDeleteAccountPassword = view.findViewById(R.id.txtDeleteAccountPassword);
+ btnDeleteAccount = view.findViewById(R.id.btnDeleteAccount);
+ btnDeleteAccount.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ if (isValid()) {
+ onDeleteAccountListener.onDeleteAccount(txtDeleteAccountPassword.getText().toString());
+ dismiss();
+ }
+ }
+ });
+
+
+ btnCancelDeleteAccount = view.findViewById(R.id.btnCancelDeleteAccount);
+ btnCancelDeleteAccount.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ dismiss();
+ }
+ });
+
+
+ }
+
+ private boolean isValid(){
+ if (!Validators.isValidPassword(txtDeleteAccountPassword.getText().toString())) {
+ txtDeleteAccountPassword.setError(getString(R.string.wrong_password));
+ txtDeleteAccountPassword.requestFocus();
+ return false;
+ }
+
+ if (!txtDeleteAccountPassword.getText().toString().equals(SharedPrefsUtils.getStringPreference(getContext(), Constant.PASSWORD, ""))) {
+ txtDeleteAccountPassword.setError(getString(R.string.wrong_password));
+ txtDeleteAccountPassword.requestFocus();
+ return false;
+ }
+
+ return true;
+ }
+}
diff --git a/Application/app/src/main/java/com/mansourappdevelopment/androidapp/kidsafe/dialogfragments/LanguageSelectionDialogFragment.java b/Application/app/src/main/java/com/mansourappdevelopment/androidapp/kidsafe/dialogfragments/LanguageSelectionDialogFragment.java
new file mode 100644
index 0000000..8904473
--- /dev/null
+++ b/Application/app/src/main/java/com/mansourappdevelopment/androidapp/kidsafe/dialogfragments/LanguageSelectionDialogFragment.java
@@ -0,0 +1,67 @@
+package com.mansourappdevelopment.androidapp.kidsafe.dialogfragments;
+
+import android.graphics.Color;
+import android.graphics.drawable.ColorDrawable;
+import android.os.Bundle;
+import android.support.annotation.NonNull;
+import android.support.annotation.Nullable;
+import android.support.v4.app.DialogFragment;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.Window;
+import android.widget.Button;
+import android.widget.Spinner;
+
+import com.mansourappdevelopment.androidapp.kidsafe.R;
+import com.mansourappdevelopment.androidapp.kidsafe.interfaces.OnLanguageSelectionListener;
+import com.mansourappdevelopment.androidapp.kidsafe.utils.Constant;
+import com.mansourappdevelopment.androidapp.kidsafe.utils.SharedPrefsUtils;
+
+public class LanguageSelectionDialogFragment extends DialogFragment {
+ private Spinner spinnerLanguageEntries;
+ private Button btnOkLanguageSelection;
+ private Button btnCancelLanguageSelection;
+ private OnLanguageSelectionListener onLanguageSelectionListener;
+
+ @Nullable
+ @Override
+ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
+ return inflater.inflate(R.layout.fragment_dialog_language_selection, container, false);
+ }
+
+ @Override
+ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
+ super.onViewCreated(view, savedInstanceState);
+ getDialog().requestWindowFeature(Window.FEATURE_NO_TITLE);
+ getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
+ onLanguageSelectionListener = (OnLanguageSelectionListener) getActivity();
+
+ String appLanguage = SharedPrefsUtils.getStringPreference(getContext(), Constant.APP_LANGUAGE, "en");
+ spinnerLanguageEntries = view.findViewById(R.id.spinnerLanguageEntries);
+ if (appLanguage.equals("en"))
+ spinnerLanguageEntries.setSelection(0);
+ else if (appLanguage.equals("ar"))
+ spinnerLanguageEntries.setSelection(1);
+
+
+ btnOkLanguageSelection = view.findViewById(R.id.btnOkLanguageSelection);
+ btnOkLanguageSelection.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ onLanguageSelectionListener.onLanguageSelection(spinnerLanguageEntries.getSelectedItem().toString());
+ dismiss();
+ }
+ });
+
+ btnCancelLanguageSelection = view.findViewById(R.id.btnCancelLanguageSelection);
+ btnCancelLanguageSelection.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ dismiss();
+ }
+ });
+
+
+ }
+}
diff --git a/Application/app/src/main/java/com/mansourappdevelopment/androidapp/kidsafe/dialogfragments/PasswordChangingDialogFragment.java b/Application/app/src/main/java/com/mansourappdevelopment/androidapp/kidsafe/dialogfragments/PasswordChangingDialogFragment.java
new file mode 100644
index 0000000..0f5fed3
--- /dev/null
+++ b/Application/app/src/main/java/com/mansourappdevelopment/androidapp/kidsafe/dialogfragments/PasswordChangingDialogFragment.java
@@ -0,0 +1,98 @@
+package com.mansourappdevelopment.androidapp.kidsafe.dialogfragments;
+
+import android.graphics.Color;
+import android.graphics.drawable.ColorDrawable;
+import android.os.Bundle;
+import android.support.annotation.NonNull;
+import android.support.annotation.Nullable;
+import android.support.v4.app.DialogFragment;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.Window;
+import android.widget.Button;
+import android.widget.EditText;
+
+import com.mansourappdevelopment.androidapp.kidsafe.R;
+import com.mansourappdevelopment.androidapp.kidsafe.interfaces.OnPasswordChangeListener;
+import com.mansourappdevelopment.androidapp.kidsafe.utils.Constant;
+import com.mansourappdevelopment.androidapp.kidsafe.utils.SharedPrefsUtils;
+import com.mansourappdevelopment.androidapp.kidsafe.utils.Validators;
+
+public class PasswordChangingDialogFragment extends DialogFragment {
+ private EditText txtOldPassword;
+ private EditText txtNewPassword;
+ private EditText txtNewPasswordConfirmation;
+ private Button btnChangePassword;
+ private Button btnCancelChangePassword;
+ private OnPasswordChangeListener onPasswordChangeListener;
+
+
+ @Nullable
+ @Override
+ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
+ return inflater.inflate(R.layout.fragment_dialog_change_password, container, false);
+ }
+
+ @Override
+ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
+ super.onViewCreated(view, savedInstanceState);
+ getDialog().requestWindowFeature(Window.FEATURE_NO_TITLE);
+ getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
+ onPasswordChangeListener = (OnPasswordChangeListener) getActivity();
+
+ txtOldPassword = view.findViewById(R.id.txtOldPassword);
+ txtNewPassword = view.findViewById(R.id.txtNewPassword);
+ txtNewPasswordConfirmation = view.findViewById(R.id.txtNewPasswordConfirmation);
+ btnChangePassword = view.findViewById(R.id.btnChangePassword);
+ btnChangePassword.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ if (isValid()) {
+ onPasswordChangeListener.onPasswordChange(txtNewPassword.getText().toString());
+ dismiss();
+ }
+
+ }
+ });
+ btnCancelChangePassword = view.findViewById(R.id.btnCancelChangePassword);
+ btnCancelChangePassword.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ dismiss();
+ }
+ });
+
+ }
+
+
+ private boolean isValid(){
+ if (!Validators.isValidPassword(txtOldPassword.getText().toString())) {
+ txtOldPassword.setError(getString(R.string.wrong_password));
+ txtOldPassword.requestFocus();
+ return false;
+ }
+
+ if (!txtOldPassword.getText().toString().equals(SharedPrefsUtils.getStringPreference(getContext(), Constant.PASSWORD, ""))) {
+ txtOldPassword.setError(getString(R.string.wrong_password));
+ txtOldPassword.requestFocus();
+ return false;
+ }
+
+
+ if (!Validators.isValidPassword(txtNewPassword.getText().toString())) {
+ txtNewPassword.setError(getString(R.string.enter_valid_password));
+ txtNewPassword.requestFocus();
+ return false;
+ }
+
+ if (!txtNewPasswordConfirmation.getText().toString().equals(txtNewPassword.getText().toString())) {
+ txtNewPasswordConfirmation.setError(getString(R.string.new_password_doesnt_match));
+ txtNewPasswordConfirmation.requestFocus();
+ return false;
+ }
+
+ return true;
+ }
+}
+
diff --git a/Application/app/src/main/java/com/mansourappdevelopment/androidapp/kidsafe/dialogfragments/PasswordValidationDialogFragment.java b/Application/app/src/main/java/com/mansourappdevelopment/androidapp/kidsafe/dialogfragments/PasswordValidationDialogFragment.java
new file mode 100644
index 0000000..b963a74
--- /dev/null
+++ b/Application/app/src/main/java/com/mansourappdevelopment/androidapp/kidsafe/dialogfragments/PasswordValidationDialogFragment.java
@@ -0,0 +1,69 @@
+package com.mansourappdevelopment.androidapp.kidsafe.dialogfragments;
+
+import android.graphics.Color;
+import android.graphics.drawable.ColorDrawable;
+import android.os.Bundle;
+import android.support.annotation.NonNull;
+import android.support.annotation.Nullable;
+import android.support.v4.app.DialogFragment;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.Window;
+import android.widget.Button;
+import android.widget.EditText;
+
+import com.mansourappdevelopment.androidapp.kidsafe.R;
+import com.mansourappdevelopment.androidapp.kidsafe.interfaces.OnPasswordValidationListener;
+import com.mansourappdevelopment.androidapp.kidsafe.utils.Constant;
+import com.mansourappdevelopment.androidapp.kidsafe.utils.SharedPrefsUtils;
+
+public class PasswordValidationDialogFragment extends DialogFragment {
+ private EditText txtValidationPassword;
+ private Button btnValidation;
+ private Button btnCancelValidation;
+ private OnPasswordValidationListener onPasswordValidationListener;
+
+ @Nullable
+ @Override
+ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
+ return inflater.inflate(R.layout.fragment_dialog_password_validation, container, false);
+ }
+
+ @Override
+ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
+ super.onViewCreated(view, savedInstanceState);
+ onPasswordValidationListener = (OnPasswordValidationListener) getActivity();
+ getDialog().requestWindowFeature(Window.FEATURE_NO_TITLE);
+ getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
+
+ txtValidationPassword = view.findViewById(R.id.txtValidationPassword);
+ btnValidation = view.findViewById(R.id.btnValidation);
+ btnCancelValidation = view.findViewById(R.id.btnCancelValidation);
+ final String passwordPrefs = SharedPrefsUtils.getStringPreference(getContext(), Constant.PASSWORD, "");
+
+ btnValidation.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ if (txtValidationPassword.getText().toString().equals(passwordPrefs)){
+ onPasswordValidationListener.onValidationOk();
+ dismiss();
+ }else{
+ txtValidationPassword.requestFocus();
+ txtValidationPassword.setError(getString(R.string.wrong_password));
+ }
+
+ }
+ });
+
+
+ btnCancelValidation.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ dismiss();
+ }
+ });
+
+
+ }
+}
diff --git a/Application/app/src/main/java/com/mansourappdevelopment/androidapp/kidsafe/dialogfragments/PermissionExplanationDialogFragment.java b/Application/app/src/main/java/com/mansourappdevelopment/androidapp/kidsafe/dialogfragments/PermissionExplanationDialogFragment.java
index 08224fe..3293af9 100644
--- a/Application/app/src/main/java/com/mansourappdevelopment/androidapp/kidsafe/dialogfragments/PermissionExplanationDialogFragment.java
+++ b/Application/app/src/main/java/com/mansourappdevelopment/androidapp/kidsafe/dialogfragments/PermissionExplanationDialogFragment.java
@@ -19,85 +19,93 @@
public class PermissionExplanationDialogFragment extends DialogFragment {
- private TextView txtPermissionBody;
- private Button btnOkPermission;
- private Button btnCancelPermission;
- private OnPermissionExplanationListener onPermissionExplanationListener;
-
- @Nullable
- @Override
- public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
- return inflater.inflate(R.layout.fragment_dialog_permission_explanation, container, false);
- }
-
- @Override
- public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
- getDialog().requestWindowFeature(Window.FEATURE_NO_TITLE);
- getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
- txtPermissionBody = (TextView) view.findViewById(R.id.txtPermissionBody);
- onPermissionExplanationListener = (OnPermissionExplanationListener) getTargetFragment();
-
- Bundle bundle = getArguments();
- final int requestCode = bundle.getInt(Constant.PERMISSION_REQUEST_CODE);
- final int switchId = bundle.getInt(Constant.SWITCH_ID);
-
- switch (requestCode) {
- case Constant.SEND_SMS_PERMISSION_REQUEST_CODE:
- txtPermissionBody.setText(getString(R.string.send_sms_explanation));
- break;
- case Constant.READ_SMS_PERMISSION_REQUEST_CODE:
- txtPermissionBody.setText(getString(R.string.read_sms_explanation));
- break;
- case Constant.RECEIVE_SMS_PERMISSION_REQUEST_CODE:
- txtPermissionBody.setText(getString(R.string.receive_sms_explanation));
- break;
- case Constant.READ_PHONE_STATE_PERMISSION_REQUEST_CODE:
- txtPermissionBody.setText(getString(R.string.read_phone_state_explanation));
- break;
- case Constant.READ_CALL_LOG_PERMISSION_REQUEST_CODE:
- txtPermissionBody.setText(getString(R.string.read_call_log_explanation));
- break;
- case Constant.READ_CONTACTS_PERMISSION_REQUEST_CODE:
- txtPermissionBody.setText(getString(R.string.read_contacts_explanation));
- break;
- case Constant.LOCATION_PERMISSION_REQUEST_CODE:
- txtPermissionBody.setText(getString(R.string.location_permission_explanation));
- break;
- case Constant.WRITE_SETTINGS_PERMISSION_REQUEST_CODE:
- txtPermissionBody.setText(getString(R.string.write_settings_permission_explanation));
- break;
- case Constant.OVERLAY_PERMISSION_REQUEST_CODE:
- txtPermissionBody.setText(getString(R.string.overlay_permission_explanation));
- break;
- case Constant.PACKAGE_USAGE_PERMISSION_REQUEST_CODE:
- txtPermissionBody.setText(getString(R.string.package_usage_permission_explanation));
- break;
- case Constant.CALL_PHONE_PERMISSION_REQUEST_CODE:
- txtPermissionBody.setText(getString(R.string.phone_call_permission_explanation));
- break;
- case Constant.USER_LOCATION_PERMISSION_REQUEST_CODE:
- txtPermissionBody.setText(getString(R.string.cant_start_the_fence_without_your_location));
- break;
-
- }
-
- btnOkPermission = (Button) view.findViewById(R.id.btnOkPermission);
- btnOkPermission.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- onPermissionExplanationListener.onOk(requestCode);
- dismiss();
- }
- });
-
- btnCancelPermission = (Button) view.findViewById(R.id.btnCancelPermission);
- btnCancelPermission.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- onPermissionExplanationListener.onCancel(switchId);
- dismiss();
- }
- });
-
- }
+ private TextView txtPermissionBody;
+ private Button btnOkPermission;
+ private Button btnCancelPermission;
+ private OnPermissionExplanationListener onPermissionExplanationListener;
+
+ @Nullable
+ @Override
+ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
+ return inflater.inflate(R.layout.fragment_dialog_permission_explanation, container, false);
+ }
+
+ @Override
+ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
+ getDialog().requestWindowFeature(Window.FEATURE_NO_TITLE);
+ getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
+ txtPermissionBody = (TextView) view.findViewById(R.id.txtPermissionBody);
+ if (getTargetFragment() != null)
+ onPermissionExplanationListener = (OnPermissionExplanationListener) getTargetFragment();
+ else onPermissionExplanationListener = (OnPermissionExplanationListener) getActivity();
+
+ Bundle bundle = getArguments();
+ final int requestCode = bundle.getInt(Constant.PERMISSION_REQUEST_CODE);
+ final int switchId = bundle.getInt(Constant.SWITCH_ID);
+
+ switch (requestCode) {
+ case Constant.SEND_SMS_PERMISSION_REQUEST_CODE:
+ txtPermissionBody.setText(getString(R.string.send_sms_explanation));
+ break;
+ case Constant.READ_SMS_PERMISSION_REQUEST_CODE:
+ txtPermissionBody.setText(getString(R.string.read_sms_explanation));
+ break;
+ case Constant.RECEIVE_SMS_PERMISSION_REQUEST_CODE:
+ txtPermissionBody.setText(getString(R.string.receive_sms_explanation));
+ break;
+ case Constant.READ_PHONE_STATE_PERMISSION_REQUEST_CODE:
+ txtPermissionBody.setText(getString(R.string.read_phone_state_explanation));
+ break;
+ case Constant.READ_CALL_LOG_PERMISSION_REQUEST_CODE:
+ txtPermissionBody.setText(getString(R.string.read_call_log_explanation));
+ break;
+ case Constant.READ_CONTACTS_PERMISSION_REQUEST_CODE:
+ txtPermissionBody.setText(getString(R.string.read_contacts_explanation));
+ break;
+ case Constant.LOCATION_PERMISSION_REQUEST_CODE:
+ txtPermissionBody.setText(getString(R.string.location_permission_explanation));
+ break;
+ case Constant.WRITE_SETTINGS_PERMISSION_REQUEST_CODE:
+ txtPermissionBody.setText(getString(R.string.write_settings_permission_explanation));
+ break;
+ case Constant.OVERLAY_PERMISSION_REQUEST_CODE:
+ txtPermissionBody.setText(getString(R.string.overlay_permission_explanation));
+ break;
+ case Constant.PACKAGE_USAGE_PERMISSION_REQUEST_CODE:
+ txtPermissionBody.setText(getString(R.string.package_usage_permission_explanation));
+ break;
+ case Constant.CALL_PHONE_PERMISSION_REQUEST_CODE:
+ txtPermissionBody.setText(getString(R.string.phone_call_permission_explanation));
+ break;
+ case Constant.USER_LOCATION_PERMISSION_REQUEST_CODE:
+ txtPermissionBody.setText(getString(R.string.cant_start_the_fence_without_your_location));
+ break;
+ case Constant.CHILD_LOCATION_PERMISSION_REQUEST_CODE:
+ txtPermissionBody.setText(getString(R.string.please_enable_your_gps));
+ break;
+ default:
+ txtPermissionBody.setText(getString(R.string.please_allow_the_following_permissions));
+ break;
+
+ }
+
+ btnOkPermission = (Button) view.findViewById(R.id.btnOkPermission);
+ btnOkPermission.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ onPermissionExplanationListener.onOk(requestCode);
+ dismiss();
+ }
+ });
+
+ btnCancelPermission = (Button) view.findViewById(R.id.btnCancelPermission);
+ btnCancelPermission.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ onPermissionExplanationListener.onCancel(switchId);
+ dismiss();
+ }
+ });
+
+ }
}
diff --git a/Application/app/src/main/java/com/mansourappdevelopment/androidapp/kidsafe/fragments/CallsFragment.java b/Application/app/src/main/java/com/mansourappdevelopment/androidapp/kidsafe/fragments/CallsFragment.java
index e446c88..2ac449a 100644
--- a/Application/app/src/main/java/com/mansourappdevelopment/androidapp/kidsafe/fragments/CallsFragment.java
+++ b/Application/app/src/main/java/com/mansourappdevelopment/androidapp/kidsafe/fragments/CallsFragment.java
@@ -102,7 +102,6 @@ public boolean onMove(@NonNull RecyclerView recyclerView, @NonNull RecyclerView.
@Override
public void onSwiped(@NonNull RecyclerView.ViewHolder viewHolder, int i) {
int position = viewHolder.getAdapterPosition();
-
deleteCall(callsList.get(position));
callsList.remove(position);
callAdapter.notifyItemRemoved(position);
@@ -112,15 +111,6 @@ public void onSwiped(@NonNull RecyclerView.ViewHolder viewHolder, int i) {
recyclerViewCalls.setVisibility(View.GONE);
}
}
-
-
- @Override
- public void onChildDraw(@NonNull Canvas c, @NonNull RecyclerView recyclerView, @NonNull RecyclerView.ViewHolder viewHolder, float dX, float dY, int actionState, boolean isCurrentlyActive) {
- super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive);
- final ColorDrawable background = new ColorDrawable(Color.RED);
- background.setBounds(viewHolder.itemView.getLeft() + 10, viewHolder.itemView.getTop(), viewHolder.itemView.getRight() + (int) dX, viewHolder.itemView.getBottom());
- background.draw(c);
- }
};
new ItemTouchHelper(simpleCallback).attachToRecyclerView(recyclerViewCalls);
diff --git a/Application/app/src/main/java/com/mansourappdevelopment/androidapp/kidsafe/fragments/ContactsFragment.java b/Application/app/src/main/java/com/mansourappdevelopment/androidapp/kidsafe/fragments/ContactsFragment.java
index b7a8196..b353e61 100644
--- a/Application/app/src/main/java/com/mansourappdevelopment/androidapp/kidsafe/fragments/ContactsFragment.java
+++ b/Application/app/src/main/java/com/mansourappdevelopment/androidapp/kidsafe/fragments/ContactsFragment.java
@@ -63,7 +63,6 @@ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceStat
recyclerViewContacts.setHasFixedSize(true);
recyclerViewContacts.setLayoutManager(new LinearLayoutManager(getContext()));
initializeAdapter(this);
- initializeItemTouchHelper();
}
}
@@ -82,39 +81,6 @@ public void initializeAdapter(OnContactClickListener onContactClickListener) {
recyclerViewContacts.setAdapter(contactsAdapter);
}
- private void initializeItemTouchHelper() {
- ItemTouchHelper.SimpleCallback simpleCallback = new ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT) {
- @Override
- public boolean onMove(@NonNull RecyclerView recyclerView, @NonNull RecyclerView.ViewHolder viewHolder, @NonNull RecyclerView.ViewHolder viewHolder1) {
- return false;
- }
-
- @Override
- public void onSwiped(@NonNull RecyclerView.ViewHolder viewHolder, int i) {
- int position = viewHolder.getAdapterPosition();
- }
-
- @Override
- public void onChildDraw(@NonNull Canvas c, @NonNull RecyclerView recyclerView, @NonNull RecyclerView.ViewHolder viewHolder, float dX, float dY, int actionState, boolean isCurrentlyActive) {
- super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive);
- View itemView = viewHolder.itemView;
-
- if (dX > 0.0) {
- final ColorDrawable background = new ColorDrawable(getResources().getColor(R.color.flatui_turquoise));
- background.setBounds(viewHolder.itemView.getLeft() - (int) dX + 10, viewHolder.itemView.getTop(), viewHolder.itemView.getRight() + (int) dX - 10, viewHolder.itemView.getBottom());
- background.draw(c);
- Drawable callIcon = ContextCompat.getDrawable(context, R.drawable.ic_call_white);
- callIcon.setBounds(20,20,20,20);
- callIcon.draw(c);
- } else {
- final ColorDrawable background = new ColorDrawable(getResources().getColor(R.color.flatui_alizarin));
- background.setBounds(viewHolder.itemView.getLeft() + (int) dX + 10, viewHolder.itemView.getTop(), viewHolder.itemView.getRight() - (int) dX - 10, viewHolder.itemView.getBottom());
- background.draw(c);
- }
- }
- };
- new ItemTouchHelper(simpleCallback).attachToRecyclerView(recyclerViewContacts);
- }
@Override
public void onCallClick(String contactNumber) {
diff --git a/Application/app/src/main/java/com/mansourappdevelopment/androidapp/kidsafe/fragments/LocationFragment.java b/Application/app/src/main/java/com/mansourappdevelopment/androidapp/kidsafe/fragments/LocationFragment.java
index 6782f0f..e127ab8 100644
--- a/Application/app/src/main/java/com/mansourappdevelopment/androidapp/kidsafe/fragments/LocationFragment.java
+++ b/Application/app/src/main/java/com/mansourappdevelopment/androidapp/kidsafe/fragments/LocationFragment.java
@@ -42,6 +42,7 @@
import com.mansourappdevelopment.androidapp.kidsafe.models.Location;
import com.mansourappdevelopment.androidapp.kidsafe.services.GeoFencingForegroundService;
import com.mansourappdevelopment.androidapp.kidsafe.utils.Constant;
+import com.mansourappdevelopment.androidapp.kidsafe.utils.Validators;
import org.osmdroid.api.IMapController;
import org.osmdroid.config.Configuration;
@@ -327,7 +328,7 @@ public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
String key = nodeShot.getKey();
if (geoFenceCenter.equals("You")) {
- if (userLocation == null || !isLocationOn()) {
+ if (userLocation == null || !Validators.isLocationOn(context)) {
startPermissionExplanationDialogFragment();
} else {
double fenceCenterLatitude = userLocation.getLatitude();
@@ -371,22 +372,16 @@ private void startFencingService() {
private void startPermissionExplanationDialogFragment() {
PermissionExplanationDialogFragment permissionExplanationDialogFragment = new PermissionExplanationDialogFragment();
Bundle bundle = new Bundle();
- bundle.putInt(Constant.PERMISSION_REQUEST_CODE, Constant.USER_LOCATION_PERMISSION_REQUEST_CODE);
+ bundle.putInt(Constant.PERMISSION_REQUEST_CODE, Constant.CHILD_LOCATION_PERMISSION_REQUEST_CODE);
permissionExplanationDialogFragment.setArguments(bundle);
permissionExplanationDialogFragment.setCancelable(false);
permissionExplanationDialogFragment.setTargetFragment(this, Constant.PERMISSION_EXPLANATION_FRAGMENT);
permissionExplanationDialogFragment.show(getFragmentManager(), Constant.PERMISSION_EXPLANATION_FRAGMENT_TAG);
}
- private boolean isLocationOn() {
- LocationManager locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
- return locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER) || locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER);
- }
-
@Override
public void onOk(int requestCode) {
startActivity(new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS));
-
}
@Override
diff --git a/Application/app/src/main/java/com/mansourappdevelopment/androidapp/kidsafe/fragments/MessagesFragment.java b/Application/app/src/main/java/com/mansourappdevelopment/androidapp/kidsafe/fragments/MessagesFragment.java
index fb65ad3..7c06b23 100644
--- a/Application/app/src/main/java/com/mansourappdevelopment/androidapp/kidsafe/fragments/MessagesFragment.java
+++ b/Application/app/src/main/java/com/mansourappdevelopment/androidapp/kidsafe/fragments/MessagesFragment.java
@@ -115,14 +115,7 @@ public void onSwiped(@NonNull RecyclerView.ViewHolder viewHolder, int i) {
recyclerViewMessages.setVisibility(View.GONE);
}
}
-
- @Override
- public void onChildDraw(@NonNull Canvas c, @NonNull RecyclerView recyclerView, @NonNull RecyclerView.ViewHolder viewHolder, float dX, float dY, int actionState, boolean isCurrentlyActive) {
- super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive);
- final ColorDrawable background = new ColorDrawable(Color.RED);
- background.setBounds(viewHolder.itemView.getLeft() + 10, viewHolder.itemView.getTop(), viewHolder.itemView.getRight() + (int) dX, viewHolder.itemView.getBottom());
- background.draw(c);
- }
+
};
new ItemTouchHelper(simpleCallback).attachToRecyclerView(recyclerViewMessages);
}
diff --git a/Application/app/src/main/java/com/mansourappdevelopment/androidapp/kidsafe/interfaces/OnDeleteAccountListener.java b/Application/app/src/main/java/com/mansourappdevelopment/androidapp/kidsafe/interfaces/OnDeleteAccountListener.java
new file mode 100644
index 0000000..3792114
--- /dev/null
+++ b/Application/app/src/main/java/com/mansourappdevelopment/androidapp/kidsafe/interfaces/OnDeleteAccountListener.java
@@ -0,0 +1,5 @@
+package com.mansourappdevelopment.androidapp.kidsafe.interfaces;
+
+public interface OnDeleteAccountListener {
+ void onDeleteAccount(String password);
+}
diff --git a/Application/app/src/main/java/com/mansourappdevelopment/androidapp/kidsafe/interfaces/OnLanguageSelectionListener.java b/Application/app/src/main/java/com/mansourappdevelopment/androidapp/kidsafe/interfaces/OnLanguageSelectionListener.java
new file mode 100644
index 0000000..7ea50f2
--- /dev/null
+++ b/Application/app/src/main/java/com/mansourappdevelopment/androidapp/kidsafe/interfaces/OnLanguageSelectionListener.java
@@ -0,0 +1,5 @@
+package com.mansourappdevelopment.androidapp.kidsafe.interfaces;
+
+public interface OnLanguageSelectionListener {
+ void onLanguageSelection(String language);
+}
diff --git a/Application/app/src/main/java/com/mansourappdevelopment/androidapp/kidsafe/interfaces/OnPasswordChangeListener.java b/Application/app/src/main/java/com/mansourappdevelopment/androidapp/kidsafe/interfaces/OnPasswordChangeListener.java
new file mode 100644
index 0000000..0bddebd
--- /dev/null
+++ b/Application/app/src/main/java/com/mansourappdevelopment/androidapp/kidsafe/interfaces/OnPasswordChangeListener.java
@@ -0,0 +1,5 @@
+package com.mansourappdevelopment.androidapp.kidsafe.interfaces;
+
+public interface OnPasswordChangeListener {
+ void onPasswordChange(String newPassword);
+}
diff --git a/Application/app/src/main/java/com/mansourappdevelopment/androidapp/kidsafe/interfaces/OnPasswordValidationListener.java b/Application/app/src/main/java/com/mansourappdevelopment/androidapp/kidsafe/interfaces/OnPasswordValidationListener.java
new file mode 100644
index 0000000..8dd4d19
--- /dev/null
+++ b/Application/app/src/main/java/com/mansourappdevelopment/androidapp/kidsafe/interfaces/OnPasswordValidationListener.java
@@ -0,0 +1,5 @@
+package com.mansourappdevelopment.androidapp.kidsafe.interfaces;
+
+public interface OnPasswordValidationListener {
+ void onValidationOk();
+}
diff --git a/Application/app/src/main/java/com/mansourappdevelopment/androidapp/kidsafe/utils/AccountUtils.java b/Application/app/src/main/java/com/mansourappdevelopment/androidapp/kidsafe/utils/AccountUtils.java
index 64b46c2..53787a0 100644
--- a/Application/app/src/main/java/com/mansourappdevelopment/androidapp/kidsafe/utils/AccountUtils.java
+++ b/Application/app/src/main/java/com/mansourappdevelopment/androidapp/kidsafe/utils/AccountUtils.java
@@ -1,15 +1,8 @@
package com.mansourappdevelopment.androidapp.kidsafe.utils;
-import android.app.AlertDialog;
import android.content.Context;
-import android.content.DialogInterface;
import android.content.Intent;
-import android.content.res.Resources;
import android.support.annotation.NonNull;
-import android.text.InputType;
-import android.util.Log;
-import android.widget.EditText;
-import android.widget.LinearLayout;
import android.widget.Toast;
import com.google.android.gms.tasks.OnCompleteListener;
@@ -32,260 +25,139 @@
import com.mansourappdevelopment.androidapp.kidsafe.R;
import com.mansourappdevelopment.androidapp.kidsafe.activities.LoginActivity;
import com.mansourappdevelopment.androidapp.kidsafe.models.User;
+import com.mansourappdevelopment.androidapp.kidsafe.services.GeoFencingForegroundService;
+import com.mansourappdevelopment.androidapp.kidsafe.services.MainForegroundService;
public class AccountUtils {
- private static final String TAG = "AccountUtilsTAG";
-
- public static void changePassword(final Context context) {
- new AlertDialog.Builder(context)
- .setTitle(R.string.change_password)
- .setMessage(R.string.do_you_want_to_change_password)
- //.setIcon(R.drawable.ic_home_)
- .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- LinearLayout parentLayout = new LinearLayout(context);
- parentLayout.setOrientation(LinearLayout.VERTICAL);
-
- LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT);
- layoutParams.setMargins(dpToPx(20), dpToPx(20), dpToPx(20), dpToPx(20));
-
- final EditText txtOldPassword = new EditText(context);
- txtOldPassword.setHint(R.string.enter_old_password);
- txtOldPassword.setLayoutParams(layoutParams);
- txtOldPassword.setSingleLine();
- //txtOldPassword.setInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD);
-
- final EditText txtNewPassword = new EditText(context);
- txtNewPassword.setHint(R.string.enter_new_password);
- txtNewPassword.setLayoutParams(layoutParams);
- txtNewPassword.setSingleLine();
- //txtNewPassword.setInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD);
-
-
- parentLayout.addView(txtOldPassword, 0);
- parentLayout.addView(txtNewPassword, 1);
-
- new AlertDialog.Builder(context)
- .setTitle(R.string.change_password)
- //.setMessage(R.string.enter_your_password)
- .setView(parentLayout)
- .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- if (isValid(txtOldPassword.getText().toString(), context)) {
- if (Validators.isValidPassword(txtNewPassword.getText().toString()))
- updatePassword(txtNewPassword.getText().toString(), context);
- else
- Toast.makeText(context, R.string.enter_a_valid_new_email, Toast.LENGTH_SHORT).show();
-
- } else {
- Toast.makeText(context, R.string.old_password_is_wrong, Toast.LENGTH_SHORT).show();
-
- }
- }
- })
- .setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- Toast.makeText(context, R.string.canceled, Toast.LENGTH_SHORT).show();
- }
- }).create().show();
- }
- })
- .setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- Toast.makeText(context, R.string.canceled, Toast.LENGTH_SHORT).show();
- }
- }).create().show();
-
- }
-
- public static void logout(final Context context) {
- new AlertDialog.Builder(context)
- .setTitle(R.string.logout)
- .setMessage(R.string.do_you_want_to_logout)
- //.setIcon(R.drawable.ic_home_)
- .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- FirebaseAuth.getInstance().signOut();
- context.startActivity(new Intent(context, LoginActivity.class));
- }
- })
- .setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- Toast.makeText(context, R.string.canceled, Toast.LENGTH_SHORT).show();
- }
- }).create().show();
-
- }
-
- public static void deleteAccount(final Context context) {
- final String providerId = FirebaseAuth.getInstance().getCurrentUser().getProviders().get(0);
- new AlertDialog.Builder(context)
- .setTitle(R.string.delete_account)
- .setMessage(R.string.do_you_want_to_delete_account)
- //.setIcon(R.drawable.ic_home_)
- .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- if (providerId.equals("google.com")) {
- deleteAccountData(providerId, null, context);
- } else {
- LinearLayout parentLayout = new LinearLayout(context);
- LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT);
- layoutParams.setMargins(dpToPx(20), dpToPx(20), dpToPx(20), dpToPx(20));
- final EditText txtPassword = new EditText(context);
- txtPassword.setHint(R.string.enter_your_password);
- txtPassword.setLayoutParams(layoutParams);
- txtPassword.setSingleLine();
- parentLayout.addView(txtPassword);
- new AlertDialog.Builder(context)
- .setTitle(R.string.delete_account)
- //.setMessage(R.string.enter_your_password)
- .setView(parentLayout)
- .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- String password = txtPassword.getText().toString();
- if (isValid(password, context)) {
- deleteAccountData(providerId, password, context);
-
- } else {
- Toast.makeText(context, R.string.wrong_password, Toast.LENGTH_SHORT).show();
-
- }
- }
- })
- .setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- Toast.makeText(context, R.string.canceled, Toast.LENGTH_SHORT).show();
- }
- }).create().show();
- }
- }
- })
- .setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- Toast.makeText(context, R.string.canceled, Toast.LENGTH_SHORT).show();
- }
- }).create().show();
- }
-
- private static void deleteAccountData(final String providerId, final String password, final Context context) {
- final DatabaseReference databaseReference = FirebaseDatabase.getInstance().getReference("users");
- final FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
-
- Query parentQuery = databaseReference.child("parents").orderByChild("email").equalTo(user.getEmail());
- parentQuery.addListenerForSingleValueEvent(new ValueEventListener() {
- @Override
- public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
- if (dataSnapshot.exists()) {
- DataSnapshot parentNodeShot = dataSnapshot.getChildren().iterator().next();
- User parent = parentNodeShot.getValue(User.class);
- String imgUrl = parent.getProfileImage();
- removeImage(imgUrl, providerId, password, context);
- databaseReference.child("parents").child(user.getUid()).removeValue();
- } else {
- Query childQuery = databaseReference.child("childs").orderByChild("email").equalTo(user.getEmail());
- childQuery.addListenerForSingleValueEvent(new ValueEventListener() {
- @Override
- public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
- if (dataSnapshot.exists()) {
- DataSnapshot childNodeShot = dataSnapshot.getChildren().iterator().next();
- User child = childNodeShot.getValue(User.class);
- String imgUrl = child.getProfileImage();
- removeImage(imgUrl, providerId, password, context);
- databaseReference.child("childs").child(user.getUid()).removeValue();
-
- }
- }
-
- @Override
- public void onCancelled(@NonNull DatabaseError databaseError) {
-
- }
- });
- }
-
-
- }
-
- @Override
- public void onCancelled(@NonNull DatabaseError databaseError) {
-
- }
- });
-
-
- }
-
- private static void removeImage(String imgUrl, final String providerId, final String password, final Context context) {
- if (imgUrl.contains("https://firebasestorage.googleapis.com")) {
- StorageReference profileImageStorageReference = FirebaseStorage.getInstance().getReferenceFromUrl(imgUrl);
- profileImageStorageReference.delete().addOnSuccessListener(new OnSuccessListener() {
- @Override
- public void onSuccess(Void aVoid) {
- deleteUser(providerId, password, context);
- }
- }).addOnFailureListener(new OnFailureListener() {
- @Override
- public void onFailure(@NonNull Exception e) {
- }
- });
- } else {
- deleteUser(providerId, password, context);
- }
- }
-
- private static void deleteUser(String providerId, final String password, final Context context) {
- final FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
- AuthCredential credential;
- if (providerId.equals("google.com"))
- credential = GoogleAuthProvider.getCredential(user.getEmail(), null);
-
- else
- credential = EmailAuthProvider.getCredential(user.getEmail(), password);
-
- user.reauthenticate(credential)
- .addOnCompleteListener(new OnCompleteListener() {
- @Override
- public void onComplete(@NonNull Task task) {
- user.delete()
- .addOnCompleteListener(new OnCompleteListener() {
- @Override
- public void onComplete(@NonNull Task task) {
- Toast.makeText(context, R.string.account_deleted, Toast.LENGTH_SHORT).show();
- context.startActivity(new Intent(context, LoginActivity.class));
- }
- });
- }
- });
- }
-
- private static void updatePassword(String newPassword, final Context context) {
- FirebaseAuth.getInstance().getCurrentUser().updatePassword(newPassword)
- .addOnCompleteListener(new OnCompleteListener() {
- @Override
- public void onComplete(@NonNull Task task) {
- Toast.makeText(context, R.string.password_updated, Toast.LENGTH_SHORT).show();
- context.startActivity(new Intent(context, LoginActivity.class));
- }
- });
- }
-
- private static boolean isValid(String password, final Context context) {
- String savedPassword = SharedPrefsUtils.getStringPreference(context, Constant.PASSWORD, "");
- return password.equals(savedPassword);
-
- }
-
- private static int dpToPx(int dp) {
- return (int) (dp * Resources.getSystem().getDisplayMetrics().density);
- }
+ private static final String TAG = "AccountUtilsTAG";
+
+ public static void changePassword(final Context context, String newPassword) {
+ FirebaseAuth.getInstance().getCurrentUser().updatePassword(newPassword).addOnCompleteListener(new OnCompleteListener() {
+ @Override
+ public void onComplete(@NonNull Task task) {
+ Toast.makeText(context, R.string.password_updated, Toast.LENGTH_SHORT).show();
+ context.startActivity(new Intent(context, LoginActivity.class));
+ closeServices(context);
+
+ }
+ });
+ }
+
+ private static void closeServices(Context context) {
+ try {
+ context.stopService(new Intent(context, MainForegroundService.class));
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ try {
+ context.stopService(new Intent(context, GeoFencingForegroundService.class));
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ public static void logout(Context context) {
+ FirebaseAuth.getInstance().signOut();
+ context.startActivity(new Intent(context, LoginActivity.class));
+
+ closeServices(context);
+ }
+
+ public static void deleteAccount(Context context, String password) {
+ final String providerId = FirebaseAuth.getInstance().getCurrentUser().getProviders().get(0);
+
+ if (providerId.equals("google.com")) deleteAccountData(providerId, null, context);
+ else deleteAccountData(providerId, password, context);
+ closeServices(context);
+
+ }
+
+ private static void deleteAccountData(final String providerId, final String password, final Context context) {
+ final DatabaseReference databaseReference = FirebaseDatabase.getInstance().getReference("users");
+ final FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
+
+ Query parentQuery = databaseReference.child("parents").orderByChild("email").equalTo(user.getEmail());
+ parentQuery.addListenerForSingleValueEvent(new ValueEventListener() {
+ @Override
+ public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
+ if (dataSnapshot.exists()) {
+ DataSnapshot parentNodeShot = dataSnapshot.getChildren().iterator().next();
+ User parent = parentNodeShot.getValue(User.class);
+ String imgUrl = parent.getProfileImage();
+ removeImage(imgUrl, providerId, password, context);
+ databaseReference.child("parents").child(user.getUid()).removeValue();
+ } else {
+ Query childQuery = databaseReference.child("childs").orderByChild("email").equalTo(user.getEmail());
+ childQuery.addListenerForSingleValueEvent(new ValueEventListener() {
+ @Override
+ public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
+ if (dataSnapshot.exists()) {
+ DataSnapshot childNodeShot = dataSnapshot.getChildren().iterator().next();
+ User child = childNodeShot.getValue(User.class);
+ String imgUrl = child.getProfileImage();
+ removeImage(imgUrl, providerId, password, context);
+ databaseReference.child("childs").child(user.getUid()).removeValue();
+
+ }
+ }
+
+ @Override
+ public void onCancelled(@NonNull DatabaseError databaseError) {
+
+ }
+ });
+ }
+
+
+ }
+
+ @Override
+ public void onCancelled(@NonNull DatabaseError databaseError) {
+
+ }
+ });
+
+
+ }
+
+ private static void removeImage(String imgUrl, final String providerId, final String password, final Context context) {
+ if (imgUrl.contains("https://firebasestorage.googleapis.com")) {
+ StorageReference profileImageStorageReference = FirebaseStorage.getInstance().getReferenceFromUrl(imgUrl);
+ profileImageStorageReference.delete().addOnSuccessListener(new OnSuccessListener() {
+ @Override
+ public void onSuccess(Void aVoid) {
+ deleteUser(providerId, password, context);
+ }
+ }).addOnFailureListener(new OnFailureListener() {
+ @Override
+ public void onFailure(@NonNull Exception e) {
+ }
+ });
+ } else {
+ deleteUser(providerId, password, context);
+ }
+ }
+
+ private static void deleteUser(String providerId, final String password, final Context context) {
+ final FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
+ AuthCredential credential;
+ if (providerId.equals("google.com"))
+ credential = GoogleAuthProvider.getCredential(user.getEmail(), null);
+
+ else credential = EmailAuthProvider.getCredential(user.getEmail(), password);
+
+ user.reauthenticate(credential).addOnCompleteListener(new OnCompleteListener() {
+ @Override
+ public void onComplete(@NonNull Task task) {
+ user.delete().addOnCompleteListener(new OnCompleteListener() {
+ @Override
+ public void onComplete(@NonNull Task task) {
+ Toast.makeText(context, R.string.account_deleted, Toast.LENGTH_SHORT).show();
+ context.startActivity(new Intent(context, LoginActivity.class));
+ }
+ });
+ }
+ });
+ }
}
diff --git a/Application/app/src/main/java/com/mansourappdevelopment/androidapp/kidsafe/utils/Constant.java b/Application/app/src/main/java/com/mansourappdevelopment/androidapp/kidsafe/utils/Constant.java
index 8b98834..6721b82 100644
--- a/Application/app/src/main/java/com/mansourappdevelopment/androidapp/kidsafe/utils/Constant.java
+++ b/Application/app/src/main/java/com/mansourappdevelopment/androidapp/kidsafe/utils/Constant.java
@@ -39,6 +39,8 @@ public class Constant {
public static final int PACKAGE_USAGE_PERMISSION_REQUEST_CODE = 10;
public static final int CALL_PHONE_PERMISSION_REQUEST_CODE = 11;
public static final int USER_LOCATION_PERMISSION_REQUEST_CODE = 12;
+ public static final int GEO_FENCING_SERVICE_REQUEST_CODE = 13;
+ public static final int CHILD_LOCATION_PERMISSION_REQUEST_CODE = 14;
public static final String SWITCH_ID = "com.mansourappdevelopment.androidapp.kidsafe.utils.SWITCH_ID";
@@ -67,7 +69,10 @@ public class Constant {
public static final String PARENT_SIGN_UP = "com.mansourappdevelopment.androidapp.kidsafe.utils.PARENT_SIGN_UP";
public static final String ACTION_STOP_GEO_FENCING_SERVICE = "com.mansourappdevelopment.androidapp.kidsafe.utils.ACTION_STOP_GEO_FENCING_SERVICE";
- public static final int GEO_FENCING_SERVICE_REQUEST_CODE = 24;
public static final String INFORMATION_MESSAGE = "com.mansourappdevelopment.androidapp.kidsafe.utils.INFORMATION_MESSAGE";
public static final String INFORMATION_DIALOG_FRAGMENT_TAG = "com.mansourappdevelopment.androidapp.kidsafe.utils.INFORMATION_DIALOG_FRAGMENT_TAG";
+ public static final String PASSWORD_VALIDATION_DIALOG_FRAGMENT_TAG ="com.mansourappdevelopment.androidapp.kidsafe.utils.PASSWORD_VALIDATION_DIALOG_FRAGMENT_TAG";
+ public static final String LANGUAGE_SELECTION_DIALOG_FRAGMENT_TAG = "com.mansourappdevelopment.androidapp.kidsafe.utils.LANGUAGE_SELECTION_DIALOG_FRAGMENT_TAG";
+ public static final String PASSWORD_CHANGING_DIALOG_FRAGMENT_TAG = "com.mansourappdevelopment.androidapp.kidsafe.utils.PASSWORD_CHANGING_DIALOG_FRAGMENT_TAG";
+ public static final String ACCOUNT_DELETE_DIALOG_FRAGMENT_TAG = "com.mansourappdevelopment.androidapp.kidsafe.utils.ACCOUNT_DELETE_DIALOG_FRAGMENT_TAG";
}
diff --git a/Application/app/src/main/java/com/mansourappdevelopment/androidapp/kidsafe/utils/Validators.java b/Application/app/src/main/java/com/mansourappdevelopment/androidapp/kidsafe/utils/Validators.java
index e7b7a95..3102537 100644
--- a/Application/app/src/main/java/com/mansourappdevelopment/androidapp/kidsafe/utils/Validators.java
+++ b/Application/app/src/main/java/com/mansourappdevelopment/androidapp/kidsafe/utils/Validators.java
@@ -2,6 +2,7 @@
import android.app.Activity;
import android.content.Context;
+import android.location.LocationManager;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.Uri;
@@ -117,4 +118,9 @@ public static boolean isGooglePlayServicesAvailable(Activity activity) {
return true;
}
+
+ public static boolean isLocationOn(Context context) {
+ LocationManager locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
+ return locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER) || locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER);
+ }
}
diff --git a/Application/app/src/main/res/drawable/ic_about.xml b/Application/app/src/main/res/drawable/ic_about.xml
new file mode 100644
index 0000000..3f86b91
--- /dev/null
+++ b/Application/app/src/main/res/drawable/ic_about.xml
@@ -0,0 +1,10 @@
+
+
+
diff --git a/Application/app/src/main/res/drawable/ic_call_white.xml b/Application/app/src/main/res/drawable/ic_call_white.xml
new file mode 100644
index 0000000..41ecbfc
--- /dev/null
+++ b/Application/app/src/main/res/drawable/ic_call_white.xml
@@ -0,0 +1,10 @@
+
+
+
diff --git a/Application/app/src/main/res/drawable/ic_cloud_done.xml b/Application/app/src/main/res/drawable/ic_cloud_done.xml
new file mode 100644
index 0000000..9d75c04
--- /dev/null
+++ b/Application/app/src/main/res/drawable/ic_cloud_done.xml
@@ -0,0 +1,10 @@
+
+
+
diff --git a/Application/app/src/main/res/drawable/ic_connected.xml b/Application/app/src/main/res/drawable/ic_connected.xml
index ea7446e..d0bda9d 100644
--- a/Application/app/src/main/res/drawable/ic_connected.xml
+++ b/Application/app/src/main/res/drawable/ic_connected.xml
@@ -1,6 +1,15 @@
-
-
-
-
+
+
+
+
diff --git a/Application/app/src/main/res/drawable/ic_delete_white.xml b/Application/app/src/main/res/drawable/ic_delete_white.xml
new file mode 100644
index 0000000..54d212f
--- /dev/null
+++ b/Application/app/src/main/res/drawable/ic_delete_white.xml
@@ -0,0 +1,10 @@
+
+
+
diff --git a/Application/app/src/main/res/drawable/ic_freepik_logo.xml b/Application/app/src/main/res/drawable/ic_freepik_logo.xml
new file mode 100644
index 0000000..8f48dc1
--- /dev/null
+++ b/Application/app/src/main/res/drawable/ic_freepik_logo.xml
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
diff --git a/Application/app/src/main/res/drawable/ic_geofence.xml b/Application/app/src/main/res/drawable/ic_geofence.xml
index 25ab70c..af0b861 100644
--- a/Application/app/src/main/res/drawable/ic_geofence.xml
+++ b/Application/app/src/main/res/drawable/ic_geofence.xml
@@ -1,5 +1,10 @@
-
-
+
+
diff --git a/Application/app/src/main/res/drawable/ic_language.xml b/Application/app/src/main/res/drawable/ic_language.xml
new file mode 100644
index 0000000..0b25b27
--- /dev/null
+++ b/Application/app/src/main/res/drawable/ic_language.xml
@@ -0,0 +1,10 @@
+
+
+
diff --git a/Application/app/src/main/res/drawable/ic_launcher_about.png b/Application/app/src/main/res/drawable/ic_launcher_about.png
new file mode 100644
index 0000000..7da340c
Binary files /dev/null and b/Application/app/src/main/res/drawable/ic_launcher_about.png differ
diff --git a/Application/app/src/main/res/drawable/ic_message_white.xml b/Application/app/src/main/res/drawable/ic_message_white.xml
new file mode 100644
index 0000000..a935c9d
--- /dev/null
+++ b/Application/app/src/main/res/drawable/ic_message_white.xml
@@ -0,0 +1,5 @@
+
+
+
diff --git a/Application/app/src/main/res/layout/activity_about.xml b/Application/app/src/main/res/layout/activity_about.xml
new file mode 100644
index 0000000..05cebbd
--- /dev/null
+++ b/Application/app/src/main/res/layout/activity_about.xml
@@ -0,0 +1,161 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Application/app/src/main/res/layout/activity_account_verification.xml b/Application/app/src/main/res/layout/activity_account_verification.xml
index 590b2a8..6000528 100644
--- a/Application/app/src/main/res/layout/activity_account_verification.xml
+++ b/Application/app/src/main/res/layout/activity_account_verification.xml
@@ -1,6 +1,7 @@
+ android:layout_height="match_parent"
+ android:background="@color/white">
@@ -52,7 +53,7 @@
android:layout_gravity="bottom"
android:layout_marginStart="@dimen/margin_32dp"
android:layout_marginEnd="@dimen/margin_32dp"
- android:layout_marginBottom="@dimen/margin_8dp"
+ android:layout_marginBottom="@dimen/margin_24dp"
android:text="@string/resend_verification_email" />
diff --git a/Application/app/src/main/res/layout/activity_blocked_app.xml b/Application/app/src/main/res/layout/activity_blocked_app.xml
index 44c4fd5..099f5c4 100644
--- a/Application/app/src/main/res/layout/activity_blocked_app.xml
+++ b/Application/app/src/main/res/layout/activity_blocked_app.xml
@@ -3,6 +3,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
+ android:background="@color/white"
android:gravity="center"
android:orientation="vertical"
tools:context=".activities.BlockedAppActivity">
@@ -16,16 +17,16 @@
android:id="@+id/txtBlockedAppName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:textAlignment="center"
android:layout_margin="@dimen/margin_4dp"
- android:textSize="@dimen/text_size_18sp"
+ android:text="@string/child_app_name"
+ android:textAlignment="center"
android:textColor="@color/flatui_midnight_blue"
- android:text="@string/child_app_name" />
+ android:textSize="@dimen/text_size_18sp" />
+ android:textSize="@dimen/text_size_16sp" />
\ No newline at end of file
diff --git a/Application/app/src/main/res/layout/activity_child_signed_in.xml b/Application/app/src/main/res/layout/activity_child_signed_in.xml
index 8ee14fd..3f3c839 100644
--- a/Application/app/src/main/res/layout/activity_child_signed_in.xml
+++ b/Application/app/src/main/res/layout/activity_child_signed_in.xml
@@ -7,6 +7,27 @@
android:orientation="vertical"
tools:context=".activities.ChildSignedInActivity">
-
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Application/app/src/main/res/layout/activity_mode_selection.xml b/Application/app/src/main/res/layout/activity_mode_selection.xml
index 273672c..fc1b42e 100644
--- a/Application/app/src/main/res/layout/activity_mode_selection.xml
+++ b/Application/app/src/main/res/layout/activity_mode_selection.xml
@@ -1,18 +1,14 @@
-
-
-
+ android:background="@color/white">
+
-
-
-
+ android:layout_gravity="bottom"
+ android:layout_marginTop="@dimen/margin_128dp"
+ android:layout_marginBottom="@dimen/margin_64dp">
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/Application/app/src/main/res/layout/activity_settings.xml b/Application/app/src/main/res/layout/activity_settings.xml
new file mode 100644
index 0000000..70dca62
--- /dev/null
+++ b/Application/app/src/main/res/layout/activity_settings.xml
@@ -0,0 +1,104 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Application/app/src/main/res/layout/card_contact.xml b/Application/app/src/main/res/layout/card_contact.xml
index e303ba8..29f9c1e 100644
--- a/Application/app/src/main/res/layout/card_contact.xml
+++ b/Application/app/src/main/res/layout/card_contact.xml
@@ -68,6 +68,12 @@
style="@style/CardBody"
android:layout_width="wrap_content" />
+
+
+
+
\ No newline at end of file
diff --git a/Application/app/src/main/res/layout/fragment_dialog_change_password.xml b/Application/app/src/main/res/layout/fragment_dialog_change_password.xml
new file mode 100644
index 0000000..5407f91
--- /dev/null
+++ b/Application/app/src/main/res/layout/fragment_dialog_change_password.xml
@@ -0,0 +1,81 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Application/app/src/main/res/layout/fragment_dialog_delete_account.xml b/Application/app/src/main/res/layout/fragment_dialog_delete_account.xml
new file mode 100644
index 0000000..7bf1140
--- /dev/null
+++ b/Application/app/src/main/res/layout/fragment_dialog_delete_account.xml
@@ -0,0 +1,67 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Application/app/src/main/res/layout/fragment_dialog_language_selection.xml b/Application/app/src/main/res/layout/fragment_dialog_language_selection.xml
new file mode 100644
index 0000000..ff5c898
--- /dev/null
+++ b/Application/app/src/main/res/layout/fragment_dialog_language_selection.xml
@@ -0,0 +1,68 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Application/app/src/main/res/layout/fragment_dialog_password_validation.xml b/Application/app/src/main/res/layout/fragment_dialog_password_validation.xml
new file mode 100644
index 0000000..778fe09
--- /dev/null
+++ b/Application/app/src/main/res/layout/fragment_dialog_password_validation.xml
@@ -0,0 +1,71 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Application/app/src/main/res/layout/fragment_permissions_location.xml b/Application/app/src/main/res/layout/fragment_permissions_location.xml
index 0d5978c..52d61a0 100644
--- a/Application/app/src/main/res/layout/fragment_permissions_location.xml
+++ b/Application/app/src/main/res/layout/fragment_permissions_location.xml
@@ -1,40 +1,36 @@
-
-
-
-
-
-
+
+
+
+
+
+
+
+ android:layout_gravity="bottom"
+ android:orientation="vertical">
-
-
-
-
-
-
-
-
-
+
-
-
+
-
+ android:layout_gravity="center_horizontal|center_vertical"
+ android:orientation="horizontal">
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
-
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/Application/app/src/main/res/layout/fragment_permissions_main.xml b/Application/app/src/main/res/layout/fragment_permissions_main.xml
index 2fbfeba..ff8c641 100644
--- a/Application/app/src/main/res/layout/fragment_permissions_main.xml
+++ b/Application/app/src/main/res/layout/fragment_permissions_main.xml
@@ -1,39 +1,35 @@
-
+
-
+
-
+
+
+ android:layout_gravity="bottom">
+
-
-
\ No newline at end of file
diff --git a/Application/app/src/main/res/layout/fragment_permissions_phone_calls.xml b/Application/app/src/main/res/layout/fragment_permissions_phone_calls.xml
index 27e8c0d..526f93f 100644
--- a/Application/app/src/main/res/layout/fragment_permissions_phone_calls.xml
+++ b/Application/app/src/main/res/layout/fragment_permissions_phone_calls.xml
@@ -1,41 +1,36 @@
-
-
-
-
-
-
+ android:layout_gravity="center"
+ android:gravity="center"
+ android:orientation="vertical">
+
+
+
+
+
+
+ android:layout_gravity="bottom"
+ android:orientation="vertical">
-
-
-
-
-
-
-
-
-
-
-
+
-
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- android:layout_gravity="center"
- android:src="@drawable/ic_dot" />
-
-
-
+
+
-
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/Application/app/src/main/res/layout/fragment_permissions_settings.xml b/Application/app/src/main/res/layout/fragment_permissions_settings.xml
index e3b1f6c..a4bdde7 100644
--- a/Application/app/src/main/res/layout/fragment_permissions_settings.xml
+++ b/Application/app/src/main/res/layout/fragment_permissions_settings.xml
@@ -1,41 +1,36 @@
-
-
-
-
-
-
+ android:layout_gravity="center"
+ android:gravity="center"
+ android:orientation="vertical">
+
+
+
+
+
+
+ android:layout_gravity="bottom"
+ android:orientation="vertical">
-
-
-
-
-
-
-
-
-
+
-
-
-
-
+
-
-
+ android:layout_gravity="center_horizontal|center_vertical"
+ android:orientation="horizontal">
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
-
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/Application/app/src/main/res/layout/fragment_permissions_sms.xml b/Application/app/src/main/res/layout/fragment_permissions_sms.xml
index b5d3ed3..3767e0e 100644
--- a/Application/app/src/main/res/layout/fragment_permissions_sms.xml
+++ b/Application/app/src/main/res/layout/fragment_permissions_sms.xml
@@ -1,43 +1,36 @@
-
-
-
-
-
-
-
+
+
+ android:layout_gravity="center"
+ android:gravity="center"
+ android:orientation="vertical">
+
+
+
+
+
+
+ android:layout_gravity="bottom"
+ android:orientation="vertical">
-
-
-
+
-
-
+
-
+ android:layout_gravity="center_horizontal|center_vertical"
+ android:orientation="horizontal">
-
- android:layout_height="wrap_content"
- android:layout_gravity="center"
- android:src="@drawable/ic_dot_selected" />
+
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:src="@drawable/ic_dot_selected" />
-
+
-
- android:layout_height="wrap_content"
+
+
- android:layout_gravity="center"
- android:src="@drawable/ic_dot" />
-
+
-
+
+
-
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/Application/app/src/main/res/layout/horizontal_line.xml b/Application/app/src/main/res/layout/horizontal_line.xml
new file mode 100644
index 0000000..2f2fa33
--- /dev/null
+++ b/Application/app/src/main/res/layout/horizontal_line.xml
@@ -0,0 +1,4 @@
+
\ No newline at end of file
diff --git a/Application/app/src/main/res/layout/toolbar.xml b/Application/app/src/main/res/layout/toolbar.xml
index 15a464d..ae7fe6a 100644
--- a/Application/app/src/main/res/layout/toolbar.xml
+++ b/Application/app/src/main/res/layout/toolbar.xml
@@ -1,13 +1,4 @@
-
-
+
Him
+
+ - English
+ - Arabic
+
+
- Immediately
- Specify a period
diff --git a/Application/app/src/main/res/values/strings.xml b/Application/app/src/main/res/values/strings.xml
index 34396b8..21a9643 100644
--- a/Application/app/src/main/res/values/strings.xml
+++ b/Application/app/src/main/res/values/strings.xml
@@ -97,7 +97,6 @@
Delete Account
Rate Us
About
- This app is free and open source
Send Feedback
General
languageSharedPerfs
@@ -111,7 +110,6 @@
rateUsSharedPrefs
sendFeedbackSharedPrefs
Website
- https://xmansour.github.io/KidSafe
Version
1.0
Choose email client
@@ -216,10 +214,30 @@
No location history was found for
Center:
Diameter:
- Please verify your account through the email that was sent to the email you used in signing up, it may be within your drafts.
+ Please check your inbox for a confirmation email. Click the link in the email to confirm your email address
Account Verification
Resend verification email
You\'re offline \nCheck your connection and try again
+ Connected
+ Please enable your GPS
+ Please accept the following permission to allow kidsafe to function properly
+ KidSafe is a free and open source android parental control app which allows parents to keep their children\'s activity under control. KidSafe was developed as a graduation project by the members specified below
+ Smashicons
+ Freepik
+ Many thanks goes to freepik.com and smashiocns.com for the graphics
+ Developers
+ Mahmoud Mansour
+ Khalid Samir
+ Supervisor
+ D. Marwa Abbas
+ 1.0
+ Select kidsafe\'s language
+ Enter your old and new password
+ Old password
+ New password
+ Re-enter new password
+ New password doesn\'t match
+ Enter your password to delete your account
diff --git a/Application/app/src/main/res/values/styles.xml b/Application/app/src/main/res/values/styles.xml
index e78d846..8fee371 100644
--- a/Application/app/src/main/res/values/styles.xml
+++ b/Application/app/src/main/res/values/styles.xml
@@ -63,14 +63,11 @@
-
-
@@ -78,20 +75,20 @@
- match_parent
- wrap_content
- center
+ - @dimen/margin_32dp
+ - @dimen/margin_32dp
- @dimen/margin_8dp
- @dimen/margin_8dp
- - @color/flatui_wet_asphalt
- - @dimen/text_size_16sp
- - bold
+ - @color/flatui_midnight_blue
+ - @dimen/text_size_18sp
-
@@ -101,7 +98,7 @@
- wrap_content
- start|center
- @android:color/transparent
- - @color/flatui_wet_asphalt
+ - @color/flatui_midnight_blue
- false
- @dimen/text_size_16sp
@@ -171,7 +168,7 @@
- @color/flatui_pumpkin
-g
+ g
+
+
+
+
+
+
+
diff --git a/Application/app/src/main/res/xml/pref_main.xml b/Application/app/src/main/res/xml/pref_main.xml
deleted file mode 100644
index 9ecc6ae..0000000
--- a/Application/app/src/main/res/xml/pref_main.xml
+++ /dev/null
@@ -1,53 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file