Skip to content

Commit

Permalink
Android source code
Browse files Browse the repository at this point in the history
  • Loading branch information
Vikas Gupta committed Sep 21, 2011
1 parent a14ba31 commit 1206c30
Show file tree
Hide file tree
Showing 23 changed files with 1,442 additions and 0 deletions.
22 changes: 22 additions & 0 deletions Android/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.wishlist"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="@drawable/icon"
android:label="@string/app_name"
android:debuggable="true">
<activity android:name=".Wishlist"
android:label="@string/app_name"
android:configChanges="keyboardHidden"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-sdk android:minSdkVersion="3"/>
</manifest>
13 changes: 13 additions & 0 deletions Android/default.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system use,
# "build.properties", and override values to adapt the script to your
# project structure.

# Indicates whether an apk should be generated for each density.
split.density=false
# Project target.
target=android-8
Binary file added Android/res/drawable/camera.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Android/res/drawable/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Android/res/drawable/login.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions Android/res/drawable/login_button.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:drawable="@drawable/login_down" />
<item android:drawable="@drawable/login" /> <!-- default -->
</selector>
Binary file added Android/res/drawable/login_down.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Android/res/drawable/logout.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions Android/res/drawable/logout_button.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:drawable="@drawable/logout_down" />
<item android:drawable="@drawable/logout" /> <!-- default -->
</selector>
Binary file added Android/res/drawable/logout_down.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Android/res/drawable/me.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Android/res/drawable/x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions Android/res/layout/place_item.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/place_name"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="7dp"
android:textColor="@color/black"
android:gravity="center_vertical"/>
61 changes: 61 additions & 0 deletions Android/res/layout/wishlist.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:background="@color/white"
android:gravity="center_horizontal">
<RelativeLayout
android:layout_width="fill_parent"
android:padding="6dip" android:layout_height="?android:attr/listPreferredItemHeight"
android:background="@color/fb_blue">
<ImageView
android:id="@+id/user_pic"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentBottom="true"
android:layout_marginRight="6dip"/>
<TextView
android:id="@+id/txt"
android:textColor="@color/white"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/user_pic"/>
<com.wishlist.LoginButton
android:id="@+id/login"
android:src="@drawable/login_button"
android:layout_toRightOf="@id/user_pic"
android:layout_below="@id/txt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</RelativeLayout>
<Spinner
android:id="@+id/wishlist_spinner"
android:prompt="@string/select_wishlist"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:layout_gravity="left"/>
<EditText
android:hint="@string/enter_name"
android:id="@+id/product_name"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
<ImageView
android:id="@+id/itemPhoto"
android:clickable="true"
android:layout_width="185dp"
android:layout_height="185dp"/>
<Spinner
android:id="@+id/location"
android:prompt="@string/select_location"
android:layout_height="50dp"
android:layout_width="fill_parent"
android:layout_gravity="left"/>
<Button
android:text="@string/add_to_timeline"
android:id="@+id/timeline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@color/fb_blue"
android:textColor="@color/white"
android:padding="6dp"/>
</LinearLayout>
10 changes: 10 additions & 0 deletions Android/res/values/colors.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="white">#ffffff</color>
<color name="black">#000000</color>
<color name="green">#23cf34</color>
<color name="orange">#E47833</color>
<color name="lite_blue">#4E78A0</color>
<color name="blue">#0000FF</color>
<color name="fb_blue">#3B5998</color>
</resources>
35 changes: 35 additions & 0 deletions Android/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Wishlist</string>
<string name="select_wishlist">Select Wishlist:</string>
<string-array name="wishlist_array">
<item>Birthday Wishlist</item>
<item>Holiday Wishlist</item>
<item>Wedding Wishlist</item>
</string-array>
<string-array name="login_for_places">
<item>"Login for nearby places"</item>
</string-array>
<string-array name="init_location_array">
<item>"Fetching Location..."</item>
</string-array>
<string-array name="fetch_places_array">
<item>"Fetching nearby places..."</item>
</string-array>
<string name="add_to_timeline">Add to Timeline</string>
<string name="select_wishlist">Select Wishlist</string>
<string name="select_location">Select Location</string>
<string name="adding_to_timeline">Adding to timeline...</string>
<string name="uploading_photo">Uploading photo...</string>
<string name="enter_name">Enter Product Name</string>
<string name="ok">OK</string>
<string name="must_login">You must first login!</string>
<string name="enter_product_name">You must enter product name</string>
<string name="take_product_photo">You must take product photo</string>
<string name="no_places_fetched">No nearby places fetched</string>
<string name="error_getting_image">Image could not be fetched</string>
<string name="no_image_selected">No image selected for upload</string>
<string name="error_uploading_photo">Product image could not be uploaded. Please try again.</string>
<string name="added_to_timeline">%1$s added to timeline</string>
<string name="error">Error</string>
</resources>
41 changes: 41 additions & 0 deletions Android/src/com/wishlist/BaseDialogListener.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Copyright 2004 - Present Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.wishlist;

import com.facebook.android.DialogError;
import com.facebook.android.FacebookError;
import com.facebook.android.Facebook.DialogListener;

/**
* Skeleton base class for RequestListeners, providing default error
* handling. Applications should handle these error conditions.
*
*/
public abstract class BaseDialogListener implements DialogListener {

public void onFacebookError(FacebookError e) {
e.printStackTrace();
}

public void onError(DialogError e) {
e.printStackTrace();
}

public void onCancel() {
}

}
57 changes: 57 additions & 0 deletions Android/src/com/wishlist/BaseRequestListener.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
* Copyright 2004 - Present Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.wishlist;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.MalformedURLException;

import android.util.Log;

import com.facebook.android.FacebookError;
import com.facebook.android.AsyncFacebookRunner.RequestListener;

/**
* Skeleton base class for RequestListeners, providing default error
* handling. Applications should handle these error conditions.
*
*/
public abstract class BaseRequestListener implements RequestListener {

public void onFacebookError(FacebookError e, final Object state) {
Log.e("Facebook", e.getMessage());
e.printStackTrace();
}

public void onFileNotFoundException(FileNotFoundException e,
final Object state) {
Log.e("Facebook", e.getMessage());
e.printStackTrace();
}

public void onIOException(IOException e, final Object state) {
Log.e("Facebook", e.getMessage());
e.printStackTrace();
}

public void onMalformedURLException(MalformedURLException e,
final Object state) {
Log.e("Facebook", e.getMessage());
e.printStackTrace();
}

}
Loading

0 comments on commit 1206c30

Please sign in to comment.