Skip to content

Commit

Permalink
Add full and noanalytics build flavors
Browse files Browse the repository at this point in the history
  • Loading branch information
Iktwo committed Aug 25, 2016
1 parent ae9a689 commit 484f057
Show file tree
Hide file tree
Showing 7 changed files with 93 additions and 20 deletions.
10 changes: 1 addition & 9 deletions src/android/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
android:theme="@style/AppTheme">

<activity
android:name="com.iktwo.qutelauncher.QuteLauncher"
android:name="com.iktwo.qutelauncher.QuteLauncherFlavored"
android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|locale|fontScale|keyboard|keyboardHidden|navigation"
android:label="Qutelauncher"
android:launchMode="singleInstance"
Expand Down Expand Up @@ -86,12 +86,6 @@
<!-- Splash screen -->
</activity>

<service android:name="com.iktwo.qutelauncher.CustomFirebaseMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>

</application>

<uses-sdk
Expand All @@ -104,6 +98,4 @@
android:normalScreens="true"
android:smallScreens="true" />

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
</manifest>
61 changes: 55 additions & 6 deletions src/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,26 @@ android {
applicationId "com.iktwo.qutelauncher"
}

String APK_NAME = "qutelauncher"

String BUILDTYPE = ""

productFlavors {
full {

}

noanalytics {

}
}

buildTypes {
releaseUnsigned {
BUILDTYPE = "unsigned"
}
}

sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
Expand All @@ -54,18 +74,47 @@ android {
assets.srcDirs = ['assets']
jniLibs.srcDirs = ['libs']
}

full {
java.srcDirs = ['full']
manifest.srcFile 'full/AndroidManifest.xml'
}

noanalytics {
java.srcDirs = ['noanalytics']
}
}

lintOptions {
abortOnError false
}

applicationVariants.all { variant ->
variant.outputs.each { output ->
output.outputFile = new File(
output.outputFile.parent,
APK_NAME + "_" + variant.productFlavors[0].name + "_"+ BUILDTYPE + ".apk")
}

variant.assemble.doLast {
variant.outputs.each { output ->
println "aligned " + output.outputFile
println "unaligned " + output.packageApplication.outputFile

File unaligned = output.packageApplication.outputFile;
File aligned = output.outputFile
if (!unaligned.getName().equalsIgnoreCase(aligned.getName())) {
println "deleting " + unaligned.getName()
unaligned.delete()
}
}
}
}
}

dependencies {
compile 'com.android.support:appcompat-v7:24.2.0'
compile 'com.google.firebase:firebase-core:9.4.0'
compile 'com.google.firebase:firebase-messaging:9.4.0'
compile 'com.google.firebase:firebase-crash:9.4.0'
fullCompile 'com.google.firebase:firebase-core:9.4.0'
fullCompile 'com.android.support:appcompat-v7:24.2.0'
fullCompile 'com.google.firebase:firebase-messaging:9.4.0'
fullCompile 'com.google.firebase:firebase-crash:9.4.0'
}

apply plugin: 'com.google.gms.google-services'
17 changes: 17 additions & 0 deletions src/android/full/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.iktwo.qutelauncher">

<application>

<service android:name="com.iktwo.qutelauncher.CustomFirebaseMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>

</application>

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
</manifest>
16 changes: 16 additions & 0 deletions src/android/full/com/iktwo/qutelauncher/QuteLauncherFlavored.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.iktwo.qutelauncher;

import android.os.Bundle;

import com.google.firebase.analytics.FirebaseAnalytics;

public class QuteLauncherFlavored extends QuteLauncher {
private FirebaseAnalytics mFirebaseAnalytics;

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package com.iktwo.qutelauncher;

public class QuteLauncherFlavored extends QuteLauncher {
}
5 changes: 0 additions & 5 deletions src/android/src/com/iktwo/qutelauncher/QuteLauncher.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
import android.util.Log;
import android.view.View;

import com.google.firebase.analytics.FirebaseAnalytics;

import java.io.ByteArrayOutputStream;
import java.util.Arrays;
import java.util.List;
Expand All @@ -32,7 +30,6 @@ public class QuteLauncher extends org.qtproject.qt5.android.bindings.QtActivity
private static WallpaperManager wm;
private static int mIconDpi;
private static PackageManager mPm;
private FirebaseAnalytics mFirebaseAnalytics;

public QuteLauncher() {
m_instance = this;
Expand Down Expand Up @@ -150,8 +147,6 @@ public void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);

getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
Expand Down

0 comments on commit 484f057

Please sign in to comment.