Add a simple about activity

This commit is contained in:
Shinokuni 2019-08-27 21:40:21 +02:00
parent ff15826fe4
commit 217d914f41
9 changed files with 120 additions and 10 deletions

View File

@ -3,10 +3,6 @@
xmlns:tools="http://schemas.android.com/tools"
package="com.readrops.app">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.VIBRATE" />
<application
android:name=".utils.ReadropsApp"
android:allowBackup="true"
@ -17,7 +13,11 @@
android:theme="@style/AppTheme"
android:usesCleartextTraffic="true"
tools:ignore="GoogleAppIndexingWarning">
<activity android:name=".activities.SettingsActivity"></activity>
<activity
android:name=".activities.AboutActivity"
android:label="@string/about"
android:parentActivityName=".activities.MainActivity" />
<activity android:name=".activities.SettingsActivity" />
<activity
android:name=".activities.SplashActivity"
android:theme="@style/SplashTheme">
@ -50,4 +50,9 @@
android:parentActivityName=".activities.MainActivity" />
</application>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.INTERNET" />
</manifest>

View File

@ -0,0 +1,28 @@
package com.readrops.app.activities;
import android.os.Bundle;
import android.view.MenuItem;
import androidx.appcompat.app.AppCompatActivity;
import com.readrops.app.R;
public class AboutActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_about);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
finish();
return true;
}
return super.onOptionsItemSelected(item);
}
}

View File

@ -220,7 +220,9 @@ public class MainActivity extends AppCompatActivity implements SwipeRefreshLayou
viewModel.setFilterType(MainViewModel.FilterType.READ_IT_LATER_FILTER);
viewModel.invalidate();
break;
case DrawerManager.ABOUT_ID:
startActivity(new Intent(getApplication(), AboutActivity.class));
break;
}
} else if (drawerItem instanceof SecondaryDrawerItem) {
drawer.closeDrawer();

View File

@ -25,9 +25,9 @@ import com.mikepenz.materialdrawer.model.SecondaryDrawerItem;
import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem;
import com.mikepenz.materialdrawer.model.interfaces.IProfile;
import com.readrops.app.R;
import com.readrops.app.database.entities.account.Account;
import com.readrops.app.database.entities.Feed;
import com.readrops.app.database.entities.Folder;
import com.readrops.app.database.entities.account.Account;
import java.util.ArrayList;
import java.util.List;
@ -40,6 +40,7 @@ public class DrawerManager {
public static final int ARTICLES_ITEM_ID = -5;
public static final int READ_LATER_ID = -6;
public static final int ADD_ACCOUNT_ID = -4;
public static final int ABOUT_ID = -7;
private Activity activity;
private Toolbar toolbar;
@ -77,6 +78,8 @@ public class DrawerManager {
public void updateDrawer(Map<Folder, List<Feed>> folderListMap) {
drawer.removeAllItems();
drawer.removeAllStickyFooterItems();
addDefaultPlaces();
List<SecondaryDrawerItem> feedsWithoutFolder = new ArrayList<>();
@ -201,6 +204,14 @@ public class DrawerManager {
.withSelectable(true)
.withIdentifier(READ_LATER_ID);
PrimaryDrawerItem aboutItem = new PrimaryDrawerItem()
.withName(R.string.about)
.withIcon(R.drawable.ic_about_grey)
.withSelectable(true)
.withIdentifier(ABOUT_ID);
drawer.addStickyFooterItem(aboutItem);
drawer.addItem(articles);
drawer.addItem(toReadLater);
drawer.addItem(new DividerDrawerItem());

View File

@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#727272"
android:viewportHeight="24.0" android:viewportWidth="24.0"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M11,17h2v-6h-2v6zM12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,20c-4.41,0 -8,-3.59 -8,-8s3.59,-8 8,-8 8,3.59 8,8 -3.59,8 -8,8zM11,9h2L13,7h-2v2z"/>
</vector>

View File

@ -0,0 +1,56 @@
<?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"
xmlns:tools="http://schemas.android.com/tools"
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_licence"
style="@style/TextAppearance.AppCompat.Subhead"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/app_licence"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/app_name" />
<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>

View File

@ -34,7 +34,7 @@
android:icon="@drawable/ic_settings"/>
<item
android:id="@+id/about_item"
android:title="@string/about_item"
android:title="@string/about"
android:icon="@drawable/ic_about"/>
</group>

View File

@ -7,7 +7,7 @@
<string name="add_feed_item">Ajouter un flux</string>
<string name="add_folder_item">Ajouter un dossier</string>
<string name="settings">Paramètres</string>
<string name="about_item">A propos</string>
<string name="about">A propos</string>
<string name="add_feed_title">Ajouter un flux</string>
<string name="feed_url">Adresse du flux</string>
<string name="validate">Valider</string>
@ -74,5 +74,6 @@
<string name="filter_oldest">Du plus ancien au plus récent</string>
<string name="login_failed">La connexion a échoué. Veuillez vérifier vos identifiants</string>
<string name="new_account">Nouveau compte</string>
<string name="app_licence">App distribuée sous la licence GPLv3</string>
</resources>

View File

@ -8,7 +8,7 @@
<string name="add_feed_item">Add feed</string>
<string name="add_folder_item">Add folder</string>
<string name="settings">Settings</string>
<string name="about_item">About</string>
<string name="about">About</string>
<string name="add_feed_title">Add feed</string>
<string name="feed_url">Feed url</string>
<string name="validate">Validate</string>
@ -80,4 +80,6 @@
<string name="filter_oldest">Oldest to newsest</string>
<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>
</resources>