de.psdev.licensesdialog.model.Notice Java Examples

The following examples show how to use de.psdev.licensesdialog.model.Notice. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SettingsFragment.java    From always-on-amoled with GNU General Public License v3.0 6 votes vote down vote up
private void openSourceLicenses() {
    findPreference("open_source_licenses").setOnPreferenceClickListener(preference -> {
        Notices notices = new Notices();
        notices.addNotice(new Notice("AppIntro", "https://github.com/PaoloRotolo/AppIntro", "Copyright 2015 Paolo Rotolo ,  Copyright 2016 Maximilian Narr", new ApacheSoftwareLicense20()));
        notices.addNotice(new Notice("android-issue-reporter", "https://github.com/HeinrichReimer/android-issue-reporter", "", new ApacheSoftwareLicense20()));
        notices.addNotice(new Notice("ButterKnife", "https://github.com/JakeWharton/butterknife", "Copyright 2013 Jake Wharton", new ApacheSoftwareLicense20()));
        notices.addNotice(new Notice("Custom Analog Clock View", "https://github.com/rosenpin/custom-analog-clock-view", "Copyright (C) 2016 Tomer Rosenfeld", new GnuGeneralPublicLicense30()));
        notices.addNotice(new Notice("CircleImageView", "https://github.com/hdodenhof/CircleImageView", "Copyright 2014 - 2016 Henning Dodenhof", new ApacheSoftwareLicense20()));
        notices.addNotice(new Notice("LicensesDialog", "https://github.com/PSDev/LicensesDialog", "", new ApacheSoftwareLicense20()));
        notices.addNotice(new Notice("material-dialogs", "https://github.com/afollestad/material-dialogs", "Copyright (c) 2014-2016 Aidan Michael Follestad", new MITLicense()));
        new LicensesDialog.Builder(getActivity())
                .setNotices(notices)
                .build()
                .show();
        return true;
    });
}
 
Example #2
Source File: GeneralPreferenceFragment.java    From Toutiao with Apache License 2.0 6 votes vote down vote up
private void createLicenseDialog() {
    Notices notices = new Notices();
    notices.addNotice(new Notice("PhotoView", "https://github.com/chrisbanes/PhotoView", "Copyright 2017 Chris Banes", new ApacheSoftwareLicense20()));
    notices.addNotice(new Notice("OkHttp", "https://github.com/square/okhttp", "Copyright 2016 Square, Inc.", new ApacheSoftwareLicense20()));
    notices.addNotice(new Notice("Gson", "https://github.com/google/gson", "Copyright 2008 Google Inc.", new ApacheSoftwareLicense20()));
    notices.addNotice(new Notice("Glide", "https://github.com/bumptech/glide", "Sam Judd - @sjudd on GitHub, @samajudd on Twitter", new ApacheSoftwareLicense20()));
    notices.addNotice(new Notice("Stetho", "https://github.com/facebook/stetho", "Copyright (c) 2015, Facebook, Inc. All rights reserved.", new BSD3ClauseLicense()));
    notices.addNotice(new Notice("PersistentCookieJar", "https://github.com/franmontiel/PersistentCookieJar", "Copyright 2016 Francisco José Montiel Navarro", new ApacheSoftwareLicense20()));
    notices.addNotice(new Notice("jsoup", "https://jsoup.org", "Copyright © 2009 - 2016 Jonathan Hedley ([email protected])", new MITLicense()));

    new LicensesDialog.Builder(context)
            .setNotices(notices)
            .setIncludeOwnLicense(true)
            .build()
            .show();
}
 
