mirror of
https://gitlab.com/oeffi/oeffi.git
synced 2025-07-07 06:08:51 +00:00
Use 'aosp' and 'google' flavors to separate the two variants.
This is a replacement for the constantly rebased 'google' git branch.
This commit is contained in:
parent
3f11df7be6
commit
e41533a63e
8 changed files with 77 additions and 6 deletions
|
@ -20,7 +20,7 @@
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
package="de.schildbach.oeffi"
|
package="de.schildbach.oeffi"
|
||||||
android:versionCode="653"
|
android:versionCode="653"
|
||||||
android:versionName="10.5.9-aosp" >
|
android:versionName="10.5.9" >
|
||||||
|
|
||||||
<uses-sdk
|
<uses-sdk
|
||||||
android:minSdkVersion="19"
|
android:minSdkVersion="19"
|
||||||
|
|
|
@ -49,6 +49,15 @@ android {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
productFlavors {
|
||||||
|
aosp {
|
||||||
|
versionNameSuffix '-aosp'
|
||||||
|
}
|
||||||
|
google {
|
||||||
|
versionNameSuffix '-google'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
main {
|
main {
|
||||||
manifest.srcFile 'AndroidManifest.xml'
|
manifest.srcFile 'AndroidManifest.xml'
|
||||||
|
@ -59,6 +68,12 @@ android {
|
||||||
test {
|
test {
|
||||||
java.srcDirs = ['test']
|
java.srcDirs = ['test']
|
||||||
}
|
}
|
||||||
|
aosp {
|
||||||
|
java.srcDirs = ['src-aosp']
|
||||||
|
}
|
||||||
|
google {
|
||||||
|
java.srcDirs = ['src-google']
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
packagingOptions {
|
packagingOptions {
|
||||||
|
|
|
@ -10,8 +10,5 @@
|
||||||
<header
|
<header
|
||||||
android:fragment="de.schildbach.oeffi.preference.AboutFragment"
|
android:fragment="de.schildbach.oeffi.preference.AboutFragment"
|
||||||
android:title="@string/about_title"/>
|
android:title="@string/about_title"/>
|
||||||
<header
|
|
||||||
android:fragment="de.schildbach.oeffi.preference.DonateFragment"
|
|
||||||
android:title="@string/about_donate_title"/>
|
|
||||||
|
|
||||||
</preference-headers>
|
</preference-headers>
|
||||||
|
|
8
oeffi/res/xml/preference_headers_donate.xml
Normal file
8
oeffi/res/xml/preference_headers_donate.xml
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<preference-headers xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<header
|
||||||
|
android:fragment="de.schildbach.oeffi.preference.DonateFragment"
|
||||||
|
android:title="@string/about_donate_title"/>
|
||||||
|
|
||||||
|
</preference-headers>
|
22
oeffi/src-aosp/de/schildbach/oeffi/Variants.java
Normal file
22
oeffi/src-aosp/de/schildbach/oeffi/Variants.java
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
/*
|
||||||
|
* Copyright the original author or authors.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.schildbach.oeffi;
|
||||||
|
|
||||||
|
public class Variants {
|
||||||
|
public static final boolean ENABLE_DONATE = true;
|
||||||
|
}
|
22
oeffi/src-google/de/schildbach/oeffi/Variants.java
Normal file
22
oeffi/src-google/de/schildbach/oeffi/Variants.java
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
/*
|
||||||
|
* Copyright the original author or authors.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.schildbach.oeffi;
|
||||||
|
|
||||||
|
public class Variants {
|
||||||
|
public static final boolean ENABLE_DONATE = false;
|
||||||
|
}
|
|
@ -277,6 +277,9 @@ public abstract class OeffiMainActivity extends OeffiActivity {
|
||||||
final MenuItem plansItem = menu.findItem(R.id.global_options_plans);
|
final MenuItem plansItem = menu.findItem(R.id.global_options_plans);
|
||||||
plansItem.setChecked(this instanceof PlansPickerActivity);
|
plansItem.setChecked(this instanceof PlansPickerActivity);
|
||||||
|
|
||||||
|
final MenuItem donateItem = menu.findItem(R.id.global_options_donate);
|
||||||
|
donateItem.setVisible(Variants.ENABLE_DONATE);
|
||||||
|
|
||||||
return super.onPrepareOptionsMenu(menu);
|
return super.onPrepareOptionsMenu(menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -326,7 +329,8 @@ public abstract class OeffiMainActivity extends OeffiActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
case R.id.global_options_donate: {
|
case R.id.global_options_donate: {
|
||||||
PreferenceActivity.start(this, DonateFragment.class.getName());
|
if (Variants.ENABLE_DONATE)
|
||||||
|
PreferenceActivity.start(this, DonateFragment.class.getName());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@ import android.app.Activity;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import de.schildbach.oeffi.R;
|
import de.schildbach.oeffi.R;
|
||||||
|
import de.schildbach.oeffi.Variants;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -38,6 +39,8 @@ public class PreferenceActivity extends android.preference.PreferenceActivity {
|
||||||
@Override
|
@Override
|
||||||
public void onBuildHeaders(final List<Header> target) {
|
public void onBuildHeaders(final List<Header> target) {
|
||||||
loadHeadersFromResource(R.xml.preference_headers, target);
|
loadHeadersFromResource(R.xml.preference_headers, target);
|
||||||
|
if (Variants.ENABLE_DONATE)
|
||||||
|
loadHeadersFromResource(R.xml.preference_headers_donate, target);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -56,6 +59,6 @@ public class PreferenceActivity extends android.preference.PreferenceActivity {
|
||||||
return CommonFragment.class.getName().equals(fragmentName)
|
return CommonFragment.class.getName().equals(fragmentName)
|
||||||
|| DirectionsFragment.class.getName().equals(fragmentName)
|
|| DirectionsFragment.class.getName().equals(fragmentName)
|
||||||
|| AboutFragment.class.getName().equals(fragmentName)
|
|| AboutFragment.class.getName().equals(fragmentName)
|
||||||
|| DonateFragment.class.getName().equals(fragmentName);
|
|| (Variants.ENABLE_DONATE && DonateFragment.class.getName().equals(fragmentName));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue