mirror of
https://github.com/viq/NewsBlur.git
synced 2025-09-18 21:43:31 +00:00
Merge branch 'android' of github.com:samuelclay/NewsBlur into android
* 'android' of github.com:samuelclay/NewsBlur: (22 commits) Fixed incorrect user image in activities adapter. Added headers for public and friend comments. Modified story intelligence formula. Fixed formatting issue with strings. Added flag to ensure text was sentence-capitalised for comments/replies. Bumped version number. Removed further debug logging. Modified count requirements for itemlist requests. Removed debug logging. Optimised layouts for readability. Removed minor rounding issues with comment-liked images. Fixed issue whereby when reading in feedReading, older pages would deleted due to passed parameter Fixed bug whereby the first story in a social feed wasn't marked as read internally. Bumped version number. Modified login process to redirect to logging in if using the registration form and login exists. Fixed login form layout. Bumped text-size Fixed bug whereby Shared Stories count would feature a zero-value in cases where pos or neutral counts were not Fixed crash due to misplaced network call on main thread Fixed crash on first load when new feeds have just been added. Added 'Delete feed' to feed item list menu Fixed feed refresh issues, FTUX UI issues. Fixed various issues as per feedback Fixed count issue where read counts updates were not unique for feed values ...
This commit is contained in:
commit
8b88aa68e5
99 changed files with 1390 additions and 1123 deletions
|
@ -1,8 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.newsblur"
|
||||
android:versionCode="8"
|
||||
android:versionName="0.9.27" >
|
||||
android:versionCode="16"
|
||||
android:versionName="0.9.57" >
|
||||
|
||||
<uses-sdk
|
||||
android:minSdkVersion="8"
|
||||
|
@ -20,7 +20,9 @@
|
|||
|
||||
<activity
|
||||
android:name=".activity.Login"
|
||||
android:label="@string/newsblur">
|
||||
android:label="@string/newsblur"
|
||||
android:noHistory="true"
|
||||
android:windowSoftInputMode="adjustResize">
|
||||
<intent-filter>
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
@ -29,6 +31,7 @@
|
|||
|
||||
<activity
|
||||
android:name=".activity.LoginProgress"
|
||||
android:noHistory="true"
|
||||
android:label="@string/newsblur" />
|
||||
|
||||
<activity
|
||||
|
|
9
media/android/NewsBlur/res/anim/rotate.xml
Normal file
9
media/android/NewsBlur/res/anim/rotate.xml
Normal file
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:duration="60000"
|
||||
android:fromDegrees="0"
|
||||
android:interpolator="@android:anim/linear_interpolator"
|
||||
android:pivotX="50%"
|
||||
android:pivotY="50%"
|
||||
android:repeatCount="infinite"
|
||||
android:toDegrees="359" />
|
7
media/android/NewsBlur/res/drawable/divider_folder.xml
Normal file
7
media/android/NewsBlur/res/drawable/divider_folder.xml
Normal 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" >
|
||||
<size android:height="1dp"/>
|
||||
<solid android:color="#ff0000" />
|
||||
|
||||
</shape>
|
BIN
media/android/NewsBlur/res/drawable/login_background.png
Normal file
BIN
media/android/NewsBlur/res/drawable/login_background.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 57 KiB |
|
@ -4,9 +4,30 @@
|
|||
android:layout_height="match_parent"
|
||||
android:background="@color/item_background" >
|
||||
|
||||
|
||||
<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>
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" >
|
||||
android:layout_height="match_parent"
|
||||
android:layout_above="@id/addsites_button_bar" >
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
@ -37,24 +58,6 @@
|
|||
</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"
|
||||
|
|
|
@ -1,28 +1,39 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/item_background" >
|
||||
android:background="@drawable/login_background"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="30dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/login_logo"
|
||||
android:layout_width="wrap_content"
|
||||
<LinearLayout
|
||||
android:id="@+id/login_logo_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="40dp"
|
||||
android:contentDescription="@string/description_login_logo"
|
||||
android:src="@drawable/logo_newsblur_blur" />
|
||||
android:paddingTop="20dp"
|
||||
android:paddingBottom="25dp"
|
||||
android:background="@color/item_background"
|
||||
android:gravity="center_horizontal" >
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/login_logo"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@string/description_login_logo"
|
||||
android:src="@drawable/logo_newsblur_blur" />
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_height="2dp"
|
||||
android:layout_width="match_parent"
|
||||
android:background="@color/lightgray" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/login_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_below="@+id/login_logo"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="50dp"
|
||||
android:gravity="center"
|
||||
android:padding="30dp" />
|
||||
android:paddingLeft="30dp"
|
||||
android:paddingRight="30dp" />
|
||||
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
|
@ -2,7 +2,7 @@
|
|||
<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" >
|
||||
android:background="@drawable/login_background" >
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/login_progress_container"
|
||||
|
|
|
@ -21,24 +21,25 @@
|
|||
android:layout_gravity="center_vertical"
|
||||
android:layout_margin="20dp"
|
||||
android:background="@drawable/newsblur_background"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
android:padding="5dp" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/addfollow_newsblur_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginRight="10dp"
|
||||
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" />
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="right" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
|
@ -48,8 +49,8 @@
|
|||
android:layout_below="@id/addfollow_newsblur"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_margin="20dp"
|
||||
android:gravity="center"
|
||||
android:background="@drawable/newsblur_background"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
android:padding="5dp" >
|
||||
|
||||
|
@ -57,16 +58,17 @@
|
|||
android:id="@+id/addfollow_popular_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginRight="10dp"
|
||||
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" />
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="right" />
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
|
@ -18,8 +18,9 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="10dp"
|
||||
android:gravity="center_horizontal"
|
||||
android:text="@string/login_add_sites_from_google_reader"
|
||||
android:textColor="@color/lightgray"
|
||||
android:textColor="@color/darkgray"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<LinearLayout
|
||||
|
|
|
@ -8,10 +8,11 @@
|
|||
android:id="@+id/addsocial_connect_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="30dp"
|
||||
android:layout_margin="20dp"
|
||||
android:text="@string/connect_with_your_friends"
|
||||
android:textColor="@color/darkgray"
|
||||
android:textSize="16sp" />
|
||||
android:textSize="18sp"
|
||||
android:gravity="center" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/addsocial_twitter"
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
android:layout_below="@id/dialog_message"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:inputType="textCapSentences"
|
||||
android:hint="@string/share_comment_hint"
|
||||
android:textSize="11sp" />
|
||||
|
||||
|
|
|
@ -3,7 +3,5 @@
|
|||
android:id="@+id/folderfeed_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:dividerHeight="1px"
|
||||
android:childDivider="@drawable/divider_light"
|
||||
android:background="@drawable/list_background"
|
||||
/>
|
||||
android:divider="@null"
|
||||
android:background="@drawable/list_background" />
|
|
@ -24,14 +24,24 @@
|
|||
android:textColor="@color/white"
|
||||
android:textSize="16dp" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/login_logging_in_progress"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginRight="15dp"
|
||||
android:layout_toLeftOf="@id/login_logging_in"
|
||||
android:indeterminateOnly="true"
|
||||
android:visibility="visible" />
|
||||
|
||||
<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" />
|
||||
android:visibility="gone"
|
||||
android:layout_toLeftOf="@id/login_logging_in" />
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<?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"
|
||||
|
@ -10,114 +9,141 @@
|
|||
<RelativeLayout
|
||||
android:id="@+id/login_form"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="fill_parent" >
|
||||
android:layout_height="match_parent" >
|
||||
|
||||
<EditText
|
||||
android:id="@+id/login_username"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/login_username_hint"
|
||||
android:inputType="textEmailAddress"
|
||||
android:textSize="22dp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/login_password"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/login_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" />
|
||||
|
||||
|
||||
<Button
|
||||
android:id="@+id/login_button"
|
||||
android:layout_width="120dp"
|
||||
<LinearLayout
|
||||
android:id="@+id/login_button_container"
|
||||
android:layout_width="match_parent"
|
||||
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_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" />
|
||||
|
||||
android:orientation="horizontal" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/login_change_to_register"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="left"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center_vertical"
|
||||
android:text="@string/need_to_register"
|
||||
android:textColor="@color/lightorange"
|
||||
android:textSize="15sp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/login_button"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="right|center_vertical"
|
||||
android:contentDescription="@string/description_login_button"
|
||||
android:text="@string/login_button_login" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/login_field_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_above="@id/login_button_container"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<EditText
|
||||
android:id="@+id/login_username"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/login_username_hint"
|
||||
android:inputType="textEmailAddress"
|
||||
android:textColor="@color/white"
|
||||
android:textColorHint="@color/lightorange"
|
||||
android:textSize="22dp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/login_password"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="40dp"
|
||||
android:hint="@string/login_password_hint"
|
||||
android:imeOptions="actionDone"
|
||||
android:inputType="textPassword"
|
||||
android:nextFocusDown="@+id/login_button"
|
||||
android:textColor="@color/white"
|
||||
android:textColorHint="@color/lightorange"
|
||||
android:textSize="22dp" />
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/registration_form"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="fill_parent">
|
||||
<RelativeLayout
|
||||
android:id="@+id/registration_form"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" >
|
||||
|
||||
<EditText
|
||||
android:id="@+id/registration_username"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/login_username_hint"
|
||||
android:inputType="textEmailAddress"
|
||||
android:textSize="22dp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/registration_password"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="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_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"
|
||||
<LinearLayout
|
||||
android:id="@+id/registration_button_container"
|
||||
android:layout_width="match_parent"
|
||||
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" />
|
||||
android:orientation="horizontal" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/login_change_to_login"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/need_to_login"
|
||||
android:textColor="@color/lightorange"
|
||||
android:textSize="15sp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/registration_button"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="right|center_vertical"
|
||||
android:contentDescription="@string/description_login_button"
|
||||
android:text="@string/login_registration_register" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_above="@id/registration_button_container"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="vertical">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/registration_username"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/login_username_hint"
|
||||
android:inputType="textEmailAddress"
|
||||
android:textColor="@color/white"
|
||||
android:textColorHint="@color/lightorange"
|
||||
android:textSize="22dp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/registration_password"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="40dp"
|
||||
android:hint="@string/login_password_hint"
|
||||
android:inputType="textPassword"
|
||||
android:nextFocusDown="@+id/registration_email"
|
||||
android:textColor="@color/white"
|
||||
android:textColorHint="@color/lightorange"
|
||||
android:textSize="22dp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/registration_email"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="40dp"
|
||||
android:hint="@string/login_registration_email_hint"
|
||||
android:imeOptions="actionDone"
|
||||
android:inputType="textEmailAddress"
|
||||
android:nextFocusDown="@+id/registration_button"
|
||||
android:textColor="@color/white"
|
||||
android:textColorHint="@color/lightorange"
|
||||
android:textSize="22dp" />
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
</ViewSwitcher>
|
|
@ -10,160 +10,22 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal" >
|
||||
|
||||
<View
|
||||
android:id="@+id/row_item_favicon_borderbar_1"
|
||||
android:layout_width="8dp"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<View
|
||||
android:id="@+id/row_item_favicon_borderbar_2"
|
||||
android:layout_width="8dp"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp" >
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/reading_feed_icon"
|
||||
android:layout_width="17dp"
|
||||
android:layout_height="17dp"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginRight="5dp"
|
||||
android:contentDescription="@string/description_row_folder_icon" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/reading_feed_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="7dp"
|
||||
android:layout_toRightOf="@id/reading_feed_icon"
|
||||
android:layout_alignParentBottom="@id/reading_feed_icon"
|
||||
android:textColor="@color/newsblur_blue"
|
||||
android:textSize="16dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/reading_item_date"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/reading_feed_title"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:paddingTop="10dp"
|
||||
android:textColor="@color/linkblue"
|
||||
android:textSize="13sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/reading_item_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/reading_item_date"
|
||||
android:layout_marginRight="10dp"
|
||||
android:textColor="@color/darkgray"
|
||||
android:textSize="20sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/reading_item_authors"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_below="@id/reading_item_title"
|
||||
android:layout_marginTop="10dp"
|
||||
android:maxLines="1"
|
||||
android:minWidth="80dp"
|
||||
android:textColor="@color/darkgray"
|
||||
android:textSize="11dp" />
|
||||
|
||||
<com.newsblur.view.FlowLayout
|
||||
android:id="@+id/reading_item_tags"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_below="@id/reading_item_authors"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:layout_marginTop="5dp" />
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
<include layout="@layout/include_reading_item_metadata" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="3dp"
|
||||
android:background="@drawable/divider_light" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/reading_share_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingTop="10dp"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:visibility="gone" >
|
||||
|
||||
<View
|
||||
android:id="@+id/center_filler"
|
||||
android:layout_width="10dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_centerInParent="true" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/comment_by"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="15dp"
|
||||
android:layout_marginRight="5dp"
|
||||
android:textColor="@color/darkgray"
|
||||
android:textSize="12sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/shared_by"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginRight="15dp"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:textColor="@color/darkgray"
|
||||
android:textSize="12sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<com.newsblur.view.FlowLayout
|
||||
android:id="@+id/reading_social_commentimages"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_toLeftOf="@id/center_filler"
|
||||
android:layout_toRightOf="@id/comment_by" />
|
||||
|
||||
<com.newsblur.view.FlowLayout
|
||||
xmlns:newsblur="http://schemas.android.com/apk/res/com.newsblur"
|
||||
android:id="@+id/reading_social_shareimages"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_toLeftOf="@+id/shared_by"
|
||||
newsblur:flow="left"
|
||||
android:layout_toRightOf="@+id/center_filler"/>
|
||||
</RelativeLayout>
|
||||
<include layout="@layout/include_reading_share_bar" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="3dp"
|
||||
android:id="@+id/share_bar_underline"
|
||||
android:visibility="gone"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="3dp"
|
||||
android:layout_marginTop="3dp"
|
||||
android:background="@drawable/divider_light" />
|
||||
android:background="@drawable/divider_light"
|
||||
android:visibility="gone" />
|
||||
|
||||
<com.newsblur.view.NewsblurWebview
|
||||
android:id="@+id/reading_webview"
|
||||
|
@ -174,46 +36,9 @@
|
|||
android:paddingRight="20dp"
|
||||
android:scrollbars="none" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/share_story_button"
|
||||
style="@style/shareButton"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_marginRight="20dp"
|
||||
android:background="@drawable/selector_sharebutton_background"
|
||||
android:padding="10dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:text="@string/share_this" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/reading_shared_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_marginRight="20dp" >
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/reading_friend_comment_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/reading_share_bar"
|
||||
android:orientation="vertical" />
|
||||
|
||||
<View
|
||||
android:id="@+id/comment_divider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="3dp"
|
||||
android:layout_below="@id/reading_friend_comment_container"
|
||||
android:background="@drawable/divider_light" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/reading_public_comment_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/comment_divider"
|
||||
android:orientation="vertical" />
|
||||
</RelativeLayout>
|
||||
<include
|
||||
layout="@layout/include_reading_item_comment" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</com.newsblur.view.NonfocusScrollview>
|
|
@ -33,22 +33,31 @@
|
|||
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
|
||||
<LinearLayout
|
||||
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" />
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center_horizontal" >
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/registerprogress_logo"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="200dp"
|
||||
android:src="@drawable/logo" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/registerprogress_logo"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="20dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/faster_faster"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="18sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<Button
|
||||
android:id="@+id/registering_next_1"
|
||||
|
@ -56,9 +65,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:layout_marginRight="20dp"
|
||||
android:text="Let's go!"
|
||||
android:text="@string/login_lets_go"
|
||||
android:textSize="20sp" />
|
||||
</RelativeLayout>
|
||||
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical" >
|
||||
android:orientation="vertical"
|
||||
android:id="@+id/category_container" >
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res/com.newsblur"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/item_background"
|
||||
|
@ -83,26 +82,16 @@
|
|||
android:layout_toLeftOf="@id/comment_shareddate"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/favourite" />
|
||||
|
||||
<com.newsblur.view.FlowLayout
|
||||
xmlns:newsblur="http://schemas.android.com/apk/res/com.newsblur"
|
||||
android:id="@+id/comment_favourite_avatars"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignBottom="@id/comment_shareddate"
|
||||
android:layout_marginRight="4dp"
|
||||
android:layout_toLeftOf="@id/comment_favourite_icon"
|
||||
newsblur:flow="left" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/comment_username"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignBottom="@id/comment_shareddate"
|
||||
android:layout_toRightOf="@id/comment_user_image"
|
||||
android:textColor="@color/newsblur_blue"
|
||||
android:textSize="14sp" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/comment_text"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -115,6 +104,18 @@
|
|||
android:textColor="@color/darkgray"
|
||||
android:textSize="14dp" />
|
||||
|
||||
<com.newsblur.view.FlowLayout
|
||||
xmlns:newsblur="http://schemas.android.com/apk/res/com.newsblur"
|
||||
android:id="@+id/comment_favourite_avatars"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="4dp"
|
||||
android:layout_toLeftOf="@id/comment_favourite_icon"
|
||||
android:layout_toRightOf="@id/comment_username"
|
||||
android:paddingTop="2dp"
|
||||
newsblur:flow="left"
|
||||
newsblur:defaultImageSize="20" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
|
|
|
@ -0,0 +1,65 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<Button
|
||||
android:id="@+id/share_story_button"
|
||||
style="@style/shareButton"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_marginRight="20dp"
|
||||
android:background="@drawable/selector_sharebutton_background"
|
||||
android:padding="10dp"
|
||||
android:text="@string/share_this" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/reading_shared_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_marginRight="20dp" >
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/reading_friend_comment_container"
|
||||
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:textColor="@color/darkgray"
|
||||
android:id="@+id/reading_friend_comment_total"
|
||||
android:paddingTop="3dp"
|
||||
android:textStyle="bold"
|
||||
android:paddingBottom="3dp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/comment_divider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="3dp"
|
||||
android:layout_below="@id/reading_friend_comment_container"
|
||||
android:background="@drawable/divider_light" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/reading_public_comment_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/comment_divider"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/darkgray"
|
||||
android:paddingTop="3dp"
|
||||
android:textStyle="bold"
|
||||
android:id="@+id/reading_public_comment_total"
|
||||
android:paddingBottom="3dp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
</merge>
|
|
@ -0,0 +1,82 @@
|
|||
<?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" >
|
||||
|
||||
<View
|
||||
android:id="@+id/row_item_favicon_borderbar_1"
|
||||
android:layout_width="8dp"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<View
|
||||
android:id="@+id/row_item_favicon_borderbar_2"
|
||||
android:layout_width="8dp"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp" >
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/reading_feed_icon"
|
||||
android:layout_width="17dp"
|
||||
android:layout_height="17dp"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_marginRight="5dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:contentDescription="@string/description_row_folder_icon" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/reading_feed_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="@id/reading_feed_icon"
|
||||
android:layout_marginTop="7dp"
|
||||
android:layout_toRightOf="@id/reading_feed_icon"
|
||||
android:textColor="@color/newsblur_blue"
|
||||
android:textSize="16dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/reading_item_date"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/reading_feed_title"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:paddingTop="10dp"
|
||||
android:textColor="@color/linkblue"
|
||||
android:textSize="13sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/reading_item_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/reading_item_date"
|
||||
android:layout_marginRight="10dp"
|
||||
android:textColor="@color/darkgray"
|
||||
android:textSize="20sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/reading_item_authors"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_below="@id/reading_item_title"
|
||||
android:layout_marginTop="10dp"
|
||||
android:maxLines="1"
|
||||
android:minWidth="80dp"
|
||||
android:textColor="@color/darkgray"
|
||||
android:textSize="11dp" />
|
||||
|
||||
<com.newsblur.view.FlowLayout
|
||||
android:id="@+id/reading_item_tags"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_below="@id/reading_item_authors"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:layout_marginTop="5dp" />
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
|
@ -0,0 +1,61 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/reading_share_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:paddingTop="10dp"
|
||||
android:visibility="gone" >
|
||||
|
||||
<View
|
||||
android:id="@+id/center_filler"
|
||||
android:layout_width="10dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_centerInParent="true" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/comment_by"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="15dp"
|
||||
android:layout_marginRight="5dp"
|
||||
android:textColor="@color/darkgray"
|
||||
android:textSize="12sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/shared_by"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginRight="15dp"
|
||||
android:textColor="@color/darkgray"
|
||||
android:textSize="12sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<com.newsblur.view.FlowLayout
|
||||
android:id="@+id/reading_social_commentimages"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_toLeftOf="@id/center_filler"
|
||||
android:layout_toRightOf="@id/comment_by" />
|
||||
|
||||
<com.newsblur.view.FlowLayout
|
||||
xmlns:newsblur="http://schemas.android.com/apk/res/com.newsblur"
|
||||
android:id="@+id/reading_social_shareimages"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_toLeftOf="@+id/shared_by"
|
||||
android:layout_toRightOf="@+id/center_filler"
|
||||
newsblur:flow="left" />
|
||||
|
||||
</RelativeLayout>
|
|
@ -11,7 +11,7 @@
|
|||
android:layout_width="25dp"
|
||||
android:layout_height="25dp"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:contentDescription="@string/description_activity_icon" />
|
||||
|
@ -21,7 +21,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginRight="10dp"
|
||||
android:textColor="@color/darkgray"
|
||||
android:textSize="10dp" />
|
||||
|
@ -30,7 +30,8 @@
|
|||
android:id="@+id/row_activity_text"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:textColorLink="@color/linkblue"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_toLeftOf="@id/row_activity_time"
|
||||
android:layout_toRightOf="@id/row_activity_icon"
|
||||
|
|
|
@ -2,10 +2,8 @@
|
|||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:background="@drawable/selector_folder_background"
|
||||
>
|
||||
android:background="@drawable/selector_folder_background" >
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/row_everything_icon"
|
||||
android:layout_width="25dp"
|
||||
|
@ -16,7 +14,7 @@
|
|||
android:layout_marginRight="12dp"
|
||||
android:contentDescription="@string/description_row_folder_icon"
|
||||
android:src="@drawable/group" />
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/row_folder_indicator"
|
||||
android:layout_width="20dp"
|
||||
|
@ -26,7 +24,7 @@
|
|||
android:layout_marginRight="12dp"
|
||||
android:contentDescription="@string/description_row_folder_icon"
|
||||
android:src="@drawable/indicator_collapsed" />
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/row_foldersums"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -59,19 +57,25 @@
|
|||
android:textSize="14dp"
|
||||
android:textStyle="bold" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/row_everythingtext"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_toRightOf="@id/row_everything_icon"
|
||||
android:layout_toLeftOf="@id/row_foldersums"
|
||||
android:layout_toRightOf="@id/row_everything_icon"
|
||||
android:paddingBottom="15dp"
|
||||
android:paddingTop="15dp"
|
||||
android:text="@string/all_shared_stories"
|
||||
android:textColor="@color/folder_text"
|
||||
android:textSize="16dp"
|
||||
android:paddingBottom="15dp"
|
||||
android:paddingTop="15dp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:background="@color/midgray" />
|
||||
|
||||
</RelativeLayout>
|
|
@ -2,10 +2,8 @@
|
|||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:background="@drawable/selector_folder_background"
|
||||
>
|
||||
android:background="@drawable/selector_folder_background" >
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/row_everything_icon"
|
||||
android:layout_width="20dp"
|
||||
|
@ -16,17 +14,16 @@
|
|||
android:layout_marginRight="12dp"
|
||||
android:contentDescription="@string/description_row_folder_icon"
|
||||
android:src="@drawable/archive" />
|
||||
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/row_everythingtext"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="50dp"
|
||||
android:text="@string/all_stories"
|
||||
android:paddingBottom="15dp"
|
||||
android:paddingTop="15dp"
|
||||
android:paddingTop="15dp"
|
||||
android:text="@string/all_stories"
|
||||
android:textColor="@color/folder_text"
|
||||
android:textSize="16dp"
|
||||
android:textStyle="bold" />
|
||||
|
@ -64,4 +61,10 @@
|
|||
android:textStyle="bold" />
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:background="@color/midgray" />
|
||||
|
||||
</RelativeLayout>
|
|
@ -14,9 +14,9 @@
|
|||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginRight="5dp"
|
||||
android:padding="2dp"
|
||||
android:gravity="right"
|
||||
android:orientation="horizontal" >
|
||||
android:orientation="horizontal"
|
||||
android:padding="2dp" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/row_feedneutral"
|
||||
|
@ -25,11 +25,10 @@
|
|||
android:layout_marginRight="5dp"
|
||||
android:background="@drawable/neutral_count_rect"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
android:paddingLeft="3dp"
|
||||
android:paddingRight="3dp"
|
||||
android:paddingBottom="1dp"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
|
@ -39,12 +38,10 @@
|
|||
android:layout_marginRight="5dp"
|
||||
android:background="@drawable/positive_count_rect"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="14sp"
|
||||
android:paddingTop="1dp"
|
||||
android:paddingBottom="2dp"
|
||||
android:paddingLeft="4dp"
|
||||
android:paddingRight="4dp"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold" />
|
||||
</LinearLayout>
|
||||
|
||||
|
@ -61,13 +58,15 @@
|
|||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginBottom="6dp"
|
||||
android:layout_marginLeft="15dp"
|
||||
android:layout_marginRight="5dp"
|
||||
android:layout_toLeftOf="@id/row_feedcounters"
|
||||
android:layout_toRightOf="@id/row_feedfavicon"
|
||||
android:ellipsize="end"
|
||||
android:singleLine="true"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="16dp" />
|
||||
android:textColor="@color/folder_text"
|
||||
android:textSize="16dp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
</RelativeLayout>
|
|
@ -37,12 +37,13 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_toRightOf="@id/row_result_feedicon"
|
||||
android:layout_alignBottom="@id/row_result_feedicon"
|
||||
android:ellipsize="end"
|
||||
android:singleLine="true"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/darkgray"
|
||||
android:textSize="11dp" />
|
||||
android:textSize="15sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/row_result_tagline"
|
||||
|
@ -52,9 +53,34 @@
|
|||
android:layout_below="@id/row_result_feedicon"
|
||||
android:layout_marginRight="8dp"
|
||||
android:paddingTop="8dp"
|
||||
android:textColor="@color/darkgray"
|
||||
android:textSize="20sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/row_result_subscribercount"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_marginRight="8dp"
|
||||
android:paddingTop="8dp"
|
||||
android:textColor="@color/darkgray"
|
||||
android:textSize="15sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/row_result_address"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignLeft="@id/row_result_feedicon"
|
||||
android:layout_below="@id/row_result_tagline"
|
||||
android:layout_marginRight="8dp"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="12dp"
|
||||
android:textColor="@color/darkgray"
|
||||
android:textSize="20dp" />
|
||||
android:autoLink="web"
|
||||
android:textColorLink="@color/linkblue"
|
||||
android:linksClickable="true"
|
||||
android:textSize="13sp" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</LinearLayout>
|
|
@ -2,8 +2,7 @@
|
|||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:background="@drawable/selector_folder_background"
|
||||
>
|
||||
android:background="@drawable/selector_folder_background">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/row_folder_icon"
|
||||
|
@ -61,15 +60,21 @@
|
|||
|
||||
<TextView
|
||||
android:id="@+id/row_foldername"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_toRightOf="@id/row_folder_icon"
|
||||
android:layout_toLeftOf="@id/row_foldersums"
|
||||
android:paddingLeft="49dp"
|
||||
android:layout_alignRight="@id/row_foldersums"
|
||||
android:textColor="@color/folder_text"
|
||||
android:paddingBottom="15dp"
|
||||
android:paddingTop="15dp"
|
||||
android:textSize="16dp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<View
|
||||
android:layout_height="1dp"
|
||||
android:layout_width="match_parent"
|
||||
android:background="@color/midgray"
|
||||
android:layout_alignParentBottom="true" />
|
||||
|
||||
</RelativeLayout>
|
|
@ -23,8 +23,6 @@
|
|||
android:gravity="center"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
android:paddingTop="1dp"
|
||||
android:paddingBottom="2dp"
|
||||
android:paddingLeft="4dp"
|
||||
android:paddingRight="4dp"
|
||||
android:textStyle="bold" />
|
||||
|
@ -38,8 +36,6 @@
|
|||
android:gravity="center"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="14sp"
|
||||
android:paddingTop="1dp"
|
||||
android:paddingBottom="2dp"
|
||||
android:paddingLeft="4dp"
|
||||
android:paddingRight="4dp"
|
||||
android:textStyle="bold" />
|
||||
|
@ -60,6 +56,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:textStyle="bold"
|
||||
android:layout_toLeftOf="@id/row_foldersums"
|
||||
android:layout_toRightOf="@id/row_socialfeed_icon"
|
||||
android:textColor="@color/folder_text"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="250dip"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|center_horizontal"
|
||||
android:orientation="vertical"
|
||||
|
@ -11,37 +11,66 @@
|
|||
android:paddingTop="10dip"
|
||||
>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/smalltext"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="A"
|
||||
android:textSize="16dip"
|
||||
android:layout_marginLeft="10dip"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignBaseline="@+id/largetext" />
|
||||
android:text="XS"
|
||||
android:textSize="14sp"
|
||||
android:layout_weight="1"
|
||||
android:layout_margin="10dp"
|
||||
android:gravity="left"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/largetext"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="A"
|
||||
android:textSize="28dip"
|
||||
android:layout_marginRight="10dip"
|
||||
android:layout_alignParentRight="true" />
|
||||
android:layout_margin="10dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:text="S"
|
||||
android:textSize="14sp" />
|
||||
|
||||
</RelativeLayout>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="M"
|
||||
android:textSize="14sp"
|
||||
android:layout_margin="10dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="L"
|
||||
android:textSize="14sp"
|
||||
android:layout_margin="10dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="XL"
|
||||
android:textSize="14sp"
|
||||
android:layout_margin="10dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="right" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<SeekBar
|
||||
android:id="@+id/textSizeSlider"
|
||||
android:background="@android:color/transparent"
|
||||
android:layout_width="fill_parent"
|
||||
android:progress="3"
|
||||
android:max="5"
|
||||
android:layout_width="match_parent"
|
||||
android:progress="2"
|
||||
android:paddingLeft="20dp"
|
||||
android:paddingRight="20dp"
|
||||
android:max="4"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
</LinearLayout>
|
9
media/android/NewsBlur/res/menu/feed_itemslist.xml
Normal file
9
media/android/NewsBlur/res/menu/feed_itemslist.xml
Normal file
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
<item android:id="@+id/menu_mark_all_as_read"
|
||||
android:title="@string/menu_mark_all_as_read"
|
||||
android:showAsAction="never" />
|
||||
<item android:id="@+id/menu_delete_feed"
|
||||
android:title="@string/menu_delete_feed"
|
||||
android:showAsAction="never" />
|
||||
</menu>
|
|
@ -4,7 +4,7 @@
|
|||
<item
|
||||
android:id="@+id/menu_reading_sharenewsblur"
|
||||
android:icon="@drawable/newsblur_share"
|
||||
android:showAsAction="ifRoom"
|
||||
android:showAsAction="never"
|
||||
android:title="@string/menu_sharenewsblur"/>
|
||||
<item
|
||||
android:id="@+id/menu_reading_original"
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<attr name="flow" format="string" />
|
||||
<attr name="defaultImageSize" format="integer" />
|
||||
|
||||
<declare-styleable name="FlowLayout">
|
||||
<attr name="flow" />
|
||||
<attr name="defaultImageSize" />
|
||||
</declare-styleable>
|
||||
</resources>
|
||||
|
|
|
@ -42,13 +42,13 @@
|
|||
<color name="half_lightgray">#77dddddd</color>
|
||||
|
||||
<color name="positive">#47730B</color>
|
||||
<color name="positive_read">#75be13</color>
|
||||
<color name="positive_read">#C5D4BC</color>
|
||||
|
||||
<color name="highlight">#d2e6fd</color>
|
||||
|
||||
<color name="darkneutral">#C59A00</color>
|
||||
<color name="neutral">#F5A90C</color>
|
||||
<color name="neutral_read">#ffdc43</color>
|
||||
<color name="neutral_read">#F4E7C3</color>
|
||||
|
||||
<color name="linkblue">#405BA8</color>
|
||||
|
||||
|
|
|
@ -39,8 +39,8 @@
|
|||
<string name="description_follow_button">Follow or unfollow a user</string>
|
||||
<string name="description_comment_user">Comment user image</string>
|
||||
|
||||
<string name="reading_shared_count" formatted="false">%s SHARES</string>
|
||||
<string name="reading_comment_count" formatted="false">%s COMMENTS</string>
|
||||
<string name="reading_shared_count">%s SHARES</string>
|
||||
<string name="reading_comment_count">%s COMMENTS</string>
|
||||
|
||||
<string name="all_stories">ALL STORIES</string>
|
||||
<string name="all_shared_stories">ALL SHARED STORIES</string>
|
||||
|
@ -57,9 +57,9 @@
|
|||
<string name="share_comment_hint">Comment (Optional)</string>
|
||||
<string name="shared">Story shared</string>
|
||||
<string name="error_sharing">There was an problem sharing this story.</string>
|
||||
<string name="share_newsblur" formatted="false">Share \"%s\" to your Blurblog?</string>
|
||||
<string name="share_newsblur">Share \"%s\" to your Blurblog?</string>
|
||||
|
||||
<string name="reply_to" formatted="false">Reply to \"%s\"</string>
|
||||
<string name="reply_to">Reply to \"%s\"</string>
|
||||
|
||||
<string name="alert_dialog_ok">Okay</string>
|
||||
<string name="alert_dialog_cancel">Cancel</string>
|
||||
|
@ -86,10 +86,11 @@
|
|||
<string name="menu_profile">Profile</string>
|
||||
<string name="menu_refresh">Refresh</string>
|
||||
<string name="menu_original">View original</string>
|
||||
<string name="menu_share">Share</string>
|
||||
<string name="menu_share">Send to…</string>
|
||||
<string name="menu_mark_feed_as_read">Mark feed as read</string>
|
||||
<string name="menu_delete_feed">Delete feed</string>
|
||||
<string name="menu_mark_folder_as_read">Mark folder as read</string>
|
||||
<string name="menu_sharenewsblur">Share on NewsBlur</string>
|
||||
<string name="menu_sharenewsblur">Share this story</string>
|
||||
<string name="menu_textsize">Adjust text size</string>
|
||||
|
||||
<string name="toast_marked_folder_as_read">Folder marked as read</string>
|
||||
|
@ -109,7 +110,6 @@
|
|||
<string name="menu_search">Search</string>
|
||||
<string name="menu_mark_all_as_read">Mark all as read</string>
|
||||
<string name="menu_logout">Log out</string>
|
||||
<string name="menu_delete_feed">Delete feed</string>
|
||||
|
||||
<string name="feed_deleted">Feed deleted</string>
|
||||
<string name="error_deleting_feed">There was an error deleting the feed.</string>
|
||||
|
@ -129,12 +129,15 @@
|
|||
<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="addfollow_add_newsblur">Follow the NewsBlur blog</string>
|
||||
<string name="addfollow_add_popular">Follow Popular Stories</string>
|
||||
<string name="add_follow">All Done!</string>
|
||||
<string name="share_with_comments">Share with comments</string>
|
||||
<string name="share_this_story">Share this story</string>
|
||||
<string name="comment_favourited">Comment favorited</string>
|
||||
<string name="error_liking_comment">Error favoriting comment</string>
|
||||
<string name="let_s_go_">Let&apos;s go!</string>
|
||||
<string name="public_comment_count">%d PUBLIC COMMENTS</string>
|
||||
<string name="friends_comments_count">%d FRIENDS COMMENTS</string>
|
||||
|
||||
</resources>
|
|
@ -36,6 +36,7 @@ public class AddFollow extends SherlockFragmentActivity {
|
|||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent i = new Intent(AddFollow.this, Main.class);
|
||||
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
startActivity(i);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -7,7 +7,6 @@ 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;
|
||||
|
@ -23,7 +22,6 @@ public class AddSites extends SherlockFragmentActivity {
|
|||
private String currentTag = "addsitesFragment";
|
||||
private AddSitesListFragment sitesList;
|
||||
private APIManager apiManager;
|
||||
private String TAG = "AddSites";
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle arg0) {
|
||||
|
@ -49,7 +47,7 @@ public class AddSites extends SherlockFragmentActivity {
|
|||
@Override
|
||||
protected Void doInBackground(Void... params) {
|
||||
final ArrayList<String> categories = sitesList.getSelectedCategories();
|
||||
Log.d(TAG, "Returned response to adding sites: " + apiManager.addCategories(categories));
|
||||
apiManager.addCategories(categories);
|
||||
return null;
|
||||
}
|
||||
}.execute();
|
||||
|
|
|
@ -29,7 +29,6 @@ public class AllSharedStoriesItemsList extends ItemsList {
|
|||
feedIds = new ArrayList<String>();
|
||||
|
||||
Cursor cursor = getContentResolver().query(FeedProvider.SOCIAL_FEEDS_URI, null, null, null, null);
|
||||
startManagingCursor(cursor);
|
||||
while (cursor.moveToNext()) {
|
||||
feedIds.add(cursor.getString(cursor.getColumnIndex(DatabaseConstants.SOCIAL_FEED_ID)));
|
||||
}
|
||||
|
@ -49,6 +48,7 @@ public class AllSharedStoriesItemsList extends ItemsList {
|
|||
fragmentManager.beginTransaction().add(syncFragment, SyncUpdateFragment.TAG).commit();
|
||||
triggerRefresh();
|
||||
}
|
||||
cursor.close();
|
||||
}
|
||||
|
||||
|
||||
|
@ -83,4 +83,8 @@ public class AllSharedStoriesItemsList extends ItemsList {
|
|||
stopLoading = true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void closeAfterUpdate() { }
|
||||
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ public class AllSharedStoriesReading extends Reading {
|
|||
|
||||
setupCountCursor();
|
||||
|
||||
stories = contentResolver.query(FeedProvider.ALL_SHARED_STORIES_URI, null, FeedProvider.getStorySelectionFromState(currentState), null, null);
|
||||
stories = contentResolver.query(FeedProvider.ALL_SHARED_STORIES_URI, null, FeedProvider.getStorySelectionFromState(currentState), null, DatabaseConstants.STORY_DATE + " desc");
|
||||
setTitle(getResources().getString(R.string.all_shared_stories));
|
||||
storiesToMarkAsRead = new ValueMultimap();
|
||||
readingAdapter = new MixedFeedsReadingAdapter(getSupportFragmentManager(), getContentResolver(), stories);
|
||||
|
@ -43,7 +43,7 @@ public class AllSharedStoriesReading extends Reading {
|
|||
}
|
||||
|
||||
private void setupCountCursor() {
|
||||
Cursor cursor = getContentResolver().query(FeedProvider.FEEDS_URI, null, FeedProvider.getStorySelectionFromState(currentState), null, null);
|
||||
Cursor cursor = getContentResolver().query(FeedProvider.FEEDS_URI, null, FeedProvider.getStorySelectionFromState(currentState), null, DatabaseConstants.STORY_DATE + " desc");
|
||||
startManagingCursor(cursor);
|
||||
feedIds = new ArrayList<String>();
|
||||
while (cursor.moveToNext()) {
|
||||
|
@ -113,4 +113,7 @@ public class AllSharedStoriesReading extends Reading {
|
|||
stopLoading = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeAfterUpdate() { }
|
||||
|
||||
}
|
||||
|
|
|
@ -84,4 +84,8 @@ public class AllStoriesItemsList extends ItemsList {
|
|||
stopLoading = true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void closeAfterUpdate() { }
|
||||
|
||||
}
|
||||
|
|
|
@ -14,18 +14,15 @@ import com.newsblur.database.MixedFeedsReadingAdapter;
|
|||
import com.newsblur.domain.ValueMultimap;
|
||||
import com.newsblur.network.MarkMixedStoriesAsReadTask;
|
||||
import com.newsblur.service.SyncService;
|
||||
import com.newsblur.util.AppConstants;
|
||||
|
||||
public class AllStoriesReading extends Reading {
|
||||
|
||||
private Cursor stories;
|
||||
private ValueMultimap storiesToMarkAsRead;
|
||||
private int negativeCount;
|
||||
private int neutralCount;
|
||||
private int positiveCount;
|
||||
private int currentPage;
|
||||
private ArrayList<String> feedIds;
|
||||
private boolean stopLoading = false;
|
||||
private boolean requestedPage = false;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceBundle) {
|
||||
|
@ -47,18 +44,11 @@ public class AllStoriesReading extends Reading {
|
|||
}
|
||||
|
||||
private void setupCountCursor() {
|
||||
Cursor countCursor = contentResolver.query(FeedProvider.FEED_COUNT_URI, null, DatabaseConstants.SOCIAL_INTELLIGENCE_SOME, null, null);
|
||||
countCursor.moveToFirst();
|
||||
negativeCount = countCursor.getInt(countCursor.getColumnIndex(DatabaseConstants.SUM_NEG));
|
||||
neutralCount = countCursor.getInt(countCursor.getColumnIndex(DatabaseConstants.SUM_NEUT));
|
||||
positiveCount = countCursor.getInt(countCursor.getColumnIndex(DatabaseConstants.SUM_POS));
|
||||
|
||||
Cursor cursor = getContentResolver().query(FeedProvider.FEEDS_URI, null, FeedProvider.getStorySelectionFromState(currentState), null, null);
|
||||
feedIds = new ArrayList<String>();
|
||||
while (cursor.moveToNext()) {
|
||||
feedIds.add(cursor.getString(cursor.getColumnIndex(DatabaseConstants.FEED_ID)));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -82,27 +72,10 @@ public class AllStoriesReading extends Reading {
|
|||
|
||||
@Override
|
||||
public void checkStoryCount(int position) {
|
||||
if (position == stories.getCount() - 1) {
|
||||
boolean loadMore = false;
|
||||
|
||||
switch (currentState) {
|
||||
case AppConstants.STATE_ALL:
|
||||
loadMore = positiveCount + neutralCount + negativeCount > stories.getCount();
|
||||
break;
|
||||
case AppConstants.STATE_BEST:
|
||||
loadMore = positiveCount > stories.getCount();
|
||||
break;
|
||||
case AppConstants.STATE_SOME:
|
||||
loadMore = positiveCount + neutralCount > stories.getCount();
|
||||
break;
|
||||
}
|
||||
|
||||
if (loadMore) {
|
||||
currentPage += 1;
|
||||
triggerRefresh(currentPage);
|
||||
} else {
|
||||
Log.d(TAG, "No need");
|
||||
}
|
||||
if (position == stories.getCount() - 1 && !stopLoading && !requestedPage) {
|
||||
requestedPage = true;
|
||||
currentPage += 1;
|
||||
triggerRefresh(currentPage);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -129,6 +102,7 @@ public class AllStoriesReading extends Reading {
|
|||
public void updateAfterSync() {
|
||||
setSupportProgressBarIndeterminateVisibility(false);
|
||||
stories.requery();
|
||||
requestedPage = false;
|
||||
readingAdapter.notifyDataSetChanged();
|
||||
checkStoryCount(pager.getCurrentItem());
|
||||
}
|
||||
|
@ -138,4 +112,7 @@ public class AllStoriesReading extends Reading {
|
|||
stopLoading = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeAfterUpdate() { }
|
||||
|
||||
}
|
||||
|
|
|
@ -6,11 +6,11 @@ import android.database.Cursor;
|
|||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.FragmentTransaction;
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.actionbarsherlock.view.Menu;
|
||||
import com.actionbarsherlock.view.MenuInflater;
|
||||
import com.actionbarsherlock.view.MenuItem;
|
||||
import com.newsblur.R;
|
||||
import com.newsblur.database.DatabaseConstants;
|
||||
import com.newsblur.database.FeedProvider;
|
||||
|
@ -56,7 +56,31 @@ public class FeedItemsList extends ItemsList {
|
|||
triggerRefresh();
|
||||
}
|
||||
}
|
||||
|
||||
public void deleteFeed() {
|
||||
setSupportProgressBarIndeterminateVisibility(true);
|
||||
final Intent intent = new Intent(Intent.ACTION_SYNC, null, this, SyncService.class);
|
||||
intent.putExtra(SyncService.EXTRA_STATUS_RECEIVER, syncFragment.receiver);
|
||||
intent.putExtra(SyncService.SYNCSERVICE_TASK, SyncService.EXTRA_TASK_DELETE_FEED);
|
||||
intent.putExtra(SyncService.EXTRA_TASK_FEED_ID, Long.parseLong(feedId));
|
||||
startService(intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
if (!super.onOptionsItemSelected(item)) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.menu_delete_feed:
|
||||
deleteFeed();
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markItemListAsRead() {
|
||||
new MarkFeedAsReadTask(this, apiManager) {
|
||||
|
@ -83,7 +107,7 @@ public class FeedItemsList extends ItemsList {
|
|||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
super.onCreateOptionsMenu(menu);
|
||||
MenuInflater inflater = getSupportMenuInflater();
|
||||
inflater.inflate(R.menu.itemslist, menu);
|
||||
inflater.inflate(R.menu.feed_itemslist, menu);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -107,9 +131,13 @@ public class FeedItemsList extends ItemsList {
|
|||
|
||||
@Override
|
||||
public void setNothingMoreToUpdate() {
|
||||
Log.d(TAG, "Stop loading");
|
||||
stopLoading = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeAfterUpdate() {
|
||||
finish();
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -28,6 +28,7 @@ public class FeedReading extends Reading {
|
|||
private Feed feed;
|
||||
private int currentPage;
|
||||
private boolean stopLoading = false;
|
||||
private boolean requestedPage = false;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceBundle) {
|
||||
|
@ -55,16 +56,13 @@ public class FeedReading extends Reading {
|
|||
|
||||
setupPager();
|
||||
|
||||
Story story = readingAdapter.getStory(passedPosition);
|
||||
|
||||
updateReadStories(story);
|
||||
|
||||
syncFragment = (SyncUpdateFragment) fragmentManager.findFragmentByTag(SyncUpdateFragment.TAG);
|
||||
if (syncFragment == null) {
|
||||
syncFragment = new SyncUpdateFragment();
|
||||
fragmentManager.beginTransaction().add(syncFragment, SyncUpdateFragment.TAG).commit();
|
||||
}
|
||||
|
||||
updateReadStories(readingAdapter.getStory(passedPosition));
|
||||
}
|
||||
|
||||
private void updateReadStories(Story story) {
|
||||
|
@ -80,30 +78,22 @@ public class FeedReading extends Reading {
|
|||
checkStoryCount(position);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateAfterSync() {
|
||||
setSupportProgressBarIndeterminateVisibility(false);
|
||||
stories.requery();
|
||||
requestedPage = false;
|
||||
readingAdapter.notifyDataSetChanged();
|
||||
checkStoryCount(pager.getCurrentItem());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkStoryCount(int position) {
|
||||
if (position == stories.getCount() - 1) {
|
||||
boolean loadMore = false;
|
||||
|
||||
switch (currentState) {
|
||||
case AppConstants.STATE_ALL:
|
||||
loadMore = feed.positiveCount + feed.neutralCount + feed.negativeCount > stories.getCount();
|
||||
break;
|
||||
case AppConstants.STATE_BEST:
|
||||
loadMore = feed.positiveCount > stories.getCount();
|
||||
break;
|
||||
case AppConstants.STATE_SOME:
|
||||
loadMore = feed.positiveCount + feed.neutralCount > stories.getCount();
|
||||
break;
|
||||
}
|
||||
|
||||
if (loadMore) {
|
||||
currentPage += 1;
|
||||
triggerRefresh(currentPage);
|
||||
} else {
|
||||
Log.d(TAG, "No need");
|
||||
}
|
||||
if (position == stories.getCount() - 1 && !stopLoading && !requestedPage) {
|
||||
requestedPage = true;
|
||||
currentPage += 1;
|
||||
triggerRefresh(currentPage);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -127,8 +117,10 @@ public class FeedReading extends Reading {
|
|||
final Intent intent = new Intent(Intent.ACTION_SYNC, null, this, SyncService.class);
|
||||
intent.putExtra(SyncService.EXTRA_STATUS_RECEIVER, syncFragment.receiver);
|
||||
intent.putExtra(SyncService.SYNCSERVICE_TASK, SyncService.EXTRA_TASK_FEED_UPDATE);
|
||||
intent.putExtra(SyncService.EXTRA_TASK_PAGE_NUMBER, Integer.toString(page));
|
||||
intent.putExtra(SyncService.EXTRA_TASK_FEED_ID, feedId);
|
||||
if (page > 1) {
|
||||
intent.putExtra(SyncService.EXTRA_TASK_PAGE_NUMBER, Integer.toString(page));
|
||||
}
|
||||
startService(intent);
|
||||
}
|
||||
}
|
||||
|
@ -138,5 +130,8 @@ public class FeedReading extends Reading {
|
|||
stopLoading = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeAfterUpdate() { }
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -50,10 +50,17 @@ public class FeedSearchResultAdapter extends ArrayAdapter<FeedResult>{
|
|||
bitmap = BitmapFactory.decodeResource(context.getResources(), R.drawable.world);
|
||||
}
|
||||
|
||||
favicon.setImageBitmap(UIUtils.roundCorners(bitmap, 5));
|
||||
favicon.setImageBitmap(bitmap);
|
||||
|
||||
((TextView) v.findViewById(R.id.row_result_title)).setText(result.label);
|
||||
((TextView) v.findViewById(R.id.row_result_tagline)).setText(result.tagline);
|
||||
if (!TextUtils.isEmpty(result.url)) {
|
||||
((TextView) v.findViewById(R.id.row_result_address)).setText(result.url);
|
||||
} else {
|
||||
v.findViewById(R.id.row_result_address).setVisibility(View.GONE);
|
||||
}
|
||||
((TextView) v.findViewById(R.id.row_result_subscribercount)).setText(result.numberOfSubscriber + " subscribers");
|
||||
|
||||
|
||||
return v;
|
||||
}
|
||||
|
|
|
@ -114,4 +114,8 @@ public class FolderItemsList extends ItemsList {
|
|||
public void setNothingMoreToUpdate() {
|
||||
stopLoading = true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void closeAfterUpdate() { }
|
||||
}
|
||||
|
|
|
@ -89,8 +89,6 @@ public class FolderReading extends Reading {
|
|||
currentPage += 1;
|
||||
requestedPage = true;
|
||||
triggerRefresh(currentPage);
|
||||
} else {
|
||||
Log.d(TAG, "No need");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -99,4 +97,7 @@ public class FolderReading extends Reading {
|
|||
stopLoading = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeAfterUpdate() { }
|
||||
|
||||
}
|
||||
|
|
|
@ -51,7 +51,6 @@ public abstract class ItemsList extends SherlockFragmentActivity implements Sync
|
|||
|
||||
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
Log.d(TAG, "Returned okay.");
|
||||
if (resultCode == RESULT_OK) {
|
||||
itemListFragment.hasUpdated();
|
||||
}
|
||||
|
@ -59,7 +58,8 @@ public abstract class ItemsList extends SherlockFragmentActivity implements Sync
|
|||
|
||||
public abstract void triggerRefresh();
|
||||
public abstract void triggerRefresh(int page);
|
||||
|
||||
public abstract void markItemListAsRead();
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
|
@ -75,12 +75,10 @@ public abstract class ItemsList extends SherlockFragmentActivity implements Sync
|
|||
return false;
|
||||
}
|
||||
|
||||
public abstract void markItemListAsRead();
|
||||
|
||||
|
||||
@Override
|
||||
public void updateAfterSync() {
|
||||
Log.d(TAG , "Redrawing UI");
|
||||
if (itemListFragment != null) {
|
||||
itemListFragment.hasUpdated();
|
||||
} else {
|
||||
|
@ -98,7 +96,6 @@ public abstract class ItemsList extends SherlockFragmentActivity implements Sync
|
|||
|
||||
@Override
|
||||
public void changedState(int state) {
|
||||
Log.d(TAG, "Changed state.");
|
||||
itemListFragment.changeState(state);
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@ 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;
|
||||
|
@ -17,7 +16,6 @@ public class Login extends FragmentActivity {
|
|||
|
||||
private FragmentManager fragmentManager;
|
||||
private final static String currentTag = "currentFragment";
|
||||
private static final String TAG = "LoginActivity";
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -28,7 +26,6 @@ public class Login extends FragmentActivity {
|
|||
fragmentManager = getSupportFragmentManager();
|
||||
|
||||
if (fragmentManager.findFragmentByTag(currentTag) == null) {
|
||||
Log.d(TAG, "Adding current new fragment");
|
||||
FragmentTransaction transaction = fragmentManager.beginTransaction();
|
||||
LoginRegisterFragment login = new LoginRegisterFragment();
|
||||
transaction.add(R.id.login_container, login, currentTag);
|
||||
|
|
|
@ -27,7 +27,6 @@ public class LoginProgress extends FragmentActivity {
|
|||
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);
|
||||
|
|
|
@ -146,5 +146,10 @@ public class Main extends SherlockFragmentActivity implements StateChangedListen
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setNothingMoreToUpdate() { }
|
||||
public void setNothingMoreToUpdate() { }
|
||||
|
||||
@Override
|
||||
public void closeAfterUpdate() {
|
||||
updateAfterSync();
|
||||
}
|
||||
}
|
|
@ -103,7 +103,7 @@ public class Profile extends SherlockFragmentActivity {
|
|||
protected void onPostExecute(Void result) {
|
||||
if (user != null && detailsFragment != null && activitiesFragment != null) {
|
||||
detailsFragment.setUser(user, TextUtils.isEmpty(userId));
|
||||
activitiesFragment.setActivities(activities);
|
||||
activitiesFragment.setActivitiesAndUser(activities, user);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.newsblur.activity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
|
||||
import android.content.ContentProviderOperation;
|
||||
import android.content.ContentResolver;
|
||||
|
@ -34,6 +35,7 @@ import com.newsblur.fragment.ReadingItemFragment;
|
|||
import com.newsblur.fragment.ShareDialogFragment;
|
||||
import com.newsblur.fragment.SyncUpdateFragment;
|
||||
import com.newsblur.fragment.TextSizeDialogFragment;
|
||||
import com.newsblur.util.AppConstants;
|
||||
import com.newsblur.util.PrefConstants;
|
||||
import com.newsblur.util.PrefsUtils;
|
||||
import com.newsblur.util.UIUtils;
|
||||
|
@ -48,7 +50,7 @@ public abstract class Reading extends SherlockFragmentActivity implements OnPage
|
|||
public static final String EXTRA_FOLDERNAME = "foldername";
|
||||
public static final String EXTRA_FEED_IDS = "feed_ids";
|
||||
private static final String TEXT_SIZE = "textsize";
|
||||
|
||||
|
||||
protected int passedPosition;
|
||||
protected int currentState;
|
||||
|
||||
|
@ -59,7 +61,8 @@ public abstract class Reading extends SherlockFragmentActivity implements OnPage
|
|||
protected SyncUpdateFragment syncFragment;
|
||||
private ArrayList<ContentProviderOperation> operations;
|
||||
protected Cursor stories;
|
||||
|
||||
private HashSet<String> storiesToMarkAsRead;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceBundle) {
|
||||
requestWindowFeature(Window.FEATURE_PROGRESS);
|
||||
|
@ -69,6 +72,8 @@ public abstract class Reading extends SherlockFragmentActivity implements OnPage
|
|||
|
||||
operations = new ArrayList<ContentProviderOperation>();
|
||||
fragmentManager = getSupportFragmentManager();
|
||||
|
||||
storiesToMarkAsRead = new HashSet<String>();
|
||||
|
||||
passedPosition = getIntent().getIntExtra(EXTRA_POSITION, 0);
|
||||
currentState = getIntent().getIntExtra(ItemsList.EXTRA_STATE, 0);
|
||||
|
@ -107,7 +112,7 @@ public abstract class Reading extends SherlockFragmentActivity implements OnPage
|
|||
int currentItem = pager.getCurrentItem();
|
||||
Story story = readingAdapter.getStory(currentItem);
|
||||
UserDetails user = PrefsUtils.getUserDetails(this);
|
||||
|
||||
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.home:
|
||||
finish();
|
||||
|
@ -140,7 +145,7 @@ public abstract class Reading extends SherlockFragmentActivity implements OnPage
|
|||
TextSizeDialogFragment textSize = TextSizeDialogFragment.newInstance(currentValue);
|
||||
textSize.show(getSupportFragmentManager(), TEXT_SIZE);
|
||||
return true;
|
||||
|
||||
|
||||
default:
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
@ -165,7 +170,7 @@ public abstract class Reading extends SherlockFragmentActivity implements OnPage
|
|||
readingAdapter.notifyDataSetChanged();
|
||||
checkStoryCount(pager.getCurrentItem());
|
||||
}
|
||||
|
||||
|
||||
public abstract void checkStoryCount(int position);
|
||||
|
||||
@Override
|
||||
|
@ -175,7 +180,7 @@ public abstract class Reading extends SherlockFragmentActivity implements OnPage
|
|||
|
||||
public abstract void triggerRefresh();
|
||||
public abstract void triggerRefresh(int page);
|
||||
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
if (isFinishing()) {
|
||||
|
@ -193,10 +198,12 @@ public abstract class Reading extends SherlockFragmentActivity implements OnPage
|
|||
}
|
||||
|
||||
protected void addStoryToMarkAsRead(Story story) {
|
||||
if (story.read != 1 && !storiesToMarkAsRead.contains(story.id)) {
|
||||
storiesToMarkAsRead.add(story.id);
|
||||
String[] selectionArgs;
|
||||
ContentValues emptyValues = new ContentValues();
|
||||
emptyValues.put(DatabaseConstants.FEED_ID, story.feedId);
|
||||
|
||||
|
||||
if (story.getIntelligenceTotal() > 0) {
|
||||
selectionArgs = new String[] { DatabaseConstants.FEED_POSITIVE_COUNT, story.feedId } ;
|
||||
} else if (story.getIntelligenceTotal() == 0) {
|
||||
|
@ -204,9 +211,9 @@ public abstract class Reading extends SherlockFragmentActivity implements OnPage
|
|||
} else {
|
||||
selectionArgs = new String[] { DatabaseConstants.FEED_NEGATIVE_COUNT, story.feedId } ;
|
||||
}
|
||||
|
||||
operations.add(ContentProviderOperation.newUpdate(FeedProvider.FEED_COUNT_URI).withValues(emptyValues).withSelection("", selectionArgs).build());
|
||||
|
||||
|
||||
|
||||
if (!TextUtils.isEmpty(story.socialUserId)) {
|
||||
String[] socialSelectionArgs;
|
||||
if (story.getIntelligenceTotal() > 0) {
|
||||
|
@ -222,17 +229,17 @@ public abstract class Reading extends SherlockFragmentActivity implements OnPage
|
|||
Uri storyUri = FeedProvider.STORY_URI.buildUpon().appendPath(story.id).build();
|
||||
ContentValues values = new ContentValues();
|
||||
values.put(DatabaseConstants.STORY_READ, true);
|
||||
|
||||
|
||||
operations.add(ContentProviderOperation.newUpdate(storyUri).withValues(values).build());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
|
||||
getSharedPreferences(PrefConstants.PREFERENCES, 0).edit().putFloat(PrefConstants.PREFERENCE_TEXT_SIZE, (float) progress / 2).commit();
|
||||
getSharedPreferences(PrefConstants.PREFERENCES, 0).edit().putFloat(PrefConstants.PREFERENCE_TEXT_SIZE, (float) progress / AppConstants.FONT_SIZE_INCREMENT_FACTOR).commit();
|
||||
Intent data = new Intent(ReadingItemFragment.TEXT_SIZE_CHANGED);
|
||||
data.putExtra(ReadingItemFragment.TEXT_SIZE_VALUE, (float) progress / 2f);
|
||||
|
||||
data.putExtra(ReadingItemFragment.TEXT_SIZE_VALUE, (float) progress / AppConstants.FONT_SIZE_INCREMENT_FACTOR);
|
||||
sendBroadcast(data);
|
||||
}
|
||||
|
||||
|
@ -244,7 +251,7 @@ public abstract class Reading extends SherlockFragmentActivity implements OnPage
|
|||
public void onStopTrackingTouch(SeekBar seekBar) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -36,7 +36,6 @@ public abstract class ReadingAdapter extends FragmentStatePagerAdapter {
|
|||
if (stories != null && stories.getCount() > 0) {
|
||||
return stories.getCount();
|
||||
} else {
|
||||
Log.d(TAG , "No cursor - use loading view.");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,6 @@ public class RegisterProgress extends SherlockFragmentActivity {
|
|||
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);
|
||||
|
|
|
@ -101,4 +101,8 @@ public class SocialFeedItemsList extends ItemsList {
|
|||
stopLoading = true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void closeAfterUpdate() { }
|
||||
|
||||
}
|
||||
|
|
|
@ -7,7 +7,6 @@ import java.util.Set;
|
|||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
|
||||
import com.newsblur.database.FeedProvider;
|
||||
import com.newsblur.database.MixedFeedsReadingAdapter;
|
||||
|
@ -17,7 +16,7 @@ import com.newsblur.network.MarkSocialStoryAsReadTask;
|
|||
import com.newsblur.service.SyncService;
|
||||
|
||||
public class SocialFeedReading extends Reading {
|
||||
|
||||
|
||||
MarkSocialAsReadUpdate markSocialAsReadList;
|
||||
private String userId;
|
||||
private String username;
|
||||
|
@ -25,20 +24,20 @@ public class SocialFeedReading extends Reading {
|
|||
private boolean requestedPage;
|
||||
private boolean stopLoading = false;
|
||||
private int currentPage;
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceBundle) {
|
||||
super.onCreate(savedInstanceBundle);
|
||||
|
||||
|
||||
setResult(RESULT_OK);
|
||||
|
||||
|
||||
userId = getIntent().getStringExtra(Reading.EXTRA_USERID);
|
||||
username = getIntent().getStringExtra(Reading.EXTRA_USERNAME);
|
||||
markSocialAsReadList = new MarkSocialAsReadUpdate(userId);
|
||||
|
||||
|
||||
Uri socialFeedUri = FeedProvider.SOCIAL_FEEDS_URI.buildUpon().appendPath(userId).build();
|
||||
socialFeed = SocialFeed.fromCursor(contentResolver.query(socialFeedUri, null, null, null, null));
|
||||
|
||||
|
||||
Uri storiesURI = FeedProvider.SOCIALFEED_STORIES_URI.buildUpon().appendPath(userId).build();
|
||||
stories = contentResolver.query(storiesURI, null, FeedProvider.getStorySelectionFromState(currentState), null, null);
|
||||
setTitle(getIntent().getStringExtra(EXTRA_USERNAME));
|
||||
|
@ -48,11 +47,10 @@ public class SocialFeedReading extends Reading {
|
|||
setupPager();
|
||||
|
||||
Story story = readingAdapter.getStory(passedPosition);
|
||||
markSocialAsReadList.add(story.feedId, story.id);
|
||||
addStoryToMarkAsRead(story);
|
||||
|
||||
markSocialAsReadList.add(story.feedId, story.id);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onPageSelected(int position) {
|
||||
super.onPageSelected(position);
|
||||
|
@ -69,16 +67,16 @@ public class SocialFeedReading extends Reading {
|
|||
new MarkSocialStoryAsReadTask(this, syncFragment, markSocialAsReadList).execute();
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
|
||||
public class MarkSocialAsReadUpdate {
|
||||
public String userId;
|
||||
HashMap<String, Set<String>> feedStoryMap;
|
||||
|
||||
|
||||
public MarkSocialAsReadUpdate(final String userId) {
|
||||
this.userId = userId;
|
||||
feedStoryMap = new HashMap<String, Set<String>>();
|
||||
}
|
||||
|
||||
|
||||
public void add(final String feedId, final String storyId) {
|
||||
if (feedStoryMap.get(feedId) == null) {
|
||||
Set<String> storiesForFeed = new HashSet<String>();
|
||||
|
@ -88,7 +86,7 @@ public class SocialFeedReading extends Reading {
|
|||
feedStoryMap.get(feedId).add(storyId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public Object getJsonObject() {
|
||||
HashMap<String, HashMap<String, Set<String>>> jsonMap = new HashMap<String, HashMap<String, Set<String>>>();
|
||||
jsonMap.put(userId, feedStoryMap);
|
||||
|
@ -118,14 +116,10 @@ public class SocialFeedReading extends Reading {
|
|||
|
||||
@Override
|
||||
public void checkStoryCount(int position) {
|
||||
if (position == stories.getCount() - 1) {
|
||||
if (!requestedPage && !stopLoading) {
|
||||
currentPage += 1;
|
||||
requestedPage = true;
|
||||
triggerRefresh(currentPage);
|
||||
} else {
|
||||
Log.d(TAG, "No need");
|
||||
}
|
||||
if (position == stories.getCount() - 1 && !requestedPage && !stopLoading) {
|
||||
currentPage += 1;
|
||||
requestedPage = true;
|
||||
triggerRefresh(currentPage);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -133,5 +127,8 @@ public class SocialFeedReading extends Reading {
|
|||
public void setNothingMoreToUpdate() {
|
||||
stopLoading = true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void closeAfterUpdate() { }
|
||||
|
||||
}
|
||||
|
|
|
@ -15,7 +15,6 @@ public class BlurDatabase extends SQLiteOpenHelper {
|
|||
|
||||
public BlurDatabase(Context context) {
|
||||
super(context, DB_NAME, null, VERSION);
|
||||
Log.d(TAG, "Initiating database");
|
||||
}
|
||||
|
||||
private final String FOLDER_SQL = "CREATE TABLE " + DatabaseConstants.FOLDER_TABLE + " (" +
|
||||
|
@ -87,7 +86,7 @@ public class BlurDatabase extends SQLiteOpenHelper {
|
|||
DatabaseConstants.STORY_AUTHORS + TEXT + ", " +
|
||||
DatabaseConstants.STORY_CONTENT + TEXT + ", " +
|
||||
DatabaseConstants.STORY_DATE + TEXT + ", " +
|
||||
DatabaseConstants.STORY_SHARED_DATE + TEXT + ", " +
|
||||
DatabaseConstants.STORY_SHARED_DATE + INTEGER + ", " +
|
||||
DatabaseConstants.STORY_SHORTDATE + TEXT + ", " +
|
||||
DatabaseConstants.STORY_LONGDATE + TEXT + ", " +
|
||||
DatabaseConstants.STORY_FEED_ID + INTEGER + ", " +
|
||||
|
|
|
@ -37,7 +37,7 @@ public class DatabaseConstants {
|
|||
public static final String FEED_FOLDER_MAP_TABLE = "feed_folder_map";
|
||||
public static final String FEED_FOLDER_FEED_ID = "feed_feed_id";
|
||||
public static final String FEED_FOLDER_FOLDER_NAME = "feed_folder_name";
|
||||
|
||||
|
||||
public static final String SOCIALFEED_STORY_MAP_TABLE = "socialfeed_story_map";
|
||||
public static final String SOCIALFEED_STORY_USER_ID = "socialfeed_story_user_id";
|
||||
public static final String SOCIALFEED_STORY_STORYID = "socialfeed_story_storyid";
|
||||
|
@ -59,7 +59,7 @@ public class DatabaseConstants {
|
|||
public static final String USER_USERID = BaseColumns._ID;
|
||||
public static final String USER_USERNAME = "username";
|
||||
public static final String USER_PHOTO_URL = "photo_url";
|
||||
|
||||
|
||||
public static final String STORY_TABLE = "stories";
|
||||
public static final String STORY_ID = BaseColumns._ID;
|
||||
public static final String STORY_AUTHORS = "authors";
|
||||
|
@ -96,14 +96,14 @@ public class DatabaseConstants {
|
|||
public static final String COMMENT_USERID = "comment_userid";
|
||||
|
||||
public static final String REPLY_TABLE = "comment_replies";
|
||||
|
||||
|
||||
public static final String REPLY_ID = BaseColumns._ID;
|
||||
public static final String REPLY_COMMENTID = "comment_id";
|
||||
public static final String REPLY_TEXT = "reply_text";
|
||||
public static final String REPLY_USERID = "reply_userid";
|
||||
public static final String REPLY_DATE = "reply_date";
|
||||
public static final String REPLY_SHORTDATE = "reply_shortdate";
|
||||
|
||||
|
||||
// Aggregated columns
|
||||
public static final String SUM_POS = "sum_postive";
|
||||
public static final String SUM_NEUT = "sum_neutral";
|
||||
|
@ -112,7 +112,7 @@ public class DatabaseConstants {
|
|||
public static final String[] UPDATE_COLUMNS = {
|
||||
UPDATE_ID, UPDATE_TYPE, UPDATE_ARGUMENTS
|
||||
};
|
||||
|
||||
|
||||
public static final String[] FEED_COLUMNS = {
|
||||
FEED_TABLE + "." + FEED_ACTIVE, FEED_TABLE + "." + FEED_ID, FEED_TABLE + "." + FEED_FAVICON_URL, FEED_TABLE + "." + FEED_TITLE, FEED_TABLE + "." + FEED_LINK, FEED_TABLE + "." + FEED_ADDRESS, FEED_TABLE + "." + FEED_SUBSCRIBERS, FEED_TABLE + "." + FEED_UPDATED_SECONDS, FEED_TABLE + "." + FEED_FAVICON_FADE, FEED_TABLE + "." + FEED_FAVICON_COLOUR, FEED_TABLE + "." + FEED_FAVICON_BORDER,
|
||||
FEED_TABLE + "." + FEED_FAVICON, FEED_TABLE + "." + FEED_POSITIVE_COUNT, FEED_TABLE + "." + FEED_NEUTRAL_COUNT, FEED_TABLE + "." + FEED_NEGATIVE_COUNT
|
||||
|
@ -125,7 +125,7 @@ public class DatabaseConstants {
|
|||
public static final String[] COMMENT_COLUMNS = {
|
||||
COMMENT_ID, COMMENT_STORYID, COMMENT_TEXT, COMMENT_BYFRIEND, COMMENT_USERID, COMMENT_DATE, COMMENT_LIKING_USERS, COMMENT_SHAREDDATE, COMMENT_SOURCE_USERID
|
||||
};
|
||||
|
||||
|
||||
public static final String[] REPLY_COLUMNS = {
|
||||
REPLY_COMMENTID, REPLY_DATE, REPLY_ID, REPLY_SHORTDATE, REPLY_TEXT, REPLY_USERID
|
||||
};
|
||||
|
@ -134,23 +134,33 @@ public class DatabaseConstants {
|
|||
FOLDER_TABLE + "." + FOLDER_ID, FOLDER_TABLE + "." + FOLDER_NAME, " SUM(" + FEED_POSITIVE_COUNT + ") AS " + SUM_POS, " SUM(" + FEED_NEUTRAL_COUNT + ") AS " + SUM_NEUT, " SUM(" + FEED_NEGATIVE_COUNT + ") AS " + SUM_NEG
|
||||
};
|
||||
|
||||
public static final String[] STORY_COLUMNS = {
|
||||
STORY_AUTHORS, STORY_COMMENT_COUNT, STORY_CONTENT, STORY_DATE, STORY_SHARED_DATE, STORY_SHORTDATE, STORY_LONGDATE, STORY_TABLE + "." + STORY_FEED_ID, STORY_TABLE + "." + STORY_ID, STORY_INTELLIGENCE_AUTHORS, STORY_INTELLIGENCE_FEED, STORY_INTELLIGENCE_TAGS, STORY_INTELLIGENCE_TITLE,
|
||||
STORY_PERMALINK, STORY_READ, STORY_SHARE_COUNT, STORY_TAGS, STORY_TITLE, STORY_SOCIAL_USER_ID, STORY_SOURCE_USER_ID, STORY_SHARED_USER_IDS, STORY_FRIEND_USER_IDS, STORY_PUBLIC_USER_IDS
|
||||
};
|
||||
|
||||
public static final String FOLDER_INTELLIGENCE_ALL = " HAVING SUM(" + DatabaseConstants.FEED_NEGATIVE_COUNT + " + " + DatabaseConstants.FEED_NEUTRAL_COUNT + " + " + DatabaseConstants.FEED_POSITIVE_COUNT + ") >= 0 ";
|
||||
public static final String FOLDER_INTELLIGENCE_SOME = " HAVING SUM(" + DatabaseConstants.FEED_NEUTRAL_COUNT + " + " + DatabaseConstants.FEED_POSITIVE_COUNT + ") > 0 ";
|
||||
public static final String FOLDER_INTELLIGENCE_BEST = " HAVING SUM(" + DatabaseConstants.FEED_POSITIVE_COUNT + ") > 0 ";
|
||||
|
||||
|
||||
public static final String SOCIAL_INTELLIGENCE_ALL = "";
|
||||
public static final String SOCIAL_INTELLIGENCE_SOME = " (" + DatabaseConstants.SOCIAL_FEED_NEUTRAL_COUNT + " + " + DatabaseConstants.SOCIAL_FEED_POSITIVE_COUNT + ") > 0 ";
|
||||
public static final String SOCIAL_INTELLIGENCE_BEST = " (" + DatabaseConstants.SOCIAL_FEED_POSITIVE_COUNT + ") > 0 ";
|
||||
private static final String SUM_STORY_TOTAL = "storyTotal";
|
||||
|
||||
|
||||
private static String STORY_SUM_TOTAL = " CASE " +
|
||||
"WHEN MAX(" + DatabaseConstants.STORY_INTELLIGENCE_AUTHORS + "," + DatabaseConstants.STORY_INTELLIGENCE_FEED + "," + DatabaseConstants.STORY_INTELLIGENCE_TAGS + "," + DatabaseConstants.STORY_INTELLIGENCE_TITLE + ") > 0 " +
|
||||
"THEN MAX(" + DatabaseConstants.STORY_INTELLIGENCE_AUTHORS + "," + DatabaseConstants.STORY_INTELLIGENCE_FEED + "," + DatabaseConstants.STORY_INTELLIGENCE_TAGS + "," + DatabaseConstants.STORY_INTELLIGENCE_TITLE + ") " +
|
||||
"WHEN MIN(" + DatabaseConstants.STORY_INTELLIGENCE_AUTHORS + "," + DatabaseConstants.STORY_INTELLIGENCE_FEED + "," + DatabaseConstants.STORY_INTELLIGENCE_TAGS + "," + DatabaseConstants.STORY_INTELLIGENCE_TITLE + ") < 0 " +
|
||||
"THEN MIN(" + DatabaseConstants.STORY_INTELLIGENCE_AUTHORS + "," + DatabaseConstants.STORY_INTELLIGENCE_FEED + "," + DatabaseConstants.STORY_INTELLIGENCE_TAGS + "," + DatabaseConstants.STORY_INTELLIGENCE_TITLE + ") " +
|
||||
"ELSE " + DatabaseConstants.STORY_INTELLIGENCE_FEED + " " +
|
||||
"END AS " + DatabaseConstants.SUM_STORY_TOTAL;
|
||||
|
||||
public static final String STORY_INTELLIGENCE_BEST = DatabaseConstants.SUM_STORY_TOTAL + " > 0 ";
|
||||
public static final String STORY_INTELLIGENCE_SOME = DatabaseConstants.SUM_STORY_TOTAL + " >= 0 ";
|
||||
public static final String STORY_INTELLIGENCE_ALL = DatabaseConstants.SUM_STORY_TOTAL + " >= 0 ";
|
||||
|
||||
public static final String[] STORY_COLUMNS = {
|
||||
STORY_AUTHORS, STORY_COMMENT_COUNT, STORY_CONTENT, STORY_DATE, STORY_SHARED_DATE, STORY_SHORTDATE, STORY_LONGDATE, STORY_TABLE + "." + STORY_FEED_ID, STORY_TABLE + "." + STORY_ID, STORY_INTELLIGENCE_AUTHORS, STORY_INTELLIGENCE_FEED, STORY_INTELLIGENCE_TAGS, STORY_INTELLIGENCE_TITLE,
|
||||
STORY_PERMALINK, STORY_READ, STORY_SHARE_COUNT, STORY_TAGS, STORY_TITLE, STORY_SOCIAL_USER_ID, STORY_SOURCE_USER_ID, STORY_SHARED_USER_IDS, STORY_FRIEND_USER_IDS, STORY_PUBLIC_USER_IDS, STORY_SUM_TOTAL
|
||||
};
|
||||
|
||||
|
||||
|
||||
public static final String STORY_INTELLIGENCE_BEST = " (" + DatabaseConstants.STORY_INTELLIGENCE_AUTHORS + " + " + DatabaseConstants.STORY_INTELLIGENCE_FEED + " + " + DatabaseConstants.STORY_INTELLIGENCE_TAGS + " + " + DatabaseConstants.STORY_INTELLIGENCE_TITLE + ") > 0 ";
|
||||
public static final String STORY_INTELLIGENCE_SOME = " (" + DatabaseConstants.STORY_INTELLIGENCE_AUTHORS + " + " + DatabaseConstants.STORY_INTELLIGENCE_FEED + " + " + DatabaseConstants.STORY_INTELLIGENCE_TAGS + " + " + DatabaseConstants.STORY_INTELLIGENCE_TITLE + ") >= 0 ";
|
||||
public static final String STORY_INTELLIGENCE_ALL = " (" + DatabaseConstants.STORY_INTELLIGENCE_AUTHORS + " + " + DatabaseConstants.STORY_INTELLIGENCE_FEED + " + " + DatabaseConstants.STORY_INTELLIGENCE_TAGS + " + " + DatabaseConstants.STORY_INTELLIGENCE_TITLE + ") >= 0 ";
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@ import android.support.v4.widget.SimpleCursorAdapter;
|
|||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.newsblur.R;
|
||||
|
|
|
@ -223,7 +223,7 @@ public class FeedProvider extends ContentProvider {
|
|||
break;
|
||||
|
||||
case UriMatcher.NO_MATCH:
|
||||
Log.d(TAG, "No match found for URI: " + uri.toString());
|
||||
Log.e(TAG, "No match found for URI: " + uri.toString());
|
||||
break;
|
||||
}
|
||||
return resultUri;
|
||||
|
@ -231,7 +231,6 @@ public class FeedProvider extends ContentProvider {
|
|||
|
||||
@Override
|
||||
public boolean onCreate() {
|
||||
Log.d(TAG, "Creating provider and database.");
|
||||
databaseHelper = new BlurDatabase(getContext().getApplicationContext());
|
||||
return true;
|
||||
}
|
||||
|
@ -246,7 +245,6 @@ public class FeedProvider extends ContentProvider {
|
|||
return db.rawQuery("SELECT " + TextUtils.join(",", DatabaseConstants.FEED_COLUMNS) + " FROM " + DatabaseConstants.FEED_FOLDER_MAP_TABLE +
|
||||
" INNER JOIN " + DatabaseConstants.FEED_TABLE +
|
||||
" ON " + DatabaseConstants.FEED_TABLE + "." + DatabaseConstants.FEED_ID + " = " + DatabaseConstants.FEED_FOLDER_MAP_TABLE + "." + DatabaseConstants.FEED_FOLDER_FEED_ID +
|
||||
" WHERE (" + DatabaseConstants.FEED_NEGATIVE_COUNT + " + " + DatabaseConstants.FEED_NEUTRAL_COUNT + " + " + DatabaseConstants.FEED_POSITIVE_COUNT + ") > 0 " +
|
||||
" ORDER BY " + DatabaseConstants.FEED_TABLE + "." + DatabaseConstants.FEED_TITLE + " COLLATE NOCASE", selectionArgs);
|
||||
|
||||
// Query for a specific feed
|
||||
|
@ -415,7 +413,10 @@ public class FeedProvider extends ContentProvider {
|
|||
allSharedBuilder.append(" WHERE ");
|
||||
allSharedBuilder.append(selection);
|
||||
}
|
||||
allSharedBuilder.append(" ORDER BY " + DatabaseConstants.STORY_DATE + " DESC");
|
||||
allSharedBuilder.append("GROUP BY " + DatabaseConstants.STORY_TABLE + "." + DatabaseConstants.STORY_ID);
|
||||
if (!TextUtils.isEmpty(sortOrder)) {
|
||||
allSharedBuilder.append(" ORDER BY " + sortOrder);
|
||||
}
|
||||
return db.rawQuery(allSharedBuilder.toString(), null);
|
||||
|
||||
case SOCIALFEED_STORIES:
|
||||
|
@ -437,7 +438,9 @@ public class FeedProvider extends ContentProvider {
|
|||
storyBuilder.append("AND ");
|
||||
storyBuilder.append(selection);
|
||||
}
|
||||
storyBuilder.append(" ORDER BY " + DatabaseConstants.STORY_DATE + " DESC");
|
||||
if (!TextUtils.isEmpty(sortOrder)) {
|
||||
storyBuilder.append(" ORDER BY " + sortOrder);
|
||||
}
|
||||
return db.rawQuery(storyBuilder.toString(), userArgument);
|
||||
default:
|
||||
throw new UnsupportedOperationException("Unknown URI: " + uri);
|
||||
|
|
|
@ -10,6 +10,7 @@ import android.database.DataSetObserver;
|
|||
import android.net.Uri;
|
||||
import android.os.Handler;
|
||||
import android.support.v4.widget.SimpleCursorAdapter.ViewBinder;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Config;
|
||||
import android.util.Log;
|
||||
import android.util.SparseArray;
|
||||
|
@ -53,7 +54,7 @@ public class MixedExpandableListAdapter extends BaseExpandableListAdapter{
|
|||
private int[] blogTo;
|
||||
|
||||
private String[] childFromNames;
|
||||
|
||||
|
||||
private final int childLayout, expandedGroupLayout, collapsedGroupLayout, blogGroupLayout;
|
||||
private final LayoutInflater inflater;
|
||||
private ViewBinder groupViewBinder;
|
||||
|
@ -61,8 +62,7 @@ public class MixedExpandableListAdapter extends BaseExpandableListAdapter{
|
|||
|
||||
public int currentState = AppConstants.STATE_SOME;
|
||||
private Cursor allStoriesCountCursor, sharedStoriesCountCursor;
|
||||
private String TAG = "MixedExpandableAdapter";
|
||||
|
||||
|
||||
public MixedExpandableListAdapter(final Context context, final Cursor folderCursor, final Cursor blogCursor, final Cursor countCursor, final Cursor sharedCountCursor, final int collapsedGroupLayout,
|
||||
int expandedGroupLayout, int blogGroupLayout, String[] groupFrom, int[] groupTo, int childLayout, String[] childFrom, int[] childTo, String[] blogFrom, int[] blogTo) {
|
||||
this.context = context;
|
||||
|
@ -89,14 +89,14 @@ public class MixedExpandableListAdapter extends BaseExpandableListAdapter{
|
|||
this.groupTo = groupTo;
|
||||
this.childTo = childTo;
|
||||
this.blogTo = blogTo;
|
||||
|
||||
|
||||
initGroupFromColumns(groupFromNames);
|
||||
initBlogFromColumns(blogFromNames);
|
||||
initialiseChildBinds(childFromNames);
|
||||
}
|
||||
|
||||
private void initialiseChildBinds(final String[] childFromNames) {
|
||||
MyCursorHelper tmpCursorHelper = getChildrenCursorHelper(2, true);
|
||||
MyCursorHelper tmpCursorHelper = getChildrenCursorHelper(0, true);
|
||||
if (tmpCursorHelper != null) {
|
||||
initChildrenFromColumns(childFromNames, tmpCursorHelper.getCursor());
|
||||
deactivateChildrenCursorHelper(0);
|
||||
|
@ -118,7 +118,7 @@ public class MixedExpandableListAdapter extends BaseExpandableListAdapter{
|
|||
groupFrom = new int[groupFromNames.length];
|
||||
initFromColumns(folderCursorHelper.getCursor(), groupFromNames, groupFrom);
|
||||
}
|
||||
|
||||
|
||||
private void initBlogFromColumns(String[] blogFromNames) {
|
||||
blogFrom = new int[blogFromNames.length];
|
||||
initFromColumns(blogCursorHelper.getCursor(), blogFromNames, blogFrom);
|
||||
|
@ -131,8 +131,7 @@ public class MixedExpandableListAdapter extends BaseExpandableListAdapter{
|
|||
|
||||
protected Cursor getChildrenCursor(Cursor folderCursor) {
|
||||
final Folder parentFolder = Folder.fromCursor(folderCursor);
|
||||
Uri uri = null;
|
||||
uri = FeedProvider.FEED_FOLDER_MAP_URI.buildUpon().appendPath(parentFolder.getName()).build();
|
||||
Uri uri = FeedProvider.FEED_FOLDER_MAP_URI.buildUpon().appendPath(parentFolder.getName()).build();
|
||||
return contentResolver.query(uri, null, null, new String[] { FeedProvider.getFolderSelectionFromState(currentState) }, null);
|
||||
}
|
||||
|
||||
|
@ -146,7 +145,7 @@ public class MixedExpandableListAdapter extends BaseExpandableListAdapter{
|
|||
return FOLDER;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public int getChildType(int groupPosition, int childPosition) {
|
||||
if (groupPosition == 0) {
|
||||
return BLOG;
|
||||
|
@ -190,13 +189,13 @@ public class MixedExpandableListAdapter extends BaseExpandableListAdapter{
|
|||
public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent) {
|
||||
View v;
|
||||
if (groupPosition == 0) {
|
||||
blogCursorHelper.moveTo(childPosition);
|
||||
if (convertView == null) {
|
||||
v = newBlogView(context, blogCursorHelper.getCursor(), parent);
|
||||
} else {
|
||||
v = convertView;
|
||||
}
|
||||
bindBlogView(v, context, blogCursorHelper.getCursor());
|
||||
blogCursorHelper.moveTo(childPosition);
|
||||
if (convertView == null) {
|
||||
v = newBlogView(context, blogCursorHelper.getCursor(), parent);
|
||||
} else {
|
||||
v = convertView;
|
||||
}
|
||||
bindBlogView(v, context, blogCursorHelper.getCursor());
|
||||
} else {
|
||||
groupPosition = groupPosition - 2;
|
||||
|
||||
|
@ -237,7 +236,7 @@ public class MixedExpandableListAdapter extends BaseExpandableListAdapter{
|
|||
public Cursor getGroup(int groupPosition) {
|
||||
return folderCursorHelper.moveTo(groupPosition - 2);
|
||||
}
|
||||
|
||||
|
||||
public Cursor getBlogCursor(int childPosition) {
|
||||
return blogCursorHelper.moveTo(childPosition);
|
||||
}
|
||||
|
@ -284,13 +283,27 @@ public class MixedExpandableListAdapter extends BaseExpandableListAdapter{
|
|||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent i = new Intent(context, AllSharedStoriesItemsList.class);
|
||||
|
||||
i.putExtra(AllStoriesItemsList.EXTRA_STATE, currentState);
|
||||
((Activity) context).startActivityForResult(i, Activity.RESULT_OK);
|
||||
}
|
||||
});
|
||||
((TextView) v.findViewById(R.id.row_foldersumneu)).setText(sharedStoriesCountCursor.getString(sharedStoriesCountCursor.getColumnIndex(DatabaseConstants.SUM_NEUT)));
|
||||
((TextView) v.findViewById(R.id.row_foldersumpos)).setText(sharedStoriesCountCursor.getString(sharedStoriesCountCursor.getColumnIndex(DatabaseConstants.SUM_POS)));
|
||||
String neutCount = sharedStoriesCountCursor.getString(sharedStoriesCountCursor.getColumnIndex(DatabaseConstants.SUM_NEUT));
|
||||
if (TextUtils.isEmpty(neutCount) || TextUtils.equals(neutCount, "0")) {
|
||||
v.findViewById(R.id.row_foldersumneu).setVisibility(View.GONE);
|
||||
} else {
|
||||
v.findViewById(R.id.row_foldersumneu).setVisibility(View.VISIBLE);
|
||||
((TextView) v.findViewById(R.id.row_foldersumneu)).setText(neutCount);
|
||||
}
|
||||
|
||||
String posCount = sharedStoriesCountCursor.getString(sharedStoriesCountCursor.getColumnIndex(DatabaseConstants.SUM_POS));
|
||||
if (TextUtils.isEmpty(posCount) || TextUtils.equals(posCount, "0")) {
|
||||
v.findViewById(R.id.row_foldersumpos).setVisibility(View.GONE);
|
||||
} else {
|
||||
v.findViewById(R.id.row_foldersumpos).setVisibility(View.VISIBLE);
|
||||
((TextView) v.findViewById(R.id.row_foldersumpos)).setText(posCount);
|
||||
}
|
||||
|
||||
v.findViewById(R.id.row_foldersums).setVisibility(isExpanded ? View.INVISIBLE : View.VISIBLE);
|
||||
((ImageView) v.findViewById(R.id.row_folder_indicator)).setImageResource(isExpanded ? R.drawable.indicator_expanded : R.drawable.indicator_collapsed);
|
||||
} else if (groupPosition == 1) {
|
||||
cursor = allStoriesCountCursor;
|
||||
|
@ -340,14 +353,17 @@ public class MixedExpandableListAdapter extends BaseExpandableListAdapter{
|
|||
// This 'if' is for an edge case, where we've no intialised the child-from to cursor-column mapping yet because we've initialised the adapter but
|
||||
// it contained no group cursor yet. This happens when first registering, assuming the user initially has no data.
|
||||
if (childFrom == null) {
|
||||
initialiseChildBinds(childFromNames);
|
||||
MyCursorHelper tmpCursorHelper = getChildrenCursorHelper(0, true);
|
||||
if (tmpCursorHelper != null) {
|
||||
initChildrenFromColumns(childFromNames, tmpCursorHelper.getCursor());
|
||||
}
|
||||
}
|
||||
bindView(view, context, cursor, childFrom, childTo, groupViewBinder);
|
||||
|
||||
}
|
||||
|
||||
protected void bindGroupView(View view, Context context, Cursor cursor, boolean isExpanded) {
|
||||
bindView(view, context, cursor, groupFrom, groupTo, groupViewBinder);
|
||||
view.findViewById(R.id.row_foldersums).setVisibility(isExpanded ? View.INVISIBLE : View.VISIBLE);
|
||||
((ImageView) view.findViewById(R.id.row_folder_icon)).setImageResource(isExpanded ? R.drawable.folder_open : R.drawable.folder_closed);
|
||||
((ImageView) view.findViewById(R.id.row_folder_indicator)).setImageResource(isExpanded ? R.drawable.indicator_expanded : R.drawable.indicator_collapsed);
|
||||
}
|
||||
|
@ -358,7 +374,6 @@ public class MixedExpandableListAdapter extends BaseExpandableListAdapter{
|
|||
|
||||
private void bindView(View view, Context context, Cursor cursor, int[] from, int[] to, ViewBinder viewbinder) {
|
||||
final ViewBinder binder = viewbinder;
|
||||
|
||||
for (int i = 0; i < to.length; i++) {
|
||||
View v = view.findViewById(to[i]);
|
||||
if (v != null) {
|
||||
|
@ -503,12 +518,10 @@ public class MixedExpandableListAdapter extends BaseExpandableListAdapter{
|
|||
cursor.registerDataSetObserver(mDataSetObserver);
|
||||
mRowIDColumn = cursor.getColumnIndex("_id");
|
||||
mDataValid = true;
|
||||
// notify the observers about the new cursor
|
||||
notifyDataSetChanged(releaseCursors);
|
||||
} else {
|
||||
mRowIDColumn = -1;
|
||||
mDataValid = false;
|
||||
// notify the observers about the lack of a data set
|
||||
notifyDataSetInvalidated();
|
||||
}
|
||||
}
|
||||
|
@ -520,6 +533,7 @@ public class MixedExpandableListAdapter extends BaseExpandableListAdapter{
|
|||
|
||||
mCursor.unregisterContentObserver(mContentObserver);
|
||||
mCursor.unregisterDataSetObserver(mDataSetObserver);
|
||||
mCursor.close();
|
||||
mCursor.deactivate();
|
||||
mCursor = null;
|
||||
}
|
||||
|
@ -541,8 +555,6 @@ public class MixedExpandableListAdapter extends BaseExpandableListAdapter{
|
|||
@Override
|
||||
public void onChange(boolean selfChange) {
|
||||
if (mAutoRequery && mCursor != null) {
|
||||
if (Config.LOGV) Log.v("Cursor", "Auto requerying " + mCursor +
|
||||
" due to update");
|
||||
mDataValid = mCursor.requery();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,8 @@ package com.newsblur.domain;
|
|||
|
||||
import android.content.ContentValues;
|
||||
import android.database.Cursor;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.newsblur.database.DatabaseConstants;
|
||||
|
@ -90,8 +92,17 @@ public class Feed {
|
|||
feed.positiveCount = childCursor.getInt(childCursor.getColumnIndex(DatabaseConstants.FEED_POSITIVE_COUNT));
|
||||
feed.subscribers = childCursor.getString(childCursor.getColumnIndex(DatabaseConstants.FEED_SUBSCRIBERS));
|
||||
feed.title = childCursor.getString(childCursor.getColumnIndex(DatabaseConstants.FEED_TITLE));
|
||||
childCursor.close();
|
||||
return feed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
Feed otherFeed = (Feed) o;
|
||||
boolean isEquals = (TextUtils.equals(feedId, otherFeed.feedId) &&
|
||||
negativeCount == otherFeed.negativeCount &&
|
||||
neutralCount == otherFeed.neutralCount &&
|
||||
positiveCount == otherFeed.positiveCount);
|
||||
return isEquals;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.newsblur.domain;
|
|||
|
||||
import android.content.ContentValues;
|
||||
import android.database.Cursor;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.newsblur.database.DatabaseConstants;
|
||||
|
||||
|
@ -32,5 +33,9 @@ public class Folder {
|
|||
return folder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object otherFolder) {
|
||||
return TextUtils.equals(((Folder) otherFolder).getId(), getId());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.newsblur.domain;
|
|||
|
||||
import android.content.ContentValues;
|
||||
import android.database.Cursor;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.newsblur.database.DatabaseConstants;
|
||||
|
@ -41,7 +42,9 @@ public class SocialFeed {
|
|||
}
|
||||
|
||||
public static SocialFeed fromCursor(final Cursor cursor) {
|
||||
cursor.moveToFirst();
|
||||
if (cursor.isBeforeFirst()) {
|
||||
cursor.moveToFirst();
|
||||
}
|
||||
SocialFeed socialFeed = new SocialFeed();
|
||||
socialFeed.userId = cursor.getString(cursor.getColumnIndex(DatabaseConstants.SOCIAL_FEED_ID));
|
||||
socialFeed.username = cursor.getString(cursor.getColumnIndex(DatabaseConstants.SOCIAL_FEED_USERNAME));
|
||||
|
@ -53,4 +56,15 @@ public class SocialFeed {
|
|||
return socialFeed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
SocialFeed otherFeed = (SocialFeed) o;
|
||||
boolean equals = (TextUtils.equals(userId, otherFeed.userId) &&
|
||||
positiveCount == otherFeed.positiveCount &&
|
||||
neutralCount == otherFeed.neutralCount &&
|
||||
negativeCount == otherFeed.negativeCount &&
|
||||
TextUtils.equals(photoUrl, otherFeed.photoUrl));
|
||||
return equals;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,11 +1,15 @@
|
|||
package com.newsblur.domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import android.content.ContentValues;
|
||||
import android.database.Cursor;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.newsblur.database.DatabaseConstants;
|
||||
|
@ -15,22 +19,22 @@ public class Story implements Serializable {
|
|||
private static final long serialVersionUID = 7629596752129163308L;
|
||||
|
||||
public String id;
|
||||
|
||||
|
||||
@SerializedName("story_permalink")
|
||||
public String permalink;
|
||||
|
||||
@SerializedName("share_count")
|
||||
public String shareCount;
|
||||
|
||||
|
||||
@SerializedName("share_user_ids")
|
||||
public String[] sharedUserIds;
|
||||
|
||||
@SerializedName("shared_by_friends")
|
||||
public String[] friendUserIds = new String[]{};
|
||||
|
||||
|
||||
@SerializedName("shared_by_public")
|
||||
public String[] publicUserIds = new String[]{};
|
||||
|
||||
|
||||
@SerializedName("comment_count")
|
||||
public int commentCount;
|
||||
|
||||
|
@ -45,13 +49,13 @@ public class Story implements Serializable {
|
|||
|
||||
@SerializedName("source_user_id")
|
||||
public String sourceUserId;
|
||||
|
||||
|
||||
@SerializedName("story_title")
|
||||
public String title;
|
||||
|
||||
@SerializedName("story_date")
|
||||
public Date date;
|
||||
|
||||
|
||||
@SerializedName("shared_date")
|
||||
public Date sharedDate;
|
||||
|
||||
|
@ -66,7 +70,7 @@ public class Story implements Serializable {
|
|||
|
||||
@SerializedName("public_comments")
|
||||
public Comment[] publicComments;
|
||||
|
||||
|
||||
@SerializedName("friend_comments")
|
||||
public Comment[] friendsComments;
|
||||
|
||||
|
@ -75,10 +79,10 @@ public class Story implements Serializable {
|
|||
|
||||
@SerializedName("short_parsed_date")
|
||||
public String shortDate;
|
||||
|
||||
|
||||
@SerializedName("long_parsed_date")
|
||||
public String longDate;
|
||||
|
||||
|
||||
public ContentValues getValues() {
|
||||
final ContentValues values = new ContentValues();
|
||||
values.put(DatabaseConstants.STORY_ID, id);
|
||||
|
@ -106,14 +110,14 @@ public class Story implements Serializable {
|
|||
values.put(DatabaseConstants.STORY_FEED_ID, feedId);
|
||||
return values;
|
||||
}
|
||||
|
||||
|
||||
public static Story fromCursor(final Cursor cursor) {
|
||||
Story story = new Story();
|
||||
story.authors = cursor.getString(cursor.getColumnIndex(DatabaseConstants.STORY_AUTHORS));
|
||||
story.content = cursor.getString(cursor.getColumnIndex(DatabaseConstants.STORY_CONTENT));
|
||||
story.title = cursor.getString(cursor.getColumnIndex(DatabaseConstants.STORY_TITLE));
|
||||
story.date = new Date(cursor.getLong(cursor.getColumnIndex(DatabaseConstants.STORY_DATE)));
|
||||
story.sharedDate = new Date(cursor.getLong(cursor.getColumnIndex(DatabaseConstants.STORY_DATE)));
|
||||
story.sharedDate = new Date(cursor.getLong(cursor.getColumnIndex(DatabaseConstants.STORY_SHARED_DATE)));
|
||||
story.shortDate = cursor.getString(cursor.getColumnIndex(DatabaseConstants.STORY_SHORTDATE));
|
||||
story.longDate = cursor.getString(cursor.getColumnIndex(DatabaseConstants.STORY_LONGDATE));
|
||||
story.shareCount = cursor.getString(cursor.getColumnIndex(DatabaseConstants.STORY_SHARE_COUNT));
|
||||
|
@ -134,24 +138,41 @@ public class Story implements Serializable {
|
|||
story.id = cursor.getString(cursor.getColumnIndex(DatabaseConstants.STORY_ID));
|
||||
return story;
|
||||
}
|
||||
|
||||
|
||||
public class Intelligence implements Serializable {
|
||||
private static final long serialVersionUID = -1314486209455376730L;
|
||||
|
||||
@SerializedName("feed")
|
||||
public int intelligenceFeed = 0;
|
||||
|
||||
|
||||
@SerializedName("author")
|
||||
public int intelligenceAuthors = 0;
|
||||
|
||||
|
||||
@SerializedName("tags")
|
||||
public int intelligenceTags = 0;
|
||||
|
||||
|
||||
@SerializedName("title")
|
||||
public int intelligenceTitle = 0;
|
||||
}
|
||||
|
||||
public int getIntelligenceTotal() {
|
||||
return (intelligence.intelligenceAuthors + intelligence.intelligenceFeed + intelligence.intelligenceTags + intelligence.intelligenceTitle);
|
||||
return getIntelligenceTotal(intelligence.intelligenceTitle, intelligence.intelligenceAuthors, intelligence.intelligenceTags, intelligence.intelligenceFeed);
|
||||
}
|
||||
|
||||
public static int getIntelligenceTotal(int title, int authors, int tags, int feed) {
|
||||
int score = 0;
|
||||
List<Integer> list = Arrays.asList(title, authors, tags);
|
||||
int max = Collections.max(list);
|
||||
int min = Collections.min(list);
|
||||
|
||||
if (max > 0) {
|
||||
score = max;
|
||||
} else if (min < 0) {
|
||||
score = min;
|
||||
} else {
|
||||
score = feed;
|
||||
}
|
||||
return score;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ 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.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
|
@ -45,6 +46,20 @@ public class AddFollowFragment extends Fragment {
|
|||
followingPopularText = (TextView) parentView.findViewById(R.id.addfollow_popular_text);
|
||||
followingPopularCheckbox = (CheckBox) parentView.findViewById(R.id.addfollow_popular_checkbox);
|
||||
|
||||
followingPopularLayout.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
followingPopularCheckbox.toggle();
|
||||
}
|
||||
});
|
||||
|
||||
followingNewsblurLayout.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
followingNewsblurCheckbox.toggle();
|
||||
}
|
||||
});
|
||||
|
||||
setupUI();
|
||||
|
||||
followingNewsblurCheckbox.setOnCheckedChangeListener(new OnCheckedChangeListener() {
|
||||
|
@ -56,7 +71,6 @@ public class AddFollowFragment extends Fragment {
|
|||
@Override
|
||||
protected Void doInBackground(Void... arg0) {
|
||||
boolean addedOkay = apiManager.addFeed("http://blog.newsblur.com", null);
|
||||
Log.d(TAG, "Added okay: " + addedOkay);
|
||||
followingNewsblur = true;
|
||||
return null;
|
||||
}
|
||||
|
@ -78,8 +92,7 @@ public class AddFollowFragment extends Fragment {
|
|||
|
||||
@Override
|
||||
protected Void doInBackground(Void... arg0) {
|
||||
|
||||
boolean addedOkay = apiManager.addFeed("http://popular.newsblur.com/", null);
|
||||
boolean addedOkay = apiManager.followUser("popular");
|
||||
followingPopular = true;
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -3,11 +3,13 @@ package com.newsblur.fragment;
|
|||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Color;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.text.TextUtils;
|
||||
|
@ -38,8 +40,10 @@ public class AddSitesListFragment extends Fragment {
|
|||
private APIManager apiManager;
|
||||
private View parentView;
|
||||
private boolean readerImported = false;
|
||||
|
||||
|
||||
HashSet<String> categoriesToAdd = new HashSet<String>();
|
||||
private int darkGray;
|
||||
private int midGray;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -47,7 +51,7 @@ public class AddSitesListFragment extends Fragment {
|
|||
setRetainInstance(true);
|
||||
apiManager = new APIManager(getActivity());
|
||||
}
|
||||
|
||||
|
||||
public ArrayList<String> getSelectedCategories() {
|
||||
ArrayList<String> categoriesArrayList = new ArrayList<String>();
|
||||
categoriesArrayList.addAll(categoriesToAdd);
|
||||
|
@ -58,6 +62,9 @@ public class AddSitesListFragment extends Fragment {
|
|||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
parentView = inflater.inflate(R.layout.fragment_addsites, null);
|
||||
|
||||
darkGray = getResources().getColor(R.color.darkgray);
|
||||
midGray = getResources().getColor(R.color.midgray);
|
||||
|
||||
importReaderButton = (Button) parentView.findViewById(R.id.login_add_reader_button);
|
||||
importReaderButton.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
|
@ -88,7 +95,7 @@ public class AddSitesListFragment extends Fragment {
|
|||
importReaderButton.setEnabled(false);
|
||||
importReaderButton.setText("Feeds imported!");
|
||||
}
|
||||
|
||||
|
||||
return parentView;
|
||||
}
|
||||
|
||||
|
@ -102,31 +109,38 @@ public class AddSitesListFragment extends Fragment {
|
|||
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() {
|
||||
final CheckBox categoryCheckbox = (CheckBox) categoryView.findViewById(R.id.category_checkbox);
|
||||
|
||||
View container = categoryView.findViewById(R.id.category_container);
|
||||
container.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
if (isChecked) {
|
||||
categoriesToAdd.add(category.title);
|
||||
} else {
|
||||
categoriesToAdd.remove(category.title);
|
||||
|
||||
}
|
||||
public void onClick(View arg0) {
|
||||
categoryCheckbox.toggle();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
categoryCheckbox.setChecked(categoriesToAdd.contains(category.title));
|
||||
|
||||
|
||||
categoryTitle.setText(category.title);
|
||||
|
||||
final ArrayList<TextView> feedTitleViews = new ArrayList<TextView>();
|
||||
final ArrayList<View> feedBorderViews = new ArrayList<View>();
|
||||
final ArrayList<ImageView> feedIconViews = new ArrayList<ImageView>();
|
||||
|
||||
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);
|
||||
|
||||
feedTitleViews.add(feedTitle);
|
||||
|
||||
View borderOne = feedView.findViewById(R.id.login_category_feed_leftbar);
|
||||
View borderTwo = feedView.findViewById(R.id.login_category_feed_rightbar);
|
||||
|
||||
feedBorderViews.add(borderTwo);
|
||||
feedBorderViews.add(borderOne);
|
||||
|
||||
if (!TextUtils.isEmpty(feed.faviconColour) && !TextUtils.equals(feed.faviconColour, "null")) {
|
||||
borderOne.setBackgroundColor(Color.parseColor("#".concat(feed.faviconColour)));
|
||||
borderTwo.setBackgroundColor(Color.parseColor("#".concat(feed.faviconColour)));
|
||||
|
@ -142,14 +156,62 @@ public class AddSitesListFragment extends Fragment {
|
|||
} else {
|
||||
bitmap = BitmapFactory.decodeResource(getActivity().getResources(), R.drawable.world);
|
||||
}
|
||||
((ImageView) feedView.findViewById(R.id.login_category_feed_icon)).setImageBitmap(bitmap);
|
||||
ImageView feedIcon = (ImageView) feedView.findViewById(R.id.login_category_feed_icon);
|
||||
feedIcon.setImageBitmap(bitmap);
|
||||
feedIconViews.add(feedIcon);
|
||||
|
||||
categoryView.addView(feedView);
|
||||
}
|
||||
|
||||
|
||||
categoryCheckbox.setOnCheckedChangeListener(new OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
if (isChecked) {
|
||||
displayFull(feedBorderViews, feedIconViews, feedTitleViews);
|
||||
categoriesToAdd.add(category.title);
|
||||
} else {
|
||||
displayHalf(feedBorderViews, feedIconViews, feedTitleViews);
|
||||
categoriesToAdd.remove(category.title);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
displayHalf(feedBorderViews, feedIconViews, feedTitleViews);
|
||||
categoryContainer.addView(categoryView);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@TargetApi(11)
|
||||
private void displayHalf(final ArrayList<View> feedBorderViews, final ArrayList<ImageView> feedIconViews, final ArrayList<TextView> feedTitleViews) {
|
||||
for (TextView feedTitle : feedTitleViews) {
|
||||
feedTitle.setTextColor(midGray);
|
||||
}
|
||||
|
||||
for (ImageView feedImage : feedIconViews) {
|
||||
feedImage.setAlpha(125);
|
||||
}
|
||||
|
||||
for (View feedBorder : feedBorderViews) {
|
||||
feedBorder.setAlpha(125);
|
||||
}
|
||||
}
|
||||
|
||||
@TargetApi(11)
|
||||
private void displayFull(final ArrayList<View> feedBorderViews, final ArrayList<ImageView> feedIconViews, final ArrayList<TextView> feedTitleViews) {
|
||||
for (TextView feedTitle : feedTitleViews) {
|
||||
feedTitle.setTextColor(darkGray);
|
||||
}
|
||||
|
||||
for (ImageView feedImage : feedIconViews) {
|
||||
feedImage.setAlpha(255);
|
||||
}
|
||||
|
||||
for (View feedBorder : feedBorderViews) {
|
||||
feedBorder.setAlpha(255);
|
||||
}
|
||||
}
|
||||
|
||||
public void setGoogleReaderImported() {
|
||||
readerImported = true;
|
||||
|
|
|
@ -85,17 +85,10 @@ public class AddSocialFragment extends Fragment {
|
|||
@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();
|
||||
}
|
||||
});
|
||||
|
|
|
@ -38,56 +38,57 @@ public class AllSharedStoriesItemListFragment extends ItemListFragment implement
|
|||
private SimpleCursorAdapter adapter;
|
||||
private boolean requestedPage;
|
||||
private int currentPage = 0;
|
||||
|
||||
|
||||
public static int ITEMLIST_LOADER = 0x01;
|
||||
private static final String TAG = "AllSharedStoriesItemListFragment";
|
||||
private Cursor countCursor;
|
||||
|
||||
private ListView itemList;
|
||||
private String[] groupFrom;
|
||||
private int[] groupTo;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
currentState = getArguments().getInt("currentState");
|
||||
|
||||
|
||||
if (!NetworkUtils.isOnline(getActivity())) {
|
||||
doRequest = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
View v = inflater.inflate(R.layout.fragment_itemlist, null);
|
||||
ListView itemList = (ListView) v.findViewById(R.id.itemlistfragment_list);
|
||||
|
||||
itemList = (ListView) v.findViewById(R.id.itemlistfragment_list);
|
||||
itemList.setEmptyView(v.findViewById(R.id.empty_view));
|
||||
|
||||
|
||||
contentResolver = getActivity().getContentResolver();
|
||||
Cursor cursor = contentResolver.query(FeedProvider.ALL_SHARED_STORIES_URI, null, FeedProvider.getStorySelectionFromState(currentState), null, null);
|
||||
|
||||
String[] groupFrom = new String[] { DatabaseConstants.STORY_TITLE, DatabaseConstants.STORY_AUTHORS, DatabaseConstants.STORY_TITLE, DatabaseConstants.STORY_SHORTDATE, DatabaseConstants.STORY_INTELLIGENCE_AUTHORS, DatabaseConstants.FEED_TITLE };
|
||||
int[] groupTo = new int[] { R.id.row_item_title, R.id.row_item_author, R.id.row_item_title, R.id.row_item_date, R.id.row_item_sidebar, R.id.row_item_feedtitle };
|
||||
|
||||
groupFrom = new String[] { DatabaseConstants.STORY_TITLE, DatabaseConstants.STORY_AUTHORS, DatabaseConstants.STORY_TITLE, DatabaseConstants.STORY_SHORTDATE, DatabaseConstants.STORY_INTELLIGENCE_AUTHORS, DatabaseConstants.FEED_TITLE };
|
||||
groupTo = new int[] { R.id.row_item_title, R.id.row_item_author, R.id.row_item_title, R.id.row_item_date, R.id.row_item_sidebar, R.id.row_item_feedtitle };
|
||||
|
||||
getLoaderManager().initLoader(ITEMLIST_LOADER , null, this);
|
||||
|
||||
adapter = new MultipleFeedItemsAdapter(getActivity(), R.layout.row_socialitem, cursor, groupFrom, groupTo, CursorAdapter.FLAG_REGISTER_CONTENT_OBSERVER);
|
||||
|
||||
itemList.setOnScrollListener(this);
|
||||
|
||||
adapter.setViewBinder(new SocialItemViewBinder(getActivity()));
|
||||
itemList.setAdapter(adapter);
|
||||
itemList.setOnItemClickListener(this);
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) {
|
||||
if (adapter == null) {
|
||||
adapter = new MultipleFeedItemsAdapter(getActivity(), R.layout.row_socialitem, cursor, groupFrom, groupTo, CursorAdapter.FLAG_REGISTER_CONTENT_OBSERVER);
|
||||
adapter.setViewBinder(new SocialItemViewBinder(getActivity()));
|
||||
itemList.setAdapter(adapter);
|
||||
}
|
||||
if (cursor != null) {
|
||||
adapter.swapCursor(cursor);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void hasUpdated() {
|
||||
getLoaderManager().restartLoader(ITEMLIST_LOADER , null, this);
|
||||
requestedPage = false;
|
||||
|
@ -101,7 +102,7 @@ public class AllSharedStoriesItemListFragment extends ItemListFragment implement
|
|||
@Override
|
||||
public void changeState(int state) {
|
||||
currentState = state;
|
||||
Cursor cursor = contentResolver.query(FeedProvider.ALL_SHARED_STORIES_URI, null, FeedProvider.getStorySelectionFromState(currentState), null, null);
|
||||
Cursor cursor = contentResolver.query(FeedProvider.ALL_SHARED_STORIES_URI, null, FeedProvider.getStorySelectionFromState(currentState), null, DatabaseConstants.STORY_DATE + " desc");
|
||||
adapter.swapCursor(cursor);
|
||||
}
|
||||
|
||||
|
@ -110,20 +111,16 @@ public class AllSharedStoriesItemListFragment extends ItemListFragment implement
|
|||
Bundle arguments = new Bundle();
|
||||
arguments.putInt("currentState", currentState);
|
||||
everythingFragment.setArguments(arguments);
|
||||
|
||||
|
||||
return everythingFragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onScroll(AbsListView view, int firstVisible, int visibleCount, int totalCount) {
|
||||
if (firstVisible + visibleCount == totalCount) {
|
||||
if (!requestedPage && doRequest) {
|
||||
currentPage += 1;
|
||||
requestedPage = true;
|
||||
((ItemsList) getActivity()).triggerRefresh(currentPage);
|
||||
} else {
|
||||
Log.d(TAG, "No need");
|
||||
}
|
||||
if (firstVisible + visibleCount == totalCount && !requestedPage && doRequest) {
|
||||
currentPage += 1;
|
||||
requestedPage = true;
|
||||
((ItemsList) getActivity()).triggerRefresh(currentPage);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -140,8 +137,8 @@ public class AllSharedStoriesItemListFragment extends ItemListFragment implement
|
|||
|
||||
@Override
|
||||
public Loader<Cursor> onCreateLoader(int arg0, Bundle arg1) {
|
||||
CursorLoader cursorLoader = new CursorLoader(getActivity(), FeedProvider.ALL_SHARED_STORIES_URI, null, FeedProvider.getStorySelectionFromState(currentState), null, null);
|
||||
return cursorLoader;
|
||||
CursorLoader cursorLoader = new CursorLoader(getActivity(), FeedProvider.ALL_SHARED_STORIES_URI, null, FeedProvider.getStorySelectionFromState(currentState), null, DatabaseConstants.STORY_DATE + " desc");
|
||||
return cursorLoader;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@ import android.support.v4.content.CursorLoader;
|
|||
import android.support.v4.content.Loader;
|
||||
import android.support.v4.widget.CursorAdapter;
|
||||
import android.support.v4.widget.SimpleCursorAdapter;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -26,7 +25,6 @@ import com.newsblur.activity.ItemsList;
|
|||
import com.newsblur.database.DatabaseConstants;
|
||||
import com.newsblur.database.FeedProvider;
|
||||
import com.newsblur.database.MultipleFeedItemsAdapter;
|
||||
import com.newsblur.util.AppConstants;
|
||||
import com.newsblur.util.NetworkUtils;
|
||||
import com.newsblur.view.SocialItemViewBinder;
|
||||
|
||||
|
@ -38,33 +36,28 @@ public class AllStoriesItemListFragment extends ItemListFragment implements Load
|
|||
private SimpleCursorAdapter adapter;
|
||||
private boolean requestedPage;
|
||||
private int currentPage = 0;
|
||||
private int positiveCount, neutralCount, negativeCount;
|
||||
|
||||
|
||||
public static int ITEMLIST_LOADER = 0x01;
|
||||
private static final String TAG = "EverythingItemListFragment";
|
||||
private Cursor countCursor;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
currentState = getArguments().getInt("currentState");
|
||||
|
||||
|
||||
if (!NetworkUtils.isOnline(getActivity())) {
|
||||
doRequest = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
View v = inflater.inflate(R.layout.fragment_itemlist, null);
|
||||
ListView itemList = (ListView) v.findViewById(R.id.itemlistfragment_list);
|
||||
|
||||
itemList.setEmptyView(v.findViewById(R.id.empty_view));
|
||||
|
||||
|
||||
contentResolver = getActivity().getContentResolver();
|
||||
Cursor cursor = contentResolver.query(FeedProvider.ALL_STORIES_URI, null, FeedProvider.getStorySelectionFromState(currentState), null, DatabaseConstants.STORY_DATE + " DESC");
|
||||
calculateTotals();
|
||||
|
||||
|
||||
String[] groupFrom = new String[] { DatabaseConstants.STORY_TITLE, DatabaseConstants.STORY_AUTHORS, DatabaseConstants.STORY_TITLE, DatabaseConstants.STORY_SHORTDATE, DatabaseConstants.STORY_INTELLIGENCE_AUTHORS, DatabaseConstants.FEED_TITLE };
|
||||
int[] groupTo = new int[] { R.id.row_item_title, R.id.row_item_author, R.id.row_item_title, R.id.row_item_date, R.id.row_item_sidebar, R.id.row_item_feedtitle };
|
||||
|
@ -74,7 +67,7 @@ public class AllStoriesItemListFragment extends ItemListFragment implements Load
|
|||
adapter = new MultipleFeedItemsAdapter(getActivity(), R.layout.row_socialitem, cursor, groupFrom, groupTo, CursorAdapter.FLAG_REGISTER_CONTENT_OBSERVER);
|
||||
|
||||
itemList.setOnScrollListener(this);
|
||||
|
||||
|
||||
adapter.setViewBinder(new SocialItemViewBinder(getActivity()));
|
||||
itemList.setAdapter(adapter);
|
||||
itemList.setOnItemClickListener(this);
|
||||
|
@ -82,22 +75,13 @@ public class AllStoriesItemListFragment extends ItemListFragment implements Load
|
|||
return v;
|
||||
}
|
||||
|
||||
private void calculateTotals() {
|
||||
countCursor = contentResolver.query(FeedProvider.FEED_COUNT_URI, null, DatabaseConstants.SOCIAL_INTELLIGENCE_SOME, null, null);
|
||||
|
||||
countCursor.moveToFirst();
|
||||
positiveCount = countCursor.getInt(countCursor.getColumnIndex(DatabaseConstants.SUM_NEG));
|
||||
neutralCount = countCursor.getInt(countCursor.getColumnIndex(DatabaseConstants.SUM_NEUT));
|
||||
negativeCount = countCursor.getInt(countCursor.getColumnIndex(DatabaseConstants.SUM_POS));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) {
|
||||
if (cursor != null) {
|
||||
adapter.swapCursor(cursor);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void hasUpdated() {
|
||||
getLoaderManager().restartLoader(ITEMLIST_LOADER , null, this);
|
||||
requestedPage = false;
|
||||
|
@ -111,7 +95,6 @@ public class AllStoriesItemListFragment extends ItemListFragment implements Load
|
|||
@Override
|
||||
public void changeState(int state) {
|
||||
currentState = state;
|
||||
calculateTotals();
|
||||
final String selection = FeedProvider.getStorySelectionFromState(state);
|
||||
Cursor cursor = contentResolver.query(FeedProvider.ALL_STORIES_URI, null, selection, null, DatabaseConstants.STORY_SHARED_DATE + " DESC");
|
||||
adapter.swapCursor(cursor);
|
||||
|
@ -122,34 +105,16 @@ public class AllStoriesItemListFragment extends ItemListFragment implements Load
|
|||
Bundle arguments = new Bundle();
|
||||
arguments.putInt("currentState", currentState);
|
||||
everythingFragment.setArguments(arguments);
|
||||
|
||||
|
||||
return everythingFragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onScroll(AbsListView view, int firstVisible, int visibleCount, int totalCount) {
|
||||
if (firstVisible + visibleCount == totalCount) {
|
||||
boolean loadMore = false;
|
||||
|
||||
switch (currentState) {
|
||||
case AppConstants.STATE_ALL:
|
||||
loadMore = positiveCount + neutralCount + negativeCount > totalCount;
|
||||
break;
|
||||
case AppConstants.STATE_BEST:
|
||||
loadMore = positiveCount > totalCount;
|
||||
break;
|
||||
case AppConstants.STATE_SOME:
|
||||
loadMore = positiveCount + neutralCount > totalCount;
|
||||
break;
|
||||
}
|
||||
|
||||
if (loadMore && !requestedPage && doRequest) {
|
||||
currentPage += 1;
|
||||
requestedPage = true;
|
||||
((ItemsList) getActivity()).triggerRefresh(currentPage);
|
||||
} else {
|
||||
Log.d(TAG, "No need");
|
||||
}
|
||||
if (firstVisible + visibleCount == totalCount && !requestedPage && doRequest) {
|
||||
currentPage += 1;
|
||||
requestedPage = true;
|
||||
((ItemsList) getActivity()).triggerRefresh(currentPage);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -167,7 +132,7 @@ public class AllStoriesItemListFragment extends ItemListFragment implements Load
|
|||
@Override
|
||||
public Loader<Cursor> onCreateLoader(int arg0, Bundle arg1) {
|
||||
CursorLoader cursorLoader = new CursorLoader(getActivity(), FeedProvider.ALL_STORIES_URI, null, FeedProvider.getStorySelectionFromState(currentState), null, DatabaseConstants.STORY_SHARED_DATE + " DESC");
|
||||
return cursorLoader;
|
||||
return cursorLoader;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@ import android.support.v4.content.CursorLoader;
|
|||
import android.support.v4.content.Loader;
|
||||
import android.support.v4.widget.CursorAdapter;
|
||||
import android.support.v4.widget.SimpleCursorAdapter;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -28,7 +27,6 @@ import com.newsblur.database.DatabaseConstants;
|
|||
import com.newsblur.database.FeedItemsAdapter;
|
||||
import com.newsblur.database.FeedProvider;
|
||||
import com.newsblur.domain.Feed;
|
||||
import com.newsblur.util.AppConstants;
|
||||
import com.newsblur.util.NetworkUtils;
|
||||
import com.newsblur.view.FeedItemViewBinder;
|
||||
|
||||
|
@ -130,7 +128,6 @@ public class FeedItemListFragment extends ItemListFragment implements LoaderMana
|
|||
|
||||
@Override
|
||||
public void onLoaderReset(Loader<Cursor> loader) {
|
||||
Log.d(TAG, "Loader reset");
|
||||
adapter.notifyDataSetInvalidated();
|
||||
}
|
||||
|
||||
|
@ -152,12 +149,10 @@ public class FeedItemListFragment extends ItemListFragment implements LoaderMana
|
|||
|
||||
@Override
|
||||
public void onScroll(AbsListView view, int firstVisible, int visibleCount, int totalCount) {
|
||||
if (firstVisible + visibleCount == totalCount) {
|
||||
if (firstVisible + visibleCount == totalCount && !requestedPage) {
|
||||
currentPage += 1;
|
||||
requestedPage = true;
|
||||
((ItemsList) getActivity()).triggerRefresh(currentPage);
|
||||
} else {
|
||||
Log.d(TAG, "No need");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@ import android.support.v4.content.CursorLoader;
|
|||
import android.support.v4.content.Loader;
|
||||
import android.support.v4.widget.CursorAdapter;
|
||||
import android.support.v4.widget.SimpleCursorAdapter;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -30,7 +29,6 @@ import com.newsblur.database.DatabaseConstants;
|
|||
import com.newsblur.database.FeedProvider;
|
||||
import com.newsblur.database.MultipleFeedItemsAdapter;
|
||||
import com.newsblur.domain.Folder;
|
||||
import com.newsblur.util.AppConstants;
|
||||
import com.newsblur.util.NetworkUtils;
|
||||
import com.newsblur.view.FeedItemViewBinder;
|
||||
|
||||
|
@ -48,9 +46,6 @@ public class FolderItemListFragment extends ItemListFragment implements LoaderMa
|
|||
private boolean requestedPage = false;
|
||||
private boolean doRequest = true;
|
||||
private Folder folder;
|
||||
private int positiveCount;
|
||||
private int negativeCount;
|
||||
private int neutralCount;
|
||||
|
||||
public static int ITEMLIST_LOADER = 0x01;
|
||||
|
||||
|
@ -76,25 +71,11 @@ public class FolderItemListFragment extends ItemListFragment implements LoaderMa
|
|||
feedIds = new String[feedIdArrayList.size()];
|
||||
feedIdArrayList.toArray(feedIds);
|
||||
|
||||
setupFolderCount();
|
||||
|
||||
if (!NetworkUtils.isOnline(getActivity())) {
|
||||
doRequest = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void setupFolderCount() {
|
||||
contentResolver = getActivity().getContentResolver();
|
||||
|
||||
Uri individualFolderUri = FeedProvider.FOLDERS_URI.buildUpon().appendPath(folderName).build();
|
||||
Cursor folderCursor = contentResolver.query(individualFolderUri, null, null, null, null);
|
||||
getActivity().startManagingCursor(folderCursor);
|
||||
folderCursor.moveToFirst();
|
||||
positiveCount = folderCursor.getInt(folderCursor.getColumnIndex(DatabaseConstants.SUM_POS));
|
||||
negativeCount = folderCursor.getInt(folderCursor.getColumnIndex(DatabaseConstants.SUM_NEG));
|
||||
neutralCount = folderCursor.getInt(folderCursor.getColumnIndex(DatabaseConstants.SUM_NEUT));
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
View v = inflater.inflate(R.layout.fragment_itemlist, null);
|
||||
|
@ -107,7 +88,7 @@ public class FolderItemListFragment extends ItemListFragment implements LoaderMa
|
|||
|
||||
Cursor cursor = contentResolver.query(storiesUri, null, FeedProvider.getStorySelectionFromState(currentState), feedIds, null);
|
||||
getActivity().startManagingCursor(cursor);
|
||||
|
||||
|
||||
String[] groupFrom = new String[] { DatabaseConstants.STORY_TITLE, DatabaseConstants.FEED_TITLE, DatabaseConstants.STORY_READ, DatabaseConstants.STORY_SHORTDATE, DatabaseConstants.STORY_INTELLIGENCE_AUTHORS, DatabaseConstants.STORY_AUTHORS };
|
||||
int[] groupTo = new int[] { R.id.row_item_title, R.id.row_item_feedtitle, R.id.row_item_title, R.id.row_item_date, R.id.row_item_sidebar, R.id.row_item_author };
|
||||
|
||||
|
@ -146,7 +127,6 @@ public class FolderItemListFragment extends ItemListFragment implements LoaderMa
|
|||
|
||||
@Override
|
||||
public void onLoaderReset(Loader<Cursor> loader) {
|
||||
Log.d(TAG, "Loader reset");
|
||||
adapter.notifyDataSetInvalidated();
|
||||
}
|
||||
|
||||
|
@ -170,28 +150,10 @@ public class FolderItemListFragment extends ItemListFragment implements LoaderMa
|
|||
|
||||
@Override
|
||||
public void onScroll(AbsListView view, int firstVisible, int visibleCount, int totalCount) {
|
||||
if (firstVisible + visibleCount == totalCount) {
|
||||
boolean loadMore = false;
|
||||
|
||||
switch (currentState) {
|
||||
case AppConstants.STATE_ALL:
|
||||
loadMore = positiveCount + neutralCount + negativeCount > totalCount;
|
||||
break;
|
||||
case AppConstants.STATE_BEST:
|
||||
loadMore = positiveCount > totalCount;
|
||||
break;
|
||||
case AppConstants.STATE_SOME:
|
||||
loadMore = positiveCount + neutralCount > totalCount;
|
||||
break;
|
||||
}
|
||||
|
||||
if (loadMore && !requestedPage) {
|
||||
currentPage += 1;
|
||||
requestedPage = true;
|
||||
((ItemsList) getActivity()).triggerRefresh(currentPage);
|
||||
} else {
|
||||
Log.d(TAG, "No need");
|
||||
}
|
||||
if (firstVisible + visibleCount == totalCount && !requestedPage && doRequest) {
|
||||
currentPage += 1;
|
||||
requestedPage = true;
|
||||
((ItemsList) getActivity()).triggerRefresh(currentPage);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@ import android.content.SharedPreferences;
|
|||
import android.database.Cursor;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.util.Log;
|
||||
import android.view.ContextMenu;
|
||||
import android.view.ContextMenu.ContextMenuInfo;
|
||||
import android.view.Display;
|
||||
|
@ -53,7 +52,6 @@ public class FolderListFragment extends Fragment implements OnGroupClickListener
|
|||
private int currentState = AppConstants.STATE_SOME;
|
||||
private int FEEDCHECK = 0x01;
|
||||
private SocialFeedViewBinder blogViewBinder;
|
||||
private String TAG = "FolderListFragment";
|
||||
private SharedPreferences sharedPreferences;
|
||||
|
||||
|
||||
|
@ -99,7 +97,6 @@ public class FolderListFragment extends Fragment implements OnGroupClickListener
|
|||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
Log.d(TAG, "Creating folder fragment view");
|
||||
View v = inflater.inflate(R.layout.fragment_folderfeedlist, container);
|
||||
list = (ExpandableListView) v.findViewById(R.id.folderfeed_list);
|
||||
list.setGroupIndicator(getResources().getDrawable(R.drawable.transparent));
|
||||
|
@ -120,6 +117,9 @@ public class FolderListFragment extends Fragment implements OnGroupClickListener
|
|||
}
|
||||
|
||||
private void checkOpenFolderPreferences() {
|
||||
if (sharedPreferences == null) {
|
||||
sharedPreferences = getActivity().getSharedPreferences(PrefConstants.PREFERENCES, 0);
|
||||
}
|
||||
for (int i = 0; i < folderAdapter.getGroupCount(); i++) {
|
||||
long groupId = folderAdapter.getGroupId(i);
|
||||
if (sharedPreferences.getBoolean(AppConstants.FOLDER_PRE + groupId, true)) {
|
||||
|
|
|
@ -25,6 +25,7 @@ import com.newsblur.service.DetachableResultReceiver;
|
|||
import com.newsblur.service.DetachableResultReceiver.Receiver;
|
||||
import com.newsblur.service.SyncService;
|
||||
import com.newsblur.util.PrefsUtils;
|
||||
import com.newsblur.util.UIUtils;
|
||||
|
||||
public class LoginProgressFragment extends Fragment implements Receiver {
|
||||
|
||||
|
@ -34,7 +35,7 @@ public class LoginProgressFragment extends Fragment implements Receiver {
|
|||
private TextView updateStatus, retrievingFeeds, letsGo;
|
||||
private ImageView loginProfilePicture;
|
||||
private int CURRENT_STATUS = -1;
|
||||
private ProgressBar feedProgress;
|
||||
private ProgressBar feedProgress, loggingInProgress;
|
||||
private LoginTask loginTask;
|
||||
private String username;
|
||||
private String password;
|
||||
|
@ -46,10 +47,8 @@ public class LoginProgressFragment extends Fragment implements Receiver {
|
|||
bundle.putString("password", password);
|
||||
fragment.setArguments(bundle);
|
||||
return fragment;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
@ -57,34 +56,33 @@ public class LoginProgressFragment extends Fragment implements Receiver {
|
|||
apiManager = new APIManager(getActivity());
|
||||
receiver = new DetachableResultReceiver(new Handler());
|
||||
receiver.setReceiver(this);
|
||||
Log.d(TAG , "Creating new fragment instance");
|
||||
|
||||
|
||||
username = getArguments().getString("username");
|
||||
password = getArguments().getString("password");
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
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);
|
||||
loggingInProgress = (ProgressBar) v.findViewById(R.id.login_logging_in_progress);
|
||||
loginProfilePicture = (ImageView) v.findViewById(R.id.login_profile_picture);
|
||||
// password.setOnEditorActionListener(this);
|
||||
|
||||
|
||||
if (loginTask != null) {
|
||||
refreshUI();
|
||||
} else {
|
||||
loginTask = new LoginTask();
|
||||
loginTask.execute();
|
||||
}
|
||||
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
|
||||
private class LoginTask extends AsyncTask<String, Void, LoginResponse> {
|
||||
|
||||
private static final String TAG = "LoginTask";
|
||||
|
@ -103,7 +101,7 @@ public class LoginProgressFragment extends Fragment implements Receiver {
|
|||
// We include this wait simply as a small UX convenience. Otherwise the user could be met with a disconcerting flicker when attempting to log in and failing.
|
||||
Thread.sleep(700);
|
||||
} catch (InterruptedException e) {
|
||||
Log.d(TAG, "Error sleeping during login.");
|
||||
Log.e(TAG, "Error sleeping during login.");
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
@ -113,36 +111,39 @@ public class LoginProgressFragment extends Fragment implements Receiver {
|
|||
if (result.authenticated) {
|
||||
final Animation a = AnimationUtils.loadAnimation(getActivity(), R.anim.text_down);
|
||||
updateStatus.setText(R.string.login_logged_in);
|
||||
loggingInProgress.setVisibility(View.GONE);
|
||||
updateStatus.startAnimation(a);
|
||||
|
||||
loginProfilePicture.setImageBitmap(PrefsUtils.getUserImage(getActivity()));
|
||||
|
||||
loginProfilePicture.setVisibility(View.VISIBLE);
|
||||
loginProfilePicture.setImageBitmap(UIUtils.roundCorners(PrefsUtils.getUserImage(getActivity()), 10f));
|
||||
feedProgress.setVisibility(View.VISIBLE);
|
||||
|
||||
Log.d(TAG, "Authenticated. Starting receiver.");
|
||||
|
||||
final Animation b = AnimationUtils.loadAnimation(getActivity(), R.anim.text_up);
|
||||
retrievingFeeds.setText(R.string.login_retrieving_feeds);
|
||||
retrievingFeeds.startAnimation(b);
|
||||
|
||||
Log.d(TAG, "Synchronisation finished.");
|
||||
final Intent intent = new Intent(Intent.ACTION_SYNC, null, getActivity(), SyncService.class);
|
||||
intent.putExtra(SyncService.EXTRA_STATUS_RECEIVER, receiver);
|
||||
intent.putExtra(SyncService.SYNCSERVICE_TASK, SyncService.EXTRA_TASK_FOLDER_UPDATE);
|
||||
getActivity().startService(intent);
|
||||
} else {
|
||||
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();
|
||||
}
|
||||
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();
|
||||
}
|
||||
getActivity().finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void refreshUI() {
|
||||
switch (CURRENT_STATUS) {
|
||||
case SyncService.NOT_RUNNING:
|
||||
break;
|
||||
case SyncService.STATUS_NO_MORE_UPDATES:
|
||||
break;
|
||||
case SyncService.STATUS_FINISHED:
|
||||
final Animation b = AnimationUtils.loadAnimation(getActivity(), R.anim.text_down);
|
||||
retrievingFeeds.setText(R.string.login_retrieved_feeds);
|
||||
|
@ -168,12 +169,11 @@ public class LoginProgressFragment extends Fragment implements Receiver {
|
|||
case SyncService.STATUS_RUNNING:
|
||||
break;
|
||||
case SyncService.STATUS_ERROR:
|
||||
Log.d(TAG, "Error synchronising feeds.");
|
||||
updateStatus.setText("Error synchronising.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Interface for Host
|
||||
public interface LoginFragmentInterface {
|
||||
|
@ -184,9 +184,8 @@ public class LoginProgressFragment extends Fragment implements Receiver {
|
|||
|
||||
@Override
|
||||
public void onReceiverResult(int resultCode, Bundle resultData) {
|
||||
Log.d(TAG, "Received result");
|
||||
CURRENT_STATUS = resultCode;
|
||||
refreshUI();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -3,13 +3,17 @@ package com.newsblur.fragment;
|
|||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.text.TextUtils;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
import android.widget.TextView.OnEditorActionListener;
|
||||
import android.widget.ViewSwitcher;
|
||||
|
||||
import com.newsblur.R;
|
||||
|
@ -20,59 +24,76 @@ 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);
|
||||
|
||||
password.setOnEditorActionListener(new OnEditorActionListener() {
|
||||
@Override
|
||||
public boolean onEditorAction(TextView arg0, int actionId, KeyEvent event) {
|
||||
if (actionId == EditorInfo.IME_ACTION_DONE ) {
|
||||
logIn();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
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);
|
||||
|
||||
|
||||
|
||||
register_email.setOnEditorActionListener(new OnEditorActionListener() {
|
||||
@Override
|
||||
public boolean onEditorAction(TextView arg0, int actionId, KeyEvent event) {
|
||||
if (actionId == EditorInfo.IME_ACTION_DONE ) {
|
||||
signUp();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
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
|
||||
|
@ -88,10 +109,12 @@ public class LoginRegisterFragment extends Fragment implements OnClickListener {
|
|||
}
|
||||
|
||||
private void logIn() {
|
||||
Intent i = new Intent(getActivity(), LoginProgress.class);
|
||||
i.putExtra("username", username.getText().toString());
|
||||
i.putExtra("password", password.getText().toString());
|
||||
startActivity(i);
|
||||
if (!TextUtils.isEmpty(username.getText().toString())) {
|
||||
Intent i = new Intent(getActivity(), LoginProgress.class);
|
||||
i.putExtra("username", username.getText().toString());
|
||||
i.putExtra("password", password.getText().toString());
|
||||
startActivity(i);
|
||||
}
|
||||
}
|
||||
|
||||
private void signUp() {
|
||||
|
|
|
@ -8,6 +8,7 @@ import android.view.ViewGroup;
|
|||
import android.widget.ListView;
|
||||
|
||||
import com.newsblur.R;
|
||||
import com.newsblur.domain.UserDetails;
|
||||
import com.newsblur.network.domain.ActivitiesResponse;
|
||||
import com.newsblur.view.ActivitiesAdapter;
|
||||
|
||||
|
@ -31,9 +32,9 @@ public class ProfileActivityFragment extends Fragment {
|
|||
return v;
|
||||
}
|
||||
|
||||
public void setActivities(final ActivitiesResponse[] activities ) {
|
||||
public void setActivitiesAndUser(final ActivitiesResponse[] activities, UserDetails user ) {
|
||||
// Set the activities, create the adapter
|
||||
adapter = new ActivitiesAdapter(getActivity(), activities);
|
||||
adapter = new ActivitiesAdapter(getActivity(), activities, user);
|
||||
displayActivities();
|
||||
}
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@ import com.newsblur.domain.Story;
|
|||
import com.newsblur.domain.UserDetails;
|
||||
import com.newsblur.network.APIManager;
|
||||
import com.newsblur.network.SetupCommentSectionTask;
|
||||
import com.newsblur.util.AppConstants;
|
||||
import com.newsblur.util.ImageLoader;
|
||||
import com.newsblur.util.PrefConstants;
|
||||
import com.newsblur.util.PrefsUtils;
|
||||
|
@ -182,7 +183,7 @@ public class ReadingItemFragment extends Fragment implements ClassifierDialogFra
|
|||
itemFeed.setVisibility(View.GONE);
|
||||
feedIcon.setVisibility(View.GONE);
|
||||
} else {
|
||||
imageLoader.displayImage(feedIconUrl, feedIcon);
|
||||
imageLoader.displayImage(feedIconUrl, feedIcon, false);
|
||||
itemFeed.setText(feedTitle);
|
||||
}
|
||||
|
||||
|
@ -237,7 +238,7 @@ public class ReadingItemFragment extends Fragment implements ClassifierDialogFra
|
|||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("<html><head><meta name=\"viewport\" content=\"target-densitydpi=device-dpi\" />");
|
||||
builder.append("<style style=\"text/css\">");
|
||||
builder.append(String.format("body { font-size: %s em; } ", Float.toString(currentSize + 0.5f)));
|
||||
builder.append(String.format("body { font-size: %s em; } ", Float.toString(currentSize + AppConstants.FONT_SIZE_LOWER_BOUND)));
|
||||
builder.append("</style>");
|
||||
builder.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"reading.css\" /></head><body>");
|
||||
builder.append(story.content);
|
||||
|
|
|
@ -9,26 +9,32 @@ import android.view.LayoutInflater;
|
|||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.animation.AnimationUtils;
|
||||
import android.view.animation.RotateAnimation;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.Toast;
|
||||
import android.widget.ViewSwitcher;
|
||||
|
||||
import com.newsblur.R;
|
||||
import com.newsblur.activity.AddSites;
|
||||
import com.newsblur.activity.LoginProgress;
|
||||
import com.newsblur.network.APIManager;
|
||||
import com.newsblur.network.domain.CategoriesResponse;
|
||||
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;
|
||||
private ImageView registerProgressLogo;
|
||||
|
||||
public static RegisterProgressFragment getInstance(String username, String password, String email) {
|
||||
RegisterProgressFragment fragment = new RegisterProgressFragment();
|
||||
|
@ -39,34 +45,36 @@ public class RegisterProgressFragment extends Fragment {
|
|||
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);
|
||||
|
||||
|
||||
registerProgressLogo = (ImageView) v.findViewById(R.id.registerprogress_logo);
|
||||
registerProgressLogo.startAnimation(AnimationUtils.loadAnimation(getActivity(), R.anim.rotate));
|
||||
|
||||
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) {
|
||||
|
@ -74,38 +82,56 @@ public class RegisterProgressFragment extends Fragment {
|
|||
startActivity(i);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
private class RegisterTask extends AsyncTask<Void, Void, LoginResponse> {
|
||||
|
||||
|
||||
private class RegisterTask extends AsyncTask<Void, Void, Boolean> {
|
||||
|
||||
private LoginResponse response;
|
||||
|
||||
@Override
|
||||
protected LoginResponse doInBackground(Void... params) {
|
||||
protected Boolean 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.");
|
||||
Log.e(TAG, "Error sleeping during login.");
|
||||
}
|
||||
return apiManager.signup(username, password, email);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(LoginResponse response) {
|
||||
response = apiManager.signup(username, password, email);
|
||||
if (response.authenticated) {
|
||||
switcher.showNext();
|
||||
return apiManager.checkForFolders();
|
||||
} else {
|
||||
if (response.errors != null && response.errors.message != null) {
|
||||
Toast.makeText(getActivity(), response.errors.message[0], Toast.LENGTH_LONG).show();
|
||||
cancel(true);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(Boolean hasFolders) {
|
||||
if (!isCancelled()) {
|
||||
if (!hasFolders.booleanValue()) {
|
||||
switcher.showNext();
|
||||
} else {
|
||||
Toast.makeText(getActivity(), getResources().getString(R.string.login_message_error), Toast.LENGTH_LONG).show();
|
||||
Intent i = new Intent(getActivity(), LoginProgress.class);
|
||||
i.putExtra("username", username);
|
||||
i.putExtra("password", password);
|
||||
startActivity(i);
|
||||
}
|
||||
getActivity().finish();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCancelled() {
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -10,7 +10,6 @@ import android.support.v4.app.DialogFragment;
|
|||
import android.text.Editable;
|
||||
import android.text.TextUtils;
|
||||
import android.text.TextWatcher;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
|
@ -162,7 +161,6 @@ public class ShareDialogFragment extends DialogFragment {
|
|||
}
|
||||
|
||||
if (!hasShared && commentEditText.length() > 0) {
|
||||
Log.d("ShareDialog", "settingPreviouslySharedText");
|
||||
previouslySavedShareText = commentEditText.getText().toString();
|
||||
callback.setPreviouslySavedShareText(previouslySavedShareText);
|
||||
}
|
||||
|
|
|
@ -45,6 +45,9 @@ public class SocialFeedItemListFragment extends ItemListFragment implements Load
|
|||
public static int ITEMLIST_LOADER = 0x01;
|
||||
private int READING_RETURNED = 0x02;
|
||||
private Uri socialFeedUri;
|
||||
private String[] groupFroms;
|
||||
private int[] groupTos;
|
||||
private ListView itemList;
|
||||
|
||||
public SocialFeedItemListFragment(final String userId, final String username, final int currentState) {
|
||||
this.userId = userId;
|
||||
|
@ -60,17 +63,11 @@ public class SocialFeedItemListFragment extends ItemListFragment implements Load
|
|||
|
||||
setupSocialFeed();
|
||||
|
||||
Cursor cursor = contentResolver.query(storiesUri, null, FeedProvider.getStorySelectionFromState(currentState), null, DatabaseConstants.STORY_SHARED_DATE + " ASC");
|
||||
getActivity().startManagingCursor(cursor);
|
||||
|
||||
String[] groupFrom = new String[] { DatabaseConstants.FEED_FAVICON_URL, DatabaseConstants.FEED_TITLE, DatabaseConstants.STORY_TITLE, DatabaseConstants.STORY_SHORTDATE, DatabaseConstants.STORY_AUTHORS, DatabaseConstants.STORY_INTELLIGENCE_AUTHORS};
|
||||
int[] groupTo = new int[] { R.id.row_item_feedicon, R.id.row_item_feedtitle, R.id.row_item_title, R.id.row_item_date, R.id.row_item_author, R.id.row_item_sidebar};
|
||||
groupFroms = new String[] { DatabaseConstants.FEED_FAVICON_URL, DatabaseConstants.FEED_TITLE, DatabaseConstants.STORY_TITLE, DatabaseConstants.STORY_SHORTDATE, DatabaseConstants.STORY_AUTHORS, DatabaseConstants.STORY_INTELLIGENCE_AUTHORS};
|
||||
groupTos = new int[] { R.id.row_item_feedicon, R.id.row_item_feedtitle, R.id.row_item_title, R.id.row_item_date, R.id.row_item_author, R.id.row_item_sidebar};
|
||||
|
||||
getLoaderManager().initLoader(ITEMLIST_LOADER , null, this);
|
||||
|
||||
adapter = new MultipleFeedItemsAdapter(getActivity(), R.layout.row_socialitem, cursor, groupFrom, groupTo, CursorAdapter.FLAG_REGISTER_CONTENT_OBSERVER);
|
||||
|
||||
adapter.setViewBinder(new SocialItemViewBinder(getActivity()));
|
||||
}
|
||||
|
||||
private void setupSocialFeed() {
|
||||
|
@ -85,7 +82,7 @@ public class SocialFeedItemListFragment extends ItemListFragment implements Load
|
|||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
View v = inflater.inflate(R.layout.fragment_itemlist, null);
|
||||
ListView itemList = (ListView) v.findViewById(R.id.itemlistfragment_list);
|
||||
itemList = (ListView) v.findViewById(R.id.itemlistfragment_list);
|
||||
itemList.setEmptyView(v.findViewById(R.id.empty_view));
|
||||
|
||||
itemList.setOnScrollListener(this);
|
||||
|
@ -98,12 +95,18 @@ public class SocialFeedItemListFragment extends ItemListFragment implements Load
|
|||
@Override
|
||||
public Loader<Cursor> onCreateLoader(int loaderId, Bundle bundle) {
|
||||
Uri uri = FeedProvider.SOCIALFEED_STORIES_URI.buildUpon().appendPath(userId).build();
|
||||
CursorLoader cursorLoader = new CursorLoader(getActivity(), uri, null, FeedProvider.getStorySelectionFromState(currentState), null, DatabaseConstants.STORY_SHARED_DATE + " ASC");
|
||||
CursorLoader cursorLoader = new CursorLoader(getActivity(), uri, null, FeedProvider.getStorySelectionFromState(currentState), null, DatabaseConstants.STORY_SHARED_DATE + " desc");
|
||||
return cursorLoader;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) {
|
||||
if (adapter == null) {
|
||||
adapter = new MultipleFeedItemsAdapter(getActivity(), R.layout.row_socialitem, cursor, groupFroms, groupTos, CursorAdapter.FLAG_REGISTER_CONTENT_OBSERVER);
|
||||
adapter.setViewBinder(new SocialItemViewBinder(getActivity()));
|
||||
itemList.setAdapter(adapter);
|
||||
}
|
||||
|
||||
if (cursor != null) {
|
||||
adapter.swapCursor(cursor);
|
||||
}
|
||||
|
@ -117,7 +120,6 @@ public class SocialFeedItemListFragment extends ItemListFragment implements Load
|
|||
|
||||
@Override
|
||||
public void onLoaderReset(Loader<Cursor> loader) {
|
||||
Log.d(TAG, "Loader reset");
|
||||
adapter.notifyDataSetInvalidated();
|
||||
}
|
||||
|
||||
|
@ -145,7 +147,7 @@ public class SocialFeedItemListFragment extends ItemListFragment implements Load
|
|||
public void changeState(int state) {
|
||||
currentState = state;
|
||||
final String selection = FeedProvider.getStorySelectionFromState(state);
|
||||
Cursor cursor = contentResolver.query(storiesUri, null, selection, null, DatabaseConstants.STORY_SHARED_DATE + " DESC");
|
||||
Cursor cursor = contentResolver.query(storiesUri, null, selection, null, DatabaseConstants.STORY_SHARED_DATE + " desc");
|
||||
adapter.swapCursor(cursor);
|
||||
getActivity().startManagingCursor(cursor);
|
||||
}
|
||||
|
|
|
@ -36,21 +36,24 @@ public class SyncUpdateFragment extends Fragment implements Receiver {
|
|||
switch (resultCode) {
|
||||
case SyncService.STATUS_FINISHED:
|
||||
syncRunning = false;
|
||||
Log.d(TAG, "Synchronisation finished.");
|
||||
if (getActivity() != null) {
|
||||
((SyncUpdateFragmentInterface) getActivity()).updateAfterSync();
|
||||
}
|
||||
break;
|
||||
case SyncService.STATUS_FINISHED_CLOSE:
|
||||
syncRunning = false;
|
||||
if (getActivity() != null) {
|
||||
((SyncUpdateFragmentInterface) getActivity()).closeAfterUpdate();
|
||||
}
|
||||
break;
|
||||
case SyncService.STATUS_RUNNING:
|
||||
syncRunning = true;
|
||||
Log.d(TAG, "Synchronisation running.");
|
||||
break;
|
||||
case SyncService.STATUS_NO_MORE_UPDATES:
|
||||
syncRunning = false;
|
||||
if (getActivity() != null) {
|
||||
((SyncUpdateFragmentInterface) getActivity()).setNothingMoreToUpdate();
|
||||
}
|
||||
Log.d(TAG, "Synchronisation completed with nothing to update.");
|
||||
break;
|
||||
case SyncService.STATUS_ERROR:
|
||||
syncRunning = false;
|
||||
|
@ -72,6 +75,7 @@ public class SyncUpdateFragment extends Fragment implements Receiver {
|
|||
|
||||
public interface SyncUpdateFragmentInterface {
|
||||
public void updateAfterSync();
|
||||
public void closeAfterUpdate();
|
||||
public void setNothingMoreToUpdate();
|
||||
public void updateSyncStatus(boolean syncRunning);
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.newsblur.fragment;
|
|||
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.DialogFragment;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
@ -13,12 +14,13 @@ import android.widget.SeekBar;
|
|||
import android.widget.SeekBar.OnSeekBarChangeListener;
|
||||
|
||||
import com.newsblur.R;
|
||||
import com.newsblur.util.AppConstants;
|
||||
|
||||
public class TextSizeDialogFragment extends DialogFragment {
|
||||
|
||||
private static String CURRENT_SIZE = "currentSize";
|
||||
private static String LISTENER = "listener";
|
||||
private float currentValue = 1.5f;
|
||||
private float currentValue = 1.0f;
|
||||
private SeekBar seekBar;
|
||||
|
||||
public static TextSizeDialogFragment newInstance(float currentValue) {
|
||||
|
@ -40,7 +42,7 @@ public class TextSizeDialogFragment extends DialogFragment {
|
|||
this.currentValue = getArguments().getFloat(CURRENT_SIZE);
|
||||
View v = inflater.inflate(R.layout.textsize_slider_dialog, null);
|
||||
seekBar = (SeekBar) v.findViewById(R.id.textSizeSlider);
|
||||
seekBar.setProgress((int) (currentValue * 2));
|
||||
seekBar.setProgress((int) (currentValue * AppConstants.FONT_SIZE_INCREMENT_FACTOR));
|
||||
|
||||
getDialog().getWindow().setFlags(WindowManager.LayoutParams.FLAG_DITHER, WindowManager.LayoutParams.FLAG_DITHER);
|
||||
getDialog().requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package com.newsblur.network;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.net.HttpURLConnection;
|
||||
|
@ -74,7 +73,6 @@ public class APIClient {
|
|||
|
||||
final URL urlFeeds = new URL(urlString + "?" + parameterString);
|
||||
connection = (HttpURLConnection) urlFeeds.openConnection();
|
||||
|
||||
final SharedPreferences preferences = context.getSharedPreferences(PrefConstants.PREFERENCES, 0);
|
||||
final String cookie = preferences.getString(PrefConstants.PREF_COOKIE, null);
|
||||
if (cookie != null) {
|
||||
|
@ -103,7 +101,7 @@ public class APIClient {
|
|||
|
||||
final URL urlFeeds = new URL(urlString + "?" + parameterString);
|
||||
connection = (HttpURLConnection) urlFeeds.openConnection();
|
||||
|
||||
|
||||
final SharedPreferences preferences = context.getSharedPreferences(PrefConstants.PREFERENCES, 0);
|
||||
final String cookie = preferences.getString(PrefConstants.PREF_COOKIE, null);
|
||||
if (cookie != null) {
|
||||
|
@ -151,7 +149,6 @@ 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();
|
||||
|
@ -199,7 +196,6 @@ 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");
|
||||
|
||||
|
|
|
@ -3,6 +3,8 @@ package com.newsblur.network;
|
|||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
|
@ -11,6 +13,7 @@ import org.apache.http.HttpStatus;
|
|||
import android.content.ContentResolver;
|
||||
import android.content.ContentValues;
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.net.Uri;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
@ -26,6 +29,7 @@ import com.newsblur.domain.Classifier;
|
|||
import com.newsblur.domain.Comment;
|
||||
import com.newsblur.domain.Feed;
|
||||
import com.newsblur.domain.FeedResult;
|
||||
import com.newsblur.domain.Folder;
|
||||
import com.newsblur.domain.Reply;
|
||||
import com.newsblur.domain.SocialFeed;
|
||||
import com.newsblur.domain.Story;
|
||||
|
@ -203,7 +207,7 @@ public class APIManager {
|
|||
contentResolver.insert(storyUri, story.getValues());
|
||||
insertComments(story);
|
||||
}
|
||||
|
||||
|
||||
for (UserProfile user : storiesResponse.users) {
|
||||
contentResolver.insert(FeedProvider.USERS_URI, user.getValues());
|
||||
}
|
||||
|
@ -230,7 +234,6 @@ public class APIManager {
|
|||
if (TextUtils.equals(pageNumber,"1")) {
|
||||
Uri storyUri = FeedProvider.ALL_STORIES_URI;
|
||||
int deleted = contentResolver.delete(storyUri, null, null);
|
||||
Log.d(TAG, "Deleted " + deleted + " stories");
|
||||
}
|
||||
|
||||
for (Story story : storiesResponse.stories) {
|
||||
|
@ -238,11 +241,11 @@ public class APIManager {
|
|||
contentResolver.insert(storyUri, story.getValues());
|
||||
insertComments(story);
|
||||
}
|
||||
|
||||
|
||||
for (UserProfile user : storiesResponse.users) {
|
||||
contentResolver.insert(FeedProvider.USERS_URI, user.getValues());
|
||||
}
|
||||
|
||||
|
||||
return storiesResponse;
|
||||
} else {
|
||||
return null;
|
||||
|
@ -258,21 +261,20 @@ public class APIManager {
|
|||
if (!TextUtils.isEmpty(pageNumber)) {
|
||||
values.put(APIConstants.PARAMETER_PAGE_NUMBER, "" + pageNumber);
|
||||
}
|
||||
|
||||
|
||||
final APIResponse response = client.get(APIConstants.URL_SHARED_RIVER_STORIES, values);
|
||||
|
||||
|
||||
SocialFeedResponse storiesResponse = gson.fromJson(response.responseString, SocialFeedResponse.class);
|
||||
if (response.responseCode == HttpStatus.SC_OK && !response.hasRedirected) {
|
||||
|
||||
// If we've successfully retrieved the latest stories for all shared feeds (the first page), delete all previous shared feeds
|
||||
if (TextUtils.equals(pageNumber,"1")) {
|
||||
Uri storyUri = FeedProvider.ALL_STORIES_URI;
|
||||
int deleted = contentResolver.delete(storyUri, null, null);
|
||||
Log.d(TAG, "Deleted " + deleted + " stories");
|
||||
contentResolver.delete(storyUri, null, null);
|
||||
}
|
||||
|
||||
for (Story story : storiesResponse.stories) {
|
||||
for (String userId : story.friendUserIds) {
|
||||
for (String userId : story.sharedUserIds) {
|
||||
Uri storySocialUri = FeedProvider.SOCIALFEED_STORIES_URI.buildUpon().appendPath(userId).build();
|
||||
contentResolver.insert(storySocialUri, story.getValues());
|
||||
}
|
||||
|
@ -283,6 +285,10 @@ public class APIManager {
|
|||
insertComments(story);
|
||||
}
|
||||
|
||||
for (UserProfile user : storiesResponse.userProfiles) {
|
||||
contentResolver.insert(FeedProvider.USERS_URI, user.getValues());
|
||||
}
|
||||
|
||||
if (storiesResponse != null && storiesResponse.feeds!= null) {
|
||||
for (Feed feed : storiesResponse.feeds) {
|
||||
contentResolver.insert(FeedProvider.FEEDS_URI, feed.getValues());
|
||||
|
@ -320,7 +326,7 @@ public class APIManager {
|
|||
contentResolver.insert(storyUri, story.getValues());
|
||||
contentResolver.insert(storySocialUri, story.getValues());
|
||||
}
|
||||
|
||||
|
||||
if (socialFeedResponse.userProfiles != null) {
|
||||
for (UserProfile user : socialFeedResponse.userProfiles) {
|
||||
contentResolver.insert(FeedProvider.USERS_URI, user.getValues());
|
||||
|
@ -413,43 +419,94 @@ public class APIManager {
|
|||
}
|
||||
}
|
||||
|
||||
public void getFolderFeedMapping() {
|
||||
getFolderFeedMapping(false);
|
||||
public boolean getFolderFeedMapping() {
|
||||
return getFolderFeedMapping(false);
|
||||
}
|
||||
|
||||
public boolean checkForFolders() {
|
||||
final APIClient client = new APIClient(context);
|
||||
final APIResponse response = client.get(APIConstants.URL_FEEDS);
|
||||
FeedFolderResponse feedUpdate = gson.fromJson(response.responseString, FeedFolderResponse.class);
|
||||
return (feedUpdate.folders.entrySet().size() > 1);
|
||||
}
|
||||
|
||||
|
||||
public void getFolderFeedMapping(boolean doUpdateCounts) {
|
||||
public boolean getFolderFeedMapping(boolean doUpdateCounts) {
|
||||
|
||||
|
||||
final APIClient client = new APIClient(context);
|
||||
final APIResponse response = client.get(doUpdateCounts ? APIConstants.URL_FEEDS : APIConstants.URL_FEEDS_NO_UPDATE);
|
||||
final FeedFolderResponse feedUpdate = gson.fromJson(response.responseString, FeedFolderResponse.class);
|
||||
|
||||
|
||||
if (response.responseCode == HttpStatus.SC_OK && !response.hasRedirected) {
|
||||
for (final Entry<String, Feed> entry : feedUpdate.feeds.entrySet()) {
|
||||
final Feed feed = entry.getValue();
|
||||
contentResolver.insert(FeedProvider.FEEDS_URI, feed.getValues());
|
||||
if (feedUpdate.folders.size() == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
HashMap<String, Feed> existingFeeds = getExistingFeeds();
|
||||
|
||||
for (String newFeedId : feedUpdate.feeds.keySet()) {
|
||||
if (existingFeeds.get(newFeedId) == null || !feedUpdate.feeds.get(newFeedId).equals(existingFeeds.get(newFeedId))) {
|
||||
contentResolver.insert(FeedProvider.FEEDS_URI, feedUpdate.feeds.get(newFeedId).getValues());
|
||||
}
|
||||
}
|
||||
|
||||
for (String olderFeedId : existingFeeds.keySet()) {
|
||||
if (feedUpdate.feeds.get(olderFeedId) == null) {
|
||||
Uri feedUri = FeedProvider.FEEDS_URI.buildUpon().appendPath(olderFeedId).build();
|
||||
contentResolver.delete(feedUri, null, null);
|
||||
}
|
||||
}
|
||||
|
||||
for (final SocialFeed feed : feedUpdate.socialFeeds) {
|
||||
contentResolver.insert(FeedProvider.SOCIAL_FEEDS_URI, feed.getValues());
|
||||
}
|
||||
|
||||
|
||||
String unsortedFolderName = context.getResources().getString(R.string.unsorted_folder_name);
|
||||
|
||||
Cursor folderCursor = contentResolver.query(FeedProvider.FOLDERS_URI, null, null, null, null);
|
||||
folderCursor.moveToFirst();
|
||||
HashSet<String> existingFolders = new HashSet<String>();
|
||||
while (!folderCursor.isAfterLast()) {
|
||||
existingFolders.add(Folder.fromCursor(folderCursor).getName());
|
||||
folderCursor.moveToNext();
|
||||
}
|
||||
folderCursor.close();
|
||||
|
||||
for (final Entry<String, List<Long>> entry : feedUpdate.folders.entrySet()) {
|
||||
String folderName = TextUtils.isEmpty(entry.getKey()) ? unsortedFolderName : entry.getKey();
|
||||
final ContentValues folderValues = new ContentValues();
|
||||
folderValues.put(DatabaseConstants.FOLDER_NAME, folderName);
|
||||
contentResolver.insert(FeedProvider.FOLDERS_URI, folderValues);
|
||||
|
||||
if (!existingFolders.contains(folderName)) {
|
||||
final ContentValues folderValues = new ContentValues();
|
||||
folderValues.put(DatabaseConstants.FOLDER_NAME, folderName);
|
||||
contentResolver.insert(FeedProvider.FOLDERS_URI, folderValues);
|
||||
}
|
||||
|
||||
for (Long feedId : entry.getValue()) {
|
||||
ContentValues values = new ContentValues();
|
||||
values.put(DatabaseConstants.FEED_FOLDER_FEED_ID, feedId);
|
||||
values.put(DatabaseConstants.FEED_FOLDER_FOLDER_NAME, folderName);
|
||||
contentResolver.insert(FeedProvider.FEED_FOLDER_MAP_URI, values);
|
||||
if (!existingFeeds.containsKey(Long.toString(feedId))) {
|
||||
ContentValues values = new ContentValues();
|
||||
values.put(DatabaseConstants.FEED_FOLDER_FEED_ID, feedId);
|
||||
values.put(DatabaseConstants.FEED_FOLDER_FOLDER_NAME, folderName);
|
||||
contentResolver.insert(FeedProvider.FEED_FOLDER_MAP_URI, values);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private HashMap<String, Feed> getExistingFeeds() {
|
||||
Cursor feedCursor = contentResolver.query(FeedProvider.FEEDS_URI, null, null, null, null);
|
||||
feedCursor.moveToFirst();
|
||||
HashMap<String, Feed> existingFeeds = new HashMap<String, Feed>();
|
||||
while (!feedCursor.isAfterLast()) {
|
||||
existingFeeds.put(Feed.fromCursor(feedCursor).feedId, Feed.fromCursor(feedCursor));
|
||||
feedCursor.moveToNext();
|
||||
}
|
||||
feedCursor.close();
|
||||
return existingFeeds;
|
||||
}
|
||||
|
||||
public boolean trainClassifier(String feedId, String key, int type, int action) {
|
||||
String typeText = null;
|
||||
String actionText = null;
|
||||
|
|
|
@ -12,11 +12,11 @@ import com.newsblur.R;
|
|||
import com.newsblur.domain.Comment;
|
||||
import com.newsblur.domain.UserDetails;
|
||||
import com.newsblur.util.PrefsUtils;
|
||||
import com.newsblur.util.UIUtils;
|
||||
import com.newsblur.view.FlowLayout;
|
||||
|
||||
public class LikeCommentTask extends AsyncTask<Void, Void, Boolean>{
|
||||
|
||||
private static final String TAG = "LikeCommentTask";
|
||||
final WeakReference<ImageView> favouriteIconViewHolder;
|
||||
|
||||
private final APIManager apiManager;
|
||||
|
@ -57,7 +57,7 @@ public class LikeCommentTask extends AsyncTask<Void, Void, Boolean>{
|
|||
|
||||
ImageView favouriteImage = new ImageView(context);
|
||||
favouriteImage.setTag(user.id);
|
||||
|
||||
userImage = UIUtils.roundCorners(userImage, 10f);
|
||||
favouriteImage.setImageBitmap(userImage);
|
||||
favouriteAvatarHolder.get().addView(favouriteImage);
|
||||
|
||||
|
|
|
@ -13,7 +13,6 @@ import android.support.v4.app.DialogFragment;
|
|||
import android.support.v4.app.FragmentManager;
|
||||
import android.text.Html;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
|
@ -31,7 +30,6 @@ import com.newsblur.domain.Story;
|
|||
import com.newsblur.domain.UserDetails;
|
||||
import com.newsblur.domain.UserProfile;
|
||||
import com.newsblur.fragment.ReplyDialogFragment;
|
||||
import com.newsblur.network.domain.ProfileResponse;
|
||||
import com.newsblur.util.ImageLoader;
|
||||
import com.newsblur.util.PrefsUtils;
|
||||
import com.newsblur.util.ViewUtils;
|
||||
|
@ -107,7 +105,7 @@ public class SetupCommentSectionTask extends AsyncTask<Void, Void, Void> {
|
|||
Cursor userCursor = resolver.query(FeedProvider.USERS_URI, null, DatabaseConstants.USER_USERID + " IN (?)", new String[] { id }, null);
|
||||
UserProfile user = UserProfile.fromCursor(userCursor);
|
||||
|
||||
imageLoader.displayImage(user.photoUrl, favouriteImage);
|
||||
imageLoader.displayImage(user.photoUrl, favouriteImage, 10f);
|
||||
favouriteImage.setTag(id);
|
||||
|
||||
favouriteContainer.addView(favouriteImage);
|
||||
|
@ -147,19 +145,20 @@ public class SetupCommentSectionTask extends AsyncTask<Void, Void, Void> {
|
|||
replyText.setText(reply.text);
|
||||
ImageView replyImage = (ImageView) replyView.findViewById(R.id.reply_user_image);
|
||||
|
||||
final ProfileResponse replyUser = apiManager.getUser(reply.userId);
|
||||
imageLoader.displayImage(replyUser.user.photoUrl, replyImage);
|
||||
Cursor replyCursor = resolver.query(FeedProvider.USERS_URI, null, DatabaseConstants.USER_USERID + " IN (?)", new String[] { reply.userId }, null);
|
||||
final UserProfile replyUser = UserProfile.fromCursor(replyCursor);
|
||||
imageLoader.displayImage(replyUser.photoUrl, replyImage);
|
||||
replyImage.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Intent i = new Intent(context, Profile.class);
|
||||
i.putExtra(Profile.USER_ID, replyUser.user.userId);
|
||||
i.putExtra(Profile.USER_ID, replyUser.userId);
|
||||
context.startActivity(i);
|
||||
}
|
||||
});
|
||||
|
||||
TextView replyUsername = (TextView) replyView.findViewById(R.id.reply_username);
|
||||
replyUsername.setText(replyUser.user.username);
|
||||
replyUsername.setText(replyUser.username);
|
||||
|
||||
TextView replySharedDate = (TextView) replyView.findViewById(R.id.reply_shareddate);
|
||||
replySharedDate.setText(reply.shortDate.toUpperCase() + " AGO");
|
||||
|
@ -170,7 +169,6 @@ public class SetupCommentSectionTask extends AsyncTask<Void, Void, Void> {
|
|||
Cursor userCursor = resolver.query(FeedProvider.USERS_URI, null, DatabaseConstants.USER_USERID + " IN (?)", new String[] { comment.userId }, null);
|
||||
UserProfile commentUser = UserProfile.fromCursor(userCursor);
|
||||
|
||||
|
||||
TextView commentUsername = (TextView) commentView.findViewById(R.id.comment_username);
|
||||
commentUsername.setText(commentUser.username);
|
||||
String userPhoto = commentUser.photoUrl;
|
||||
|
@ -193,7 +191,7 @@ public class SetupCommentSectionTask extends AsyncTask<Void, Void, Void> {
|
|||
imageLoader.displayImage(userPhoto, usershareImage, 10f);
|
||||
}
|
||||
} else {
|
||||
imageLoader.displayImage(userPhoto, commentImage);
|
||||
imageLoader.displayImage(userPhoto, commentImage, 10f);
|
||||
}
|
||||
|
||||
if (comment.byFriend) {
|
||||
|
@ -220,6 +218,9 @@ public class SetupCommentSectionTask extends AsyncTask<Void, Void, Void> {
|
|||
FlowLayout sharedGrid = (FlowLayout) viewHolder.get().findViewById(R.id.reading_social_shareimages);
|
||||
FlowLayout commentGrid = (FlowLayout) viewHolder.get().findViewById(R.id.reading_social_commentimages);
|
||||
|
||||
TextView friendCommentTotal = ((TextView) viewHolder.get().findViewById(R.id.reading_friend_comment_total));
|
||||
TextView publicCommentTotal = ((TextView) viewHolder.get().findViewById(R.id.reading_public_comment_total));
|
||||
|
||||
ViewUtils.setupCommentCount(context, viewHolder.get(), commentCursor.getCount());
|
||||
ViewUtils.setupShareCount(context, viewHolder.get(), story.sharedUserIds.length);
|
||||
|
||||
|
@ -254,6 +255,22 @@ public class SetupCommentSectionTask extends AsyncTask<Void, Void, Void> {
|
|||
commentGrid.addView(image);
|
||||
commentCursor.moveToNext();
|
||||
}
|
||||
|
||||
if (publicCommentViews.size() > 0) {
|
||||
String commentCount = context.getString(R.string.public_comment_count);
|
||||
if (publicCommentViews.size() == 1) {
|
||||
commentCount = commentCount.substring(0, commentCount.length() - 1);
|
||||
}
|
||||
publicCommentTotal.setText(String.format(commentCount, publicCommentViews.size()));
|
||||
}
|
||||
|
||||
if (friendCommentViews.size() > 0) {
|
||||
String commentCount = context.getString(R.string.friends_comments_count);
|
||||
if (friendCommentViews.size() == 1) {
|
||||
commentCount = commentCount.substring(0, commentCount.length() - 1);
|
||||
}
|
||||
friendCommentTotal.setText(String.format(commentCount, friendCommentViews.size()));
|
||||
}
|
||||
|
||||
for (int i = 0; i < publicCommentViews.size(); i++) {
|
||||
if (i == publicCommentViews.size() - 1) {
|
||||
|
@ -261,14 +278,15 @@ public class SetupCommentSectionTask extends AsyncTask<Void, Void, Void> {
|
|||
}
|
||||
((LinearLayout) viewHolder.get().findViewById(R.id.reading_public_comment_container)).addView(publicCommentViews.get(i));
|
||||
}
|
||||
|
||||
for (int i = 0; i < friendCommentViews.size(); i++) {
|
||||
if (i == friendCommentViews.size() - 1) {
|
||||
friendCommentViews.get(i).findViewById(R.id.comment_divider).setVisibility(View.GONE);
|
||||
}
|
||||
((LinearLayout) viewHolder.get().findViewById(R.id.reading_friend_comment_container)).addView(friendCommentViews.get(i));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
commentCursor.close();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,9 +68,9 @@ public class UnLikeCommentTask extends AsyncTask<Void, Void, Boolean>{
|
|||
likingUsers.toArray(newArray);
|
||||
comment.likingUsers = newArray;
|
||||
|
||||
Toast.makeText(context, "Removed like", Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(context, "Removed favourite", Toast.LENGTH_SHORT).show();
|
||||
} else {
|
||||
Toast.makeText(context, "Error removing like from comment", Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(context, "Error removing favorite from comment", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,7 +33,6 @@ public class DetachableResultReceiver extends ResultReceiver {
|
|||
@Override
|
||||
protected void onReceiveResult(int resultCode, Bundle resultData) {
|
||||
if (receiver != null) {
|
||||
Log.d(TAG, "Sending receiver result...");
|
||||
receiver.onReceiverResult(resultCode, resultData);
|
||||
} else {
|
||||
Log.w(TAG, "No receiver to handle result: " + resultCode + " " + resultData.toString());
|
||||
|
|
|
@ -51,6 +51,7 @@ public class SyncService extends IntentService {
|
|||
public final static int STATUS_FINISHED = 0x03;
|
||||
public final static int STATUS_ERROR = 0x04;
|
||||
public static final int STATUS_NO_MORE_UPDATES = 0x05;
|
||||
public static final int STATUS_FINISHED_CLOSE = 0x06;
|
||||
public static final int NOT_RUNNING = 0x01;
|
||||
|
||||
public static final int EXTRA_TASK_FOLDER_UPDATE = 30;
|
||||
|
@ -85,7 +86,6 @@ public class SyncService extends IntentService {
|
|||
|
||||
@Override
|
||||
protected void onHandleIntent(Intent intent) {
|
||||
Log.d(TAG, "Received SyncService handleIntent call.");
|
||||
final ResultReceiver receiver = intent.getParcelableExtra(EXTRA_STATUS_RECEIVER);
|
||||
try {
|
||||
if (receiver != null) {
|
||||
|
@ -94,7 +94,9 @@ public class SyncService extends IntentService {
|
|||
|
||||
switch (intent.getIntExtra(SYNCSERVICE_TASK , -1)) {
|
||||
case EXTRA_TASK_FOLDER_UPDATE:
|
||||
apiManager.getFolderFeedMapping();
|
||||
if (!apiManager.getFolderFeedMapping()) {
|
||||
receiver.send(STATUS_NO_MORE_UPDATES, null);
|
||||
}
|
||||
break;
|
||||
|
||||
case EXTRA_TASK_FOLDER_UPDATE_WITH_COUNT:
|
||||
|
@ -207,9 +209,10 @@ public class SyncService extends IntentService {
|
|||
if (intent.getLongExtra(EXTRA_TASK_FEED_ID, -1) != -1) {
|
||||
Long feedToBeDeleted = intent.getLongExtra(EXTRA_TASK_FEED_ID, -1);
|
||||
if (apiManager.deleteFeed(feedToBeDeleted, intent.getStringExtra(EXTRA_TASK_FOLDER_NAME))) {
|
||||
Log.d(TAG, "Deleted feed");
|
||||
Uri feedUri = FeedProvider.FEEDS_URI.buildUpon().appendPath(Long.toString(feedToBeDeleted)).build();
|
||||
contentResolver.delete(feedUri, null, null);
|
||||
receiver.send(STATUS_FINISHED_CLOSE, Bundle.EMPTY);
|
||||
return;
|
||||
} else {
|
||||
Log.e(TAG, "Error deleting feed");
|
||||
Toast.makeText(this, getResources().getString(R.string.error_deleting_feed), Toast.LENGTH_LONG).show();
|
||||
|
|
|
@ -11,5 +11,7 @@ public class AppConstants {
|
|||
|
||||
public static final String FOLDER_PRE = "folder_collapsed";
|
||||
public static final String NEWSBLUR_URL = "http://www.newsblur.com";
|
||||
public static final float FONT_SIZE_LOWER_BOUND = 1.0f;
|
||||
public static final float FONT_SIZE_INCREMENT_FACTOR = 5;
|
||||
|
||||
}
|
||||
|
|
|
@ -111,7 +111,6 @@ public class ImageLoader {
|
|||
Bitmap bitmap = BitmapFactory.decodeFile(f.getAbsolutePath());
|
||||
|
||||
if (bitmap != null) {
|
||||
Log.d(TAG, "Retrieving bitmap From file cache");
|
||||
memoryCache.put(url, bitmap);
|
||||
bitmap = UIUtils.roundCorners(bitmap, 5);
|
||||
return bitmap;
|
||||
|
|
|
@ -45,28 +45,6 @@ public class UIUtils {
|
|||
return rounded;
|
||||
}
|
||||
|
||||
public static Bitmap roundBitmap(Bitmap source) {
|
||||
int width = source.getWidth();
|
||||
int height = source.getHeight();
|
||||
|
||||
Paint paint = new Paint();
|
||||
paint.setAntiAlias(true);
|
||||
paint.setColor(WHITE);
|
||||
|
||||
Bitmap clipped = Bitmap.createBitmap(width, height, ARGB_8888);
|
||||
Canvas canvas = new Canvas(clipped);
|
||||
canvas.drawCircle(width / 2, height / 2, width / 2, paint);
|
||||
paint.setXfermode(new PorterDuffXfermode(DST_IN));
|
||||
|
||||
Bitmap rounded = Bitmap.createBitmap(width, height, ARGB_8888);
|
||||
canvas = new Canvas(rounded);
|
||||
canvas.drawBitmap(source, 0, 0, null);
|
||||
canvas.drawBitmap(clipped, 0, 0, paint);
|
||||
|
||||
clipped.recycle();
|
||||
|
||||
return rounded;
|
||||
}
|
||||
|
||||
public static Bitmap roundBitmapWithFrame(Bitmap source, Context context) {
|
||||
int width = source.getWidth();
|
||||
|
|
|
@ -54,7 +54,7 @@ public class ViewUtils {
|
|||
image.setMaxWidth(imageLength);
|
||||
|
||||
image.setLayoutParams(imageParameters);
|
||||
imageLoader.displayImageByUid(photoUrl, image);
|
||||
imageLoader.displayImage(photoUrl, image, 10f);
|
||||
image.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
|
|
|
@ -22,19 +22,18 @@ import com.newsblur.activity.Profile;
|
|||
import com.newsblur.domain.UserDetails;
|
||||
import com.newsblur.network.domain.ActivitiesResponse;
|
||||
import com.newsblur.util.ImageLoader;
|
||||
import com.newsblur.util.PrefsUtils;
|
||||
|
||||
public class ActivitiesAdapter extends ArrayAdapter<ActivitiesResponse> {
|
||||
|
||||
private LayoutInflater inflater;
|
||||
private ImageLoader imageLoader;
|
||||
private final String startedFollowing, ago, repliedTo, sharedStory, withComment, likedComment;
|
||||
private ForegroundColorSpan midgray, highlight, darkgray, lightblue;
|
||||
private ForegroundColorSpan highlight, darkgray;
|
||||
private String TAG = "ActivitiesAdapter";
|
||||
private Context context;
|
||||
private UserDetails userDetails;
|
||||
private UserDetails currentUserDetails;
|
||||
|
||||
public ActivitiesAdapter(final Context context, final ActivitiesResponse[] activities) {
|
||||
public ActivitiesAdapter(final Context context, final ActivitiesResponse[] activities, UserDetails user) {
|
||||
super(context, R.id.row_activity_text);
|
||||
inflater = LayoutInflater.from(context);
|
||||
imageLoader = ((NewsBlurApplication) context.getApplicationContext()).getImageLoader();
|
||||
|
@ -44,7 +43,7 @@ public class ActivitiesAdapter extends ArrayAdapter<ActivitiesResponse> {
|
|||
add(response);
|
||||
}
|
||||
|
||||
userDetails = PrefsUtils.getUserDetails(context);
|
||||
currentUserDetails = user;
|
||||
|
||||
Resources resources = context.getResources();
|
||||
startedFollowing = resources.getString(R.string.profile_started_following);
|
||||
|
@ -54,9 +53,7 @@ public class ActivitiesAdapter extends ArrayAdapter<ActivitiesResponse> {
|
|||
withComment = resources.getString(R.string.profile_with_comment);
|
||||
ago = resources.getString(R.string.profile_ago);
|
||||
|
||||
lightblue = new ForegroundColorSpan(resources.getColor(R.color.light_newsblur_blue));
|
||||
highlight = new ForegroundColorSpan(resources.getColor(R.color.linkblue));
|
||||
midgray = new ForegroundColorSpan(resources.getColor(R.color.midgray));
|
||||
darkgray = new ForegroundColorSpan(resources.getColor(R.color.darkgray));
|
||||
}
|
||||
|
||||
|
@ -87,6 +84,8 @@ public class ActivitiesAdapter extends ArrayAdapter<ActivitiesResponse> {
|
|||
activityTime.setText(activity.timeSince.toUpperCase() + " " + ago);
|
||||
if (activity.user != null) {
|
||||
imageLoader.displayImage(activity.user.photoUrl, imageView);
|
||||
} else if (TextUtils.equals(activity.category, "sharedstory")) {
|
||||
imageLoader.displayImage(currentUserDetails.photoUrl, imageView, 10f);
|
||||
} else {
|
||||
imageView.setImageResource(R.drawable.logo);
|
||||
}
|
||||
|
@ -134,16 +133,12 @@ public class ActivitiesAdapter extends ArrayAdapter<ActivitiesResponse> {
|
|||
stringBuilder.append("\"");
|
||||
}
|
||||
stringBuilder.setSpan(darkgray, 0, sharedStory.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
stringBuilder.setSpan(lightblue, sharedStory.length() + 1, sharedStory.length() + 1 + activity.title.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
stringBuilder.setSpan(highlight, sharedStory.length() + 1, sharedStory.length() + 1 + activity.title.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
if (!TextUtils.isEmpty(activity.content)) {
|
||||
stringBuilder.setSpan(midgray, sharedStory.length() + 4 + activity.title.length() + withComment.length(), stringBuilder.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
stringBuilder.setSpan(darkgray, sharedStory.length() + 4 + activity.title.length() + withComment.length(), stringBuilder.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
}
|
||||
|
||||
imageLoader.displayImage(userDetails.photoUrl, imageView);
|
||||
}
|
||||
|
||||
|
||||
|
||||
activityText.setText(stringBuilder);
|
||||
activityText.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
|
||||
|
|
|
@ -1,120 +0,0 @@
|
|||
package com.newsblur.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.BlurMaskFilter;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Paint;
|
||||
import android.hardware.Sensor;
|
||||
import android.hardware.SensorEvent;
|
||||
import android.hardware.SensorEventListener;
|
||||
import android.hardware.SensorManager;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
|
||||
import com.newsblur.R;
|
||||
|
||||
public class BlurView extends View implements SensorEventListener {
|
||||
|
||||
private static final String TAG = "BlurView";
|
||||
private Bitmap baseImage;
|
||||
private SensorManager mSensorManager;
|
||||
private Sensor mAccelerometer;
|
||||
private boolean mInitialized;
|
||||
private float mLastX;
|
||||
private float mLastY;
|
||||
private float NOISE = 2.0f;
|
||||
private float accelerometerValue = 1.5f;
|
||||
|
||||
public BlurView(Context context, AttributeSet attributeSet) {
|
||||
super(context, attributeSet);
|
||||
baseImage = BitmapFactory.decodeResource(getResources(), R.drawable.logo);
|
||||
|
||||
mInitialized = false;
|
||||
mSensorManager = (SensorManager) context.getSystemService(Context.SENSOR_SERVICE);
|
||||
mAccelerometer = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
|
||||
mSensorManager.registerListener(this, mAccelerometer, SensorManager.SENSOR_DELAY_NORMAL);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||
int parentWidth = MeasureSpec.getSize(widthMeasureSpec);
|
||||
int parentHeight = MeasureSpec.getSize(heightMeasureSpec);
|
||||
baseImage = Bitmap.createScaledBitmap(baseImage, parentWidth, parentHeight, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onAttachedToWindow() {
|
||||
super.onAttachedToWindow();
|
||||
Log.d(TAG, "Attached to window");
|
||||
|
||||
mSensorManager.registerListener(this, mAccelerometer, SensorManager.SENSOR_DELAY_NORMAL);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDetachedFromWindow() {
|
||||
Log.d(TAG, "Detached from window");
|
||||
super.onDetachedFromWindow();
|
||||
mSensorManager.unregisterListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Canvas canvas) {
|
||||
canvas.drawBitmap(otherBlur(baseImage), 0, 0, null);
|
||||
}
|
||||
|
||||
private Bitmap otherBlur(Bitmap src) {
|
||||
|
||||
int width = src.getWidth();
|
||||
int height = src.getHeight();
|
||||
|
||||
BlurMaskFilter blurMaskFilter;
|
||||
Paint paintBlur = new Paint();
|
||||
|
||||
Bitmap dest = Bitmap.createBitmap(width, height, Bitmap.Config.RGB_565);
|
||||
Canvas canvas = new Canvas(dest);
|
||||
|
||||
//Create background in White
|
||||
Bitmap alpha = src.extractAlpha();
|
||||
paintBlur.setColor(0xfffbe74d);
|
||||
canvas.drawBitmap(alpha, 0, 0, paintBlur);
|
||||
|
||||
blurMaskFilter = new BlurMaskFilter(accelerometerValue * 3, BlurMaskFilter.Blur.OUTER);
|
||||
paintBlur.setMaskFilter(blurMaskFilter);
|
||||
canvas.drawBitmap(alpha, 0, 0, paintBlur);
|
||||
|
||||
//Create inner blur
|
||||
blurMaskFilter = new BlurMaskFilter(accelerometerValue * 3, BlurMaskFilter.Blur.INNER);
|
||||
paintBlur.setMaskFilter(blurMaskFilter);
|
||||
canvas.drawBitmap(src, 0, 0, paintBlur);
|
||||
|
||||
return dest;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void onAccuracyChanged(Sensor sensor, int accuracy) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSensorChanged(SensorEvent event) {
|
||||
final float x = event.values[0];
|
||||
if (accelerometerValue - x > NOISE) {
|
||||
accelerometerValue += (x - accelerometerValue) / 3f;
|
||||
Log.d(TAG, "Sensor changed");
|
||||
postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
accelerometerValue = Math.abs(x);
|
||||
invalidate();
|
||||
}
|
||||
}, 200);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -3,12 +3,14 @@ package com.newsblur.view;
|
|||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.support.v4.widget.SimpleCursorAdapter.ViewBinder;
|
||||
import android.text.Html;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.newsblur.R;
|
||||
import com.newsblur.database.DatabaseConstants;
|
||||
import com.newsblur.domain.Story;
|
||||
|
||||
public class FeedItemViewBinder implements ViewBinder {
|
||||
|
||||
|
@ -44,13 +46,14 @@ public class FeedItemViewBinder implements ViewBinder {
|
|||
return true;
|
||||
} else if (TextUtils.equals(columnName, DatabaseConstants.STORY_INTELLIGENCE_AUTHORS)) {
|
||||
int authors = cursor.getInt(columnIndex);
|
||||
|
||||
int tags = cursor.getInt(cursor.getColumnIndex(DatabaseConstants.STORY_INTELLIGENCE_TAGS));
|
||||
int feed = cursor.getInt(cursor.getColumnIndex(DatabaseConstants.STORY_INTELLIGENCE_FEED));
|
||||
int title = cursor.getInt(cursor.getColumnIndex(DatabaseConstants.STORY_INTELLIGENCE_TITLE));
|
||||
if (authors + tags + feed + title > 0) {
|
||||
int score = Story.getIntelligenceTotal(title, authors, tags, feed);
|
||||
|
||||
if (score > 0) {
|
||||
view.setBackgroundResource(hasBeenRead == 0 ? R.drawable.positive_count_circle : R.drawable.positive_count_circle_read);
|
||||
} else if (authors + tags + feed + title == 0) {
|
||||
} else if (score == 0) {
|
||||
view.setBackgroundResource(hasBeenRead == 0 ? R.drawable.neutral_count_circle : R.drawable.neutral_count_circle_read);
|
||||
} else {
|
||||
view.setBackgroundResource(R.drawable.negative_count_circle);
|
||||
|
@ -58,6 +61,9 @@ public class FeedItemViewBinder implements ViewBinder {
|
|||
|
||||
((TextView) view).setText("");
|
||||
return true;
|
||||
} else if (TextUtils.equals(columnName, DatabaseConstants.STORY_TITLE)) {
|
||||
((TextView) view).setText(Html.fromHtml(cursor.getString(columnIndex)));
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
@ -53,12 +53,17 @@ public class FlowLayout extends ViewGroup {
|
|||
|
||||
public FlowLayout(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
defaultImageLength = UIUtils.convertDPsToPixels(context, 25);
|
||||
|
||||
TypedArray styledAttributes = context.obtainStyledAttributes(attrs, R.styleable.FlowLayout);
|
||||
String flowAttribute = styledAttributes.getString(R.styleable.FlowLayout_flow);
|
||||
int defaultImageSizeAttribute = styledAttributes.getInt(R.styleable.FlowLayout_defaultImageSize, 25);
|
||||
defaultImageLength = UIUtils.convertDPsToPixels(context, defaultImageSizeAttribute);
|
||||
|
||||
if (!TextUtils.isEmpty(flowAttribute) && TextUtils.equals(flowAttribute, "left")) {
|
||||
flowDirection = FLOW_LEFT;
|
||||
}
|
||||
|
||||
|
||||
styledAttributes.recycle();
|
||||
}
|
||||
|
||||
|
@ -123,6 +128,7 @@ public class FlowLayout extends ViewGroup {
|
|||
height = ypos + line_height;
|
||||
}
|
||||
}
|
||||
|
||||
setMeasuredDimension(width, height);
|
||||
}
|
||||
|
||||
|
@ -142,6 +148,7 @@ public class FlowLayout extends ViewGroup {
|
|||
|
||||
@Override
|
||||
protected void onLayout(boolean changed, int l, int t, int r, int b) {
|
||||
|
||||
final int count = getChildCount();
|
||||
final int width = r - l;
|
||||
|
||||
|
@ -154,8 +161,8 @@ public class FlowLayout extends ViewGroup {
|
|||
int childw;
|
||||
int childh;
|
||||
if (child instanceof ImageView) {
|
||||
childw = UIUtils.convertDPsToPixels(getContext(), 25);
|
||||
childh = UIUtils.convertDPsToPixels(getContext(), 25);
|
||||
childw = defaultImageLength;
|
||||
childh = defaultImageLength;
|
||||
} else {
|
||||
childw = child.getMeasuredWidth();
|
||||
childh = child.getMeasuredHeight();
|
||||
|
|
|
@ -1,27 +1,21 @@
|
|||
package com.newsblur.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.util.AttributeSet;
|
||||
import android.webkit.WebSettings;
|
||||
import android.webkit.WebView;
|
||||
|
||||
import com.newsblur.util.PrefConstants;
|
||||
import com.newsblur.util.AppConstants;
|
||||
|
||||
public class NewsblurWebview extends WebView {
|
||||
|
||||
private SharedPreferences preferences;
|
||||
private Handler handler;
|
||||
private float currentSize;
|
||||
|
||||
public NewsblurWebview(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
|
||||
preferences = context.getSharedPreferences(PrefConstants.PREFERENCES, 0);
|
||||
|
||||
getSettings().setJavaScriptEnabled(true);
|
||||
getSettings().setLoadWithOverviewMode(true);
|
||||
getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
|
||||
|
@ -36,16 +30,6 @@ public class NewsblurWebview extends WebView {
|
|||
}
|
||||
|
||||
|
||||
|
||||
public void increaseSize() {
|
||||
|
||||
if (currentSize < 2.0) {
|
||||
currentSize += 0.1f;
|
||||
preferences.edit().putFloat(PrefConstants.PREFERENCE_TEXT_SIZE, currentSize).commit();
|
||||
setTextSize(currentSize);
|
||||
}
|
||||
}
|
||||
|
||||
public class JavaScriptInterface {
|
||||
NewsblurWebview view;
|
||||
|
||||
|
@ -67,16 +51,10 @@ public class NewsblurWebview extends WebView {
|
|||
loadUrl("javascript:window.onload=webview.scroll(document.body.scrollHeight)");
|
||||
}
|
||||
|
||||
public void setTextSize(float int1) {
|
||||
loadUrl("javascript:document.body.style.fontSize='" + (0.5f + int1) + "em';");
|
||||
public void setTextSize(float textSize) {
|
||||
loadUrl("javascript:document.body.style.fontSize='" + (AppConstants.FONT_SIZE_LOWER_BOUND + textSize) + "em';");
|
||||
}
|
||||
|
||||
public void decreaseSize() {
|
||||
float currentSize = preferences.getFloat(PrefConstants.PREFERENCE_TEXT_SIZE, 1.0f);
|
||||
if (currentSize > 0.5) {
|
||||
currentSize -= 0.1f;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ public class SocialFeedViewBinder implements ViewBinder {
|
|||
return true;
|
||||
} else if (TextUtils.equals(cursor.getColumnName(columnIndex), DatabaseConstants.SOCIAL_FEED_ICON)) {
|
||||
String url = cursor.getString(columnIndex);
|
||||
imageLoader.displayImage(url, (ImageView) view, false);
|
||||
imageLoader.displayImage(url, (ImageView) view);
|
||||
return true;
|
||||
} else if (TextUtils.equals(cursor.getColumnName(columnIndex), DatabaseConstants.SOCIAL_FEED_NEGATIVE_COUNT)) {
|
||||
int feedNegative = cursor.getInt(columnIndex);
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.newsblur.view;
|
|||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.support.v4.widget.SimpleCursorAdapter.ViewBinder;
|
||||
import android.text.Html;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
|
@ -11,6 +12,7 @@ import android.widget.TextView;
|
|||
import com.newsblur.R;
|
||||
import com.newsblur.activity.NewsBlurApplication;
|
||||
import com.newsblur.database.DatabaseConstants;
|
||||
import com.newsblur.domain.Story;
|
||||
import com.newsblur.util.ImageLoader;
|
||||
|
||||
public class SocialItemViewBinder implements ViewBinder {
|
||||
|
@ -34,9 +36,12 @@ public class SocialItemViewBinder implements ViewBinder {
|
|||
int tags = cursor.getInt(cursor.getColumnIndex(DatabaseConstants.STORY_INTELLIGENCE_TAGS));
|
||||
int feed = cursor.getInt(cursor.getColumnIndex(DatabaseConstants.STORY_INTELLIGENCE_FEED));
|
||||
int title = cursor.getInt(cursor.getColumnIndex(DatabaseConstants.STORY_INTELLIGENCE_TITLE));
|
||||
if (authors + tags + feed + title > 0) {
|
||||
|
||||
int score = Story.getIntelligenceTotal(title, authors, tags, feed);
|
||||
|
||||
if (score > 0) {
|
||||
view.setBackgroundResource(hasBeenRead == 0 ? R.drawable.positive_count_circle : R.drawable.positive_count_circle_read);
|
||||
} else if (authors + tags + feed + title == 0) {
|
||||
} else if (score == 0) {
|
||||
view.setBackgroundResource(hasBeenRead == 0 ? R.drawable.neutral_count_circle : R.drawable.neutral_count_circle_read);
|
||||
} else {
|
||||
view.setBackgroundResource(R.drawable.negative_count_circle);
|
||||
|
@ -44,6 +49,15 @@ public class SocialItemViewBinder implements ViewBinder {
|
|||
|
||||
((TextView) view).setText("");
|
||||
return true;
|
||||
} else if (TextUtils.equals(columnName, DatabaseConstants.STORY_AUTHORS)) {
|
||||
String authors = cursor.getString(columnIndex);
|
||||
if (!TextUtils.isEmpty(authors)) {
|
||||
((TextView) view).setText(authors.toUpperCase());
|
||||
}
|
||||
return true;
|
||||
} else if (TextUtils.equals(columnName, DatabaseConstants.STORY_TITLE)) {
|
||||
((TextView) view).setText(Html.fromHtml(cursor.getString(columnIndex)));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue