Loading app/src/main/java/com/gsnathan/pdfviewer/AboutActivity.java +9 −10 Original line number Diff line number Diff line Loading @@ -24,10 +24,12 @@ package com.gsnathan.pdfviewer; import android.content.ActivityNotFoundException; import android.os.Bundle; import android.view.MenuItem; import android.view.View; import android.widget.Toast; import com.franmontiel.attributionpresenter.AttributionPresenter; import com.franmontiel.attributionpresenter.entities.Attribution; Loading Loading @@ -92,17 +94,9 @@ public class AboutActivity extends CyaneaAppCompatActivity { .setWebsite("https://github.com/barteksc/AndroidPdfViewer") .build() ) .addAttributions( new Attribution.Builder("AndroidAnnotations") .addCopyrightNotice("Copyright 2012-2016 eBusiness Information\n" + "Copyright 2016-2017 the AndroidAnnotations project") .addLicense(License.APACHE) .setWebsite("https://github.com/androidannotations/androidannotations") .build() ) .addAttributions( new Attribution.Builder("AppIntro") .addCopyrightNotice("Copyright 2018 paorotolo") .addCopyrightNotice("Copyright 2018 Paolo Rotolo") .addLicense(License.APACHE) .setWebsite("https://github.com/paolorotolo/AppIntro") .build() Loading Loading @@ -149,7 +143,12 @@ public class AboutActivity extends CyaneaAppCompatActivity { } public void emailDev(View v) { startActivity(Utils.emailIntent("gokulswamilive@gmail.com", "Pdf Viewer Plus", APP_VERSION_RELEASE, "Send email...")); String email = "gokulswamilive@gmail.com"; try { startActivity(Utils.emailIntent(email, "Pdf Viewer Plus", APP_VERSION_RELEASE)); } catch (ActivityNotFoundException e) { Toast.makeText(this, email, Toast.LENGTH_SHORT).show(); } } public void navToGit(View v) { Loading app/src/main/java/com/gsnathan/pdfviewer/MainActivity.java +7 −1 Original line number Diff line number Diff line Loading @@ -178,7 +178,13 @@ public class MainActivity extends CyaneaAppCompatActivity { } void shareFile() { startActivity(Utils.emailIntent(pdfFileName, "", getResources().getString(R.string.share), uri)); Intent sharingIntent; if (uri.getScheme() != null && uri.getScheme().startsWith("http")) { sharingIntent = Utils.plainTextShareIntent(getString(R.string.share), uri.toString()); } else { sharingIntent = Utils.fileShareIntent(getString(R.string.share), pdfFileName, uri); } startActivity(sharingIntent); } private void openSelectedDocument(Uri selectedDocumentUri) { Loading app/src/main/java/com/gsnathan/pdfviewer/Utils.java +19 −12 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ package com.gsnathan.pdfviewer; import android.content.ClipData; import android.content.Context; import android.content.Intent; import android.graphics.Color; Loading Loading @@ -61,22 +62,28 @@ public class Utils { log.show(context.getSupportFragmentManager(), "Log"); } static Intent emailIntent(String emailAddress, String subject, String text, String title) { Intent email = new Intent(Intent.ACTION_SEND); email.setType("text/email"); email.putExtra(Intent.EXTRA_EMAIL, new String[]{emailAddress}); static Intent emailIntent(String emailAddress, String subject, String text) { Intent email = new Intent(Intent.ACTION_SENDTO); email.setData(Uri.parse("mailto:" + emailAddress)); email.putExtra(Intent.EXTRA_SUBJECT, subject); email.putExtra(Intent.EXTRA_TEXT, text); return Intent.createChooser(email, title); return email; } static Intent emailIntent(String subject, String text, String title, Uri filePath) { Intent email = new Intent(Intent.ACTION_SEND); email.setType("text/email"); email.putExtra(Intent.EXTRA_SUBJECT, subject); email.putExtra(Intent.EXTRA_TEXT, text); email.putExtra(Intent.EXTRA_STREAM, filePath); return Intent.createChooser(email, title); static Intent plainTextShareIntent(String chooserTitle, String text) { Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_TEXT, text); return Intent.createChooser(intent, chooserTitle); } static Intent fileShareIntent(String chooserTitle, String fileName, Uri fileUri) { Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("application/pdf"); intent.putExtra(Intent.EXTRA_STREAM, fileUri); intent.setClipData(new ClipData(fileName, new String[] { "application/pdf" }, new ClipData.Item(fileUri))); intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); return Intent.createChooser(intent, chooserTitle); } static Intent linkIntent(String url) { Loading Loading
app/src/main/java/com/gsnathan/pdfviewer/AboutActivity.java +9 −10 Original line number Diff line number Diff line Loading @@ -24,10 +24,12 @@ package com.gsnathan.pdfviewer; import android.content.ActivityNotFoundException; import android.os.Bundle; import android.view.MenuItem; import android.view.View; import android.widget.Toast; import com.franmontiel.attributionpresenter.AttributionPresenter; import com.franmontiel.attributionpresenter.entities.Attribution; Loading Loading @@ -92,17 +94,9 @@ public class AboutActivity extends CyaneaAppCompatActivity { .setWebsite("https://github.com/barteksc/AndroidPdfViewer") .build() ) .addAttributions( new Attribution.Builder("AndroidAnnotations") .addCopyrightNotice("Copyright 2012-2016 eBusiness Information\n" + "Copyright 2016-2017 the AndroidAnnotations project") .addLicense(License.APACHE) .setWebsite("https://github.com/androidannotations/androidannotations") .build() ) .addAttributions( new Attribution.Builder("AppIntro") .addCopyrightNotice("Copyright 2018 paorotolo") .addCopyrightNotice("Copyright 2018 Paolo Rotolo") .addLicense(License.APACHE) .setWebsite("https://github.com/paolorotolo/AppIntro") .build() Loading Loading @@ -149,7 +143,12 @@ public class AboutActivity extends CyaneaAppCompatActivity { } public void emailDev(View v) { startActivity(Utils.emailIntent("gokulswamilive@gmail.com", "Pdf Viewer Plus", APP_VERSION_RELEASE, "Send email...")); String email = "gokulswamilive@gmail.com"; try { startActivity(Utils.emailIntent(email, "Pdf Viewer Plus", APP_VERSION_RELEASE)); } catch (ActivityNotFoundException e) { Toast.makeText(this, email, Toast.LENGTH_SHORT).show(); } } public void navToGit(View v) { Loading
app/src/main/java/com/gsnathan/pdfviewer/MainActivity.java +7 −1 Original line number Diff line number Diff line Loading @@ -178,7 +178,13 @@ public class MainActivity extends CyaneaAppCompatActivity { } void shareFile() { startActivity(Utils.emailIntent(pdfFileName, "", getResources().getString(R.string.share), uri)); Intent sharingIntent; if (uri.getScheme() != null && uri.getScheme().startsWith("http")) { sharingIntent = Utils.plainTextShareIntent(getString(R.string.share), uri.toString()); } else { sharingIntent = Utils.fileShareIntent(getString(R.string.share), pdfFileName, uri); } startActivity(sharingIntent); } private void openSelectedDocument(Uri selectedDocumentUri) { Loading
app/src/main/java/com/gsnathan/pdfviewer/Utils.java +19 −12 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ package com.gsnathan.pdfviewer; import android.content.ClipData; import android.content.Context; import android.content.Intent; import android.graphics.Color; Loading Loading @@ -61,22 +62,28 @@ public class Utils { log.show(context.getSupportFragmentManager(), "Log"); } static Intent emailIntent(String emailAddress, String subject, String text, String title) { Intent email = new Intent(Intent.ACTION_SEND); email.setType("text/email"); email.putExtra(Intent.EXTRA_EMAIL, new String[]{emailAddress}); static Intent emailIntent(String emailAddress, String subject, String text) { Intent email = new Intent(Intent.ACTION_SENDTO); email.setData(Uri.parse("mailto:" + emailAddress)); email.putExtra(Intent.EXTRA_SUBJECT, subject); email.putExtra(Intent.EXTRA_TEXT, text); return Intent.createChooser(email, title); return email; } static Intent emailIntent(String subject, String text, String title, Uri filePath) { Intent email = new Intent(Intent.ACTION_SEND); email.setType("text/email"); email.putExtra(Intent.EXTRA_SUBJECT, subject); email.putExtra(Intent.EXTRA_TEXT, text); email.putExtra(Intent.EXTRA_STREAM, filePath); return Intent.createChooser(email, title); static Intent plainTextShareIntent(String chooserTitle, String text) { Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_TEXT, text); return Intent.createChooser(intent, chooserTitle); } static Intent fileShareIntent(String chooserTitle, String fileName, Uri fileUri) { Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("application/pdf"); intent.putExtra(Intent.EXTRA_STREAM, fileUri); intent.setClipData(new ClipData(fileName, new String[] { "application/pdf" }, new ClipData.Item(fileUri))); intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); return Intent.createChooser(intent, chooserTitle); } static Intent linkIntent(String url) { Loading