Skip to content
This repository has been archived by the owner on Sep 8, 2019. It is now read-only.

Commit

Permalink
- minor Bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
kollerlukas committed Mar 26, 2017
1 parent 6ca4f3c commit 68ca892
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 41 deletions.
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/Theme.CameraRoll">

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@

import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.Environment;
import android.support.annotation.Nullable;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
Expand All @@ -21,8 +19,7 @@
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestListener;
import com.bumptech.glide.request.target.Target;
import com.bumptech.glide.load.engine.DiskCacheStrategy;

import java.util.ArrayList;

Expand Down Expand Up @@ -159,15 +156,17 @@ public void showFolderSelectorDialog(final File_POJO[] files) {
public void onClick(DialogInterface dialogInterface, int i) {
String path = recyclerViewAdapter.getSelectedPath();
if (path != null) {
if (path.equals(CREATE_NEW_FOLDER)) {
creatingNewFolder = true;
createNewFolder(files);
} else {
executeAction(files, path);
}
executeAction(files, path);
}
}
})
.setNeutralButton(getString(R.string.new_folder), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
creatingNewFolder = true;
createNewFolder(files);
}
})
.setNegativeButton(R.string.cancel, null)
.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
Expand Down Expand Up @@ -201,7 +200,7 @@ public void createNewFolderDialog(final NewFolderCallback callback) {

final EditText editText = (EditText) dialogLayout.findViewById(R.id.edit_text);

dialog = new AlertDialog.Builder(this)
dialog = new AlertDialog.Builder(this, R.style.Theme_CameraRoll_Dialog)
.setTitle(R.string.new_folder)
.setView(dialogLayout)
.setPositiveButton(R.string.create, new DialogInterface.OnClickListener() {
Expand Down Expand Up @@ -233,14 +232,14 @@ public void failed(String path) {
.setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
creatingNewFolder = false;
//showFolderSelectorDialog();
showFolderSelectorDialog();
}
})
.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialogInterface) {
onDialogDismiss();
creatingNewFolder = false;
}
})
.create();
Expand Down Expand Up @@ -284,11 +283,7 @@ String getSelectedPath() {
return null;
}

if (albums.size() > selected_position) {
return albums.get(selected_position).getPath();
} else {
return CREATE_NEW_FOLDER;
}
return albums.get(selected_position).getPath();
}

@Override
Expand All @@ -300,25 +295,18 @@ public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType

@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, final int position) {
if (albums.size() > position) {
final Album album = albums.get(position);
((TextView) holder.itemView.findViewById(R.id.album_title))
.setText(album.getName());

if (album.getAlbumItems().size() > 0) {
Glide.with(holder.itemView.getContext())
.load(album.getAlbumItems().get(0).getPath())
.asBitmap()
//.centerCrop()
.error(R.drawable.error_placeholder_tinted)
.into((ImageView) holder.itemView.findViewById(R.id.image));
}
} else {
((TextView) holder.itemView.findViewById(R.id.album_title))
.setText(holder.itemView.getContext().getString(R.string.new_folder));
final Album album = albums.get(position);
((TextView) holder.itemView.findViewById(R.id.album_title))
.setText(album.getName());

if (album.getAlbumItems().size() > 0) {
Log.d("FileOperationDialog", "onBindViewHolder: " + album.getAlbumItems().get(0).getPath());

Glide.with(holder.itemView.getContext())
.load(R.drawable.new_folder_placeholder)
.load(album.getAlbumItems().get(0).getPath())
.skipMemoryCache(true)
.thumbnail(0.1f)
.error(R.drawable.error_placeholder_tinted)
.into((ImageView) holder.itemView.findViewById(R.id.image));
}

Expand Down Expand Up @@ -360,7 +348,7 @@ public void onClick(View view) {

@Override
public int getItemCount() {
return albums.size() + 1;
return albums.size();
}
}
}
Binary file removed app/src/main/res/drawable/new_folder_placeholder.png
Binary file not shown.
5 changes: 3 additions & 2 deletions app/src/main/res/layout-v21/file_op_view_holder.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<us.koller.cameraroll.ui.widget.SquareCardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_margin="8dp"
android:stateListAnimator="@animator/lift_up">
android:stateListAnimator="@animator/lift_up"
app:cardBackgroundColor="@color/grey_900">

<ImageView
android:id="@+id/image"
Expand Down
5 changes: 3 additions & 2 deletions app/src/main/res/layout/file_op_view_holder.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<us.koller.cameraroll.ui.widget.SquareCardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_margin="8dp">
android:layout_margin="8dp"
app:cardBackgroundColor="@color/grey_900">

<ImageView
android:id="@+id/image"
Expand Down

0 comments on commit 68ca892

Please sign in to comment.