Skip to content

Commit f6c0095

Browse files
committed
bug fixes in remove pages fragment
1 parent 50ce94c commit f6c0095

File tree

5 files changed

+40
-14
lines changed

5 files changed

+40
-14
lines changed

app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ android {
1010
minSdkVersion 21
1111
multiDexEnabled true
1212
targetSdkVersion 28
13-
versionCode 79
14-
versionName "8.5.2"
13+
versionCode 80
14+
versionName "8.5.3"
1515
}
1616
buildTypes {
1717
release {

app/src/main/assets/whatsnew.json

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,31 @@
11
{
22
"data": [
3+
34
{
4-
"title": "Modify Existing PDF",
5-
"content": "Add images to existing PDF",
6-
"icon": "ic_add_black_24dp"
7-
},
8-
{
9-
"title": "Rearrange images while creating PDF",
10-
"content": "Now, you can easily sort images while creating PDF using images",
11-
"icon": "ic_text_format_black_24dp"
5+
"title": "Reorder PDF pages",
6+
"content": "Fixed errors in Reorder and Remove PDF pages.",
7+
"icon": ""
128
}
9+
1310
],
1411
"old_data": {
1512
//paste old data here
1613
"version_code": [
1714
],
1815

16+
"79" : [
17+
{
18+
"title": "Modify Existing PDF",
19+
"content": "Add images to existing PDF",
20+
"icon": "ic_add_black_24dp"
21+
},
22+
{
23+
"title": "Rearrange images while creating PDF",
24+
"content": "Now, you can easily sort images while creating PDF using images",
25+
"icon": "ic_text_format_black_24dp"
26+
}
27+
],
28+
1929
"74" : [
2030
{
2131
"title": "Merge PDF",

app/src/main/java/swati4star/createpdf/activity/RearrangePdfPages.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
import android.support.v7.widget.RecyclerView;
1414
import android.support.v7.widget.Toolbar;
1515
import android.view.MenuItem;
16+
import android.view.View;
17+
import android.widget.Button;
1618

1719
import com.afollestad.materialdialogs.MaterialDialog;
1820

@@ -34,6 +36,8 @@ public class RearrangePdfPages extends AppCompatActivity implements RearrangePdf
3436

3537
@BindView(R.id.recyclerView)
3638
RecyclerView mRecyclerView;
39+
@BindView(R.id.sort)
40+
Button sortButton;
3741

3842
public static ArrayList<Bitmap> mImages;
3943
private RearrangePdfAdapter mRearrangeImagesAdapter;
@@ -49,9 +53,14 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
4953

5054
Toolbar toolbar = findViewById(R.id.toolbar);
5155
setSupportActionBar(toolbar);
52-
Objects.requireNonNull(getSupportActionBar()).setDisplayHomeAsUpEnabled(true);
5356
ButterKnife.bind(this);
54-
if (mImages == null || mImages.size() < 1)
57+
58+
mSequence = new ArrayList<>();
59+
Objects.requireNonNull(getSupportActionBar()).setDisplayHomeAsUpEnabled(true);
60+
sortButton.setVisibility(View.GONE);
61+
if (mImages == null || mImages.size() < 1) {
62+
finish();
63+
} else
5564
initRecyclerView(mImages);
5665
}
5766

app/src/main/java/swati4star/createpdf/util/FileUtils.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,9 @@ public static String getFileDirectoryPath(String path) {
319319
*/
320320
public static String saveImage(String filename, Bitmap finalBitmap) {
321321

322+
if (finalBitmap == null)
323+
return null;
324+
322325
if (checkIfBitmapIsWhite(finalBitmap))
323326
return null;
324327

@@ -346,6 +349,10 @@ public static String saveImage(String filename, Bitmap finalBitmap) {
346349
* @return - true, if bitmap is all white
347350
*/
348351
private static boolean checkIfBitmapIsWhite(Bitmap bitmap) {
352+
353+
if (bitmap == null)
354+
return true;
355+
349356
int w = bitmap.getWidth();
350357
int h = bitmap.getHeight();
351358
for (int i = 0; i < w; i++) {

app/src/main/res/layout/activity_rearrange_images.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<Button
2626
android:id="@+id/sort"
2727
android:layout_width="match_parent"
28-
android:layout_height="wrap_content"
28+
android:layout_height="45dp"
2929
android:layout_marginStart="10dp"
3030
android:layout_marginEnd="10dp"
3131
android:background="@drawable/cornered_edges"
@@ -39,7 +39,7 @@
3939
<android.support.v7.widget.RecyclerView
4040
android:id="@+id/recyclerView"
4141
android:layout_width="match_parent"
42-
android:layout_height="match_parent"
42+
android:layout_height="wrap_content"
4343
android:orientation="vertical" />
4444

4545
</LinearLayout>

0 commit comments

Comments
 (0)