Add registration pages.

This commit is contained in:
RyanBateman 2012-09-14 01:17:58 -04:00
parent 832dbc46d8
commit 9591dc55ab
49 changed files with 1828 additions and 237 deletions

View file

@ -20,7 +20,6 @@
<activity
android:name=".activity.Login"
android:noHistory="true"
android:label="@string/newsblur">
<intent-filter>
<category android:name="android.intent.category.LAUNCHER" />
@ -28,10 +27,43 @@
</intent-filter>
</activity>
<activity
android:name=".activity.LoginProgress"
android:label="@string/newsblur" />
<activity
android:name=".activity.RegisterProgress"
android:label="@string/get_started" />
<activity
android:name=".activity.AddSites"
android:label="@string/add_sites" />
<activity
android:name=".activity.AddFollow"
android:label="@string/add_follow" />
<activity
android:name=".activity.AddTwitter"
android:label="@string/add_twitter" />
<activity
android:name=".activity.AddFacebook"
android:label="@string/add_facebook" />
<activity
android:name=".activity.AddSocial"
android:label="@string/add_friends" />
<activity
android:name=".activity.ImportFeeds"
android:label="@string/newsblur" />
<activity
android:name=".activity.Main"
android:label="@string/newsblur">
</activity>
android:label="@string/newsblur" />
<activity
android:name=".activity.Profile"

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<solid android:color="@color/facebook_blue" />
<corners android:radius="3dp" />
</shape>

Binary file not shown.

After

Width:  |  Height:  |  Size: 509 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<solid android:color="@color/newsblur_blue" />
<corners android:radius="3dp" />
</shape>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 4 KiB

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<solid android:color="@color/twitter_blue" />
<corners android:radius="3dp" />
</shape>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

View file

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/item_background" >
<FrameLayout
android:id="@+id/addfollow_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
android:gravity="center"
android:padding="30dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="@color/newsblur_blue"
android:id="@+id/addfollow_button_bar"
android:gravity="right"
android:padding="10dp">
<Button
android:id="@+id/login_addfollow_startreading"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:text="Start Reading"
android:textSize="14sp" />
</LinearLayout>
<View
android:layout_width="fill_parent"
android:layout_height="8dip"
android:background="@drawable/inverted_orangeline_shadow"
android:layout_above="@id/addfollow_button_bar" />
<View
android:layout_width="fill_parent"
android:layout_height="8dip"
android:background="@drawable/orangeline_shadow" />
</RelativeLayout>

View file

@ -0,0 +1,70 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/item_background" >
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="20dp"
android:gravity="center"
android:text="Start your collection of great sites to follow."
android:textColor="@color/lightorange"
android:textSize="20sp" />
<View
android:layout_width="match_parent"
android:layout_height="3dp"
android:background="@drawable/divider_light" />
<FrameLayout
android:id="@+id/addsites_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="10dp"
android:gravity="center"
android:padding="20dp" />
</LinearLayout>
</ScrollView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="@color/newsblur_blue"
android:id="@+id/addsites_button_bar"
android:gravity="right"
android:padding="10dp">
<Button
android:id="@+id/login_addsites_nextstep"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:text="Next Step"
android:textSize="14sp" />
</LinearLayout>
<View
android:layout_width="fill_parent"
android:layout_height="8dip"
android:background="@drawable/inverted_orangeline_shadow"
android:layout_above="@id/addsites_button_bar" />
<View
android:layout_width="fill_parent"
android:layout_height="8dip"
android:background="@drawable/orangeline_shadow" />
</RelativeLayout>

View file

@ -0,0 +1,45 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/item_background" >
<FrameLayout
android:id="@+id/addsocial_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="10dp"
android:gravity="center"
android:padding="20dp" />
<LinearLayout
android:id="@+id/addsocial_button_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="@color/newsblur_blue"
android:gravity="right"
android:padding="10dp" >
<Button
android:id="@+id/login_addsocial_nextstep"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:text="Skip this step"
android:textSize="14sp" />
</LinearLayout>
<View
android:layout_width="fill_parent"
android:layout_height="8dip"
android:layout_above="@id/addsocial_button_bar"
android:background="@drawable/inverted_orangeline_shadow" />
<View
android:layout_width="fill_parent"
android:layout_height="8dip"
android:background="@drawable/orangeline_shadow" />
</RelativeLayout>

View file

@ -2,36 +2,27 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/activity_background"
android:gravity="center" >
android:background="@color/item_background" >
<ImageView
android:id="@+id/login_logo"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_marginRight="8dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="40dp"
android:contentDescription="@string/description_login_logo"
android:src="@drawable/logo" />
<TextView
android:id="@+id/login_logo_title"
android:layout_width="wrap_content"
android:layout_height="80dp"
android:layout_alignBaseline="@+id/login_logo"
android:layout_marginTop="40dp"
android:layout_toRightOf="@+id/login_logo"
android:gravity="center"
android:text="@string/newsblur"
android:textColor="@color/white"
android:textSize="40dp"
android:textStyle="bold" />
android:src="@drawable/logo_newsblur_blur" />
<FrameLayout
android:id="@+id/login_container"
android:layout_width="280dp"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/login_logo"
android:layout_marginTop="50dp" />
android:layout_centerHorizontal="true"
android:layout_marginTop="50dp"
android:gravity="center"
android:padding="30dp" />
</RelativeLayout>

View file

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/item_background" >
<FrameLayout
android:id="@+id/login_progress_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
android:gravity="center"
android:padding="30dp" />
<View
android:layout_width="fill_parent"
android:layout_height="8dip"
android:layout_alignParentTop="true"
android:background="@drawable/orangeline_shadow" />
</RelativeLayout>

View file

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/item_background" >
<WebView
android:id="@+id/webcontainer"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<View
android:layout_width="fill_parent"
android:layout_height="8dip"
android:layout_alignParentTop="true"
android:background="@drawable/orangeline_shadow" />
</RelativeLayout>

View file

@ -0,0 +1,72 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="20dp" >
<TextView
android:id="@+id/addfollow_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="30dp"
android:text="@string/wonderful_things"
android:textColor="@color/darkgray"
android:textSize="16sp" />
<LinearLayout
android:id="@+id/addfollow_newsblur"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/addfollow_text"
android:layout_gravity="center_vertical"
android:layout_margin="20dp"
android:background="@drawable/newsblur_background"
android:orientation="horizontal"
android:gravity="center"
android:padding="5dp" >
<TextView
android:id="@+id/addfollow_newsblur_text"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:text="@string/addfollow_add_newsblur"
android:textColor="@color/white"
android:layout_marginRight="10dp"
android:textSize="16sp" />
<CheckBox
android:id="@+id/addfollow_newsblur_checkbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
android:id="@+id/addfollow_popular"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/addfollow_newsblur"
android:layout_gravity="center_vertical"
android:layout_margin="20dp"
android:gravity="center"
android:background="@drawable/newsblur_background"
android:orientation="horizontal"
android:padding="5dp" >
<TextView
android:id="@+id/addfollow_popular_text"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:text="@string/addfollow_add_popular"
android:textColor="@color/white"
android:layout_marginRight="10dp"
android:textSize="16sp" />
<CheckBox
android:id="@+id/addfollow_popular_checkbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
</RelativeLayout>

View file

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="20dp"
android:orientation="vertical" >
<Button
android:id="@+id/login_add_reader_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/newsblur_blue"
android:text="@string/login_google_reader"
android:textColor="@color/white"
android:textSize="14sp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:text="@string/login_add_sites_from_google_reader"
android:textColor="@color/lightgray"
android:textSize="12sp" />
<LinearLayout
android:id="@+id/login_categories_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<ProgressBar
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_marginTop="20dp"
android:id="@+id/login_categories_progress"
android:indeterminateOnly="true"
android:layout_gravity="center_horizontal" />
</LinearLayout>
</LinearLayout>

View file

@ -0,0 +1,91 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="20dp" >
<TextView
android:id="@+id/addsocial_connect_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="30dp"
android:text="@string/connect_with_your_friends"
android:textColor="@color/darkgray"
android:textSize="16sp" />
<LinearLayout
android:id="@+id/addsocial_twitter"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/addsocial_connect_text"
android:layout_gravity="center_vertical"
android:layout_margin="20dp"
android:background="@drawable/twitter_background"
android:orientation="horizontal"
android:padding="5dp" >
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginRight="15dp"
android:scaleType="centerInside"
android:src="@drawable/twitter_logo" />
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:text="@string/twitter"
android:id="@+id/addsocial_twitter_text"
android:textColor="@color/white"
android:textSize="16sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/addsocial_facebook"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/addsocial_twitter"
android:layout_gravity="center_vertical"
android:layout_margin="20dp"
android:background="@drawable/facebook_background"
android:orientation="horizontal"
android:padding="5dp" >
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginRight="15dp"
android:scaleType="centerInside"
android:src="@drawable/facebook_logo" />
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:text="@string/facebook"
android:id="@+id/addsocial_facebook_text"
android:textColor="@color/white"
android:textSize="16sp" />
</LinearLayout>
<TextView
android:id="@+id/addsocial_autofollow_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/addsocial_facebook"
android:layout_centerHorizontal="true"
android:layout_marginTop="30dp"
android:textSize="16sp"
android:text="@string/auto_follow_friends"
android:textColor="@color/darkgray" />
<CheckBox
android:id="@+id/addsocial_autofollow_checkbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/addsocial_facebook"
android:layout_alignBaseline="@id/addsocial_autofollow_text"
android:layout_toRightOf="@id/addsocial_autofollow_text" />
</RelativeLayout>

View file

@ -0,0 +1,73 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/login_status"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center_horizontal"
android:orientation="vertical" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1" >
<TextView
android:id="@+id/login_logging_in"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="@string/login_logging_in"
android:textColor="@color/white"
android:textSize="16dp" />
<ImageView
android:id="@+id/login_profile_picture"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_centerVertical="true"
android:layout_marginRight="15dp"
android:layout_toLeftOf="@id/login_logging_in"
android:src="@drawable/world" />
</RelativeLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1" >
<TextView
android:id="@+id/login_retrieving_feeds"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_marginLeft="20dp"
android:text="@string/login_retrieving_feeds"
android:textColor="@color/white"
android:textSize="16dp" />
<ProgressBar
android:id="@+id/login_feed_progress"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_centerVertical="true"
android:layout_toLeftOf="@id/login_retrieving_feeds"
android:indeterminateOnly="true"
android:visibility="invisible" />
</RelativeLayout>
<TextView
android:id="@+id/login_lets_go"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="@string/login_lets_go"
android:textColor="@color/white"
android:textSize="16dp" />
</LinearLayout>
</RelativeLayout>

View file

@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<ViewSwitcher xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/login_viewswitcher"
android:layout_width="fill_parent"
@ -31,18 +32,8 @@
android:nextFocusDown="@+id/login_button"
android:textSize="22dp" />
<Button
android:id="@+id/login_signup"
android:layout_width="120dp"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_marginBottom="20dp"
android:layout_marginTop="60dp"
android:contentDescription="@string/description_signup_button"
android:text="@string/login_button_signup" />
<Button
<Button
android:id="@+id/login_button"
android:layout_width="120dp"
android:layout_height="wrap_content"
@ -52,73 +43,81 @@
android:layout_marginTop="60dp"
android:contentDescription="@string/description_login_button"
android:text="@string/login_button_login" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:text="@string/need_to_register"
android:textColor="@color/darkorange"
android:id="@+id/login_change_to_register"
android:layout_alignBaseline="@id/login_button"
android:layout_marginBottom="20dp"
android:textSize="15sp" />
</RelativeLayout>
<LinearLayout
android:id="@+id/login_status"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center_horizontal"
android:orientation="vertical" >
<RelativeLayout
android:id="@+id/registration_form"
android:layout_width="match_parent"
android:layout_height="fill_parent">
<EditText
android:id="@+id/registration_username"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1" >
android:hint="@string/login_username_hint"
android:inputType="textEmailAddress"
android:textSize="22dp" />
<TextView
android:id="@+id/login_logging_in"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="@string/login_logging_in"
android:textColor="@color/white"
android:textSize="16dp" />
<ImageView
android:id="@+id/login_profile_picture"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_centerVertical="true"
android:layout_marginRight="15dp"
android:layout_toLeftOf="@id/login_logging_in"
android:src="@drawable/world" />
</RelativeLayout>
<RelativeLayout
<EditText
android:id="@+id/registration_password"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1" >
<TextView
android:id="@+id/login_retrieving_feeds"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_marginLeft="20dp"
android:text="@string/login_retrieving_feeds"
android:textColor="@color/white"
android:textSize="16dp" />
<ProgressBar
android:id="@+id/login_feed_progress"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_centerVertical="true"
android:layout_toLeftOf="@id/login_retrieving_feeds"
android:indeterminateOnly="true"
android:visibility="invisible" />
</RelativeLayout>
<TextView
android:id="@+id/login_lets_go"
android:layout_width="wrap_content"
android:layout_below="@+id/registration_username"
android:layout_marginTop="40dp"
android:hint="@string/login_password_hint"
android:imeOptions="actionDone"
android:inputType="textPassword"
android:nextFocusDown="@+id/login_button"
android:textSize="22dp" />
<EditText
android:id="@+id/registration_email"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="@string/login_lets_go"
android:textColor="@color/white"
android:textSize="16dp" />
</LinearLayout>
android:layout_below="@+id/registration_password"
android:layout_marginTop="40dp"
android:hint="@string/login_registration_email_hint"
android:imeOptions="actionDone"
android:inputType="textEmailAddress"
android:nextFocusDown="@+id/registration_button"
android:textSize="22dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:id="@+id/login_change_to_login"
android:text="@string/need_to_login"
android:textColor="@color/darkorange"
android:layout_alignBaseline="@id/registration_button"
android:layout_marginBottom="20dp"
android:textSize="13sp" />
<Button
android:id="@+id/registration_button"
android:layout_width="120dp"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_marginBottom="20dp"
android:layout_marginTop="60dp"
android:contentDescription="@string/description_login_button"
android:text="@string/login_registration_register" />
</RelativeLayout>
</ViewSwitcher>

View file

@ -0,0 +1,65 @@
<?xml version="1.0" encoding="utf-8"?>
<ViewSwitcher xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/register_viewswitcher"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:inAnimation="@android:anim/fade_in"
android:outAnimation="@android:anim/fade_out" >
<LinearLayout
android:id="@+id/registering_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="horizontal" >
<ProgressBar
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginRight="10dp"
android:indeterminateOnly="true" />
<TextView
android:id="@+id/registering_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Registering..."
android:textColor="@color/lightorange"
android:textSize="20sp" />
</LinearLayout>
<RelativeLayout
android:id="@+id/getting_started"
android:layout_width="match_parent"
android:layout_height="fill_parent" >
<ImageView
android:id="@+id/registerprogress_logo"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_marginTop="50dp"
android:layout_centerHorizontal="true"
android:src="@drawable/logo" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/registerprogress_logo"
android:gravity="center"
android:layout_marginTop="20dp"
android:text="@string/faster_faster"
android:textColor="@color/darkgray" />
<Button
android:id="@+id/registering_next_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_marginBottom="20dp"
android:layout_marginRight="20dp"
android:text="Let&apos;s go!"
android:textSize="20sp" />
</RelativeLayout>
</ViewSwitcher>

View file

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="20dp"
android:background="@color/newsblur_blue" >
<TextView
android:id="@+id/category_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:textColor="@color/white"
android:textSize="16sp" />
<CheckBox
android:id="@+id/category_checkbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_alignParentRight="true"
android:layout_alignBaseline="@id/category_title" />
</RelativeLayout>
</LinearLayout>

View file

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingLeft="2dp"
android:gravity="center_vertical"
android:paddingRight="2dp">
<View
android:layout_width="2dp"
android:layout_height="match_parent"
android:id="@+id/login_category_feed_leftbar" />
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:id="@+id/login_category_feed_icon"
android:layout_marginLeft="5dp"
android:padding="2dp"
android:layout_marginRight="5dp" />
<TextView
android:id="@+id/login_category_feed_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingTop="4dp"
android:paddingBottom="4dp"
android:textSize="14sp"
android:textColor="@color/darkgray"
/>
<View
android:layout_width="2dp"
android:layout_height="match_parent"
android:layout_gravity="right"
android:id="@+id/login_category_feed_rightbar" />
</LinearLayout>

View file

@ -10,6 +10,9 @@
<color name="lightorange">#d98800</color>
<color name="darkorange">#b44a00</color>
<color name="twitter_blue">#4099FF</color>
<color name="facebook_blue">#3B5998</color>
<color name="lightgreen">#3b8207</color>
<color name="darkgreen">#134c00</color>

View file

@ -5,6 +5,7 @@
<string name="login_username_hint">username</string>
<string name="login_password_hint">password</string>
<string name="login_registration_email_hint">email address</string>
<string name="login_button_login">Log In</string>
<string name="login_button_signup">Sign Up</string>
<string name="login_message_error">There was problem connecting to NewsBlur. Check your internet connection.</string>
@ -101,5 +102,24 @@
<string name="feed_deleted">Feed deleted</string>
<string name="error_deleting_feed">There was an error deleting the feed.</string>
<string name="login_registration_register">Register</string>
<string name="login_google_reader">Google Reader</string>
<string name="login_add_sites_from_google_reader">Import your sites from Google Reader</string>
<string name="add_sites">Add some sites</string>
<string name="get_started">Let\'s get started</string>
<string name="add_friends">Add your friends</string>
<string name="connect_with_your_friends">Connect with your friends to easily follow the stories that matter to them</string>
<string name="twitter">Twitter</string>
<string name="facebook">Facebook</string>
<string name="auto_follow_friends">Auto-follow friends</string>
<string name="faster_faster">Faster! Faster! Until the thrill of speed overcomes the fear of death!</string>
<string name="add_twitter">Add Twitter friends</string>
<string name="add_facebook">Add Facebook friends</string>
<string name="need_to_login"><u>I need to log in!</u></string>
<string name="need_to_register"><u>I need to register</u></string>
<string name="wonderful_things">Wonderful things are happening at Newsblur. Add our blog for the latest news.</string>
<string name="addfollow_add_newsblur">Follow NewsBlur</string>
<string name="addfollow_add_popular">Follow Popular</string>
<string name="add_follow">All Done!</string>
</resources>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="edittext" parent="@android:style/Widget.EditText">
<item name="android:focusable">true</item>
@ -7,8 +7,8 @@
<item name="android:clickable">true</item>
<item name="android:background">@drawable/edittext_newsblur</item>
<item name="android:gravity">center_vertical</item>
<item name="android:textColor">@color/white</item>
<item name="android:textColorHint">@color/hintgray</item>
<item name="android:textColor">@color/darkgray</item>
<item name="android:textColorHint">@color/lightorange</item>
</style>
<style name="greenButton" parent="@android:style/Widget.Button">

View file

@ -0,0 +1,39 @@
package com.newsblur.activity;
import android.os.Bundle;
import android.text.TextUtils;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import com.actionbarsherlock.app.SherlockFragmentActivity;
import com.newsblur.R;
public class AddFacebook extends SherlockFragmentActivity {
public static final int FACEBOOK_AUTHED = 0x21;
private WebView webview;
@Override
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);
setContentView(R.layout.activity_webcontainer);
webview = (WebView) findViewById(R.id.webcontainer);
webview.getSettings().setJavaScriptEnabled(true);
webview.setWebViewClient(new WebViewClient() {
public boolean shouldOverrideUrlLoading(WebView view, String url){
if (TextUtils.equals(url, "http://www.newsblur.com/")) {
AddFacebook.this.setResult(FACEBOOK_AUTHED);
AddFacebook.this.finish();
return true;
}
view.loadUrl(url);
return false;
}
});
webview.loadUrl("http://www.newsblur.com/oauth/facebook_connect/");
}
}

View file

@ -0,0 +1,44 @@
package com.newsblur.activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import com.actionbarsherlock.app.SherlockFragmentActivity;
import com.newsblur.R;
import com.newsblur.fragment.AddFollowFragment;
public class AddFollow extends SherlockFragmentActivity {
private FragmentManager fragmentManager;
private String currentTag = "addFollowFragment";
private AddFollowFragment addFollowFragment;
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
setContentView(R.layout.activity_addfollow);
fragmentManager = getSupportFragmentManager();
if (fragmentManager.findFragmentByTag(currentTag ) == null) {
FragmentTransaction transaction = fragmentManager.beginTransaction();
addFollowFragment = new AddFollowFragment();
transaction.add(R.id.addfollow_container, addFollowFragment, currentTag);
transaction.commit();
}
Button startReading = (Button) findViewById(R.id.login_addfollow_startreading);
startReading.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent i = new Intent(AddFollow.this, Main.class);
startActivity(i);
}
});
};
}

View file

