Skip to content

Commit

Permalink
v0.19 - Updated Deployment UI
Browse files Browse the repository at this point in the history
  • Loading branch information
hallahan committed Mar 9, 2016
1 parent e90396f commit 74ee9fb
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 8 deletions.
2 changes: 1 addition & 1 deletion app/app.iml
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@
<orderEntry type="jdk" jdkName="Android API 23 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="library-2.4.0" level="project" />
<orderEntry type="library" exported="" name="okhttp-urlconnection-2.4.0" level="project" />
<orderEntry type="library" exported="" name="guava-18.0" level="project" />
<orderEntry type="library" exported="" name="okhttp-urlconnection-2.4.0" level="project" />
<orderEntry type="library" exported="" name="cardview-v7-23.1.1" level="project" />
<orderEntry type="library" exported="" name="okhttp-2.4.0" level="project" />
<orderEntry type="library" exported="" name="design-23.1.1" level="project" />
Expand Down
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ android {
applicationId "org.redcross.openmapkit"
minSdkVersion 16
targetSdkVersion 21
versionCode 18
versionName "0.18"
versionCode 19
versionName "0.19"
}
buildTypes {
release {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,25 @@ public JSONObject json() {
return json;
}

/**
* Returns the title of the deployment. If the title
* is not available, return the name instead.
*
* @return - title or name
*/
public String title() {
String title = null;
JSONObject manifest = json.optJSONObject("manifest");
if (manifest != null) {
title = manifest.optString("title");
}
if (title != null && title.length() > 0) {
return title;
} else {
return json.optString("name");
}
}

public int osmCount() {
JSONObject files = json.optJSONObject("files");
if (files == null) return 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ protected void onCreate(Bundle savedInstanceState) {
int position = getIntent().getIntExtra("POSITION", 0);
deployment = Deployments.singleton().get(position);

String name = deployment.json().optString("name");
String title = deployment.title();
TextView nameTextView = (TextView)findViewById(R.id.nameTextView);
nameTextView.setText(name);
nameTextView.setText(title);

JSONObject manifest = deployment.json().optJSONObject("manifest");
if (manifest != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ public DeploymentsViewHolder onCreateViewHolder(ViewGroup parent, int viewType)
@Override
public void onBindViewHolder(DeploymentsViewHolder holder, int position) {
Deployment deployment = Deployments.singleton().get(position);
String name = deployment.json().optString("name");
if (name == null) return;
holder.nameTextView.setText(name);
String title = deployment.title();
if (title == null) return;
holder.nameTextView.setText(title);
JSONObject manifest = deployment.json().optJSONObject("manifest");
if (manifest == null) return;
String description = manifest.optString("description");
Expand Down

0 comments on commit 74ee9fb

Please sign in to comment.