Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Cleaned up the user interface

  • Loading branch information...
commit 26b420fa1a38c0e79b52ea320d9adee0e874d184 1 parent 5b021bc
@kalharbi kalharbi authored
View
2  AndroidManifest.xml
@@ -6,7 +6,7 @@
android:versionName="1.0">
<uses-sdk
- android:minSdkVersion="8"
+ android:minSdkVersion="7"
android:targetSdkVersion="10" />
<uses-permission android:name="android.permission.INTERNET" />
View
77 res/layout/citydetails.xml
@@ -3,92 +3,53 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
- android:orientation="vertical">
+ android:orientation="vertical"
+ android:background="#FFFFFF">
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
- android:orientation="horizontal">
+ android:orientation="horizontal"
+ android:background="#0063DC">
<ImageView
android:id="@+id/flickrcity_image"
android:src="@drawable/flickrcity_launcher_32"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:contentDescription="FlickrCity" />
- <TextView
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/textviewtitle"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/app_name"
- android:textSize="25dp" />
- </LinearLayout>
+ android:contentDescription="@string/app_name" />
<TextView
android:id="@+id/textviewcityname"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:textSize="20dp" />
-
- <LinearLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:orientation="horizontal">
- <TextView
- android:id="@+id/textviewlat"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/cd_latitude"
- android:textSize="18dp" />
- <TextView
- android:id="@+id/textviewlatVal"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textSize="18dp" />
- </LinearLayout>
-
- <LinearLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="fill_parent"
+ android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:orientation="horizontal">
- <TextView
- android:id="@+id/textviewlng"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/cd_longitude"
- android:textSize="18dp" />
- <TextView
- android:id="@+id/textviewlngVal"
+ android:textSize="20dp"
+ android:textColor="#FFFFFF"/>
+ <TextView
+ android:id="@+id/text_view_lat_lon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:textSize="18dp" />
+ android:textSize="12dp"
+ android:textColor="#FFFFFF" />
</LinearLayout>
-
- <Button
+ <Button
android:id="@+id/view_flickr_pictures"
- android:layout_width="wrap_content"
+ android:layout_width="fill_parent"
android:layout_height="wrap_content"
- android:text="@string/cd_view_photos" />
+ android:text="@string/cd_view_photos"
+ android:background="#FF0084"
+ android:textColor="#FFFFFF"
+ android:textSize="15dp"/>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
-
- <ProgressBar
- android:id="@+id/progress_par"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- style="?android:attr/progressBarStyleHorizontal"
- android:layout_marginRight="5dp" />
</LinearLayout>
<GridView
android:id="@+id/picture_grid_view"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
- android:columnWidth="100dp"
+ android:columnWidth="80dp"
android:numColumns="auto_fit"
android:verticalSpacing="10dp"
android:horizontalSpacing="10dp"
View
2  res/layout/main.xml
@@ -26,5 +26,5 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:clickable="true"
- android:apiKey="0nPbAvuDMJWq7-mfR2dkquZuR57FTJX3ZCUEFJA" />
+ android:apiKey="0nPbAvuDMJWrGQOgGEeI9OTWV3QKD3VHDjsUGUQ" />
</LinearLayout>
View
4 res/layout/photo.xml
@@ -2,8 +2,8 @@
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
- android:layout_width="match_parent"
- android:layout_height="match_parent">
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent">
<ImageView
android:id="@+id/picture_full_size"
android:layout_width="fill_parent"
View
39 src/com/FlickrCity/FlickrCityAndroid/CityDetailsView.java
@@ -1,8 +1,10 @@
package com.FlickrCity.FlickrCityAndroid;
+import java.math.BigDecimal;
import java.util.List;
import android.app.Activity;
+import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
@@ -24,18 +26,18 @@
private ConcurrentAPI api;
private Context mContext;
- private ProgressBar progressBar=null;
// city details
private String mCity;
private double mLat;
private double mLng;
-
+ char degree = '\u00B0';
+ ProgressDialog progressDialog;
+
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.citydetails);
-
- progressBar=(ProgressBar)findViewById(R.id.progress_par);
+
api = new ConcurrentAPI(Constants.FLICKR);
mContext = this;
@@ -46,11 +48,28 @@ public void onCreate(Bundle savedInstanceState) {
mLat = extras.getDouble(Constants.LAT);
mLng = extras.getDouble(Constants.LNG);
TextView citytext = (TextView) findViewById(R.id.textviewcityname);
- TextView lattext = (TextView) findViewById(R.id.textviewlatVal);
- TextView lngtext = (TextView) findViewById(R.id.textviewlngVal);
+ TextView text_view_lat_lon = (TextView) findViewById(R.id.text_view_lat_lon);
citytext.setText(mCity);
- lattext.setText(String.valueOf(mLat));
- lngtext.setText(String.valueOf(mLng));
+
+ BigDecimal mLatBigDecimal = new BigDecimal(mLat);
+ BigDecimal mLngBigDecimal = new BigDecimal(mLng);
+ double roundedLat = mLatBigDecimal.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
+ double roundedLng = mLngBigDecimal.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
+
+ char NSDirection='N';
+ char EWDirection='E';
+ if(roundedLat<0)
+ {
+ NSDirection='S';
+ roundedLat*=-1.0;
+ }
+ if(roundedLng<0){
+ EWDirection='W';
+ roundedLng*=-1.0;
+ }
+
+ text_view_lat_lon.setText(" ("+String.valueOf(roundedLat)+degree+NSDirection+","
+ +roundedLng+degree+EWDirection+")");
}
final Button button = (Button) findViewById(R.id.view_flickr_pictures);
@@ -82,8 +101,4 @@ public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
});
}
-
- public void updateProgress(int progress){
- progressBar.setProgress(progress);
- }
}
Please sign in to comment.
Something went wrong with that request. Please try again.