Merge pull request #345 from AdrianLxM/wear-versionnumber-settings
Version-Number in settings
This commit is contained in:
commit
cfe51757a1
|
@ -1,5 +1,25 @@
|
||||||
apply plugin: 'com.android.application'
|
apply plugin: 'com.android.application'
|
||||||
|
|
||||||
|
def generateGitBuild = { ->
|
||||||
|
|
||||||
|
StringBuilder stringBuilder = new StringBuilder();
|
||||||
|
stringBuilder.append('"')
|
||||||
|
try {
|
||||||
|
def stdout = new ByteArrayOutputStream()
|
||||||
|
exec {
|
||||||
|
commandLine 'git', 'describe', '--always'
|
||||||
|
standardOutput = stdout
|
||||||
|
}
|
||||||
|
String commitObject = stdout.toString().trim()
|
||||||
|
stringBuilder.append(commitObject)
|
||||||
|
} catch (ignored) {
|
||||||
|
stringBuilder.append('NoGitSystemAvailable')
|
||||||
|
}
|
||||||
|
stringBuilder.append('-')
|
||||||
|
stringBuilder.append((new Date()).format('yyyy.MM.dd'))
|
||||||
|
stringBuilder.append('"')
|
||||||
|
return stringBuilder.toString()
|
||||||
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 23
|
compileSdkVersion 23
|
||||||
|
@ -11,6 +31,7 @@ android {
|
||||||
targetSdkVersion 23
|
targetSdkVersion 23
|
||||||
versionCode 1
|
versionCode 1
|
||||||
versionName "1.0.2"
|
versionName "1.0.2"
|
||||||
|
buildConfigField "String", "BUILDVERSION", generateGitBuild()
|
||||||
}
|
}
|
||||||
buildTypes {
|
buildTypes {
|
||||||
release {
|
release {
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
package info.nightscout.androidaps.interaction.utils;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
import android.preference.PreferenceManager;
|
||||||
|
import android.support.annotation.NonNull;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import info.nightscout.androidaps.BuildConfig;
|
||||||
|
import preference.WearListPreference;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by adrian on 07/08/17.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class VersionPreference extends WearListPreference {
|
||||||
|
public VersionPreference(Context context, AttributeSet attrs) {
|
||||||
|
super(context, attrs);
|
||||||
|
entries = new CharSequence[]{BuildConfig.BUILDVERSION};
|
||||||
|
entryValues = new CharSequence[]{BuildConfig.BUILDVERSION};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override public CharSequence getSummary(@NonNull final Context context) {
|
||||||
|
return BuildConfig.BUILDVERSION;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void onPreferenceClick(@NonNull Context context) {
|
||||||
|
Toast.makeText(context, "Build version:" + BuildConfig.BUILDVERSION, Toast.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
|
}
|
|
@ -149,4 +149,11 @@
|
||||||
android:title="Wizard Percentage"
|
android:title="Wizard Percentage"
|
||||||
app:wear_iconOff="@drawable/settings_off"
|
app:wear_iconOff="@drawable/settings_off"
|
||||||
app:wear_iconOn="@drawable/settings_on"/>
|
app:wear_iconOn="@drawable/settings_on"/>
|
||||||
|
<info.nightscout.androidaps.interaction.utils.VersionPreference
|
||||||
|
android:defaultValue="1"
|
||||||
|
android:entries="@array/input_design"
|
||||||
|
android:entryValues="@array/input_design_values"
|
||||||
|
android:key="version_number"
|
||||||
|
android:summary="Input Design"
|
||||||
|
android:title="Version:" />
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
|
|
Loading…
Reference in a new issue