Skip to content

Commit 74ee9fb

Browse files
committed
v0.19 - Updated Deployment UI
1 parent e90396f commit 74ee9fb

File tree

5 files changed

+27
-8
lines changed

5 files changed

+27
-8
lines changed

app/app.iml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@
8787
<orderEntry type="jdk" jdkName="Android API 23 Platform" jdkType="Android SDK" />
8888
<orderEntry type="sourceFolder" forTests="false" />
8989
<orderEntry type="library" exported="" name="library-2.4.0" level="project" />
90-
<orderEntry type="library" exported="" name="okhttp-urlconnection-2.4.0" level="project" />
9190
<orderEntry type="library" exported="" name="guava-18.0" level="project" />
91+
<orderEntry type="library" exported="" name="okhttp-urlconnection-2.4.0" level="project" />
9292
<orderEntry type="library" exported="" name="cardview-v7-23.1.1" level="project" />
9393
<orderEntry type="library" exported="" name="okhttp-2.4.0" level="project" />
9494
<orderEntry type="library" exported="" name="design-23.1.1" level="project" />

app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ android {
1212
applicationId "org.redcross.openmapkit"
1313
minSdkVersion 16
1414
targetSdkVersion 21
15-
versionCode 18
16-
versionName "0.18"
15+
versionCode 19
16+
versionName "0.19"
1717
}
1818
buildTypes {
1919
release {

app/src/main/java/org/redcross/openmapkit/deployments/Deployment.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,25 @@ public JSONObject json() {
2727
return json;
2828
}
2929

30+
/**
31+
* Returns the title of the deployment. If the title
32+
* is not available, return the name instead.
33+
*
34+
* @return - title or name
35+
*/
36+
public String title() {
37+
String title = null;
38+
JSONObject manifest = json.optJSONObject("manifest");
39+
if (manifest != null) {
40+
title = manifest.optString("title");
41+
}
42+
if (title != null && title.length() > 0) {
43+
return title;
44+
} else {
45+
return json.optString("name");
46+
}
47+
}
48+
3049
public int osmCount() {
3150
JSONObject files = json.optJSONObject("files");
3251
if (files == null) return 0;

app/src/main/java/org/redcross/openmapkit/deployments/DeploymentDetailsActivity.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ protected void onCreate(Bundle savedInstanceState) {
4747
int position = getIntent().getIntExtra("POSITION", 0);
4848
deployment = Deployments.singleton().get(position);
4949

50-
String name = deployment.json().optString("name");
50+
String title = deployment.title();
5151
TextView nameTextView = (TextView)findViewById(R.id.nameTextView);
52-
nameTextView.setText(name);
52+
nameTextView.setText(title);
5353

5454
JSONObject manifest = deployment.json().optJSONObject("manifest");
5555
if (manifest != null) {

app/src/main/java/org/redcross/openmapkit/deployments/DeploymentsRecyclerAdapter.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ public DeploymentsViewHolder onCreateViewHolder(ViewGroup parent, int viewType)
2727
@Override
2828
public void onBindViewHolder(DeploymentsViewHolder holder, int position) {
2929
Deployment deployment = Deployments.singleton().get(position);
30-
String name = deployment.json().optString("name");
31-
if (name == null) return;
32-
holder.nameTextView.setText(name);
30+
String title = deployment.title();
31+
if (title == null) return;
32+
holder.nameTextView.setText(title);
3333
JSONObject manifest = deployment.json().optJSONObject("manifest");
3434
if (manifest == null) return;
3535
String description = manifest.optString("description");

0 commit comments

Comments
 (0)