Skip to content

Commit

Permalink
Refactoring of Android's Hackbook example
Browse files Browse the repository at this point in the history
Summary:
Cleaning of the Hackbook code. Main reason of this commit is mixing tabs and
white spaces inside the code, which makes the code ugly (for example browsing
the code inside github).

In addition I also refactored few other things:
 - I tried to wrap the lines to 100 characters per line (80 per comments) - at
least in those places where it made sense
 - Remove trailing whitespaces and unnecessary blank lines
 - Add missing @OverRide adnnotations
 - Fixed syntax in some places (like "for(i=0;..." -> "for (i = 0;...")
 - Added missing 'static' keywords

Test Plan:
Run the app and see if everything works :-)

Reviewers: jimbru, raghuc1, vksgupta, dalves

Reviewed By: dalves

CC: platform-diffs@lists, nbushak, dalves

Differential Revision: 370079
  • Loading branch information
Kamil Kraszewski authored and Kamil Kraszewski committed Dec 1, 2011
1 parent f4b2b9e commit 61551e0
Show file tree
Hide file tree
Showing 36 changed files with 2,553 additions and 2,433 deletions.
94 changes: 47 additions & 47 deletions examples/Hackbook/AndroidManifest.xml
@@ -1,49 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.facebook.android"
android:versionCode="1"
android:versionName="1.0">
<supports-screens
android:smallScreens="true"
android:normalScreens="true"
android:largeScreens="true"
android:anyDensity="true" />
<application android:icon="@drawable/icon"
android:label="@string/app_name"
android:debuggable="true">
<activity android:name=".SplashActivity"
android:label="@string/app_name"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".Hackbook"
android:label="@string/app_name"
android:configChanges="keyboardHidden"
android:screenOrientation="portrait">
</activity>
<activity
android:name=".GraphExplorer"
android:windowSoftInputMode="stateHidden"
android:screenOrientation="portrait" />
<activity android:name=".IntentUriHandler">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="fbgraphex" />
</intent-filter>
</activity>
<activity
android:name=".FriendsList"
android:screenOrientation="portrait" />
<activity
android:name=".Places"
android:screenOrientation="portrait" />
</application>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.MANAGE_ACCOUNTS" />
<uses-sdk android:minSdkVersion="3" />
</manifest>
package="com.facebook.android"
android:versionCode="1"
android:versionName="1.0">
<supports-screens
android:smallScreens="true"
android:normalScreens="true"
android:largeScreens="true"
android:anyDensity="true" />
<application android:icon="@drawable/icon"
android:label="@string/app_name"
android:debuggable="true">
<activity android:name=".SplashActivity"
android:label="@string/app_name"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".Hackbook"
android:label="@string/app_name"
android:configChanges="keyboardHidden"
android:screenOrientation="portrait">
</activity>
<activity
android:name=".GraphExplorer"
android:windowSoftInputMode="stateHidden"
android:screenOrientation="portrait" />
<activity android:name=".IntentUriHandler">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="fbgraphex" />
</intent-filter>
</activity>
<activity
android:name=".FriendsList"
android:screenOrientation="portrait" />
<activity
android:name=".Places"
android:screenOrientation="portrait" />
</application>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.MANAGE_ACCOUNTS" />
<uses-sdk android:minSdkVersion="3" />
</manifest>
4 changes: 2 additions & 2 deletions examples/Hackbook/res/layout/connection_item.xml
@@ -1,11 +1,11 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="?android:attr/listPreferredItemHeight">
<TextView
<TextView
android:id="@+id/connection_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="26sp"
android:textColor="@color/lite_blue"
android:paddingLeft="5dp" />
</RelativeLayout>
</RelativeLayout>
84 changes: 42 additions & 42 deletions examples/Hackbook/res/layout/fields_connections_list.xml
@@ -1,45 +1,45 @@
<?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/black">
<TabHost
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:id="@+id/tabHost">
<RelativeLayout
android:layout_height="wrap_content"
android:layout_width="fill_parent">
<TabWidget
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@android:id/tabs" />
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@android:id/tabcontent"
android:layout_below="@android:id/tabs">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/fields_layout">
<Button android:id="@+id/get_fields_button"
android:text="@string/get_fields"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="10dp" />
<ListView
android:id="@+id/fields_list"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</LinearLayout>
<ListView
android:id="@+id/connections_list"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</FrameLayout>
</RelativeLayout>
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/black">
<TabHost
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:id="@+id/tabHost">
<RelativeLayout
android:layout_height="wrap_content"
android:layout_width="fill_parent">
<TabWidget
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@android:id/tabs" />
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@android:id/tabcontent"
android:layout_below="@android:id/tabs">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/fields_layout">
<Button android:id="@+id/get_fields_button"
android:text="@string/get_fields"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="10dp" />
<ListView
android:id="@+id/fields_list"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</LinearLayout>
<ListView
android:id="@+id/connections_list"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</FrameLayout>
</RelativeLayout>
</TabHost>
</LinearLayout>
</LinearLayout>
16 changes: 8 additions & 8 deletions examples/Hackbook/res/layout/fields_item.xml
@@ -1,14 +1,14 @@
<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/black">
<CheckBox
android:id="@+id/fields_checkbox"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/black">
<CheckBox
android:id="@+id/fields_checkbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
<TextView
android:id="@+id/fields_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>
78 changes: 39 additions & 39 deletions examples/Hackbook/res/layout/fql_query.xml
@@ -1,41 +1,41 @@
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<EditText
android:layout_height="wrap_content"
android:layout_width="240dp"
android:layout_weight="1"
android:textSize="25px"
android:gravity="left|center"
android:id="@+id/fqlquery" />
<Button android:id="@+id/submit_button"
android:text="@string/submit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:padding="10dp" />
</LinearLayout>
<View
android:layout_width="fill_parent"
android:layout_height="3dip"
android:background="@color/grey" />
<ScrollView
android:id="@+id/ScrollView01"
android:layout_height="fill_parent"
android:layout_width="fill_parent">
<TextView
android:id="@+id/fqlOutput"
android:textColor="@color/white"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingTop="3dp"
android:paddingLeft="3dp"
android:visibility="invisible"
android:background="@color/grey" />
</ScrollView>
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<EditText
android:layout_height="wrap_content"
android:layout_width="240dp"
android:layout_weight="1"
android:textSize="25px"
android:gravity="left|center"
android:id="@+id/fqlquery" />
<Button android:id="@+id/submit_button"
android:text="@string/submit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:padding="10dp" />
</LinearLayout>
<View
android:layout_width="fill_parent"
android:layout_height="3dip"
android:background="@color/grey" />
<ScrollView
android:id="@+id/ScrollView01"
android:layout_height="fill_parent"
android:layout_width="fill_parent">
<TextView
android:id="@+id/fqlOutput"
android:textColor="@color/white"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingTop="3dp"
android:paddingLeft="3dp"
android:visibility="invisible"
android:background="@color/grey" />
</ScrollView>
</LinearLayout>
20 changes: 10 additions & 10 deletions examples/Hackbook/res/layout/friend_item.xml
@@ -1,10 +1,10 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:padding="6dip"
android:padding="6dip"
android:layout_height="?android:attr/listPreferredItemHeight"
android:id="@+id/friend_item">
<ImageView
android:id="@+id/profile_pic"
android:id="@+id/profile_pic"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
Expand All @@ -13,21 +13,21 @@
<TextView
android:id="@+id/name"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/profile_pic"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_alignWithParentIfMissing="true"
android:layout_alignParentTop="true"
android:layout_alignWithParentIfMissing="true"
android:gravity="center_vertical" />
<TextView
<TextView
android:id="@+id/info"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/profile_pic"
android:layout_below="@id/name"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_alignWithParentIfMissing="true"
android:layout_alignParentRight="true"
android:layout_alignWithParentIfMissing="true"
android:singleLine="true"
android:ellipsize="marquee" />
</RelativeLayout>
</RelativeLayout>
14 changes: 7 additions & 7 deletions examples/Hackbook/res/layout/friends_list.xml
@@ -1,11 +1,11 @@
<?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/black">
<ListView
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/black">
<ListView
android:id="@+id/friends_list"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</LinearLayout>
android:layout_height="fill_parent" />
</LinearLayout>

0 comments on commit 61551e0

Please sign in to comment.