Added "about" section. General code improvements.

parent 2255531c
......@@ -2,7 +2,7 @@ apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "27.0.0"
buildToolsVersion "27.0.1"
defaultConfig {
applicationId "com.systemallica.gallery"
minSdkVersion 19
......@@ -40,4 +40,7 @@ dependencies {
compile 'com.davemorrissey.labs:subsampling-scale-image-view:3.7.2'
compile 'com.google.android.exoplayer:exoplayer:r2.5.4'
compile 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
}
......@@ -34,7 +34,16 @@
android:name=".VideoActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:label="@string/title_activity_video"
android:theme="@style/AppTheme.NoActionBar"/>
android:theme="@style/AppTheme.NoActionBar" />
<activity
android:name=".AboutActivity"
android:label="@string/title_activity_about"
android:parentActivityName=".MainActivity"
android:theme="@style/AppTheme.NoActionBar">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.systemallica.gallery.MainActivity" />
</activity>
</application>
</manifest>
\ No newline at end of file
package com.systemallica.gallery;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.widget.TextView;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
public class AboutActivity extends AppCompatActivity {
@BindView(R.id.app_name) TextView app_name;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_about);
ButterKnife.bind(this);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
if (getSupportActionBar() != null) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
//Add version number to the TextView
String version = getResources().getString(R.string.about_name) + " " + BuildConfig.VERSION_NAME;
app_name.setText(version);
}
//Send email
@OnClick(R.id.email) public void email() {
Intent emailIntent = new Intent(Intent.ACTION_SENDTO);
emailIntent.setData(Uri.parse("mailto:systemallica.apps@gmail.com"));
startActivity(emailIntent);
}
//Open Play Store
@OnClick(R.id.rate) public void rate() {
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=com.systemallica.gallery"));
startActivity(browserIntent);
}
}
......@@ -184,8 +184,6 @@ public class ImageActivity extends AppCompatActivity {
return true;
}
class CustomPagerAdapter extends PagerAdapter {
Context mContext;
......@@ -326,13 +324,13 @@ public class ImageActivity extends AppCompatActivity {
String sizeText = " bytes";
if(sizeD>1024){
sizeD = sizeD/1024;//KB
sizeText = " kilobytes";
sizeText = " kB";
if(sizeD>1024){
sizeD = sizeD/1024;//MB
sizeText = " megabytes";
sizeText = " MB";
if(sizeD>1024){
sizeD = sizeD/1024;//GB
sizeText = " gigabytes";
sizeText = " GB";
}
}
}
......
......@@ -96,6 +96,11 @@ public class MainActivity extends AppCompatActivity {
loadFolders(columns);
}
return true;
case R.id.action_about:
// Start AboutActivity
Intent intent = new Intent(getBaseContext(), AboutActivity.class);
startActivity(intent);
return true;
default:
return super.onOptionsItemSelected(item);
}
......
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout 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="com.systemallica.gallery.AboutActivity">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay" />
</android.support.design.widget.AppBarLayout>
<include layout="@layout/content_about" />
</android.support.design.widget.CoordinatorLayout>
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.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"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="com.systemallica.gallery.AboutActivity"
tools:showIn="@layout/activity_about">
<TextView
android:id="@+id/app_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="50dp"
android:text="@string/app_name"
android:textAllCaps="false"
android:textColor="#FFFFFF"
android:textSize="24sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/developed"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="120dp"
android:fontFamily="sans-serif"
android:text="@string/about_developed"
android:textStyle="normal|bold"
android:textColor="#FFFFFF"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/developer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="4dp"
android:text="@string/about_developer"
android:textColor="#FFFFFF"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/developed" />
<TextView
android:id="@+id/rate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="215dp"
android:text="@string/about_rate"
android:textStyle="normal|bold"
android:textColor="#FFFFFF"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.502"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/contact"
android:layout_width="wrap_content"
android:layout_height="22dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="284dp"
android:text="@string/about_contact"
android:textColor="#FFFFFF"
android:textStyle="normal|bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/email"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:text="@string/about_email"
android:textColor="#FFFFFF"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/contact" />
<TextView
android:id="@+id/library"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="376dp"
android:text="@string/about_library"
android:textColor="#FFFFFF"
android:textStyle="normal|bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/library1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:text="@string/about_library1"
android:textColor="#FFFFFF"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/library" />
<TextView
android:id="@+id/library2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:text="@string/about_library2"
android:textColor="#FFFFFF"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/library1" />
<TextView
android:id="@+id/library3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:text="@string/about_library3"
android:textColor="#FFFFFF"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/library2" />
</android.support.constraint.ConstraintLayout>
......@@ -19,4 +19,10 @@
android:orderInCategory="2"
android:title="@string/action_decrease_columns"
app:showAsAction="never" />
<item
android:id="@+id/action_about"
android:orderInCategory="3"
android:title="@string/action_about"
app:showAsAction="never" />
</menu>
......@@ -17,4 +17,19 @@
<string name="delete_no">No</string>
<string name="delete_title">Atención!</string>
<string name="delete_message">La imagen será borrada para siempre, quieres continuar?</string>
<string name="action_about">Sobre la app</string>
<string name="title_activity_video">Video</string>
<string name="title_activity_about">Sobre la app</string>
<string name="details_image">Detalles de la imagen</string>
<string name="details_video">Detalles del video</string>
<string name="details_name_title">Nombre</string>
<string name="details_path_title">Ruta</string>
<string name="details_size_title">Tamaño</string>
<string name="details_type_title">Tipo</string>
<string name="details_modified_title">Modificado</string>
<string name="about_name">Galería versión:</string>
<string name="about_developed">Desarrollado por:</string>
<string name="about_library">Librerías utilizadas:</string>
<string name="about_contact">Contacto:</string>
<string name="about_rate">Tap aquí para calificar la app!</string>
</resources>
\ No newline at end of file
......@@ -7,6 +7,7 @@
<string name="action_delete">Delete</string>
<string name="action_share">Share</string>
<string name="action_details">Details</string>
<string name="action_about">About</string>
<string name="desc_folder">Folder thumbnail</string>
<string name="desc_image">Image thumbnail</string>
......@@ -15,6 +16,7 @@
<string name="title_activity_folder">Folder</string>
<string name="title_activity_image">Image</string>
<string name="title_activity_video">Video</string>
<string name="title_activity_about">About</string>
<string name="no_images">The folder is empty!</string>
......@@ -23,7 +25,7 @@
<string name="delete_title">Warning!</string>
<string name="delete_message">This will delete the image forever, are you sure?</string>
<string name="ok">OK</string>
<string name="ok" translatable="false">OK</string>
<string name="details_image">Image details</string>
<string name="details_video">Video details</string>
<string name="details_name_title">Name</string>
......@@ -31,4 +33,15 @@
<string name="details_size_title">Size</string>
<string name="details_type_title">Type</string>
<string name="details_modified_title">Modified</string>
<string name="about_name">Gallery version:</string>
<string name="about_developed">Developed by:</string>
<string name="about_developer" translatable="false">Systemallica</string>
<string name="about_library">Libraries used:</string>
<string name="about_library1" translatable="false">Glide</string>
<string name="about_library2" translatable="false">Subsampling-scale-image-view</string>
<string name="about_library3" translatable="false">Exoplayer</string>
<string name="about_contact">Contact:</string>
<string name="about_email" translatable="false">systemallica.apps@gmail.com</string>
<string name="about_rate">Tap here to rate the app!</string>
</resources>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment