Skip to content

Commit

Permalink
bug fixes in remove pages fragment
Browse files Browse the repository at this point in the history
  • Loading branch information
Swati4star committed Dec 19, 2018
1 parent 50ce94c commit f6c0095
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 14 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ android {
minSdkVersion 21
multiDexEnabled true
targetSdkVersion 28
versionCode 79
versionName "8.5.2"
versionCode 80
versionName "8.5.3"
}
buildTypes {
release {
Expand Down
26 changes: 18 additions & 8 deletions app/src/main/assets/whatsnew.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,31 @@
{
"data": [

{
"title": "Modify Existing PDF",
"content": "Add images to existing PDF",
"icon": "ic_add_black_24dp"
},
{
"title": "Rearrange images while creating PDF",
"content": "Now, you can easily sort images while creating PDF using images",
"icon": "ic_text_format_black_24dp"
"title": "Reorder PDF pages",
"content": "Fixed errors in Reorder and Remove PDF pages.",
"icon": ""
}

],
"old_data": {
//paste old data here
"version_code": [
],

"79" : [
{
"title": "Modify Existing PDF",
"content": "Add images to existing PDF",
"icon": "ic_add_black_24dp"
},
{
"title": "Rearrange images while creating PDF",
"content": "Now, you can easily sort images while creating PDF using images",
"icon": "ic_text_format_black_24dp"
}
],

"74" : [
{
"title": "Merge PDF",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;

import com.afollestad.materialdialogs.MaterialDialog;

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

@BindView(R.id.recyclerView)
RecyclerView mRecyclerView;
@BindView(R.id.sort)
Button sortButton;

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

Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
Objects.requireNonNull(getSupportActionBar()).setDisplayHomeAsUpEnabled(true);
ButterKnife.bind(this);
if (mImages == null || mImages.size() < 1)

mSequence = new ArrayList<>();
Objects.requireNonNull(getSupportActionBar()).setDisplayHomeAsUpEnabled(true);
sortButton.setVisibility(View.GONE);
if (mImages == null || mImages.size() < 1) {
finish();
} else
initRecyclerView(mImages);
}

Expand Down
7 changes: 7 additions & 0 deletions app/src/main/java/swati4star/createpdf/util/FileUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,9 @@ public static String getFileDirectoryPath(String path) {
*/
public static String saveImage(String filename, Bitmap finalBitmap) {

if (finalBitmap == null)
return null;

if (checkIfBitmapIsWhite(finalBitmap))
return null;

Expand Down Expand Up @@ -346,6 +349,10 @@ public static String saveImage(String filename, Bitmap finalBitmap) {
* @return - true, if bitmap is all white
*/
private static boolean checkIfBitmapIsWhite(Bitmap bitmap) {

if (bitmap == null)
return true;

int w = bitmap.getWidth();
int h = bitmap.getHeight();
for (int i = 0; i < w; i++) {
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/layout/activity_rearrange_images.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<Button
android:id="@+id/sort"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="45dp"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:background="@drawable/cornered_edges"
Expand All @@ -39,7 +39,7 @@
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" />

</LinearLayout>

0 comments on commit f6c0095

Please sign in to comment.