From 0e118da02f4f0466769983357619d272e7b8d746 Mon Sep 17 00:00:00 2001 From: Victor Häggqvist Date: Fri, 24 Jul 2015 22:35:56 +0200 Subject: feat: expose method to get only version string --- aboutit/src/main/java/com/snilius/aboutit/AboutIt.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/aboutit/src/main/java/com/snilius/aboutit/AboutIt.java b/aboutit/src/main/java/com/snilius/aboutit/AboutIt.java index 7d52191..c07ce05 100644 --- a/aboutit/src/main/java/com/snilius/aboutit/AboutIt.java +++ b/aboutit/src/main/java/com/snilius/aboutit/AboutIt.java @@ -60,12 +60,11 @@ public class AboutIt { TextView out = (TextView) activity.findViewById(about_text); out.setAutoLinkMask(Linkify.WEB_URLS); - releaseName = "-"+(releaseName != null?releaseName:(debug?"debug":"")); endYear = endYear(); StringBuilder sb = new StringBuilder(); if (appName != null) - sb.append(appName+" v"+versionName+" ("+versionCode+releaseName+")\n"); + sb.append(appName+" v"+getVersionString()+"\n"); if (copyright != null) { sb.append("Copyright (c) "); @@ -92,6 +91,17 @@ public class AboutIt { out.setText(sb.toString()); } + /** + * Get a baked version string. + * Version string is build from build info and release name + * It will look something like '1.42 (42-debug)' + * @return baked version string + */ + public String getVersionString() { + releaseName = "-"+(releaseName != null?releaseName:(debug?"debug":"")); + return versionName+" ("+versionCode+releaseName+")"; + } + /** * Demiter what endyear to show * @return year to show -- cgit v1.2.3