Skip to content

Commit

Permalink
productFlavorにrcとdevを用意してパッケージ名をきりかえられるようにした。Playストア用の画像リソースを用意した。
Browse files Browse the repository at this point in the history
  • Loading branch information
Yoshihiro Oyama committed Mar 4, 2017
1 parent 0e48c72 commit 5783fe1
Show file tree
Hide file tree
Showing 15 changed files with 81 additions and 16 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@
/build
/captures
.externalNativeBuild
.apk

27 changes: 27 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,33 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

productFlavors {
dev {
applicationId "jp.juggler.fadownloader.dev"
}
rc {
applicationId "jp.juggler.fadownloader"
}
}


// Generate Signed APK のファイル名を変更
applicationVariants.all { variant ->
if (variant.buildType.name.equals("release")) {
variant.outputs.each { output ->
if (output.outputFile != null && output.outputFile.name.endsWith('.apk')) {
// Rename APK
def versionCode = defaultConfig.versionCode
def versionName = defaultConfig.versionName
def flavor = variant.flavorName
def date = new java.text.SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date())
def newName = "jp.juggler.fadownloader-${versionCode}-${versionName}-${date}-${flavor}.apk"
output.outputFile = new File((String) output.outputFile.parent, (String) newName)
}
}
}
}
}

dependencies {
Expand Down
11 changes: 11 additions & 0 deletions app/src/dev/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<application android:name="jp.juggler.fadownloader.App1">
<provider
android:name="jp.juggler.fadownloader.DataProvider"
android:authorities="jp.juggler.fadownloader.data.dev"
android:exported="false"
/>
</application>
</manifest>
6 changes: 6 additions & 0 deletions app/src/dev/java/config/BuildVariant.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package config;

public class BuildVariant{
public static final String DATA_PROVIDER_AUTHORITY="jp.juggler.fadownloader.data.dev";
}

3 changes: 3 additions & 0 deletions app/src/dev/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<resources>
<string name="app_name" translatable="false">(dev)FA Downloader</string>
</resources>
19 changes: 7 additions & 12 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="jp.juggler.fadownloader"
xmlns:android="http://schemas.android.com/apk/res/android"
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="jp.juggler.fadownloader"
>

<uses-permission android:name="android.permission.INTERNET"/>
Expand All @@ -11,27 +12,21 @@
<uses-permission android:name="android.permission.WAKE_LOCK"/>

<application
android:name=".App1"
android:name="jp.juggler.fadownloader.App1"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme"
>

<provider
android:name=".DataProvider"
android:authorities="jp.juggler.fadownloader.data"
android:exported="false"
/>

<service
android:name=".DownloadService"
android:name="jp.juggler.fadownloader.DownloadService"
android:exported="false"
/>

<receiver
android:name=".Receiver1"
android:name="jp.juggler.fadownloader.Receiver1"
android:exported="true"
>
<intent-filter>
Expand All @@ -41,7 +36,7 @@


<activity
android:name=".ActMain"
android:name="jp.juggler.fadownloader.ActMain"
android:icon="@drawable/ic_launcher"
android:launchMode="singleTask"
android:windowSoftInputMode="stateAlwaysHidden"
Expand Down
4 changes: 3 additions & 1 deletion app/src/main/java/jp/juggler/fadownloader/DataProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;

import config.BuildVariant;

public class DataProvider extends ContentProvider{

static final String AUTHORITY = "jp.juggler.fadownloader.data";
static final String AUTHORITY = BuildVariant.DATA_PROVIDER_AUTHORITY;

static final String DB_NAME = "data";
static final int DB_SCHEMA_VERSION = 1;
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-ja/strings.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<resources>
<string name="app_name">FA Downloader</string>
<string name="flashair_url">FlashAir URL</string>
<string name="local_folder">Local Folder</string>
<string name="repeat_interval">Repeat Interval</string>
Expand Down Expand Up @@ -78,4 +77,5 @@
<string name="progress_file">ファイル確認中 %s</string>
<string name="download_file">ファイル取得中 %s</string>
<string name="thread_end">スレッド終了</string>
<string name="flashair_update_status_error">FlashAir更新ステータスのデータエラー</string>
</resources>
3 changes: 1 addition & 2 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<resources>
<string name="app_name">FA Downloader</string>
<string name="flashair_url">FlashAir URL</string>
<string name="local_folder">Local Folder</string>
<string name="repeat_interval">Repeat Interval</string>
Expand Down Expand Up @@ -78,5 +77,5 @@
<string name="progress_file">FILE %s</string>
<string name="download_file">DOWNLOADING: %s</string>
<string name="thread_end">thread stopped</string>
<string name="flashair_update_status_error">parse error. (FlashAir update status)</string>
<string name="flashair_update_status_error">FlashAir update status data error</string>
</resources>
11 changes: 11 additions & 0 deletions app/src/rc/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<application android:name="jp.juggler.fadownloader.App1">
<provider
android:name="jp.juggler.fadownloader.DataProvider"
android:authorities="jp.juggler.fadownloader.data"
android:exported="false"
/>
</application>
</manifest>
6 changes: 6 additions & 0 deletions app/src/rc/java/config/BuildVariant.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package config;

public class BuildVariant{
public static final String DATA_PROVIDER_AUTHORITY="jp.juggler.fadownloader.data";
}

3 changes: 3 additions & 0 deletions app/src/rc/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<resources>
<string name="app_name" translatable="false">FA Downloader</string>
</resources>
Binary file added ic_launcher-512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added play-store-bg.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added play-store-promo.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 5783fe1

Please sign in to comment.