AppInfo Activity

This commit is contained in:
Alessandro Ferro 2022-10-25 12:16:20 +02:00
parent ebf823d690
commit a741c9db3c
6 changed files with 119 additions and 2 deletions

View File

@ -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"
}

View File

@ -23,6 +23,13 @@
android:supportsRtl="true"
android:theme="@style/Theme.LocateMyDevice"
tools:targetApi="30">
<activity
android:name=".AppInfoActivity"
android:exported="false">
<meta-data
android:name="android.app.lib_name"
android:value="" />
</activity>
<activity
android:name=".WhitelistContactsActivity"
android:exported="false">

View File

@ -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);
}
}

View File

@ -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);
}
});
}
}

View File

@ -0,0 +1,50 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".AppInfoActivity">
<ImageView
android:id="@+id/imageView2"
android:layout_width="100dp"
android:layout_height="100dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.19999999"
app:srcCompat="@drawable/logo" />
<TextView
android:id="@+id/appversionTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="App Version:"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.498"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/imageView2"
app:layout_constraintVertical_bias="0.121" />
<TextView
android:id="@+id/infoTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:text="This software is open source licensed under General Public License v3.0\n\nSource code and instructions at\nhttps://www.github.com/xfarrow/locatemydevice"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/appversionTextView"
app:layout_constraintVertical_bias="0.136"
android:linksClickable="true"
android:autoLink="web"/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -102,6 +102,37 @@
android:layout_marginEnd="10dp"
android:text="Add contacts"/>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?android:attr/listDivider" />
<LinearLayout
android:id="@+id/info_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="?android:attr/selectableItemBackground">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textStyle="bold"
android:textSize="17sp"
android:layout_marginStart="10dp"
android:layout_marginTop="10dp"
android:text="Info" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:text="Click here for more info"/>
</LinearLayout>
</LinearLayout>
</ScrollView>