Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for #395 #408

Merged
merged 1 commit into from
Aug 19, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

import com.dd.morphingbutton.MorphingButton;

import java.io.File;
import java.util.ArrayList;

import butterknife.BindView;
Expand Down Expand Up @@ -49,6 +50,7 @@ public class ExtractImagesFragment extends Fragment implements MergeFilesAdapter
private FileUtils mFileUtils;
private DirectoryUtils mDirectoryUtils;
private static final int INTENT_REQUEST_PICKFILE_CODE = 10;
private ArrayList<String> mOutFilePaths;

@BindView(R.id.selectFile)
Button selectFileButton;
Expand All @@ -69,6 +71,8 @@ public class ExtractImagesFragment extends Fragment implements MergeFilesAdapter
RecyclerView mExtractedFiles;
@BindView(R.id.extractedimages_text)
TextView extractImagesSuccessText;
@BindView(R.id.share_files)
Button mShareFiles;

@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
Expand All @@ -94,6 +98,17 @@ public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
return rootview;
}

@OnClick(R.id.share_files)
void onShareFilesClick(View view) {
if (mOutFilePaths != null) {
ArrayList<File> fileArrayList = new ArrayList<>();
for (String path : mOutFilePaths) {
fileArrayList.add(new File(path));
}
mFileUtils.shareMultipleFiles(fileArrayList);
}
}

@OnClick(R.id.viewFiles)
void onViewFilesClick(View view) {
if (sheetBehavior.getState() != BottomSheetBehavior.STATE_EXPANDED) {
Expand Down Expand Up @@ -146,6 +161,7 @@ public void onItemClick(String path) {

private void setTextAndActivateButtons(String path) {
mExtractedFiles.setVisibility(View.GONE);
mShareFiles.setVisibility(View.GONE);
extractImagesSuccessText.setVisibility(View.GONE);
mPath = path;
selectFileButton.setText(mPath);
Expand All @@ -171,6 +187,8 @@ public void resetView() {
@Override
public void updateView(String text, ArrayList<String> outputFilePaths) {
extractImagesSuccessText.setVisibility(View.VISIBLE);
mShareFiles.setVisibility(View.VISIBLE);
mOutFilePaths = outputFilePaths;
FilesListAdapter splitFilesAdapter = new FilesListAdapter(mActivity, outputFilePaths, this);
RecyclerView.LayoutManager mLayoutManager = new LinearLayoutManager(mActivity);
extractImagesSuccessText.setText(text);
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/drawable/baseline_share_24.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0"
android:tint="?attr/colorControlNormal">
android:tint="@android:color/white">
<path
android:fillColor="@android:color/white"
android:pathData="M18,16.08c-0.76,0 -1.44,0.3 -1.96,0.77L8.91,12.7c0.05,-0.23 0.09,-0.46 0.09,-0.7s-0.04,-0.47 -0.09,-0.7l7.05,-4.11c0.54,0.5 1.25,0.81 2.04,0.81 1.66,0 3,-1.34 3,-3s-1.34,-3 -3,-3 -3,1.34 -3,3c0,0.24 0.04,0.47 0.09,0.7L8.04,9.81C7.5,9.31 6.79,9 6,9c-1.66,0 -3,1.34 -3,3s1.34,3 3,3c0.79,0 1.5,-0.31 2.04,-0.81l7.12,4.16c-0.05,0.21 -0.08,0.43 -0.08,0.65 0,1.61 1.31,2.92 2.92,2.92 1.61,0 2.92,-1.31 2.92,-2.92s-1.31,-2.92 -2.92,-2.92z"/>
Expand Down
46 changes: 28 additions & 18 deletions app/src/main/res/layout/fragment_extract_images.xml
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout 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"
android:layout_width="match_parent"
android:layout_height="match_parent">

<LinearLayout 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"
<RelativeLayout
android:id="@+id/tableLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:stretchColumns="*"
android:layout_marginBottom="40dp"
android:orientation="vertical"
android:stretchColumns="*"
tools:context=".fragment.ExtractImagesFragment">

<Button
Expand All @@ -24,42 +22,54 @@
android:maxWidth="30dp"
android:padding="3dip"
android:text="@string/merge_file_select"
android:textColor="@color/mb_white"
app:layout_constraintEnd_toStartOf="@+id/filetwobtn"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
android:textColor="@color/mb_white" />

<com.dd.morphingbutton.MorphingButton
android:id="@+id/extractImages"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/selectFile"
android:layout_gravity="center"
android:layout_margin="16dp"
android:layout_marginTop="112dp"
android:padding="10dp"
android:text="@string/extract_images"
android:textColor="@color/mb_white"
app:layout_constraintBottom_toTopOf="@id/recyclerView"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/textView" />
android:textColor="@color/mb_white" />

<TextView
android:visibility="gone"
android:id="@+id/extractedimages_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/extractImages"
android:layout_margin="10dp"
android:text="@string/split_success"
android:textSize="20sp"
android:textStyle="bold" />
android:textStyle="bold"
android:visibility="gone" />

<android.support.v7.widget.RecyclerView
android:id="@+id/extracted_files"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
android:layout_above="@id/share_files"
android:layout_below="@id/extractedimages_text" />

<Button
android:id="@+id/share_files"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="8dp"
android:background="@color/colorPrimary"
android:drawableEnd="@drawable/baseline_share_24"
android:drawablePadding="8dp"
android:padding="8dp"
android:text="@string/share_files"
android:textColor="@color/mb_white"
android:visibility="gone" />

</LinearLayout>
</RelativeLayout>

<include layout="@layout/bottom_sheet" />
</android.support.design.widget.CoordinatorLayout>
1 change: 1 addition & 0 deletions app/src/main/res/values-es/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -279,4 +279,5 @@
<string name="decrypted">Decrypted</string>
<string name="reorder_pages">Reorder Pages</string>
<string name="reorder_pages_text">Enter the order of the pages. For example, if you want to reorder a PDF with 5 pages, you may write 4-5,1-3. The output PDF with have page no. 4,5, and then, 1,2,3.</string>
<string name="share_files">Share Files</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-fr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -280,4 +280,5 @@
<string name="decrypted">Decrypted</string>
<string name="reorder_pages">Reorder Pages</string>
<string name="reorder_pages_text">Enter the order of the pages. For example, if you want to reorder a PDF with 5 pages, you may write 4-5,1-3. The output PDF with have page no. 4,5, and then, 1,2,3.</string>
<string name="share_files">Share Files</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-ja/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -278,4 +278,5 @@
<string name="decrypted">Decrypted</string>
<string name="reorder_pages">Reorder Pages</string>
<string name="reorder_pages_text">Enter the order of the pages. For example, if you want to reorder a PDF with 5 pages, you may write 4-5,1-3. The output PDF with have page no. 4,5, and then, 1,2,3.</string>
<string name="share_files">Share Files</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -350,4 +350,5 @@
<string name="rotate_pages">Rotate Pages</string>
<string name="enter_rotation_angle">Enter Rotation Angle</string>
<string name="rotated_file_name">%s_rotated_%s%s</string>
<string name="share_files">Share Files</string>
</resources>