@ -0,0 +1,72 @@
package com.newsblur.activity;
import java.util.ArrayList;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import com.actionbarsherlock.app.SherlockFragmentActivity;
import com.newsblur.R;
import com.newsblur.fragment.AddSitesListFragment;
import com.newsblur.network.APIManager;
public class AddSites extends SherlockFragmentActivity {
private FragmentManager fragmentManager;
private String currentTag = "addsitesFragment";
private AddSitesListFragment sitesList;
private APIManager apiManager;
private String TAG = "AddSites";
@Override
protected void onCreate(Bundle arg0) {
super.onCreate(arg0);
setContentView(R.layout.activity_addsites);
apiManager = new APIManager(this);
fragmentManager = getSupportFragmentManager();
if (fragmentManager.findFragmentByTag(currentTag ) == null) {
FragmentTransaction transaction = fragmentManager.beginTransaction();
sitesList = new AddSitesListFragment();
transaction.add(R.id.addsites_container, sitesList, currentTag);
transaction.commit();
}
Button nextStep = (Button) findViewById(R.id.login_addsites_nextstep);
nextStep.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
new AsyncTask<Void, Void, Void>() {
@Override
protected Void doInBackground(Void... params) {
final ArrayList<String> categories = sitesList.getSelectedCategories();
Log.d(TAG, "Returned response to adding sites: " + apiManager.addCategories(categories));
return null;
}
}.execute();
Intent i = new Intent(AddSites.this, AddSocial.class);
startActivity(i);
}
});
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent i) {
if (resultCode == RESULT_OK) {
sitesList.setGoogleReaderImported();
}
}
}

View file

@ -0,0 +1,56 @@
package com.newsblur.activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import com.actionbarsherlock.app.SherlockFragmentActivity;
import com.newsblur.R;
import com.newsblur.fragment.AddSocialFragment;
public class AddSocial extends SherlockFragmentActivity {
private FragmentManager fragmentManager;
private String currentTag = "addSocialFragment";
private AddSocialFragment addSocialFragment;
@Override
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);
setContentView(R.layout.activity_addsocial);
fragmentManager = getSupportFragmentManager();
if (fragmentManager.findFragmentByTag(currentTag) == null) {
FragmentTransaction transaction = fragmentManager.beginTransaction();
addSocialFragment = new AddSocialFragment();
transaction.add(R.id.addsocial_container, addSocialFragment, currentTag);
transaction.commit();
}
Button nextStep = (Button) findViewById(R.id.login_addsocial_nextstep);
nextStep.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
Intent i = new Intent(AddSocial.this, AddFollow.class);
startActivity(i);
}
});
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
switch (resultCode) {
case AddTwitter.TWITTER_AUTHED:
addSocialFragment.setTwitterAuthed();
case AddFacebook.FACEBOOK_AUTHED:
addSocialFragment.setFacebookAuthed();
}
}
}

View file

@ -0,0 +1,39 @@
package com.newsblur.activity;
import android.os.Bundle;
import android.text.TextUtils;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import com.actionbarsherlock.app.SherlockFragmentActivity;
import com.newsblur.R;
public class AddTwitter extends SherlockFragmentActivity {
public static final int TWITTER_AUTHED = 0x20;
private WebView webview;
@Override
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);
setContentView(R.layout.activity_webcontainer);
webview = (WebView) findViewById(R.id.webcontainer);
webview.getSettings().setJavaScriptEnabled(true);
webview.setWebViewClient(new WebViewClient() {
public boolean shouldOverrideUrlLoading(WebView view, String url){
if (TextUtils.equals(url, "http://www.newsblur.com/")) {
AddTwitter.this.setResult(TWITTER_AUTHED);
AddTwitter.this.finish();
return true;
}
view.loadUrl(url);
return false;
}
});
webview.loadUrl("http://www.newsblur.com/oauth/twitter_connect/");
}
}

View file

@ -25,9 +25,7 @@ public class AllStoriesReading extends Reading {
private int neutralCount;
private int positiveCount;
private int currentPage;
private boolean requestedPage;
private ArrayList<String> feedIds;
private ArrayList<ContentProviderOperation> storiesToMarkAsReadInternally = new ArrayList<ContentProviderOperation>();
@Override
protected void onCreate(Bundle savedInstanceBundle) {
@ -101,7 +99,6 @@ public class AllStoriesReading extends Reading {
if (loadMore) {
currentPage += 1;
requestedPage = true;
triggerRefresh(currentPage);
} else {
Log.d(TAG, "No need");

View file

@ -0,0 +1,39 @@
package com.newsblur.activity;
import android.os.Bundle;
import android.text.TextUtils;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import com.actionbarsherlock.app.SherlockFragmentActivity;
import com.newsblur.R;
public class ImportFeeds extends SherlockFragmentActivity {
private WebView webContainer;
@Override
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);
setContentView(R.layout.activity_webcontainer);
webContainer = (WebView) findViewById(R.id.webcontainer);
webContainer.getSettings().setJavaScriptEnabled(true);
webContainer.setWebViewClient(new WebViewClient() {
public boolean shouldOverrideUrlLoading(WebView view, String url){
if (TextUtils.equals(url, "http://www.newsblur.com/")) {
ImportFeeds.this.setResult(RESULT_OK);
ImportFeeds.this.finish();
return true;
}
view.loadUrl(url);
return false;
}
});
webContainer.loadUrl("http://www.newsblur.com/import/authorize/");
}
}

View file

@ -10,10 +10,10 @@ import android.util.Log;
import android.view.Window;
import com.newsblur.R;
import com.newsblur.fragment.LoginFragment;
import com.newsblur.fragment.LoginRegisterFragment;
import com.newsblur.util.PrefConstants;
public class Login extends FragmentActivity implements LoginFragment.LoginFragmentInterface {
public class Login extends FragmentActivity {
private FragmentManager fragmentManager;
private final static String currentTag = "currentFragment";
@ -30,29 +30,12 @@ public class Login extends FragmentActivity implements LoginFragment.LoginFragme
if (fragmentManager.findFragmentByTag(currentTag) == null) {
Log.d(TAG, "Adding current new fragment");
FragmentTransaction transaction = fragmentManager.beginTransaction();
LoginFragment login = new LoginFragment();
LoginRegisterFragment login = new LoginRegisterFragment();
transaction.add(R.id.login_container, login, currentTag);
transaction.commit();
}
}
@Override
public void loginSuccessful() {
Log.d(TAG, "Login successful");
}
@Override
public void syncSuccessful() {
Log.d(TAG, "Sync successful");
final Intent mainIntent = new Intent(this, Main.class);
startActivity(mainIntent);
}
@Override
public void loginUnsuccessful() {
Log.d(TAG, "Login unsuccessful");
}
private void preferenceCheck() {
final SharedPreferences preferences = getSharedPreferences(PrefConstants.PREFERENCES, 0);
if (preferences.getString(PrefConstants.PREF_COOKIE, null) != null) {

View file

@ -0,0 +1,38 @@
package com.newsblur.activity;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.util.Log;
import android.view.Window;
import com.newsblur.R;
import com.newsblur.fragment.LoginProgressFragment;
public class LoginProgress extends FragmentActivity {
private FragmentManager fragmentManager;
private String currentTag = "fragment";
private String TAG = "LoginProgressActivity";
@Override
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_loginprogress);
fragmentManager = getSupportFragmentManager();
if (fragmentManager.findFragmentByTag(currentTag ) == null) {
String username = getIntent().getStringExtra("username");
String password = getIntent().getStringExtra("password");
Log.d(TAG , "Adding current new fragment");
FragmentTransaction transaction = fragmentManager.beginTransaction();
LoginProgressFragment login = LoginProgressFragment.getInstance(username, password);
transaction.add(R.id.login_progress_container, login, currentTag);
transaction.commit();
}
}
}

View file

@ -0,0 +1,40 @@
package com.newsblur.activity;
import android.os.Bundle;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.util.Log;
import com.actionbarsherlock.app.SherlockFragmentActivity;
import com.newsblur.R;
import com.newsblur.fragment.RegisterProgressFragment;
public class RegisterProgress extends SherlockFragmentActivity {
private FragmentManager fragmentManager;
private String currentTag = "fragment";
private String TAG = "RegisterProgressActivity";
@Override
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);
setContentView(R.layout.activity_loginprogress);
fragmentManager = getSupportFragmentManager();
if (fragmentManager.findFragmentByTag(currentTag ) == null) {
final String username = getIntent().getStringExtra("username");
final String password = getIntent().getStringExtra("password");
final String email = getIntent().getStringExtra("email");
Log.d(TAG , "Adding current new fragment");
FragmentTransaction transaction = fragmentManager.beginTransaction();
RegisterProgressFragment register = RegisterProgressFragment.getInstance(username, password, email);
transaction.add(R.id.login_progress_container, register, currentTag);
transaction.commit();
}
}
}

View file

@ -0,0 +1,13 @@
package com.newsblur.domain;
import com.google.gson.annotations.SerializedName;
public class Category {
public String title;
public String description;
@SerializedName("feed_ids")
public String[] feedIds;
}

View file

@ -0,0 +1,42 @@
package com.newsblur.fragment;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import com.newsblur.R;
public class AddFollowFragment extends Fragment {
boolean followingNewsblur, followingPopular;
private View parentView;
private LinearLayout followingNewsblurButton, followingPopularButton;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
parentView = inflater.inflate(R.layout.fragment_addfollow, null);
followingNewsblurButton = (LinearLayout) parentView.findViewById(R.id.addfollow_newsblur);
followingPopularButton = (LinearLayout) parentView.findViewById(R.id.addfollow_popular);
setupUI();
return parentView;
}
private void setupUI() {
if (followingNewsblur) {
}
if (followingPopular) {
}
}
}

