Commit 95ed3015 authored by Matteo De Carlo's avatar Matteo De Carlo

Added licenses and donation in the code

parent 44b0f810
This diff is collapsed.
......@@ -5,14 +5,18 @@ apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
signingConfigs {
google_signing {
}
}
compileSdkVersion 27
buildToolsVersion "27.0.3"
defaultConfig {
applicationId "org.covolunablu.marswallpaper"
minSdkVersion 15
targetSdkVersion 27
versionCode 1
versionName "1.0"
versionCode 2
versionName "1.1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
......@@ -21,12 +25,25 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
flavorDimensions("freedom")
productFlavors {
google {
dimension "freedom"
buildConfigField "boolean", "DONATIONS_GOOGLE", "true"
}
fdroid {
dimension "freedom"
buildConfigField "boolean", "DONATIONS_GOOGLE", "false"
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation"org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'org.sufficientlysecure:donations:2.6'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
......
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.covolunablu.marswallpaper">
<uses-permission android:name="com.android.vending.BILLING" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
......@@ -8,7 +11,6 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<service
android:name=".MarsWallpaperService"
android:enabled="true"
......@@ -30,19 +32,37 @@
android:theme="@style/HomeTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".activities.MarsWallpaperPreferenceActivity"
android:exported="true"
android:label="@string/app_name"
android:theme="@style/Theme.AppCompat" />
<activity
android:name=".activities.ShowCaseActivity"
android:exported="true"
android:label="Live Wallpaper Showcase" />
<activity
android:name=".activities.MarsWallpaperInfo"
android:label="@string/title_activity_mars_wallpaper_info"
android:theme="@style/AppTheme.ActionBarPresent"
android:parentActivityName=".activities.MarsWallpaperHome" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="org.covolunablu.marswallpaper.activities.MarsWallpaperHome" />
</activity>
<activity
android:name=".activities.DonationsActivity"
android:theme="@style/AppTheme.ActionBarPresent"
android:label="Donate"
android:parentActivityName=".activities.MarsWallpaperInfo" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="org.covolunablu.marswallpaper.activities.MarsWallpaperInfo" />
</activity>
</application>
</manifest>
</manifest>
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
/*
* Copyright (C) 2011-2015 Dominik Schürmann <dominik@dominikschuermann.de>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// file modified from https://github.com/PrivacyApps/donations/blob/aa4b03a15efcba020221c914272ab35dbf043ddb/example/src/main/java/org/sufficientlysecure/donations/example/DonationsActivity.java
package org.covolunablu.marswallpaper.activities
import android.content.Intent
import android.os.Bundle
import android.support.v4.app.FragmentActivity
import org.covolunablu.marswallpaper.BuildConfig
import org.covolunablu.marswallpaper.R
import org.sufficientlysecure.donations.DonationsFragment
class DonationsActivity : FragmentActivity() {
/**
* Called when the activity is first created.
*/
public override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_donations)
actionBar?.setDisplayShowTitleEnabled(true)
val ft = supportFragmentManager.beginTransaction()
val donationsFragment: DonationsFragment
if (BuildConfig.DONATIONS_GOOGLE) {
donationsFragment = DonationsFragment.newInstance(false,
true,
GOOGLE_PUBKEY,
GOOGLE_CATALOG,
resources.getStringArray(R.array.donation_google_catalog_values),
false,
null,
null,
null,
false,
null,
null,
false,
null)
} else {
donationsFragment = DonationsFragment.newInstance(BuildConfig.DEBUG,
false,
null,
null,
null,
true,
PAYPAL_USER,
PAYPAL_CURRENCY_CODE,
getString(R.string.donation_paypal_item),
false,
FLATTR_PROJECT_URL,
FLATTR_URL,
false,
BITCOIN_ADDRESS)
}
ft.replace(R.id.donations_activity_container, donationsFragment, "donationsFragment")
ft.commit()
}
/**
* Needed for Google Play In-app Billing. It uses startIntentSenderForResult(). The result is not propagated to
* the Fragment like in startActivityForResult(). Thus we need to propagate manually to our Fragment.
*/
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent) {
super.onActivityResult(requestCode, resultCode, data)
val fragmentManager = supportFragmentManager
val fragment = fragmentManager.findFragmentByTag("donationsFragment")
fragment?.onActivityResult(requestCode, resultCode, data)
}
companion object {
/**
* Google
*/
private const val GOOGLE_PUBKEY = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnYLx+sRdFJIEyHYNDqqWX0AfSf2dsR1wCtE7BZsINaTgX9ATh7O5m50OM2WfnHXos1yA6VKtpVzcStDiGyPe1YHlCjwhlztYnV06wl0zAmatG6dlMFUyTj1duRGKxSaPvaKL2KKIjBC9HCvZFOnbCWKv+2yrMR0ZO/GZXVpJMHf1j9Lhe7LpE1IticNC6WKumIOKAIFFIICaBMpQUg36DnzDAmOwVBs9M/7oB0779e7uoj6yt4+f00FlS88WFNSj0Bwdc8POyO1lXtiFlt/xaTVAiWaHhM9g44V2/Aua1GpRwqdXr6V2OLKBVlmkIFXge2kd58EKe9uVqhS/4U2v+wIDAQAB"
private val GOOGLE_CATALOG = arrayOf(
"org.covolunablu.marswallpaper.donation.1",
"org.covolunablu.marswallpaper.donation.2",
"org.covolunablu.marswallpaper.donation.3",
"org.covolunablu.marswallpaper.donation.5",
"org.covolunablu.marswallpaper.donation.8",
"org.covolunablu.marswallpaper.donation.13")
/**
* PayPal
*/
private const val PAYPAL_USER = "matteo.dek@covolunablu.org"
private const val PAYPAL_CURRENCY_CODE = "EUR"
/**
* Flattr
*/
private const val FLATTR_PROJECT_URL = "https://git.covolunablu.org/portaloffreedom/MarsWallpaper"
// FLATTR_URL without http:// !
private const val FLATTR_URL = "flattr.com/thing/712895/dschuermannandroid-donations-lib-on-GitHub"
/**
* Bitcoin
*/
private const val BITCOIN_ADDRESS = "12Y6zbBYoRxf8kBrjau3WedjtzvcACvPMk"
}
}
\ No newline at end of file
......@@ -38,7 +38,7 @@ public class MarsWallpaperHome extends Activity
protected void onCreate(@Nullable Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.home_activity);
setContentView(R.layout.activity_home);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
......@@ -255,4 +255,10 @@ public class MarsWallpaperHome extends Activity
return orientation;
}
public void onClickInfo(View view)
{
Intent intent = new Intent(this, MarsWallpaperInfo.class);
startActivity(intent);
}
}
package org.covolunablu.marswallpaper.activities
import android.os.Bundle
import android.app.Activity
import android.content.Intent
import android.support.v7.app.AlertDialog
import android.widget.Toast
import org.covolunablu.marswallpaper.R
import kotlinx.android.synthetic.main.activity_mars_wallpaper_info.*
import android.view.LayoutInflater
import android.webkit.WebView
class MarsWallpaperInfo : Activity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_mars_wallpaper_info)
actionBar?.setDisplayHomeAsUpEnabled(true)
actionBar?.title = getString(R.string.about_title)
actionBar.setDisplayShowTitleEnabled(true)
show_license.setOnClickListener { showLicense("file:///android_asset/licenses/gpl-3.0-standalone.html") }
show_third_party_licenses.setOnClickListener { showLicense("file:///android_asset/licenses/third-party.html") }
show_donate.setOnClickListener { showDonate() }
}
private fun showLicense(licenseURL: String) {
val view = LayoutInflater.from(this).inflate(R.layout.dialog_licenses, null) as WebView
view.loadUrl(licenseURL)
AlertDialog.Builder(this, R.style.Theme_AppCompat_Light_Dialog_Alert)
// .setTitle(getString(R.string.license))
.setView(view)
.setPositiveButton(android.R.string.ok, null)
.show()
}
private fun showDonate() {
val intent = Intent(this, DonationsActivity::class.java)
startActivity(intent)
}
}
......@@ -112,12 +112,12 @@ public class Planet extends RenderableObject {
@Override
String GetVertexShaderCode(final Context context) {
return getShaderCodeFromAsset(context, "mars.vert");
return getShaderCodeFromAsset(context, "shaders/mars.vert");
}
@Override
String GetFragmentShaderCode(final Context context) {
return getShaderCodeFromAsset(context, "mars.frag");
return getShaderCodeFromAsset(context, "shaders/mars.frag");
}
@Override
......
......@@ -203,13 +203,13 @@ public class SkyMap extends RenderableObject
@Override
String GetVertexShaderCode(final Context context)
{
return getShaderCodeFromAsset(context, "skymap.vert");
return getShaderCodeFromAsset(context, "shaders/skymap.vert");
}
@Override
String GetFragmentShaderCode(final Context context)
{
return getShaderCodeFromAsset(context, "skymap.frag");
return getShaderCodeFromAsset(context, "shaders/skymap.frag");
}
@Override
......
......@@ -21,11 +21,11 @@ public class Triangle extends RenderableObject {
@Override
String GetVertexShaderCode(final Context context) {
return getShaderCodeFromAsset(context, "basic.vert");
return getShaderCodeFromAsset(context, "shaders/basic.vert");
}
@Override
String GetFragmentShaderCode(final Context context) {
return getShaderCodeFromAsset(context, "basic.frag");
return getShaderCodeFromAsset(context, "shaders/basic.frag");
}
}
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<LinearLayout
android:id="@+id/donations_activity_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
</LinearLayout>
</LinearLayout>
\ No newline at end of file
......@@ -8,7 +8,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent" />
<LinearLayout
<RelativeLayout
android:id="@+id/home_root_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
......@@ -21,24 +21,37 @@
android:id="@+id/textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_gravity="top"
android:gravity="center"
android:paddingTop="20dp"
android:text="@string/app_name"
android:textSize="24sp" />
<Space
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
<FrameLayout
android:padding="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true">
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/informations"
android:background="@android:color/transparent"
android:onClick="onClickInfo"
android:src="@android:drawable/ic_dialog_info" />
</FrameLayout>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_gravity="bottom"
android:onClick="onClick"
android:padding="40dp"
android:text="@string/button_set_wallpaper" />
</LinearLayout>
</RelativeLayout>
</FrameLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/black"
android:orientation="vertical"
tools:context=".activities.MarsWallpaperInfo">
<org.covolunablu.marswallpaper.MyGLSurfaceView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
<TextView
android:id="@+id/show_license"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="18dp"
android:paddingBottom="18dp"
android:paddingLeft="24dp"
android:paddingRight="24dp"
android:text="@string/license"
android:textColor="@android:color/white"
android:textSize="18sp" />
<TextView
android:id="@+id/show_third_party_licenses"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="18dp"
android:paddingBottom="18dp"
android:paddingLeft="24dp"
android:paddingRight="24dp"
android:text="@string/third_party_licenses"
android:textColor="@android:color/white"
android:textSize="18sp" />
<TextView
android:id="@+id/show_donate"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="18dp"
android:paddingBottom="18dp"
android:paddingLeft="24dp"
android:paddingRight="24dp"
android:text="@string/donate"
android:textColor="@android:color/white"
android:textSize="18sp" />
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<WebView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<resources xmlns:tools="http://schemas.android.com/tools">
<style name="HomeTheme" parent="AppTheme">
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:navigationBarColor">@android:color/transparent</item>
</style>
<style name="AppTheme.ActionBarPresent" parent="Theme.AppCompat.CompactMenu">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:statusBarColor">@color/colorPrimaryDark</item>
<item name="android:actionBarStyle" tools:ignore="NewApi">@style/AppTheme.ActionBar</item>
<item name="actionBarStyle">@style/AppTheme.ActionBar</item>
</style>
</resources>
\ No newline at end of file
......@@ -9,4 +9,20 @@
<string name="pref_speed_mul_summary">How faster in respect to real life rotation</string>
<string name="button_set_wallpaper">Set Wallpaper</string>
<string name="pref_starmap_res_title">Star Map Resolution</string>
<string name="informations">Informations</string>
<string name="title_activity_mars_wallpaper_info">MarsWallpaperInfo</string>
<string name="about_title">About</string>
<string name="license">License</string>
<string name="third_party_licenses">Third Party Licenses</string>
<string name="donate">Donate</string>
<string name="donation_paypal_item">Donation</string>
<string-array name="donation_google_catalog_values">
<item>1 Euro</item>
<item>2 Euros</item>
<item>3 Euros</item>
<item>5 Euros</item>
<item>8 Euros</item>
<item>13 Euros</item>
</string-array>
</resources>
<resources>
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat">
......@@ -12,4 +12,17 @@
<item name="windowNoTitle">true</item>
</style>
<style name="AppTheme.ActionBarPresent" parent="Theme.AppCompat.CompactMenu">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:actionBarStyle" tools:ignore="NewApi">@style/AppTheme.ActionBar</item>
<item name="actionBarStyle">@style/AppTheme.ActionBar</item>
</style>
<style name="AppTheme.ActionBar" parent="@style/Widget.AppCompat.ActionBar">
<item name="android:background" tools:ignore="NewApi">@color/colorPrimary</item>
<item name="background">@color/colorPrimary</item>
</style>
</resources>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment