Commit 779c1f43 authored by Gilbert Ndresaj's avatar Gilbert Ndresaj

Changelog + Stuff

parent 6ee54485
package org.horaapps.leafpic.activities;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.v7.app.AlertDialog;
import android.support.v7.widget.CardView;
import android.support.v7.widget.Toolbar;
import android.text.method.LinkMovementMethod;
......@@ -20,7 +22,9 @@ import com.mikepenz.iconics.view.IconicsImageView;
import org.horaapps.leafpic.BuildConfig;
import org.horaapps.leafpic.R;
import org.horaapps.leafpic.activities.base.ThemedActivity;
import org.horaapps.leafpic.util.AlertDialogsHelper;
import org.horaapps.leafpic.util.CustomTabService;
import org.horaapps.leafpic.util.StringUtils;
import de.hdodenhof.circleimageview.CircleImageView;
......@@ -83,6 +87,21 @@ public class AboutActivity extends ThemedActivity {
public void onClick(View v) { cts.launchUrl("https://github.com/HoraApps/LeafPic/blob/master/LICENSE");}
});
//ChangeLog
((TextView) findViewById(R.id.about_changelog_item_sub)).setText(StringUtils.html(getString(R.string.changelog)+" <b>"+BuildConfig.VERSION_NAME+"</b>"));
findViewById(R.id.ll_about_changelog).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
final AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(AboutActivity.this, getDialogStyle());
AlertDialogsHelper.changelogDialog(AboutActivity.this, dialogBuilder);
dialogBuilder.setPositiveButton(getString(R.string.ok_action).toUpperCase(), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {}
});
dialogBuilder.show();
}
});
/*** Donald Shtjefni ***/
findViewById(R.id.about_author_donald_googleplus_item).setOnClickListener(new View.OnClickListener() {
@Override
......@@ -230,6 +249,7 @@ public class AboutActivity extends ThemedActivity {
((IconicsImageView) findViewById(R.id.about_support_report_bug_icon)).setColor(color);
((IconicsImageView) findViewById(R.id.about_support_donate_icon)).setColor(color);
((IconicsImageView) findViewById(R.id.about_license_icon)).setColor(color);
((IconicsImageView) findViewById(R.id.about_changelog_icon)).setColor(color);
/** TextViews **/
color = getTextColor();
......@@ -240,6 +260,7 @@ public class AboutActivity extends ThemedActivity {
((TextView) findViewById(R.id.about_support_report_bug_item)).setTextColor(color);
((TextView) findViewById(R.id.about_support_donate_item)).setTextColor(color);
((TextView) findViewById(R.id.about_license_item)).setTextColor(color);
((TextView) findViewById(R.id.about_changelog_item)).setTextColor(color);
/** Sub Text Views**/
color = getSubTextColor();
......@@ -255,5 +276,6 @@ public class AboutActivity extends ThemedActivity {
((TextView) findViewById(R.id.donald_shtjefni_role)).setTextColor(color);
((TextView) findViewById(R.id.gilbert_ndresaj_role)).setTextColor(color);
((TextView) findViewById(R.id.about_license_item_sub)).setTextColor(color);
((TextView) findViewById(R.id.about_changelog_item_sub)).setTextColor(color);
}
}
\ No newline at end of file
......@@ -13,7 +13,9 @@ import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.provider.MediaStore;
import android.support.design.widget.CoordinatorLayout;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v4.content.ContextCompat;
import android.support.v4.view.GravityCompat;
import android.support.v4.view.MenuItemCompat;
......@@ -45,6 +47,7 @@ import com.mikepenz.google_material_typeface_library.GoogleMaterial;
import com.mikepenz.iconics.IconicsDrawable;
import com.mikepenz.iconics.view.IconicsImageView;
import org.horaapps.leafpic.BuildConfig;
import org.horaapps.leafpic.R;
import org.horaapps.leafpic.SelectAlbumBuilder;
import org.horaapps.leafpic.activities.base.SharedMediaActivity;
......@@ -86,6 +89,7 @@ public class MainActivity extends SharedMediaActivity {
private DrawerLayout mDrawerLayout;
private Toolbar toolbar;
private SwipeRefreshLayout swipeRefreshLayout;
private CoordinatorLayout coordinatorMainLayout;
private boolean hidden = false, pickMode = false, editMode = false, albumsMode = true, firstLaunch = true;
......@@ -164,7 +168,7 @@ public class MainActivity extends SharedMediaActivity {
swipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipeRefreshLayout);
fabCamera = (FloatingActionButton) findViewById(R.id.fab_camera);
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
coordinatorMainLayout = (CoordinatorLayout) findViewById(R.id.coordinator_main_layout);
SP = PreferenceUtil.getInstance(getApplicationContext());
initUi();
......@@ -188,6 +192,30 @@ public class MainActivity extends SharedMediaActivity {
firstLaunch = false;
}
private void showChangelog(){
String titleHtml = "<font color='" + getTextColor() + "'>" + getString(R.string.changelog) + " <b>" + BuildConfig.VERSION_NAME + "</b>" + "</font>";
String buttonHtml= "<font color='" + getAccentColor() + "'>" + getString(R.string.view).toUpperCase() + "</font>";
Snackbar snackbar = Snackbar
.make(coordinatorMainLayout, StringUtils.html(titleHtml), Snackbar.LENGTH_LONG)
.setAction(StringUtils.html(buttonHtml), new View.OnClickListener() {
@Override
public void onClick(View view) {
final AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(MainActivity.this, getDialogStyle());
AlertDialogsHelper.changelogDialog(MainActivity.this, dialogBuilder);
dialogBuilder.setPositiveButton(getString(R.string.ok_action).toUpperCase(), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {}
});
dialogBuilder.show();
}
});
View snackbarView = snackbar.getView();
snackbarView.setBackgroundColor(getBackgroundColor());
snackbarView.setElevation(R.dimen.snackbar_elevation);
snackbar.show();
SP.putBoolean("changelog", false);
}
private void displayCurrentAlbumMedia(boolean reload) {
toolbar.setTitle(getAlbum().getName());
toolbar.setNavigationIcon(getToolbarIcon(GoogleMaterial.Icon.gmd_arrow_back));
......@@ -397,6 +425,15 @@ public class MainActivity extends SharedMediaActivity {
@Override
public void updateUiElements() {
/** CHANGELOG **/
//SP.putInt("VERSION_CODE",0);
int versionCode = BuildConfig.VERSION_CODE;
if (SP.getInt("VERSION_CODE", 0) != versionCode) {
SP.putInt("VERSION_CODE", versionCode);
showChangelog();
}
//TODO: MUST BE FIXED
toolbar.setPopupTheme(getPopupToolbarStyle());
toolbar.setBackgroundColor(getPrimaryColor());
......
......@@ -16,11 +16,13 @@ import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.ScrollView;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.drew.lang.GeoLocation;
import org.horaapps.leafpic.BuildConfig;
import org.horaapps.leafpic.R;
import org.horaapps.leafpic.activities.base.ThemedActivity;
import org.horaapps.leafpic.model.Media;
......@@ -177,4 +179,37 @@ public class AlertDialogsHelper {
MediaDetailsMap<String, String> metadata = media.getAllDetails();
loadDetails(dialogLayout ,activity , metadata);
}
public static AlertDialog changelogDialog(final ThemedActivity activity, AlertDialog.Builder changelogDialogBuilder){
View dialogLayout = activity.getLayoutInflater().inflate(R.layout.dialog_changelog, null);
TextView dialogTitle = (TextView) dialogLayout.findViewById(R.id.dialog_changelog_title);
TextView dialogMessage = (TextView) dialogLayout.findViewById(R.id.dialog_changelog_text);
CardView cvBackground = (CardView) dialogLayout.findViewById(R.id.dialog_changelog_card);
ScrollView scrChangelog = (ScrollView) dialogLayout.findViewById(R.id.changelog_scrollview);
cvBackground.setCardBackgroundColor(activity.getCardBackgroundColor());
dialogTitle.setBackgroundColor(activity.getPrimaryColor());
activity.getThemeHelper().setScrollViewColor(scrChangelog);
String titleHtml = activity.getString(R.string.changelog) + " <font color='" + activity.getAccentColor()+ "'>" + BuildConfig.VERSION_NAME + "</font>";
dialogTitle.setText(StringUtils.html(titleHtml));
//TODO: TRY TO FIND A BETTER WAY PLZ, I BELIVE IN YOU! <3
//Spanned changelogText = StringUtils.html(activity.getString(R.string.changelog_text));
//dialogMessage.setText(changelogText);
dialogMessage.setText("");
String[] changeLogMessage = activity.getResources().getStringArray(R.array.changelog_message);
StringBuilder builder = new StringBuilder();
for(String s: changeLogMessage){
builder.append(s);
builder.append("\n");
}
dialogMessage.setText(builder.toString().trim());
dialogMessage.setTextColor(activity.getTextColor());
changelogDialogBuilder.setView(dialogLayout);
return changelogDialogBuilder.create();
}
}
......@@ -22,7 +22,7 @@ public class FabScrollBehaviour extends FloatingActionButton.Behavior {
public void onNestedScroll(CoordinatorLayout coordinatorLayout, FloatingActionButton child, View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed) {
super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed);
if (dyConsumed > 0)
child.animate().translationY(child.getHeight()*2).setInterpolator(new AccelerateInterpolator(2)).start();
child.animate().translationY(child.getHeight()*4).setInterpolator(new AccelerateInterpolator(2)).start();
else
child.animate().translationY(/*-Measure.getNavigationBarSize(coordinatorLayout
.getContext()).y*/0).setInterpolator(new DecelerateInterpolator(2)).start();
......
......@@ -597,7 +597,7 @@
android:orientation="vertical"
android:paddingTop="@dimen/small_spacing"
android:paddingRight="@dimen/medium_spacing"
android:paddingBottom="@dimen/medium_spacing">
android:paddingBottom="@dimen/small_spacing">
<TextView
android:id="@+id/about_license_item"
android:layout_width="wrap_content"
......@@ -614,6 +614,47 @@
android:textSize="@dimen/sub_medium_text" />
</LinearLayout>
</LinearLayout>
<!-- CHANGELOG -->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/ll_about_changelog"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="@drawable/ripple"
android:clickable="true">
<com.mikepenz.iconics.view.IconicsImageView
android:id="@+id/about_changelog_icon"
android:layout_width="@dimen/icon_width_height"
android:layout_height="@dimen/icon_width_height"
android:layout_gravity="center_vertical"
app:iiv_icon="gmd-new-releases"
android:layout_marginLeft="@dimen/big_spacing"
android:layout_marginRight="@dimen/big_spacing" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingTop="@dimen/small_spacing"
android:paddingRight="@dimen/medium_spacing"
android:paddingBottom="@dimen/medium_spacing">
<TextView
android:id="@+id/about_changelog_item"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/changelog"
android:textColor="@color/md_dark_background"
android:textSize="@dimen/medium_text" />
<TextView
android:id="@+id/about_changelog_item_sub"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/changelog"
android:textColor="@color/md_grey_400"
android:textSize="@dimen/sub_medium_text" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
......
......@@ -6,7 +6,7 @@
android:layout_height="match_parent"
tools:openDrawer="start">
<android.support.design.widget.CoordinatorLayout
android:id="@+id/Relative_Album_layout"
android:id="@+id/coordinator_main_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
......
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/dialog_changelog_card"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardCornerRadius="@dimen/card_corner_radius">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/dialog_changelog_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@color/md_dark_primary_text"
android:background="@color/md_red_500"
android:padding="@dimen/big_spacing"
android:textSize="@dimen/sub_big_text"
android:textStyle="bold"
android:text="@string/changelog"/>
<ScrollView
android:id="@+id/changelog_scrollview"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/dialog_changelog_text"
android:textColor="@color/md_dark_primary_text"
android:padding="@dimen/big_spacing"
android:textSize="@dimen/medium_text"
android:text="@string/changelog" />
</LinearLayout>
</ScrollView>
</LinearLayout>
</android.support.v7.widget.CardView>
\ No newline at end of file
......@@ -10,7 +10,7 @@
<!-- ACTION / TITLE BAR -->
<LinearLayout
android:id="@+id/Relative_Album_layout"
android:id="@+id/coordinator_main_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
......
......@@ -43,5 +43,6 @@
<!--OTHER OBJECT-->
<dimen name="progress_circle_width_height">48dp</dimen>
<dimen name="snackbar_elevation">10dp</dimen>
</resources>
\ No newline at end of file
......@@ -7,6 +7,27 @@
<string name="welcome_slide_sub">A Colorful Material Designed Gallery!</string>
<string name="made_with_love_by">Made with love by</string>
<!--CHANGELOG-->
<string-array name="changelog_message">
<item><b>#Fixed</b></item>
<item>&#8226; Fixed crash on startup and some random crash</item>
<item>&#8226; FIied crash opening video (Nougat)</item>
<item>&#8226; Fixed zoom out issue with SubScaling ImageView enabled</item>
<item><b>#Update</b></item>
<item>&#8226; Updated translations</item>
<item>&#8226; General improvements</item>
</string-array>
<string name="changelog_text">
<b>#Fixed</b><br/>
&#8226; Fixed crash on startup and some random crash<br/>
&#8226; FIied crash opening video (Nougat)<br/>
&#8226; Fixed zoom out issue with SubScaling ImageView enabled<br/>
<b>#Update</b><br/>
&#8226; Updated translations<br/>
&#8226; General improvements<br/>
</string>
<!--AUTHORS-->
<string name="donald_role">Project Manager</string>
<string name="gilbert_role">Major Designer</string>
......@@ -66,6 +87,7 @@
<string name="clear_preview">Clear preview</string>
<string name="new_folder">New Folder</string>
<string name="create_new_folder">Create new folder</string>
<string name="view">View</string>
<!--DIALOG MESSAGES-->
<string name="hide_album_message">
......@@ -83,6 +105,7 @@
then the media will be copied or moved in the new folder.
</string>
<string name="card_style_alert">NOTE: Restart the app for make changes.</string>
<string name="changelog">Changelog</string>
<!-- ITEMS -->
<string name="singular_photo">Photo</string>
......
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