Commit 57232102 authored by DNLDsht's avatar DNLDsht

copy and move single photo

tweaks
parent bd477bb7
......@@ -10,6 +10,7 @@ import android.provider.MediaStore;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.view.ContextThemeWrapper;
import android.support.v7.widget.Toolbar;
import android.view.GestureDetector;
import android.view.Menu;
......@@ -97,6 +98,47 @@ public class PhotoPagerActivity extends AppCompatActivity {
return true;
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (data != null) {
final Bundle b = data.getExtras();
switch (requestCode) {
case SelectAlbumActivity.COPY_TO_ACTION:
if (resultCode == RESULT_OK) {
StringUtils.showToast(getApplicationContext(), "copied ok");
}
break;
case SelectAlbumActivity.MOVE_TO_ACTION:
if (resultCode == RESULT_OK) {
String asd = b.getString("photos_indexes");
if (asd != null) {
StringUtils.showToast(getApplicationContext(), "moved ok");
//Log.wtf("asdasdasdas", photos.photos.size() + "");
//photos.removePhoto(Integer.valueOf(asd));
// TODO remove photo moved from older album [porco dio]
//Log.wtf("asdasdasdas", photos.photos.size() + "");
//adapter.removeItemAt(Integer.valueOf(asd));
//mRecyclerView.removeViewAt(Integer.parseInt(asd));
//photos.photos.remove(Integer.parseInt(asd));
//mRecyclerView.removeViewAt(Integer.valueOf(asd));
//adapter.notifyItemRemoved(Integer.parseInt(asd));
}
//adapter.notifyDataSetChanged();
invalidateOptionsMenu();
}
break;
default:
break;
}
}
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
......@@ -107,14 +149,14 @@ public class PhotoPagerActivity extends AppCompatActivity {
case R.id.moveAction:
Intent int1 = new Intent(getApplicationContext(), SelectAlbumActivity.class);
int1.putExtra("selected_photos", photos.getCurrentPhoto());
int1.putExtra("selected_photos", photos.getCurrentPhoto().Path);
int1.putExtra("request_code", SelectAlbumActivity.MOVE_TO_ACTION);
int1.putExtra("photos_indexes", photos.getSelectedPhotosIndexSerilized());
int1.putExtra("photos_indexes", photos.getCurrentPhotoIndex());
startActivityForResult(int1, SelectAlbumActivity.MOVE_TO_ACTION);
break;
case R.id.copyAction:
Intent int2 = new Intent(getApplicationContext(), SelectAlbumActivity.class);
int2.putExtra("selected_photos", photos.getCurrentPhoto());
int2.putExtra("selected_photos", photos.getCurrentPhoto().Path);
int2.putExtra("request_code", SelectAlbumActivity.COPY_TO_ACTION);
startActivityForResult(int2, SelectAlbumActivity.COPY_TO_ACTION);
break;
......@@ -128,16 +170,16 @@ public class PhotoPagerActivity extends AppCompatActivity {
return true;
case R.id.deletePhoto:
AlertDialog.Builder builder1 = new AlertDialog.Builder(getApplicationContext());
AlertDialog.Builder builder1 = new AlertDialog.Builder(new ContextThemeWrapper(PhotoPagerActivity.this, android.R.style.Theme_Dialog));
builder1.setMessage(R.string.delete_album_message);
builder1.setPositiveButton("DELETE", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
StringUtils.showToast(getApplicationContext(),"doesn't work properly");
//int index = mViewPager.getCurrentItem();
//mViewPager.removeView(mViewPager.getChildAt(index));
//TODO improve delete single photo
// photos.deleteCurrentPhoto();
//mCustomPagerAdapter.notifyDataSetChanged();
//photos.deleteCurrentPhoto();
//adapter.notifyDataSetChanged();
//mViewPager.destroyDrawingCache();
//mViewPager.setCurrentItem(index + 1);
}
......
......@@ -11,7 +11,9 @@ import android.os.Build;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.provider.MediaStore;
import android.support.design.widget.AppBarLayout;
import android.support.design.widget.CollapsingToolbarLayout;
import android.support.design.widget.CoordinatorLayout;
import android.support.design.widget.FloatingActionButton;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
......@@ -238,7 +240,6 @@ public class PhotosActivity extends AppCompatActivity {
int c;
try {
if ((c = photos.getSelectedCount()) != 0) {
toolbar.setCollapsible(false);
collapsingToolbarLayout.setTitle(c + "/" + photos.photos.size());
toolbar.setNavigationIcon(new IconicsDrawable(this)
......
......@@ -34,7 +34,7 @@ public class SelectAlbumActivity extends AppCompatActivity {
SelectAlbumAdapter adapt;
String photoPaths;
String photosIndexes;
boolean hidden=true;
boolean hidden=false;
int code;
HandlingPhotos p;//= new HandlingPhotos(SelectAlbumActivity.this);
......@@ -89,9 +89,9 @@ public class SelectAlbumActivity extends AppCompatActivity {
}
private void loadAlbumPreview(){
if (hidden == false)
albums.loadPreviewHiddenAlbums();
if (hidden) albums.loadPreviewHiddenAlbums();
else albums.loadPreviewAlbums();
hidden=!hidden;
mRecyclerView = (RecyclerView) findViewById(R.id.grid_albums);
......
......@@ -3,26 +3,21 @@
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"
/>
>
<item android:id="@+id/sortPhotos"
android:title="Sort"
android:orderInCategory="1"
android:icon="@mipmap/ic_sort_white_24dp"
app:showAsAction="ifRoom"
>
>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context=".PhotosActivity">
<group android:enabled="true" android:checkableBehavior="single">
<group android:checkableBehavior="single">
<item
android:id="@+id/name_sort_action"
android:checked="false"
android:title="by Name"
app:showAsAction="ifRoom"
/>
......@@ -31,11 +26,11 @@
android:id="@+id/date_taken_sort_action"
android:title="by Date Taken"
app:showAsAction="ifRoom"
/>
<item
android:id="@+id/size_sort_action"
android:title="by Size"
android:checked="false"
app:showAsAction="ifRoom"
/>
</group>
......@@ -43,7 +38,6 @@
<item
android:id="@+id/ascending_sort_action"
android:title="Ascending"
android:checked="false"
app:showAsAction="ifRoom"
/>
</group>
......@@ -54,7 +48,7 @@
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"
......@@ -65,12 +59,12 @@
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/excludeAlbumButton"
android:title="@string/exclude_album_action"
......@@ -85,10 +79,14 @@
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"
/>
/>
<item android:id="@+id/select_all_albums_action"
android:title="Select all"
app:showAsAction="never"
/>
</menu>
\ No newline at end of file
......@@ -41,7 +41,10 @@
<item name="windowActionBar">false</item>
</style>
-->
<style name="AlertDialogCustom" parent="Theme.AppCompat.Dialog">
<style name="AlertDialogDark" parent="Theme.AppCompat.Dialog">
</style>
<style name="AlertDialogLight" parent="Theme.AppCompat.Light.Dialog">
</style>
......
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