Skip to content
Snippets Groups Projects
Commit ba37d6f2 authored by s22thong's avatar s22thong
Browse files
parents cc0918ba 713db051
No related branches found
No related tags found
No related merge requests found
Showing with 104 additions and 19 deletions
......@@ -11,7 +11,7 @@
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:icon="@drawable/baseline_manage_accounts_24"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
......
......@@ -126,7 +126,7 @@ public class DisplayUserActivity extends AppCompatActivity {
String phoneNumber = phoneTextView.getText().toString();
if (phoneNumber.trim().isEmpty()) {
Snackbar.make(findViewById(R.id.mainContent), "The number to be called is invalid", Snackbar.LENGTH_LONG).show();
Snackbar.make(findViewById(R.id.mainContent), getString(R.string.invalid_phone_number), Snackbar.LENGTH_LONG).show();
return;
}
......@@ -142,16 +142,16 @@ public class DisplayUserActivity extends AppCompatActivity {
callIntent.setData(Uri.parse("tel:" + phoneNumber));
startActivity(callIntent);
} catch (SecurityException e) {
Snackbar.make(v, "An error occurred during the call attempt: " + e, Snackbar.LENGTH_SHORT).show();
Snackbar.make(v, getString(R.string.call_attempt_error) + e, Snackbar.LENGTH_SHORT).show();
}
}
private void grantPermissionAlertDialog() {
new AlertDialog.Builder(this)
.setTitle("Call Permission Required")
.setMessage("This App needs Call permission in order to be able to handle calling a phone number")
.setNegativeButton("Cancel", (dialog, which) -> Toast.makeText(DisplayUserActivity.this, "Permission Denied", Toast.LENGTH_SHORT)
.setTitle(getString(R.string.call_permission_title))
.setMessage(getString(R.string.call_permission_message))
.setNegativeButton(getString(R.string.cancel), (dialog, which) -> Toast.makeText(DisplayUserActivity.this, getString(R.string.permission_denied), Toast.LENGTH_SHORT)
.show())
.setPositiveButton("Ok", (dialog, which) -> ActivityCompat.requestPermissions(DisplayUserActivity.this, new String[]{Manifest.permission.CALL_PHONE}, 3))
.create()
......
......@@ -62,11 +62,8 @@ public class MainActivity extends AppCompatActivity {
birthDate = getString(R.string.pick_date_hint);
findAllViewById();
birthDateButton.setOnClickListener(view -> showDatePicker());
if (savedInstanceState == null) {
if(savedInstanceState == null)
restorePreferences();
}
}
private void findAllViewById() {
......@@ -207,7 +204,7 @@ public class MainActivity extends AppCompatActivity {
} catch (Exception e) {
final Snackbar snackbar;
if (e.getMessage() == null) {
snackbar = Snackbar.make(mainContent, "An error occurred please try again.", Snackbar.LENGTH_LONG);
snackbar = Snackbar.make(mainContent, getString(R.string.error_try_again), Snackbar.LENGTH_LONG);
} else {
snackbar = Snackbar.make(mainContent, e.getMessage(), Snackbar.LENGTH_LONG);
}
......@@ -322,7 +319,7 @@ public class MainActivity extends AppCompatActivity {
private void openWikipedia() {
if (birthCity == null || birthCity.trim().isEmpty()) {
Snackbar.make(mainContent, "Please enter a birth city first", Snackbar.LENGTH_LONG).show();
Snackbar.make(mainContent, getString(R.string.enter_birth_city), Snackbar.LENGTH_LONG).show();
return;
}
......@@ -332,20 +329,20 @@ public class MainActivity extends AppCompatActivity {
if (intent.resolveActivity(getPackageManager()) != null) {
startActivity(intent);
} else {
Snackbar.make(mainContent, "No browser found to open Wikipedia", Snackbar.LENGTH_LONG).show();
Snackbar.make(mainContent, getString(R.string.no_browser_found), Snackbar.LENGTH_LONG).show();
}
}
private void shareCity() {
if (birthCity == null || birthCity.trim().isEmpty()) {
Snackbar.make(mainContent, "Please enter a birth city first", Snackbar.LENGTH_LONG).show();
Snackbar.make(mainContent, getString(R.string.enter_birth_city), Snackbar.LENGTH_LONG).show();
return;
}
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_TEXT, birthCity);
Intent chooser = Intent.createChooser(intent, "Share ville");
Intent chooser = Intent.createChooser(intent, getString(R.string.share_city));
startActivity(chooser);
}
......@@ -390,4 +387,4 @@ public class MainActivity extends AppCompatActivity {
}
);
}
\ No newline at end of file
}
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:tint="#000000" android:viewportHeight="24" android:viewportWidth="24" android:width="24dp">
<path android:fillColor="@android:color/white" android:pathData="M10,8m-4,0a4,4 0,1 1,8 0a4,4 0,1 1,-8 0"/>
<path android:fillColor="@android:color/white" android:pathData="M10.67,13.02C10.45,13.01 10.23,13 10,13c-2.42,0 -4.68,0.67 -6.61,1.82C2.51,15.34 2,16.32 2,17.35V20h9.26C10.47,18.87 10,17.49 10,16C10,14.93 10.25,13.93 10.67,13.02z"/>
<path android:fillColor="@android:color/white" android:pathData="M20.75,16c0,-0.22 -0.03,-0.42 -0.06,-0.63l1.14,-1.01l-1,-1.73l-1.45,0.49c-0.32,-0.27 -0.68,-0.48 -1.08,-0.63L18,11h-2l-0.3,1.49c-0.4,0.15 -0.76,0.36 -1.08,0.63l-1.45,-0.49l-1,1.73l1.14,1.01c-0.03,0.21 -0.06,0.41 -0.06,0.63s0.03,0.42 0.06,0.63l-1.14,1.01l1,1.73l1.45,-0.49c0.32,0.27 0.68,0.48 1.08,0.63L16,21h2l0.3,-1.49c0.4,-0.15 0.76,-0.36 1.08,-0.63l1.45,0.49l1,-1.73l-1.14,-1.01C20.72,16.42 20.75,16.22 20.75,16zM17,18c-1.1,0 -2,-0.9 -2,-2s0.9,-2 2,-2s2,0.9 2,2S18.1,18 17,18z"/>
</vector>
......@@ -5,10 +5,10 @@
</item>
<item
android:id="@+id/wikipediaAction"
android:title="Open Wikipedia">
android:title="@string/open_wikipedia">
</item>
<item
android:id="@+id/shareAction"
android:title="Share">
android:title="@string/share">
</item>
</menu>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
<color name="green">#4CAF50</color>
<color name="red">#6B2626</color>
</resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="departments">
<item>Côtes d\'Armor</item>
<item>Finistère</item>
<item>Ille et Vilaine</item>
<item>Morbihan</item>
</string-array>
</resources>
\ No newline at end of file
<resources>
<string name="app_name">Annuaire</string>
<string name="first_name_label">Prénom</string>
<string name="first_name_placeholder">Jean</string>
<string name="last_name_label">Nom</string>
<string name="last_name_placeholder">Dupont</string>
<string name="birth_date_label">Date de naissance</string>
<string name="birth_date_placeholder">26/01/2002</string>
<string name="birth_dept_label">Département de naissance</string>
<string name="birth_city_label">Ville de naissance</string>
<string name="birth_city_placeholder">Londres</string>
<string name="validate">Valider</string>
<string name="reset_action">Réinitialiser</string>
<string name="cancel">Annuler</string>
<string name="ok">OK</string>
<string name="permission_denied">Permission refusée</string>
<string name="add_phone_number_label">Ajouter un numéro de téléphone</string>
<string name="phone_number_label">Numéro de téléphone</string>
<string name="phone_number_placeholder">0612345678</string>
<string name="empty_warning">Veuillez remplir tous les champs vides !</string>
<string name="close_snackbar">Fermer</string>
<string name="pick_date_hint">Choisir une date</string>
<string name="invalid_phone_number">Le numéro à appeler est invalide</string>
<string name="call_attempt_error">Une erreur est survenue lors de la tentative d\'appel : </string>
<string name="call_permission_title">Permission d\'appel requise</string>
<string name="call_permission_message">Cette application nécessite la permission d\'appel pour pouvoir effectuer un appel téléphonique</string>
<string name="enter_birth_city">Veuillez entrer une ville de naissance</string>
<string name="no_browser_found">Aucun navigateur trouvé pour ouvrir Wikipédia</string>
<string name="share_city">Partager la ville</string>
<string name="error_try_again">Une erreur est survenue, veuillez réessayer.</string>
<string name="open_wikipedia">Ouvrir Wikipédia</string>
<string name="share">Partager</string>
<string name="error_first_name_empty">Le prénom ne peut pas être vide.</string>
</resources>
\ No newline at end of file
<resources>
<style name="HintTextAppearance" parent="TextAppearance.AppCompat">
<item name="android:textSize">15sp</item>
<item name="android:textColorHint">#888888</item>
</style>
</resources>
\ No newline at end of file
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Base.Theme.MyFirstApplication" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your light theme here. -->
<!-- <item name="colorPrimary">@color/my_light_primary</item> -->
</style>
<style name="Theme.MyFirstApplication" parent="Base.Theme.MyFirstApplication" />
</resources>
\ No newline at end of file
<resources>
<string name="app_name">MyFirstApplication</string>
<string name="app_name">Directory</string>
<string name="first_name_label">First name</string>
<string name="first_name_placeholder">John</string>
<string name="last_name_label">Last name</string>
......@@ -12,10 +12,23 @@
<string name="validate">Validate</string>
<string name="reset_action">Reset</string>
<string name="cancel">Cancel</string>
<string name="ok">OK</string>
<string name="permission_denied">Permission Denied</string>
<string name="add_phone_number_label">Add a phone number</string>
<string name="phone_number_label">Phone number</string>
<string name="phone_number_placeholder">0612345678</string>
<string name="empty_warning">Please fill all empty field !</string>
<string name="close_snackbar">Close</string>
<string name="pick_date_hint">Pick date</string>
<string name="invalid_phone_number">The number to be called is invalid</string>
<string name="call_attempt_error">An error occurred during the call attempt: </string>
<string name="call_permission_title">Call Permission Required</string>
<string name="call_permission_message">This App needs Call permission in order to be able to handle calling a phone number</string>
<string name="enter_birth_city">Please enter a birth city first</string>
<string name="no_browser_found">No browser found to open Wikipedia</string>
<string name="share_city">Share city</string>
<string name="error_try_again">An error occurred please try again.</string>
<string name="open_wikipedia">Open Wikipedia</string>
<string name="share">Share</string>
<string name="error_first_name_empty">The first name can not be empty.</string>
</resources>
\ No newline at end of file
<svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="24px" viewBox="0 0 24 24" width="24px" fill="#1f1f1f"><g><path d="M0,0h24v24H0V0z" fill="none"/></g><g><g><circle cx="10" cy="8" r="4"/><path d="M10.67,13.02C10.45,13.01,10.23,13,10,13c-2.42,0-4.68,0.67-6.61,1.82C2.51,15.34,2,16.32,2,17.35V20h9.26 C10.47,18.87,10,17.49,10,16C10,14.93,10.25,13.93,10.67,13.02z"/><path d="M20.75,16c0-0.22-0.03-0.42-0.06-0.63l1.14-1.01l-1-1.73l-1.45,0.49c-0.32-0.27-0.68-0.48-1.08-0.63L18,11h-2l-0.3,1.49 c-0.4,0.15-0.76,0.36-1.08,0.63l-1.45-0.49l-1,1.73l1.14,1.01c-0.03,0.21-0.06,0.41-0.06,0.63s0.03,0.42,0.06,0.63l-1.14,1.01 l1,1.73l1.45-0.49c0.32,0.27,0.68,0.48,1.08,0.63L16,21h2l0.3-1.49c0.4-0.15,0.76-0.36,1.08-0.63l1.45,0.49l1-1.73l-1.14-1.01 C20.72,16.42,20.75,16.22,20.75,16z M17,18c-1.1,0-2-0.9-2-2s0.9-2,2-2s2,0.9,2,2S18.1,18,17,18z"/></g></g></svg>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment