Add Mike Penz About Libraries library

This commit is contained in:
Shinokuni 2019-09-27 22:18:12 +02:00
parent be17ba13e6
commit 55e900bb22
4 changed files with 21 additions and 68 deletions

View File

@ -88,4 +88,6 @@ dependencies {
implementation "androidx.core:core-ktx:1.1.0"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "com.mikepenz:aboutlibraries:6.2.3"
}

View File

@ -2,11 +2,11 @@ package com.readrops.app.activities;
import android.os.Bundle;
import android.view.MenuItem;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import com.readrops.app.BuildConfig;
import com.mikepenz.aboutlibraries.Libs;
import com.mikepenz.aboutlibraries.LibsBuilder;
import com.readrops.app.R;
public class AboutActivity extends AppCompatActivity {
@ -16,8 +16,17 @@ public class AboutActivity extends AppCompatActivity {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_about);
TextView appVersion = findViewById(R.id.app_version);
appVersion.setText(BuildConfig.VERSION_NAME);
new LibsBuilder()
.withAboutIconShown(true)
.withAboutVersionShown(true)
.withAboutAppName(getString(R.string.app_name))
.withAboutDescription(getString(R.string.app_description, getString(R.string.app_licence), getString(R.string.app_url)))
.withLicenseShown(true)
.withLicenseDialog(false)
.withActivityTitle(getString(R.string.about))
.withActivityStyle(Libs.ActivityStyle.LIGHT)
.withFields(R.string.class.getFields())
.start(this);
}
@Override

View File

@ -1,67 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".activities.AboutActivity">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/app_logo"
android:layout_width="120dp"
android:layout_height="120dp"
android:layout_marginTop="40dp"
android:src="@drawable/ic_readrops"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="ContentDescription" />
<TextView
android:id="@+id/app_name"
style="@style/TextAppearance.AppCompat.Display1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/app_name"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/app_logo" />
<TextView
android:id="@+id/app_version"
style="@style/TextAppearance.AppCompat.Subhead"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/app_name"
tools:text="1.0.1" />
<TextView
android:id="@+id/app_licence"
style="@style/TextAppearance.AppCompat.Subhead"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:text="@string/app_licence"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/app_version" />
<TextView
android:id="@+id/app_source_code"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:autoLink="web"
android:text="@string/source_url"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/app_licence" />
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -81,11 +81,12 @@
<string name="login_failed">Login failed. Please check your credentials</string>
<string name="new_account">New account</string>
<string name="app_licence">App released under the GPLv3 licence</string>
<string name="source_url" translatable="false">https://github.com/readrops/Readrops</string>
<string name="app_url" translatable="false">https://github.com/readrops/Readrops</string>
<string name="number_items_to_parse">Maximum number of items per feed</string>
<string name="unlimited">Unlimited</string>
<string name="local">Local</string>
<string name="feeds_number">%1$s feeds</string>
<string name="feed_number">%1$s feed</string>
<string name="delete">Delete</string>
<string name="app_description" translatable="false"><![CDATA[%1$s <br/><br/> %2$s]]></string>
</resources>