Example #3
Source File: PBAboutActivity.java    From client-android with GNU General Public License v2.0 6 votes vote down vote up
public void clickOnOpenSourceLicenses(final View view) throws Exception {
    final Notices notices = new Notices();
    notices.addNotice(new Notice(
            "Android v7 Support Libraries",
            "https://developer.android.com/topic/libraries/support-library/features.html#v7",
            "Copyright (C) 2012 The Android Open Source Project",
            new ApacheSoftwareLicense20()));
    notices.addNotice(new Notice(
            "LicensesDialog",
            "http://psdev.de",
            "Copyright 2013 Philip Schiffer <[email protected]>",
            new ApacheSoftwareLicense20()));
    notices.addNotice(new Notice(
            "OkHttp",
            "http://square.github.io/okhttp/",
            "Copyright 2016 Square, Inc.",
            new ApacheSoftwareLicense20()));

    new LicensesDialog.Builder(this)
            .setNotices(notices)
            .build()
            .show();
}
 
Example #4
Source File: NoticesHtmlBuilder.java    From LicensesDialog with Apache License 2.0 6 votes vote down vote up
private void appendNoticeBlock(final StringBuilder noticesHtmlBuilder, final Notice notice) {
    noticesHtmlBuilder.append("<ul><li>").append(notice.getName());
    final String currentNoticeUrl = notice.getUrl();
    if (currentNoticeUrl != null && currentNoticeUrl.length() > 0) {
        noticesHtmlBuilder.append(" (<a href=\"")
            .append(currentNoticeUrl)
            .append("\" target=\"_blank\">")
            .append(currentNoticeUrl)
            .append("</a>)");
    }
    noticesHtmlBuilder.append("</li></ul>");
    noticesHtmlBuilder.append("<pre>");
    final String copyright = notice.getCopyright();
    if (copyright != null) {
        noticesHtmlBuilder.append(copyright).append("<br/><br/>");
    }
    noticesHtmlBuilder.append(getLicenseText(notice.getLicense())).append("</pre>");
}
 
Example #5
Source File: NoticesXmlParser.java    From LicensesDialog with Apache License 2.0 6 votes vote down vote up
private static Notice readNotice(final XmlPullParser parser) throws IOException,
    XmlPullParserException {
    parser.require(XmlPullParser.START_TAG, null, "notice");
    String name = null;
    String url = null;
    String copyright = null;
    License license = null;
    while (parser.next() != XmlPullParser.END_TAG) {
        if (parser.getEventType() != XmlPullParser.START_TAG) {
            continue;
        }
        final String element = parser.getName();
        if ("name".equals(element)) {
            name = readName(parser);
        } else if ("url".equals(element)) {
            url = readUrl(parser);
        } else if ("copyright".equals(element)) {
            copyright = readCopyright(parser);
        } else if ("license".equals(element)) {
            license = readLicense(parser);
        } else {
            skip(parser);
        }
    }
    return new Notice(name, url, copyright, license);
}
 
Example #6
Source File: LicensesDialog.java    From LicensesDialog with Apache License 2.0 5 votes vote down vote up
private static String getLicensesText(final Context context, final Notices notices, final boolean showFullLicenseText,
                                      final boolean includeOwnLicense, final String style) {
    try {
        if (includeOwnLicense) {
            final List<Notice> noticeList = notices.getNotices();
            noticeList.add(LICENSES_DIALOG_NOTICE);
        }
        return NoticesHtmlBuilder.create(context).setShowFullLicenseText(showFullLicenseText).setNotices(notices).setStyle(style).build();
    } catch (final Exception e) {
        throw new IllegalStateException(e);
    }
}
 
Example #7
Source File: MainActivity.java    From LicensesDialog with Apache License 2.0 5 votes vote down vote up
public void onMultipleProgrammaticFragmentClick(final View view) {
    final Notices notices = new Notices();
    notices.addNotice(new Notice("Test 1", "http://example.org", "Example Person", new ApacheSoftwareLicense20()));
    notices.addNotice(new Notice("Test 2", "http://example.org", "Example Person 2", new GnuLesserGeneralPublicLicense21()));

    final LicensesDialogFragment fragment = new LicensesDialogFragment.Builder(this)
        .setNotices(notices)
        .setShowFullLicenseText(false)
        .setIncludeOwnLicense(true)
        .build();

    fragment.show(getSupportFragmentManager(), null);
}
 