View file

@ -0,0 +1,160 @@
package com.newsblur.fragment;
import java.util.ArrayList;
import java.util.HashSet;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.text.TextUtils;
import android.util.Base64;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.newsblur.R;
import com.newsblur.activity.ImportFeeds;
import com.newsblur.domain.Category;
import com.newsblur.domain.Feed;
import com.newsblur.network.APIManager;
import com.newsblur.network.domain.CategoriesResponse;
public class AddSitesListFragment extends Fragment {
private Button importReaderButton;
private CategoriesResponse response;
private APIManager apiManager;
private View parentView;
private boolean readerImported = false;
HashSet<String> categoriesToAdd = new HashSet<String>();
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setRetainInstance(true);
apiManager = new APIManager(getActivity());
}
public ArrayList<String> getSelectedCategories() {
ArrayList<String> categoriesArrayList = new ArrayList<String>();
categoriesArrayList.addAll(categoriesToAdd);
return categoriesArrayList;
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
parentView = inflater.inflate(R.layout.fragment_addsites, null);
importReaderButton = (Button) parentView.findViewById(R.id.login_add_reader_button);
importReaderButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent i = new Intent(getActivity(), ImportFeeds.class);
startActivityForResult(i, 0);
}
});
if (response == null) {
new AsyncTask<Void, Void, Void>() {
@Override
protected Void doInBackground(Void... params) {
response = apiManager.getCategories();
return null;
}
protected void onPostExecute(Void result) {
setupUI();
};
}.execute();
} else {
setupUI();
}
if (readerImported) {
importReaderButton.setEnabled(false);
importReaderButton.setText("Feeds imported!");
}
return parentView;
}
private void setupUI() {
LayoutInflater inflater = getActivity().getLayoutInflater();
LinearLayout categoryContainer = (LinearLayout) parentView.findViewById(R.id.login_categories_container);
parentView.findViewById(R.id.login_categories_progress).setVisibility(View.GONE);
for (final Category category : response.categories) {
LinearLayout categoryView = (LinearLayout) inflater.inflate(R.layout.include_category, null);
TextView categoryTitle = (TextView) categoryView.findViewById(R.id.category_title);
CheckBox categoryCheckbox = (CheckBox) categoryView.findViewById(R.id.category_checkbox);
categoryCheckbox.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) {
categoriesToAdd.add(category.title);
} else {
categoriesToAdd.remove(category.title);
}
}
});
categoryCheckbox.setChecked(categoriesToAdd.contains(category.title));
categoryTitle.setText(category.title);
for (String feedId : category.feedIds) {
Feed feed = response.feeds.get(feedId);
View feedView = inflater.inflate(R.layout.merge_category_feed, null);
TextView feedTitle = (TextView) feedView.findViewById(R.id.login_category_feed_title);
feedTitle.setText(feed.title);
View borderOne = feedView.findViewById(R.id.login_category_feed_leftbar);
View borderTwo = feedView.findViewById(R.id.login_category_feed_rightbar);
if (!TextUtils.isEmpty(feed.faviconColour) && !TextUtils.equals(feed.faviconColour, "null")) {
borderOne.setBackgroundColor(Color.parseColor("#".concat(feed.faviconColour)));
borderTwo.setBackgroundColor(Color.parseColor("#".concat(feed.faviconColour)));
} else {
borderOne.setBackgroundColor(Color.LTGRAY);
borderTwo.setBackgroundColor(Color.LTGRAY);
}
Bitmap bitmap = null;
if (!TextUtils.isEmpty(feed.favicon)) {
final byte[] data = Base64.decode(feed.favicon, Base64.DEFAULT);
bitmap = BitmapFactory.decodeByteArray(data, 0, data.length);
} else {
bitmap = BitmapFactory.decodeResource(getActivity().getResources(), R.drawable.world);
}
((ImageView) feedView.findViewById(R.id.login_category_feed_icon)).setImageBitmap(bitmap);
categoryView.addView(feedView);
}
categoryContainer.addView(categoryView);
}
}
public void setGoogleReaderImported() {
readerImported = true;
importReaderButton.setEnabled(false);
importReaderButton.setText("Feeds imported successfully!");
}
}

View file

@ -0,0 +1,119 @@
package com.newsblur.fragment;
import java.util.HashSet;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.newsblur.R;
import com.newsblur.activity.AddFacebook;
import com.newsblur.activity.AddTwitter;
import com.newsblur.network.APIManager;
public class AddSocialFragment extends Fragment {
private APIManager apiManager;
private View parentView;
HashSet<String> categoriesToAdd = new HashSet<String>();
private LinearLayout twitterButton, facebookButton;
private CheckBox autofollow;
private boolean twitterAuthed, facebookAuthed;
private TextView twitterText;
private TextView facebookText;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setRetainInstance(true);
apiManager = new APIManager(getActivity());
}
public void setTwitterAuthed() {
twitterAuthed = true;
authCheck();
}
public void setFacebookAuthed() {
facebookAuthed = true;
authCheck();
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
parentView = inflater.inflate(R.layout.fragment_addsocial, null);
twitterButton = (LinearLayout) parentView.findViewById(R.id.addsocial_twitter);
twitterText = (TextView) parentView.findViewById(R.id.addsocial_twitter_text);
twitterButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
Intent i = new Intent(getActivity(), AddTwitter.class);
startActivityForResult(i, 0);
}
});
facebookButton = (LinearLayout) parentView.findViewById(R.id.addsocial_facebook);
facebookButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
Intent i = new Intent(getActivity(), AddFacebook.class);
startActivityForResult(i, 0);
}
});
authCheck();
facebookText = (TextView) parentView.findViewById(R.id.addsocial_facebook_text);
autofollow = (CheckBox) parentView.findViewById(R.id.addsocial_autofollow_checkbox);
autofollow.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, final boolean checked) {
new AsyncTask<Void, Void, Boolean>() {
@Override
protected Boolean doInBackground(Void... params) {
return apiManager.setAutoFollow(checked);
}
@Override
protected void onPostExecute(Boolean result) {
Toast.makeText(getActivity(), "SetPreference: " + result.toString(), Toast.LENGTH_LONG).show();
};
}.execute();
}
});
return parentView;
}
private void authCheck() {
if (twitterAuthed) {
twitterText.setText("Added Twitter friends!");
twitterButton.setEnabled(false);
}
if (facebookAuthed) {
facebookText.setText("Added Facebook friends!");
facebookButton.setEnabled(false);
}
}
}

View file

@ -1,5 +1,14 @@
package com.newsblur.fragment;
import com.newsblur.R;
import com.newsblur.activity.Main;
import com.newsblur.network.APIManager;
import com.newsblur.network.domain.LoginResponse;
import com.newsblur.service.DetachableResultReceiver;
import com.newsblur.service.SyncService;
import com.newsblur.service.DetachableResultReceiver.Receiver;
import com.newsblur.util.PrefsUtil;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
@ -8,73 +17,40 @@ import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.Animation.AnimationListener;
import android.view.animation.AnimationUtils;
import android.widget.Button;
import android.widget.EditText;
import android.view.animation.Animation.AnimationListener;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.ViewSwitcher;
import com.newsblur.R;
import com.newsblur.activity.Main;
import com.newsblur.network.APIManager;
import com.newsblur.network.domain.LoginResponse;
import com.newsblur.service.DetachableResultReceiver;
import com.newsblur.service.DetachableResultReceiver.Receiver;
import com.newsblur.service.SyncService;
import com.newsblur.util.PrefsUtil;
public class LoginProgressFragment extends Fragment implements Receiver {
public class LoginFragment extends Fragment implements OnClickListener, Receiver {
private static final String TAG = "LoginFragment";
private String VIEWSWITCHER_CHILD = "viewSwitcherChild";
public APIManager apiManager;
private EditText username, password;
private ViewSwitcher viewSwitcher;
private LoginTask loginTask;
private SignupTask signupTask;
DetachableResultReceiver receiver;
private APIManager apiManager;
private DetachableResultReceiver receiver;
private String TAG = "LoginProgress";
private TextView updateStatus, retrievingFeeds, letsGo;
private ImageView loginProfilePicture;
private int CURRENT_STATUS = -1;
private ProgressBar feedProgress;
private LoginTask loginTask;
private String username;
private String password;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
final View v = inflater.inflate(R.layout.fragment_loginregister, container, false);
Log.d(TAG, "Creating login fragment view");
final Button loginButton = (Button) v.findViewById(R.id.login_button);
final Button signupButton = (Button) v.findViewById(R.id.login_signup);
loginButton.setOnClickListener(this);
signupButton.setOnClickListener(this);
viewSwitcher = (ViewSwitcher) v.findViewById(R.id.login_viewswitcher);
updateStatus = (TextView) v.findViewById(R.id.login_logging_in);
retrievingFeeds = (TextView) v.findViewById(R.id.login_retrieving_feeds);
letsGo = (TextView) v.findViewById(R.id.login_lets_go);
username = (EditText) v.findViewById(R.id.login_username);
password = (EditText) v.findViewById(R.id.login_password);
feedProgress = (ProgressBar) v.findViewById(R.id.login_feed_progress);
loginProfilePicture = (ImageView) v.findViewById(R.id.login_profile_picture);
// password.setOnEditorActionListener(this);
if (loginTask != null) {
loginTask.viewSwitcher = viewSwitcher;
viewSwitcher.setDisplayedChild(1);
refreshUI();
}
return v;
public static LoginProgressFragment getInstance(String username, String password) {
LoginProgressFragment fragment = new LoginProgressFragment();
Bundle bundle = new Bundle();
bundle.putString("username", username);
bundle.putString("password", password);
fragment.setArguments(bundle);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@ -82,57 +58,46 @@ public class LoginFragment extends Fragment implements OnClickListener, Receiver
apiManager = new APIManager(getActivity());
receiver = new DetachableResultReceiver(new Handler());
receiver.setReceiver(this);
Log.d(TAG, "Creating new fragment instance");
Log.d(TAG , "Creating new fragment instance");
username = getArguments().getString("username");
password = getArguments().getString("password");
}
@Override
public void onClick(View viewClicked) {
switch (viewClicked.getId()) {
case R.id.login_button:
logIn();
break;
case R.id.login_signup:
signUp();
break;
}
}
private void logIn() {
loginTask = new LoginTask();
loginTask.viewSwitcher = viewSwitcher;
loginTask.execute(username.getText().toString(), password.getText().toString());
}
private void signUp() {
signupTask = new SignupTask();
signupTask.execute(username.getText().toString(), password.getText().toString());
}
@Override
public void onSaveInstanceState(Bundle outState) {
outState.putInt(VIEWSWITCHER_CHILD , viewSwitcher.getDisplayedChild());
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_loginprogress, null);
updateStatus = (TextView) v.findViewById(R.id.login_logging_in);
retrievingFeeds = (TextView) v.findViewById(R.id.login_retrieving_feeds);
letsGo = (TextView) v.findViewById(R.id.login_lets_go);
feedProgress = (ProgressBar) v.findViewById(R.id.login_feed_progress);
loginProfilePicture = (ImageView) v.findViewById(R.id.login_profile_picture);
// password.setOnEditorActionListener(this);
if (loginTask != null) {
loginTask.viewSwitcher = null;
refreshUI();
} else {
loginTask = new LoginTask();
loginTask.execute();
}
super.onSaveInstanceState(outState);
return v;
}
private class LoginTask extends AsyncTask<String, Void, LoginResponse> {
private static final String TAG = "LoginTask";
public ViewSwitcher viewSwitcher;
@Override
protected void onPreExecute() {
viewSwitcher.showNext();
Animation a = AnimationUtils.loadAnimation(getActivity(), R.anim.text_up);
updateStatus.startAnimation(a);
}
@Override
protected LoginResponse doInBackground(String... params) {
final String username = params[0];
final String password = params[1];
LoginResponse response = apiManager.login(username, password);
apiManager.updateUserProfile();
try {
@ -165,9 +130,7 @@ public class LoginFragment extends Fragment implements OnClickListener, Receiver
intent.putExtra(SyncService.SYNCSERVICE_TASK, SyncService.EXTRA_TASK_FOLDER_UPDATE);
getActivity().startService(intent);
} else {
if (viewSwitcher != null) {
viewSwitcher.showPrevious();
if (result.errors != null && result.errors.message != null) {
if (result.errors != null && result.errors.message != null) {
Toast.makeText(getActivity(), result.errors.message[0], Toast.LENGTH_LONG).show();
} else {
Toast.makeText(getActivity(), getResources().getString(R.string.login_message_error), Toast.LENGTH_LONG).show();
@ -175,7 +138,6 @@ public class LoginFragment extends Fragment implements OnClickListener, Receiver
}
}
}
}
private void refreshUI() {
@ -212,20 +174,7 @@ public class LoginFragment extends Fragment implements OnClickListener, Receiver
break;
}
}
private class SignupTask extends AsyncTask<String, Void, Void> {
// TODO: Finish handling feed import, content choice, when API endpoints are in place
@Override
protected Void doInBackground(String... params) {
final String username = params[0];
final String password = params[1];
LoginResponse response = apiManager.signup(username, password);
return null;
}
}
// Interface for Host
public interface LoginFragmentInterface {
@ -240,4 +189,5 @@ public class LoginFragment extends Fragment implements OnClickListener, Receiver
CURRENT_STATUS = resultCode;
refreshUI();
}
}

View file

@ -0,0 +1,106 @@
package com.newsblur.fragment;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.ViewSwitcher;
import com.newsblur.R;
import com.newsblur.activity.LoginProgress;
import com.newsblur.activity.RegisterProgress;
import com.newsblur.network.APIManager;
import com.newsblur.service.DetachableResultReceiver;
public class LoginRegisterFragment extends Fragment implements OnClickListener {
private static final String TAG = "LoginFragment";
public APIManager apiManager;
private EditText username, password;
private ViewSwitcher viewSwitcher;
DetachableResultReceiver receiver;
private EditText register_username, register_password, register_email;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
final View v = inflater.inflate(R.layout.fragment_loginregister, container, false);
final Button loginButton = (Button) v.findViewById(R.id.login_button);
final Button registerButton = (Button) v.findViewById(R.id.registration_button);
loginButton.setOnClickListener(this);
registerButton.setOnClickListener(this);
username = (EditText) v.findViewById(R.id.login_username);
password = (EditText) v.findViewById(R.id.login_password);
register_username = (EditText) v.findViewById(R.id.registration_username);
register_password = (EditText) v.findViewById(R.id.registration_password);
register_email = (EditText) v.findViewById(R.id.registration_email);
viewSwitcher = (ViewSwitcher) v.findViewById(R.id.login_viewswitcher);
TextView changeToLogin = (TextView) v.findViewById(R.id.login_change_to_login);
TextView changeToRegister = (TextView) v.findViewById(R.id.login_change_to_register);
changeToLogin.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
viewSwitcher.showPrevious();
}
});
changeToRegister.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
viewSwitcher.showNext();
}
});
return v;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public void onClick(View viewClicked) {
switch (viewClicked.getId()) {
case R.id.login_button:
logIn();
break;
case R.id.registration_button:
signUp();
break;
}
}
private void logIn() {
Intent i = new Intent(getActivity(), LoginProgress.class);
i.putExtra("username", username.getText().toString());
i.putExtra("password", password.getText().toString());
startActivity(i);
}
private void signUp() {
Intent i = new Intent(getActivity(), RegisterProgress.class);
i.putExtra("username", register_username.getText().toString());
i.putExtra("password", register_password.getText().toString());
i.putExtra("email", register_email.getText().toString());
startActivity(i);
}
}

