Skip to content

Commit

Permalink
improve about demo, ignore unknown resources
Browse files Browse the repository at this point in the history
  • Loading branch information
friedger committed Dec 12, 2017
1 parent a00e928 commit 6499d69
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 17 deletions.
8 changes: 5 additions & 3 deletions DistributionDemoAbout/src/main/res/xml/about.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
<about xmlns:oi="http://schemas.openintents.org/android/about">
<oi:comments oi:resource="@string/about_comments" />
<oi:copyright oi:resource="@string/about_copyright" />
<oi:website-url oi:resource="@string/about_website_url" />
<oi:license oi:resource="@raw/oi_distribution_license_short" />
<oi:email oi:value="[email protected]"/>
<!-- these options are available as well
<oi:authors oi:resource="@array/about_authors" />
<oi:documenters oi:resource="@array/about_documenters" />
<oi:translators oi:resource="@array/about_translators" />
<oi:artists oi:resource="@array/about_artists" />
<oi:website-url oi:resource="@string/about_website_url" />
<oi:license oi:resource="@raw/oi_distribution_license_short" />
<oi:email oi:value="[email protected]"/>
-->
</about>
2 changes: 1 addition & 1 deletion DistributionLibrary/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apply plugin: 'com.android.library'

group = 'org.openintents'
version = '2.1.0'
version = '2.1.1'

android {
compileSdkVersion rootProject.ext.compileSdkVersion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,11 @@ public static String[] getStringArrayExtraOrMetadata(final MetaDataReader metaDa
String[] array = null;
try {
int id = md.getInt(metadata);
Resources resources = context.getPackageManager()
.getResourcesForApplication(packagename);
array = resources.getStringArray(id);
if (id != 0) {
Resources resources = context.getPackageManager()
.getResourcesForApplication(packagename);
array = resources.getStringArray(id);
}
} catch (NameNotFoundException e) {
Log.e(TAG, "Package name not found ", e);
} catch (NumberFormatException e) {
Expand All @@ -60,11 +62,7 @@ public static String[] getStringArrayExtraOrMetadata(final MetaDataReader metaDa
Log.e(TAG, "Resource not found.", e);
}

if (array != null) {
return array;
} else {
return null;
}
return array;
} else {
return null;
}
Expand Down Expand Up @@ -99,11 +97,13 @@ public static String getStringExtraOrMetadata(final MetaDataReader metaDataReade
//Still try metadata but don't expect a ready string (get it from the resources).
try {
int id = md.getInt(metadata);
Resources resources = context.getPackageManager()
.getResourcesForApplication(packagename);
String text = resources.getString(id);
if (!TextUtils.isEmpty(text)) {
return text;
if (id != 0) {
Resources resources = context.getPackageManager()
.getResourcesForApplication(packagename);
String text = resources.getString(id);
if (!TextUtils.isEmpty(text)) {
return text;
}
}
} catch (NameNotFoundException e) {
Log.e(TAG, "Package name not found ", e);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
---------------------------------------------------------
release: 2.1.1
date: 2017-12-12
- improve About demo
- ignore unknown resources

---------------------------------------------------------
release: 2.1.0
date: 2017-12-12
- hide market link for OI About app

---------------------------------------------------------
release: 2.0.0
date: 2017-11-18
Expand Down

0 comments on commit 6499d69

Please sign in to comment.