mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-09-18 21:50:56 +00:00
Added headers for public and friend comments.
This commit is contained in:
parent
925f798231
commit
b5820303e1
8 changed files with 54 additions and 28 deletions
|
@ -2,7 +2,7 @@
|
|||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.newsblur"
|
||||
android:versionCode="15"
|
||||
android:versionName="0.9.5" >
|
||||
android:versionName="0.9.55" >
|
||||
|
||||
<uses-sdk
|
||||
android:minSdkVersion="8"
|
||||
|
|
|
@ -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"
|
||||
|
@ -93,7 +92,6 @@
|
|||
android:textColor="@color/newsblur_blue"
|
||||
android:textSize="14sp" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/comment_text"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -106,7 +104,6 @@
|
|||
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"
|
||||
|
@ -119,7 +116,6 @@
|
|||
newsblur:flow="left"
|
||||
newsblur:defaultImageSize="20" />
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<Button
|
||||
android:id="@+id/share_story_button"
|
||||
style="@style/shareButton"
|
||||
|
@ -24,7 +23,18 @@
|
|||
android:id="@+id/reading_friend_comment_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical" />
|
||||
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"
|
||||
|
@ -38,7 +48,18 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/comment_divider"
|
||||
android:orientation="vertical" />
|
||||
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>
|
|
@ -137,5 +137,7 @@
|
|||
<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>
|
|
@ -8,7 +8,6 @@ import android.database.ContentObserver;
|
|||
import android.database.Cursor;
|
||||
import android.database.DataSetObserver;
|
||||
import android.net.Uri;
|
||||
import android.opengl.Visibility;
|
||||
import android.os.Handler;
|
||||
import android.support.v4.widget.SimpleCursorAdapter.ViewBinder;
|
||||
import android.text.TextUtils;
|
||||
|
@ -63,7 +62,6 @@ 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) {
|
||||
|
@ -133,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);
|
||||
}
|
||||
|
||||
|
@ -286,7 +283,6 @@ 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);
|
||||
}
|
||||
|
@ -425,7 +421,6 @@ public class MixedExpandableListAdapter extends BaseExpandableListAdapter{
|
|||
|
||||
private synchronized void releaseCursorHelpers() {
|
||||
for (int pos = mChildrenCursorHelpers.size() - 1; pos >= 0; pos--) {
|
||||
|
||||
mChildrenCursorHelpers.valueAt(pos).deactivate();
|
||||
}
|
||||
mChildrenCursorHelpers.clear();
|
||||
|
@ -523,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();
|
||||
}
|
||||
}
|
||||
|
@ -562,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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
||||
|
@ -119,9 +117,11 @@ 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);
|
||||
sharedPreferences = getActivity().getSharedPreferences(PrefConstants.PREFERENCES, 0);
|
||||
if (sharedPreferences.getBoolean(AppConstants.FOLDER_PRE + groupId, true)) {
|
||||
list.expandGroup(i);
|
||||
}
|
||||
|
|
|
@ -14,7 +14,6 @@ import android.os.Handler;
|
|||
import android.support.v4.app.DialogFragment;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
|
|
|
@ -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;
|
||||
|
@ -171,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;
|
||||
|
@ -221,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);
|
||||
|
||||
|
@ -255,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) {
|
||||
|
@ -262,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();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue