Skip to content

Commit

Permalink
few playstore reported crash fixes (#475)
Browse files Browse the repository at this point in the history
  • Loading branch information
Swati4star authored Oct 8, 2018
1 parent 2d56144 commit a0c858f
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 8 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 27
versionCode 53
versionName "8.0.0"
versionCode 58
versionName "8.3.1"
}
buildTypes {
release {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,8 @@ public void unCheckAll() {
public ArrayList<String> getSelectedFilePath() {
ArrayList<String> filePathList = new ArrayList<>();
for (int position : mSelectedFiles) {
filePathList.add(mFileList.get(position).getPath());
if (mFileList.size() > position)
filePathList.add(mFileList.get(position).getPath());
}
return filePathList;
}
Expand Down Expand Up @@ -286,7 +287,8 @@ public void deleteFiles() {
public void shareFiles() {
ArrayList<File> files = new ArrayList<>();
for (int position : mSelectedFiles) {
files.add(mFileList.get(position));
if (mFileList.size() > position)
files.add(mFileList.get(position));
}
mFileUtils.shareMultipleFiles(files);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ public void pdfCompressionStarted() {
@Override
public void pdfCompressionEnded(String path, Boolean success) {
mMaterialDialog.dismiss();
if (success) {
if (success && path != null) {
getSnackbarwithAction(mActivity, R.string.snackbar_pdfCreated)
.setAction(R.string.snackbar_viewAction, v -> mFileUtils.openFile(path)).show();
new DatabaseHelper(mActivity).insertRecord(path,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -395,13 +395,13 @@ public void onRequestPermissionsResult(int requestCode,

private void onPasswordAdded() {
mTextEnhancementOptionsEntityArrayList.get(3)
.setImage(getResources().getDrawable(R.drawable.baseline_done_24));
.setImage(mActivity.getResources().getDrawable(R.drawable.baseline_done_24));
mTextEnhancementOptionsAdapter.notifyDataSetChanged();
}

private void onPasswordRemoved() {
mTextEnhancementOptionsEntityArrayList.get(3)
.setImage(getResources().getDrawable(R.drawable.baseline_enhanced_encryption_24));
.setImage(mActivity.getResources().getDrawable(R.drawable.baseline_enhanced_encryption_24));
mTextEnhancementOptionsAdapter.notifyDataSetChanged();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ private int checkChar(String query , String fileName) {
*/
public ArrayList<File> getPdfsFromPdfFolder(File[] files) {
ArrayList<File> pdfFiles = new ArrayList<>();
if (files == null)
return pdfFiles;
for (File file : files) {
if (isPDFAndNotDirectory(file))
pdfFiles.add(file);
Expand Down
5 changes: 4 additions & 1 deletion app/src/main/java/swati4star/createpdf/util/FileUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ public void openFile(String path) {
File file = new File(path);
Intent target = new Intent(Intent.ACTION_VIEW);
target.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);

try {
Uri uri = FileProvider.getUriForFile(mContext, AUTHORITY_APP, file);
target.setDataAndType(uri, mContext.getString(R.string.pdf_type));
Expand Down Expand Up @@ -232,6 +231,10 @@ public int checkRepeat(String finalOutputFile, final ArrayList<File> mFile) {
*/
public String getUriRealPath(Uri uri) {
String ret;

if (uri == null)
return null;

if (isWhatsappImage(uri.getAuthority())) {
ret = null;
} else {
Expand Down

0 comments on commit a0c858f

Please sign in to comment.