View file

@ -0,0 +1,111 @@
package com.newsblur.fragment;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.Toast;
import android.widget.ViewSwitcher;
import com.newsblur.R;
import com.newsblur.activity.AddSites;
import com.newsblur.network.APIManager;
import com.newsblur.network.domain.LoginResponse;
public class RegisterProgressFragment extends Fragment {
private APIManager apiManager;
private String TAG = "LoginProgress";
private String username;
private String password;
private String email;
private RegisterTask registerTask;
private ViewSwitcher switcher;
private Button next;
public static RegisterProgressFragment getInstance(String username, String password, String email) {
RegisterProgressFragment fragment = new RegisterProgressFragment();
Bundle bundle = new Bundle();
bundle.putString("username", username);
bundle.putString("password", password);
bundle.putString("email", email);
fragment.setArguments(bundle);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setRetainInstance(true);
apiManager = new APIManager(getActivity());
Log.d(TAG , "Creating new fragment instance");
username = getArguments().getString("username");
password = getArguments().getString("password");
email = getArguments().getString("email");
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_registerprogress, null);
switcher = (ViewSwitcher) v.findViewById(R.id.register_viewswitcher);
next = (Button) v.findViewById(R.id.registering_next_1);
if (registerTask != null) {
switcher.showNext();
} else {
registerTask = new RegisterTask();
registerTask.execute();
}
next.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
Intent i = new Intent(getActivity(), AddSites.class);
startActivity(i);
}
});
return v;
}
private class RegisterTask extends AsyncTask<Void, Void, LoginResponse> {
@Override
protected LoginResponse doInBackground(Void... params) {
try {
// We include this wait simply as a small UX convenience. Otherwise the user could be met with a disconcerting flicker when attempting to register and failing.
Thread.sleep(700);
} catch (InterruptedException e) {
Log.d(TAG, "Error sleeping during login.");
}
return apiManager.signup(username, password, email);
}
@Override
protected void onPostExecute(LoginResponse response) {
if (response.authenticated) {
switcher.showNext();
} else {
if (response.errors != null && response.errors.message != null) {
Toast.makeText(getActivity(), response.errors.message[0], Toast.LENGTH_LONG).show();
} else {
Toast.makeText(getActivity(), getResources().getString(R.string.login_message_error), Toast.LENGTH_LONG).show();
}
getActivity().finish();
}
}
}
}

View file

