Added About activity to display information about the app

This commit is contained in:
bitscuit 2021-03-19 14:34:04 +01:00
parent c49454b870
commit 88ff15eb2c
7 changed files with 205 additions and 17 deletions

View File

@ -5,7 +5,7 @@ android {
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "be.bitscuit.calendar"
minSdkVersion 15
minSdkVersion 16
targetSdkVersion 29
versionCode 5
versionName "1.1.1"

View File

@ -13,7 +13,11 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:theme="@style/AppTheme"
tools:ignore="GoogleAppIndexingWarning">
<activity android:name=".Activities.SettingsActivity"
<activity
android:name=".Activities.AboutActivity"
android:parentActivityName=".Activities.MainActivity" />
<activity
android:name=".Activities.SettingsActivity"
android:parentActivityName=".Activities.MainActivity" />
<activity
android:name=".Activities.EditActivity"

View File

@ -0,0 +1,78 @@
/*
* Copyright (C) 2021 Thomas Van Acker
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
package be.bitscuit.calendar.Activities;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.MenuItem;
import android.widget.TextView;
import be.bitscuit.calendar.BuildConfig;
import be.bitscuit.calendar.R;
import be.bitscuit.calendar.Util.TaskData;
import be.bitscuit.calendar.Util.Util;
public class AboutActivity extends AppCompatActivity {
private Toolbar toolbar;
private TextView textVersion;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_about);
//Set toolbar
toolbar = findViewById(R.id.about_toolbar);
setSupportActionBar(toolbar);
setTitle("About");
ActionBar actionBar = getSupportActionBar();
actionBar.setDisplayHomeAsUpEnabled(true);
// Init views
textVersion = findViewById(R.id.about_text_version);
// Set views
textVersion.setText("Version: "+ BuildConfig.VERSION_NAME +"\nBuild: "+BuildConfig.VERSION_CODE);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
onBackPressed();
return true;
default:
return super.onOptionsItemSelected(item);
}
}
@Override
public void onBackPressed() {
//Close activity
this.finish();
}
}

View File

@ -157,6 +157,11 @@ public class MainActivity extends AppCompatActivity
startActivity(intent);
return true;
case R.id.main_menu_about:
Intent i = new Intent(this, AboutActivity.class);
startActivity(i);
return true;
case R.id.main_menu_date:
//Show date picker
DialogFragment fragment = new DatePickerFragment(this);

View File

@ -0,0 +1,112 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2021 Thomas Van Acker
~
~ This program is free software: you can redistribute it and/or modify it under
~ the terms of the GNU General Public License as published by the Free Software
~ Foundation, either version 3 of the License, or (at your option) any later
~ version.
~
~ This program is distributed in the hope that it will be useful, but WITHOUT
~ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
~ FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License along with
~ this program. If not, see <https://www.gnu.org/licenses/>.
-->
<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=".Activities.AboutActivity">
<androidx.appcompat.widget.Toolbar
android:id="@+id/about_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:elevation="4dp"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
<TextView
android:id="@+id/about_text_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:text="Calendar"
android:textSize="24sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/about_toolbar" />
<TextView
android:id="@+id/about_text_subtitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:text="A Simple, Open Source Calendar App"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/about_text_title" />
<TextView
android:id="@+id/about_text_version"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="24dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:gravity="center_horizontal"
android:text="Version x\nBuild x"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/about_text_subtitle" />
<TextView
android:id="@+id/about_text_copyright"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="24dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:text="Copyright 2021 Thomas Van Acker"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/about_text_version" />
<TextView
android:id="@+id/about_text_git"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="24dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:gravity="center_horizontal"
android:text="This project is hosted on Gitscuit:\nhttps://git.bitscuit.be/bitscuit/Calendar"
android:autoLink="web"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/about_text_copyright" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -116,21 +116,6 @@
app:layout_constraintStart_toEndOf="@+id/settings_label_overview_time"
app:layout_constraintTop_toBottomOf="@+id/settings_switch_overview" />
<TextView
android:id="@+id/settings_text_copyright"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_marginBottom="8dp"
android:gravity="center"
android:text="Copyright 2021 Thomas Van Acker"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<Button
android:id="@+id/settings_button_backup_create"
android:layout_width="wrap_content"

View File

@ -18,4 +18,8 @@
android:title="Settings"
app:showAsAction="never"/>
<item android:id="@+id/main_menu_about"
android:title="About"
app:showAsAction="never"/>
</menu>