Permalink
Browse files

Merge branch 'master' of github.com:soulmates/Soulmate-Android

  • Loading branch information...
2 parents 15b6897 + f272f47 commit 8b3d2927ef9b6923383718877a10d98cfa052d01 @christoff christoff committed Feb 12, 2012
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item
+ android:state_selected="true"
+ android:drawable="@color/transparent" />
+ <item
+ android:state_pressed="true"
+ android:drawable="@color/transparent" />
+ <item>
+ <shape>
+ <gradient
+ android:startColor="#ffffff"
+ android:centerColor="#f0f0ff"
+ android:centerY="0.9"
+ android:endColor="#eeeef2"
+ android:angle="270"/>
+ </shape>
+ </item>
+</selector>
@@ -2,32 +2,76 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
- android:orientation="vertical" >
- <LinearLayout
+ android:orientation="vertical"
+ android:gravity="center_horizontal"
+ android:background="#CFDFE8">
+ <RelativeLayout
android:id="@+id/actionBar"
android:layout_width="fill_parent"
android:layout_height="45dp"
- android:padding="5dp"
- android:gravity="center_vertical">
-
- </LinearLayout>
+ android:background="@+drawable/action_bar_bg">
+ <ImageView
+ android:src="@+drawable/logo"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_centerInParent="true"/>
+ </RelativeLayout>
+ <RelativeLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="24dp">
+ <Button
+ android:id="@+id/twitterBtn"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_centerInParent="true"
+ android:padding="12dp"
+ android:text="add Twitter id..."
+ android:textStyle="bold|italic"
+ android:textSize="18dp"
+ android:textColor="#333"
+ android:background="@+drawable/btn_lt_blue_bg"/>
+ <TextView
+ android:id="@+id/twitterId"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_centerInParent="true"
+ android:textSize="28dp"
+ android:textColor="#fff"
+ android:textStyle="bold|italic"
+ android:shadowDx="2"
+ android:shadowDy="2"
+ android:shadowRadius="2"
+ android:shadowColor="#000000"/>
+ </RelativeLayout>
<TextView
- android:layout_width="fill_parent"
+ android:text="my favorite artists:"
+ android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:text="MY Favrorite Artists" />
+ android:padding="12dp"
+ android:textSize="21dp"
+ android:textColor="#222"
+ android:textStyle="bold|italic"/>
<ListView
android:id="@android:id/list"
android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:layout_weight="1"/>
- <FrameLayout
+ android:layout_height="255dp"
+
+ android:background="#CFDFE8"/>
+ <RelativeLayout
android:layout_width="fill_parent"
- android:layout_height="80dp"
- android:gravity="center">
+ android:layout_height="fill_parent"
+ android:layout_weight="1">
<Button
- android:id="@+id/find"
+ android:id="@+id/find"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:text="Find my soulmate"/>
- </FrameLayout>
+ android:layout_centerInParent="true"
+ android:padding="16dp"
+ android:text="Find my soulmate!"
+ android:textStyle="bold|italic"
+ android:textSize="18dp"
+ android:textColor="#fff"
+ android:background="@+drawable/btn_blue_bg"/>
+ </RelativeLayout>
</LinearLayout>
@@ -1,50 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
- <LinearLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:minHeight="50dp"
- android:padding="10dp"
- android:gravity="center_vertical">
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:minHeight="50dp"
+ android:gravity="center_vertical"
+ android:background="@drawable/listitem_bg">
- <TextView
- android:id="@+id/counter"
- android:textSize="21dp"
- android:textStyle="bold"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"/>
-
- <TextView android:id="@+id/artist"
- android:textSize="18dp"
- android:textStyle="bold"
- android:textColor="#323232"
- android:singleLine="true"
- android:ellipsize="end"
- android:layout_margin="10dp"
- android:layout_width="wrap_content"
- android:layout_height="fill_parent"
- android:layout_weight="1"/>
-
- <TextView android:id="@+id/counter"
- android:textSize="21dp"
- android:textStyle="bold"
+ <TextView
+ android:id="@+id/counter"
+ android:textSize="28dp"
+ android:layout_marginLeft="10dp"
android:layout_width="wrap_content"
- android:layout_height="wrap_content"/>
-
- <TextView android:id="@+id/artist"
+ android:layout_height="wrap_content"
+ android:textColor="#bbb"
+ android:textStyle="bold|italic"/>
+
+ <TextView android:id="@+id/artist"
android:textSize="18dp"
android:textStyle="bold"
android:textColor="#323232"
android:singleLine="true"
- android:ellipsize="end"
- android:layout_margin="10dp"
+ android:ellipsize="end"
+ android:layout_marginLeft="16dp"
android:layout_width="wrap_content"
- android:layout_height="fill_parent"
+ android:layout_height="wrap_content"
android:layout_weight="1"/>
<Button android:id="@+id/editBtn"
android:text="edit"
android:layout_width="wrap_content"
- android:layout_height="wrap_content"/>
+ android:layout_height="wrap_content"
+ android:layout_marginRight="10dp"
+ android:textStyle="bold"
+ android:textColor="#333"
+ android:padding="8dp"
+ android:background="@+drawable/btn_lt_blue_bg"/>
</LinearLayout>
@@ -3,6 +3,17 @@
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
+ <RelativeLayout
+ android:id="@+id/actionBar"
+ android:layout_width="fill_parent"
+ android:layout_height="45dp"
+ android:background="@+drawable/action_bar_bg">
+ <ImageView
+ android:src="@+drawable/logo"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_centerInParent="true"/>
+ </RelativeLayout>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
View
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<resources>
+ <color name="appwidget_text">#ffffffff</color>
+ <color name="transparent">#00000000</color>
+ <color name="list_divider_day">#cacfd6</color>
+ <color name="text_list_day">#323232</color>
+ <color name="text_list_subtext_day">#7A7AFF</color>
+</resources>
+
@@ -238,7 +238,7 @@ public View getView(final int position, View convertView, ViewGroup parent) {
if(position >= 0 && position < mItems.size()){
final Artist artist = mItems.get(position);
- counterView.setText((position+1)+"");
+ counterView.setText("#" + String.valueOf(position+1));
artistView.setText(artist.name);
artistView.setOnClickListener(new OnClickListener() {
@@ -3,8 +3,10 @@
import java.util.ArrayList;
import java.util.List;
+import android.app.AlertDialog;
import android.app.ListActivity;
import android.content.Context;
+import android.content.DialogInterface;
import android.os.Bundle;
import android.os.Handler;
import android.text.TextUtils;
@@ -27,6 +29,7 @@
protected ArrayList <Artist> mArtists;
private static ImageDownloader imgLoader = new ImageDownloader();
private ArrayAdapter<SoulmateInfo> listAdapter = null;
+ private AlertDialog dialog = null;
public class MatesAdapter extends ArrayAdapter<SoulmateInfo> {
public MatesAdapter(Context context, int resource, int textViewResourceId) {
@@ -66,6 +69,7 @@ public void onCreate(Bundle savedInstanceState) {
R.layout.results_list_item,
R.id.handle);
setListAdapter(listAdapter);
+ dialog = createAlert();
Bundle extras = getIntent().getExtras();
if(extras != null && extras.containsKey("artists")){
@@ -84,7 +88,7 @@ public void onCreate(Bundle savedInstanceState) {
Log.e("soul", "Did not get ids from intent");
}
- twitter = "J909";
+ twitter = "mayhem";
// myArtists = new String[] {
// "68c4ce01-99ff-4a51-b839-54a15aa81a9a", //Jackmaster
// "dc9b8085-fe1e-4b83-8d41-6dd8d295513c", //Caspa
@@ -104,6 +108,18 @@ public void onClick(View v) {
*/
}
+ private AlertDialog createAlert() {
+ AlertDialog.Builder builder = new AlertDialog.Builder(this);
+ builder.setMessage("Sorry, there's no soulmate in your proximity.")
+ .setCancelable(false)
+ .setPositiveButton("One more time...", new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog, int id) {
+ ResultActivity.this.finish();
+ }
+ });
+ return builder.create();
+ }
+
final Handler mHandler = new Handler();
private void requestSoulmatesAsync() {
@@ -117,12 +133,16 @@ private void requestSoulmatesAsync() {
t.start();
Log.d(TAG, "Requested matches...");
- Toast.makeText(this, "Now checking for your soulmate!", Toast.LENGTH_LONG).show();
+ Toast.makeText(this, "Checking for your soulmate...", Toast.LENGTH_LONG).show();
}
final Runnable updateViewRunnable = new Runnable() {
@Override public void run() {
- listAdapter.notifyDataSetChanged();
+ if(soulmates != null && soulmates.size() > 0) {
+ listAdapter.notifyDataSetChanged();
+ } else {
+ dialog.show();
+ }
}
};
}
@@ -76,13 +76,15 @@
}
private static String createSoulmateRequest(SoulmateInfo soulmateIn) {
- String query = TextUtils.join("&artist=", soulmateIn.getArtists());
- String url = String.format(
- "%s?twitter_handle=%s&artist=&%s",
- baseUrl,
- soulmateIn.getTwitterId(),
- URLEncoder.encode(query));
- return URLEncoder.encode(url);
+ String[] artists = soulmateIn.getArtists();
+ String query = String.format("twitter_handle=%s", URLEncoder.encode(soulmateIn.getTwitterId()));
+ for(int i = 0; i < artists.length; i++) {
+ String artistId = artists[i];
+ if(artistId != null && !artistId.isEmpty()) {
+ query = query + "&artist=" + URLEncoder.encode(artistId);
+ }
+ }
+ return String.format("%s?%s", baseUrl, query);
}
public static HttpResponse sendRequest(String url) {

0 comments on commit 8b3d292

Please sign in to comment.