@ -47,7 +47,7 @@ public class APIClient {
}
return extractResponse(urlFeeds, connection);
} catch (IOException e) {
Log.d(TAG, "Error opening GET connection to " + urlString, e.getCause());
Log.e(TAG, "Error opening GET connection to " + urlString, e.getCause());
return new APIResponse();
} finally {
connection.disconnect();
@ -82,7 +82,7 @@ public class APIClient {
}
return extractResponse(urlFeeds, connection);
} catch (IOException e) {
Log.d(TAG, "Error opening GET connection to " + urlString, e.getCause());
Log.e(TAG, "Error opening GET connection to " + urlString, e.getCause());
return new APIResponse();
} finally {
connection.disconnect();
@ -109,7 +109,7 @@ public class APIClient {
}
return extractResponse(urlFeeds, connection);
} catch (IOException e) {
Log.d(TAG, "Error opening GET connection to " + urlString, e.getCause());
Log.e(TAG, "Error opening GET connection to " + urlString, e.getCause());
return new APIResponse();
} finally {
connection.disconnect();
@ -149,7 +149,7 @@ public class APIClient {
parameters.add(builder.toString());
}
final String parameterString = TextUtils.join("&", parameters);
Log.d(TAG, "Parameter string: " + parameterString);
try {
final URL url = new URL(urlString);
connection = (HttpURLConnection) url.openConnection();
@ -198,7 +198,7 @@ public class APIClient {
connection.setDoOutput(true);
connection.setRequestMethod("POST");
String parameterString = jsonIfy ? valueMap.getJsonString() : valueMap.getParameterString();
Log.d(TAG, "Parameter string: " + parameterString);
connection.setFixedLengthStreamingMode(parameterString.getBytes().length);
connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");

View file

@ -38,6 +38,8 @@ public class APIConstants {
public static final String PARAMETER_PASSWORD = "password";
public static final String PARAMETER_USER_ID = "user_id";
public static final String PARAMETER_USERNAME = "username";
public static final String PARAMETER_EMAIL = "email";
public static final String PARAMETER_USERID = "user_id";
public static final String PARAMETER_STORYID = "story_id";
public static final String PARAMETER_FEEDS_STORIES = "feeds_stories";
@ -56,9 +58,9 @@ public class APIConstants {
public static final String PARAMETER_PAGE_NUMBER = "page";
public static final String NEWSBLUR_URL = "http://www.newsblur.com";
public static final String URL_CATEGORIES = "http://www.newsblur.com/categories/" ;
public static final String PARAMETER_CATEGORY = "category";
public static final String URL_ADD_CATEGORIES = "http://www.newsblur.com/categories/subscribe";
public static final String URL_AUTOFOLLOW_PREF = "http://www.newsblur.com/profile/set_preference";
}

View file

@ -11,9 +11,10 @@ import android.content.ContentResolver;
import android.content.ContentValues;
import android.content.Context;
import android.net.Uri;
import android.os.AsyncTask;
import android.text.TextUtils;
import android.util.Log;
import android.webkit.CookieManager;
import android.webkit.CookieSyncManager;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
@ -28,6 +29,7 @@ import com.newsblur.domain.Reply;
import com.newsblur.domain.SocialFeed;
import com.newsblur.domain.Story;
import com.newsblur.domain.ValueMultimap;
import com.newsblur.network.domain.CategoriesResponse;
import com.newsblur.network.domain.FeedFolderResponse;
import com.newsblur.network.domain.FeedRefreshResponse;
import com.newsblur.network.domain.LoginResponse;
@ -66,6 +68,24 @@ public class APIManager {
return new LoginResponse();
}
}
public boolean setAutoFollow(boolean autofollow) {
final APIClient client = new APIClient(context);
ContentValues values = new ContentValues();
values.put("autofollow_friends", autofollow ? "true" : "false");
final APIResponse response = client.post(APIConstants.URL_AUTOFOLLOW_PREF, values);
return (response.responseCode == HttpStatus.SC_OK && !response.hasRedirected);
}
public boolean addCategories(ArrayList<String> categories) {
final APIClient client = new APIClient(context);
final ValueMultimap values = new ValueMultimap();
for (String category : categories) {
values.put(APIConstants.PARAMETER_CATEGORY, category);
}
final APIResponse response = client.post(APIConstants.URL_ADD_CATEGORIES, values, false);
return (response.responseCode == HttpStatus.SC_OK && !response.hasRedirected);
}
public boolean markFeedAsRead(final String[] feedIds) {
final APIClient client = new APIClient(context);
@ -107,16 +127,34 @@ public class APIManager {
return false;
}
}
public CategoriesResponse getCategories() {
final APIClient client = new APIClient(context);
final APIResponse response = client.get(APIConstants.URL_CATEGORIES);
if (!response.isOffline && response.responseCode == HttpStatus.SC_OK && !response.hasRedirected) {
return gson.fromJson(response.responseString, CategoriesResponse.class);
} else {
return null;
}
}
public LoginResponse signup(final String username, final String password) {
public LoginResponse signup(final String username, final String password, final String email) {
final APIClient client = new APIClient(context);
final ContentValues values = new ContentValues();
values.put(APIConstants.PARAMETER_USERNAME, username);
values.put(APIConstants.PARAMETER_PASSWORD, password);
values.put(APIConstants.PARAMETER_EMAIL, email);
final APIResponse response = client.post(APIConstants.URL_SIGNUP, values);
if (response.responseCode == HttpStatus.SC_OK && !response.hasRedirected) {
LoginResponse loginResponse = gson.fromJson(response.responseString, LoginResponse.class);
PrefsUtil.saveCookie(context, response.cookie);
CookieSyncManager.createInstance(context.getApplicationContext());
CookieManager cookieManager = CookieManager.getInstance();
cookieManager.setCookie(".newsblur.com", response.cookie);
CookieSyncManager.getInstance().sync();
return loginResponse;
} else {
return new LoginResponse();

View file

@ -0,0 +1,18 @@
package com.newsblur.network.domain;
import java.util.HashMap;
import com.google.gson.annotations.SerializedName;
import com.newsblur.domain.Category;
import com.newsblur.domain.Feed;
public class CategoriesResponse {
@SerializedName("feeds")
public HashMap<String, Feed> feeds;
@SerializedName("categories")
public Category[] categories;
}

View file

@ -5,7 +5,6 @@ import java.util.Map;
import com.google.gson.annotations.SerializedName;
import com.newsblur.domain.Feed;
import com.newsblur.domain.FolderStructure;
import com.newsblur.domain.SocialFeed;
public class FeedFolderResponse {

View file

@ -4,6 +4,11 @@ public class AppConstants {
public static final int STATE_ALL = 0;
public static final int STATE_SOME = 1;
public static final int STATE_BEST = 2;
public static final int REGISTRATION_DEFAULT = 0;
public static final int REGISTRATION_STARTED = 1;
public static final int REGISTRATION_COMPLETED = 1;
public static final String NEWSBLUR_URL = "http://newsblur.com";
public static final String FOLDER_PRE = "folder_collapsed";

View file

@ -21,6 +21,9 @@ public class PrefConstants {
public final static String USER_FOLLOWING_COUNT = "following_count";
public final static String USER_SUBSCRIBER_COUNT = "subscribers_count";
public final static String USER_SHARED_STORIES_COUNT = "shared_stories_count";
public static final String PREFERENCE_TEXT_SIZE = "default_reading_text_size";
public static final String PREFERENCE_REGISTRATION_STATE = "registration_stage";
}