forked from upstream-mirrors/quik
Merge pull request #174 from Allsimon/remove-nonfree-libs
Create a free flavor for F-Droid
This commit is contained in:
+17
-3
@@ -5,6 +5,21 @@ repositories {
|
|||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
|
flavorDimensions "analytics"
|
||||||
|
|
||||||
|
productFlavors {
|
||||||
|
withAnalytics {
|
||||||
|
dimension "analytics"
|
||||||
|
}
|
||||||
|
noAnalytics {
|
||||||
|
dimension "analytics"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
lintOptions {
|
||||||
|
checkReleaseBuilds false
|
||||||
|
abortOnError false
|
||||||
|
}
|
||||||
|
|
||||||
compileSdkVersion 22
|
compileSdkVersion 22
|
||||||
buildToolsVersion '23.0.0'
|
buildToolsVersion '23.0.0'
|
||||||
@@ -64,8 +79,7 @@ dependencies {
|
|||||||
compile 'com.android.support:appcompat-v7:22.2.1'
|
compile 'com.android.support:appcompat-v7:22.2.1'
|
||||||
compile 'com.android.support:support-v13:22.2.1'
|
compile 'com.android.support:support-v13:22.2.1'
|
||||||
compile 'com.android.support:recyclerview-v7:22.2.1'
|
compile 'com.android.support:recyclerview-v7:22.2.1'
|
||||||
compile 'com.google.android.gms:play-services-analytics:7.5.0'
|
withAnalyticsCompile 'com.google.android.gms:play-services-analytics:7.5.0'
|
||||||
|
|
||||||
// External services
|
// External services
|
||||||
compile 'com.crittercism:crittercism-android-agent:5.0.3'
|
withAnalyticsCompile 'com.crittercism:crittercism-android-agent:5.0.3'
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-7
@@ -31,7 +31,6 @@ import android.util.Log;
|
|||||||
import com.android.mms.transaction.MmsSystemEventReceiver;
|
import com.android.mms.transaction.MmsSystemEventReceiver;
|
||||||
import com.android.mms.util.DownloadManager;
|
import com.android.mms.util.DownloadManager;
|
||||||
import com.android.mms.util.RateController;
|
import com.android.mms.util.RateController;
|
||||||
import com.crittercism.app.Crittercism;
|
|
||||||
import com.moez.QKSMS.common.AnalyticsManager;
|
import com.moez.QKSMS.common.AnalyticsManager;
|
||||||
import com.moez.QKSMS.common.LiveViewManager;
|
import com.moez.QKSMS.common.LiveViewManager;
|
||||||
import com.moez.QKSMS.common.google.DraftCache;
|
import com.moez.QKSMS.common.google.DraftCache;
|
||||||
@@ -46,13 +45,13 @@ import com.squareup.leakcanary.RefWatcher;
|
|||||||
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
public class QKSMSApp extends Application {
|
public class QKSMSAppBase extends Application {
|
||||||
public static final String LOG_TAG = "Mms";
|
public static final String LOG_TAG = "Mms";
|
||||||
|
|
||||||
private SearchRecentSuggestions mRecentSuggestions;
|
private SearchRecentSuggestions mRecentSuggestions;
|
||||||
private TelephonyManager mTelephonyManager;
|
private TelephonyManager mTelephonyManager;
|
||||||
private String mCountryIso;
|
private String mCountryIso;
|
||||||
private static QKSMSApp sQKSMSApp = null;
|
private static QKSMSAppBase sQKSMSApp = null;
|
||||||
private PduLoaderManager mPduLoaderManager;
|
private PduLoaderManager mPduLoaderManager;
|
||||||
private ThumbnailManager mThumbnailManager;
|
private ThumbnailManager mThumbnailManager;
|
||||||
private DrmManagerClient mDrmManagerClient;
|
private DrmManagerClient mDrmManagerClient;
|
||||||
@@ -77,7 +76,6 @@ public class QKSMSApp extends Application {
|
|||||||
// Initialize analytics, leakcanary, and crittercism
|
// Initialize analytics, leakcanary, and crittercism
|
||||||
AnalyticsManager.getInstance().init(this);
|
AnalyticsManager.getInstance().init(this);
|
||||||
refWatcher = LeakCanary.install(this);
|
refWatcher = LeakCanary.install(this);
|
||||||
Crittercism.initialize(getApplicationContext(), getString(R.string.crtsm_key));
|
|
||||||
|
|
||||||
// Figure out the country *before* loading contacts and formatting numbers
|
// Figure out the country *before* loading contacts and formatting numbers
|
||||||
Country country = new Country(Locale.getDefault().getCountry(), Country.COUNTRY_SOURCE_LOCALE);
|
Country country = new Country(Locale.getDefault().getCountry(), Country.COUNTRY_SOURCE_LOCALE);
|
||||||
@@ -102,7 +100,7 @@ public class QKSMSApp extends Application {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static RefWatcher getRefWatcher(Context context) {
|
public static RefWatcher getRefWatcher(Context context) {
|
||||||
QKSMSApp application = (QKSMSApp) context.getApplicationContext();
|
QKSMSAppBase application = (QKSMSAppBase) context.getApplicationContext();
|
||||||
return application.refWatcher;
|
return application.refWatcher;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,7 +122,7 @@ public class QKSMSApp extends Application {
|
|||||||
//sendBroadcast(new Intent(SmsReceiverService.ACTION_SEND_INACTIVE_MESSAGE, null, this, SmsReceiver.class));
|
//sendBroadcast(new Intent(SmsReceiverService.ACTION_SEND_INACTIVE_MESSAGE, null, this, SmsReceiver.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
synchronized public static QKSMSApp getApplication() {
|
synchronized public static QKSMSAppBase getApplication() {
|
||||||
return sQKSMSApp;
|
return sQKSMSApp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -155,7 +153,7 @@ public class QKSMSApp extends Application {
|
|||||||
*/
|
*/
|
||||||
public TelephonyManager getTelephonyManager() {
|
public TelephonyManager getTelephonyManager() {
|
||||||
if (mTelephonyManager == null) {
|
if (mTelephonyManager == null) {
|
||||||
mTelephonyManager = (TelephonyManager)getApplicationContext()
|
mTelephonyManager = (TelephonyManager) getApplicationContext()
|
||||||
.getSystemService(Context.TELEPHONY_SERVICE);
|
.getSystemService(Context.TELEPHONY_SERVICE);
|
||||||
}
|
}
|
||||||
return mTelephonyManager;
|
return mTelephonyManager;
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package com.moez.QKSMS.common;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
interface AnalyticsManagerBase {
|
||||||
|
String TAG = "AnalyticsManager";
|
||||||
|
boolean LOCAL_LOGV = false;
|
||||||
|
String CATEGORY_MESSAGES = "messages";
|
||||||
|
// Note: For preferences events, the action will just be the preference value.
|
||||||
|
String CATEGORY_PREFERENCE_CHANGE = "preference_change";
|
||||||
|
String CATEGORY_PREFERENCE_CLICK = "preference_click";
|
||||||
|
String CATEGORY_REPORT = "report";
|
||||||
|
String ACTION_SEND_MESSAGE = "send_message";
|
||||||
|
String ACTION_ATTACH_IMAGE = "attach_image";
|
||||||
|
String ACTION_ATTACH_FROM_CAMERA = "attach_from_camera";
|
||||||
|
|
||||||
|
void init(Context context);
|
||||||
|
|
||||||
|
void sendEvent(String category, String action, String label);
|
||||||
|
|
||||||
|
void sendEvent(String category, String action, String label, long value);
|
||||||
|
}
|
||||||
@@ -22,6 +22,7 @@ import android.util.Log;
|
|||||||
|
|
||||||
import com.android.mms.transaction.MmsMessageSender;
|
import com.android.mms.transaction.MmsMessageSender;
|
||||||
import com.google.android.mms.pdu_alt.PduHeaders;
|
import com.google.android.mms.pdu_alt.PduHeaders;
|
||||||
|
import com.moez.QKSMS.QKSMSAppBase;
|
||||||
import com.moez.QKSMS.mmssms.Utils;
|
import com.moez.QKSMS.mmssms.Utils;
|
||||||
import com.moez.QKSMS.LogTag;
|
import com.moez.QKSMS.LogTag;
|
||||||
import com.moez.QKSMS.QKSMSApp;
|
import com.moez.QKSMS.QKSMSApp;
|
||||||
@@ -802,7 +803,7 @@ public class Conversation {
|
|||||||
sDeletingThreads = true;
|
sDeletingThreads = true;
|
||||||
String selection = deleteAll ? null : "locked=0";
|
String selection = deleteAll ? null : "locked=0";
|
||||||
|
|
||||||
QKSMSApp app = QKSMSApp.getApplication();
|
QKSMSAppBase app = QKSMSApp.getApplication();
|
||||||
//app.getPduLoaderManager().clear();
|
//app.getPduLoaderManager().clear();
|
||||||
//app.getThumbnailManager().clear();
|
//app.getThumbnailManager().clear();
|
||||||
|
|
||||||
|
|||||||
@@ -624,7 +624,7 @@ public class ThemeManager {
|
|||||||
|
|
||||||
public static void setColour(int color) {
|
public static void setColour(int color) {
|
||||||
|
|
||||||
AnalyticsManager.INSTANCE.sendEvent(
|
AnalyticsManager.getInstance().sendEvent(
|
||||||
AnalyticsManager.CATEGORY_PREFERENCE_CHANGE,
|
AnalyticsManager.CATEGORY_PREFERENCE_CHANGE,
|
||||||
SettingsFragment.CATEGORY_THEME,
|
SettingsFragment.CATEGORY_THEME,
|
||||||
getColorString(color)
|
getColorString(color)
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
package com.moez.QKSMS;
|
||||||
|
|
||||||
|
public class QKSMSApp extends QKSMSAppBase {
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package com.moez.QKSMS.common;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
public class AnalyticsManager implements AnalyticsManagerBase {
|
||||||
|
private AnalyticsManager() {
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class AnalyticsManagerHolder {
|
||||||
|
private final static AnalyticsManager INSTANCE = new AnalyticsManager();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static AnalyticsManager getInstance() {
|
||||||
|
return AnalyticsManagerHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(Context context) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sendEvent(String category, String action, String label) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sendEvent(String category, String action, String label, long value) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package com.moez.QKSMS;
|
||||||
|
|
||||||
|
import com.crittercism.app.Crittercism;
|
||||||
|
|
||||||
|
public class QKSMSApp extends QKSMSAppBase {
|
||||||
|
@Override
|
||||||
|
public void onCreate() {
|
||||||
|
super.onCreate();
|
||||||
|
Crittercism.initialize(getApplicationContext(), getString(R.string.crtsm_key));
|
||||||
|
}
|
||||||
|
}
|
||||||
+14
-26
@@ -2,40 +2,28 @@ package com.moez.QKSMS.common;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import com.google.android.gms.analytics.GoogleAnalytics;
|
import com.google.android.gms.analytics.GoogleAnalytics;
|
||||||
import com.google.android.gms.analytics.HitBuilders;
|
import com.google.android.gms.analytics.HitBuilders;
|
||||||
import com.google.android.gms.analytics.Tracker;
|
import com.google.android.gms.analytics.Tracker;
|
||||||
import com.moez.QKSMS.R;
|
import com.moez.QKSMS.R;
|
||||||
|
|
||||||
public enum AnalyticsManager {
|
public class AnalyticsManager implements AnalyticsManagerBase {
|
||||||
INSTANCE;
|
private AnalyticsManager() {
|
||||||
|
}
|
||||||
|
|
||||||
private final static String TAG = "AnalyticsManager";
|
private static class AnalyticsManagerHolder {
|
||||||
private final static boolean LOCAL_LOGV = false;
|
private final static AnalyticsManager INSTANCE = new AnalyticsManager();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
public static AnalyticsManager getInstance() {
|
||||||
* Event categories
|
return AnalyticsManagerHolder.INSTANCE;
|
||||||
*/
|
}
|
||||||
public final static String CATEGORY_MESSAGES = "messages";
|
|
||||||
// Note: For preferences events, the action will just be the preference value.
|
|
||||||
public final static String CATEGORY_PREFERENCE_CHANGE = "preference_change";
|
|
||||||
public final static String CATEGORY_PREFERENCE_CLICK = "preference_click";
|
|
||||||
public final static String CATEGORY_REPORT = "report";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Event actions
|
|
||||||
*/
|
|
||||||
public final static String ACTION_SEND_MESSAGE = "send_message";
|
|
||||||
public final static String ACTION_ATTACH_IMAGE = "attach_image";
|
|
||||||
public final static String ACTION_ATTACH_FROM_CAMERA = "attach_from_camera";
|
|
||||||
|
|
||||||
private boolean mNeedsInit = true;
|
private boolean mNeedsInit = true;
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
private Tracker mTracker;
|
private Tracker mTracker;
|
||||||
|
|
||||||
public static AnalyticsManager getInstance() {
|
|
||||||
return INSTANCE;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void init(Context context) {
|
public void init(Context context) {
|
||||||
if (LOCAL_LOGV) Log.v(TAG, "init called. mNeedsInit: " + mNeedsInit);
|
if (LOCAL_LOGV) Log.v(TAG, "init called. mNeedsInit: " + mNeedsInit);
|
||||||
@@ -56,8 +44,8 @@ public enum AnalyticsManager {
|
|||||||
|
|
||||||
HitBuilders.EventBuilder b = new HitBuilders.EventBuilder();
|
HitBuilders.EventBuilder b = new HitBuilders.EventBuilder();
|
||||||
if (category != null) b.setCategory(category);
|
if (category != null) b.setCategory(category);
|
||||||
if (action != null) b.setAction(action);
|
if (action != null) b.setAction(action);
|
||||||
if (label != null) b.setLabel(label);
|
if (label != null) b.setLabel(label);
|
||||||
|
|
||||||
mTracker.send(b.build());
|
mTracker.send(b.build());
|
||||||
}
|
}
|
||||||
@@ -68,8 +56,8 @@ public enum AnalyticsManager {
|
|||||||
|
|
||||||
HitBuilders.EventBuilder b = new HitBuilders.EventBuilder();
|
HitBuilders.EventBuilder b = new HitBuilders.EventBuilder();
|
||||||
if (category != null) b.setCategory(category);
|
if (category != null) b.setCategory(category);
|
||||||
if (action != null) b.setAction(action);
|
if (action != null) b.setAction(action);
|
||||||
if (label != null) b.setLabel(label);
|
if (label != null) b.setLabel(label);
|
||||||
b.setValue(value);
|
b.setValue(value);
|
||||||
|
|
||||||
mTracker.send(b.build());
|
mTracker.send(b.build());
|
||||||
Reference in New Issue
Block a user