Add source code
BIN
.img/screenshot.png
Executable file
After Width: | Height: | Size: 220 KiB |
1
app/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
/build
|
36
app/build.gradle
Normal file
|
@ -0,0 +1,36 @@
|
|||
plugins {
|
||||
id 'com.android.application'
|
||||
}
|
||||
|
||||
android {
|
||||
namespace 'org.clubelec.clubelecemailkiosk'
|
||||
compileSdk 33
|
||||
|
||||
defaultConfig {
|
||||
applicationId "org.clubelec.clubelecemailkiosk"
|
||||
minSdk 21
|
||||
targetSdk 33
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
implementation 'androidx.appcompat:appcompat:1.6.1'
|
||||
implementation 'com.google.android.material:material:1.9.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
||||
}
|
21
app/proguard-rules.pro
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
26
app/src/main/AndroidManifest.xml
Normal file
|
@ -0,0 +1,26 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||
android:fullBackupContent="@xml/backup_rules"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.ClubElecEmailKiosk"
|
||||
tools:targetApi="31">
|
||||
<activity
|
||||
android:name=".activity.MainActivity"
|
||||
android:exported="true"
|
||||
android:screenOrientation="portrait">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
|
@ -0,0 +1,361 @@
|
|||
package org.clubelec.clubelecemailkiosk.activity;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.ContentValues;
|
||||
import android.content.Intent;
|
||||
import android.database.Cursor;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.text.InputFilter;
|
||||
import android.text.InputType;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Patterns;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowInsets;
|
||||
import android.view.WindowManager;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.Button;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.google.android.material.elevation.SurfaceColors;
|
||||
|
||||
import org.clubelec.clubelecemailkiosk.R;
|
||||
import org.clubelec.clubelecemailkiosk.helper.DatabaseHelper;
|
||||
import org.clubelec.clubelecemailkiosk.helper.SharedPrefManager;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class MainActivity extends AppCompatActivity {
|
||||
|
||||
private static final String PREF_NOT_FIRST_LAUNCH = "not_first_launch";
|
||||
private static final String PREF_PASSWORD = "password";
|
||||
private static final int REQUEST_CODE_EXPORT_EMAILS = 2;
|
||||
private static final int REQUIRED_TAP_COUNT = 10;
|
||||
private static final long MAX_TAP_DELAY = 3000;
|
||||
private DatabaseHelper databaseHelper;
|
||||
private EditText editTextEmailAddress;
|
||||
private CheckBox checkBox;
|
||||
private Button button;
|
||||
private int tapCount = 0;
|
||||
private int passwordMaxLength = 6;
|
||||
private Handler handler;
|
||||
private Runnable tapResetRunnable;
|
||||
private SharedPrefManager sharedPrefManager;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
getWindow().setStatusBarColor(SurfaceColors.SURFACE_2.getColor(this));
|
||||
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
|
||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
setContentView(R.layout.activity_main);
|
||||
|
||||
getWindow().getDecorView()
|
||||
.setOnSystemUiVisibilityChangeListener(visibility -> {
|
||||
if ((visibility & View.SYSTEM_UI_FLAG_FULLSCREEN) == 0) {
|
||||
hideSystemUI(getWindow());
|
||||
}
|
||||
});
|
||||
|
||||
sharedPrefManager = SharedPrefManager.getInstance(getApplicationContext());
|
||||
boolean isNotFirstLaunch = sharedPrefManager.getBool(PREF_NOT_FIRST_LAUNCH);
|
||||
|
||||
if (!isNotFirstLaunch) {
|
||||
showFirstLaunchPasswordInputDialog();
|
||||
hideSystemUI(getWindow());
|
||||
}
|
||||
|
||||
databaseHelper = new DatabaseHelper(this);
|
||||
|
||||
editTextEmailAddress = findViewById(R.id.editTextTextEmailAddress);
|
||||
editTextEmailAddress.setOnFocusChangeListener((v, hasFocus) -> {
|
||||
if (!hasFocus) {
|
||||
hideKeyboard(v);
|
||||
}
|
||||
});
|
||||
checkBox = findViewById(R.id.checkBox);
|
||||
button = findViewById(R.id.button);
|
||||
|
||||
button.setOnClickListener(v -> onButtonClick());
|
||||
|
||||
ImageView logoImageView = findViewById(R.id.activity_main_clubelec_logo);
|
||||
logoImageView.setOnClickListener(v -> onLogoClick());
|
||||
|
||||
handler = new Handler();
|
||||
tapResetRunnable = () -> tapCount = 0;
|
||||
}
|
||||
|
||||
private void showFirstLaunchPasswordInputDialog() {
|
||||
final EditText input = new EditText(this);
|
||||
input.setInputType(InputType.TYPE_CLASS_NUMBER);
|
||||
InputFilter[] filters = new InputFilter[]{new InputFilter.LengthFilter(passwordMaxLength)};
|
||||
input.setFilters(filters);
|
||||
new AlertDialog.Builder(this)
|
||||
.setTitle(R.string.first_launch_password)
|
||||
.setMessage(R.string.first_launch_password_desc)
|
||||
.setView(input)
|
||||
.setPositiveButton(android.R.string.ok, (dialog, which) -> {
|
||||
String password = input.getText().toString();
|
||||
if (!TextUtils.isEmpty(password) && password.length() == passwordMaxLength) {
|
||||
sharedPrefManager.saveBool(PREF_NOT_FIRST_LAUNCH, true);
|
||||
sharedPrefManager.saveString(PREF_PASSWORD, password);
|
||||
} else {
|
||||
showFirstLaunchPasswordInputDialog();
|
||||
}
|
||||
})
|
||||
.setCancelable(false)
|
||||
.show();
|
||||
}
|
||||
|
||||
private void onButtonClick() {
|
||||
String email = editTextEmailAddress.getText().toString();
|
||||
boolean isCheckBoxChecked = checkBox.isChecked();
|
||||
|
||||
if (TextUtils.isEmpty(email)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Patterns.EMAIL_ADDRESS.matcher(email).matches()) {
|
||||
showErrorDialog(getString(R.string.invalid_email_format));
|
||||
} else {
|
||||
if (!isCheckBoxChecked) {
|
||||
showErrorDialog(getString(R.string.checkbox_unchecked));
|
||||
} else {
|
||||
showConfirmationDialog(getString(R.string.is_email_correct) + email);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void showConfirmationDialog(String message) {
|
||||
new AlertDialog.Builder(this)
|
||||
.setTitle(R.string.confirmation_dialog)
|
||||
.setMessage(message)
|
||||
.setPositiveButton(android.R.string.yes, (dialog, which) -> {
|
||||
String email = editTextEmailAddress.getText().toString();
|
||||
saveEmailToDatabase(email);
|
||||
editTextEmailAddress = findViewById(R.id.editTextTextEmailAddress);
|
||||
checkBox = findViewById(R.id.checkBox);
|
||||
editTextEmailAddress.setText("");
|
||||
checkBox.setChecked(false);
|
||||
Toast.makeText(MainActivity.this, getString(R.string.email_saved), Toast.LENGTH_SHORT).show();
|
||||
})
|
||||
.setNegativeButton(android.R.string.no, null)
|
||||
.show();
|
||||
}
|
||||
|
||||
private void saveEmailToDatabase(String email) {
|
||||
SQLiteDatabase db = databaseHelper.getWritableDatabase();
|
||||
ContentValues values = new ContentValues();
|
||||
values.put(DatabaseHelper.COLUMN_EMAIL, email);
|
||||
db.insert(DatabaseHelper.TABLE_EMAILS, null, values);
|
||||
}
|
||||
|
||||
|
||||
private void showErrorDialog(String message) {
|
||||
new AlertDialog.Builder(this)
|
||||
.setTitle(R.string.error)
|
||||
.setMessage(message)
|
||||
.setPositiveButton(android.R.string.ok, null)
|
||||
.show();
|
||||
}
|
||||
|
||||
private void onLogoClick() {
|
||||
tapCount++;
|
||||
if (tapCount == REQUIRED_TAP_COUNT) {
|
||||
handler.removeCallbacks(tapResetRunnable);
|
||||
handler.postDelayed(tapResetRunnable, MAX_TAP_DELAY);
|
||||
showPasswordDialog();
|
||||
} else if (tapCount > REQUIRED_TAP_COUNT) {
|
||||
handler.removeCallbacks(tapResetRunnable);
|
||||
tapCount = 1;
|
||||
} else {
|
||||
handler.removeCallbacks(tapResetRunnable);
|
||||
handler.postDelayed(tapResetRunnable, MAX_TAP_DELAY);
|
||||
}
|
||||
}
|
||||
|
||||
private void showPasswordDialog() {
|
||||
final EditText input = new EditText(this);
|
||||
input.setInputType(InputType.TYPE_CLASS_NUMBER);
|
||||
InputFilter[] filters = new InputFilter[]{new InputFilter.LengthFilter(passwordMaxLength)};
|
||||
input.setFilters(filters);
|
||||
|
||||
new AlertDialog.Builder(this)
|
||||
.setTitle(R.string.enter_password)
|
||||
.setView(input)
|
||||
.setCancelable(false)
|
||||
.setPositiveButton(android.R.string.ok, (dialog, which) -> {
|
||||
String enteredPassword = input.getText().toString();
|
||||
if (enteredPassword.length() != passwordMaxLength) {
|
||||
showErrorDialog(getString(R.string.enter_password_incorrect_format));
|
||||
} else {
|
||||
String storedPassword = sharedPrefManager.getString(PREF_PASSWORD);
|
||||
|
||||
if (enteredPassword.equals(storedPassword)) {
|
||||
showActionsDialog();
|
||||
} else {
|
||||
showErrorDialog(getString(R.string.enter_password_incorrect));
|
||||
}
|
||||
}
|
||||
})
|
||||
.setNegativeButton(android.R.string.cancel, null)
|
||||
.show();
|
||||
}
|
||||
|
||||
private void showActionsDialog() {
|
||||
String[] actions = {getString(R.string.show_emails), getString(R.string.export_emails), getString(R.string.clear_database)};
|
||||
new AlertDialog.Builder(this)
|
||||
.setTitle(R.string.select_action)
|
||||
.setItems(actions, (dialog, which) -> {
|
||||
switch (which) {
|
||||
case 0:
|
||||
showEmails();
|
||||
break;
|
||||
case 1:
|
||||
openExportActivity();
|
||||
break;
|
||||
case 2:
|
||||
clearDatabase();
|
||||
break;
|
||||
}
|
||||
})
|
||||
.show();
|
||||
}
|
||||
|
||||
private void showEmails() {
|
||||
List<String> emails = getEmailsFromDatabase();
|
||||
StringBuilder builder = new StringBuilder();
|
||||
for (String email : emails) {
|
||||
builder.append(email).append("\n");
|
||||
}
|
||||
|
||||
new AlertDialog.Builder(this)
|
||||
.setTitle(R.string.saved_emails)
|
||||
.setMessage(builder.toString())
|
||||
.setPositiveButton(android.R.string.ok, null)
|
||||
.show();
|
||||
}
|
||||
|
||||
private void clearDatabase() {
|
||||
SQLiteDatabase db = databaseHelper.getWritableDatabase();
|
||||
db.delete(DatabaseHelper.TABLE_EMAILS, null, null);
|
||||
Toast.makeText(this, getString(R.string.database_cleared), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
private void openExportActivity() {
|
||||
Intent intent = new Intent(Intent.ACTION_CREATE_DOCUMENT);
|
||||
intent.addCategory(Intent.CATEGORY_OPENABLE);
|
||||
intent.setType("text/plain");
|
||||
intent.putExtra(Intent.EXTRA_TITLE, "emails.txt");
|
||||
startActivityForResult(intent, REQUEST_CODE_EXPORT_EMAILS);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
if (requestCode == REQUEST_CODE_EXPORT_EMAILS && resultCode == Activity.RESULT_OK) {
|
||||
if (data != null && data.getData() != null) {
|
||||
Uri uri = data.getData();
|
||||
exportEmails(uri);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void exportEmails(Uri uri) {
|
||||
List<String> emailsList = getEmailsFromDatabase();
|
||||
|
||||
if (emailsList.isEmpty()) {
|
||||
Toast.makeText(this, getString(R.string.no_emails_found), Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
OutputStream outputStream = getContentResolver().openOutputStream(uri);
|
||||
if (outputStream != null) {
|
||||
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(outputStream));
|
||||
for (String email : emailsList) {
|
||||
writer.write(email);
|
||||
writer.newLine();
|
||||
}
|
||||
writer.close();
|
||||
Toast.makeText(this, getString(R.string.emails_exported), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
Toast.makeText(this, getString(R.string.export_failed), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
private List<String> getEmailsFromDatabase() {
|
||||
List<String> emails = new ArrayList<>();
|
||||
|
||||
SQLiteDatabase db = databaseHelper.getReadableDatabase();
|
||||
String[] projection = {DatabaseHelper.COLUMN_EMAIL};
|
||||
Cursor cursor = db.query(DatabaseHelper.TABLE_EMAILS, projection, null, null, null, null, null);
|
||||
|
||||
if (cursor != null) {
|
||||
while (cursor.moveToNext()) {
|
||||
String email = cursor.getString(cursor.getColumnIndexOrThrow(DatabaseHelper.COLUMN_EMAIL));
|
||||
emails.add(email);
|
||||
}
|
||||
cursor.close();
|
||||
}
|
||||
|
||||
return emails;
|
||||
}
|
||||
|
||||
public void hideKeyboard(View view) {
|
||||
InputMethodManager inputMethodManager = (InputMethodManager) getSystemService(Activity.INPUT_METHOD_SERVICE);
|
||||
inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWindowFocusChanged(boolean hasFocus) {
|
||||
super.onWindowFocusChanged(hasFocus);
|
||||
hideSystemUI(getWindow());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
hideSystemUI(getWindow());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
|
||||
}
|
||||
|
||||
public void hideSystemUI(Window window) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||
window.getInsetsController().hide(WindowInsets.Type.systemBars());
|
||||
} else {
|
||||
View decorView = window.getDecorView();
|
||||
int uiVisibility = decorView.getSystemUiVisibility();
|
||||
uiVisibility |= View.SYSTEM_UI_FLAG_LOW_PROFILE;
|
||||
uiVisibility |= View.SYSTEM_UI_FLAG_FULLSCREEN;
|
||||
uiVisibility |= View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
|
||||
uiVisibility |= View.SYSTEM_UI_FLAG_IMMERSIVE;
|
||||
uiVisibility |= View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
|
||||
decorView.setSystemUiVisibility(uiVisibility);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
package org.clubelec.clubelecemailkiosk.helper;
|
||||
|
||||
import android.content.Context;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.database.sqlite.SQLiteOpenHelper;
|
||||
|
||||
public class DatabaseHelper extends SQLiteOpenHelper {
|
||||
|
||||
public static final String TABLE_EMAILS = "emails";
|
||||
public static final String COLUMN_ID = "_id";
|
||||
public static final String COLUMN_EMAIL = "email";
|
||||
private static final String DATABASE_NAME = "email.db";
|
||||
private static final int DATABASE_VERSION = 1;
|
||||
private static final String CREATE_TABLE_EMAILS =
|
||||
"CREATE TABLE " + TABLE_EMAILS + "(" +
|
||||
COLUMN_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " +
|
||||
COLUMN_EMAIL + " TEXT NOT NULL" +
|
||||
")";
|
||||
|
||||
public DatabaseHelper(Context context) {
|
||||
super(context, DATABASE_NAME, null, DATABASE_VERSION);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(SQLiteDatabase db) {
|
||||
db.execSQL(CREATE_TABLE_EMAILS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
|
||||
db.execSQL("DROP TABLE IF EXISTS " + TABLE_EMAILS);
|
||||
onCreate(db);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,133 @@
|
|||
package org.clubelec.clubelecemailkiosk.helper;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
|
||||
public class SharedPrefManager {
|
||||
private static final String SHARED_PREF_NAME = "travelogue_sharepref";
|
||||
private static SharedPrefManager mInstance;
|
||||
private final Context mCtx;
|
||||
|
||||
private SharedPrefManager(Context mCtx) {
|
||||
this.mCtx = mCtx;
|
||||
}
|
||||
|
||||
public static synchronized SharedPrefManager getInstance(Context mCtx) {
|
||||
if (mInstance == null) {
|
||||
mInstance = new SharedPrefManager(mCtx);
|
||||
}
|
||||
return mInstance;
|
||||
}
|
||||
|
||||
public void saveString(String key, String value) {
|
||||
SharedPreferences sharedPreferences = mCtx.getSharedPreferences(SHARED_PREF_NAME, Context.MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = sharedPreferences.edit();
|
||||
editor.putString(key, value);
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
public void saveBool(String key, boolean value) {
|
||||
SharedPreferences sharedPreferences = mCtx.getSharedPreferences(SHARED_PREF_NAME, Context.MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = sharedPreferences.edit();
|
||||
editor.putBoolean(key, value);
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
public void saveInt(String key, int value) {
|
||||
SharedPreferences sharedPreferences = mCtx.getSharedPreferences(SHARED_PREF_NAME, Context.MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = sharedPreferences.edit();
|
||||
editor.putInt(key, value);
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
public void saveFloat(String key, float value) {
|
||||
SharedPreferences sharedPreferences = mCtx.getSharedPreferences(SHARED_PREF_NAME, Context.MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = sharedPreferences.edit();
|
||||
editor.putFloat(key, value);
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
public void saveLong(String key, long value) {
|
||||
SharedPreferences sharedPreferences = mCtx.getSharedPreferences(SHARED_PREF_NAME, Context.MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = sharedPreferences.edit();
|
||||
editor.putLong(key, value);
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
public void updateString(String key, String value) {
|
||||
SharedPreferences sharedPreferences = mCtx.getSharedPreferences(SHARED_PREF_NAME, Context.MODE_PRIVATE);
|
||||
if (sharedPreferences.contains(key)) {
|
||||
SharedPreferences.Editor editor = sharedPreferences.edit();
|
||||
editor.putString(key, value);
|
||||
editor.apply();
|
||||
}
|
||||
}
|
||||
|
||||
public void updateBool(String key, boolean value) {
|
||||
SharedPreferences sharedPreferences = mCtx.getSharedPreferences(SHARED_PREF_NAME, Context.MODE_PRIVATE);
|
||||
if (sharedPreferences.contains(key)) {
|
||||
SharedPreferences.Editor editor = sharedPreferences.edit();
|
||||
editor.putBoolean(key, value);
|
||||
editor.apply();
|
||||
}
|
||||
}
|
||||
|
||||
public void updateInt(String key, int value) {
|
||||
SharedPreferences sharedPreferences = mCtx.getSharedPreferences(SHARED_PREF_NAME, Context.MODE_PRIVATE);
|
||||
if (sharedPreferences.contains(key)) {
|
||||
SharedPreferences.Editor editor = sharedPreferences.edit();
|
||||
editor.putInt(key, value);
|
||||
editor.apply();
|
||||
}
|
||||
}
|
||||
|
||||
public void updateFloat(String key, float value) {
|
||||
SharedPreferences sharedPreferences = mCtx.getSharedPreferences(SHARED_PREF_NAME, Context.MODE_PRIVATE);
|
||||
if (sharedPreferences.contains(key)) {
|
||||
SharedPreferences.Editor editor = sharedPreferences.edit();
|
||||
editor.putFloat(key, value);
|
||||
editor.apply();
|
||||
}
|
||||
}
|
||||
|
||||
public void updateLong(String key, long value) {
|
||||
SharedPreferences sharedPreferences = mCtx.getSharedPreferences(SHARED_PREF_NAME, Context.MODE_PRIVATE);
|
||||
if (sharedPreferences.contains(key)) {
|
||||
SharedPreferences.Editor editor = sharedPreferences.edit();
|
||||
editor.putLong(key, value);
|
||||
editor.apply();
|
||||
}
|
||||
}
|
||||
|
||||
public String getString(String key) {
|
||||
SharedPreferences sharedPreferences = mCtx.getSharedPreferences(SHARED_PREF_NAME, Context.MODE_PRIVATE);
|
||||
return sharedPreferences.getString(key, null);
|
||||
}
|
||||
|
||||
public boolean getBool(String key) {
|
||||
SharedPreferences sharedPreferences = mCtx.getSharedPreferences(SHARED_PREF_NAME, Context.MODE_PRIVATE);
|
||||
return sharedPreferences.getBoolean(key, false);
|
||||
}
|
||||
|
||||
public int getInt(String key) {
|
||||
SharedPreferences sharedPreferences = mCtx.getSharedPreferences(SHARED_PREF_NAME, Context.MODE_PRIVATE);
|
||||
return sharedPreferences.getInt(key, 0);
|
||||
}
|
||||
|
||||
public float getFloat(String key) {
|
||||
SharedPreferences sharedPreferences = mCtx.getSharedPreferences(SHARED_PREF_NAME, Context.MODE_PRIVATE);
|
||||
return sharedPreferences.getFloat(key, 0f);
|
||||
}
|
||||
|
||||
public long getLong(String key) {
|
||||
SharedPreferences sharedPreferences = mCtx.getSharedPreferences(SHARED_PREF_NAME, Context.MODE_PRIVATE);
|
||||
return sharedPreferences.getLong(key, 0L);
|
||||
}
|
||||
|
||||
public void clearPreferences() {
|
||||
SharedPreferences sharedPreferences = mCtx.getSharedPreferences(SHARED_PREF_NAME, Context.MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = sharedPreferences.edit();
|
||||
editor.clear();
|
||||
editor.apply();
|
||||
}
|
||||
}
|
BIN
app/src/main/play_store_512.png
Normal file
After Width: | Height: | Size: 30 KiB |
8
app/src/main/res/drawable/button.xml
Normal file
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="@color/colorPrimary" />
|
||||
<stroke
|
||||
android:width="1.5dp"
|
||||
android:color="@color/colorPrimary" />
|
||||
<corners android:radius="12dp" />
|
||||
</shape>
|
19
app/src/main/res/drawable/clubelec_integration.xml
Normal file
87
app/src/main/res/drawable/undraw_subscribe.xml
Normal file
|
@ -0,0 +1,87 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="740.86dp"
|
||||
android:height="511.67dp"
|
||||
android:viewportWidth="740.86"
|
||||
android:viewportHeight="511.67">
|
||||
<path
|
||||
android:fillColor="#fff"
|
||||
android:pathData="M733.86,193.67h-0.2l-114.8,49.02 -157.07,67.07a5.07,5.07 0,0 1,-3.88 0.02l-162.05,-67.23 -117.62,-48.8 -0.18,-0.08h-0.2a7.01,7.01 0,0 0,-7 7v304a7.01,7.01 0,0 0,7 7h556a7.01,7.01 0,0 0,7 -7v-304A7.01,7.01 0,0 0,733.86 193.67Z" />
|
||||
<path
|
||||
android:fillColor="#3f3d56"
|
||||
android:pathData="M735.86,195.67a1,1 0,0 1,-0.57 -0.18L458.73,2.89a5.02,5.02 0,0 0,-5.73 0.01L178.43,195.49a1,1 0,0 1,-1.15 -1.64l274.57,-192.59a7.02,7.02 0,0 1,8.02 -0.01l276.56,192.6a1,1 0,0 1,-0.57 1.82Z" />
|
||||
<path
|
||||
android:fillColor="#e6e6e6"
|
||||
android:pathData="M194.12,202.5l262.01,-194.18l264,208l-250.5,148.5l-136,-31l-139.51,-131.32z" />
|
||||
<path
|
||||
android:fillColor="#1e1f1d"
|
||||
android:pathData="M345.11,456.54L215.67,456.54a6.05,6.05 0,1 1,0 -12.09L345.11,444.45a6.05,6.05 0,1 1,0 12.09Z" />
|
||||
<path
|
||||
android:fillColor="#1e1f1d"
|
||||
android:pathData="M262.11,430.54L215.67,430.54a6.05,6.05 0,1 1,0 -12.09h46.44a6.05,6.05 0,1 1,0 12.09Z" />
|
||||
<path
|
||||
android:fillColor="#fff"
|
||||
android:pathData="M459.82,310.66a7.56,7.56 0,0 1,-2.87 -0.56L295.36,243.05v-209.87a7.01,7.01 0,0 1,7 -7h310a7.01,7.01 0,0 1,7 7v210.02l-0.3,0.13L462.77,310.06A7.62,7.62 0,0 1,459.82 310.66Z" />
|
||||
<path
|
||||
android:fillColor="#3f3d56"
|
||||
android:pathData="M459.82,311.16a8.07,8.07 0,0 1,-3.06 -0.6L294.86,243.38v-210.21a7.51,7.51 0,0 1,7.5 -7.5h310a7.51,7.51 0,0 1,7.5 7.5L619.86,243.53l-156.89,67A8.11,8.11 0,0 1,459.82 311.16ZM296.86,242.05 L457.52,308.71a6.12,6.12 0,0 0,4.67 -0.03L617.86,242.2L617.86,33.17a5.51,5.51 0,0 0,-5.5 -5.5h-310a5.51,5.51 0,0 0,-5.5 5.5Z" />
|
||||
<path
|
||||
android:fillColor="#3f3d56"
|
||||
android:pathData="M733.86,193.67h-0.2l-114.8,49.02 -157.07,67.07a5.07,5.07 0,0 1,-3.88 0.02l-162.05,-67.23 -117.62,-48.8 -0.18,-0.08h-0.2a7.01,7.01 0,0 0,-7 7v304a7.01,7.01 0,0 0,7 7h556a7.01,7.01 0,0 0,7 -7v-304A7.01,7.01 0,0 0,733.86 193.67ZM738.86,504.67a5,5 0,0 1,-5 5h-556a5,5 0,0 1,-5 -5v-304a5.01,5.01 0,0 1,4.81 -5l118.19,49.04 161.28,66.92a7.12,7.12 0,0 0,5.44 -0.03l156.28,-66.74 115.2,-49.19a5.02,5.02 0,0 1,4.8 5Z" />
|
||||
<path
|
||||
android:fillColor="#1e1f1d"
|
||||
android:pathData="M434.66,104.63h-110a8,8 0,1 1,0 -16h110a8,8 0,0 1,0 16Z" />
|
||||
<path
|
||||
android:fillColor="#1e1f1d"
|
||||
android:pathData="M377.66,70.63h-53a8,8 0,1 1,0 -16h53a8,8 0,0 1,0 16Z" />
|
||||
<path
|
||||
android:fillColor="#ccc"
|
||||
android:pathData="M539.63,184.63h-168a8,8 0,1 1,0 -16h168a8,8 0,0 1,0 16Z" />
|
||||
<path
|
||||
android:fillColor="#ccc"
|
||||
android:pathData="M539.63,221.63h-168a8,8 0,1 1,0 -16h168a8,8 0,0 1,0 16Z" />
|
||||
<path
|
||||
android:fillColor="#2f2e41"
|
||||
android:pathData="M40.95,230.98a4.51,4.51 0,0 1,-4.41 -3.62L32.9,209.22a37,37 0,0 1,72.56 -14.55l3.64,18.14a4.5,4.5 0,0 1,-3.53 5.3L41.83,230.89A4.51,4.51 0,0 1,40.95 230.98Z" />
|
||||
<path
|
||||
android:fillColor="#a0616a"
|
||||
android:pathData="M154.09,501.06l-11.43,-0l-5.44,-44.1l16.87,0l-0,44.1z" />
|
||||
<path
|
||||
android:fillColor="#2f2e41"
|
||||
android:pathData="M134.49,497.79h22.05a0,0 0,0 1,0 0v13.88a0,0 0,0 1,0 0H120.61a0,0 0,0 1,0 0v0A13.88,13.88 0,0 1,134.49 497.79Z" />
|
||||
<path
|
||||
android:fillColor="#a0616a"
|
||||
android:pathData="M34.97,500.94l-10.53,-4.46l12.19,-42.73l15.54,6.58l-17.2,40.6z" />
|
||||
<path
|
||||
android:fillColor="#2f2e41"
|
||||
android:pathData="M18.2,490.29l20.3,8.6a0,0 0,0 1,0 0L33.08,511.67a0,0 0,0 1,0 0L-0,497.66a0,0 0,0 1,0 0l0,0A13.88,13.88 67.95,0 1,18.2 490.29Z" />
|
||||
<path
|
||||
android:fillColor="#a0616a"
|
||||
android:pathData="M70.22,201.87m-24.56,0a24.56,24.56 0,1 1,49.12 0a24.56,24.56 0,1 1,-49.12 0" />
|
||||
<path
|
||||
android:fillColor="#3f3d56"
|
||||
android:pathData="M71.39,313.6l-0.25,-0.82c-6.69,-21.75 -13.61,-44.24 -20.54,-65.63l-0.19,-0.58 0.43,-0.43c10.75,-10.94 30.9,-15.3 46.86,-10.15 16.06,5.19 27.13,19.73 25.75,33.83a36.13,36.13 0,0 0,6.43 23.89l0.64,0.93 -1,0.52A181.87,181.87 0,0 1,72.23 313.48Z" />
|
||||
<path
|
||||
android:fillColor="#2f2e41"
|
||||
android:pathData="M41.76,493.02a4.99,4.99 0,0 1,-2.49 -0.67l-13.27,-7.66a4.97,4.97 0,0 1,-2.03 -6.45l29.48,-69.95 22.53,-102.02 41.06,-14.93 0.37,0.17c44.02,20.22 40.62,165.16 39.49,194.02a5.01,5.01 0,0 1,-4.56 4.78l-12.35,1.61a5.05,5.05 0,0 1,-5.41 -4.14l-25.21,-112.65a1,1 0,0 0,-0.82 -0.87,0.98 0.98,0 0,0 -1.04,0.49L46.14,490.46a4.98,4.98 0,0 1,-3.05 2.38A5.04,5.04 0,0 1,41.76 493.02Z" />
|
||||
<path
|
||||
android:fillColor="#a0616a"
|
||||
android:pathData="M56.51,390.21a9.38,9.38 0,0 0,-3.87 -13.85l0.67,-21.42L40.4,351.37l-0.52,30.26a9.43,9.43 0,0 0,16.64 8.59Z" />
|
||||
<path
|
||||
android:fillColor="#1e1f1d"
|
||||
android:pathData="M40.06,367.58l-0.76,-0a4.97,4.97 0,0 1,-4.92 -4.61c-1.24,-15.95 -5.04,-70.29 -1.98,-99.74a20.76,20.76 0,0 1,24.19 -17.41l0.79,0.17 -0.01,0.81c-0.28,38.76 -0.26,77.29 -0.25,114.55a5,5 0,0 1,-3.91 4.89A64.51,64.51 0,0 1,40.06 367.58Z" />
|
||||
<path
|
||||
android:fillColor="#1e1f1d"
|
||||
android:pathData="M69.47,414.06a13.58,13.58 0,0 1,-13.42 -11.93l1.09,-89.45 -17.78,-44.97a26.4,26.4 0,0 1,16.98 -28.06l4.75,-1.78a7.29,7.29 0,0 1,9.39 4.29L88.81,291.65l0,0.07c1.27,19.7 7.01,117.75 -4.43,120.67a63.12,63.12 0,0 1,-14.79 1.66Z" />
|
||||
<path
|
||||
android:fillColor="#a0616a"
|
||||
android:pathData="M175.08,356.44a9.38,9.38 0,0 1,-4.41 -13.69l-12.37,-17.49 8.8,-10.11 17.13,24.95a9.43,9.43 0,0 1,-9.14 16.34Z" />
|
||||
<path
|
||||
android:fillColor="#1e1f1d"
|
||||
android:pathData="M162.73,333.96a4.04,4.04 0,0 1,-3.25 -1.81l-0.06,-0.1c-20.48,-30.99 -41.65,-63.04 -63.11,-94.98l-0.23,-0.34 0.3,-0.29a19.1,19.1 0,0 1,14.08 -5.11,18.82 18.82,0 0,1 13.91,6.52c18.75,22.82 45.51,70.17 53.27,84.14a3.96,3.96 0,0 1,-1.23 5.23,63.42 63.42,0 0,1 -12.17,6.47A3.83,3.83 0,0 1,162.73 333.96Z" />
|
||||
<path
|
||||
android:fillColor="#1e1f1d"
|
||||
android:pathData="M155.85,394.12c-12.26,0.01 -56.14,-84.48 -64.82,-101.42l-0.08,-0.21 -9.59,-51.83a7.28,7.28 0,0 1,5.87 -8.49l5,-0.9a26.41,26.41 0,0 1,28.96 15.41l12.53,52.69 41.91,71.21a13.59,13.59 0,0 1,-5.48 17.29,63.08 63.08,0 0,1 -13.56,6.15 2.67,2.67 0,0 1,-0.75 0.11Z" />
|
||||
<path
|
||||
android:fillColor="#2f2e41"
|
||||
android:pathData="M89.3,202.08h-49.5v-6a25.03,25.03 0,0 1,25 -25h4a25.03,25.03 0,0 1,25 25v1.5A4.5,4.5 0,0 1,89.3 202.08Z" />
|
||||
</vector>
|
BIN
app/src/main/res/font/varela_round_regular.ttf
Normal file
91
app/src/main/res/layout/activity_main.xml
Normal file
|
@ -0,0 +1,91 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
android:gravity="top"
|
||||
android:orientation="vertical">
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/activity_main_clubelec_logo"
|
||||
android:layout_width="154dp"
|
||||
android:layout_height="65dp"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginTop="-5dp"
|
||||
app:srcCompat="@drawable/clubelec_integration" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginTop="30dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:fontFamily="@font/varela_round_regular"
|
||||
android:text="@string/activity_main_headline"
|
||||
android:textSize="40sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:fontFamily="@font/varela_round_regular"
|
||||
android:text="@string/activity_main_sub"
|
||||
android:textSize="20sp" />
|
||||
|
||||
<View
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/activity_main_subscribe"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="250dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="30dp"
|
||||
android:layout_marginBottom="30dp"
|
||||
app:srcCompat="@drawable/undraw_subscribe" />
|
||||
|
||||
<View
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/editTextTextEmailAddress"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:ems="10"
|
||||
android:hint="@string/activity_main_edittext_hint"
|
||||
android:inputType="textEmailAddress"
|
||||
android:minHeight="48dp" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/checkBox"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:text="@string/activity_main_checkbox"
|
||||
android:textAppearance="@style/TextAppearance.MaterialComponents.Subtitle1"
|
||||
android:textSize="11sp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginBottom="30dp"
|
||||
android:background="@drawable/button"
|
||||
android:text="@string/activity_main_button" />
|
||||
|
||||
</LinearLayout>
|
6
app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@mipmap/ic_launcher_background" />
|
||||
<foreground android:drawable="@mipmap/ic_launcher_foreground" />
|
||||
<monochrome android:drawable="@mipmap/ic_launcher_monochrome" />
|
||||
</adaptive-icon>
|
BIN
app/src/main/res/mipmap-hdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 4.9 KiB |
BIN
app/src/main/res/mipmap-hdpi/ic_launcher_background.png
Normal file
After Width: | Height: | Size: 843 B |
BIN
app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png
Normal file
After Width: | Height: | Size: 5.0 KiB |
BIN
app/src/main/res/mipmap-hdpi/ic_launcher_monochrome.png
Normal file
After Width: | Height: | Size: 5.0 KiB |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher_background.png
Normal file
After Width: | Height: | Size: 449 B |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher_monochrome.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 7.1 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher_background.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png
Normal file
After Width: | Height: | Size: 6.7 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher_monochrome.png
Normal file
After Width: | Height: | Size: 6.7 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher_background.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher_monochrome.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher_background.png
Normal file
After Width: | Height: | Size: 4.1 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher_monochrome.png
Normal file
After Width: | Height: | Size: 17 KiB |
29
app/src/main/res/values-fr/strings.xml
Normal file
|
@ -0,0 +1,29 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="app_name">email kiosk</string>
|
||||
<string name="activity_main_headline">Inscrivez-vous à la liste de diffusion du club elec pour être au courant de toutes nos actualités, nos événements, nos services, et bien plus encore.</string>
|
||||
<string name="activity_main_checkbox">En validant votre inscription, vous acceptez que le club elec conserve et utilise votre adresse de courriel afin de vous envoyer des communications de la part du club elec et de ses partenaires.\nVous pouvez à tout moment vous désinscrire de cette liste de diffusion.</string>
|
||||
<string name="activity_main_button">Valider l’inscription</string>
|
||||
<string name="activity_main_edittext_hint">nom@domaine.dpn</string>
|
||||
<string name="first_launch_password">Choisir un code de sécurité</string>
|
||||
<string name="first_launch_password_desc">Lors du premier lancement de l\'application, un code de sécurité vous est demandé pour verrouiller l\'accès aux données enregistrées par l\'application.\nUn menu permettant d\'accéder et d\'exporter les données enregistrées est disponible en cliquant 10 fois de suite sur le logo du club elec.</string>
|
||||
<string name="invalid_email_format">Format d’adresse de courriel invalide</string>
|
||||
<string name="checkbox_unchecked">Vous devez cocher la case d’acceptation de la conservation de votre adresse de courriel par le club elec</string>
|
||||
<string name="is_email_correct">Cette adresse de courriel est-elle correcte ?\n</string>
|
||||
<string name="confirmation_dialog">Vérification</string>
|
||||
<string name="email_saved">Adresse de courriel sauvegardée avec succès</string>
|
||||
<string name="error">Erreur</string>
|
||||
<string name="enter_password">Saisissez votre code de sécurité</string>
|
||||
<string name="enter_password_incorrect_format">Le code de sécurité doit contenir exactement 6 chiffres</string>
|
||||
<string name="enter_password_incorrect">Code de sécurité invalide</string>
|
||||
<string name="show_emails">Voir les adresses de courriel</string>
|
||||
<string name="clear_database">Vider la base de données</string>
|
||||
<string name="export_emails">Exporter les adresses de courriel dans un fichier</string>
|
||||
<string name="select_action">Sélectionnez une option</string>
|
||||
<string name="saved_emails">Adresses de courriel sauvegardées</string>
|
||||
<string name="database_cleared">Base de données vidée avec succès</string>
|
||||
<string name="no_emails_found">Aucune adresse de courriel trouvée pour l’export</string>
|
||||
<string name="emails_exported">Adresses de courriel exportées avec succès</string>
|
||||
<string name="export_failed">L’export a échoué</string>
|
||||
<string name="activity_main_sub">Ne vous inquiétez pas, nous sommes sympas ! 😄</string>
|
||||
</resources>
|
9
app/src/main/res/values-v27/themes.xml
Normal file
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<style name="Base.Theme.ClubElecEmailKiosk" parent="Theme.Material3.Light.NoActionBar">
|
||||
<!-- Customize your light theme here. -->
|
||||
<!-- <item name="colorPrimary">@color/my_light_primary</item> -->
|
||||
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
|
||||
</style>
|
||||
</resources>
|
6
app/src/main/res/values/colors.xml
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="white">#e1e0e2</color>
|
||||
<color name="colorPrimary">#1e1f1d</color>
|
||||
<color name="colorPrimaryVariant">#282828</color>
|
||||
</resources>
|
28
app/src/main/res/values/strings.xml
Normal file
|
@ -0,0 +1,28 @@
|
|||
<resources>
|
||||
<string name="app_name">email kiosk</string>
|
||||
<string name="activity_main_headline">Subscribe to the club elec mailing list to keep up to date with all our news, events, services and much more.</string>
|
||||
<string name="activity_main_checkbox">By validating your registration, you agree to allow club elec to store and use your email address for a period of one year for the purpose of sending you communications from club elec and its partners.\nYou may unsubscribe from this mailing list at any time.</string>
|
||||
<string name="activity_main_button">Confirm registration</string>
|
||||
<string name="activity_main_edittext_hint">name@domain.tld</string>
|
||||
<string name="first_launch_password">Choose a security code</string>
|
||||
<string name="first_launch_password_desc">The first time you launch the application, you are prompted for a security code to lock access to the data recorded by the application. \nA menu allowing you to access and export recorded data is available by clicking 10 times in a row on the club elec logo.</string>
|
||||
<string name="invalid_email_format">Invalid email format</string>
|
||||
<string name="checkbox_unchecked">You must tick the checkbox to agree to the conservation of your email address by the club elec</string>
|
||||
<string name="is_email_correct">Is this email address correct?\n</string>
|
||||
<string name="confirmation_dialog">Confirmation</string>
|
||||
<string name="email_saved">Email address successfully saved</string>
|
||||
<string name="error">Error</string>
|
||||
<string name="enter_password">Enter your security code</string>
|
||||
<string name="enter_password_incorrect_format">The security code must contain exactly 6 digits</string>
|
||||
<string name="enter_password_incorrect">Incorrect security code</string>
|
||||
<string name="show_emails">Show emails</string>
|
||||
<string name="clear_database">Clear database</string>
|
||||
<string name="export_emails">Export emails to a file</string>
|
||||
<string name="select_action">Select an action</string>
|
||||
<string name="saved_emails">Saved emails</string>
|
||||
<string name="database_cleared">Database cleared</string>
|
||||
<string name="no_emails_found">No emails found to export</string>
|
||||
<string name="emails_exported">Emails exported successfully</string>
|
||||
<string name="export_failed">Export failed</string>
|
||||
<string name="activity_main_sub">Don\'t worry, we\'re friendly! 😄</string>
|
||||
</resources>
|
12
app/src/main/res/values/themes.xml
Normal file
|
@ -0,0 +1,12 @@
|
|||
<resources>
|
||||
<!-- Base application theme. -->
|
||||
<style name="Base.Theme.ClubElecEmailKiosk" parent="Theme.Material3.Light.NoActionBar">
|
||||
<!-- Customize your light theme here. -->
|
||||
<!-- <item name="colorPrimary">@color/my_light_primary</item> -->
|
||||
<item name="colorPrimary">@color/colorPrimary</item>
|
||||
<item name="colorPrimaryVariant">@color/colorPrimary</item>
|
||||
|
||||
</style>
|
||||
|
||||
<style name="Theme.ClubElecEmailKiosk" parent="Base.Theme.ClubElecEmailKiosk" />
|
||||
</resources>
|
13
app/src/main/res/xml/backup_rules.xml
Normal file
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
Sample backup rules file; uncomment and customize as necessary.
|
||||
See https://developer.android.com/guide/topics/data/autobackup
|
||||
for details.
|
||||
Note: This file is ignored for devices older that API 31
|
||||
See https://developer.android.com/about/versions/12/backup-restore
|
||||
-->
|
||||
<full-backup-content>
|
||||
<!--
|
||||
<include domain="sharedpref" path="."/>
|
||||
<exclude domain="sharedpref" path="device.xml"/>
|
||||
-->
|
||||
</full-backup-content>
|
19
app/src/main/res/xml/data_extraction_rules.xml
Normal file
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
Sample data extraction rules file; uncomment and customize as necessary.
|
||||
See https://developer.android.com/about/versions/12/backup-restore#xml-changes
|
||||
for details.
|
||||
-->
|
||||
<data-extraction-rules>
|
||||
<cloud-backup>
|
||||
<!-- TODO: Use <include> and <exclude> to control what is backed up.
|
||||
<include .../>
|
||||
<exclude .../>
|
||||
-->
|
||||
</cloud-backup>
|
||||
<!--
|
||||
<device-transfer>
|
||||
<include .../>
|
||||
<exclude .../>
|
||||
</device-transfer>
|
||||
-->
|
||||
</data-extraction-rules>
|
5
build.gradle
Normal file
|
@ -0,0 +1,5 @@
|
|||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
plugins {
|
||||
id 'com.android.application' version '8.0.2' apply false
|
||||
id 'com.android.library' version '8.0.2' apply false
|
||||
}
|
21
gradle.properties
Normal file
|
@ -0,0 +1,21 @@
|
|||
# Project-wide Gradle settings.
|
||||
# IDE (e.g. Android Studio) users:
|
||||
# Gradle settings configured through the IDE *will override*
|
||||
# any settings specified in this file.
|
||||
# For more details on how to configure your build environment visit
|
||||
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
||||
# Specifies the JVM arguments used for the daemon process.
|
||||
# The setting is particularly useful for tweaking memory settings.
|
||||
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
|
||||
# When configured, Gradle will run in incubating parallel mode.
|
||||
# This option should only be used with decoupled projects. More details, visit
|
||||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||
# org.gradle.parallel=true
|
||||
# AndroidX package structure to make it clearer which packages are bundled with the
|
||||
# Android operating system, and which are packaged with your app's APK
|
||||
# https://developer.android.com/topic/libraries/support-library/androidx-rn
|
||||
android.useAndroidX=true
|
||||
# Enables namespacing of each library's R class so that its R class includes only the
|
||||
# resources declared in the library itself and none from the library's dependencies,
|
||||
# thereby reducing the size of the R class for that library
|
||||
android.nonTransitiveRClass=true
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
6
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
#Wed Aug 02 14:38:57 CEST 2023
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
185
gradlew
vendored
Executable file
|
@ -0,0 +1,185 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
#
|
||||
# Copyright 2015 the original author or authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
NONSTOP* )
|
||||
nonstop=true
|
||||
;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=`expr $i + 1`
|
||||
done
|
||||
case $i in
|
||||
0) set -- ;;
|
||||
1) set -- "$args0" ;;
|
||||
2) set -- "$args0" "$args1" ;;
|
||||
3) set -- "$args0" "$args1" "$args2" ;;
|
||||
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Escape application args
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
APP_ARGS=`save "$@"`
|
||||
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
|
||||
exec "$JAVACMD" "$@"
|
89
gradlew.bat
vendored
Normal file
|
@ -0,0 +1,89 @@
|
|||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
16
settings.gradle
Normal file
|
@ -0,0 +1,16 @@
|
|||
pluginManagement {
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
}
|
||||
}
|
||||
dependencyResolutionManagement {
|
||||
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
rootProject.name = "club elec email kiosk"
|
||||
include ':app'
|