Example #8
Source File: MainActivity.java    From LicensesDialog with Apache License 2.0 5 votes vote down vote up
public void onSingleFragmentClick(final View view) {
    final String name = "LicensesDialog";
    final String url = "http://psdev.de";
    final String copyright = "Copyright 2013 Philip Schiffer <[email protected]>";
    final License license = new ApacheSoftwareLicense20();
    final Notice notice = new Notice(name, url, copyright, license);

    final LicensesDialogFragment fragment = new LicensesDialogFragment.Builder(this)
        .setNotice(notice)
        .setIncludeOwnLicense(false)
        .build();

    fragment.show(getSupportFragmentManager(), null);
}
 
Example #9
Source File: MainActivity.java    From LicensesDialog with Apache License 2.0 5 votes vote down vote up
public void onMultipleProgrammaticClick(final View view) {
    final Notices notices = new Notices();
    notices.addNotice(new Notice("Test 1", "http://example.org", "Example Person", new ApacheSoftwareLicense20()));
    notices.addNotice(new Notice("Test 2", "http://example.org", "Example Person 2", new GnuLesserGeneralPublicLicense21()));

    new LicensesDialog.Builder(this)
        .setNotices(notices)
        .setIncludeOwnLicense(true)
        .build()
        .show();
}
 
Example #10
Source File: MainActivity.java    From LicensesDialog with Apache License 2.0 5 votes vote down vote up
public void onSingleClick(final View view) {
    final String name = "LicensesDialog";
    final String url = "http://psdev.de";
    final String copyright = "Copyright 2013 Philip Schiffer <[email protected]>";
    final License license = new ApacheSoftwareLicense20();
    final Notice notice = new Notice(name, url, copyright, license);
    new LicensesDialog.Builder(this)
        .setNotices(notice)
        .build()
        .show();
}
 
Example #11
Source File: NoticesHtmlBuilder.java    From LicensesDialog with Apache License 2.0 5 votes vote down vote up
public String build() {
    final StringBuilder noticesHtmlBuilder = new StringBuilder(500);
    appendNoticesContainerStart(noticesHtmlBuilder);
    if (mNotice != null) {
        appendNoticeBlock(noticesHtmlBuilder, mNotice);
    } else if (mNotices != null) {
        for (final Notice notice : mNotices.getNotices()) {
            appendNoticeBlock(noticesHtmlBuilder, notice);
        }
    } else {
        throw new IllegalStateException("no notice(s) set");
    }
    appendNoticesContainerEnd(noticesHtmlBuilder);
    return noticesHtmlBuilder.toString();
}
 
Example #12
Source File: MainActivity.java    From MockSMS with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    int id = item.getItemId();
    if (id == R.id.action_settings) {
        new AlertDialog.Builder(MainActivity.this)
                .setTitle("Info")
                .setItems(new String[]{"Terms & Conditions", "Privacy Policy", "Disclaimer", "Help"}, (dialog, which) -> handleInfoItemClick(which))
                .setPositiveButton("Back", null)
                .setNeutralButton("Open-Source Licenses", (dialog, which) -> {
                    Notices notices = new Notices();
                    notices.addNotice(new Notice("AppCompat", "https://developer.android.com/reference/android/support/v7/appcompat/package-summary", "Google", new ApacheSoftwareLicense20()));
                    notices.addNotice(new Notice("Android Support Library", "https://developer.android.com/topic/libraries/support-library/", "Google", new ApacheSoftwareLicense20()));
                    notices.addNotice(new Notice("MaterialDateTimePicker", "https://github.com/wdullaer/MaterialDateTimePicker", "wdullaer", new ApacheSoftwareLicense20()));
                    notices.addNotice(new Notice("PiracyChecker", "https://github.com/javiersantos/PiracyChecker", "javiersantos", new ApacheSoftwareLicense20()));

                    new LicensesDialog.Builder(MainActivity.this)
                            .setNotices(notices)
                            .setIncludeOwnLicense(true)
                            .build()
                            .show();

                })
                .show();
        return true;
    }
    return super.onOptionsItemSelected(item);
}
 
