Commit 18ada897 authored by Gilbert Ndresaj's avatar Gilbert Ndresaj

Copy Move Act Hidden fab Improve!

parent 72b8e167
......@@ -94,6 +94,20 @@ public class PhotoActivity extends AppCompatActivity {
finish();
return true;
case R.id.moveAction:
Intent int1 = new Intent(PhotoActivity.this, SelectAlbumActivity.class);
int1.putExtra("selected_photos", photos.getCurrentPhoto());
int1.putExtra("request_code", SelectAlbumActivity.MOVE_TO_ACTION);
int1.putExtra("photos_indexes", photos.getSelectedPhotosIndexSerilized());
startActivityForResult(int1, SelectAlbumActivity.MOVE_TO_ACTION);
break;
case R.id.copyAction:
Intent int2 = new Intent(PhotoActivity.this, SelectAlbumActivity.class);
int2.putExtra("selected_photos", photos.getCurrentPhoto());
int2.putExtra("request_code", SelectAlbumActivity.COPY_TO_ACTION);
startActivityForResult(int2, SelectAlbumActivity.COPY_TO_ACTION);
break;
case R.id.shareButton:
String file_path = photos.photos.get(mViewPager.getCurrentItem()).Path;
Intent share = new Intent(Intent.ACTION_SEND);
......
......@@ -455,9 +455,9 @@ public class PhotosActivity extends AppCompatActivity {
}
public void initUiTweaks() {
SP = PreferenceManager.getDefaultSharedPreferences(getBaseContext());
/**** Navigation Bar*/
SP = PreferenceManager.getDefaultSharedPreferences(getBaseContext());
boolean NavBar = SP.getBoolean("nav_bar", false);
if ((android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) && (NavBar)) {
getWindow().setNavigationBarColor(getColor(R.color.toolbar));
......
......@@ -2,7 +2,12 @@ package com.leafpic.app;
import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.ColorStateList;
import android.graphics.Color;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.design.widget.FloatingActionButton;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.LinearLayoutManager;
......@@ -10,6 +15,7 @@ import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.TextView;
import com.leafpic.app.Adapters.SelectAlbumAdapter;
import com.leafpic.app.Base.HandlingAlbums;
import com.leafpic.app.Base.HandlingPhotos;
......@@ -22,12 +28,12 @@ public class SelectAlbumActivity extends AppCompatActivity {
public static final int COPY_TO_ACTION = 23;
public static final int MOVE_TO_ACTION = 69;
HandlingAlbums albums = new HandlingAlbums(SelectAlbumActivity.this);
RecyclerView mRecyclerView;
SelectAlbumAdapter adapt;
String photoPaths;
String photosIndexes;
boolean hidden=true;
int code;
HandlingPhotos p;//= new HandlingPhotos(SelectAlbumActivity.this);
......@@ -50,45 +56,54 @@ public class SelectAlbumActivity extends AppCompatActivity {
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
setSupportActionBar(toolbar);
getWindow().setStatusBarColor(getColor(R.color.toolbar));
/*FAB*/
SharedPreferences SP;
SP = PreferenceManager.getDefaultSharedPreferences(getBaseContext());
final FloatingActionButton fabhidden = (FloatingActionButton) findViewById(R.id.fab_hidden);
fabhidden.setBackgroundTintList(ColorStateList.valueOf(Color.parseColor(SP.getString("PrefColor", "#03A9F4"))));
fabhidden.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
loadAlbumPreview();
//fabhidden.setImageIcon();
}
});
loadAlbumPreview();
}
albums.loadPreviewAlbums();
private void loadAlbumPreview(){
if (hidden == false)
albums.loadPreviewHiddenAlbums();
else albums.loadPreviewAlbums();
hidden=!hidden;
mRecyclerView = (RecyclerView) findViewById(R.id.grid_albums);
adapt = new SelectAlbumAdapter(albums.dispAlbums, R.layout.select_album_card);
adapt.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
TextView a = (TextView) v.findViewById(R.id.album_name);
String newAlbumPath = a.getTag().toString();
if (code == MOVE_TO_ACTION) {
Intent result = new Intent();
result.putExtra("photos_indexes", photosIndexes);
p.moveSelectedPhotos(photoPaths, newAlbumPath);
setResult(Activity.RESULT_OK, result);
}
if (code == COPY_TO_ACTION) {
Intent result = new Intent();
p.copySelectedPhotos(photoPaths, newAlbumPath);
setResult(Activity.RESULT_OK, result);
}
finish();
}
});
mRecyclerView.setHasFixedSize(true);
mRecyclerView.setAdapter(adapt);
mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:orientation="vertical"
android:theme="@style/Theme.AppCompat.NoActionBar"
android:background="@color/background_material_dark"
>
android:background="@color/background_material_dark">
<include layout="@layout/toolbar"
android:id="@+id/toolbar"
android:background="@color/toolbar"
/>
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:id="@+id/grid_albums"
/>
<include layout="@layout/toolbar"
android:id="@+id/toolbar"
android:background="@color/toolbar"
/>
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:id="@+id/grid_albums"
/>
</LinearLayout>
\ No newline at end of file
</LinearLayout>
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab_hidden"
style="@style/fab2"
android:theme="@style/ThemeOverlay.AppCompat.Light"
app:borderWidth="0dp"
app:elevation="4dp"
android:layout_margin="16dp"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_gravity="bottom|end"/>
</RelativeLayout>
\ No newline at end of file
......@@ -14,7 +14,6 @@
android:orientation="vertical"
tools:ignore="MissingPrefix"
>
<ImageView
android:id="@+id/album_preview"
android:layout_width="match_parent"
......
......@@ -5,7 +5,6 @@
tools:context=".MainActivity"
>
<!-- general Stuff -->
<!-- Albums Stuff -->
<item
android:id="@+id/shareButton"
......@@ -29,7 +28,6 @@
android:id="@+id/rotateDX"
android:title="Rotate right 90°"
android:icon="@mipmap/ic_rotate_right_white_24dp"/>
<item
android:id="@+id/rotateSX"
android:title="Rotate left 90°"
......@@ -55,17 +53,25 @@
android:title="Rename"
app:showAsAction="never"
/>
<item
android:id="@+id/copyAction"
android:title="Copy to"
app:showAsAction="never"
/>
<item
android:id="@+id/moveAction"
android:title="Move to"
app:showAsAction="never"
/>
<item
android:id="@+id/details"
android:title="Details"
app:showAsAction="never"
/>
<item
android:id="@+id/setting"
android:title="Settings"
app:showAsAction="never"
android:id="@+id/setting"
android:title="Settings"
app:showAsAction="never"
/>
<!-- End Albums Stuff -->
</menu>
\ No newline at end of file
<menu
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=".PhotosActivity"
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=".PhotosActivity"
>
<item
android:id="@+id/endEditAlbumMode"
android:icon="@mipmap/ic_done_white_24dp"
android:title="DONE"
app:showAsAction="ifRoom"
android:id="@+id/endEditAlbumMode"
android:icon="@mipmap/ic_done_white_24dp"
android:title="DONE"
app:showAsAction="ifRoom"
/>
<item android:id="@+id/sortPhotos"
android:title="Sort"
android:orderInCategory="1"
android:icon="@mipmap/ic_sort_white_24dp"
app:showAsAction="ifRoom"
android:title="Sort"
android:orderInCategory="1"
android:icon="@mipmap/ic_sort_white_24dp"
app:showAsAction="ifRoom"
/>
<item
android:id="@+id/sharePhotos"
android:icon="@mipmap/ic_share_white_24dp"
android:title="Share"
app:showAsAction="ifRoom"
android:id="@+id/sharePhotos"
android:icon="@mipmap/ic_share_white_24dp"
android:title="Share"
app:showAsAction="ifRoom"
/>
<item
android:id="@+id/deleteAction"
android:icon="@mipmap/ic_delete_white_24dp"
android:title="@string/delete_album_action"
app:showAsAction="never"
android:id="@+id/deleteAction"
android:icon="@mipmap/ic_delete_white_24dp"
android:title="@string/delete_album_action"
app:showAsAction="never"
/>
<item
android:id="@+id/copyAction"
android:title="Copy to"
app:showAsAction="never"
android:id="@+id/copyAction"
android:title="Copy to"
app:showAsAction="never"
/>
<item
android:id="@+id/moveAction"
android:title="Move to"
app:showAsAction="never"
android:id="@+id/moveAction"
android:title="Move to"
app:showAsAction="never"
/>
<item
android:id="@+id/excludeAlbumButton"
......@@ -49,15 +48,14 @@
android:title="@string/hide_album_action"
app:showAsAction="never"
/>
<item
android:id="@+id/renameAlbum"
android:title="@string/rename_album_action"
app:showAsAction="never"
android:id="@+id/renameAlbum"
android:title="@string/rename_album_action"
app:showAsAction="never"
/>
<item
android:id="@+id/setAsAlbumPreview"
android:title="Set as Preview"
app:showAsAction="never"
android:id="@+id/setAsAlbumPreview"
android:title="Set as Preview"
app:showAsAction="never"
/>
</menu>
\ No newline at end of file
......@@ -38,6 +38,17 @@
<item name="rippleColor">@android:color/white</item>
</style>
<style name="fab2">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_margin">4dp</item>
<item name="android:src">@mipmap/ic_visibility_off_white_24dp</item>
<item name="borderWidth">0dp</item>
<item name="elevation">50dp</item>
<item name="pressedTranslationZ">12dp</item>
<item name="rippleColor">@android:color/white</item>
</style>
<style name="fabAddFolder">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
......
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