Commit c07f819b authored by Donald's avatar Donald

tweaks int PhotActivity

Use As Intent
toolbar color
added some dialogs
parent 10a36bf5
......@@ -3,12 +3,16 @@ package com.leafpic.app;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.*;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.DecelerateInterpolator;
import com.afollestad.materialdialogs.DialogAction;
import com.afollestad.materialdialogs.MaterialDialog;
import com.leafpic.app.Adapters.PhotosPagerAdapter;
import com.leafpic.app.Animations.DepthPageTransformer;
import com.leafpic.app.utils.string;
......@@ -103,28 +107,46 @@ public class PhotoActivity extends AppCompatActivity {
return true;
case R.id.shareButton:
String file_path = photos.photos.get(mViewPager.getCurrentItem()).Path;
string.showToast(this, file_path);
Intent share = new Intent(Intent.ACTION_SEND);
share.setType(string.getMimeType(file_path));
share.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://" + file_path));
startActivity(Intent.createChooser(share, "Share Image"));
return true;
case R.id.deletePhoto:
new MaterialDialog.Builder(this)
.content(R.string.delete_photo_message)
.positiveText("DELETE")
.negativeText("CANCEL")
.onPositive(new MaterialDialog.SingleButtonCallback() {
@Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
int index = mViewPager.getCurrentItem();
Log.d("asdasdasdasd", index + "");
mViewPager.removeView(mViewPager.getFocusedChild());
// mViewPager.removeViewAt(index);
mViewPager.setCurrentItem(index + 1);
//mViewPager.removeViewAt(index);
photos.deleteCurrentPhoto();
mCustomPagerAdapter.notifyDataSetChanged();
//mViewPager.setCurrentItem(++index);
}
})
.show();
mCustomPagerAdapter.destroyItem(mViewPager,
photos.getCurrentPhotoIndex(),
mViewPager.getFocusedChild());
mViewPager.removeView(mViewPager.getFocusedChild());
photos.deleteCurrentPhoto();
mCustomPagerAdapter.notifyDataSetChanged();
return true;
case R.id.rotatePhoto:
return true;
case R.id.useAsIntent:
String file_path_use_as = photos.photos.get(mViewPager.getCurrentItem()).Path;
Intent intent = new Intent(Intent.ACTION_ATTACH_DATA);
intent.setDataAndType(Uri.parse("file://" + file_path_use_as), "image/*");
intent.putExtra("jpg", string.getMimeType(file_path_use_as));
startActivity(Intent.createChooser(intent, "Use As"));
return true;
default:
// If we got here, the user's action was not recognized.
......@@ -141,8 +163,8 @@ public class PhotoActivity extends AppCompatActivity {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowTitleEnabled(false);
toolbar.setBackgroundColor(getColor(android.R.color.transparent));
hideSystemUI();// TODO hide navigation bar [PORCODIO]
toolbar.setBackgroundColor(getColor(R.color.transparent_gray));
//hideSystemUI();// TODO hide navigation bar [PORCODIO]
//toolbar.animate().translationY(-toolbar.getBottom()).setInterpolator(new AccelerateInterpolator()).start();
// getSupportActionBar().hide();
......
......@@ -62,8 +62,8 @@ public class PhotosActivity extends AppCompatActivity {
@Override
public void onResume() {
//string.showToast(this, album.Path);
LoadPhotos();
updateHeaderContent();
super.onResume();
}
......@@ -247,7 +247,7 @@ public class PhotosActivity extends AppCompatActivity {
@Override
public void onInput(MaterialDialog dialog, CharSequence input) {
albums.renameAlbum(photos.FolderPath, input.toString());
finish();
finish();//TODO make this better
}
}).show();
break;
......@@ -279,6 +279,7 @@ public class PhotosActivity extends AppCompatActivity {
if (editmode) {
photos.deleteSelectedPhotos();
adapter.notifyDataSetChanged();
updateHeaderContent();
} else {
albums.deleteAlbum(photos.FolderPath);
finish();
......@@ -394,14 +395,7 @@ public class PhotosActivity extends AppCompatActivity {
//OSCURA LIMMAGINE
image.setColorFilter(0x77000000, PorterDuff.Mode.SRC_ATOP);
TextView textView = (TextView) findViewById(R.id.AlbumName);
textView.setText(photos.DisplayName);
//SpannableString content = new SpannableString(photos.DisplayName);
//content.setSpan(new UnderlineSpan(), 10, content.length(), 0);
//textView.setText(content);
textView = (TextView) findViewById(R.id.AlbumNPhotos);
textView.setText(Html.fromHtml("<b><font color='#FBC02D'>" + photos.photos.size()+ "</font></b>" + "<font " +
"color='#FFFFFF'> Photos</font>"));
updateHeaderContent();
collapsingToolbarLayout = (CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar);
collapsingToolbarLayout.setTitle(photos.DisplayName);
......@@ -411,6 +405,14 @@ public class PhotosActivity extends AppCompatActivity {
//setPalette();
}
private void updateHeaderContent() {
TextView textView = (TextView) findViewById(R.id.AlbumName);
textView.setText(photos.DisplayName);
textView = (TextView) findViewById(R.id.AlbumNPhotos);
textView.setText(Html.fromHtml("<b><font color='#FBC02D'>" + photos.photos.size() + "</font></b>" + "<font " +
"color='#FFFFFF'> Photos</font>"));
}
private void initActivityTransitions() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Slide transition = new Slide();
......
......@@ -12,6 +12,7 @@
<!--GREY-->
<color name="grey_1">#727272</color>
<color name="grey_2">#424242</color>
<color name="transparent_gray">#96100e11</color>
<!--GREEN-->
<color name="green_1">#727272</color>
<color name="fabOrange">#FF9800</color>
......
......@@ -20,6 +20,7 @@
</string>
<string name="delete_album_message">Are you sure you want to delete the entire album folder?</string>
<string name="delete_photos_message">Are you sure you want to delete selected photos?</string>
<string name="delete_photo_message">Are you sure you want to delete this photo?</string>
<string name="exclude_album_message">Are you sure you want to exclude the album?</string>
<string name="rename_album_action">Rename</string>
<string name="asd">13 Photos</string>
......
......@@ -11,7 +11,7 @@ buildscript {
// in the individual module build.gradle files
}
}
//asd
allprojects {
repositories {
jcenter()
......
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