Example #13
Source File: Licenses.java    From fontster with Apache License 2.0 5 votes vote down vote up
public static Notices getNotices() {
  if (mNotices.getNotices().isEmpty()) {
    for (Notice notice : NOTICE_LIST) {
      mNotices.addNotice(notice);
    }
  }
  return mNotices;
}
 
Example #14
Source File: AboutAppActivity.java    From ForceDoze with GNU General Public License v3.0 5 votes vote down vote up
public void showLicences(View v) {
    final Notices notices = new Notices();
    notices.addNotice(new Notice("Material Dialogs", "https://github.com/afollestad/material-dialogs", "Aidan Michael Follestad", new MITLicense()));
    notices.addNotice(new Notice("libsuperuser", "https://github.com/Chainfire/libsuperuser", "Chainfire", new ApacheSoftwareLicense20()));
    notices.addNotice(new Notice("Nanotasks", "https://github.com/fabiendevos/nanotasks", "Fabien Devos", new ApacheSoftwareLicense20()));
    notices.addNotice(new Notice("ProcessPhoenix", "https://github.com/JakeWharton/ProcessPhoenix", "Jake Wharton", new ApacheSoftwareLicense20()));
    notices.addNotice(new Notice("ckChangelog", "https://github.com/cketti/ckChangeLog", "cketti", new ApacheSoftwareLicense20()));
    notices.addNotice(new Notice("SimpleCustomTabs", "https://github.com/eliseomartelli/SimpleCustomTabs", "Eliseo Martelli", new MITLicense()));
    notices.addNotice(new Notice("MaterialList", "https://github.com/dexafree/MaterialList", "Dexafree", new MITLicense()));
    new LicensesDialog.Builder(this).setNotices(notices).setIncludeOwnLicense(true).build().show();
}
 
Example #15
Source File: MainActivity.java    From MockSMS with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    int id = item.getItemId();
    if (id == R.id.action_settings) {
        View topView = getLayoutInflater().inflate(R.layout.bad_quality_content, null);
        setupGrids(topView);
        new AlertDialog.Builder(MainActivity.this)
                .setTitle("Info")
                .setView(topView)
                .setPositiveButton("Back", null)
                .setNeutralButton("Open-Source Licenses", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        Notices notices = new Notices();
                        notices.addNotice(new Notice("AppCompat", "https://developer.android.com/reference/android/support/v7/appcompat/package-summary", "Google", new ApacheSoftwareLicense20()));
                        notices.addNotice(new Notice("Android Support Library", "https://developer.android.com/topic/libraries/support-library/", "Google", new ApacheSoftwareLicense20()));
                        notices.addNotice(new Notice("MaterialDateTimePicker", "https://github.com/wdullaer/MaterialDateTimePicker", "wdullaer", new ApacheSoftwareLicense20()));
                        notices.addNotice(new Notice("PiracyChecker", "https://github.com/javiersantos/PiracyChecker", "javiersantos", new ApacheSoftwareLicense20()));
                        notices.addNotice(new Notice("LicensesDialog", "https://github.com/PSDev/LicensesDialog", "PSDev", new ApacheSoftwareLicense20()));

                        new LicensesDialog.Builder(MainActivity.this)
                                .setNotices(notices)
                                .build()
                                .show();

                        Toast.makeText(MainActivity.this, "Scroll Down", Toast.LENGTH_SHORT).show();
                    }
                })
                .show();
        return true;
    }
    return super.onOptionsItemSelected(item);
}
 
Example #16
Source File: LicensesDialog.java    From LicensesDialog with Apache License 2.0 4 votes vote down vote up
private static Notices getSingleNoticeNotices(final Notice notice) {
    final Notices notices = new Notices();
    notices.addNotice(notice);
    return notices;
}
 
