Simplify the project setup a little bit. (#615)

* Use applicationIdSuffix instead of defining applicationId in each flavor

Signed-off-by: TacoTheDank <SkytkRSfan3895@gmail.com>

* Define DEVELOPER_MODE as a buildConfigField in gradle buildTypes

Signed-off-by: TacoTheDank <SkytkRSfan3895@gmail.com>

* Manifest: utilize "${applicationId}" for provider authority

Signed-off-by: TacoTheDank <SkytkRSfan3895@gmail.com>
fix-travis
TacoTheDank 6 years ago committed by Florens
parent 98eb525dcb
commit 5dbb361630
  1. 11
      Clover/app/build.gradle
  2. 23
      Clover/app/src/debug/java/org/floens/chan/ChanBuild.java
  3. 33
      Clover/app/src/default/AndroidManifest.xml
  4. 33
      Clover/app/src/dev/AndroidManifest.xml
  5. 33
      Clover/app/src/fdroid/AndroidManifest.xml
  6. 13
      Clover/app/src/main/AndroidManifest.xml
  7. 2
      Clover/app/src/main/java/org/floens/chan/Chan.java
  8. 2
      Clover/app/src/main/java/org/floens/chan/ChanApplication.java
  9. 4
      Clover/app/src/main/java/org/floens/chan/utils/Logger.java
  10. 23
      Clover/app/src/release/java/org/floens/chan/ChanBuild.java

@ -44,6 +44,7 @@ android {
buildToolsVersion '28.0.3'
defaultConfig {
applicationId "org.floens.chan"
minSdkVersion 15
targetSdkVersion 28
@ -70,10 +71,10 @@ android {
keyPass=pass
*/
def hash = getCommitHash();
def hash = getCommitHash()
File f = file('keys.properties')
boolean doSign = f.exists();
boolean doSign = f.exists()
if (doSign) {
Properties props = new Properties()
@ -102,7 +103,6 @@ android {
// the flavor name is appended to the name in the settings.
"default" {
dimension "default"
applicationId "org.floens.chan"
resValue "string", "app_name", "Clover"
resValue "string", "app_flavor_name", ""
buildConfigField "String", "BUILD_HASH", "\"$hash\""
@ -112,7 +112,7 @@ android {
dev {
dimension "default"
applicationId "org.floens.chan.dev"
applicationIdSuffix ".dev"
resValue "string", "app_name", "Clover dev"
resValue "string", "app_flavor_name", ""
buildConfigField "String", "BUILD_HASH", "\"$hash\""
@ -124,7 +124,6 @@ android {
fdroid {
dimension "default"
applicationId "org.floens.chan"
resValue "string", "app_name", "Clover"
resValue "string", "app_flavor_name", "F-Droid"
buildConfigField "String", "BUILD_HASH", "\"$hash\""
@ -140,11 +139,13 @@ android {
}
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard.cfg'
buildConfigField "boolean", "DEVELOPER_MODE", "false"
}
debug {
// minifyEnabled true
// proguardFiles 'proguard.cfg'
buildConfigField "boolean", "DEVELOPER_MODE", "true"
}
}
}

@ -1,23 +0,0 @@
/*
* Clover - 4chan browser https://github.com/Floens/Clover/
* Copyright (C) 2014 Floens
*
* 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 <http://www.gnu.org/licenses/>.
*/
package org.floens.chan;
// debug version
public class ChanBuild {
public static final boolean DEVELOPER_MODE = true;
}

@ -1,33 +0,0 @@
<?xml version="1.0" encoding="utf-8"?><!--
Clover - 4chan browser https://github.com/Floens/Clover/
Copyright (C) 2014 Floens
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 <http://www.gnu.org/licenses/>.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application>
<!-- Note: only difference is the authorities property -->
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="org.floens.chan.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths" />
</provider>
</application>
</manifest>

@ -1,33 +0,0 @@
<?xml version="1.0" encoding="utf-8"?><!--
Clover - 4chan browser https://github.com/Floens/Clover/
Copyright (C) 2014 Floens
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 <http://www.gnu.org/licenses/>.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application>
<!-- Note: only difference is the authorities property -->
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="org.floens.chan.dev.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths" />
</provider>
</application>
</manifest>

@ -1,33 +0,0 @@
<?xml version="1.0" encoding="utf-8"?><!--
Clover - 4chan browser https://github.com/Floens/Clover/
Copyright (C) 2014 Floens
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 <http://www.gnu.org/licenses/>.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application>
<!-- Note: only difference is the authorities property -->
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="org.floens.chan.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths" />
</provider>
</application>
</manifest>

@ -96,8 +96,17 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</receiver>
<!-- providers are defined in the flavor specific directories -->
<!-- see src/<flavorname>/AndroidManifest.xml -->
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="${applicationId}.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths" />
</provider>
</application>

@ -107,7 +107,7 @@ public class Chan extends Application implements UserAgentProvider, Application.
Time.endTiming("Initializing application", startTime);
// Start watching for slow disk reads and writes after the heavy initializing is done
if (ChanBuild.DEVELOPER_MODE) {
if (BuildConfig.DEVELOPER_MODE) {
StrictMode.setThreadPolicy(
new StrictMode.ThreadPolicy.Builder()
.detectCustomSlowCalls()

@ -33,7 +33,7 @@ public class ChanApplication extends Chan {
initialize();
if (!ChanBuild.DEVELOPER_MODE && ChanSettings.isCrashReportingEnabled()) {
if (!BuildConfig.DEVELOPER_MODE && ChanSettings.isCrashReportingEnabled()) {
Sentry.init(
BuildConfig.CRASH_REPORT_TOKEN +
"?release=" + BuildConfig.VERSION_NAME +

@ -19,14 +19,14 @@ package org.floens.chan.utils;
import android.util.Log;
import org.floens.chan.ChanBuild;
import org.floens.chan.BuildConfig;
public class Logger {
private static final String TAG = "Clover";
private static final String TAG_SPACER = " | ";
public static boolean debugEnabled() {
return ChanBuild.DEVELOPER_MODE;
return BuildConfig.DEVELOPER_MODE;
}
public static void v(String tag, String message) {

@ -1,23 +0,0 @@
/*
* Clover - 4chan browser https://github.com/Floens/Clover/
* Copyright (C) 2014 Floens
*
* 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 <http://www.gnu.org/licenses/>.
*/
package org.floens.chan;
// release version
public class ChanBuild {
public static final boolean DEVELOPER_MODE = false;
}
Loading…
Cancel
Save