public class

MiscUtils

extends Object
java.lang.Object
   ↳ com.pdftron.demo.utils.MiscUtils

Summary

Public Constructors
MiscUtils()
Public Methods
static int copy(InputStream input, OutputStream output, CustomAsyncTask task)
static ExternalFileInfo extractFileFromFileSpec(Context context, ExternalFileInfo extractFolder, FileSpec fileSpec, String fileName)
static String extractFileFromPortfolio(File portfolioFile, String fileName)
static String extractFileFromPortfolio(Context context, Uri portfolioFileUri, String fileName)
static Intent getAppSettingsIntent(Context context)
static SpannableStringBuilder getFileDescriptionFromUri(String uriString, Context context)
Returns description of a file a given content uri
static Uri getUriParent(Uri uri)
static void handleLowMemory(Context context, BaseFileAdapter adapter)
static void handleLowMemory(Context context)
static boolean isExternalFileUri(Context context, Uri uri)
static boolean isIntentActionMain(Intent intent)
static boolean isPDFFile(String filename)
static void keepOnScreenAfterClick(Context context, MenuItem item)
Prevents menu item from closing its popup menu on click
static void manageOOM(Context context, PDFViewCtrl pdfViewCtrl)
static void manageOOM(Context context)
static File parseIntentGetPdfFile(Context context, Intent intent)
Given an Intent, try to parse it and get a File for the PDF document.
static void removeFiles(ArrayList<FileInfo> filesToDelete)
static void showPermissionResultSnackbar(Activity activity, View layout, boolean hasPermission, int requestCode)
static boolean showSDCardActionErrorDialog(Context context, JumpNavigationCallbacks jumpNavigationCallbacks, String action)
static void sortFileInfoList(List<FileInfo> list, Comparator<FileInfo> sortMode)
Sorts file info list according to sort setting
static void updateAdapterViewWidthAfterGlobalLayout(RecyclerView recyclerView, BaseFileAdapter adapter)
static boolean verifyPermissions(int[] grantResults)
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public MiscUtils ()

Public Methods

public static int copy (InputStream input, OutputStream output, CustomAsyncTask task)

Throws
IOException

public static ExternalFileInfo extractFileFromFileSpec (Context context, ExternalFileInfo extractFolder, FileSpec fileSpec, String fileName)

Throws
Exception

public static String extractFileFromPortfolio (File portfolioFile, String fileName)

public static String extractFileFromPortfolio (Context context, Uri portfolioFileUri, String fileName)

public static Intent getAppSettingsIntent (Context context)

public static SpannableStringBuilder getFileDescriptionFromUri (String uriString, Context context)

Returns description of a file a given content uri

Parameters
uriString uri to a file
context context to get string resources and content resolver
Returns
  • description for file

public static Uri getUriParent (Uri uri)

public static void handleLowMemory (Context context, BaseFileAdapter adapter)

public static void handleLowMemory (Context context)

public static boolean isExternalFileUri (Context context, Uri uri)

public static boolean isIntentActionMain (Intent intent)

public static boolean isPDFFile (String filename)

public static void keepOnScreenAfterClick (Context context, MenuItem item)

Prevents menu item from closing its popup menu on click

Parameters
item menu item to prevent from closing menu

public static void manageOOM (Context context, PDFViewCtrl pdfViewCtrl)

public static void manageOOM (Context context)

public static File parseIntentGetPdfFile (Context context, Intent intent)

Given an Intent, try to parse it and get a File for the PDF document. This will only work if the Intent action is ACTION_VIEW or ACTION_EDIT, and the Intent data is a valid PDF file scheme.

Parameters
intent the Intent that holds the data
Returns
  • a File for the PDF document

public static void removeFiles (ArrayList<FileInfo> filesToDelete)

public static void showPermissionResultSnackbar (Activity activity, View layout, boolean hasPermission, int requestCode)

public static boolean showSDCardActionErrorDialog (Context context, JumpNavigationCallbacks jumpNavigationCallbacks, String action)

public static void sortFileInfoList (List<FileInfo> list, Comparator<FileInfo> sortMode)

Sorts file info list according to sort setting

Parameters
list A list of file info
sortMode The sort mode

public static void updateAdapterViewWidthAfterGlobalLayout (RecyclerView recyclerView, BaseFileAdapter adapter)

public static boolean verifyPermissions (int[] grantResults)