Example #17
Source File: LicensesDialogFragment.java    From LicensesDialog with Apache License 2.0 4 votes vote down vote up
public Builder setNotice(final Notice notice) {
    mNotices = new Notices();
    mNotices.addNotice(notice);
    return this;
}
 
Example #18
Source File: NoticesHtmlBuilder.java    From LicensesDialog with Apache License 2.0 4 votes vote down vote up
public NoticesHtmlBuilder setNotice(final Notice notice) {
    mNotice = notice;
    mNotices = null;
    return this;
}
 
Example #19
Source File: LicensesDialog.java    From LicensesDialog with Apache License 2.0 4 votes vote down vote up
public Builder setNotices(final Notice notice) {
    return setNotices(getSingleNoticeNotices(notice));
}
 
Example #20
Source File: FragmentAboutHelper.java    From Saiy-PS with GNU Affero General Public License v3.0 4 votes vote down vote up
/**
 * Get the license information we need to display
 *
 * @return the {@link Notices} object containing the required {@link Notice} elements
 */
public Notices getLicenses() {
    if (DEBUG) {
        MyLog.i(CLS_NAME, "getLicenses");
    }

    final Notices notices = new Notices();

    notices.addNotice(new Notice(getString(R.string.google_play_services),
            Constants.LICENSE_URL_GOOGLE_PLAY_SERVICES,
            getString(R.string.license_android_open_source),
            new ApacheSoftwareLicense20()));

    notices.addNotice(new Notice(getString(R.string.gson),
            Constants.LICENSE_URL_GSON,
            getString(R.string.license_google_inc),
            new ApacheSoftwareLicense20()));

    notices.addNotice(new Notice(getString(R.string.volley),
            Constants.LICENSE_URL_VOLLEY,
            getString(R.string.license_volley),
            new ApacheSoftwareLicense20()));

    notices.addNotice(new Notice(getString(R.string.two_forty_four),
            Constants.LICENSE_URL_TWO_FORTY_FOUR,
            getString(R.string.license_two_forty_four),
            new ApacheSoftwareLicense20()));

    notices.addNotice(new Notice(getString(R.string.speechutils),
            Constants.LICENSE_URL_KAAREL_KALJURAND,
            getString(R.string.license_kaarel_kaljurand),
            new ApacheSoftwareLicense20()));

    notices.addNotice(new Notice(getString(R.string.microsoft_translator),
            Constants.LICENSE_URL_MICROSOFT_TRANSLATOR,
            getString(R.string.license_microsoft_translator),
            new ApacheSoftwareLicense20()));

    notices.addNotice(new Notice(getString(R.string.apache_commons),
            Constants.LICENSE_URL_APACHE_COMMONS,
            getString(R.string.license_apache_commons),
            new ApacheSoftwareLicense20()));

    notices.addNotice(new Notice(getString(R.string.simmetrics),
            Constants.LICENSE_URL_SIMMETRICS,
            getString(R.string.license_simmetrics),
            new ApacheSoftwareLicense20()));

    notices.addNotice(new Notice(getString(R.string.nuance_speechkit),
            Constants.LICENSE_URL_NUANCE_SPEECHKIT,
            getString(R.string.license_nuance_speechkit),
            new BSD2ClauseLicense()));

    notices.addNotice(new Notice(getString(R.string.guava),
            Constants.LICENSE_URL_GUAVA,
            getString(R.string.license_guava),
            new ApacheSoftwareLicense20()));

    notices.addNotice(new Notice(getString(R.string.microsoft_cognitive),
            Constants.LICENSE_URL_MICROSOFT_COGNITIVE,
            getString(R.string.license_microsoft_cognitive),
            new MITLicense()));

    notices.addNotice(new Notice(getString(R.string.api_ai),
            Constants.LICENSE_URL_API_AI,
            getString(R.string.license_api_ai),
            new ApacheSoftwareLicense20()));

    notices.addNotice(new Notice(getString(R.string.simple_xml),
            Constants.LICENSE_URL_SIMPLE_XML,
            getString(R.string.license_simple_xml),
            new ApacheSoftwareLicense20()));

    notices.addNotice(new Notice(getString(R.string.material_icons),
            Constants.LICENSE_MATERIAL_ICONS,
            getString(R.string.license_material_icons),
            new ApacheSoftwareLicense20()));

    notices.addNotice(new Notice(getString(R.string.material_dialogs),
            Constants.LICENSE_MATERIAL_DIALOGS,
            getString(R.string.license_material_dialogs),
            new MITLicense()));

    notices.addNotice(new Notice(getString(R.string.pocketsphinx),
            Constants.LICENSE_POCKETSPHINX,
            getString(R.string.license_pocketsphinx),
            new BSD2ClauseLicense()));

    notices.addNotice(new Notice(getString(R.string.sound_bible),
            Constants.LICENSE_SOUND_BIBLE,
            getString(R.string.license_sound_bible),
            new CreativeCommonsAttributionShareAlike30Unported()));

    return notices;
}
 
