License dialog for buoy tender app

This commit is contained in:
Bennet Brunsen
2015-12-04 15:59:56 +01:00
parent 30fb23e13d
commit 7c756a4171
6 changed files with 89 additions and 1 deletions
@@ -51,6 +51,9 @@ dependencies {
/* Google Play Services */
compile "com.google.android.gms:play-services-location:${rootProject.ext.play_services}"
/* licence dialog */
compile('de.psdev.licensesdialog:licensesdialog:1.8.0')
/* all local jar-libs */
compile fileTree(dir: "libs", include: ["*.jar"])
@@ -86,6 +86,13 @@
<groupId>android</groupId>
<artifactId>android</artifactId>
</dependency>
<dependency>
<groupId>de.psdev.licensesdialog</groupId>
<artifactId>licensesdialog</artifactId>
<version>1.8.0</version>
<type>aar</type>
</dependency>
</dependencies>
<build>
@@ -0,0 +1,47 @@
package com.sap.sailing.android.shared.util;
import de.psdev.licensesdialog.licenses.ApacheSoftwareLicense20;
import de.psdev.licensesdialog.licenses.License;
import de.psdev.licensesdialog.model.Notice;
public class LicenseHelper {
public Notice getOpenSansNotice() {
String name = "Google Fonts - Open Sans";
String url = "https://www.google.com/fonts/specimen/Open+Sans";
String copyright = "Copyright (C) Steve Matteson";
License license = new ApacheSoftwareLicense20();
return new Notice(name, url, copyright, license);
}
public Notice getJsonSimpleNotice() {
String name = "Json Simple";
String url = "http://code.google.com/p/json-simple/";
String copyright = "Copyright (C) Yidong Fang";
License license = new ApacheSoftwareLicense20();
return new Notice(name, url, copyright, license);
}
public Notice getAndroidSupportNotice() {
String name = "Android Support Library";
String url = "http://developer.android.com/tools/support-library/index.html";
String copyright = "Copyright (C) Google";
License license = new ApacheSoftwareLicense20();
return new Notice(name, url, copyright, license);
}
public Notice getAdvancedRecyclerViewNotice() {
String name = "Advanced RecyclerView";
String url = "https://github.com/h6ah4i/android-advancedrecyclerview";
String copyright = "Copyright (C) 2015 Haruki Hasegawa";
License license = new ApacheSoftwareLicense20();
return new Notice(name, url, copyright, license);
}
public Notice getDialogNotice() {
String name = "LicensesDialog";
String url = "http://psdev.de";
String copyright = "Copyright 2013 Philip Schiffer <admin@psdev.de>";
License license = new ApacheSoftwareLicense20();
return new Notice(name, url, copyright, license);
}
}
@@ -74,6 +74,9 @@ dependencies {
/* Google Play Services */
compile "com.google.android.gms:play-services-location:${rootProject.ext.play_services}"
/* licence dialog */
compile('de.psdev.licensesdialog:licensesdialog:1.8.0')
/* local dependencies */
compile project(":mobile:com.sap.sailing.android.shared")
@@ -63,6 +63,14 @@
<version>1.0.0-SNAPSHOT</version>
<type>apklib</type>
</dependency>
<dependency>
<groupId>de.psdev.licensesdialog</groupId>
<artifactId>licensesdialog</artifactId>
<version>1.8.0</version>
<type>aar</type>
</dependency>
</dependencies>
<build>
@@ -8,8 +8,15 @@ import android.view.ViewGroup;
import com.sap.sailing.android.buoy.positioning.app.R;
import com.sap.sailing.android.shared.util.EulaHelper;
import com.sap.sailing.android.shared.util.LicenseHelper;
import com.sap.sailing.android.ui.fragments.BaseFragment;
import de.psdev.licensesdialog.LicensesDialog;
import de.psdev.licensesdialog.licenses.ApacheSoftwareLicense20;
import de.psdev.licensesdialog.licenses.License;
import de.psdev.licensesdialog.model.Notice;
import de.psdev.licensesdialog.model.Notices;
public class AboutFragment extends BaseFragment {
public static AboutFragment newInstance() {
@@ -26,7 +33,7 @@ public class AboutFragment extends BaseFragment {
view.findViewById(R.id.licence_button).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showLicenceDialog();
}
});
view.findViewById(R.id.eula_button).setOnClickListener(new View.OnClickListener() {
@@ -37,4 +44,17 @@ public class AboutFragment extends BaseFragment {
});
return view;
}
private void showLicenceDialog() {
Notices notices = new Notices();
LicenseHelper licenseHelper = new LicenseHelper();
notices.addNotice(licenseHelper.getAndroidSupportNotice());
notices.addNotice(licenseHelper.getOpenSansNotice());
notices.addNotice(licenseHelper.getJsonSimpleNotice());
notices.addNotice(licenseHelper.getDialogNotice());
LicensesDialog.Builder builder = new LicensesDialog.Builder(getActivity());
builder.setTitle(getString(R.string.licence_information));
builder.setNotices(notices);
builder.build().show();
}
}