From a741c9db3ca13b297943b0f2c54f0308d6481a15 Mon Sep 17 00:00:00 2001 From: Alessandro Ferro <49845537+xfarrow@users.noreply.github.com> Date: Tue, 25 Oct 2022 12:16:20 +0200 Subject: [PATCH] AppInfo Activity --- src/app/build.gradle | 4 +- src/app/src/main/AndroidManifest.xml | 7 +++ .../locatemydevice/AppInfoActivity.java | 18 +++++++ .../locatemydevice/SettingsActivity.java | 11 ++++ .../src/main/res/layout/activity_app_info.xml | 50 +++++++++++++++++++ src/app/src/main/res/layout/settings.xml | 31 ++++++++++++ 6 files changed, 119 insertions(+), 2 deletions(-) create mode 100644 src/app/src/main/java/com/xfarrow/locatemydevice/AppInfoActivity.java create mode 100644 src/app/src/main/res/layout/activity_app_info.xml diff --git a/src/app/build.gradle b/src/app/build.gradle index 375c1af..0510dc8 100644 --- a/src/app/build.gradle +++ b/src/app/build.gradle @@ -9,8 +9,8 @@ android { applicationId "com.xfarrow.locatemydevice" minSdk 28 targetSdk 32 - versionCode 1 - versionName "0.2" + versionCode 2 + versionName "1.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } diff --git a/src/app/src/main/AndroidManifest.xml b/src/app/src/main/AndroidManifest.xml index d822bff..b30d1a0 100644 --- a/src/app/src/main/AndroidManifest.xml +++ b/src/app/src/main/AndroidManifest.xml @@ -23,6 +23,13 @@ android:supportsRtl="true" android:theme="@style/Theme.LocateMyDevice" tools:targetApi="30"> + + + diff --git a/src/app/src/main/java/com/xfarrow/locatemydevice/AppInfoActivity.java b/src/app/src/main/java/com/xfarrow/locatemydevice/AppInfoActivity.java new file mode 100644 index 0000000..561d57e --- /dev/null +++ b/src/app/src/main/java/com/xfarrow/locatemydevice/AppInfoActivity.java @@ -0,0 +1,18 @@ +package com.xfarrow.locatemydevice; + +import androidx.appcompat.app.AppCompatActivity; + +import android.os.Bundle; +import android.widget.TextView; + +public class AppInfoActivity extends AppCompatActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_app_info); + + TextView appVersionTextView = findViewById(R.id.appversionTextView); + appVersionTextView.setText("App version: " + BuildConfig.VERSION_NAME); + } +} \ No newline at end of file diff --git a/src/app/src/main/java/com/xfarrow/locatemydevice/SettingsActivity.java b/src/app/src/main/java/com/xfarrow/locatemydevice/SettingsActivity.java index 342f344..d3f4f84 100644 --- a/src/app/src/main/java/com/xfarrow/locatemydevice/SettingsActivity.java +++ b/src/app/src/main/java/com/xfarrow/locatemydevice/SettingsActivity.java @@ -11,6 +11,7 @@ import android.view.View; import android.widget.Button; import android.widget.CompoundButton; import android.widget.EditText; +import android.widget.LinearLayout; import android.widget.Switch; import android.widget.Toast; @@ -25,6 +26,7 @@ public class SettingsActivity extends AppCompatActivity { private Switch whitelistSwitch; private Button addContactsButton; private Settings settings; + private LinearLayout infoLinearLayout; @Override protected void onCreate(Bundle savedInstanceState) { @@ -42,6 +44,7 @@ public class SettingsActivity extends AppCompatActivity { editTextLmdCommand = findViewById(R.id.editTextLmdCommand); whitelistSwitch = findViewById(R.id.SwitchWhitelist); addContactsButton = findViewById(R.id.buttonAddContacts); + infoLinearLayout = findViewById(R.id.info_layout); addContactsButton.setEnabled(Boolean.parseBoolean(settings.get(Settings.WHITELIST_ENABLED))); whitelistSwitch.setChecked(Boolean.parseBoolean(settings.get(Settings.WHITELIST_ENABLED))); @@ -135,5 +138,13 @@ public class SettingsActivity extends AppCompatActivity { } }); + infoLinearLayout.setOnClickListener(new View.OnClickListener(){ + @Override + public void onClick(View v) { + Intent myIntent = new Intent(SettingsActivity.this, AppInfoActivity.class); + SettingsActivity.this.startActivity(myIntent); + } + }); + } } diff --git a/src/app/src/main/res/layout/activity_app_info.xml b/src/app/src/main/res/layout/activity_app_info.xml new file mode 100644 index 0000000..47c264d --- /dev/null +++ b/src/app/src/main/res/layout/activity_app_info.xml @@ -0,0 +1,50 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/src/app/src/main/res/layout/settings.xml b/src/app/src/main/res/layout/settings.xml index 2608339..d3aa1c8 100644 --- a/src/app/src/main/res/layout/settings.xml +++ b/src/app/src/main/res/layout/settings.xml @@ -102,6 +102,37 @@ android:layout_marginEnd="10dp" android:text="Add contacts"/> + + + + + + + + + + + +