Example #21
Source File: SettingsAboutFragment.java    From Rey-MusicPlayer with Apache License 2.0 4 votes vote down vote up
@Override
public void onCreate(Bundle onSavedInstanceState) {
    super.onCreate(onSavedInstanceState);
    addPreferencesFromResource(R.xml.settings_about);
    ((SettingActivity) getActivity()).setToolbarTitle(getString(R.string.licenses_and_about));
    mPreferenceManager = getPreferenceManager();

    mContactsUsPreference = mPreferenceManager.findPreference("preference_key_contact_us");
    mAboutUsPreference=mPreferenceManager.findPreference("preference_key_about_us");
    mAboutUsPreference.setOnPreferenceClickListener(preference -> {
        AlertDialog.Builder  builder    =new AlertDialog.Builder(getActivity());
        View view  =LayoutInflater.from(getActivity()).inflate(R.layout.layout_about,null);
        ((TextView)view.findViewById(R.id.version_name)).setText(Common.getVersionName());
        builder.setView(view);
        builder.setTitle(R.string.about);
        builder.setPositiveButton(R.string.ok, (dialog, which) -> dialog.dismiss());
        builder.create().show();
        return false;
    });

    mLicensesPreference = mPreferenceManager.findPreference("preference_key_licenses");

    mContactsUsPreference.setOnPreferenceClickListener(preference -> {
        Intent emailIntent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts("mailto", "[email protected]", null));
        emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Boom Music Player Support");
        startActivity(Intent.createChooser(emailIntent, "Send email"));
        return false;
    });

    mLicensesPreference.setOnPreferenceClickListener(preference -> {
        final Notices notices = new Notices();
        notices.addNotice(new Notice("SeekArc", "https://github.com/neild001/SeekArc", "Neil Davies", new MITLicense()));
        notices.addNotice(new Notice("RangeSliderView", "https://github.com/channguyen/range-slider-view", "Chan Nguyen", new MITLicense()));
        notices.addNotice(new Notice("range-seek-bar", "https://github.com/anothem/android-range-seek-bar", "Neil Davies", new ApacheSoftwareLicense20()));
        notices.addNotice(new Notice("jaudiotagger", "https://bitbucket.org/ijabz/jaudiotagger", "Paul Taylor", new GnuGeneralPublicLicense20()));
        notices.addNotice(new Notice("Universal Image Loader", "https://github.com/nostra13/Android-Universal-Image-Loader", "Sergey Tarasevich", new ApacheSoftwareLicense20()));
        notices.addNotice(new Notice("android-betterpickers", "https://github.com/code-troopers/android-betterpickers", "Derek Brameyer", new ApacheSoftwareLicense20()));
        notices.addNotice(new Notice("VerticalSeekBar", "https://github.com/h6ah4i/android-verticalseekbar", "Derek Brameyer", new ApacheSoftwareLicense20()));


        new LicensesDialog.Builder(getActivity())
                .setNotices(notices)
                .setIncludeOwnLicense(true)
                .build()
                .show();
        return false;
    });

}