{
-
- static class ViewHolder {
-
- @InjectView(R.id.tv_title)
- TextView title;
- @InjectView(R.id.tv_description)
- TextView description;
- @InjectView(R.id.tv_author)
- TextView author;
- @InjectView(R.id.tv_date)
- TextView time;
- @InjectView(R.id.tv_count)
- TextView comment_count;
-
- @InjectView(R.id.iv_face)
- public AvatarView face;
-
- public ViewHolder(View view) {
- ButterKnife.inject(this, view);
- }
- }
-
- @Override
- protected View getRealView(int position, View convertView, ViewGroup parent) {
- ViewHolder vh = null;
- if (convertView == null || convertView.getTag() == null) {
- convertView = getLayoutInflater(parent.getContext()).inflate(
- R.layout.list_cell_post, null);
- vh = new ViewHolder(convertView);
- convertView.setTag(vh);
- } else {
- vh = (ViewHolder) convertView.getTag();
- }
-
- Post post = (Post) mDatas.get(position);
-
- vh.face.setUserInfo(post.getAuthorId(), post.getAuthor());
- vh.face.setAvatarUrl(post.getPortrait());
- vh.title.setText(post.getTitle());
- String body = post.getBody();
- vh.description.setVisibility(View.GONE);
- if (null != body || !StringUtils.isEmpty(body)) {
- vh.description.setVisibility(View.VISIBLE);
- vh.description.setText(HTMLUtil.replaceTag(post.getBody()).trim());
- }
-
- if (AppContext.isOnReadedPostList(PostList.PREF_READED_POST_LIST,
- post.getId() + "")) {
- vh.title.setTextColor(parent.getContext().getResources()
- .getColor(ThemeSwitchUtils.getTitleReadedColor()));
- } else {
- vh.title.setTextColor(parent.getContext().getResources()
- .getColor(ThemeSwitchUtils.getTitleUnReadedColor()));
- }
-
- vh.author.setText(post.getAuthor());
- vh.time.setText(StringUtils.friendly_time(post.getPubDate()));
- vh.comment_count.setText(post.getAnswerCount() + "回 / "
- + post.getViewCount() + "阅");
-
- return convertView;
- }
-}
diff --git a/app/src/main/java/net/oschina/app/adapter/RecycleBin.java b/app/src/main/java/net/oschina/app/adapter/RecycleBin.java
deleted file mode 100644
index e46514b864d4bdf989d5d762e4901e6f7e8b7435..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/adapter/RecycleBin.java
+++ /dev/null
@@ -1,155 +0,0 @@
-package net.oschina.app.adapter;
-
-import android.annotation.SuppressLint;
-import android.os.Build;
-import android.util.SparseArray;
-import android.view.View;
-
-/**
- * The RecycleBin facilitates reuse of views across layouts. The RecycleBin has two levels of
- * storage: ActiveViews and ScrapViews. ActiveViews are those views which were onscreen at the
- * start of a layout. By construction, they are displaying current information. At the end of
- * layout, all views in ActiveViews are demoted to ScrapViews. ScrapViews are old views that
- * could potentially be used by the adapter to avoid allocating views unnecessarily.
- *
- * This class was taken from Android's implementation of {@link android.widget.AbsListView} which
- * is copyrighted 2006 The Android Open Source Project.
- */
-public class RecycleBin {
- /**
- * Views that were on screen at the start of layout. This array is populated at the start of
- * layout, and at the end of layout all view in activeViews are moved to scrapViews.
- * Views in activeViews represent a contiguous range of Views, with position of the first
- * view store in mFirstActivePosition.
- */
- private View[] activeViews = new View[0];
- private int[] activeViewTypes = new int[0];
-
- /** Unsorted views that can be used by the adapter as a convert view. */
- private SparseArray[] scrapViews;
-
- private int viewTypeCount;
-
- private SparseArray currentScrapViews;
-
- public void setViewTypeCount(int viewTypeCount) {
- if (viewTypeCount < 1) {
- throw new IllegalArgumentException("Can't have a viewTypeCount < 1");
- }
- //noinspection unchecked
- SparseArray[] scrapViews = new SparseArray[viewTypeCount];
- for (int i = 0; i < viewTypeCount; i++) {
- scrapViews[i] = new SparseArray();
- }
- this.viewTypeCount = viewTypeCount;
- currentScrapViews = scrapViews[0];
- this.scrapViews = scrapViews;
- }
-
- protected boolean shouldRecycleViewType(int viewType) {
- return viewType >= 0;
- }
-
- /** @return A view from the ScrapViews collection. These are unordered. */
- View getScrapView(int position, int viewType) {
- if (viewTypeCount == 1) {
- return retrieveFromScrap(currentScrapViews, position);
- } else if (viewType >= 0 && viewType < scrapViews.length) {
- return retrieveFromScrap(scrapViews[viewType], position);
- }
- return null;
- }
-
- /**
- * Put a view into the ScrapViews list. These views are unordered.
- *
- * @param scrap The view to add
- */
- @SuppressLint("NewApi")
-void addScrapView(View scrap, int position, int viewType) {
- if (viewTypeCount == 1) {
- currentScrapViews.put(position, scrap);
- } else {
- scrapViews[viewType].put(position, scrap);
- }
-
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
- scrap.setAccessibilityDelegate(null);
- }
- }
-
- /** Move all views remaining in activeViews to scrapViews. */
- @SuppressLint("NewApi")
-void scrapActiveViews() {
- final View[] activeViews = this.activeViews;
- final int[] activeViewTypes = this.activeViewTypes;
- final boolean multipleScraps = viewTypeCount > 1;
-
- SparseArray scrapViews = currentScrapViews;
- final int count = activeViews.length;
- for (int i = count - 1; i >= 0; i--) {
- final View victim = activeViews[i];
- if (victim != null) {
- int whichScrap = activeViewTypes[i];
-
- activeViews[i] = null;
- activeViewTypes[i] = -1;
-
- if (!shouldRecycleViewType(whichScrap)) {
- continue;
- }
-
- if (multipleScraps) {
- scrapViews = this.scrapViews[whichScrap];
- }
- scrapViews.put(i, victim);
-
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
- victim.setAccessibilityDelegate(null);
- }
- }
- }
-
- pruneScrapViews();
- }
-
- /**
- * Makes sure that the size of scrapViews does not exceed the size of activeViews.
- * (This can happen if an adapter does not recycle its views).
- */
- private void pruneScrapViews() {
- final int maxViews = activeViews.length;
- final int viewTypeCount = this.viewTypeCount;
- final SparseArray[] scrapViews = this.scrapViews;
- for (int i = 0; i < viewTypeCount; ++i) {
- final SparseArray scrapPile = scrapViews[i];
- int size = scrapPile.size();
- final int extras = size - maxViews;
- size--;
- for (int j = 0; j < extras; j++) {
- scrapPile.remove(scrapPile.keyAt(size--));
- }
- }
- }
-
- static View retrieveFromScrap(SparseArray scrapViews, int position) {
- int size = scrapViews.size();
- if (size > 0) {
- // See if we still have a view for this position.
- for (int i = 0; i < size; i++) {
- int fromPosition = scrapViews.keyAt(i);
- View view = scrapViews.get(fromPosition);
- if (fromPosition == position) {
- scrapViews.remove(fromPosition);
- return view;
- }
- }
- int index = size - 1;
- View r = scrapViews.valueAt(index);
- scrapViews.remove(scrapViews.keyAt(index));
- return r;
- } else {
- return null;
- }
- }
-}
diff --git a/app/src/main/java/net/oschina/app/adapter/RecyclingPagerAdapter.java b/app/src/main/java/net/oschina/app/adapter/RecyclingPagerAdapter.java
deleted file mode 100644
index 84e7d8859c0061d5d9fac6f4250a5765765bc807..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/adapter/RecyclingPagerAdapter.java
+++ /dev/null
@@ -1,122 +0,0 @@
-package net.oschina.app.adapter;
-
-import android.support.v4.view.PagerAdapter;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.AdapterView;
-
-/**
- * A {@link PagerAdapter} which behaves like an {@link android.widget.Adapter}
- * with view types and view recycling.
- */
-public abstract class RecyclingPagerAdapter extends PagerAdapter {
- static final int IGNORE_ITEM_VIEW_TYPE = AdapterView.ITEM_VIEW_TYPE_IGNORE;
-
- private final RecycleBin recycleBin;
-
- public RecyclingPagerAdapter() {
- this(new RecycleBin());
- }
-
- RecyclingPagerAdapter(RecycleBin recycleBin) {
- this.recycleBin = recycleBin;
- recycleBin.setViewTypeCount(getViewTypeCount());
- }
-
- @Override
- public void notifyDataSetChanged() {
- recycleBin.scrapActiveViews();
- super.notifyDataSetChanged();
- }
-
- @Override
- public final Object instantiateItem(ViewGroup container, int position) {
- int viewType = getItemViewType(position);
- View view = null;
- if (viewType != IGNORE_ITEM_VIEW_TYPE) {
- view = recycleBin.getScrapView(position, viewType);
- }
- view = getView(position, view, container);
- container.addView(view);
- return view;
- }
-
- @Override
- public final void destroyItem(ViewGroup container, int position,
- Object object) {
- View view = (View) object;
- container.removeView(view);
- int viewType = getItemViewType(position);
- if (viewType != IGNORE_ITEM_VIEW_TYPE) {
- recycleBin.addScrapView(view, position, viewType);
- }
- }
-
- @Override
- public final boolean isViewFromObject(View view, Object object) {
- return view == object;
- }
-
- /**
- *
- * Returns the number of types of Views that will be created by
- * {@link #getView}. Each type represents a set of views that can be
- * converted in {@link #getView}. If the adapter always returns the same
- * type of View for all items, this method should return 1.
- *
- *
- * This method will only be called when when the adapter is set on the the
- * {@link AdapterView}.
- *
- *
- * @return The number of types of Views that will be created by this adapter
- */
- public int getViewTypeCount() {
- return 1;
- }
-
- /**
- * Get the type of View that will be created by {@link #getView} for the
- * specified item.
- *
- * @param position
- * The position of the item within the adapter's data set whose
- * view type we want.
- * @return An integer representing the type of View. Two views should share
- * the same type if one can be converted to the other in
- * {@link #getView}. Note: Integers must be in the range 0 to
- * {@link #getViewTypeCount} - 1. {@link #IGNORE_ITEM_VIEW_TYPE} can
- * also be returned.
- * @see #IGNORE_ITEM_VIEW_TYPE
- */
- public int getItemViewType(int position) {
- return 0;
- }
-
- /**
- * Get a View that displays the data at the specified position in the data
- * set. You can either create a View manually or inflate it from an XML
- * layout file. When the View is inflated, the parent View (GridView,
- * ListView...) will apply default layout parameters unless you use
- * {@link android.view.LayoutInflater#inflate(int, android.view.ViewGroup, boolean)}
- * to specify a root view and to prevent attachment to the root.
- *
- * @param position
- * The position of the item within the adapter's data set of the
- * item whose view we want.
- * @param convertView
- * The old view to reuse, if possible. Note: You should check
- * that this view is non-null and of an appropriate type before
- * using. If it is not possible to convert this view to display
- * the correct data, this method can create a new view.
- * Heterogeneous lists can specify their number of view types, so
- * that this View is always of the right type (see
- * {@link #getViewTypeCount()} and {@link #getItemViewType(int)}
- * ).
- * @param parent
- * The parent that this view will eventually be attached to
- * @return A View corresponding to the data at the specified position.
- */
- public abstract View getView(int position, View convertView,
- ViewGroup container);
-}
diff --git a/app/src/main/java/net/oschina/app/adapter/SearchAdapter.java b/app/src/main/java/net/oschina/app/adapter/SearchAdapter.java
deleted file mode 100644
index 9e77e3c0b86ede480514a34f114568f9c5d4b984..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/adapter/SearchAdapter.java
+++ /dev/null
@@ -1,70 +0,0 @@
-package net.oschina.app.adapter;
-
-import net.oschina.app.R;
-import net.oschina.app.base.ListBaseAdapter;
-import net.oschina.app.bean.SearchResult;
-import net.oschina.app.util.StringUtils;
-import android.annotation.SuppressLint;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.ImageView;
-import android.widget.TextView;
-import butterknife.ButterKnife;
-import butterknife.InjectView;
-
-public class SearchAdapter extends ListBaseAdapter {
-
- @SuppressLint("InflateParams")
- @Override
- protected View getRealView(int position, View convertView, ViewGroup parent) {
- ViewHolder vh = null;
- if (convertView == null || convertView.getTag() == null) {
- convertView = getLayoutInflater(parent.getContext()).inflate(
- R.layout.list_cell_news, null);
- vh = new ViewHolder(convertView);
- convertView.setTag(vh);
- } else {
- vh = (ViewHolder) convertView.getTag();
- }
-
- SearchResult item = (SearchResult) mDatas.get(position);
-
- vh.title.setText(item.getTitle());
-
- if (item.getDescription() == null || StringUtils.isEmpty(item.getDescription())) {
- vh.description.setVisibility(View.GONE);
- } else {
- vh.description.setVisibility(View.VISIBLE);
- vh.description.setText(item.getDescription());
- }
-
- if (!StringUtils.isEmpty(item.getAuthor())) {
- vh.source.setText(item.getAuthor());
- } else {
- vh.source.setVisibility(View.GONE);
- }
-
- if (!StringUtils.isEmpty(item.getPubDate())) {
- vh.time.setText(StringUtils.friendly_time(item.getPubDate()));
- } else {
- vh.time.setVisibility(View.GONE);
- }
-
- vh.tip.setVisibility(View.GONE);
- vh.comment_count.setVisibility(View.GONE);
- return convertView;
- }
-
- static class ViewHolder {
- @InjectView(R.id.tv_title)TextView title;
- @InjectView(R.id.tv_description)TextView description;
- @InjectView(R.id.tv_source)TextView source;
- @InjectView(R.id.tv_time)TextView time;
- @InjectView(R.id.tv_comment_count)TextView comment_count;
- @InjectView(R.id.iv_tip)ImageView tip;
-
- public ViewHolder(View view) {
- ButterKnife.inject(this, view);
- }
- }
-}
diff --git a/app/src/main/java/net/oschina/app/adapter/SearchFriendAdapter.java b/app/src/main/java/net/oschina/app/adapter/SearchFriendAdapter.java
deleted file mode 100644
index 313cc6c8703140fb5a651c0c9074d256cf566115..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/adapter/SearchFriendAdapter.java
+++ /dev/null
@@ -1,111 +0,0 @@
-package net.oschina.app.adapter;
-
-import android.content.Context;
-import android.text.SpannableString;
-import android.text.Spanned;
-import android.text.style.ForegroundColorSpan;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.BaseAdapter;
-import android.widget.CheckBox;
-import android.widget.TextView;
-
-import net.oschina.app.R;
-import net.oschina.app.ui.SelectFriendsActivity;
-import net.oschina.app.widget.AvatarView;
-
-import java.util.List;
-
-import butterknife.ButterKnife;
-import butterknife.InjectView;
-
-/**
- * Created 15/8/27 下午9:29.
- * Email:730395591@qq.com
- * LeonLee Blog
- *
- * @author 李文龙(LeonLee
- *
- * 搜索好友结果适配器
- */
-public class SearchFriendAdapter extends BaseAdapter {
-
- final List mSearchResults;
- private LayoutInflater mInflater;
-
- public SearchFriendAdapter(List list) {
- this.mSearchResults = list;
- }
-
- protected LayoutInflater getLayoutInflater(Context context) {
- if (mInflater == null) {
- mInflater = (LayoutInflater) context
- .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
- }
- return mInflater;
- }
-
- @Override
- public int getCount() {
- return mSearchResults.size();
- }
-
- @Override
- public SelectFriendsActivity.SearchItem getItem(int position) {
- return mSearchResults.get(position);
- }
-
- @Override
- public long getItemId(int position) {
- return 0;
- }
-
- @Override
- public View getView(int position, View convertView, ViewGroup parent) {
- final NormalViewHolder holder;
- if(convertView == null) {
- convertView = getLayoutInflater(parent.getContext()).inflate(R.layout.list_cell_select_friend, parent, false);
- holder = new NormalViewHolder(convertView);
- convertView.setTag(holder);
- } else {
- holder = (NormalViewHolder) convertView.getTag();
- }
- holder.bind(getItem(position));
- return convertView;
- }
-
- static class NormalViewHolder {
- @InjectView(R.id.tv_name)
- TextView name;
- @InjectView(R.id.iv_avatar)
- AvatarView avatar;
- @InjectView(R.id.cb_check)
- CheckBox checkBox;
-
- NormalViewHolder(View view) {
- ButterKnife.inject(this, view);
- avatar.setClickable(false);
- }
-
- public void bind(SelectFriendsActivity.SearchItem item) {
- SelectFriendsActivity.FriendItem friendItem = item.getFriendItem();
- avatar.setAvatarUrl(friendItem.getFriend().getPortrait());
- checkBox.setChecked(friendItem.isSelected());
-
- avatar.setDisplayCircle(false);
-
- int start = item.getStartIndex();
- if(start != -1) {
- SpannableString ss = new SpannableString(friendItem.getFriend().getName());
- ss.setSpan(new ForegroundColorSpan(item.getHightLightColor()), start,
- start + item.getKeyLength(), Spanned.SPAN_EXCLUSIVE_INCLUSIVE);
- name.setText(ss);
- } else {
- name.setText(friendItem.getFriend().getName());
- }
-
- }
- }
-
-}
diff --git a/app/src/main/java/net/oschina/app/adapter/SelectFriendAdapter.java b/app/src/main/java/net/oschina/app/adapter/SelectFriendAdapter.java
deleted file mode 100644
index b2b85e972781371137a62b545c46f9c97e5a3184..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/adapter/SelectFriendAdapter.java
+++ /dev/null
@@ -1,219 +0,0 @@
-package net.oschina.app.adapter;
-
-import android.content.Context;
-import android.util.SparseArray;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.BaseAdapter;
-import android.widget.CheckBox;
-import android.widget.TextView;
-
-import net.oschina.app.R;
-import net.oschina.app.ui.SelectFriendsActivity;
-import net.oschina.app.widget.AvatarView;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import butterknife.ButterKnife;
-import butterknife.InjectView;
-
-/**
- * Created 15/8/26 下午2:09.
- * Email:730395591@qq.com
- * LeonLee Blog
- *
- * @author 李文龙(LeonLee)
- */
-public class SelectFriendAdapter extends BaseAdapter {
-
- private static final char DEFAULT_OTHER_LETTER = '#';
-
- private static final int VIEWTYPE_HEADER = 0;
- private static final int VIEWTYPE_NORMAL = 1;
-
- private List mList = new ArrayList<>();
- //记录索引值对应的位置
- private SparseArray mPositionArray = new SparseArray<>();
-
- private LayoutInflater mInflater;
-
- public SelectFriendAdapter() {
-
- }
-
- protected LayoutInflater getLayoutInflater(Context context) {
- if (mInflater == null) {
- mInflater = (LayoutInflater) context
- .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
- }
- return mInflater;
- }
-
- public void setFriendItems(List list) {
- mPositionArray.clear();
- mList.clear();
-
- //非字母开头的列表
- List otherList = null;
-
- char lastIndex = '0';
- for(SelectFriendsActivity.FriendItem item : list) {
- char indexLetter;
- char c = item.getFirstLetter();
- if(c >= 'A' && c <= 'Z') {
- indexLetter = c;
- } else if(c >= 'a' && c <= 'z') {
- indexLetter = (char)(c - 'a' + 'A');
- } else {
- indexLetter = DEFAULT_OTHER_LETTER;
- }
- if(indexLetter == DEFAULT_OTHER_LETTER) {
- if(otherList == null) {
- otherList = new ArrayList<>();
- }
- otherList.add(new NormalItemData(item));
- } else {
- if (indexLetter != lastIndex) {
- mPositionArray.append(indexLetter, mList.size());
- mList.add(new HeaderItemData(String.valueOf(indexLetter)));
- lastIndex = indexLetter;
- }
- mList.add(new NormalItemData(item));
- }
- }
- //将没有索引的数据列表放到最后
- if(otherList != null && !otherList.isEmpty()) {
- mPositionArray.append(DEFAULT_OTHER_LETTER, mList.size());
- mList.add(new HeaderItemData(String.valueOf(DEFAULT_OTHER_LETTER)));
- mList.addAll(otherList);
- }
-
- notifyDataSetChanged();
- }
-
- /** 根据索引获取位置*/
- public int getPositionByIndex(char indexLetter) {
- Integer value = mPositionArray.get(indexLetter);
- if(value == null) {
- return -1;
- }
- return value;
- }
-
- public SelectFriendsActivity.FriendItem getFriendItem(int position) {
- ItemData data = getItem(position);
- if(data instanceof NormalItemData) {
- return ((NormalItemData)data).friendItem;
- }
- return null;
- }
-
- @Override
- public int getCount() {
- return mList.size();
- }
-
- @Override
- public ItemData getItem(int position) {
- return mList.get(position);
- }
-
- @Override
- public long getItemId(int position) {
- return position;
- }
-
- @Override
- public int getViewTypeCount() {
- return 2;
- }
-
- @Override
- public int getItemViewType(int position) {
- return (getItem(position) instanceof HeaderItemData) ? VIEWTYPE_HEADER : VIEWTYPE_NORMAL;
- }
-
- @Override
- public View getView(int position, View convertView, ViewGroup parent) {
- final ItemData itemData = getItem(position);
- if(itemData instanceof HeaderItemData) {
- final HeaderViewHolder holder;
- if(convertView == null) {
- convertView = getLayoutInflater(parent.getContext()).inflate(R.layout.list_index_header, parent, false);
- holder = new HeaderViewHolder(convertView);
- convertView.setTag(holder);
- convertView.setEnabled(false);
- } else {
- holder = (HeaderViewHolder) convertView.getTag();
- }
- holder.bind(((HeaderItemData)itemData).index);
- } else {
- final NormalViewHolder holder;
- if(convertView == null) {
- convertView = getLayoutInflater(parent.getContext()).inflate(R.layout.list_cell_select_friend, parent, false);
- holder = new NormalViewHolder(convertView);
- convertView.setTag(holder);
- } else {
- holder = (NormalViewHolder) convertView.getTag();
- }
- holder.bind(((NormalItemData)itemData).friendItem);
- }
-
- return convertView;
- }
-
- private interface ItemData {}
-
- static class HeaderItemData implements ItemData {
- String index;
- public HeaderItemData(String index) {
- this.index = index;
- }
- }
-
- static class NormalItemData implements ItemData {
- SelectFriendsActivity.FriendItem friendItem;
-
- public NormalItemData(SelectFriendsActivity.FriendItem friendItem) {
- this.friendItem = friendItem;
- }
- }
-
- static class HeaderViewHolder {
- @InjectView(R.id.header_text)
- TextView text;
-
- HeaderViewHolder(View view) {
- ButterKnife.inject(this, view);
- }
-
- public void bind(String index) {
- text.setText(index);
- }
- }
-
- static class NormalViewHolder {
- @InjectView(R.id.tv_name)
- TextView name;
- @InjectView(R.id.iv_avatar)
- AvatarView avatar;
- @InjectView(R.id.cb_check)
- CheckBox checkBox;
-
- NormalViewHolder(View view) {
- ButterKnife.inject(this, view);
- avatar.setClickable(false);
- }
-
- public void bind(SelectFriendsActivity.FriendItem item) {
- name.setText(item.getFriend().getName());
- avatar.setAvatarUrl(item.getFriend().getPortrait());
- checkBox.setChecked(item.isSelected());
-
- avatar.setDisplayCircle(false);
-
- }
- }
-}
diff --git a/app/src/main/java/net/oschina/app/adapter/SoftwareAdapter.java b/app/src/main/java/net/oschina/app/adapter/SoftwareAdapter.java
deleted file mode 100644
index 2aea0ca4d3ae357829cbfe0d7ad42c8493b9dcf2..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/adapter/SoftwareAdapter.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package net.oschina.app.adapter;
-
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.TextView;
-
-import net.oschina.app.AppContext;
-import net.oschina.app.R;
-import net.oschina.app.base.ListBaseAdapter;
-import net.oschina.app.bean.SoftwareDec;
-import net.oschina.app.bean.SoftwareList;
-import net.oschina.app.util.ThemeSwitchUtils;
-
-import butterknife.ButterKnife;
-import butterknife.InjectView;
-
-public class SoftwareAdapter extends ListBaseAdapter {
-
- static class ViewHold {
- @InjectView(R.id.tv_title)
- TextView name;
- @InjectView(R.id.tv_software_des)
- TextView des;
-
- public ViewHold(View view) {
- ButterKnife.inject(this, view);
- }
- }
-
- @Override
- protected View getRealView(int position, View convertView, ViewGroup parent) {
-
- ViewHold vh = null;
- if (convertView == null || convertView.getTag() == null) {
- convertView = getLayoutInflater(parent.getContext()).inflate(R.layout.list_cell_software, null);
- vh = new ViewHold(convertView);
- convertView.setTag(vh);
- } else {
- vh = (ViewHold) convertView.getTag();
- }
-
- SoftwareDec softwareDes = (SoftwareDec) mDatas.get(position);
- vh.name.setText(softwareDes.getName());
-
- if (AppContext.isOnReadedPostList(SoftwareList.PREF_READED_SOFTWARE_LIST,
- softwareDes.getName())) {
- vh.name.setTextColor(parent.getContext().getResources()
- .getColor(ThemeSwitchUtils.getTitleReadedColor()));
- } else {
- vh.name.setTextColor(parent.getContext().getResources()
- .getColor(ThemeSwitchUtils.getTitleUnReadedColor()));
- }
-
- vh.des.setText(softwareDes.getDescription());
-
- return convertView;
- }
-}
diff --git a/app/src/main/java/net/oschina/app/adapter/SoftwareCatalogListAdapter.java b/app/src/main/java/net/oschina/app/adapter/SoftwareCatalogListAdapter.java
deleted file mode 100644
index 68a4b02716ad43bdf64f1f5427285a796ae15e99..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/adapter/SoftwareCatalogListAdapter.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package net.oschina.app.adapter;
-
-import net.oschina.app.R;
-import net.oschina.app.base.ListBaseAdapter;
-import net.oschina.app.bean.SoftwareCatalogList.SoftwareType;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.TextView;
-import butterknife.ButterKnife;
-import butterknife.InjectView;
-
-public class SoftwareCatalogListAdapter extends ListBaseAdapter {
-
- static class ViewHold{
- @InjectView(R.id.tv_software_catalog_name)TextView name;
- public ViewHold(View view) {
- ButterKnife.inject(this,view);
- }
- }
-
- @Override
- protected View getRealView(int position, View convertView, ViewGroup parent) {
-
- ViewHold vh = null;
-
- if (convertView == null || convertView.getTag() == null) {
- convertView = getLayoutInflater(parent.getContext()).inflate(R.layout.list_cell_softwarecatalog, null);
- vh = new ViewHold(convertView);
- convertView.setTag(vh);
- } else {
- vh = (ViewHold)convertView.getTag();
- }
-
- SoftwareType softwareType = (SoftwareType) mDatas.get(position);
- vh.name.setText(softwareType.getName());
- return convertView;
-
- }
-}
diff --git a/app/src/main/java/net/oschina/app/adapter/TweetAdapter.java b/app/src/main/java/net/oschina/app/adapter/TweetAdapter.java
deleted file mode 100644
index 8fcb096eac337d80fc1ba44066eacb77eba515db..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/adapter/TweetAdapter.java
+++ /dev/null
@@ -1,251 +0,0 @@
-package net.oschina.app.adapter;
-
-import android.content.Context;
-import android.content.DialogInterface;
-import android.graphics.Bitmap;
-import android.graphics.BitmapFactory;
-import android.text.Html;
-import android.text.Spannable;
-import android.text.SpannableString;
-import android.text.Spanned;
-import android.text.TextUtils;
-import android.text.style.ImageSpan;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.view.ViewGroup;
-import android.widget.ImageView;
-import android.widget.TextView;
-
-import com.loopj.android.http.AsyncHttpResponseHandler;
-
-import net.oschina.app.AppContext;
-import net.oschina.app.R;
-import net.oschina.app.api.remote.OSChinaApi;
-import net.oschina.app.base.ListBaseAdapter;
-import net.oschina.app.bean.Tweet;
-import net.oschina.app.emoji.InputHelper;
-import net.oschina.app.ui.ImagePreviewActivity;
-import net.oschina.app.util.DialogHelp;
-import net.oschina.app.util.ImageUtils;
-import net.oschina.app.util.KJAnimations;
-import net.oschina.app.util.PlatfromUtil;
-import net.oschina.app.util.StringUtils;
-import net.oschina.app.util.TypefaceUtils;
-import net.oschina.app.util.UIHelper;
-import net.oschina.app.widget.AvatarView;
-import net.oschina.app.widget.MyLinkMovementMethod;
-import net.oschina.app.widget.TweetTextView;
-
-import org.kymjs.kjframe.Core;
-import org.kymjs.kjframe.utils.DensityUtils;
-
-import butterknife.ButterKnife;
-import butterknife.InjectView;
-import cz.msebera.android.httpclient.Header;
-
-public class TweetAdapter extends ListBaseAdapter {
-
- static class ViewHolder {
- @InjectView(R.id.tv_tweet_name)
- TextView author;
- @InjectView(R.id.tv_tweet_time)
- TextView time;
- @InjectView(R.id.tweet_item)
- TweetTextView content;
- @InjectView(R.id.tv_tweet_comment_count)
- TextView commentcount;
- @InjectView(R.id.tv_tweet_platform)
- TextView platform;
- @InjectView(R.id.iv_tweet_face)
- AvatarView face;
- @InjectView(R.id.iv_tweet_image)
- ImageView image;
- @InjectView(R.id.tv_like_state)
- TextView tvLikeState;
- @InjectView(R.id.tv_del)
- TextView del;
- @InjectView(R.id.tv_likeusers)
- TextView likeUsers;
-
- public ViewHolder(View view) {
- ButterKnife.inject(this, view);
- image.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- String url = (String) v.getTag();
- int index = url.lastIndexOf("?");
- if (index > 0) {
- url = url.substring(0, index);
- }
- ImagePreviewActivity.showImagePrivew(v.getContext(), 0, new String[]{url});
- }
- });
- }
- }
-
- private Bitmap recordBitmap;
- private Context context;
-
- final private AsyncHttpResponseHandler handler = new AsyncHttpResponseHandler() {
-
- @Override
- public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
- }
-
- @Override
- public void onFailure(int arg0, Header[] arg1, byte[] arg2,
- Throwable arg3) {
- }
- };
-
- private void initRecordImg(Context cxt) {
- recordBitmap = BitmapFactory.decodeResource(cxt.getResources(),
- R.drawable.audio3);
- recordBitmap = ImageUtils.zoomBitmap(recordBitmap,
- DensityUtils.dip2px(cxt, 20f), DensityUtils.dip2px(cxt, 20f));
- }
-
- @Override
- protected View getRealView(final int position, View convertView, ViewGroup parent) {
- context = parent.getContext();
- final ViewHolder vh;
- if (convertView == null || convertView.getTag() == null) {
- convertView = View.inflate(context, R.layout.list_cell_tweet, null);
- vh = new ViewHolder(convertView);
- convertView.setTag(vh);
- } else {
- vh = (ViewHolder) convertView.getTag();
- }
- final Tweet tweet = mDatas.get(position);
-
- if (tweet.getAuthorid() == AppContext.getInstance().getLoginUid()) {
- vh.del.setVisibility(View.VISIBLE);
- vh.del.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View v) {
- optionDel(context, tweet, position);
- }
- });
- } else {
- vh.del.setVisibility(View.GONE);
- }
-
- vh.face.setUserInfo(tweet.getAuthorid(), tweet.getAuthor());
- vh.face.setAvatarUrl(tweet.getPortrait());
- vh.author.setText(tweet.getAuthor());
- vh.time.setText(StringUtils.friendly_time(tweet.getPubDate()));
- vh.content.setMovementMethod(MyLinkMovementMethod.a());
- vh.content.setFocusable(false);
- vh.content.setDispatchToParent(true);
- vh.content.setLongClickable(false);
-
- Spanned span = Html.fromHtml(tweet.getBody().trim());
-
- if (!StringUtils.isEmpty(tweet.getAttach())) {
- if (recordBitmap == null) {
- initRecordImg(context);
- }
- ImageSpan recordImg = new ImageSpan(context, recordBitmap);
- SpannableString str = new SpannableString("c");
- str.setSpan(recordImg, 0, 1, Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
- vh.content.setText(str);
- span = InputHelper.displayEmoji(context.getResources(), span);
- vh.content.append(span);
- } else {
- span = InputHelper.displayEmoji(context.getResources(), span);
- vh.content.setText(span);
- }
-
- vh.commentcount.setText(tweet.getCommentCount());
-
- showTweetImage(vh, tweet.getImgSmall(), tweet.getImgBig());
- tweet.setLikeUsers(context, vh.likeUsers, true);
-
- if (tweet.getLikeUser() == null) {
- vh.tvLikeState.setVisibility(View.GONE);
- } else {
- vh.tvLikeState.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View v) {
- if (AppContext.getInstance().isLogin()) {
- updateLikeState(vh, tweet);
- } else {
- AppContext.showToast("先登陆再赞~");
- UIHelper.showLoginActivity(context);
- }
- }
- });
- }
-
- TypefaceUtils.setTypeface(vh.tvLikeState);
- if (tweet.getIsLike() == 1) {
- vh.tvLikeState.setTextColor(AppContext.getInstance().getResources().getColor(R.color
- .day_colorPrimary));
- } else {
- vh.tvLikeState.setTextColor(AppContext.getInstance().getResources().getColor(R.color
- .gray));
- }
- PlatfromUtil.setPlatFromString(vh.platform, tweet.getAppclient());
- return convertView;
- }
-
- private void updateLikeState(ViewHolder vh, Tweet tweet) {
- if (tweet.getIsLike() == 1) {
- tweet.setIsLike(0);
- tweet.setLikeCount(tweet.getLikeCount() - 1);
- if (!tweet.getLikeUser().isEmpty()) {
- tweet.getLikeUser().remove(0);
- }
- OSChinaApi.pubUnLikeTweet(tweet.getId(), tweet.getAuthorid(),
- handler);
- vh.tvLikeState.setTextColor(AppContext.getInstance().getResources().getColor(R.color
- .gray));
- } else {
- vh.tvLikeState.setAnimation(KJAnimations.getScaleAnimation(1.5f, 300));
- tweet.getLikeUser().add(0, AppContext.getInstance().getLoginUser());
- OSChinaApi.pubLikeTweet(tweet.getId(), tweet.getAuthorid(), handler);
- vh.tvLikeState.setTextColor(AppContext.getInstance().getResources().getColor(R.color
- .day_colorPrimary));
- tweet.setIsLike(1);
- tweet.setLikeCount(tweet.getLikeCount() + 1);
- }
- tweet.setLikeUsers(context, vh.likeUsers, true);
- }
-
- private void optionDel(Context context, final Tweet tweet, final int position) {
-
- DialogHelp.getConfirmDialog(context, "确定删除吗?", new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialogInterface, int i) {
- OSChinaApi.deleteTweet(tweet.getAuthorid(), tweet.getId(),
- new AsyncHttpResponseHandler() {
- @Override
- public void onSuccess(int arg0, Header[] arg1,
- byte[] arg2) {
- mDatas.remove(position);
- notifyDataSetChanged();
- }
-
- @Override
- public void onFailure(int arg0, Header[] arg1,
- byte[] arg2, Throwable arg3) {
- }
- });
- }
- }).show();
- }
-
- /**
- * 动态设置动弹列表图片显示规则
- */
- private void showTweetImage(final ViewHolder vh, String imgSmall, final String imgBig) {
- if (!TextUtils.isEmpty(imgBig)) {
- vh.image.setTag(imgBig);
- new Core.Builder().view(vh.image).size(300, 300).url(imgBig + "?300X300")
- .loadBitmapRes(R.drawable.pic_bg).doTask();
- vh.image.setVisibility(AvatarView.VISIBLE);
- } else {
- vh.image.setVisibility(AvatarView.GONE);
- }
- }
-}
diff --git a/app/src/main/java/net/oschina/app/adapter/TweetLikeAdapter.java b/app/src/main/java/net/oschina/app/adapter/TweetLikeAdapter.java
deleted file mode 100644
index 2dc6aa678e1621568112a25b4b9b3ddad07960ee..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/adapter/TweetLikeAdapter.java
+++ /dev/null
@@ -1,87 +0,0 @@
-package net.oschina.app.adapter;
-
-import android.annotation.SuppressLint;
-import android.text.Spanned;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.TextView;
-
-import net.oschina.app.R;
-import net.oschina.app.base.ListBaseAdapter;
-import net.oschina.app.bean.TweetLike;
-import net.oschina.app.util.PlatfromUtil;
-import net.oschina.app.util.StringUtils;
-import net.oschina.app.util.UIHelper;
-import net.oschina.app.widget.AvatarView;
-import net.oschina.app.widget.MyLinkMovementMethod;
-import net.oschina.app.widget.MyURLSpan;
-import net.oschina.app.widget.TweetTextView;
-
-import butterknife.ButterKnife;
-import butterknife.InjectView;
-
-/**
- * 动弹点赞适配器 TweetLikeAdapter.java
- *
- * @author 火蚁(http://my.oschina.net/u/253900)
- * @data 2015-4-10 上午10:19:19
- */
-public class TweetLikeAdapter extends ListBaseAdapter {
-
- @SuppressLint("InflateParams")
- @Override
- protected View getRealView(int position, View convertView,
- final ViewGroup parent) {
- ViewHolder vh = null;
- if (convertView == null || convertView.getTag() == null) {
- convertView = getLayoutInflater(parent.getContext()).inflate(
- R.layout.list_cell_tweet_like, null);
- vh = new ViewHolder(convertView);
- convertView.setTag(vh);
- } else {
- vh = (ViewHolder) convertView.getTag();
- }
-
- final TweetLike item = (TweetLike) mDatas.get(position);
-
- vh.name.setText(item.getUser().getName().trim());
-
- vh.action.setText("赞了我的动弹");
-
- vh.time.setText(StringUtils.friendly_time(item.getDatatime().trim()));
-
- PlatfromUtil.setPlatFromString(vh.from, item.getAppClient());
- vh.avatar.setUserInfo(item.getUser().getId(), item.getUser().getName());
- vh.avatar.setAvatarUrl(item.getUser().getPortrait());
-
- vh.reply.setMovementMethod(MyLinkMovementMethod.a());
- vh.reply.setFocusable(false);
- vh.reply.setDispatchToParent(true);
- vh.reply.setLongClickable(false);
- Spanned span = UIHelper.parseActiveReply(item.getTweet().getAuthor(),
- item.getTweet().getBody());
- vh.reply.setText(span);
- MyURLSpan.parseLinkText(vh.reply, span);
-
- return convertView;
- }
-
- static class ViewHolder {
- @InjectView(R.id.tv_name)
- TextView name;
- @InjectView(R.id.tv_from)
- TextView from;
- @InjectView(R.id.tv_time)
- TextView time;
- @InjectView(R.id.tv_action)
- TextView action;
- @InjectView(R.id.tv_reply)
- TweetTextView reply;
- @InjectView(R.id.iv_avatar)
- AvatarView avatar;
-
- public ViewHolder(View view) {
- ButterKnife.inject(this, view);
- }
- }
-}
diff --git a/app/src/main/java/net/oschina/app/adapter/TweetLikeUsersAdapter.java b/app/src/main/java/net/oschina/app/adapter/TweetLikeUsersAdapter.java
deleted file mode 100644
index 96110041bf15d11281f5e348d6ec55b420bcfed4..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/adapter/TweetLikeUsersAdapter.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package net.oschina.app.adapter;
-
-import butterknife.ButterKnife;
-import butterknife.InjectView;
-
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.TextView;
-import net.oschina.app.R;
-import net.oschina.app.base.ListBaseAdapter;
-import net.oschina.app.bean.User;
-import net.oschina.app.widget.AvatarView;
-
-/**
- * TweetLikeUsersAdapter.java
- *
- * @author 火蚁(http://my.oschina.net/u/253900)
- *
- * @data 2015-3-26 下午4:11:25
- */
-public class TweetLikeUsersAdapter extends ListBaseAdapter {
-
- @Override
- protected View getRealView(int position, View convertView, ViewGroup parent) {
- // TODO Auto-generated method stub
- ViewHolder vh = null;
- if (convertView == null || convertView.getTag() == null) {
- convertView = getLayoutInflater(parent.getContext()).inflate(
- R.layout.list_cell_tweet_like_user, null);
- vh = new ViewHolder(convertView);
- convertView.setTag(vh);
- } else {
- vh = (ViewHolder) convertView.getTag();
- }
- User item = mDatas.get(position);
- vh.avatar.setAvatarUrl(item.getPortrait());
- vh.name.setText(item.getName());
- return convertView;
- }
-
- static class ViewHolder {
-
- @InjectView(R.id.iv_avatar)
- AvatarView avatar;
- @InjectView(R.id.tv_name)
- TextView name;
-
- public ViewHolder(View view) {
- ButterKnife.inject(this, view);
- }
- }
-}
-
diff --git a/app/src/main/java/net/oschina/app/adapter/UserFavoriteAdapter.java b/app/src/main/java/net/oschina/app/adapter/UserFavoriteAdapter.java
deleted file mode 100644
index 405820f3e1f5c68f107ae293a523de19f049fe8d..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/adapter/UserFavoriteAdapter.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package net.oschina.app.adapter;
-
-import net.oschina.app.R;
-import net.oschina.app.base.ListBaseAdapter;
-import net.oschina.app.bean.Favorite;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.TextView;
-import butterknife.ButterKnife;
-import butterknife.InjectView;
-
-public class UserFavoriteAdapter extends ListBaseAdapter {
-
- static class ViewHolder {
-
- @InjectView(R.id.tv_favorite_title) TextView title;
-
- public ViewHolder(View view) {
- ButterKnife.inject(this,view);
- }
- }
-
- @Override
- protected View getRealView(int position, View convertView, ViewGroup parent) {
- ViewHolder vh = null;
- if (convertView == null || convertView.getTag() == null) {
- convertView = getLayoutInflater(parent.getContext()).inflate(
- R.layout.list_cell_favorite, null);
- vh = new ViewHolder(convertView);
- convertView.setTag(vh);
- } else {
- vh = (ViewHolder) convertView.getTag();
- }
-
- Favorite favorite = (Favorite) mDatas.get(position);
-
- vh.title.setText(favorite.getTitle());
- return convertView;
- }
-
-}
diff --git a/app/src/main/java/net/oschina/app/adapter/ViewPageFragmentAdapter.java b/app/src/main/java/net/oschina/app/adapter/ViewPageFragmentAdapter.java
deleted file mode 100644
index e216768150fde748f7c538d659053a2ca95c4800..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/adapter/ViewPageFragmentAdapter.java
+++ /dev/null
@@ -1,124 +0,0 @@
-package net.oschina.app.adapter;
-
-import java.util.ArrayList;
-
-import net.oschina.app.R;
-import net.oschina.app.widget.PagerSlidingTabStrip;
-import android.annotation.SuppressLint;
-import android.content.Context;
-import android.os.Bundle;
-import android.support.v4.app.Fragment;
-import android.support.v4.app.FragmentManager;
-import android.support.v4.app.FragmentStatePagerAdapter;
-import android.support.v4.view.PagerAdapter;
-import android.support.v4.view.ViewPager;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.widget.TextView;
-
-@SuppressLint("Recycle")
-public class ViewPageFragmentAdapter extends FragmentStatePagerAdapter {
-
- private final Context mContext;
- protected PagerSlidingTabStrip mPagerStrip;
- private final ViewPager mViewPager;
- private final ArrayList mTabs = new ArrayList();
-
- public ViewPageFragmentAdapter(FragmentManager fm,
- PagerSlidingTabStrip pageStrip, ViewPager pager) {
- super(fm);
- mContext = pager.getContext();
- mPagerStrip = pageStrip;
- mViewPager = pager;
- mViewPager.setAdapter(this);
- mPagerStrip.setViewPager(mViewPager);
- }
-
- public void addTab(String title, String tag, Class> clss, Bundle args) {
- ViewPageInfo viewPageInfo = new ViewPageInfo(title, tag, clss, args);
- addFragment(viewPageInfo);
- }
-
- public void addAllTab(ArrayList mTabs) {
- for (ViewPageInfo viewPageInfo : mTabs) {
- addFragment(viewPageInfo);
- }
- }
-
- private void addFragment(ViewPageInfo info) {
- if (info == null) {
- return;
- }
-
- // 加入tab title
- View v = LayoutInflater.from(mContext).inflate(
- R.layout.base_viewpage_fragment_tab_item, null, false);
- TextView title = (TextView) v.findViewById(R.id.tab_title);
- title.setText(info.title);
- mPagerStrip.addTab(v);
-
- mTabs.add(info);
- notifyDataSetChanged();
- }
-
- /**
- * 移除第一次
- */
- public void remove() {
- remove(0);
- }
-
- /**
- * 移除一个tab
- *
- * @param index
- * 备注:如果index小于0,则从第一个开始删 如果大于tab的数量值则从最后一个开始删除
- */
- public void remove(int index) {
- if (mTabs.isEmpty()) {
- return;
- }
- if (index < 0) {
- index = 0;
- }
- if (index >= mTabs.size()) {
- index = mTabs.size() - 1;
- }
- mTabs.remove(index);
- mPagerStrip.removeTab(index, 1);
- notifyDataSetChanged();
- }
-
- /**
- * 移除所有的tab
- */
- public void removeAll() {
- if (mTabs.isEmpty()) {
- return;
- }
- mPagerStrip.removeAllTab();
- mTabs.clear();
- notifyDataSetChanged();
- }
-
- @Override
- public int getCount() {
- return mTabs.size();
- }
-
- @Override
- public int getItemPosition(Object object) {
- return PagerAdapter.POSITION_NONE;
- }
-
- @Override
- public Fragment getItem(int position) {
- ViewPageInfo info = mTabs.get(position);
- return Fragment.instantiate(mContext, info.clss.getName(), info.args);
- }
-
- @Override
- public CharSequence getPageTitle(int position) {
- return mTabs.get(position).title;
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/net/oschina/app/adapter/ViewPageInfo.java b/app/src/main/java/net/oschina/app/adapter/ViewPageInfo.java
deleted file mode 100644
index 61307db2ee4c5f03961c4449330b5529aed5edd5..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/adapter/ViewPageInfo.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package net.oschina.app.adapter;
-
-import android.os.Bundle;
-
-public final class ViewPageInfo {
-
- public final String tag;
- public final Class> clss;
- public final Bundle args;
- public final String title;
-
- public ViewPageInfo(String _title, String _tag, Class> _class, Bundle _args) {
- title = _title;
- tag = _tag;
- clss = _class;
- args = _args;
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/net/oschina/app/api/ApiClientHelper.java b/app/src/main/java/net/oschina/app/api/ApiClientHelper.java
deleted file mode 100644
index f6da3026481e84c4c39d322bbb664e9d76ef2374..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/api/ApiClientHelper.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package net.oschina.app.api;
-
-import net.oschina.app.AppContext;
-
-public class ApiClientHelper {
-
- /**
- * 获得请求的服务端数据的userAgent
- * @param appContext
- * @return
- */
- public static String getUserAgent(AppContext appContext) {
- StringBuilder ua = new StringBuilder("OSChina.NET");
- ua.append('/' + appContext.getPackageInfo().versionName + '_'
- + appContext.getPackageInfo().versionCode);// app版本信息
- ua.append("/Android");// 手机系统平台
- ua.append("/" + android.os.Build.VERSION.RELEASE);// 手机系统版本
- ua.append("/" + android.os.Build.MODEL); // 手机型号
- ua.append("/" + appContext.getAppId());// 客户端唯一标识
- return ua.toString();
- }
-}
diff --git a/app/src/main/java/net/oschina/app/api/ApiHttpClient.java b/app/src/main/java/net/oschina/app/api/ApiHttpClient.java
deleted file mode 100644
index 47e124aff7a4da23d0e3d9488cee70197dca2a3c..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/api/ApiHttpClient.java
+++ /dev/null
@@ -1,149 +0,0 @@
-package net.oschina.app.api;
-
-import android.content.Context;
-import android.util.Log;
-import cz.msebera.android.httpclient.client.params.ClientPNames;
-
-import com.loopj.android.http.AsyncHttpClient;
-import com.loopj.android.http.AsyncHttpResponseHandler;
-import com.loopj.android.http.RequestParams;
-
-import net.oschina.app.AppContext;
-import net.oschina.app.util.TLog;
-
-import java.util.Locale;
-
-public class ApiHttpClient {
-
- public final static String HOST = "www.oschina.net";
- private static String API_URL = "http://www.oschina.net/%s";
-// public final static String HOST = "192.168.1.101";
-// private static String API_URL = "http://192.168.1.101/%s";
- public static final String DELETE = "DELETE";
- public static final String GET = "GET";
- public static final String POST = "POST";
- public static final String PUT = "PUT";
- public static AsyncHttpClient client;
-
- public ApiHttpClient() {
- }
-
- public static AsyncHttpClient getHttpClient() {
- return client;
- }
-
- public static void cancelAll(Context context) {
- client.cancelRequests(context, true);
- }
-
- public static void clearUserCookies(Context context) {
- // (new HttpClientCookieStore(context)).a();
- }
-
- public static void delete(String partUrl, AsyncHttpResponseHandler handler) {
- client.delete(getAbsoluteApiUrl(partUrl), handler);
- log(new StringBuilder("DELETE ").append(partUrl).toString());
- }
-
- public static void get(String partUrl, AsyncHttpResponseHandler handler) {
- client.get(getAbsoluteApiUrl(partUrl), handler);
- log(new StringBuilder("GET ").append(partUrl).toString());
- }
-
- public static void get(String partUrl, RequestParams params,
- AsyncHttpResponseHandler handler) {
- client.get(getAbsoluteApiUrl(partUrl), params, handler);
- log(new StringBuilder("GET ").append(partUrl).append("&")
- .append(params).toString());
- }
-
- public static String getAbsoluteApiUrl(String partUrl) {
- String url = partUrl;
- if (!partUrl.startsWith("http:") && !partUrl.startsWith("https:")) {
- url = String.format(API_URL, partUrl);
- }
- Log.d("BASE_CLIENT", "request:" + url);
- return url;
- }
-
- public static String getApiUrl() {
- return API_URL;
- }
-
- public static void getDirect(String url, AsyncHttpResponseHandler handler) {
- client.get(url, handler);
- log(new StringBuilder("GET ").append(url).toString());
- }
-
- public static void log(String log) {
- Log.d("BaseApi", log);
- TLog.log("Test", log);
- }
-
- public static void post(String partUrl, AsyncHttpResponseHandler handler) {
- client.post(getAbsoluteApiUrl(partUrl), handler);
- log(new StringBuilder("POST ").append(partUrl).toString());
- }
-
- public static void post(String partUrl, RequestParams params,
- AsyncHttpResponseHandler handler) {
- client.post(getAbsoluteApiUrl(partUrl), params, handler);
- log(new StringBuilder("POST ").append(partUrl).append("&")
- .append(params).toString());
- }
-
- public static void postDirect(String url, RequestParams params,
- AsyncHttpResponseHandler handler) {
- client.post(url, params, handler);
- log(new StringBuilder("POST ").append(url).append("&").append(params)
- .toString());
- }
-
- public static void put(String partUrl, AsyncHttpResponseHandler handler) {
- client.put(getAbsoluteApiUrl(partUrl), handler);
- log(new StringBuilder("PUT ").append(partUrl).toString());
- }
-
- public static void put(String partUrl, RequestParams params,
- AsyncHttpResponseHandler handler) {
- client.put(getAbsoluteApiUrl(partUrl), params, handler);
- log(new StringBuilder("PUT ").append(partUrl).append("&")
- .append(params).toString());
- }
-
- public static void setApiUrl(String apiUrl) {
- API_URL = apiUrl;
- }
-
- public static void setHttpClient(AsyncHttpClient c) {
- client = c;
- client.addHeader("Accept-Language", Locale.getDefault().toString());
- client.addHeader("Host", HOST);
- client.addHeader("Connection", "Keep-Alive");
- client.getHttpClient().getParams()
- .setParameter(ClientPNames.ALLOW_CIRCULAR_REDIRECTS, true);
-
- setUserAgent(ApiClientHelper.getUserAgent(AppContext.getInstance()));
- }
-
- public static void setUserAgent(String userAgent) {
- client.setUserAgent(userAgent);
- }
-
- public static void setCookie(String cookie) {
- client.addHeader("Cookie", cookie);
- }
-
- private static String appCookie;
-
- public static void cleanCookie() {
- appCookie = "";
- }
-
- public static String getCookie(AppContext appContext) {
- if (appCookie == null || appCookie == "") {
- appCookie = appContext.getProperty("cookie");
- }
- return appCookie;
- }
-}
diff --git a/app/src/main/java/net/oschina/app/api/ApiResponse.java b/app/src/main/java/net/oschina/app/api/ApiResponse.java
deleted file mode 100644
index 119d9af584fa5d1a703fee3af0bb831b56ab6217..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/api/ApiResponse.java
+++ /dev/null
@@ -1,90 +0,0 @@
-package net.oschina.app.api;
-
-import org.json.JSONObject;
-
-public class ApiResponse {
- protected Object _data;
- protected String _message;
- protected int _errorCode;
- protected boolean _isOk;
- private long _total;
- private String _serverTime;
- private boolean isCanceled;
-
- public ApiResponse(JSONObject json) {
- if (json != null) {
- setData(json.optJSONObject("data") == null ? json
- .optJSONArray("data") : json.optJSONObject("data"));
- setMessage(json.optString("result_desc"));
- setErrorCode(json.optInt("result_code"));
- setOk(getErrorCode() == 0);
- setServerTime(json.optString("timestamp"));
- }
- }
-
- public Object getData() {
- return _data;
- }
-
- public void setData(Object _data) {
- this._data = _data;
- }
-
- public boolean isOk() {
- return _isOk;
- }
-
- public void setOk(boolean _isOk) {
- this._isOk = _isOk;
- }
-
- public String getMessage() {
- return _message;
- }
-
- public void setMessage(String _message) {
- this._message = _message;
- }
-
- public int getErrorCode() {
- return _errorCode;
- }
-
- public void setErrorCode(int _errorCode) {
- this._errorCode = _errorCode;
- }
-
- @Override
- public String toString() {
- return "data:" + getData() + " message:" + getMessage() + " errocode:"
- + _errorCode;
- }
-
- public void update(ApiResponse response) {
- _message = response.getMessage();
- }
-
- public void setTotal(long total) {
- _total = total;
- }
-
- public long getTotal() {
- return _total;
- }
-
- public String getServerTime() {
- return _serverTime;
- }
-
- public void setServerTime(String _serverTime) {
- this._serverTime = _serverTime;
- }
-
- public boolean isCanceled() {
- return isCanceled;
- }
-
- public void setCanceled(boolean isCanceled) {
- this.isCanceled = isCanceled;
- }
-}
diff --git a/app/src/main/java/net/oschina/app/api/OperationResponseHandler.java b/app/src/main/java/net/oschina/app/api/OperationResponseHandler.java
deleted file mode 100644
index 604fdca13259aaea817a747d3ad98c12e09703e9..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/api/OperationResponseHandler.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package net.oschina.app.api;
-
-import java.io.ByteArrayInputStream;
-
-
-import android.os.Looper;
-import cz.msebera.android.httpclient.Header;
-
-import com.loopj.android.http.AsyncHttpResponseHandler;
-
-public class OperationResponseHandler extends AsyncHttpResponseHandler {
-
- private Object[] args;
-
- public OperationResponseHandler(Looper looper, Object... args) {
- super(looper);
- this.args = args;
- }
-
- public OperationResponseHandler(Object... args) {
- this.args = args;
- }
-
- @Override
- public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) {
- onFailure(arg0, arg3.getMessage(), args);
- }
-
- public void onFailure(int code, String errorMessage, Object[] args) {
- }
-
- @Override
- public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
- try {
- onSuccess(arg0, new ByteArrayInputStream(arg2), args);
- } catch (Exception e) {
- e.printStackTrace();
- onFailure(arg0, e.getMessage(), args);
- }
- }
-
- public void onSuccess(int code, ByteArrayInputStream is, Object[] args)
- throws Exception {
-
- }
-}
diff --git a/app/src/main/java/net/oschina/app/api/remote/OSChinaApi.java b/app/src/main/java/net/oschina/app/api/remote/OSChinaApi.java
deleted file mode 100644
index cc5097959e8b65cb2ab05b106b1c4143db18d645..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/api/remote/OSChinaApi.java
+++ /dev/null
@@ -1,1029 +0,0 @@
-package net.oschina.app.api.remote;
-
-import android.text.TextUtils;
-
-import com.loopj.android.http.AsyncHttpResponseHandler;
-import com.loopj.android.http.RequestParams;
-
-import net.oschina.app.AppContext;
-import net.oschina.app.AppException;
-import net.oschina.app.api.ApiHttpClient;
-import net.oschina.app.bean.EventApplyData;
-import net.oschina.app.bean.NewsList;
-import net.oschina.app.bean.Report;
-import net.oschina.app.bean.Tweet;
-import net.oschina.app.team.bean.Team;
-import net.oschina.app.util.StringUtils;
-import net.oschina.app.util.TLog;
-
-import org.kymjs.kjframe.utils.KJLoger;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.net.URLEncoder;
-
-public class OSChinaApi {
-
- /**
- * 登陆
- *
- * @param username
- * @param password
- * @param handler
- */
- public static void login(String username, String password,
- AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- params.put("username", username);
- params.put("pwd", password);
- params.put("keep_login", 1);
- String loginurl = "action/api/login_validate";
- ApiHttpClient.post(loginurl, params, handler);
- }
-
- public static void openIdLogin(String s) {
-
- }
-
- /**
- * 获取新闻列表
- *
- * @param catalog
- * 类别 (1,2,3)
- * @param page
- * 第几页
- * @param handler
- */
- public static void getNewsList(int catalog, int page,
- AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- params.put("catalog", catalog);
- params.put("pageIndex", page);
- params.put("pageSize", AppContext.PAGE_SIZE);
- if (catalog == NewsList.CATALOG_WEEK) {
- params.put("show", "week");
- } else if (catalog == NewsList.CATALOG_MONTH) {
- params.put("show", "month");
- }
- ApiHttpClient.get("action/api/news_list", params, handler);
- }
-
- public static void getBlogList(String type, int pageIndex,
- AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- params.put("type", type);
- params.put("pageIndex", pageIndex);
- params.put("pageSize", AppContext.PAGE_SIZE);
- ApiHttpClient.get("action/api/blog_list", params, handler);
- }
-
- public static void getPostList(int catalog, int page,
- AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- params.put("catalog", catalog);
- params.put("pageIndex", page);
- params.put("pageSize", AppContext.PAGE_SIZE);
- ApiHttpClient.get("action/api/post_list", params, handler);
- }
-
- public static void getPostListByTag(String tag, int page,
- AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- params.put("tag", tag);
- params.put("pageIndex", page);
- params.put("pageSize", AppContext.PAGE_SIZE);
- ApiHttpClient.get("action/api/post_list", params, handler);
- }
-
- public static void getTweetList(int uid, int page,
- AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- params.put("uid", uid);
- params.put("pageIndex", page);
- params.put("pageSize", AppContext.PAGE_SIZE);
- ApiHttpClient.get("action/api/tweet_list", params, handler);
- }
-
- public static void getTweetTopicList(int page, String topic,
- AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- params.put("pageIndex", page);
- params.put("title", topic);
- params.put("pageSize", AppContext.PAGE_SIZE);
- ApiHttpClient.get("action/api/tweet_topic_list", params, handler);
- }
-
- public static void getTweetLikeList(AsyncHttpResponseHandler handler) {
- ApiHttpClient.get("action/api/my_tweet_like_list", handler);
- }
-
- public static void pubLikeTweet(int tweetId, int authorId,
- AsyncHttpResponseHandler handler) {
-
- RequestParams params = new RequestParams();
- params.put("tweetid", tweetId);
- params.put("uid", AppContext.getInstance().getLoginUid());
- params.put("ownerOfTweet", authorId);
- ApiHttpClient.post("action/api/tweet_like", params, handler);
- }
-
- public static void pubUnLikeTweet(int tweetId, int authorId,
- AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- params.put("tweetid", tweetId);
- params.put("uid", AppContext.getInstance().getLoginUid());
- params.put("ownerOfTweet", authorId);
- ApiHttpClient.post("action/api/tweet_unlike", params, handler);
- }
-
- public static void getTweetLikeList(int tweetId, int page,
- AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- params.put("tweetid", tweetId);
- params.put("pageIndex", page);
- params.put("pageSize", AppContext.PAGE_SIZE);
- ApiHttpClient.get("action/api/tweet_like_list", params, handler);
-
- }
-
- public static void getActiveList(int uid, int catalog, int page,
- AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- params.put("uid", uid);
- params.put("catalog", catalog);
- params.put("pageIndex", page);
- params.put("pageSize", AppContext.PAGE_SIZE);
- ApiHttpClient.get("action/api/active_list", params, handler);
- }
-
- public static void getFriendList(int uid, int relation, int page,
- AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- params.put("uid", uid);
- params.put("relation", relation);
- params.put("pageIndex", page);
- params.put("pageSize", AppContext.PAGE_SIZE);
- ApiHttpClient.get("action/api/friends_list", params, handler);
- }
-
- /**
- * 获取所有关注好友列表
- *
- * @param uid
- * 指定用户UID
- * @param handler
- * */
- public static void getAllFriendsList(int uid, int relation, AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- params.put("uid", uid);
- params.put("relation", relation);
- params.put("all", 1);
- ApiHttpClient.get("action/api/friends_list", params, handler);
- }
-
- /**
- * 获取用户收藏
- *
- * @param uid
- * 指定用户UID
- * @param type
- * 收藏类型: 0:全部收藏 1:软件 2:话题 3:博客 4:新闻 5:代码
- * @param page
- * @param handler
- */
- public static void getFavoriteList(int uid, int type, int page,
- AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- params.put("uid", uid);
- params.put("type", type);
- params.put("pageIndex", page);
- params.put("pageSize", AppContext.PAGE_SIZE);
- ApiHttpClient.get("action/api/favorite_list", params, handler);
- }
-
- /**
- * 分类列表
- *
- * @param tag
- * 第一级:0
- * @param handler
- */
- public static void getSoftwareCatalogList(int tag,
- AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams("tag", tag);
- ApiHttpClient.get("action/api/softwarecatalog_list", params, handler);
- }
-
- public static void getSoftwareTagList(int searchTag, int page,
- AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- params.put("searchTag", searchTag);
- params.put("pageIndex", page);
- params.put("pageSize", AppContext.PAGE_SIZE);
- ApiHttpClient.get("action/api/softwaretag_list", params, handler);
- }
-
- /**
- * @param searchTag
- * 软件分类 推荐:recommend 最新:time 热门:view 国产:list_cn
- * @param page
- * @param handler
- */
- public static void getSoftwareList(String searchTag, int page,
- AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- params.put("searchTag", searchTag);
- params.put("pageIndex", page);
- params.put("pageSize", AppContext.PAGE_SIZE);
- ApiHttpClient.get("action/api/software_list", params, handler);
- }
-
- /**
- * 获取评论列表
- *
- * @PARAM ID
- * @PARAM CATALOG
- * 1新闻 2帖子 3动弹 4动态
- * @PARAM PAGE
- * @PARAM HANDLER
- */
- public static void getCommentList(int id, int catalog, int page,
- AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- params.put("catalog", catalog);
- params.put("id", id);
- params.put("pageIndex", page);
- params.put("pageSize", AppContext.PAGE_SIZE);
- params.put("clientType", "android");
- ApiHttpClient.get("action/api/comment_list", params, handler);
- }
-
- public static void getBlogCommentList(int id, int page,
- AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- params.put("id", id);
- params.put("pageIndex", page);
- params.put("pageSize", AppContext.PAGE_SIZE);
- ApiHttpClient.get("action/api/blogcomment_list", params, handler);
- }
-
- public static void getChatMessageList(int friendId, int page, AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- params.put("id", friendId);
- params.put("pageIndex", page);
- params.put("pageSize", AppContext.PAGE_SIZE);
- ApiHttpClient.get("action/api/message_detail", params, handler);
- }
-
- public static void getUserInformation(int uid, int hisuid, String hisname,
- int pageIndex, AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- params.put("uid", uid);
- params.put("hisuid", hisuid);
- params.put("hisname", hisname);
- params.put("pageIndex", pageIndex);
- params.put("pageSize", AppContext.PAGE_SIZE);
- ApiHttpClient.get("action/api/user_information", params, handler);
- }
-
- @SuppressWarnings("deprecation")
- public static void getUserBlogList(int authoruid, final String authorname,
- final int uid, final int pageIndex, AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- params.put("authoruid", authoruid);
- params.put("authorname", URLEncoder.encode(authorname));
- params.put("uid", uid);
- params.put("pageIndex", pageIndex);
- params.put("pageSize", AppContext.PAGE_SIZE);
- ApiHttpClient.get("action/api/userblog_list", params, handler);
- }
-
- public static void updateRelation(int uid, int hisuid, int newrelation,
- AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- params.put("uid", uid);
- params.put("hisuid", hisuid);
- params.put("newrelation", newrelation);
- ApiHttpClient.post("action/api/user_updaterelation", params, handler);
- }
-
- public static void getMyInformation(int uid,
- AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- params.put("uid", uid);
- ApiHttpClient.get("action/api/my_information", params, handler);
- }
-
- /**
- * 获取新闻明细
- *
- * @param id 新闻的id
- * @param handler
- */
- public static void getNewsDetail(int id, AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams("id", id);
- ApiHttpClient.get("action/api/news_detail", params, handler);
- }
-
- public static void getBlogDetail(int id, AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams("id", id);
- ApiHttpClient.get("action/api/blog_detail", params, handler);
- }
-
- /**
- * 获取软件详情
- *
- * @param ident
- * @param handler
- */
- public static void getSoftwareDetail(String ident,
- AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams("ident",
- ident);
- ApiHttpClient.get("action/api/software_detail", params, handler);
- }
-
- /***
- * 通过id获取软件详情
- * @param id
- * @param handler
- */
- public static void getSoftwareDetail(int id, AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams("id",
- id);
- ApiHttpClient.get("action/api/software_detail", params, handler);
- }
-
- public static void getPostDetail(int id, AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams("id", id);
- ApiHttpClient.get("action/api/post_detail", params, handler);
- }
-
- public static void getTweetDetail(int id, AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams("id", id);
- ApiHttpClient.get("action/api/tweet_detail", params, handler);
- }
-
- /**
- * 用户针对某个新闻,帖子,动弹,消息发表评论的接口,参数使用POST方式提交
- *
- * @param catalog
- * 1新闻 2 帖子 3 动弹 4消息中心
- * @param id
- * 被评论的某条新闻,帖子,动弹或者某条消息的id
- * @param uid
- * 当天登陆用户的UID
- * @param content
- * 发表的评论内容
- * @param isPostToMyZone
- * 是否转发到我的空间,0不转发 1转发到我的空间(注意该功能之对某条动弹进行评论是有效,其他情况下服务器借口可以忽略该参数)
- * @param handler
- */
- public static void publicComment(int catalog, int id, int uid,
- String content, int isPostToMyZone, AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- params.put("catalog", catalog);
- params.put("id", id);
- params.put("uid", uid);
- params.put("content", content);
- params.put("isPostToMyZone", isPostToMyZone);
- ApiHttpClient.post("action/api/comment_pub", params, handler);
- }
-
- public static void replyComment(int id, int catalog, int replyid,
- int authorid, int uid, String content,
- AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- params.put("catalog", catalog);
- params.put("id", id);
- params.put("uid", uid);
- params.put("content", content);
- params.put("replyid", replyid);
- params.put("authorid", authorid);
- ApiHttpClient.post("action/api/comment_reply", params, handler);
- }
-
- public static void publicBlogComment(int blog, int uid, String content,
- AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- params.put("blog", blog);
- params.put("uid", uid);
- params.put("content", content);
- ApiHttpClient.post("action/api/blogcomment_pub", params, handler);
- }
-
- public static void replyBlogComment(int blog, int uid, String content,
- int reply_id, int objuid, AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- params.put("blog", blog);
- params.put("uid", uid);
- params.put("content", content);
- params.put("reply_id", reply_id);
- params.put("objuid", objuid);
- ApiHttpClient.post("action/api/blogcomment_pub", params, handler);
- }
-
- public static void pubTweet(Tweet tweet, AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- params.put("uid", tweet.getAuthorid());
- params.put("msg", tweet.getBody());
-
- // Map files = new HashMap();
- if (!TextUtils.isEmpty(tweet.getImageFilePath())) {
- try {
- params.put("img", new File(tweet.getImageFilePath()));
- } catch (FileNotFoundException e) {
- e.printStackTrace();
- }
- }
- if (!TextUtils.isEmpty(tweet.getAudioPath())) {
- try {
- params.put("amr", new File(tweet.getAudioPath()));
- } catch (FileNotFoundException e) {
- e.printStackTrace();
- }
- }
- ApiHttpClient.post("action/api/tweet_pub", params, handler);
- }
-
- public static void pubSoftWareTweet(Tweet tweet, int softid,
- AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- params.put("uid", tweet.getAuthorid());
- params.put("msg", tweet.getBody());
- params.put("project", softid);
- ApiHttpClient.post("action/api/software_tweet_pub", params, handler);
- }
-
- public static void deleteTweet(int uid, int tweetid,
- AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- params.put("uid", uid);
- params.put("tweetid", tweetid);
- ApiHttpClient.post("action/api/tweet_delete", params, handler);
- }
-
- public static void deleteComment(int id, int catalog, int replyid,
- int authorid, AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- params.put("id", id);
- params.put("catalog", catalog);
- params.put("replyid", replyid);
- params.put("authorid", authorid);
- ApiHttpClient.post("action/api/comment_delete", params, handler);
- }
-
- public static void deleteBlog(int uid, int authoruid, int id,
- AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- params.put("uid", uid);
- params.put("authoruid", authoruid);
- params.put("id", id);
- ApiHttpClient.post("action/api/userblog_delete", params, handler);
- }
-
- public static void deleteBlogComment(int uid, int blogid, int replyid,
- int authorid, int owneruid, AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- params.put("uid", uid);
- params.put("blogid", blogid);
- params.put("replyid", replyid);
- params.put("authorid", authorid);
- params.put("owneruid", owneruid);
- ApiHttpClient.post("action/api/blogcomment_delete", params, handler);
- }
-
- /**
- * 用户添加收藏
- *
- * @param uid
- * 用户UID
- * @param objid
- * 比如是新闻ID 或者问答ID 或者动弹ID
- * @param type
- * 1:软件 2:话题 3:博客 4:新闻 5:代码
- */
- public static void addFavorite(int uid, int objid, int type,
- AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- params.put("uid", uid);
- params.put("objid", objid);
- params.put("type", type);
- ApiHttpClient.post("action/api/favorite_add", params, handler);
- }
-
- public static void delFavorite(int uid, int objid, int type,
- AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- params.put("uid", uid);
- params.put("objid", objid);
- params.put("type", type);
- ApiHttpClient.post("action/api/favorite_delete", params, handler);
- }
-
- public static void getSearchList(String catalog, String content,
- int pageIndex, AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- params.put("catalog", catalog);
- params.put("content", content);
- params.put("pageIndex", pageIndex);
- params.put("pageSize", AppContext.PAGE_SIZE);
- ApiHttpClient.get("action/api/search_list", params, handler);
- }
-
- public static void publicMessage(int uid, int receiver, String content,
- AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- params.put("uid", uid);
- params.put("receiver", receiver);
- params.put("content", content);
-
- ApiHttpClient.post("action/api/message_pub", params, handler);
- }
-
- public static void deleteMessage(int uid, int friendid,
- AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- params.put("uid", uid);
- params.put("friendid", friendid);
- ApiHttpClient.post("action/api/message_delete", params, handler);
- }
-
- public static void forwardMessage(int uid, String receiverName,
- String content, AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- params.put("uid", uid);
- params.put("receiverName", receiverName);
- params.put("content", content);
- ApiHttpClient.post("action/api/message_pub", params, handler);
- }
-
- public static void getMessageList(int uid, int pageIndex,
- AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- params.put("uid", uid);
- params.put("pageIndex", pageIndex);
- params.put("pageSize", AppContext.PAGE_SIZE);
- ApiHttpClient.get("action/api/message_list", params, handler);
- }
-
- public static void updatePortrait(int uid, File portrait,
- AsyncHttpResponseHandler handler) throws FileNotFoundException {
- RequestParams params = new RequestParams();
- params.put("uid", uid);
- params.put("portrait", portrait);
- ApiHttpClient.post("action/api/portrait_update", params, handler);
- }
-
- public static void getNotices(AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- params.put("uid", AppContext.getInstance().getLoginUid());
- ApiHttpClient.get("action/api/user_notice", params, handler);
- }
-
- /**
- * 清空通知消息
- *
- * @param uid
- * @param type
- * 1:@我的信息 2:未读消息 3:评论个数 4:新粉丝个数
- * @return
- * @throws AppException
- */
- public static void clearNotice(int uid, int type,
- AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- params.put("uid", uid);
- params.put("type", type);
- ApiHttpClient.post("action/api/notice_clear", params, handler);
- }
-
- public static void singnIn(String url, AsyncHttpResponseHandler handler) {
- ApiHttpClient.getDirect(url, handler);
- }
-
- /**
- * 获取软件的动态列表
- *
- * @param softid
- * @param handler
- */
- public static void getSoftTweetList(int softid, int page,
- AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- params.put("project", softid);
- params.put("pageIndex", page);
- params.put("pageSize", AppContext.PAGE_SIZE);
- ApiHttpClient.get("action/api/software_tweet_list", params, handler);
- }
-
- public static void checkUpdate(AsyncHttpResponseHandler handler) {
- ApiHttpClient.get("MobileAppVersion.xml", handler);
- }
-
- /**
- * 查找用户
- *
- * @param username
- * @param handler
- */
- public static void findUser(String username,
- AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- params.put("name", username);
- ApiHttpClient.get("action/api/find_user", params, handler);
- }
-
- /**
- * 获取活动列表
- *
- * @param pageIndex
- * @param uid
- * <= 0 近期活动 实际的用户ID 则获取用户参与的活动列表,需要已登陆的用户
- * @param handler
- */
- public static void getEventList(int pageIndex, int uid,
- AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- params.put("pageIndex", pageIndex);
- params.put("uid", uid);
- params.put("pageSize", AppContext.PAGE_SIZE);
- ApiHttpClient.get("action/api/event_list", params, handler);
- }
-
- /**
- * 获取某活动已出席的人员列表
- *
- * @param eventId
- * @param pageIndex
- * @param handler
- */
- public static void getEventApplies(int eventId, int pageIndex,
- AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- params.put("pageIndex", pageIndex);
- params.put("event_id", eventId);
- params.put("pageSize", AppContext.PAGE_SIZE);
- ApiHttpClient.get("action/api/event_attend_user", params, handler);
- }
-
- /**
- * 举报
- *
- * @param report
- * @param handler
- */
- public static void report(Report report, AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- params.put("obj_id", report.getObjId());
- params.put("url", report.getUrl());
- params.put("obj_type", report.getObjType());
- params.put("reason", report.getReason());
- if (report.getOtherReason() != null
- && !StringUtils.isEmpty(report.getOtherReason())) {
- params.put("memo", report.getOtherReason());
- }
- ApiHttpClient.post("action/communityManage/report", params, handler);
- }
-
- /**
- * 摇一摇,随机数据
- *
- * @param handler
- */
- public static void shake(AsyncHttpResponseHandler handler) {
- shake(-1, handler);
- }
-
- /**
- * 摇一摇指定请求类型
- */
- public static void shake(int type, AsyncHttpResponseHandler handler) {
- String inter = "action/api/rock_rock";
- if (type > 0) {
- inter = (inter + "/?type=" + type);
- }
- ApiHttpClient.get(inter, handler);
- }
-
- /**
- * 活动报名
- *
- * @param data
- * @param handler
- */
- public static void eventApply(EventApplyData data,
- AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- params.put("event", data.getEvent());
- params.put("user", data.getUser());
- params.put("name", data.getName());
- params.put("gender", data.getGender());
- params.put("mobile", data.getPhone());
- params.put("company", data.getCompany());
- params.put("job", data.getJob());
- if (!StringUtils.isEmpty(data.getRemark())) {
- params.put("misc_info", data.getRemark());
- }
- ApiHttpClient.post("action/api/event_apply", params, handler);
- }
-
- private static void uploadLog(String data, String report,
- AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- params.put("app", "1");
- params.put("report", report);
- params.put("msg", data);
- ApiHttpClient.post("action/api/user_report_to_admin", params, handler);
- }
-
- /**
- * BUG上报
- *
- * @param data
- * @param handler
- */
- public static void uploadLog(String data, AsyncHttpResponseHandler handler) {
- uploadLog(data, "1", handler);
- }
-
- /**
- * 反馈意见
- *
- * @param data
- * @param handler
- */
- public static void feedback(String data, AsyncHttpResponseHandler handler) {
- uploadLog(data, "2", handler);
- }
-
- /**
- * team动态
- *
- * @param team
- * @param page
- * @param handler
- */
- public static void teamDynamic(Team team, int page,
- AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- // int uid = AppContext.getInstance().getLoginUid();
- // params.put("uid", uid);
- params.put("teamid", team.getId());
- params.put("pageIndex", page);
- params.put("pageSize", 20);
- params.put("type", "all");
- ApiHttpClient.get("action/api/team_active_list", params, handler);
- }
-
- /**
- * 获取team列表
- *
- * @param handler
- */
- public static void teamList(AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- params.put("uid", AppContext.getInstance().getLoginUid());
- ApiHttpClient.get("action/api/team_list", params, handler);
- }
-
- /**
- * 获取team成员列表
- *
- * @param handler
- */
- public static void getTeamMemberList(int teamid,
- AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- params.put("teamid", teamid);
- ApiHttpClient.get("action/api/team_member_list", params, handler);
- }
-
- /**
- * 获取team成员个人信息
- *
- * @param handler
- */
- public static void getTeamUserInfo(String teamid, String uid,
- int pageIndex, AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- params.put("teamid", teamid);
- params.put("uid", uid);
- params.put("pageIndex", pageIndex);
- params.put("pageSize", 20);
- ApiHttpClient.get("action/api/team_user_information", params, handler);
- }
-
- /**
- * 获取我的任务中进行中、未完成、已完成等状态的数量
- */
- public static void getMyIssueState(String teamid, String uid,
- AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- params.put("teamid", teamid);
- params.put("uid", uid);
- ApiHttpClient.get("action/api/team_user_issue_information", params,
- handler);
- }
-
- /**
- * 获取指定用户的动态
- */
- public static void getUserDynamic(int teamid, String uid, int pageIndex,
- AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- params.put("teamid", teamid);
- params.put("pageIndex", pageIndex);
- params.put("pageSize", 20);
- params.put("type", "git");
- params.put("uid", uid);
- ApiHttpClient.get("action/api/team_active_list", params, handler);
- }
-
- /**
- * 动态详情
- *
- * @param activeid
- * @param teamid
- * @param uid
- * @param handler
- */
- public static void getDynamicDetail(int activeid, int teamid, int uid,
- AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- params.put("teamid", teamid);
- params.put("uid", uid);
- params.put("activeid", activeid);
- ApiHttpClient.get("action/api/team_active_detail", params, handler);
- }
-
- /**
- * 获取指定用户的任务
- */
- public static void getMyIssue(String teamid, String uid, int pageIndex,
- String type, AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- params.put("teamid", teamid);
- params.put("uid", uid);
- params.put("pageIndex", pageIndex);
- params.put("pageSize", 20);
- params.put("state", type);
- params.put("projectid", "-1");
- ApiHttpClient.get("action/api/team_issue_list", params, handler);
- }
-
- /**
- * 获取指定周周报
- *
- * @param teamid
- * @param year
- * @param week
- * @param handler
- */
- public static void getDiaryFromWhichWeek(int teamid, int year, int week,
- AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- params.put("teamid", teamid);
- params.put("year", year);
- params.put("week", week);
- ApiHttpClient.get("action/api/team_diary_list", params, handler);
- }
-
- /**
- * 删除一个便签
- *
- * @param id
- * 便签id
- * @param uid
- * 用户id
- */
- public static void deleteNoteBook(int id, int uid,
- AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- params.put("uid", uid);
- params.put("id", id); // 便签id
- ApiHttpClient
- .get("action/api/team_stickynote_recycle", params, handler);
- }
-
- public static void getNoteBook(int uid, AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- params.put("uid", uid);
- ApiHttpClient.get("action/api/team_sticky_list", params, handler);
- }
-
- /**
- * 获取指定周报的详细信息
- *
- * @param teamid
- * @param diaryid
- * @param handler
- */
- public static void getDiaryDetail(int teamid, int diaryid,
- AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- params.put("teamid", teamid);
- params.put("diaryid", diaryid);
- ApiHttpClient.get("action/api/team_diary_detail", params, handler);
- }
-
- /**
- * diary评论列表
- *
- * @param teamid
- * @param diaryid
- * @param handler
- */
- public static void getDiaryComment(int teamid, int diaryid,
- AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- params.put("teamid", teamid);
- params.put("id", diaryid);
- params.put("type", "diary");
- params.put("pageIndex", 0);
- params.put("pageSize", "20");
- KJLoger.debug(teamid + "==getDiaryComment接口=" + diaryid);
- ApiHttpClient
- .get("action/api/team_reply_list_by_type", params, handler);
- }
-
- /**
- * 周报评论(以后可改为全局评论)
- *
- * @param uid
- * @param teamid
- * @param diaryId
- * @param content
- * @param handler
- */
- public static void sendComment(int uid, int teamid, int diaryId,
- String content, AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- params.put("uid", uid);
- params.put("teamid", teamid);
- params.put("type", "118");
- params.put("tweetid", diaryId);
- params.put("content", content);
- ApiHttpClient.post("action/api/team_tweet_reply", params, handler);
- }
-
- /***
- * 客户端扫描二维码登陆
- *
- * @author 火蚁 2015-3-13 上午11:45:47
- *
- * @return void
- * @param url
- * @param handler
- */
- public static void scanQrCodeLogin(String url,
- AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- String uuid = url.substring(url.lastIndexOf("=") + 1);
- params.put("uuid", uuid);
- ApiHttpClient.getDirect(url, handler);
- }
-
- /***
- * 使用第三方登陆
- * @param catalog 类别
- * @param openIdInfo 第三方的info
- * @param handler handler
- */
- public static void open_login(String catalog, String openIdInfo, AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- params.put("catalog", catalog);
- params.put("openid_info", openIdInfo);
- ApiHttpClient.post("action/api/openid_login", params, handler);
- }
-
- /***
- * 第三方登陆账号绑定
- * @param catalog 类别(QQ、wechat)
- * @param openIdInfo 第三方info
- * @param userName 用户名
- * @param pwd 密码
- * @param handler handler
- */
- public static void bind_openid(String catalog, String openIdInfo, String userName, String pwd, AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- params.put("catalog", catalog);
- params.put("openid_info", openIdInfo);
- params.put("username", userName);
- params.put("pwd", pwd);
- ApiHttpClient.post("action/api/openid_bind", params, handler);
- }
-
- /***
- * 使用第三方账号注册
- * @param catalog 类别(qq、wechat)
- * @param openIdInfo 第三方info
- * @param handler handler
- */
- public static void openid_reg(String catalog, String openIdInfo, AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- params.put("catalog", catalog);
- params.put("openid_info", openIdInfo);
- ApiHttpClient.post("action/api/openid_reg", params, handler);
- }
-}
diff --git a/app/src/main/java/net/oschina/app/api/remote/OSChinaTeamApi.java b/app/src/main/java/net/oschina/app/api/remote/OSChinaTeamApi.java
deleted file mode 100644
index 584b19d7746fa260450acdbe96a3300a5b25ac61..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/api/remote/OSChinaTeamApi.java
+++ /dev/null
@@ -1,426 +0,0 @@
-package net.oschina.app.api.remote;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-
-import net.oschina.app.AppContext;
-import net.oschina.app.api.ApiHttpClient;
-import net.oschina.app.team.bean.TeamIssue;
-import net.oschina.app.team.bean.TeamProject;
-import android.text.TextUtils;
-
-import com.loopj.android.http.AsyncHttpResponseHandler;
-import com.loopj.android.http.RequestParams;
-
-/**
- * osc team api集合类
- *
- * @author FireAnt(http://my.oschina.net/LittleDY)
- * @version 创建时间:2015年1月14日 下午3:32:18
- *
- */
-public class OSChinaTeamApi {
-
- /**
- * 获取团队项目列表
- *
- * @param teamId
- * @param handler
- */
- public static void getTeamProjectList(int teamId,
- AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- params.put("teamid", teamId);
- ApiHttpClient.get("action/api/team_project_list", params, handler);
- }
-
- /**
- * 获取team动态列表
- *
- * @param teamId
- * @param activeId
- * @param pageIndex
- * @param handler
- */
- public static void getTeamCommentList(int teamId, int activeId,
- int pageIndex, AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- params.put("teamid", teamId);
- params.put("id", activeId);
- params.put("pageIndex", pageIndex);
- params.put("pageSize", 20);
- ApiHttpClient.get("action/api/team_reply_list_by_activeid", params,
- handler);
- }
-
- /***
- * 获取团队绑定项目的成员列表(包括管理员以及开发者)
- *
- * @author 火蚁 2015-2-5 下午6:45:41
- *
- * @return void
- * @param teamId
- * @param teamProject
- * @param handler
- */
- public static void getTeamProjectMemberList(int teamId,
- TeamProject teamProject, AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- params.put("teamid", teamId);
- params.put("uid", AppContext.getInstance().getLoginUid());
- params.put("projectid", teamProject.getGit().getId());
- String source = teamProject.getSource();
- if (source != null && !TextUtils.isEmpty(source)) {
-
- params.put("source", teamProject.getSource());
- }
- ApiHttpClient.get("action/api/team_project_member_list", params,
- handler);
- }
-
- /***
- * 获取项目的动态列表
- *
- * @author 火蚁 2015-3-2 下午5:18:54
- *
- * @return void
- * @param teamId
- * @param project
- * @param type
- * "all"(default),"issue","code","other"
- * @param page
- * @param handler
- */
- public static void getTeamProjectActiveList(int teamId,
- TeamProject project, String type, int page,
- AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- params.put("teamid", teamId);
- params.put("projectid", project.getGit().getId());
- if (!TextUtils.isEmpty(project.getSource())) {
- params.put("source", project.getSource());
- }
- params.put("type", type);
- params.put("pageIndex", page);
- ApiHttpClient.get("action/api/team_project_active_list", params,
- handler);
- }
-
- /**
- * 获取某项目的任务列表
- *
- * @param uId
- * 用户id
- * @param teamId
- * 团队id
- * @param projectId
- * 项目id(当<=0或不设置时,查询非项目的任务列表)
- * @param source
- * "Git@OSC","GitHub"(只有设置了projectid值,这里才需要设置该值)
- */
- public static void getTeamCatalogIssueList(int uId, int teamId,
- int projectId, String source, AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- params.put("uid", uId);
- params.put("teamid", teamId);
- params.put("projectid", projectId);
- params.put("source", source);
- ApiHttpClient.get("action/api/team_project_catalog_list", params,
- handler);
- }
-
- /**
- * 获取指定任务列表的任务列表
- *
- * @param teamId
- * @param projectId
- * 项目id(-1获取非项目任务列表, 0获取所有任务列表)
- * @param catalogId
- * 任务列表的的目录id
- * @param source
- * "Team@OSC"(default),"Git@OSC","GitHub",如果指定了projectid的值,
- * 这个值就是必须的
- * @param uid
- * 如果指定该值,则获取该id用户相关的任务
- * @param state
- * "all"(default),"opened","closed","outdate"
- * @param scope
- * "tome"(default,指派给我的任务),"meto"(我指派的任务)
- * @param pageIndex
- * @param pageSize
- * @param handler
- */
- public static void getTeamIssueList(int teamId, int projectId,
- int catalogId, String source, int uid, String state, String scope,
- int pageIndex, int pageSize, AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- params.put("teamid", teamId);
- params.put("projectid", projectId);
- params.put("catalogid", catalogId);
- params.put("source", source);
- params.put("uid", uid);
- params.put("state", state);
- params.put("scope", scope);
- params.put("pageIndex", pageIndex);
- params.put("pageSize", pageSize);
- ApiHttpClient.get("action/api/team_issue_list", params, handler);
- }
-
- /***
- * 改变一个任务的状态
- *
- * @author 火蚁 2015-3-6 上午11:44:01
- *
- * @return void
- * @param teamId
- * @param issue
- * @param target
- * 修改的属性("state" : 状态, "assignee" 指派人, "deadline" : 截止日期)
- * @param handler
- */
- public static void changeIssueState(int teamId, TeamIssue issue,
- String target, AsyncHttpResponseHandler handler) {
- if (issue == null)
- return;
- RequestParams params = new RequestParams();
- params.put("uid", AppContext.getInstance().getLoginUid());
- params.put("teamid", teamId);
- params.put("target", target);
- params.put("issueid", issue.getId());
- if (target.equals("state")) {
- params.put("state", issue.getState());
- } else if (target.equals("assignee")) {
- params.put("assignee", issue.getToUser().getId());
- } else if (target.equals("deadline")) {
- params.put("deadline", issue.getDeadlineTime());
- }
- ApiHttpClient.post("action/api/team_issue_update", params, handler);
- }
-
- public static void pubTeamNewIssue(RequestParams params,
- AsyncHttpResponseHandler handler) {
- ApiHttpClient.post("action/api/team_issue_pub", params, handler);
- }
-
- /***
- * 获取团队的讨论区列表
- *
- * @param type
- * @param teamId
- * @param uid
- * @param pageIndex
- * @param handler
- */
- public static void getTeamDiscussList(String type, int teamId, int uid,
- int pageIndex, AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- params.put("type", type);
- params.put("teamid", teamId);
- params.put("uid", uid);
- params.put("pageIndex", pageIndex);
- params.put("pageSize", AppContext.PAGE_SIZE);
- ApiHttpClient.get("action/api/team_discuss_list", params, handler);
- }
-
- /***
- * 获取讨论贴详情
- *
- * @author 火蚁 2015-2-2 下午6:19:54
- *
- * @return void
- * @param teamId
- * @param discussId
- * @param handler
- */
- public static void getTeamDiscussDetail(int teamId, int discussId,
- AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- params.put("teamid", teamId);
- params.put("discussid", discussId);
- ApiHttpClient.get("action/api/team_discuss_detail", params, handler);
- }
-
- /***
- * 发表讨论贴评论
- *
- * @author 火蚁 2015-2-3 下午2:42:54
- *
- * @return void
- * @param uid
- * @param teamId
- * @param dicussId
- * @param content
- * @param handler
- */
- public static void pubTeamDiscussReply(int uid, int teamId, int discussId,
- String content, AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- params.put("uid", uid);
- params.put("teamid", teamId);
- params.put("discussid", discussId);
- params.put("content", content);
- ApiHttpClient.post("action/api/team_discuss_reply", params, handler);
- }
-
- /***
- * 发表一条综合评论 动态、分享内容、周报
- *
- * @author 火蚁 2015-3-6 下午3:31:07
- *
- * @return void
- * @param teamId
- * @param type
- * 普通动态-110,分享内容-114, 周报-118
- * @param tweetId
- * @param content
- * @param handler
- */
- public static void pubTeamTweetReply(int teamId, int type, long tweetId,
- String content, AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- params.put("uid", AppContext.getInstance().getLoginUid());
- params.put("type", type);
- params.put("teamid", teamId);
- params.put("tweetid", tweetId);
- params.put("content", content);
- ApiHttpClient.post("action/api/team_tweet_reply", params, handler);
- }
-
- /***
- * 获取团队任务详情
- *
- * @author 火蚁 2015-1-27 下午7:47:17
- *
- */
- public static void getTeamIssueDetail(int teamId, int issueId,
- AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- params.put("teamid", teamId);
- params.put("issueid", issueId);
- ApiHttpClient.get("action/api/team_issue_detail", params, handler);
- }
-
- /***
- * 获取团队的周报列表
- *
- * @param uid
- * @param teamId
- * @param year
- * @param week
- * @param pageIndex
- * @param handler
- */
- public static void getTeamDiaryList(int uid, int teamId, int year,
- int week, int pageIndex, AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- params.put("uid", uid);
- params.put("teamid", teamId);
- params.put("year", year);
- params.put("week", week);
- params.put("pageIndex", pageIndex);
- params.put("pageSize", AppContext.PAGE_SIZE);
- ApiHttpClient.get("action/api/team_diary_list", params, handler);
- }
-
- /***
- * 任务、周报、讨论的回复列表
- *
- * @author 火蚁 2015-2-2 上午11:39:04
- *
- * @return void
- * @param teamId
- * @param id
- * @param type
- * 评论列表的类型(周报diary,讨论discuss,任务issue)
- * @param pageIndex
- * @param handler
- */
- public static void getTeamReplyList(int teamId, int id, String type,
- int pageIndex, AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- params.put("teamid", teamId);
- params.put("id", id);
- params.put("type", type);
- params.put("pageIndex", pageIndex);
- ApiHttpClient
- .get("action/api/team_reply_list_by_type", params, handler);
-
- }
-
- /***
- * 发表一个新的团队动态
- *
- * @author 火蚁 2015-3-9 下午2:46:13
- *
- * @return void
- * @param teamId
- * @param content
- * @param img
- * @param handler
- */
- public static void pubTeamNewActive(int teamId, String content, File img,
- AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- params.put("teamid", teamId);
- params.put("uid", AppContext.getInstance().getLoginUid());
- params.put("msg", content);
- params.put("appid", 3);
- if (img != null) {
-
- try {
- params.put("img", img);
- } catch (FileNotFoundException e) {
- e.printStackTrace();
- }
- }
- ApiHttpClient.post("action/api/team_tweet_pub", params, handler);
- }
-
- /***
- * 更新子任务属性
- *
- * @author 火蚁 2015-3-10 下午4:53:49
- *
- * @return void
- * @param teamId
- * @param target
- * @param childIssue
- * @param handler
- */
- public static void updateChildIssue(int teamId, String target,
- TeamIssue childIssue, AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- params.put("uid", AppContext.getInstance().getLoginUid());
- params.put("teamid", teamId);
- params.put("childissueid", childIssue.getId());
- params.put("target", target);
- if (target.equals("state")) {
- params.put("state", childIssue.getState());
- } else {
- params.put("title", childIssue.getTitle());
- }
- ApiHttpClient.post("action/api/team_issue_update_child_issue", params,
- handler);
- }
-
- /***
- * 发表任务评论
- *
- * @author 火蚁 2015-3-13 下午6:22:41
- *
- * @return void
- * @param teamId
- * @param issueId
- * @param content
- * @param handler
- */
- public static void pubTeamIssueReply(int teamId, int issueId,
- String content, AsyncHttpResponseHandler handler) {
- RequestParams params = new RequestParams();
- params.put("uid", AppContext.getInstance().getLoginUid());
- params.put("teamid", teamId);
- params.put("content", content);
- params.put("issueid", issueId);
- ApiHttpClient.post("action/api/team_issue_reply", params, handler);
- }
-}
diff --git a/app/src/main/java/net/oschina/app/base/BaseActivity.java b/app/src/main/java/net/oschina/app/base/BaseActivity.java
deleted file mode 100644
index 99c32cd5802a89115de2d82d4d62bc1b035725e5..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/base/BaseActivity.java
+++ /dev/null
@@ -1,217 +0,0 @@
-package net.oschina.app.base;
-
-import android.app.ProgressDialog;
-import android.os.Bundle;
-import android.support.v7.app.ActionBar;
-import android.support.v7.app.ActionBarActivity;
-import android.view.LayoutInflater;
-import android.view.Menu;
-import android.view.MenuItem;
-import android.view.View;
-import android.widget.TextView;
-
-import net.oschina.app.AppContext;
-import net.oschina.app.AppManager;
-import net.oschina.app.R;
-import net.oschina.app.interf.BaseViewInterface;
-import net.oschina.app.ui.dialog.CommonToast;
-import net.oschina.app.ui.dialog.DialogControl;
-import net.oschina.app.util.DialogHelp;
-import net.oschina.app.util.TDevice;
-
-import org.kymjs.kjframe.utils.StringUtils;
-
-import butterknife.ButterKnife;
-
-/**
- * baseActionBar Activity
- *
- * @author FireAnt(http://my.oschina.net/LittleDY)
- * @created 2014年9月25日 上午11:30:15 引用自:tonlin
- */
-public abstract class BaseActivity extends ActionBarActivity implements
- DialogControl, View.OnClickListener, BaseViewInterface {
- public static final String INTENT_ACTION_EXIT_APP = "INTENT_ACTION_EXIT_APP";
-
- private boolean _isVisible;
- private ProgressDialog _waitDialog;
-
- protected LayoutInflater mInflater;
- protected ActionBar mActionBar;
- private TextView mTvActionTitle;
-
- @Override
- protected void onDestroy() {
- super.onDestroy();
- TDevice.hideSoftKeyboard(getCurrentFocus());
- ButterKnife.reset(this);
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- if (AppContext.getNightModeSwitch()) {
- setTheme(R.style.AppBaseTheme_Night);
- } else {
- setTheme(R.style.AppBaseTheme_Light);
- }
- AppManager.getAppManager().addActivity(this);
- if (!hasActionBar()) {
- // supportRequestWindowFeature(Window.FEATURE_NO_TITLE);
- }
- onBeforeSetContentLayout();
- if (getLayoutId() != 0) {
- setContentView(getLayoutId());
- }
- mActionBar = getSupportActionBar();
- mInflater = getLayoutInflater();
- if (hasActionBar()) {
- initActionBar(mActionBar);
- }
-
- // 通过注解绑定控件
- ButterKnife.inject(this);
-
- init(savedInstanceState);
- initView();
- initData();
- _isVisible = true;
- }
-
- protected void onBeforeSetContentLayout() {}
-
- protected boolean hasActionBar() {
- return true;
- }
-
- protected int getLayoutId() {
- return 0;
- }
-
- protected View inflateView(int resId) {
- return mInflater.inflate(resId, null);
- }
-
- protected int getActionBarTitle() {
- return R.string.app_name;
- }
-
- protected boolean hasBackButton() {
- return false;
- }
-
- protected void init(Bundle savedInstanceState) {}
-
- protected void initActionBar(ActionBar actionBar) {
- if (actionBar == null)
- return;
- if (hasBackButton()) {
- mActionBar.setDisplayHomeAsUpEnabled(true);
- mActionBar.setHomeButtonEnabled(true);
- } else {
- actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE);
- actionBar.setDisplayUseLogoEnabled(false);
- int titleRes = getActionBarTitle();
- if (titleRes != 0) {
- actionBar.setTitle(titleRes);
- }
- }
- }
-
- public void setActionBarTitle(int resId) {
- if (resId != 0) {
- setActionBarTitle(getString(resId));
- }
- }
-
- public void setActionBarTitle(String title) {
- if (StringUtils.isEmpty(title)) {
- title = getString(R.string.app_name);
- }
- if (hasActionBar() && mActionBar != null) {
- if (mTvActionTitle != null) {
- mTvActionTitle.setText(title);
- }
- mActionBar.setTitle(title);
- }
- }
-
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
- switch (item.getItemId()) {
- case android.R.id.home:
- onBackPressed();
- break;
-
- default:
- break;
- }
- return super.onOptionsItemSelected(item);
- }
-
- @Override
- protected void onPause() {
- super.onPause();
- }
-
- @Override
- protected void onResume() {
- super.onResume();
- }
-
- public void showToast(int msgResid, int icon, int gravity) {
- showToast(getString(msgResid), icon, gravity);
- }
-
- public void showToast(String message, int icon, int gravity) {
- CommonToast toast = new CommonToast(this);
- toast.setMessage(message);
- toast.setMessageIc(icon);
- toast.setLayoutGravity(gravity);
- toast.show();
- }
-
- @Override
- public ProgressDialog showWaitDialog() {
- return showWaitDialog(R.string.loading);
- }
-
- @Override
- public ProgressDialog showWaitDialog(int resid) {
- return showWaitDialog(getString(resid));
- }
-
- @Override
- public ProgressDialog showWaitDialog(String message) {
- if (_isVisible) {
- if (_waitDialog == null) {
- _waitDialog = DialogHelp.getWaitDialog(this, message);
- }
- if (_waitDialog != null) {
- _waitDialog.setMessage(message);
- _waitDialog.show();
- }
- return _waitDialog;
- }
- return null;
- }
-
- @Override
- public void hideWaitDialog() {
- if (_isVisible && _waitDialog != null) {
- try {
- _waitDialog.dismiss();
- _waitDialog = null;
- } catch (Exception ex) {
- ex.printStackTrace();
- }
- }
- }
-
- @Override
- public boolean onMenuOpened(int featureId, Menu menu) {
-
- // setOverflowIconVisible(featureId, menu);
- return super.onMenuOpened(featureId, menu);
- }
-}
diff --git a/app/src/main/java/net/oschina/app/base/BaseApplication.java b/app/src/main/java/net/oschina/app/base/BaseApplication.java
deleted file mode 100644
index 975c33f795db1ec96c248a3af38455603d3059ef..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/base/BaseApplication.java
+++ /dev/null
@@ -1,264 +0,0 @@
-package net.oschina.app.base;
-
-import android.annotation.SuppressLint;
-import android.annotation.TargetApi;
-import android.app.Activity;
-import android.app.Application;
-import android.content.Context;
-import android.content.SharedPreferences;
-import android.content.SharedPreferences.Editor;
-import android.content.res.Resources;
-import android.os.Build;
-import android.util.DisplayMetrics;
-import android.view.Gravity;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.widget.ImageView;
-import android.widget.TextView;
-import android.widget.Toast;
-
-import net.oschina.app.R;
-import net.oschina.app.util.StringUtils;
-
-@SuppressLint("InflateParams")
-public class BaseApplication extends Application {
- private static String PREF_NAME = "creativelocker.pref";
- private static String LAST_REFRESH_TIME = "last_refresh_time.pref";
- static Context _context;
- static Resources _resource;
- private static String lastToast = "";
- private static long lastToastTime;
-
- private static boolean sIsAtLeastGB;
-
- static {
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
- sIsAtLeastGB = true;
- }
- }
-
- @Override
- public void onCreate() {
- super.onCreate();
- _context = getApplicationContext();
- _resource = _context.getResources();
- }
-
- public static synchronized BaseApplication context() {
- return (BaseApplication) _context;
- }
-
- public static Resources resources() {
- return _resource;
- }
-
- /**
- * 放入已读文章列表中
- *
- */
- public static void putReadedPostList(String prefFileName, String key,
- String value) {
- SharedPreferences preferences = getPreferences(prefFileName);
- int size = preferences.getAll().size();
- Editor editor = preferences.edit();
- if (size >= 100) {
- editor.clear();
- }
- editor.putString(key, value);
- apply(editor);
- }
-
- /**
- * 读取是否是已读的文章列表
- *
- * @return
- */
- public static boolean isOnReadedPostList(String prefFileName, String key) {
- return getPreferences(prefFileName).contains(key);
- }
-
- /**
- * 记录列表上次刷新时间
- *
- * @param key
- * @param value
- * @return void
- * @author 火蚁
- * 2015-2-9 下午2:21:37
- */
- public static void putToLastRefreshTime(String key, String value) {
- SharedPreferences preferences = getPreferences(LAST_REFRESH_TIME);
- Editor editor = preferences.edit();
- editor.putString(key, value);
- apply(editor);
- }
-
- /**
- * 获取列表的上次刷新时间
- *
- * @param key
- * @return
- * @author 火蚁
- * 2015-2-9 下午2:22:04
- */
- public static String getLastRefreshTime(String key) {
- return getPreferences(LAST_REFRESH_TIME).getString(key, StringUtils.getCurTimeStr());
- }
-
- @TargetApi(Build.VERSION_CODES.GINGERBREAD)
- public static void apply(SharedPreferences.Editor editor) {
- if (sIsAtLeastGB) {
- editor.apply();
- } else {
- editor.commit();
- }
- }
-
- public static void set(String key, int value) {
- Editor editor = getPreferences().edit();
- editor.putInt(key, value);
- apply(editor);
- }
-
- public static void set(String key, boolean value) {
- Editor editor = getPreferences().edit();
- editor.putBoolean(key, value);
- apply(editor);
- }
-
- public static void set(String key, String value) {
- Editor editor = getPreferences().edit();
- editor.putString(key, value);
- apply(editor);
- }
-
- public static boolean get(String key, boolean defValue) {
- return getPreferences().getBoolean(key, defValue);
- }
-
- public static String get(String key, String defValue) {
- return getPreferences().getString(key, defValue);
- }
-
- public static int get(String key, int defValue) {
- return getPreferences().getInt(key, defValue);
- }
-
- public static long get(String key, long defValue) {
- return getPreferences().getLong(key, defValue);
- }
-
- public static float get(String key, float defValue) {
- return getPreferences().getFloat(key, defValue);
- }
-
- @TargetApi(Build.VERSION_CODES.HONEYCOMB)
- public static SharedPreferences getPreferences() {
- SharedPreferences pre = context().getSharedPreferences(PREF_NAME,
- Context.MODE_MULTI_PROCESS);
- return pre;
- }
-
- @TargetApi(Build.VERSION_CODES.HONEYCOMB)
- public static SharedPreferences getPreferences(String prefName) {
- return context().getSharedPreferences(prefName,
- Context.MODE_MULTI_PROCESS);
- }
-
- public static int[] getDisplaySize() {
- return new int[]{getPreferences().getInt("screen_width", 480),
- getPreferences().getInt("screen_height", 854)};
- }
-
- public static void saveDisplaySize(Activity activity) {
- DisplayMetrics displaymetrics = new DisplayMetrics();
- activity.getWindowManager().getDefaultDisplay()
- .getMetrics(displaymetrics);
- SharedPreferences.Editor editor = getPreferences().edit();
- editor.putInt("screen_width", displaymetrics.widthPixels);
- editor.putInt("screen_height", displaymetrics.heightPixels);
- editor.putFloat("density", displaymetrics.density);
- editor.commit();
- }
-
- public static String string(int id) {
- return _resource.getString(id);
- }
-
- public static String string(int id, Object... args) {
- return _resource.getString(id, args);
- }
-
- public static void showToast(int message) {
- showToast(message, Toast.LENGTH_LONG, 0);
- }
-
- public static void showToast(String message) {
- showToast(message, Toast.LENGTH_LONG, 0, Gravity.BOTTOM);
- }
-
- public static void showToast(int message, int icon) {
- showToast(message, Toast.LENGTH_LONG, icon);
- }
-
- public static void showToast(String message, int icon) {
- showToast(message, Toast.LENGTH_LONG, icon, Gravity.BOTTOM);
- }
-
- public static void showToastShort(int message) {
- showToast(message, Toast.LENGTH_SHORT, 0);
- }
-
- public static void showToastShort(String message) {
- showToast(message, Toast.LENGTH_SHORT, 0, Gravity.BOTTOM);
- }
-
- public static void showToastShort(int message, Object... args) {
- showToast(message, Toast.LENGTH_SHORT, 0, Gravity.BOTTOM, args);
- }
-
- public static void showToast(int message, int duration, int icon) {
- showToast(message, duration, icon, Gravity.BOTTOM);
- }
-
- public static void showToast(int message, int duration, int icon,
- int gravity) {
- showToast(context().getString(message), duration, icon, gravity);
- }
-
- public static void showToast(int message, int duration, int icon,
- int gravity, Object... args) {
- showToast(context().getString(message, args), duration, icon, gravity);
- }
-
- public static void showToast(String message, int duration, int icon,
- int gravity) {
- if (message != null && !message.equalsIgnoreCase("")) {
- long time = System.currentTimeMillis();
- if (!message.equalsIgnoreCase(lastToast)
- || Math.abs(time - lastToastTime) > 2000) {
- View view = LayoutInflater.from(context()).inflate(
- R.layout.view_toast, null);
- ((TextView) view.findViewById(R.id.title_tv)).setText(message);
- if (icon != 0) {
- ((ImageView) view.findViewById(R.id.icon_iv))
- .setImageResource(icon);
- ((ImageView) view.findViewById(R.id.icon_iv))
- .setVisibility(View.VISIBLE);
- }
- Toast toast = new Toast(context());
- toast.setView(view);
- if (gravity == Gravity.CENTER) {
- toast.setGravity(gravity, 0, 0);
- } else {
- toast.setGravity(gravity, 0, 35);
- }
-
- toast.setDuration(duration);
- toast.show();
- lastToast = message;
- lastToastTime = System.currentTimeMillis();
- }
- }
- }
-}
diff --git a/app/src/main/java/net/oschina/app/base/BaseFragment.java b/app/src/main/java/net/oschina/app/base/BaseFragment.java
deleted file mode 100644
index 73caa6d8bc12ea6d157c2dbc21a146586b9b77b2..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/base/BaseFragment.java
+++ /dev/null
@@ -1,119 +0,0 @@
-package net.oschina.app.base;
-
-import android.app.ProgressDialog;
-import android.os.Bundle;
-import android.support.v4.app.Fragment;
-import android.support.v4.app.FragmentActivity;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-
-import net.oschina.app.AppContext;
-import net.oschina.app.R;
-import net.oschina.app.interf.BaseFragmentInterface;
-import net.oschina.app.ui.dialog.DialogControl;
-
-/**
- * 碎片基类
- *
- * @author FireAnt(http://my.oschina.net/LittleDY)
- * @created 2014年9月25日 上午11:18:46
- *
- */
-public class BaseFragment extends Fragment implements
- android.view.View.OnClickListener, BaseFragmentInterface {
- public static final int STATE_NONE = 0;
- public static final int STATE_REFRESH = 1;
- public static final int STATE_LOADMORE = 2;
- public static final int STATE_NOMORE = 3;
- public static final int STATE_PRESSNONE = 4;// 正在下拉但还没有到刷新的状态
- public static int mState = STATE_NONE;
-
- protected LayoutInflater mInflater;
-
- public AppContext getApplication() {
- return (AppContext) getActivity().getApplication();
- }
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- }
-
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
- this.mInflater = inflater;
- View view = super.onCreateView(inflater, container, savedInstanceState);
- return view;
- }
-
- @Override
- public void onResume() {
- super.onResume();
- }
-
- @Override
- public void onPause() {
- super.onPause();
- }
-
- @Override
- public void onDestroy() {
- super.onDestroy();
- }
-
- protected int getLayoutId() {
- return 0;
- }
-
- protected View inflateView(int resId) {
- return this.mInflater.inflate(resId, null);
- }
-
- public boolean onBackPressed() {
- return false;
- }
-
- protected void hideWaitDialog() {
- FragmentActivity activity = getActivity();
- if (activity instanceof DialogControl) {
- ((DialogControl) activity).hideWaitDialog();
- }
- }
-
- protected ProgressDialog showWaitDialog() {
- return showWaitDialog(R.string.loading);
- }
-
- protected ProgressDialog showWaitDialog(int resid) {
- FragmentActivity activity = getActivity();
- if (activity instanceof DialogControl) {
- return ((DialogControl) activity).showWaitDialog(resid);
- }
- return null;
- }
-
- protected ProgressDialog showWaitDialog(String str) {
- FragmentActivity activity = getActivity();
- if (activity instanceof DialogControl) {
- return ((DialogControl) activity).showWaitDialog(str);
- }
- return null;
- }
-
- @Override
- public void initView(View view) {
-
- }
-
- @Override
- public void initData() {
-
- }
-
- @Override
- public void onClick(View v) {
-
- }
-}
diff --git a/app/src/main/java/net/oschina/app/base/BaseListFragment.java b/app/src/main/java/net/oschina/app/base/BaseListFragment.java
deleted file mode 100644
index f7790bbee384f7942e6babe27628bf2a68d2fee2..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/base/BaseListFragment.java
+++ /dev/null
@@ -1,606 +0,0 @@
-package net.oschina.app.base;
-
-import android.annotation.SuppressLint;
-import android.content.Context;
-import android.os.AsyncTask;
-import android.os.Bundle;
-import android.support.v4.widget.SwipeRefreshLayout;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.AbsListView;
-import android.widget.AbsListView.OnScrollListener;
-import android.widget.AdapterView;
-import android.widget.AdapterView.OnItemClickListener;
-import android.widget.ListView;
-import android.widget.TextView;
-
-import com.loopj.android.http.AsyncHttpResponseHandler;
-
-import net.oschina.app.AppContext;
-import net.oschina.app.R;
-import net.oschina.app.bean.Entity;
-import net.oschina.app.bean.ListEntity;
-import net.oschina.app.bean.Result;
-import net.oschina.app.bean.ResultBean;
-import net.oschina.app.cache.CacheManager;
-import net.oschina.app.ui.empty.EmptyLayout;
-import net.oschina.app.util.StringUtils;
-import net.oschina.app.util.TDevice;
-import net.oschina.app.util.ThemeSwitchUtils;
-import net.oschina.app.util.XmlUtils;
-
-import cz.msebera.android.httpclient.Header;
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-import java.io.Serializable;
-import java.lang.ref.WeakReference;
-import java.util.ArrayList;
-import java.util.List;
-
-import butterknife.ButterKnife;
-import butterknife.InjectView;
-
-@SuppressLint("NewApi")
-public abstract class BaseListFragment extends BaseFragment
- implements SwipeRefreshLayout.OnRefreshListener, OnItemClickListener,
- OnScrollListener {
-
- public static final String BUNDLE_KEY_CATALOG = "BUNDLE_KEY_CATALOG";
-
- @InjectView(R.id.swiperefreshlayout)
- protected SwipeRefreshLayout mSwipeRefreshLayout;
-
- @InjectView(R.id.listview)
- protected ListView mListView;
-
- protected ListBaseAdapter mAdapter;
-
- @InjectView(R.id.error_layout)
- protected EmptyLayout mErrorLayout;
-
- protected int mStoreEmptyState = -1;
-
- protected int mCurrentPage = 0;
-
- protected int mCatalog = 1;
- // 错误信息
- protected Result mResult;
-
- private AsyncTask> mCacheTask;
- private ParserTask mParserTask;
-
- @Override
- protected int getLayoutId() {
- return R.layout.fragment_pull_refresh_listview;
- }
-
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
- View view = inflater.inflate(getLayoutId(), container, false);
- return view;
- }
-
- @Override
- public void onViewCreated(View view, Bundle savedInstanceState) {
- super.onViewCreated(view, savedInstanceState);
- ButterKnife.inject(this, view);
- initView(view);
- }
-
- @Override
- public void onCreate(android.os.Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- Bundle args = getArguments();
- if (args != null) {
- mCatalog = args.getInt(BUNDLE_KEY_CATALOG, 0);
- }
- }
-
- @Override
- public void initView(View view) {
- mSwipeRefreshLayout.setOnRefreshListener(this);
- mSwipeRefreshLayout.setColorSchemeResources(
- R.color.swiperefresh_color1, R.color.swiperefresh_color2,
- R.color.swiperefresh_color3, R.color.swiperefresh_color4);
-
- mErrorLayout.setOnLayoutClickListener(new View.OnClickListener() {
-
- @Override
- public void onClick(View v) {
- mCurrentPage = 0;
- mState = STATE_REFRESH;
- mErrorLayout.setErrorType(EmptyLayout.NETWORK_LOADING);
- requestData(true);
- }
- });
-
- mListView.setOnItemClickListener(this);
- mListView.setOnScrollListener(this);
-
- if (mAdapter != null) {
- mListView.setAdapter(mAdapter);
- mErrorLayout.setErrorType(EmptyLayout.HIDE_LAYOUT);
- } else {
- mAdapter = getListAdapter();
- mListView.setAdapter(mAdapter);
-
- if (requestDataIfViewCreated()) {
- mErrorLayout.setErrorType(EmptyLayout.NETWORK_LOADING);
- mState = STATE_NONE;
- requestData(false);
- } else {
- mErrorLayout.setErrorType(EmptyLayout.HIDE_LAYOUT);
- }
-
- }
- if (mStoreEmptyState != -1) {
- mErrorLayout.setErrorType(mStoreEmptyState);
- }
- }
-
- @Override
- public void onDestroyView() {
- mStoreEmptyState = mErrorLayout.getErrorState();
- super.onDestroyView();
- }
-
- @Override
- public void onDestroy() {
- cancelReadCacheTask();
- cancelParserTask();
- super.onDestroy();
- }
-
- protected abstract ListBaseAdapter getListAdapter();
-
- // 下拉刷新数据
- @Override
- public void onRefresh() {
- if (mState == STATE_REFRESH) {
- return;
- }
- // 设置顶部正在刷新
- mListView.setSelection(0);
- setSwipeRefreshLoadingState();
- mCurrentPage = 0;
- mState = STATE_REFRESH;
- requestData(true);
- }
-
- protected boolean requestDataIfViewCreated() {
- return true;
- }
-
- protected String getCacheKeyPrefix() {
- return null;
- }
-
- protected ListEntity parseList(InputStream is) throws Exception {
- return null;
- }
-
- protected ListEntity readList(Serializable seri) {
- return null;
- }
-
- @Override
- public void onItemClick(AdapterView> parent, View view, int position,
- long id) {}
-
- private String getCacheKey() {
- return new StringBuilder(getCacheKeyPrefix()).append("_")
- .append(mCurrentPage).toString();
- }
-
- // 是否需要自动刷新
- protected boolean needAutoRefresh() {
- return true;
- }
-
- /***
- * 获取列表数据
- *
- *
- * @author 火蚁 2015-2-9 下午3:16:12
- *
- * @return void
- * @param refresh
- */
- protected void requestData(boolean refresh) {
- String key = getCacheKey();
- if (isReadCacheData(refresh)) {
- readCacheData(key);
- } else {
- // 取新的数据
- sendRequestData();
- }
- }
-
- /***
- * 判断是否需要读取缓存的数据
- *
- * @author 火蚁 2015-2-10 下午2:41:02
- *
- * @return boolean
- * @param refresh
- * @return
- */
- protected boolean isReadCacheData(boolean refresh) {
- String key = getCacheKey();
- if (!TDevice.hasInternet()) {
- return true;
- }
- // 第一页若不是主动刷新,缓存存在,优先取缓存的
- if (CacheManager.isExistDataCache(getActivity(), key) && !refresh
- && mCurrentPage == 0) {
- return true;
- }
- // 其他页数的,缓存存在以及还没有失效,优先取缓存的
- if (CacheManager.isExistDataCache(getActivity(), key)
- && !CacheManager.isCacheDataFailure(getActivity(), key)
- && mCurrentPage != 0) {
- return true;
- }
-
- return false;
- }
-
- // 是否到时间去刷新数据了
- private boolean onTimeRefresh() {
- String lastRefreshTime = AppContext.getLastRefreshTime(getCacheKey());
- String currTime = StringUtils.getCurTimeStr();
- long diff = StringUtils.calDateDifferent(lastRefreshTime, currTime);
- return needAutoRefresh() && diff > getAutoRefreshTime();
- }
-
- /***
- * 自动刷新的时间
- *
- * 默认:自动刷新的时间为半天时间
- *
- * @author 火蚁 2015-2-9 下午5:55:11
- *
- * @return long
- * @return
- */
- protected long getAutoRefreshTime() {
- return 12 * 60 * 60;
- }
-
- @Override
- public void onResume() {
- super.onResume();
- if (onTimeRefresh()) {
- onRefresh();
- }
- }
-
- protected void sendRequestData() {}
-
- private void readCacheData(String cacheKey) {
- cancelReadCacheTask();
- mCacheTask = new CacheTask(getActivity()).execute(cacheKey);
- }
-
- private void cancelReadCacheTask() {
- if (mCacheTask != null) {
- mCacheTask.cancel(true);
- mCacheTask = null;
- }
- }
-
- private class CacheTask extends AsyncTask> {
- private final WeakReference mContext;
-
- private CacheTask(Context context) {
- mContext = new WeakReference(context);
- }
-
- @Override
- protected ListEntity doInBackground(String... params) {
- Serializable seri = CacheManager.readObject(mContext.get(),
- params[0]);
- if (seri == null) {
- return null;
- } else {
- return readList(seri);
- }
- }
-
- @Override
- protected void onPostExecute(ListEntity list) {
- super.onPostExecute(list);
- if (list != null) {
- executeOnLoadDataSuccess(list.getList());
- } else {
- executeOnLoadDataError(null);
- }
- executeOnLoadFinish();
- }
- }
-
- private class SaveCacheTask extends AsyncTask {
- private final WeakReference mContext;
- private final Serializable seri;
- private final String key;
-
- private SaveCacheTask(Context context, Serializable seri, String key) {
- mContext = new WeakReference(context);
- this.seri = seri;
- this.key = key;
- }
-
- @Override
- protected Void doInBackground(Void... params) {
- CacheManager.saveObject(mContext.get(), seri, key);
- return null;
- }
- }
-
- protected AsyncHttpResponseHandler mHandler = new AsyncHttpResponseHandler() {
-
- @Override
- public void onSuccess(int statusCode, Header[] headers,
- byte[] responseBytes) {
- if (mCurrentPage == 0 && needAutoRefresh()) {
- AppContext.putToLastRefreshTime(getCacheKey(),
- StringUtils.getCurTimeStr());
- }
- if (isAdded()) {
- if (mState == STATE_REFRESH) {
- onRefreshNetworkSuccess();
- }
- executeParserTask(responseBytes);
- }
- }
-
- @Override
- public void onFailure(int arg0, Header[] arg1, byte[] arg2,
- Throwable arg3) {
- if (isAdded()) {
- readCacheData(getCacheKey());
- }
- }
- };
-
- protected void executeOnLoadDataSuccess(List data) {
- if (data == null) {
- data = new ArrayList();
- }
-
- if (mResult != null && !mResult.OK()) {
- AppContext.showToast(mResult.getErrorMessage());
- // 注销登陆,密码已经修改,cookie,失效了
- AppContext.getInstance().Logout();
- }
-
- mErrorLayout.setErrorType(EmptyLayout.HIDE_LAYOUT);
- if (mCurrentPage == 0) {
- mAdapter.clear();
- }
-
- for (int i = 0; i < data.size(); i++) {
- if (compareTo(mAdapter.getData(), data.get(i))) {
- data.remove(i);
- i--;
- }
- }
- int adapterState = ListBaseAdapter.STATE_EMPTY_ITEM;
- if ((mAdapter.getCount() + data.size()) == 0) {
- adapterState = ListBaseAdapter.STATE_EMPTY_ITEM;
- } else if (data.size() == 0
- || (data.size() < getPageSize() && mCurrentPage == 0)) {
- adapterState = ListBaseAdapter.STATE_NO_MORE;
- mAdapter.notifyDataSetChanged();
- } else {
- adapterState = ListBaseAdapter.STATE_LOAD_MORE;
- }
- mAdapter.setState(adapterState);
- mAdapter.addData(data);
- // 判断等于是因为最后有一项是listview的状态
- if (mAdapter.getCount() == 1) {
-
- if (needShowEmptyNoData()) {
- mErrorLayout.setErrorType(EmptyLayout.NODATA);
- } else {
- mAdapter.setState(ListBaseAdapter.STATE_EMPTY_ITEM);
- mAdapter.notifyDataSetChanged();
- }
- }
- }
-
- /**
- * 是否需要隐藏listview,显示无数据状态
- *
- * @author 火蚁 2015-1-27 下午6:18:59
- *
- */
- protected boolean needShowEmptyNoData() {
- return true;
- }
-
- protected boolean compareTo(List extends Entity> data, Entity enity) {
- int s = data.size();
- if (enity != null) {
- for (int i = 0; i < s; i++) {
- if (enity.getId() == data.get(i).getId()) {
- return true;
- }
- }
- }
- return false;
- }
-
- protected int getPageSize() {
- return AppContext.PAGE_SIZE;
- }
-
- protected void onRefreshNetworkSuccess() {}
-
- protected void executeOnLoadDataError(String error) {
- if (mCurrentPage == 0
- && !CacheManager.isExistDataCache(getActivity(), getCacheKey())) {
- mErrorLayout.setErrorType(EmptyLayout.NETWORK_ERROR);
- } else {
-
- //在无网络时,滚动到底部时,mCurrentPage先自加了,然而在失败时却
- //没有减回来,如果刻意在无网络的情况下上拉,可以出现漏页问题
- //find by TopJohn
- mCurrentPage--;
-
- mErrorLayout.setErrorType(EmptyLayout.HIDE_LAYOUT);
- mAdapter.setState(ListBaseAdapter.STATE_NETWORK_ERROR);
- mAdapter.notifyDataSetChanged();
- }
- }
-
- // 完成刷新
- protected void executeOnLoadFinish() {
- setSwipeRefreshLoadedState();
- mState = STATE_NONE;
- }
-
- /** 设置顶部正在加载的状态 */
- protected void setSwipeRefreshLoadingState() {
- if (mSwipeRefreshLayout != null) {
- mSwipeRefreshLayout.setRefreshing(true);
- // 防止多次重复刷新
- mSwipeRefreshLayout.setEnabled(false);
- }
- }
-
- /** 设置顶部加载完毕的状态 */
- protected void setSwipeRefreshLoadedState() {
- if (mSwipeRefreshLayout != null) {
- mSwipeRefreshLayout.setRefreshing(false);
- mSwipeRefreshLayout.setEnabled(true);
- }
- }
-
- private void executeParserTask(byte[] data) {
- cancelParserTask();
- mParserTask = new ParserTask(data);
- mParserTask.execute();
- }
-
- private void cancelParserTask() {
- if (mParserTask != null) {
- mParserTask.cancel(true);
- mParserTask = null;
- }
- }
-
- class ParserTask extends AsyncTask {
-
- private final byte[] reponseData;
- private boolean parserError;
- private List list;
-
- public ParserTask(byte[] data) {
- this.reponseData = data;
- }
-
- @Override
- protected String doInBackground(Void... params) {
- try {
- ListEntity data = parseList(new ByteArrayInputStream(
- reponseData));
- new SaveCacheTask(getActivity(), data, getCacheKey()).execute();
- list = data.getList();
- if (list == null) {
- ResultBean resultBean = XmlUtils.toBean(ResultBean.class,
- reponseData);
- if (resultBean != null) {
- mResult = resultBean.getResult();
- }
- }
- } catch (Exception e) {
- e.printStackTrace();
-
- parserError = true;
- }
- return null;
- }
-
- @Override
- protected void onPostExecute(String result) {
- super.onPostExecute(result);
- if (parserError) {
- readCacheData(getCacheKey());
- } else {
- executeOnLoadDataSuccess(list);
- executeOnLoadFinish();
- }
- }
- }
-
- @Override
- public void onScrollStateChanged(AbsListView view, int scrollState) {
- if (mAdapter == null || mAdapter.getCount() == 0) {
- return;
- }
- // 数据已经全部加载,或数据为空时,或正在加载,不处理滚动事件
- if (mState == STATE_LOADMORE || mState == STATE_REFRESH) {
- return;
- }
- // 判断是否滚动到底部
- boolean scrollEnd = false;
- try {
- if (view.getPositionForView(mAdapter.getFooterView()) == view
- .getLastVisiblePosition())
- scrollEnd = true;
- } catch (Exception e) {
- scrollEnd = false;
- }
-
- if (mState == STATE_NONE && scrollEnd) {
- if (mAdapter.getState() == ListBaseAdapter.STATE_LOAD_MORE
- || mAdapter.getState() == ListBaseAdapter.STATE_NETWORK_ERROR) {
- mCurrentPage++;
- mState = STATE_LOADMORE;
- requestData(false);
- mAdapter.setFooterViewLoading();
- }
- }
- }
-
- @Override
- public void onScroll(AbsListView view, int firstVisibleItem,
- int visibleItemCount, int totalItemCount) {
- // 数据已经全部加载,或数据为空时,或正在加载,不处理滚动事件
- // if (mState == STATE_NOMORE || mState == STATE_LOADMORE
- // || mState == STATE_REFRESH) {
- // return;
- // }
- // if (mAdapter != null
- // && mAdapter.getDataSize() > 0
- // && mListView.getLastVisiblePosition() == (mListView.getCount() - 1))
- // {
- // if (mState == STATE_NONE
- // && mAdapter.getState() == ListBaseAdapter.STATE_LOAD_MORE) {
- // mState = STATE_LOADMORE;
- // mCurrentPage++;
- // requestData(true);
- // }
- // }
- }
-
- /**
- * 保存已读的文章列表
- *
- * @param view
- * @param prefFileName
- * @param key
- */
- protected void saveToReadedList(final View view, final String prefFileName,
- final String key) {
- // 放入已读列表
- AppContext.putReadedPostList(prefFileName, key, "true");
- TextView tvTitle = (TextView) view.findViewById(R.id.tv_title);
- if (tvTitle != null) {
- tvTitle.setTextColor(AppContext.getInstance().getResources().getColor(ThemeSwitchUtils.getTitleReadedColor()));
- }
- }
-}
diff --git a/app/src/main/java/net/oschina/app/base/BaseNewActivity.java b/app/src/main/java/net/oschina/app/base/BaseNewActivity.java
deleted file mode 100644
index 77a7283aebf500fd0e0cf35dcef8f5fd92bb2f44..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/base/BaseNewActivity.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package net.oschina.app.base;
-
-import android.support.v7.app.AppCompatActivity;
-
-/**
- * Created by 火蚁 on 15/5/18.
- */
-public class BaseNewActivity extends AppCompatActivity {
-
-
-}
diff --git a/app/src/main/java/net/oschina/app/base/BaseViewPagerFragment.java b/app/src/main/java/net/oschina/app/base/BaseViewPagerFragment.java
deleted file mode 100644
index f7b55f2c5c6ebc0866603f38d7c3c5a3a6b0cd52..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/base/BaseViewPagerFragment.java
+++ /dev/null
@@ -1,65 +0,0 @@
-package net.oschina.app.base;
-
-import net.oschina.app.R;
-import net.oschina.app.adapter.ViewPageFragmentAdapter;
-import net.oschina.app.ui.empty.EmptyLayout;
-import net.oschina.app.widget.PagerSlidingTabStrip;
-import android.os.Bundle;
-import android.support.v4.view.ViewPager;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-
-/**
- * 带有导航条的基类
- *
- * @author FireAnt(http://my.oschina.net/LittleDY)
- * @created 2014年11月6日 下午4:59:50
- *
- */
-public abstract class BaseViewPagerFragment extends BaseFragment {
-
- protected PagerSlidingTabStrip mTabStrip;
- protected ViewPager mViewPager;
- protected ViewPageFragmentAdapter mTabsAdapter;
- protected EmptyLayout mErrorLayout;
-
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
- return inflater.inflate(R.layout.base_viewpage_fragment, null);
- }
-
- @Override
- public void onViewCreated(View view, Bundle savedInstanceState) {
- mTabStrip = (PagerSlidingTabStrip) view
- .findViewById(R.id.pager_tabstrip);
-
- mViewPager = (ViewPager) view.findViewById(R.id.pager);
-
- mErrorLayout = (EmptyLayout) view.findViewById(R.id.error_layout);
-
- mTabsAdapter = new ViewPageFragmentAdapter(getChildFragmentManager(),
- mTabStrip, mViewPager);
- setScreenPageLimit();
- onSetupTabAdapter(mTabsAdapter);
- // if (savedInstanceState != null) {
- // int pos = savedInstanceState.getInt("position");
- // mViewPager.setCurrentItem(pos, true);
- // }
- }
-
- protected void setScreenPageLimit() {
- }
-
- // @Override
- // public void onSaveInstanceState(Bundle outState) {
- // //No call for super(). Bug on API Level > 11.
- // if (outState != null && mViewPager != null) {
- // outState.putInt("position", mViewPager.getCurrentItem());
- // }
- // //super.onSaveInstanceState(outState);
- // }
-
- protected abstract void onSetupTabAdapter(ViewPageFragmentAdapter adapter);
-}
\ No newline at end of file
diff --git a/app/src/main/java/net/oschina/app/base/BeseHaveHeaderListFragment.java b/app/src/main/java/net/oschina/app/base/BeseHaveHeaderListFragment.java
deleted file mode 100644
index b4a85e125d2e7fed6b9705708daffbd07338cf25..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/base/BeseHaveHeaderListFragment.java
+++ /dev/null
@@ -1,178 +0,0 @@
-package net.oschina.app.base;
-
-import java.io.ByteArrayInputStream;
-import java.io.Serializable;
-import java.lang.ref.WeakReference;
-
-import net.oschina.app.bean.Entity;
-import net.oschina.app.cache.CacheManager;
-import net.oschina.app.ui.empty.EmptyLayout;
-
-import cz.msebera.android.httpclient.Header;
-
-import android.app.Activity;
-import android.content.Context;
-import android.os.AsyncTask;
-import android.os.Bundle;
-import android.view.View;
-import butterknife.ButterKnife;
-
-import com.loopj.android.http.AsyncHttpResponseHandler;
-
-/**
- * 需要加入header的BaseListFragment
- *
- * @desc 应用场景:如动弹详情、团队任务详情这些, 即是头部显示详情,然后下面显示评论列表的
- *
- * BeseHaveHeaderListFragment.java
- *
- * @author 火蚁(http://my.oschina.net/u/253900)
- *
- * @data 2015-1-27 下午3:02:42
- */
-public abstract class BeseHaveHeaderListFragment
- extends BaseListFragment {
-
- protected T2 detailBean;// list 头部的详情实体类
-
- protected Activity aty;
-
- protected final AsyncHttpResponseHandler mDetailHandler = new AsyncHttpResponseHandler() {
-
- @Override
- public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
- try {
- if (arg2 != null) {
- T2 detail = getDetailBean(new ByteArrayInputStream(arg2));
- if (detail != null) {
- requstListData();
- executeOnLoadDetailSuccess(detail);
- new SaveCacheTask(getActivity(), detail,
- getDetailCacheKey()).execute();
- } else {
- onFailure(arg0, arg1, arg2, null);
- }
- } else {
- throw new RuntimeException("load detail error");
- }
- } catch (Exception e) {
- e.printStackTrace();
- onFailure(arg0, arg1, arg2, e);
- }
- }
-
- @Override
- public void onFailure(int arg0, Header[] arg1, byte[] arg2,
- Throwable arg3) {
- readDetailCacheData(getDetailCacheKey());
- }
- };
-
- @Override
- public void onViewCreated(View view, Bundle savedInstanceState) {
- // 通过注解绑定控件
- ButterKnife.inject(this, view);
- mListView.addHeaderView(initHeaderView());
- aty = getActivity();
- super.initView(view);
- requestDetailData(isRefresh());
- }
-
- protected boolean isRefresh() {
- return false;
- }
-
- protected abstract void requestDetailData(boolean isRefresh);
-
- protected abstract View initHeaderView();
-
- protected abstract String getDetailCacheKey();
-
- protected abstract void executeOnLoadDetailSuccess(T2 detailBean);
-
- protected abstract T2 getDetailBean(ByteArrayInputStream is);
-
- @Override
- protected boolean requestDataIfViewCreated() {
- return false;
- }
-
- private void requstListData() {
- mState = STATE_REFRESH;
- mAdapter.setState(ListBaseAdapter.STATE_LOAD_MORE);
- sendRequestData();
- }
-
- /***
- * 带有header view的listfragment不需要显示是否数据为空
- */
- @Override
- protected boolean needShowEmptyNoData() {
- return false;
- }
-
- protected void readDetailCacheData(String cacheKey) {
- new ReadCacheTask(getActivity()).execute(cacheKey);
- }
-
- private class SaveCacheTask extends AsyncTask {
- private final WeakReference mContext;
- private final Serializable seri;
- private final String key;
-
- private SaveCacheTask(Context context, Serializable seri, String key) {
- mContext = new WeakReference(context);
- this.seri = seri;
- this.key = key;
- }
-
- @Override
- protected Void doInBackground(Void... params) {
- CacheManager.saveObject(mContext.get(), seri, key);
- return null;
- }
- }
-
- private class ReadCacheTask extends AsyncTask {
- private final WeakReference mContext;
-
- private ReadCacheTask(Context context) {
- mContext = new WeakReference(context);
- }
-
- @Override
- protected T2 doInBackground(String... params) {
- if (mContext.get() != null) {
- Serializable seri = CacheManager.readObject(mContext.get(),
- params[0]);
- if (seri == null) {
- return null;
- } else {
- return (T2) seri;
- }
- }
- return null;
- }
-
- @Override
- protected void onPostExecute(T2 t) {
- super.onPostExecute(t);
- if (t != null) {
- requstListData();
- executeOnLoadDetailSuccess(t);
- }
- }
- }
-
- @Override
- protected void executeOnLoadDataError(String error) {
- mErrorLayout.setErrorType(EmptyLayout.HIDE_LAYOUT);
- mAdapter.setState(ListBaseAdapter.STATE_NETWORK_ERROR);
- mAdapter.notifyDataSetChanged();
- }
-
- @SuppressWarnings("unchecked")
- protected T findHeaderView(View headerView, int viewId) {
- return (T) headerView.findViewById(viewId);
- }
-}
diff --git a/app/src/main/java/net/oschina/app/base/CommonDetailFragment.java b/app/src/main/java/net/oschina/app/base/CommonDetailFragment.java
deleted file mode 100644
index 3c64d4835d76413d4b9d4d6d56428a0ece25df2f..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/base/CommonDetailFragment.java
+++ /dev/null
@@ -1,558 +0,0 @@
-package net.oschina.app.base;
-
-import android.content.Context;
-import android.content.DialogInterface;
-import android.os.AsyncTask;
-import android.os.Bundle;
-import android.support.annotation.Nullable;
-import android.support.v7.app.AlertDialog;
-import android.text.Editable;
-import android.text.TextUtils;
-import android.view.LayoutInflater;
-import android.view.Menu;
-import android.view.MenuInflater;
-import android.view.MenuItem;
-import android.view.View;
-import android.view.ViewGroup;
-import android.webkit.WebView;
-
-import com.loopj.android.http.AsyncHttpResponseHandler;
-import com.loopj.android.http.TextHttpResponseHandler;
-
-import net.oschina.app.AppContext;
-import net.oschina.app.R;
-import net.oschina.app.api.remote.OSChinaApi;
-import net.oschina.app.bean.Report;
-import net.oschina.app.bean.Result;
-import net.oschina.app.bean.ResultBean;
-import net.oschina.app.cache.CacheManager;
-import net.oschina.app.emoji.OnSendClickListener;
-import net.oschina.app.ui.DetailActivity;
-import net.oschina.app.ui.ReportDialog;
-import net.oschina.app.ui.ShareDialog;
-import net.oschina.app.ui.empty.EmptyLayout;
-import net.oschina.app.util.DialogHelp;
-import net.oschina.app.util.FontSizeUtils;
-import net.oschina.app.util.HTMLUtil;
-import net.oschina.app.util.TDevice;
-import net.oschina.app.util.UIHelper;
-import net.oschina.app.util.XmlUtils;
-
-import cz.msebera.android.httpclient.Header;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-import java.io.Serializable;
-import java.lang.ref.WeakReference;
-
-import butterknife.ButterKnife;
-
-/**
- * 通用的详情fragment
- * Created by 火蚁 on 15/5/25.
- */
-public abstract class CommonDetailFragment extends BaseFragment implements OnSendClickListener {
-
- protected int mId;
-
- protected EmptyLayout mEmptyLayout;
-
- protected int mCommentCount = 0;
-
- protected WebView mWebView;
-
- protected T mDetail;
-
- private AsyncTask mCacheTask;
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setHasOptionsMenu(true);
- }
-
- @Override
- protected int getLayoutId() {
- return R.layout.fragment_news_detail;
- }
-
- @Override
- public View onCreateView(LayoutInflater inflater,
- @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
- View view = inflater.inflate(getLayoutId(), container,
- false);
- mCommentCount = getActivity().getIntent().getIntExtra("comment_count",
- 0);
- mId = getActivity().getIntent().getIntExtra("id", 0);
- ButterKnife.inject(this, view);
- initView(view);
- initData();
- requestData(false);
- return view;
- }
-
- @Override
- public void initView(View view) {
- mEmptyLayout = (EmptyLayout) view.findViewById(R.id.error_layout);
- setCommentCount(mCommentCount);
- mWebView = (WebView) view.findViewById(R.id.webview);
- UIHelper.initWebView(mWebView);
- }
-
- protected void setCommentCount(int commentCount) {
- ((DetailActivity) getActivity()).toolFragment
- .setCommentCount(commentCount);
- }
-
- private void requestData(boolean refresh) {
- String key = getCacheKey();
- if (TDevice.hasInternet()
- && (!CacheManager.isExistDataCache(getActivity(), key) || refresh)) {
- sendRequestDataForNet();
- } else {
- readCacheData(key);
- }
- }
-
- @Override
- public void onDestroyView() {
- recycleWebView();
- super.onDestroyView();
- }
-
- private void recycleWebView() {
- if (mWebView != null) {
- mWebView.setVisibility(View.GONE);
- mWebView.removeAllViews();
- mWebView.destroy();
- mWebView = null;
- }
- }
-
- private void readCacheData(String cacheKey) {
- cancelReadCache();
- mCacheTask = new CacheTask(getActivity()).execute(cacheKey);
- }
-
- private void cancelReadCache() {
- if (mCacheTask != null) {
- mCacheTask.cancel(true);
- mCacheTask = null;
- }
- }
-
- protected AsyncHttpResponseHandler mDetailHeandler = new AsyncHttpResponseHandler() {
- @Override
- public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
- try {
- T detail = parseData(new ByteArrayInputStream(arg2));
- if (detail != null) {
- mEmptyLayout.setErrorType(EmptyLayout.HIDE_LAYOUT);
- executeOnLoadDataSuccess(detail);
- saveCache(detail);
- } else {
- executeOnLoadDataError();
- }
- } catch (Exception e) {
- e.printStackTrace();
- executeOnLoadDataError();
- }
- }
-
- @Override
- public void onStart() {
- super.onStart();
- mEmptyLayout.setErrorType(EmptyLayout.NETWORK_LOADING);
- }
-
- @Override
- public void onFailure(int arg0, Header[] arg1, byte[] arg2,
- Throwable arg3) {
- readCacheData(getCacheKey());
- }
- };
-
- private class CacheTask extends AsyncTask {
- private final WeakReference mContext;
-
- private CacheTask(Context context) {
- mContext = new WeakReference(context);
- }
-
- @Override
- protected T doInBackground(String... params) {
- if (mContext.get() != null) {
- Serializable seri = CacheManager.readObject(mContext.get(),
- params[0]);
- if (seri == null) {
- return null;
- } else {
- return (T)seri;
- }
- }
- return null;
- }
-
- @Override
- protected void onPostExecute(T detail) {
- super.onPostExecute(detail);
- mEmptyLayout.setErrorType(EmptyLayout.HIDE_LAYOUT);
- if (detail != null) {
- executeOnLoadDataSuccess(detail);
- } else {
- executeOnLoadDataError();
- }
- }
-
- @Override
- protected void onPreExecute() {
- super.onPreExecute();
- mEmptyLayout.setErrorType(EmptyLayout.NETWORK_LOADING);
- }
- }
-
- protected void executeOnLoadDataSuccess(T detail) {
- this.mDetail = detail;
- if (this.mDetail == null || TextUtils.isEmpty(this.getWebViewBody(detail))) {
- executeOnLoadDataError();
- return;
- }
-
- mWebView.loadDataWithBaseURL("", this.getWebViewBody(detail), "text/html", "UTF-8", "");
- // 显示存储的字体大小
- mWebView.loadUrl(FontSizeUtils.getSaveFontSize());
- boolean favoriteState = getFavoriteState() == 1;
- setFavoriteState(favoriteState);
-
- // 判断最新的评论数是否大于
- if (getCommentCount() > mCommentCount) {
- mCommentCount = getCommentCount();
- }
- setCommentCount(mCommentCount);
- }
-
- protected void executeOnLoadDataError() {
- mEmptyLayout.setErrorType(EmptyLayout.NETWORK_ERROR);
- mEmptyLayout.setOnLayoutClickListener(new View.OnClickListener() {
-
- @Override
- public void onClick(View v) {
- mState = STATE_REFRESH;
- mEmptyLayout.setErrorType(EmptyLayout.NETWORK_LOADING);
- requestData(true);
- }
- });
- }
-
- protected void saveCache(T detail) {
- new SaveCacheTask(getActivity(), detail, getCacheKey()).execute();
- }
-
- private class SaveCacheTask extends AsyncTask {
- private final WeakReference mContext;
- private final Serializable seri;
- private final String key;
-
- private SaveCacheTask(Context context, Serializable seri, String key) {
- mContext = new WeakReference(context);
- this.seri = seri;
- this.key = key;
- }
-
- @Override
- protected Void doInBackground(Void... params) {
- CacheManager.saveObject(mContext.get(), seri, key);
- return null;
- }
- }
-
- @Override
- public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
- inflater.inflate(R.menu.common_detail_menu, menu);
- super.onCreateOptionsMenu(menu, inflater);
- }
-
- int i = 0;
-
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
- switch (item.getItemId()) {
- case R.id.refresh:
- sendRequestDataForNet();
- return false;
- case R.id.font_size:
- showChangeFontSize();
- break;
- default:
- break;
- }
- return super.onOptionsItemSelected(item);
- }
-
- AlertDialog fontSizeChange;
-
- private void showChangeFontSize() {
-
- final String[] items = getResources().getStringArray(
- R.array.font_size);
- fontSizeChange = DialogHelp.getSingleChoiceDialog(getActivity(), items, FontSizeUtils.getSaveFontSizeIndex(), new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialogInterface, int i) {
- // 更改字体大小
- FontSizeUtils.saveFontSize(i);
- mWebView.loadUrl(FontSizeUtils.getFontSize(i));
- fontSizeChange.dismiss();
- }
- }).show();
- }
-
- // 收藏或者取消收藏
- public void handleFavoriteOrNot() {
- if (mDetail == null) {
- return;
- }
- if (!TDevice.hasInternet()) {
- AppContext.showToastShort(R.string.tip_no_internet);
- return;
- }
- if (!AppContext.getInstance().isLogin()) {
- UIHelper.showLoginActivity(getActivity());
- return;
- }
- int uid = AppContext.getInstance().getLoginUid();
- final boolean isFavorited = getFavoriteState() == 1 ? true : false;
- AsyncHttpResponseHandler mFavoriteHandler = new AsyncHttpResponseHandler() {
-
- @Override
- public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
- try {
- Result res = XmlUtils.toBean(ResultBean.class,
- new ByteArrayInputStream(arg2)).getResult();
- if (res.OK()) {
- AppContext.showToast(res.getErrorMessage());
- boolean newFavorited = !isFavorited;
- setFavoriteState(newFavorited);
- // 更新收藏的状态
- updateFavoriteChanged(!newFavorited ? 0 : 1);
- } else {
- onFailure(arg0, arg1, arg2, null);
- }
-
- } catch (Exception e) {
- e.printStackTrace();
- onFailure(arg0, arg1, arg2, e);
- }
- }
-
- @Override
- public void onFailure(int arg0, Header[] arg1, byte[] arg2,
- Throwable arg3) {
- AppContext.showToastShort(R.string.add_favorite_faile);
- }
-
- @Override
- public void onStart() {
- super.onStart();
- showWaitDialog("请稍候...");
- }
-
- @Override
- public void onFinish() {
- super.onFinish();
- hideWaitDialog();
- }
- };
-
- if (isFavorited) {
- OSChinaApi.delFavorite(uid, mId,
- getFavoriteTargetType(), mFavoriteHandler);
- } else {
- OSChinaApi.addFavorite(uid, mId,
- getFavoriteTargetType(), mFavoriteHandler);
- }
- }
-
- private void setFavoriteState(boolean isFavorited) {
- ((DetailActivity) getActivity()).toolFragment.setFavorite(isFavorited);
- }
-
- // 举报帖子
- public void onReportMenuClick() {
- if (mId == 0 || mDetail == null) {
- AppContext.showToast("正在加载,请稍等...");
- }
- if (!AppContext.getInstance().isLogin()) {
- UIHelper.showLoginActivity(getActivity());
- return;
- }
- int reportId = mId;
-
- final ReportDialog dialog = new ReportDialog(getActivity(),
- getRepotrUrl(), reportId, getReportType());
- dialog.setCancelable(true);
- dialog.setTitle(R.string.report);
- dialog.setCanceledOnTouchOutside(true);
- dialog.setNegativeButton(R.string.cancle, null);
- final TextHttpResponseHandler mReportHandler = new TextHttpResponseHandler() {
-
- @Override
- public void onSuccess(int arg0, Header[] arg1, String arg2) {
- if (TextUtils.isEmpty(arg2)) {
- AppContext.showToastShort(R.string.tip_report_success);
- } else {
- AppContext.showToastShort(new String(arg2));
- }
- }
-
- @Override
- public void onFailure(int arg0, Header[] arg1, String arg2,
- Throwable arg3) {
- AppContext.showToastShort(R.string.tip_report_faile);
- }
-
- @Override
- public void onFinish() {
- hideWaitDialog();
- }
- };
- dialog.setPositiveButton(R.string.ok,
- new DialogInterface.OnClickListener() {
-
- @Override
- public void onClick(DialogInterface d, int which) {
- Report report = null;
- if ((report = dialog.getReport()) != null) {
- showWaitDialog(R.string.progress_submit);
- OSChinaApi.report(report, mReportHandler);
- }
- d.dismiss();
- }
- });
- dialog.show();
- }
- // 分享
- public void handleShare() {
- if (mDetail == null || TextUtils.isEmpty(getShareContent())
- || TextUtils.isEmpty(getShareUrl()) || TextUtils.isEmpty(getShareTitle())) {
- AppContext.showToast("内容加载失败...");
- return;
- }
- final ShareDialog dialog = new ShareDialog(getActivity());
- dialog.setCancelable(true);
- dialog.setCanceledOnTouchOutside(true);
- dialog.setTitle(R.string.share_to);
- dialog.setShareInfo(getShareTitle(), getShareContent(), getShareUrl());
- dialog.show();
- }
- // 显示评论列表
- public void onCilckShowComment() {
- showCommentView();
- }
-
- // 刷新数据
- protected void refresh() {
- sendRequestDataForNet();
- }
-
- protected AsyncHttpResponseHandler mCommentHandler = new AsyncHttpResponseHandler() {
-
- @Override
- public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
- try {
- ResultBean rsb = XmlUtils.toBean(ResultBean.class,
- new ByteArrayInputStream(arg2));
- Result res = rsb.getResult();
- if (res.OK()) {
- hideWaitDialog();
- AppContext.showToastShort(res.getErrorMessage());
- // 评论成功之后,评论数加1
- setCommentCount(mCommentCount + 1);
- } else {
- hideWaitDialog();
- AppContext.showToastShort(res.getErrorMessage());
- }
- } catch (Exception e) {
- e.printStackTrace();
- onFailure(arg0, arg1, arg2, e);
- }
- ((DetailActivity) getActivity()).emojiFragment.clean();
- }
-
- @Override
- public void onFailure(int arg0, Header[] arg1, byte[] arg2,
- Throwable arg3) {
- hideWaitDialog();
- AppContext.showToastShort(R.string.comment_publish_faile);
- }
-
- @Override
- public void onFinish() {
- ((DetailActivity) getActivity()).emojiFragment.hideAllKeyBoard();
- };
- };
-
- // 发表评论
- @Override
- public void onClickSendButton(Editable str) {
- if (!TDevice.hasInternet()) {
- AppContext.showToastShort(R.string.tip_network_error);
- return;
- }
- if (!AppContext.getInstance().isLogin()) {
- UIHelper.showLoginActivity(getActivity());
- return;
- }
- if (TextUtils.isEmpty(str)) {
- AppContext.showToastShort(R.string.tip_comment_content_empty);
- return;
- }
- showWaitDialog(R.string.progress_submit);
-
- OSChinaApi.publicComment(getCommentType(), mId, AppContext
- .getInstance().getLoginUid(), str.toString(), 0,
- mCommentHandler);
- }
-
- @Override
- public void onClickFlagButton() {
-
- }
-
- /***
- * 获取去除html标签的body
- *
- * @param body
- * @return
- */
- protected String getFilterHtmlBody(String body) {
- if (body == null)
- return "";
- return HTMLUtil.delHTMLTag(body.trim());
- }
-
- // 获取缓存的key
- protected abstract String getCacheKey();
- // 从网络中读取数据
- protected abstract void sendRequestDataForNet();
- // 解析数据
- protected abstract T parseData(InputStream is);
- // 返回填充到webview中的内容
- protected abstract String getWebViewBody(T detail);
- // 显示评论列表
- protected abstract void showCommentView();
- // 获取评论的类型
- protected abstract int getCommentType();
- protected abstract String getShareTitle();
- protected abstract String getShareContent();
- protected abstract String getShareUrl();
- // 返回举报的url
- protected String getRepotrUrl() {return "";}
- // 返回举报的类型
- protected byte getReportType() {return Report.TYPE_QUESTION;}
-
- // 获取收藏类型(如新闻、博客、帖子)
- protected abstract int getFavoriteTargetType();
- protected abstract int getFavoriteState();
- protected abstract void updateFavoriteChanged(int newFavoritedState);
- protected abstract int getCommentCount();
-}
diff --git a/app/src/main/java/net/oschina/app/base/ListBaseAdapter.java b/app/src/main/java/net/oschina/app/base/ListBaseAdapter.java
deleted file mode 100644
index 4468bc4c74de089e8a029212fd3d4bf2f6f67e54..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/base/ListBaseAdapter.java
+++ /dev/null
@@ -1,301 +0,0 @@
-package net.oschina.app.base;
-
-import android.annotation.SuppressLint;
-import android.content.Context;
-import android.text.Html;
-import android.text.Spanned;
-import android.text.TextUtils;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.BaseAdapter;
-import android.widget.LinearLayout;
-import android.widget.ProgressBar;
-import android.widget.TextView;
-
-import net.oschina.app.R;
-import net.oschina.app.bean.Entity;
-import net.oschina.app.emoji.InputHelper;
-import net.oschina.app.util.StringUtils;
-import net.oschina.app.util.TDevice;
-import net.oschina.app.widget.MyLinkMovementMethod;
-import net.oschina.app.widget.MyURLSpan;
-import net.oschina.app.widget.TweetTextView;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class ListBaseAdapter extends BaseAdapter {
- public static final int STATE_EMPTY_ITEM = 0;
- public static final int STATE_LOAD_MORE = 1;
- public static final int STATE_NO_MORE = 2;
- public static final int STATE_NO_DATA = 3;
- public static final int STATE_LESS_ONE_PAGE = 4;
- public static final int STATE_NETWORK_ERROR = 5;
- public static final int STATE_OTHER = 6;
-
- protected int state = STATE_LESS_ONE_PAGE;
-
- protected int _loadmoreText;
- protected int _loadFinishText;
- protected int _noDateText;
- protected int mScreenWidth;
-
- private LayoutInflater mInflater;
-
- protected LayoutInflater getLayoutInflater(Context context) {
- if (mInflater == null) {
- mInflater = (LayoutInflater) context
- .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
- }
- return mInflater;
- }
-
- public void setScreenWidth(int width) {
- mScreenWidth = width;
- }
-
- public void setState(int state) {
- this.state = state;
- }
-
- public int getState() {
- return this.state;
- }
-
- protected ArrayList mDatas = new ArrayList();
-
- public ListBaseAdapter() {
- _loadmoreText = R.string.loading;
- _loadFinishText = R.string.loading_no_more;
- _noDateText = R.string.error_view_no_data;
- }
-
- @Override
- public int getCount() {
- switch (getState()) {
- case STATE_EMPTY_ITEM:
- return getDataSizePlus1();
- case STATE_NETWORK_ERROR:
- case STATE_LOAD_MORE:
- return getDataSizePlus1();
- case STATE_NO_DATA:
- return 1;
- case STATE_NO_MORE:
- return getDataSizePlus1();
- case STATE_LESS_ONE_PAGE:
- return getDataSize();
- default:
- break;
- }
- return getDataSize();
- }
-
- public int getDataSizePlus1(){
- if(hasFooterView()){
- return getDataSize() + 1;
- }
- return getDataSize();
- }
-
- public int getDataSize() {
- return mDatas.size();
- }
-
- @Override
- public T getItem(int arg0) {
- if (mDatas.size() > arg0) {
- return mDatas.get(arg0);
- }
- return null;
- }
-
- @Override
- public long getItemId(int arg0) {
- return arg0;
- }
-
- public void setData(ArrayList data) {
- mDatas = data;
- notifyDataSetChanged();
- }
-
- public ArrayList getData() {
- return mDatas == null ? (mDatas = new ArrayList()) : mDatas;
- }
-
- public void addData(List data) {
- if (mDatas != null && data != null && !data.isEmpty()) {
- mDatas.addAll(data);
- }
- notifyDataSetChanged();
- }
-
- public void addItem(T obj) {
- if (mDatas != null) {
- mDatas.add(obj);
- }
- notifyDataSetChanged();
- }
-
- public void addItem(int pos, T obj) {
- if (mDatas != null) {
- mDatas.add(pos, obj);
- }
- notifyDataSetChanged();
- }
-
- public void removeItem(Object obj) {
- mDatas.remove(obj);
- notifyDataSetChanged();
- }
-
- public void clear() {
- mDatas.clear();
- notifyDataSetChanged();
- }
-
- public void setLoadmoreText(int loadmoreText) {
- _loadmoreText = loadmoreText;
- }
-
- public void setLoadFinishText(int loadFinishText) {
- _loadFinishText = loadFinishText;
- }
-
- public void setNoDataText(int noDataText) {
- _noDateText = noDataText;
- }
-
- protected boolean loadMoreHasBg() {
- return true;
- }
-
- @SuppressWarnings("deprecation")
- @SuppressLint("InflateParams")
- @Override
- public View getView(int position, View convertView, ViewGroup parent) {
- if (position == getCount() - 1&&hasFooterView()) {// 最后一条
- // if (position < _data.size()) {
- // position = getCount() - 2; // footview
- // }
- if (getState() == STATE_LOAD_MORE || getState() == STATE_NO_MORE
- || state == STATE_EMPTY_ITEM
- || getState() == STATE_NETWORK_ERROR) {
- this.mFooterView = (LinearLayout) LayoutInflater.from(
- parent.getContext()).inflate(R.layout.list_cell_footer,
- null);
- if (!loadMoreHasBg()) {
- mFooterView.setBackgroundDrawable(null);
- }
- ProgressBar progress = (ProgressBar) mFooterView
- .findViewById(R.id.progressbar);
- TextView text = (TextView) mFooterView.findViewById(R.id.text);
- switch (getState()) {
- case STATE_LOAD_MORE:
- setFooterViewLoading();
- break;
- case STATE_NO_MORE:
- mFooterView.setVisibility(View.VISIBLE);
- progress.setVisibility(View.GONE);
- text.setVisibility(View.VISIBLE);
- text.setText(_loadFinishText);
- break;
- case STATE_EMPTY_ITEM:
- progress.setVisibility(View.GONE);
- mFooterView.setVisibility(View.VISIBLE);
- text.setText(_noDateText);
- break;
- case STATE_NETWORK_ERROR:
- mFooterView.setVisibility(View.VISIBLE);
- progress.setVisibility(View.GONE);
- text.setVisibility(View.VISIBLE);
- if (TDevice.hasInternet()) {
- text.setText("加载出错了");
- } else {
- text.setText("没有可用的网络");
- }
- break;
- default:
- progress.setVisibility(View.GONE);
- mFooterView.setVisibility(View.GONE);
- text.setVisibility(View.GONE);
- break;
- }
- return mFooterView;
- }
- }
- if (position < 0) {
- position = 0; // 若列表没有数据,是没有footview/headview的
- }
- return getRealView(position, convertView, parent);
- }
-
- protected View getRealView(int position, View convertView, ViewGroup parent) {
- return null;
- }
-
- private LinearLayout mFooterView;
-
- protected boolean hasFooterView(){
- return true;
- }
-
- public View getFooterView() {
- return this.mFooterView;
- }
-
- public void setFooterViewLoading(String loadMsg) {
- ProgressBar progress = (ProgressBar) mFooterView
- .findViewById(R.id.progressbar);
- TextView text = (TextView) mFooterView.findViewById(R.id.text);
- mFooterView.setVisibility(View.VISIBLE);
- progress.setVisibility(View.VISIBLE);
- text.setVisibility(View.VISIBLE);
- if (StringUtils.isEmpty(loadMsg)) {
- text.setText(_loadmoreText);
- } else {
- text.setText(loadMsg);
- }
- }
-
- public void setFooterViewLoading() {
- setFooterViewLoading("");
- }
-
- public void setFooterViewText(String msg) {
- ProgressBar progress = (ProgressBar) mFooterView
- .findViewById(R.id.progressbar);
- TextView text = (TextView) mFooterView.findViewById(R.id.text);
- mFooterView.setVisibility(View.VISIBLE);
- progress.setVisibility(View.GONE);
- text.setVisibility(View.VISIBLE);
- text.setText(msg);
- }
-
- protected void setContent(TweetTextView contentView, String content) {
- contentView.setMovementMethod(MyLinkMovementMethod.a());
- contentView.setFocusable(false);
- contentView.setDispatchToParent(true);
- contentView.setLongClickable(false);
- Spanned span = Html.fromHtml(TweetTextView.modifyPath(content));
- span = InputHelper.displayEmoji(contentView.getResources(),
- span.toString());
- contentView.setText(span);
- MyURLSpan.parseLinkText(contentView, span);
- }
-
- protected void setText(TextView textView, String text, boolean needGone) {
- if (text == null || TextUtils.isEmpty(text)) {
- if (needGone) {
- textView.setVisibility(View.GONE);
- }
- } else {
- textView.setText(text);
- }
- }
-
- protected void setText(TextView textView, String text) {
- setText(textView, text, false);
- }
-}
diff --git a/app/src/main/java/net/oschina/app/bean/Active.java b/app/src/main/java/net/oschina/app/bean/Active.java
deleted file mode 100644
index 0bce263dee26ebef44e6a3d4694bd92ba6bc18c1..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/bean/Active.java
+++ /dev/null
@@ -1,240 +0,0 @@
-package net.oschina.app.bean;
-
-import java.io.Serializable;
-
-import com.thoughtworks.xstream.annotations.XStreamAlias;
-
-/**
- * 动态实体类
- *
- * @author FireAnt(http://my.oschina.net/LittleDY)
- * @created 2014年10月22日 下午3:22:09
- *
- */
-@SuppressWarnings("serial")
-@XStreamAlias("active")
-public class Active extends Entity {
-
- public final static int CATALOG_OTHER = 0;// 其他
- public final static int CATALOG_NEWS = 1;// 新闻
- public final static int CATALOG_POST = 2;// 帖子
- public final static int CATALOG_TWEET = 3;// 动弹
- public final static int CATALOG_BLOG = 4;// 博客
-
- public final static int CLIENT_MOBILE = 2;
- public final static int CLIENT_ANDROID = 3;
- public final static int CLIENT_IPHONE = 4;
- public final static int CLIENT_WINDOWS_PHONE = 5;
-
- @XStreamAlias("portrait")
- private String portrait;
-
- @XStreamAlias("message")
- private String message;
-
- @XStreamAlias("author")
- private String author;
-
- @XStreamAlias("authorid")
- private int authorId;
-
- @XStreamAlias("activetype")
- private int activeType;
-
- @XStreamAlias("objectID")
- private int objectId;
-
- @XStreamAlias("catalog")
- private int catalog;
-
- @XStreamAlias("objecttype")
- private int objectType;
-
- @XStreamAlias("objectcatalog")
- private int objectCatalog;
-
- @XStreamAlias("objecttitle")
- private String objectTitle;
-
- @XStreamAlias("objectreply")
- private ObjectReply objectReply;
-
- @XStreamAlias("commentCount")
- private int commentCount;
-
- @XStreamAlias("pubDate")
- private String pubDate;
-
- @XStreamAlias("tweetimage")
- private String tweetimage;
-
- @XStreamAlias("tweetattach")
- private String tweetattach;
-
- @XStreamAlias("appclient")
- private int appClient;
-
- @XStreamAlias("url")
- private String url;
-
- public String getPortrait() {
- return portrait;
- }
-
- public void setPortrait(String portrait) {
- this.portrait = portrait;
- }
-
- public String getMessage() {
- return message;
- }
-
- public void setMessage(String message) {
- this.message = message;
- }
-
- public String getAuthor() {
- return author;
- }
-
- public void setAuthor(String author) {
- this.author = author;
- }
-
- public int getAuthorId() {
- return authorId;
- }
-
- public void setAuthorId(int authorId) {
- this.authorId = authorId;
- }
-
- public int getActiveType() {
- return activeType;
- }
-
- public void setActiveType(int activeType) {
- this.activeType = activeType;
- }
-
- public int getObjectId() {
- return objectId;
- }
-
- public void setObjectId(int objectId) {
- this.objectId = objectId;
- }
-
- public int getCatalog() {
- return catalog;
- }
-
- public void setCatalog(int catalog) {
- this.catalog = catalog;
- }
-
- public int getObjectType() {
- return objectType;
- }
-
- public void setObjectType(int objectType) {
- this.objectType = objectType;
- }
-
- public int getObjectCatalog() {
- return objectCatalog;
- }
-
- public void setObjectCatalog(int objectCatalog) {
- this.objectCatalog = objectCatalog;
- }
-
- public String getObjectTitle() {
- return objectTitle;
- }
-
- public void setObjectTitle(String objectTitle) {
- this.objectTitle = objectTitle;
- }
-
- public ObjectReply getObjectReply() {
- return objectReply;
- }
-
- public void setObjectReply(ObjectReply objectReply) {
- this.objectReply = objectReply;
- }
-
- public int getCommentCount() {
- return commentCount;
- }
-
- public void setCommentCount(int commentCount) {
- this.commentCount = commentCount;
- }
-
- public String getPubDate() {
- return pubDate;
- }
-
- public void setPubDate(String pubDate) {
- this.pubDate = pubDate;
- }
-
- public String getTweetattach() {
- return tweetattach;
- }
-
- public void setTweetattach(String tweetattach) {
- this.tweetattach = tweetattach;
- }
-
- public String getTweetimage() {
- return tweetimage;
- }
-
- public void setTweetimage(String tweetimage) {
- this.tweetimage = tweetimage;
- }
-
- public int getAppClient() {
- return appClient;
- }
-
- public void setAppClient(int appClient) {
- this.appClient = appClient;
- }
-
- public String getUrl() {
- return url;
- }
-
- public void setUrl(String url) {
- this.url = url;
- }
-
- @XStreamAlias("objectreply")
- public static class ObjectReply implements Serializable {
- @XStreamAlias("objectname")
- public String objectName;
-
- @XStreamAlias("objectbody")
- public String objectBody;
-
- public String getObjectName() {
- return objectName;
- }
-
- public void setObjectName(String objectName) {
- this.objectName = objectName;
- }
-
- public String getObjectBody() {
- return objectBody;
- }
-
- public void setObjectBody(String objectBody) {
- this.objectBody = objectBody;
- }
- }
-}
diff --git a/app/src/main/java/net/oschina/app/bean/ActiveList.java b/app/src/main/java/net/oschina/app/bean/ActiveList.java
deleted file mode 100644
index 6b2219d0c6417335b9eae4e74fe66d821653c28c..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/bean/ActiveList.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package net.oschina.app.bean;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import com.thoughtworks.xstream.annotations.XStreamAlias;
-
-/**
- * 动态实体列表
- *
- * @author FireAnt(http://my.oschina.net/LittleDY)
- * @created 2014年10月22日 下午3:34:21
- *
- */
-@SuppressWarnings("serial")
-@XStreamAlias("oschina")
-public class ActiveList extends Entity implements ListEntity {
-
- public final static int CATALOG_LASTEST = 1;// 最新
- public final static int CATALOG_ATME = 2;// @我
- public final static int CATALOG_COMMENT = 3;// 评论
- public final static int CATALOG_MYSELF = 4;// 我自己
-
- @XStreamAlias("pagesize")
- private int pageSize;
-
- @XStreamAlias("activeCount")
- private int activeCount;
-
- @XStreamAlias("activies")
- private List activelist = new ArrayList();
-
- @XStreamAlias("result")
- private Result result;
-
- public int getPageSize() {
- return pageSize;
- }
-
- public int getActiveCount() {
- return activeCount;
- }
-
- public List getActivelist() {
- return activelist;
- }
-
- @Override
- public List getList() {
- return activelist;
- }
-
- public Result getResult() {
- return result;
- }
-
- public void setResult(Result result) {
- this.result = result;
- }
-}
diff --git a/app/src/main/java/net/oschina/app/bean/Apply.java b/app/src/main/java/net/oschina/app/bean/Apply.java
deleted file mode 100644
index 366bbc7e65bf1951c966af29d102520f47082cb8..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/bean/Apply.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package net.oschina.app.bean;
-
-import com.thoughtworks.xstream.annotations.XStreamAlias;
-
-/**
- * 活动报名者实体类
- * @author FireAnt(http://my.oschina.net/LittleDY)
- * @version 创建时间:2015年1月16日 下午3:27:04
- *
- */
-@SuppressWarnings("serial")
-@XStreamAlias("apply")
-public class Apply extends Entity {
-
- @XStreamAlias("uid")
- private int userid;
-
- @XStreamAlias("name")
- private String name;
-
- @XStreamAlias("portrait")
- private String portrait;
-
- @XStreamAlias("company")
- private String company;
-
- @XStreamAlias("job")
- private String job;
-
- public int getId() {
- return userid;
- }
- public void setId(int userid) {
- this.userid = userid;
- }
- public String getName() {
- return name;
- }
- public void setName(String name) {
- this.name = name;
- }
- public String getPortrait() {
- return portrait;
- }
- public void setPortrait(String portrait) {
- this.portrait = portrait;
- }
- public String getCompany() {
- return company;
- }
- public void setCompany(String company) {
- this.company = company;
- }
- public String getJob() {
- return job;
- }
- public void setJob(String job) {
- this.job = job;
- }
-}
-
diff --git a/app/src/main/java/net/oschina/app/bean/BarCode.java b/app/src/main/java/net/oschina/app/bean/BarCode.java
deleted file mode 100644
index c63e5bbb87d212c1cb34956daa9a99c1de30ac83..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/bean/BarCode.java
+++ /dev/null
@@ -1,102 +0,0 @@
-package net.oschina.app.bean;
-
-import java.io.Serializable;
-
-import net.oschina.app.AppException;
-
-import org.json.JSONException;
-import org.json.JSONObject;
-
-/**
- * 二维码扫描实体类
- * @author 火蚁 (http://my.oschina.net/LittleDY)
- * @version 1.0
- * @created 2014-3-17
- */
-@SuppressWarnings("serial")
-public class BarCode extends Entity implements Serializable{
-
- public final static String NODE_REQURE_LOGIN = "require_login";
- public final static String NODE_TYPE = "type";
- public final static String NODE_URL = "url";
- public final static String NODE_TITLE = "title";
-
- public final static byte LOGIN_IN = 0x00;// 登录
- public final static byte SIGN_IN = 0x01;// 签到
-
- private boolean requireLogin;// 是否需要登录
- private int type;// 类型
- private String url;// url地址
- private String title;// 标题
-
- public String getTitle() {
- return title;
- }
-
- public void setTitle(String title) {
- this.title = title;
- }
-
- public boolean isRequireLogin() {
- return requireLogin;
- }
-
- public void setRequireLogin(boolean requireLogin) {
- this.requireLogin = requireLogin;
- }
-
- public int getType() {
- return type;
- }
-
- public void setType(int type) {
- this.type = type;
- }
-
- public String getUrl() {
- return url;
- }
-
- public void setUrl(String url) {
- this.url = url;
- }
-
- public static BarCode parse(String barCodeString) throws AppException {
- BarCode barCode = new BarCode();
- try {
- // 由字符串创建json对象
- JSONObject jsonObject = new JSONObject(barCodeString);
- // 取数据操作
- if (!jsonObject.isNull(NODE_REQURE_LOGIN)) {
- barCode.setRequireLogin(jsonObject.getBoolean(NODE_REQURE_LOGIN));
- } else {
- barCode.setUrl("www.oschina.net");
- }
- if (!jsonObject.isNull(NODE_TYPE)) {
- barCode.setType(jsonObject.getInt(NODE_TYPE));
- } else {
- barCode.setType(1);
- }
- if (!jsonObject.isNull(NODE_URL)) {
- barCode.setUrl(jsonObject.getString(NODE_URL));
- } else {
- barCode.setUrl("www.oschina.net");
- }
- if (!jsonObject.isNull(NODE_TITLE)) {
- barCode.setTitle(jsonObject.getString(NODE_TITLE));
- } else {
- barCode.setTitle("");
- }
- } catch (JSONException e) {
- // 抛出一个json解析错误的异常
- throw AppException.json(e);
- }
- return barCode;
- }
-
- @Override
- public String toString() {
- return "Barcode [requireLogin=" + requireLogin + ", type=" + type
- + ", url=" + url + "]";
- }
-}
diff --git a/app/src/main/java/net/oschina/app/bean/Base.java b/app/src/main/java/net/oschina/app/bean/Base.java
deleted file mode 100644
index d9f64576da1ebfd826a3a8283d3cc63d3628da9d..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/bean/Base.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package net.oschina.app.bean;
-
-import java.io.Serializable;
-
-import com.thoughtworks.xstream.annotations.XStreamAlias;
-
-/**
- * 实体基类:实现序列化
- * @author liux (http://my.oschina.net/liux)
- * @version 1.0
- * @created 2012-3-21
- */
-@SuppressWarnings("serial")
-public abstract class Base implements Serializable {
-
- @XStreamAlias("notice")
- protected Notice notice;
-
- public Notice getNotice() {
- return notice;
- }
-
- public void setNotice(Notice notice) {
- this.notice = notice;
- }
-}
diff --git a/app/src/main/java/net/oschina/app/bean/Blog.java b/app/src/main/java/net/oschina/app/bean/Blog.java
deleted file mode 100644
index 67eb58d00401f690c35246f56d185f4cd69aea69..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/bean/Blog.java
+++ /dev/null
@@ -1,126 +0,0 @@
-package net.oschina.app.bean;
-
-import com.thoughtworks.xstream.annotations.XStreamAlias;
-
-/**
- * @author HuangWenwei
- *
- * @date 2014年9月29日
- */
-@SuppressWarnings("serial")
-@XStreamAlias("blog")
-public class Blog extends Entity {
-
- public final static int DOC_TYPE_REPASTE = 0;//转帖
- public final static int DOC_TYPE_ORIGINAL = 1;//原创
-
- @XStreamAlias("title")
- private String title;
-
- @XStreamAlias("url")
- private String url;
-
- @XStreamAlias("where")
- private String where;
-
- @XStreamAlias("commentCount")
- private int commentCount;
-
- @XStreamAlias("body")
- private String body;
-
- @XStreamAlias("author")
- private String authorname;
-
- @XStreamAlias("authorid")
- private int authoruid;
-
- @XStreamAlias("documentType")
- private int documentType;
-
- @XStreamAlias("pubDate")
- private String pubDate;
-
- @XStreamAlias("favorite")
- private int favorite;
-
- public String getTitle() {
- return title;
- }
-
- public void setTitle(String title) {
- this.title = title;
- }
-
- public String getUrl() {
- return url;
- }
-
- public void setUrl(String url) {
- this.url = url;
- }
-
- public String getWhere() {
- return where;
- }
-
- public void setWhere(String where) {
- this.where = where;
- }
-
- public int getCommentCount() {
- return commentCount;
- }
-
- public void setCommentCount(int commentCount) {
- this.commentCount = commentCount;
- }
-
- public String getBody() {
- return body;
- }
-
- public void setBody(String body) {
- this.body = body;
- }
-
- public String getAuthor() {
- return authorname;
- }
-
- public void setAuthor(String author) {
- this.authorname = author;
- }
-
- public int getAuthorId() {
- return authoruid;
- }
-
- public void setAuthorId(int authorId) {
- this.authoruid = authorId;
- }
-
- public int getDocumenttype() {
- return documentType;
- }
-
- public void setDocumenttype(int documenttype) {
- this.documentType = documenttype;
- }
-
- public String getPubDate() {
- return pubDate;
- }
-
- public void setPubDate(String pubDate) {
- this.pubDate = pubDate;
- }
-
- public int getFavorite() {
- return favorite;
- }
-
- public void setFavorite(int favorite) {
- this.favorite = favorite;
- }
-}
diff --git a/app/src/main/java/net/oschina/app/bean/BlogCommentList.java b/app/src/main/java/net/oschina/app/bean/BlogCommentList.java
deleted file mode 100644
index c50b632c65526faf220e8d2f5a693f890f440bea..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/bean/BlogCommentList.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package net.oschina.app.bean;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import com.thoughtworks.xstream.annotations.XStreamAlias;
-
-/**
- * 博客评论列表实体类
- * @author FireAnt(http://my.oschina.net/LittleDY)
- * @created 2014年10月17日 上午10:28:04
- *
- */
-@SuppressWarnings("serial")
-@XStreamAlias("oschina")
-public class BlogCommentList extends Entity implements ListEntity {
-
- @XStreamAlias("pagesize")
- private int pageSize;
- @XStreamAlias("allCount")
- private int allCount;
- @XStreamAlias("comments")
- private List commentlist = new ArrayList();
-
- public int getPageSize() {
- return pageSize;
- }
-
- public int getAllCount() {
- return allCount;
- }
-
- public List getCommentlist() {
- return commentlist;
- }
-
- @Override
- public List getList() {
- return commentlist;
- }
-}
diff --git a/app/src/main/java/net/oschina/app/bean/BlogDetail.java b/app/src/main/java/net/oschina/app/bean/BlogDetail.java
deleted file mode 100644
index 97918d7fc6de7bf15262552c727a93d9b633f066..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/bean/BlogDetail.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package net.oschina.app.bean;
-
-import com.thoughtworks.xstream.annotations.XStreamAlias;
-
-/**
- * 博客详情
- * @author FireAnt(http://my.oschina.net/LittleDY)
- * @created 2014年10月15日 上午10:51:11
- *
- */
-@SuppressWarnings("serial")
-@XStreamAlias("oschina")
-public class BlogDetail extends Entity {
-
- @XStreamAlias("blog")
- private Blog blog;
-
- public Blog getBlog() {
- return blog;
- }
-
- public void setBlog(Blog blog) {
- this.blog = blog;
- }
-}
diff --git a/app/src/main/java/net/oschina/app/bean/BlogList.java b/app/src/main/java/net/oschina/app/bean/BlogList.java
deleted file mode 100644
index 80ded41b5e7ccbc37a3ced6b7954f9868d86ac24..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/bean/BlogList.java
+++ /dev/null
@@ -1,67 +0,0 @@
-package net.oschina.app.bean;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import com.thoughtworks.xstream.annotations.XStreamAlias;
-
-/**
- * @author HuangWenwei
- *
- * @date 2014年9月28日
- */
-@SuppressWarnings("serial")
-@XStreamAlias("oschina")
-public class BlogList extends Entity implements ListEntity {
-
- public final static String PREF_READED_BLOG_LIST = "readed_blog_list.pref";
-
- public static final String CATALOG_LATEST = "latest";
- public static final String CATALOG_RECOMMEND = "recommend";
-
- @XStreamAlias("pagesize")
- private int pagesize;
-
- @XStreamAlias("blogs")
- private List bloglist = new ArrayList();
-
- @XStreamAlias("blogsCount")
- private int blogsCount;
-
- public int getPageSize() {
- return pagesize;
- }
-
- public void setPageSize(int pageSize) {
- this.pagesize = pageSize;
- }
-
- public List getBloglist() {
- return bloglist;
- }
-
- public void setBloglist(List bloglist) {
- this.bloglist = bloglist;
- }
-
- @Override
- public List getList() {
- return bloglist;
- }
-
- public int getPagesize() {
- return pagesize;
- }
-
- public void setPagesize(int pagesize) {
- this.pagesize = pagesize;
- }
-
- public int getBlogsCount() {
- return blogsCount;
- }
-
- public void setBlogsCount(int blogsCount) {
- this.blogsCount = blogsCount;
- }
-}
diff --git a/app/src/main/java/net/oschina/app/bean/Comment.java b/app/src/main/java/net/oschina/app/bean/Comment.java
deleted file mode 100644
index ff846d07a40955eea894a63cad266e4e3e5fb2fc..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/bean/Comment.java
+++ /dev/null
@@ -1,287 +0,0 @@
-package net.oschina.app.bean;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-
-import android.os.Parcel;
-import android.os.Parcelable;
-
-import com.thoughtworks.xstream.annotations.XStreamAlias;
-
-/**
- * 评论实体类
- * @author FireAnt(http://my.oschina.net/LittleDY)
- * @created 2014年10月14日 下午3:29:22
- *
- */
-@SuppressWarnings("serial")
-@XStreamAlias("comment")
-public class Comment extends Entity implements Parcelable {
-
- public static final String BUNDLE_KEY_COMMENT = "bundle_key_comment";
- public static final String BUNDLE_KEY_ID = "bundle_key_id";
- public static final String BUNDLE_KEY_CATALOG = "bundle_key_catalog";
- public static final String BUNDLE_KEY_BLOG = "bundle_key_blog";
- public static final String BUNDLE_KEY_OPERATION = "bundle_key_operation";
-
- public static final int OPT_ADD = 1;
- public static final int OPT_REMOVE = 2;
-
- public final static int CLIENT_MOBILE = 2;
- public final static int CLIENT_ANDROID = 3;
- public final static int CLIENT_IPHONE = 4;
- public final static int CLIENT_WINDOWS_PHONE = 5;
-
- @XStreamAlias("portrait")
- private String portrait;
-
- @XStreamAlias("content")
- private String content;
-
- @XStreamAlias("author")
- private String author;
-
- @XStreamAlias("authorid")
- private int authorId;
-
- @XStreamAlias("pubDate")
- private String pubDate;
-
- @XStreamAlias("appclient")
- private int appClient;
-
- @XStreamAlias("replies")
- private List replies = new ArrayList();
-
- @XStreamAlias("refers")
- private List refers = new ArrayList();
-
- @SuppressWarnings("unchecked")
- public Comment(Parcel source) {
- id = source.readInt();
- portrait = source.readString();
- author = source.readString();
- authorId = source.readInt();
- pubDate = source.readString();
- appClient = source.readInt();
- content = source.readString();
-
- replies = source.readArrayList(Reply.class.getClassLoader());
- refers = source.readArrayList(Refer.class.getClassLoader());
- }
-
- @Override
- public void writeToParcel(Parcel dest, int flags) {
- dest.writeInt(id);
- dest.writeString(portrait);
- dest.writeString(author);
- dest.writeInt(authorId);
- dest.writeString(pubDate);
- dest.writeInt(appClient);
- dest.writeString(content);
-
- dest.writeList(replies);
- dest.writeList(refers);
- }
-
- @Override
- public int describeContents() {
- return 0;
- }
-
- public String getPortrait() {
- return portrait;
- }
-
- public void setPortrait(String portrait) {
- this.portrait = portrait;
- }
-
- public String getContent() {
- return content;
- }
-
- public void setContent(String content) {
- this.content = content;
- }
-
- public String getAuthor() {
- return author;
- }
-
- public void setAuthor(String author) {
- this.author = author;
- }
-
- public int getAuthorId() {
- return authorId;
- }
-
- public void setAuthorId(int authorId) {
- this.authorId = authorId;
- }
-
- public String getPubDate() {
- return pubDate;
- }
-
- public void setPubDate(String pubDate) {
- this.pubDate = pubDate;
- }
-
- public int getAppClient() {
- return appClient;
- }
-
- public void setAppClient(int appClient) {
- this.appClient = appClient;
- }
-
- public List getReplies() {
- return replies;
- }
-
- public void setReplies(List replies) {
- this.replies = replies;
- }
-
- public List getRefers() {
- return refers;
- }
-
- public void setRefers(List refers) {
- this.refers = refers;
- }
-
- @XStreamAlias("reply")
- public static class Reply implements Serializable, Parcelable {
- @XStreamAlias("rauthor")
- public String rauthor;
- @XStreamAlias("rpubDate")
- public String rpubDate;
- @XStreamAlias("rcontent")
- public String rcontent;
-
- public Reply() {
- }
-
- public Reply(Parcel source) {
- rauthor = source.readString();
- rpubDate = source.readString();
- rcontent = source.readString();
- }
-
- public String getRauthor() {
- return rauthor;
- }
- public void setRauthor(String rauthor) {
- this.rauthor = rauthor;
- }
- public String getRpubDate() {
- return rpubDate;
- }
- public void setRpubDate(String rpubDate) {
- this.rpubDate = rpubDate;
- }
- public String getRcontent() {
- return rcontent;
- }
- public void setRcontent(String rcontent) {
- this.rcontent = rcontent;
- }
-
- @Override
- public void writeToParcel(Parcel dest, int flags) {
- dest.writeString(rauthor);
- dest.writeString(rpubDate);
- dest.writeString(rcontent);
- }
-
- @Override
- public int describeContents() {
- return 0;
- }
-
- public static final Parcelable.Creator CREATOR = new Creator() {
-
- @Override
- public Reply[] newArray(int size) {
- return new Reply[size];
- }
-
- @Override
- public Reply createFromParcel(Parcel source) {
- return new Reply(source);
- }
- };
-
- }
-
- @XStreamAlias("refer")
- public static class Refer implements Serializable, Parcelable {
-
- @XStreamAlias("refertitle")
- public String refertitle;
- @XStreamAlias("referbody")
- public String referbody;
-
- public Refer() {
- }
-
- public Refer(Parcel source) {
- referbody = source.readString();
- refertitle = source.readString();
- }
-
- public String getRefertitle() {
- return refertitle;
- }
- public void setRefertitle(String refertitle) {
- this.refertitle = refertitle;
- }
- public String getReferbody() {
- return referbody;
- }
- public void setReferbody(String referbody) {
- this.referbody = referbody;
- }
-
- @Override
- public void writeToParcel(Parcel dest, int flags) {
- dest.writeString(referbody);
- dest.writeString(refertitle);
- }
-
- @Override
- public int describeContents() {
- return 0;
- }
-
- public static final Parcelable.Creator CREATOR = new Creator() {
-
- @Override
- public Refer[] newArray(int size) {
- return new Refer[size];
- }
-
- @Override
- public Refer createFromParcel(Parcel source) {
- return new Refer(source);
- }
- };
- }
-
- public static final Parcelable.Creator CREATOR = new Creator() {
-
- @Override
- public Comment[] newArray(int size) {
- return new Comment[size];
- }
-
- @Override
- public Comment createFromParcel(Parcel source) {
- return new Comment(source);
- }
- };
-}
diff --git a/app/src/main/java/net/oschina/app/bean/CommentList.java b/app/src/main/java/net/oschina/app/bean/CommentList.java
deleted file mode 100644
index 0b19aa56556782a2253332b40629e1f65d5485a8..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/bean/CommentList.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package net.oschina.app.bean;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-
-import com.thoughtworks.xstream.annotations.XStreamAlias;
-
-/**
- * 评论列表实体类
- *
- * @author FireAnt(http://my.oschina.net/LittleDY)
- * @created 2014年10月14日 下午3:32:39
- *
- */
-@SuppressWarnings("serial")
-@XStreamAlias("oschina")
-public class CommentList extends Entity implements ListEntity {
-
- public final static int CATALOG_NEWS = 1;
- public final static int CATALOG_POST = 2;
- public final static int CATALOG_TWEET = 3;
- public final static int CATALOG_ACTIVE = 4;
- public final static int CATALOG_MESSAGE = 4;// 动态与留言都属于消息中心
-
- @XStreamAlias("pagesize")
- private int pageSize;
- @XStreamAlias("allCount")
- private int allCount;
- @XStreamAlias("comments")
- private final List commentlist = new ArrayList();
-
- public int getPageSize() {
- return pageSize;
- }
-
- public int getAllCount() {
- return allCount;
- }
-
- public List getCommentlist() {
- return commentlist;
- }
-
- @Override
- public List getList() {
- return commentlist;
- }
-
- public void sortList() {
- Collections.sort(commentlist, new Comparator() {
-
- @Override
- public int compare(Comment lhs, Comment rhs) {
- return lhs.getPubDate().compareTo(rhs.getPubDate());
- }
- });
- }
-}
diff --git a/app/src/main/java/net/oschina/app/bean/Constants.java b/app/src/main/java/net/oschina/app/bean/Constants.java
deleted file mode 100644
index edaf5cc4f35c0c42794998771af0e85aa68053ee..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/bean/Constants.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package net.oschina.app.bean;
-
-/**
- * 常量类
- *
- * @author FireAnt(http://my.oschina.net/LittleDY)
- * @version 创建时间:2014年10月27日 下午12:14:42
- *
- */
-
-public class Constants {
-
- public static final String INTENT_ACTION_USER_CHANGE = "net.oschina.action.USER_CHANGE";
-
- public static final String INTENT_ACTION_COMMENT_CHANGED = "net.oschina.action.COMMENT_CHANGED";
-
- public static final String INTENT_ACTION_NOTICE = "net.oschina.action.APPWIDGET_UPDATE";
-
- public static final String INTENT_ACTION_LOGOUT = "net.oschina.action.LOGOUT";
-
- public static final String WEICHAT_APPID = "wxa8213dc827399101";
- public static final String WEICHAT_SECRET = "5c716417ce72ff69d8cf0c43572c9284";
-
- public static final String QQ_APPID = "100942993";
- public static final String QQ_APPKEY = "8edd3cc7ca8dcc15082d6fe75969601b";
-}
diff --git a/app/src/main/java/net/oschina/app/bean/Entity.java b/app/src/main/java/net/oschina/app/bean/Entity.java
deleted file mode 100644
index 60fdf96e4cdc0b41d34925615e87a81cd3c7da7f..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/bean/Entity.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package net.oschina.app.bean;
-
-import com.thoughtworks.xstream.annotations.XStreamAlias;
-
-/**
- * 实体类
- *
- * @author liux (http://my.oschina.net/liux)
- * @version 1.0
- * @created 2012-3-21
- */
-@SuppressWarnings("serial")
-public abstract class Entity extends Base {
-
- @XStreamAlias("id")
- protected int id;
-
- protected String cacheKey;
-
- public int getId() {
- return id;
- }
-
- public void setId(int id) {
- this.id = id;
- }
-
- public String getCacheKey() {
- return cacheKey;
- }
-
- public void setCacheKey(String cacheKey) {
- this.cacheKey = cacheKey;
- }
-}
diff --git a/app/src/main/java/net/oschina/app/bean/Event.java b/app/src/main/java/net/oschina/app/bean/Event.java
deleted file mode 100644
index 25c50e8a348e0d3b031cb6d4748f479f38640326..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/bean/Event.java
+++ /dev/null
@@ -1,186 +0,0 @@
-package net.oschina.app.bean;
-
-import com.thoughtworks.xstream.annotations.XStreamAlias;
-
-/**
- * 活动实体类
- *
- * @author FireAnt(http://my.oschina.net/LittleDY)
- * @version 创建时间:2014年12月12日 下午3:18:08
- *
- */
-@SuppressWarnings("serial")
-@XStreamAlias("event")
-public class Event extends Entity {
-
- public final static int EVNET_STATUS_APPLYING = 0x02;
- public final static int EVNET_STATUS_END = 0x01;
-
- public final static int APPLYSTATUS_CHECKING = 0x00;// 审核中
- public final static int APPLYSTATUS_CHECKED = 0x01;// 已经确认
- public final static int APPLYSTATUS_ATTEND = 0x02;// 已经出席
- public final static int APPLYSTATUS_CANCLE = 0x03;// 已取消
- public final static int APPLYSTATUS_REJECT = 0X04;// 已拒绝
-
- @XStreamAlias("cover")
- private String cover;
-
- @XStreamAlias("title")
- private String title;
-
- @XStreamAlias("url")
- private String url;
-
- @XStreamAlias("createTime")
- private String createTime;
-
- @XStreamAlias("startTime")
- private String startTime;
-
- @XStreamAlias("endTime")
- private String endTime;
-
- @XStreamAlias("spot")
- private String spot;
-
- @XStreamAlias("actor_count")
- private int actor_count;
-
- @XStreamAlias("location")
- private String location;
-
- @XStreamAlias("city")
- private String city;
-
- @XStreamAlias("status")
- private int status;
-
- @XStreamAlias("applyStatus")
- private int applyStatus;
-
- @XStreamAlias("category")
- private int category;// 活动类型 1源创会 2技术交流 3其他 4站外活动
-
- @XStreamAlias("remark")
- private EventRemark eventRemark;
-
- public int getCategory() {
- return category;
- }
-
- public void setCategory(int category) {
- this.category = category;
- }
-
- public String getCity() {
- return city;
- }
-
- public void setCity(String city) {
- this.city = city;
- }
-
- public int getId() {
- return id;
- }
-
- public void setId(int id) {
- this.id = id;
- }
-
- public String getCover() {
- return cover;
- }
-
- public void setCover(String cover) {
- this.cover = cover;
- }
-
- public String getTitle() {
- return title;
- }
-
- public void setTitle(String title) {
- this.title = title;
- }
-
- public String getUrl() {
- return url;
- }
-
- public void setUrl(String url) {
- this.url = url;
- }
-
- public String getCreateTime() {
- return createTime;
- }
-
- public void setCreateTime(String createTime) {
- this.createTime = createTime;
- }
-
- public String getStartTime() {
- return startTime;
- }
-
- public void setStartTime(String startTime) {
- this.startTime = startTime;
- }
-
- public String getEndTime() {
- return endTime;
- }
-
- public void setEndTime(String endTime) {
- this.endTime = endTime;
- }
-
- public String getSpot() {
- return spot;
- }
-
- public void setSpot(String spot) {
- this.spot = spot;
- }
-
- public int getActor_count() {
- return actor_count;
- }
-
- public void setActor_count(int actor_count) {
- this.actor_count = actor_count;
- }
-
- public String getLocation() {
- return location;
- }
-
- public void setLocation(String location) {
- this.location = location;
- }
-
- public int getStatus() {
- return status;
- }
-
- public void setStatus(int status) {
- this.status = status;
- }
-
- public int getApplyStatus() {
- return applyStatus;
- }
-
- public void setApplyStatus(int applyStatus) {
- this.applyStatus = applyStatus;
- }
-
- public EventRemark getEventRemark() {
- return eventRemark;
- }
-
- public void setEventRemark(EventRemark eventRemark) {
- this.eventRemark = eventRemark;
- }
-}
diff --git a/app/src/main/java/net/oschina/app/bean/EventAppliesList.java b/app/src/main/java/net/oschina/app/bean/EventAppliesList.java
deleted file mode 100644
index 9ac5dfb07e6f4d1af7bcad55b6a0730c519bf26c..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/bean/EventAppliesList.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package net.oschina.app.bean;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import com.thoughtworks.xstream.annotations.XStreamAlias;
-
-/**
- * 活动参与者列表实体类
- *
- * @author FireAnt(http://my.oschina.net/LittleDY)
- * @created 2014年12月12日 下午8:06:30
- *
- */
-@SuppressWarnings("serial")
-@XStreamAlias("oschina")
-public class EventAppliesList extends Entity implements ListEntity {
-
- public final static int TYPE_FANS = 0x00;
- public final static int TYPE_FOLLOWER = 0x01;
-
- @XStreamAlias("applies")
- private List list = new ArrayList();
-
- @Override
- public List getList() {
- return list;
- }
-
- public void setList(List list) {
- this.list = list;
- }
-}
diff --git a/app/src/main/java/net/oschina/app/bean/EventApplyData.java b/app/src/main/java/net/oschina/app/bean/EventApplyData.java
deleted file mode 100644
index 89a6a5d65384f20f1723ff2d7ae27612679074ea..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/bean/EventApplyData.java
+++ /dev/null
@@ -1,92 +0,0 @@
-package net.oschina.app.bean;
-
-/**
- * 活动报名实体类
- *
- * @author FireAnt(http://my.oschina.net/LittleDY)
- * @created 2014年12月17日 下午3:13:07
- *
- */
-@SuppressWarnings("serial")
-public class EventApplyData extends Entity {
-
- private int event;// 活动的id
-
- private int user;// 用户的id
-
- private String name;// 名字
-
- private String gender;// 性别
-
- private String mobile;// 电话
-
- private String company;// 单位名称
-
- private String job;// 职业名称
-
- private String remark;// 备注
-
- public int getEvent() {
- return event;
- }
-
- public void setEvent(int event) {
- this.event = event;
- }
-
- public int getUser() {
- return user;
- }
-
- public void setUser(int user) {
- this.user = user;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getGender() {
- return gender;
- }
-
- public void setGender(String gender) {
- this.gender = gender;
- }
-
- public String getPhone() {
- return mobile;
- }
-
- public void setPhone(String phone) {
- this.mobile = phone;
- }
-
- public String getCompany() {
- return company;
- }
-
- public void setCompany(String company) {
- this.company = company;
- }
-
- public String getJob() {
- return job;
- }
-
- public void setJob(String job) {
- this.job = job;
- }
-
- public String getRemark() {
- return remark;
- }
-
- public void setRemark(String remark) {
- this.remark = remark;
- }
-}
diff --git a/app/src/main/java/net/oschina/app/bean/EventList.java b/app/src/main/java/net/oschina/app/bean/EventList.java
deleted file mode 100644
index ad2f80a5fb4518b79848169015c4035c034b890f..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/bean/EventList.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package net.oschina.app.bean;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import com.thoughtworks.xstream.annotations.XStreamAlias;
-
-/**
- * 活动实体类列表
- *
- * @author FireAnt(http://my.oschina.net/LittleDY)
- * @created 2014年12月10日 下午2:28:54
- *
- */
-@SuppressWarnings("serial")
-@XStreamAlias("oschina")
-public class EventList extends Entity implements ListEntity {
-
- public final static int EVENT_LIST_TYPE_NEW_EVENT = 0X00;// 近期活动
-
- public final static int EVENT_LIST_TYPE_MY_EVENT = 0X01;// 我的活动
-
- @XStreamAlias("events")
- private List friendlist = new ArrayList();
-
- public List getFriendlist() {
- return friendlist;
- }
-
- public void setFriendlist(List resultlist) {
- this.friendlist = resultlist;
- }
-
- @Override
- public List getList() {
- return friendlist;
- }
-}
diff --git a/app/src/main/java/net/oschina/app/bean/EventRemark.java b/app/src/main/java/net/oschina/app/bean/EventRemark.java
deleted file mode 100644
index f0242a22fb48d11155c3795faa1d80e03a5c0fb6..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/bean/EventRemark.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package net.oschina.app.bean;
-
-import com.thoughtworks.xstream.annotations.XStreamAlias;
-import com.thoughtworks.xstream.annotations.XStreamImplicit;
-
-import java.io.Serializable;
-import java.util.List;
-
-/**
- * 活动备注选择
- * Created by zhangdeyi on 15/8/19.
- */
-@XStreamAlias("remark")
-public class EventRemark implements Serializable {
-
- @XStreamAlias("remarkTip")
- private String remarkTip;
-
- @XStreamAlias("remarkSelect")
- private RemarksSelet select;
-
- public class RemarksSelet implements Serializable {
- @XStreamImplicit(itemFieldName = "select")
- private List list;
-
- public List getList() {
- return list;
- }
-
- public void setList(List list) {
- this.list = list;
- }
-
- }
-
- public String getRemarkTip() {
- return remarkTip;
- }
-
- public void setRemarkTip(String remarkTip) {
- this.remarkTip = remarkTip;
- }
-
- public RemarksSelet getSelect() {
- return select;
- }
-
- public void setSelect(RemarksSelet select) {
- this.select = select;
- }
-}
diff --git a/app/src/main/java/net/oschina/app/bean/Favorite.java b/app/src/main/java/net/oschina/app/bean/Favorite.java
deleted file mode 100644
index d229ffdb478acfdce9b74c49dae37a96fbe3cfb4..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/bean/Favorite.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package net.oschina.app.bean;
-
-import com.thoughtworks.xstream.annotations.XStreamAlias;
-
-/**
- * 收藏实体类
- * @author hww
- *
- */
-@SuppressWarnings("serial")
-@XStreamAlias("favorite")
-public class Favorite extends Entity {
-
- public static final int CATALOG_ALL = 0;
- public static final int CATALOG_SOFTWARE = 1;
- public static final int CATALOG_TOPIC = 2;
- public static final int CATALOG_BLOGS = 3;
- public static final int CATALOG_NEWS = 4;
- public static final int CATALOG_CODE = 5;
-
- @XStreamAlias("objid")
- public int id;
- @XStreamAlias("type")
- public int type;
- @XStreamAlias("title")
- public String title;
- @XStreamAlias("url")
- public String url;
- public int getId() {
- return id;
- }
- public void setId(int id) {
- this.id = id;
- }
- public int getType() {
- return type;
- }
- public void setType(int type) {
- this.type = type;
- }
- public String getTitle() {
- return title;
- }
- public void setTitle(String title) {
- this.title = title;
- }
- public String getUrl() {
- return url;
- }
- public void setUrl(String url) {
- this.url = url;
- }
-
-}
diff --git a/app/src/main/java/net/oschina/app/bean/FavoriteList.java b/app/src/main/java/net/oschina/app/bean/FavoriteList.java
deleted file mode 100644
index 513eb64a430dd331f2a57b4e2b6c90b2de4f0101..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/bean/FavoriteList.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package net.oschina.app.bean;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import com.thoughtworks.xstream.annotations.XStreamAlias;
-
-/**
- * 收藏实体类
- * @author FireAnt(http://my.oschina.net/LittleDY)
- * @created 2014年10月14日 下午2:27:39
- *
- */
-@SuppressWarnings("serial")
-@XStreamAlias("oschina")
-public class FavoriteList extends Entity implements ListEntity {
-
- public final static int TYPE_ALL = 0x00;
- public final static int TYPE_SOFTWARE = 0x01;
- public final static int TYPE_POST = 0x02;
- public final static int TYPE_BLOG = 0x03;
- public final static int TYPE_NEWS = 0x04;
- public final static int TYPE_CODE = 0x05;
-
- @XStreamAlias("pagesize")
- private int pageSize;
- @XStreamAlias("favorites")
- private List favoritelist = new ArrayList();
-
- public int getPageSize() {
- return pageSize;
- }
-
- public void setPageSize(int pagesize) {
- this.pageSize = pagesize;
- }
-
- public List getFavoritelist() {
- return favoritelist;
- }
-
- public void setFavoritelist(List favoritelist) {
- this.favoritelist = favoritelist;
- }
-
- @Override
- public List getList() {
- return favoritelist;
- }
-}
diff --git a/app/src/main/java/net/oschina/app/bean/FindUserList.java b/app/src/main/java/net/oschina/app/bean/FindUserList.java
deleted file mode 100644
index 165884e018ef145701c596b562db6c377da34b60..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/bean/FindUserList.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package net.oschina.app.bean;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import com.thoughtworks.xstream.annotations.XStreamAlias;
-
-/**
- * 好友实体类
- *
- * @author FireAnt(http://my.oschina.net/LittleDY)
- * @created 2014年11月6日 上午11:17:36
- *
- */
-@SuppressWarnings("serial")
-@XStreamAlias("oschina")
-public class FindUserList extends Entity implements ListEntity {
-
- public final static int TYPE_FANS = 0x00;
- public final static int TYPE_FOLLOWER = 0x01;
-
- @XStreamAlias("users")
- private List friendlist = new ArrayList();
-
- public List getFriendlist() {
- return friendlist;
- }
-
- public void setFriendlist(List resultlist) {
- this.friendlist = resultlist;
- }
-
- @Override
- public List getList() {
- return friendlist;
- }
-}
diff --git a/app/src/main/java/net/oschina/app/bean/Friend.java b/app/src/main/java/net/oschina/app/bean/Friend.java
deleted file mode 100644
index eeaa23adbfeea11100c4ac6534f700c3d2114b30..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/bean/Friend.java
+++ /dev/null
@@ -1,81 +0,0 @@
-package net.oschina.app.bean;
-
-import com.thoughtworks.xstream.annotations.XStreamAlias;
-
-/**
- * 好友实体类
- *
- * @author FireAnt(http://my.oschina.net/LittleDY)
- * @created 2014年11月6日 上午11:37:31
- *
- */
-@SuppressWarnings("serial")
-@XStreamAlias("friend")
-public class Friend extends Entity {
-
- @XStreamAlias("userid")
- private int userid;
-
- @XStreamAlias("name")
- private String name;
-
- @XStreamAlias("from")
- private String from;
-
- @XStreamAlias("portrait")
- private String portrait;
-
- @XStreamAlias("expertise")
- private String expertise;
-
- @XStreamAlias("gender")
- private int gender;
-
- public int getUserid() {
- return userid;
- }
-
- public void setUserid(int userid) {
- this.userid = userid;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getFrom() {
- return from;
- }
-
- public void setFrom(String from) {
- this.from = from;
- }
-
- public String getPortrait() {
- return portrait;
- }
-
- public void setPortrait(String portrait) {
- this.portrait = portrait;
- }
-
- public String getExpertise() {
- return expertise;
- }
-
- public void setExpertise(String expertise) {
- this.expertise = expertise;
- }
-
- public int getGender() {
- return gender;
- }
-
- public void setGender(int gender) {
- this.gender = gender;
- }
-}
diff --git a/app/src/main/java/net/oschina/app/bean/FriendsList.java b/app/src/main/java/net/oschina/app/bean/FriendsList.java
deleted file mode 100644
index 9c73190f12d51382d58166bf1bf54dec000699e4..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/bean/FriendsList.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package net.oschina.app.bean;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import com.thoughtworks.xstream.annotations.XStreamAlias;
-
-/**
- * 好友实体类
- *
- * @author FireAnt(http://my.oschina.net/LittleDY)
- * @created 2014年11月6日 上午11:17:36
- *
- */
-@SuppressWarnings("serial")
-@XStreamAlias("oschina")
-public class FriendsList extends Entity implements ListEntity {
-
- public final static int TYPE_FANS = 0x00;
- public final static int TYPE_FOLLOWER = 0x01;
-
- @XStreamAlias("friends")
- private List friendlist = new ArrayList();
-
- public List getFriendlist() {
- return friendlist;
- }
-
- public void setFriendlist(List resultlist) {
- this.friendlist = resultlist;
- }
-
- @Override
- public List getList() {
- return friendlist;
- }
-}
diff --git a/app/src/main/java/net/oschina/app/bean/ListEntity.java b/app/src/main/java/net/oschina/app/bean/ListEntity.java
deleted file mode 100644
index 1581e070716d766a49927dbe403943fafe4cd249..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/bean/ListEntity.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package net.oschina.app.bean;
-
-import java.io.Serializable;
-import java.util.List;
-
-public interface ListEntity extends Serializable {
-
- public List getList();
-}
diff --git a/app/src/main/java/net/oschina/app/bean/LoginUserBean.java b/app/src/main/java/net/oschina/app/bean/LoginUserBean.java
deleted file mode 100644
index a6d7ac9a4b4252b296f2713a60e3491ce6cb4a38..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/bean/LoginUserBean.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package net.oschina.app.bean;
-
-import com.thoughtworks.xstream.annotations.XStreamAlias;
-
-/**
- * @author FireAnt(http://my.oschina.net/LittleDY)
- * @version 创建时间:2014年9月27日 下午2:45:57
- *
- */
-
-@SuppressWarnings("serial")
-@XStreamAlias("oschina")
-public class LoginUserBean extends Entity {
-
- @XStreamAlias("result")
- private Result result;
-
- @XStreamAlias("user")
- private User user;
-
- public Result getResult() {
- return result;
- }
-
- public void setResult(Result result) {
- this.result = result;
- }
-
- public User getUser() {
- return user;
- }
-
- public void setUser(User user) {
- this.user = user;
- }
-
-}
\ No newline at end of file
diff --git a/app/src/main/java/net/oschina/app/bean/MessageDetail.java b/app/src/main/java/net/oschina/app/bean/MessageDetail.java
deleted file mode 100644
index 222440b4dfeb5587085c61cdeaa9064704d60023..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/bean/MessageDetail.java
+++ /dev/null
@@ -1,115 +0,0 @@
-package net.oschina.app.bean;
-
-import com.thoughtworks.xstream.annotations.XStreamAlias;
-
-/**
- * 聊天详细信息实体类
- * @author 铂金小鸟(http://my.oschina.net/fants)
- * @Created 2015年9月16日 上午4:20:01
- */
-@SuppressWarnings("serial")
-@XStreamAlias("message")
-public class MessageDetail extends Entity {
-
- //是否显示时间
- private boolean showDate;
- //消息状态
- private MessageStatus status;
-
- @XStreamAlias("portrait")
- private String portrait;
-
- @XStreamAlias("author")
- private String author;
-
- @XStreamAlias("authorid")
- private int authorId;
-
- @XStreamAlias("content")
- private String content;
-
- @XStreamAlias("fileName")
- private String fileName;
-
- @XStreamAlias("btype")
- private int btype;
-
- @XStreamAlias("pubDate")
- private String pubDate;
-
- public enum MessageStatus{
- NORMAL,SENDING,ERROR
- }
-
- public String getPortrait() {
- return portrait;
- }
-
- public void setPortrait(String portrait) {
- this.portrait = portrait;
- }
-
- public String getAuthor() {
- return author;
- }
-
- public void setAuthor(String author) {
- this.author = author;
- }
-
- public int getAuthorId() {
- return authorId;
- }
-
- public void setAuthorId(int authorId) {
- this.authorId = authorId;
- }
-
- public String getContent() {
- return content;
- }
-
- public void setContent(String content) {
- this.content = content;
- }
-
- public String getFileName() {
- return fileName;
- }
-
- public void setFileName(String fileName) {
- this.fileName = fileName;
- }
-
- public int getBtype() {
- return btype;
- }
-
- public void setBtype(int btype) {
- this.btype = btype;
- }
-
- public String getPubDate() {
- return pubDate;
- }
-
- public void setPubDate(String pubDate) {
- this.pubDate = pubDate;
- }
-
- public boolean isShowDate() {
- return showDate;
- }
-
- public void setShowDate(boolean showDate) {
- this.showDate = showDate;
- }
-
- public MessageStatus getStatus() {
- return status;
- }
-
- public void setStatus(MessageStatus status) {
- this.status = status;
- }
-}
diff --git a/app/src/main/java/net/oschina/app/bean/MessageDetailList.java b/app/src/main/java/net/oschina/app/bean/MessageDetailList.java
deleted file mode 100644
index 7684a8dcbbd88ad051b11955f14f7f1c651a917b..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/bean/MessageDetailList.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package net.oschina.app.bean;
-
-import com.thoughtworks.xstream.annotations.XStreamAlias;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * 聊天详细信息实体类
- * @author 铂金小鸟(http://my.oschina.net/fants)
- * @Created 2015年9月16日 上午4:20:01
- */
-@SuppressWarnings("serial")
-@XStreamAlias("oschina")
-public class MessageDetailList extends Entity implements ListEntity {
-
- @XStreamAlias("allCount")
- private int allCount;
-
- @XStreamAlias("pagesize")
- private int pageSize;
-
- @XStreamAlias("messages")
- private List messagelist = new ArrayList();
-
- public int getPageSize() {
- return pageSize;
- }
-
- public int getMessageCount() {
- return allCount;
- }
-
- public List getMessagelist() {
- return messagelist;
- }
-
- @Override
- public List getList() {
- return messagelist;
- }
-
-}
diff --git a/app/src/main/java/net/oschina/app/bean/MessageList.java b/app/src/main/java/net/oschina/app/bean/MessageList.java
deleted file mode 100644
index 63cb67eb4fddc6f98cf61ac0c0d11448cde479c4..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/bean/MessageList.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package net.oschina.app.bean;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import com.thoughtworks.xstream.annotations.XStreamAlias;
-
-/**
- * 留言实体类列表
- * @author FireAnt(http://my.oschina.net/LittleDY)
- * @created 2014年10月22日 下午4:38:49
- *
- */
-@SuppressWarnings("serial")
-@XStreamAlias("oschina")
-public class MessageList extends Entity implements ListEntity {
-
- @XStreamAlias("pagesize")
- private int pageSize;
-
- @XStreamAlias("messageCount")
- private int messageCount;
-
- @XStreamAlias("messages")
- private List messagelist = new ArrayList();
-
- public int getPageSize() {
- return pageSize;
- }
-
- public int getMessageCount() {
- return messageCount;
- }
-
- public List getMessagelist() {
- return messagelist;
- }
-
- @Override
- public List getList() {
- return messagelist;
- }
-}
diff --git a/app/src/main/java/net/oschina/app/bean/Messages.java b/app/src/main/java/net/oschina/app/bean/Messages.java
deleted file mode 100644
index e004f82dc910fc1460c5635eb5ce177fb6fb53b5..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/bean/Messages.java
+++ /dev/null
@@ -1,118 +0,0 @@
-package net.oschina.app.bean;
-
-import com.thoughtworks.xstream.annotations.XStreamAlias;
-
-/**
- * 留言实体类
- * @author FireAnt(http://my.oschina.net/LittleDY)
- * @created 2014年10月22日 下午4:43:01
- *
- */
-@SuppressWarnings("serial")
-@XStreamAlias("message")
-public class Messages extends Entity {
-
- public final static int CLIENT_MOBILE = 2;
- public final static int CLIENT_ANDROID = 3;
- public final static int CLIENT_IPHONE = 4;
- public final static int CLIENT_WINDOWS_PHONE = 5;
-
- @XStreamAlias("portrait")
- private String portrait;
-
- @XStreamAlias("friendid")
- private int friendId;
-
- @XStreamAlias("friendname")
- private String friendName;
-
- @XStreamAlias("sender")
- private String sender;
-
- @XStreamAlias("senderid")
- private int senderId;
-
- @XStreamAlias("content")
- private String content;
-
- @XStreamAlias("messageCount")
- private int messageCount;
-
- @XStreamAlias("pubDate")
- private String pubDate;
-
- @XStreamAlias("appClient")
- private int appClient;
-
- public String getPortrait() {
- return portrait;
- }
-
- public void setPortrait(String portrait) {
- this.portrait = portrait;
- }
-
- public int getFriendId() {
- return friendId;
- }
-
- public void setFriendId(int friendId) {
- this.friendId = friendId;
- }
-
- public String getFriendName() {
- return friendName;
- }
-
- public void setFriendName(String friendName) {
- this.friendName = friendName;
- }
-
- public String getSender() {
- return sender;
- }
-
- public void setSender(String sender) {
- this.sender = sender;
- }
-
- public int getSenderId() {
- return senderId;
- }
-
- public void setSenderId(int senderId) {
- this.senderId = senderId;
- }
-
- public String getContent() {
- return content;
- }
-
- public void setContent(String content) {
- this.content = content;
- }
-
- public int getMessageCount() {
- return messageCount;
- }
-
- public void setMessageCount(int messageCount) {
- this.messageCount = messageCount;
- }
-
- public String getPubDate() {
- return pubDate;
- }
-
- public void setPubDate(String pubDate) {
- this.pubDate = pubDate;
- }
-
- public int getAppClient() {
- return appClient;
- }
-
- public void setAppClient(int appClient) {
- this.appClient = appClient;
- }
-}
diff --git a/app/src/main/java/net/oschina/app/bean/MyInformation.java b/app/src/main/java/net/oschina/app/bean/MyInformation.java
deleted file mode 100644
index 91a2bf214ead1ec8eedd2b12918ec9f5ec21091d..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/bean/MyInformation.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package net.oschina.app.bean;
-
-import com.thoughtworks.xstream.annotations.XStreamAlias;
-
-/**
- * 我的资料实体类
- * @author FireAnt(http://my.oschina.net/LittleDY)
- * @version 创建时间:2014年10月30日 下午4:08:30
- *
- */
-
-@SuppressWarnings("serial")
-@XStreamAlias("oschina")
-public class MyInformation extends Base {
-
- @XStreamAlias("user")
- private User user;
-
- public User getUser() {
- return user;
- }
-
- public void setUser(User user) {
- this.user = user;
- }
-}
diff --git a/app/src/main/java/net/oschina/app/bean/News.java b/app/src/main/java/net/oschina/app/bean/News.java
deleted file mode 100644
index fb1ab9a00181c2bd2070bb3b406d3f5a146ec6e9..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/bean/News.java
+++ /dev/null
@@ -1,225 +0,0 @@
-package net.oschina.app.bean;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-
-import net.oschina.app.util.StringUtils;
-
-import com.thoughtworks.xstream.annotations.XStreamAlias;
-
-/**
- * 新闻、软件、帖子、博客实体类
- * @author FireAnt(http://my.oschina.net/LittleDY)
- * @created 2014年9月28日 上午10:16:59
- *
- */
-@SuppressWarnings("serial")
-@XStreamAlias("news")
-public class News extends Entity {
-
- public final static int NEWSTYPE_NEWS = 0x00;//0 新闻
- public final static int NEWSTYPE_SOFTWARE = 0x01;//1 软件
- public final static int NEWSTYPE_POST = 0x02;//2 帖子
- public final static int NEWSTYPE_BLOG = 0x03;//3 博客
-
- @XStreamAlias("title")
- private String title;
-
- @XStreamAlias("url")
- private String url;
-
- @XStreamAlias("body")
- private String body;
-
- @XStreamAlias("author")
- private String author;
-
- @XStreamAlias("authorid")
- private int authorId;
-
- @XStreamAlias("commentcount")
- private int commentCount;
-
- @XStreamAlias("pubdate")
- private String pubDate;
-
- @XStreamAlias("softwarelink")
- private String softwareLink;
-
- @XStreamAlias("softwarename")
- private String softwareName;
-
- @XStreamAlias("favorite")
- private int favorite;
-
- @XStreamAlias("newstype")
- private NewsType newsType;
-
- @XStreamAlias("relativies")
- private List relatives = new ArrayList();
-
- public int getId() {
- return id;
- }
-
- public void setId(int id) {
- this.id = id;
- }
-
- public String getTitle() {
- return title;
- }
-
- public void setTitle(String title) {
- this.title = title;
- }
-
- public String getUrl() {
- return url;
- }
-
- public void setUrl(String url) {
- this.url = url;
- }
-
- public String getBody() {
- return body;
- }
-
- public void setBody(String body) {
- this.body = body;
- }
-
- public String getAuthor() {
- return author;
- }
-
- public void setAuthor(String author) {
- this.author = author;
- }
-
- public int getAuthorId() {
- return authorId;
- }
-
- public void setAuthorId(String authorId) {
- this.authorId = StringUtils.toInt(authorId, 0);
- }
-
- public int getCommentCount() {
- return commentCount;
- }
-
- public void setCommentCount(int commentCount) {
- this.commentCount = commentCount;
- }
-
- public String getPubDate() {
- return pubDate;
- }
-
- public void setPubDate(String pubDate) {
- this.pubDate = pubDate;
- }
-
- public String getSoftwareLink() {
- return softwareLink;
- }
-
- public void setSoftwareLink(String softwareLink) {
- this.softwareLink = softwareLink;
- }
-
- public String getSoftwareName() {
- return softwareName;
- }
-
- public void setSoftwareName(String softwareName) {
- this.softwareName = softwareName;
- }
-
- public int getFavorite() {
- return favorite;
- }
-
- public void setFavorite(int favorite) {
- this.favorite = favorite;
- }
-
- public NewsType getNewType() {
- return newsType;
- }
-
- public void setNewType(NewsType newType) {
- this.newsType = newType;
- }
-
- public List getRelatives() {
- return relatives;
- }
-
- public void setRelatives(List relatives) {
- this.relatives = relatives;
- }
-
- @XStreamAlias("newstype")
- public class NewsType implements Serializable{
- @XStreamAlias("type")
- private int type;
- @XStreamAlias("attachment")
- private String attachment;
- @XStreamAlias("authoruid2")
- private int authoruid2;
- @XStreamAlias("eventurl")
- private String eventUrl;
-
- public String getEventUrl() {
- return eventUrl;
- }
- public void setEventUrl(String eventUrl) {
- this.eventUrl = eventUrl;
- }
- public int getType() {
- return type;
- }
- public void setType(int type) {
- this.type = type;
- }
- public String getAttachment() {
- return attachment;
- }
- public void setAttachment(String attachment) {
- this.attachment = attachment;
- }
- public int getAuthoruid2() {
- return authoruid2;
- }
- public void setAuthoruid2(int authoruid2) {
- this.authoruid2 = authoruid2;
- }
- }
-
- @XStreamAlias("relative")
- public class Relative implements Serializable{
-
- @XStreamAlias("rtitle")
- public String title;
-
- @XStreamAlias("rurl")
- public String url;
-
- public String getTitle() {
- return title;
- }
- public void setTitle(String title) {
- this.title = title;
- }
- public String getUrl() {
- return url;
- }
- public void setUrl(String url) {
- this.url = url;
- }
- }
-}
diff --git a/app/src/main/java/net/oschina/app/bean/NewsDetail.java b/app/src/main/java/net/oschina/app/bean/NewsDetail.java
deleted file mode 100644
index ce68418a35935ed38ee4ed3b948141ebaf105b83..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/bean/NewsDetail.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package net.oschina.app.bean;
-
-import com.thoughtworks.xstream.annotations.XStreamAlias;
-
-/**
- * 资讯详情
- * @author FireAnt(http://my.oschina.net/LittleDY)
- * @version 创建时间:2014年10月11日 下午3:28:33
- *
- */
-@SuppressWarnings("serial")
-@XStreamAlias("oschina")
-public class NewsDetail extends Entity {
-
- @XStreamAlias("news")
- private News news;
-
- public News getNews() {
- return news;
- }
-
- public void setNews(News news) {
- this.news = news;
- }
-}
diff --git a/app/src/main/java/net/oschina/app/bean/NewsList.java b/app/src/main/java/net/oschina/app/bean/NewsList.java
deleted file mode 100644
index c353462a01a375f5b9bd762741659f9ea7e32a40..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/bean/NewsList.java
+++ /dev/null
@@ -1,71 +0,0 @@
-package net.oschina.app.bean;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import com.thoughtworks.xstream.annotations.XStreamAlias;
-
-/**
- * 新闻列表实体类
- *
- * @author FireAnt(http://my.oschina.net/LittleDY)
- * @created 2014年9月27日 下午5:55:58
- *
- */
-@SuppressWarnings("serial")
-@XStreamAlias("oschina")
-public class NewsList extends Entity implements ListEntity {
-
- public final static String PREF_READED_NEWS_LIST = "readed_news_list.pref";
-
- public final static int CATALOG_ALL = 1;
- public final static int CATALOG_INTEGRATION = 2;
- public final static int CATALOG_SOFTWARE = 3;
-
- public final static int CATALOG_WEEK = 4;
- public final static int CATALOG_MONTH = 5;
-
- @XStreamAlias("catalog")
- private int catalog;
-
- @XStreamAlias("pagesize")
- private int pageSize;
-
- @XStreamAlias("newscount")
- private int newsCount;
-
- @XStreamAlias("newslist")
- private List list = new ArrayList();
-
- public int getCatalog() {
- return catalog;
- }
-
- public void setCatalog(int catalog) {
- this.catalog = catalog;
- }
-
- public int getPageSize() {
- return pageSize;
- }
-
- public void setPageSize(int pageSize) {
- this.pageSize = pageSize;
- }
-
- public int getNewsCount() {
- return newsCount;
- }
-
- public void setNewsCount(int newsCount) {
- this.newsCount = newsCount;
- }
-
- public List getList() {
- return list;
- }
-
- public void setList(List list) {
- this.list = list;
- }
-}
diff --git a/app/src/main/java/net/oschina/app/bean/NotebookData.java b/app/src/main/java/net/oschina/app/bean/NotebookData.java
deleted file mode 100644
index 1e429ece94fdfa671c7cc4355f1e5eb6d09a679f..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/bean/NotebookData.java
+++ /dev/null
@@ -1,159 +0,0 @@
-package net.oschina.app.bean;
-
-import java.io.Serializable;
-
-import com.thoughtworks.xstream.annotations.XStreamAlias;
-
-/**
- * 便签数据bean(有重载equals()方法)
- *
- * @author kymjs (https://github.com/kymjs)
- *
- */
-@XStreamAlias("sticky")
-public class NotebookData extends Entity implements Serializable,
- Comparable {
- private static final long serialVersionUID = 1L;
-
- @XStreamAlias("id")
- private int id;
- @XStreamAlias("iid")
- private int iid;
- @XStreamAlias("timestamp")
- private String unixTime;
- @XStreamAlias("updateTime")
- private String date;
- @XStreamAlias("content")
- private String content;
- @XStreamAlias("color")
- private String colorText;
-
- private String serverUpdateTime; // 服务器端需要,客户端无用
- private int color;
-
- @Override
- public boolean equals(Object o) {
- if (super.equals(o)) {
- return true;
- } else {
- if (o instanceof NotebookData) {
- NotebookData data = (NotebookData) o;
- try {
- return (this.id == data.getId())
- && (this.iid == data.getIid())
- && (this.unixTime == data.getUnixTime())
- && (this.date.equals(data.getDate()))
- && (this.content == data.getContent())
- && (this.color == data.getColor());
- } catch (NullPointerException e) {
- return false;
- }
- } else {
- return false;
- }
- }
- }
-
- @Override
- public int getId() {
- return id;
- }
-
- @Override
- public void setId(int id) {
- this.id = id;
- }
-
- public int getIid() {
- return iid;
- }
-
- public void setIid(int iid) {
- this.iid = iid;
- }
-
- public String getContent() {
- return content;
- }
-
- public void setContent(String content) {
- this.content = content;
- }
-
- public String getDate() {
- return date;
- }
-
- public void setDate(String date) {
- this.date = date;
- }
-
- public String getUnixTime() {
- return unixTime;
- }
-
- public void setUnixTime(String time) {
- this.unixTime = time;
- setServerUpdateTime(time);
- }
-
- public String getColorText() {
- return colorText;
- }
-
- public void setColorText(String color) {
- this.colorText = color;
- }
-
- public int getColor() {
- // 客户端始终以当前手机上的颜色为准
- if ("blue".equals(colorText)) {
- this.color = 3;
- } else if ("red".equals(colorText)) {
- this.color = 2;
- } else if ("yellow".equals(colorText)) {
- this.color = 1;
- } else if ("purple".equals(colorText)) {
- this.color = 4;
- } else if ("green".equals(colorText)) {
- this.color = 0;
- }
- return color;
- }
-
- public String getServerUpdateTime() {
- return serverUpdateTime;
- }
-
- public void setServerUpdateTime(String serverUpdateTime) {
- this.serverUpdateTime = serverUpdateTime;
- }
-
- public void setColor(int color) {
- switch (color) {
- case 0:
- colorText = "green";
- break;
- case 1:
- colorText = "yellow";
- break;
- case 2:
- colorText = "red";
- break;
- case 3:
- colorText = "blue";
- break;
- case 4:
- colorText = "purple";
- break;
- default:
- this.color = color;
- break;
- }
- }
-
- @Override
- public int compareTo(NotebookData another) {
- return this.iid - another.getIid();
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/net/oschina/app/bean/NotebookDataList.java b/app/src/main/java/net/oschina/app/bean/NotebookDataList.java
deleted file mode 100644
index 5a9c5a790b5f8534146b98831f9570b18b3cb8da..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/bean/NotebookDataList.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package net.oschina.app.bean;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import com.thoughtworks.xstream.annotations.XStreamAlias;
-
-@XStreamAlias("oschina")
-public class NotebookDataList extends Entity implements
- ListEntity {
-
- private static final long serialVersionUID = 1L;
- @XStreamAlias("stickies")
- private List list = new ArrayList();
-
- @Override
- public List getList() {
- return list;
- }
-
- public void setList(List list) {
- this.list = list;
- }
-
-}
\ No newline at end of file
diff --git a/app/src/main/java/net/oschina/app/bean/Notice.java b/app/src/main/java/net/oschina/app/bean/Notice.java
deleted file mode 100644
index 8d5717bbc4489c3024f050100677077af02e3665..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/bean/Notice.java
+++ /dev/null
@@ -1,81 +0,0 @@
-package net.oschina.app.bean;
-
-import java.io.Serializable;
-
-import com.thoughtworks.xstream.annotations.XStreamAlias;
-
-/**
- * 通知信息实体类
- *
- * @author liux (http://my.oschina.net/liux)
- * @version 1.0
- * @created 2012-3-21
- */
-@SuppressWarnings("serial")
-@XStreamAlias("notice")
-public class Notice implements Serializable {
-
- public final static String UTF8 = "UTF-8";
- public final static String NODE_ROOT = "oschina";
-
- public final static int TYPE_ATME = 1;
- public final static int TYPE_MESSAGE = 2;
- public final static int TYPE_COMMENT = 3;
- public final static int TYPE_NEWFAN = 4;
- public final static int TYPE_NEWLIKE = 5;
-
- @XStreamAlias("atmeCount")
- private int atmeCount;
-
- @XStreamAlias("msgCount")
- private int msgCount;
-
- @XStreamAlias("reviewCount")
- private int reviewCount;
-
- @XStreamAlias("newFansCount")
- private int newFansCount;
-
- @XStreamAlias("newLikeCount")
- private int newLikeCount;
-
- public int getAtmeCount() {
- return atmeCount;
- }
-
- public void setAtmeCount(int atmeCount) {
- this.atmeCount = atmeCount;
- }
-
- public int getMsgCount() {
- return msgCount;
- }
-
- public void setMsgCount(int msgCount) {
- this.msgCount = msgCount;
- }
-
- public int getReviewCount() {
- return reviewCount;
- }
-
- public void setReviewCount(int reviewCount) {
- this.reviewCount = reviewCount;
- }
-
- public int getNewFansCount() {
- return newFansCount;
- }
-
- public void setNewFansCount(int newFansCount) {
- this.newFansCount = newFansCount;
- }
-
- public int getNewLikeCount() {
- return newLikeCount;
- }
-
- public void setNewLikeCount(int newLikeCount) {
- this.newLikeCount = newLikeCount;
- }
-}
diff --git a/app/src/main/java/net/oschina/app/bean/NoticeDetail.java b/app/src/main/java/net/oschina/app/bean/NoticeDetail.java
deleted file mode 100644
index 776fe5fb7128e90447a7e54d5f9956443c84f14f..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/bean/NoticeDetail.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package net.oschina.app.bean;
-
-import com.thoughtworks.xstream.annotations.XStreamAlias;
-
-/**
- * 通知实体类
- * @author FireAnt(http://my.oschina.net/LittleDY)
- * @version 创建时间:2014年10月27日 下午2:28:42
- *
- */
-@SuppressWarnings("serial")
-@XStreamAlias("oschina")
-public class NoticeDetail extends Base {
-
- @XStreamAlias("result")
- private Result result;
-
- public Result getResult() {
- return result;
- }
-
- public void setResult(Result result) {
- this.result = result;
- }
-
-
-}
diff --git a/app/src/main/java/net/oschina/app/bean/OpenIdCatalog.java b/app/src/main/java/net/oschina/app/bean/OpenIdCatalog.java
deleted file mode 100644
index 7d6efe9cb4cb32b2e269c7180ee46dda6bedd8de..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/bean/OpenIdCatalog.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package net.oschina.app.bean;
-
-/**
- * Created by zhangdeyi on 15/7/22.
- */
-public class OpenIdCatalog {
-
- public static final String QQ = "qq";
- public static final String WEIBO = "weibo";
- public static final String WECHAT = "wechat";
- public static final String GITHUB = "github";
-}
diff --git a/app/src/main/java/net/oschina/app/bean/Post.java b/app/src/main/java/net/oschina/app/bean/Post.java
deleted file mode 100644
index b6441f74aa2cc1e892bb23e96524139d674434d5..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/bean/Post.java
+++ /dev/null
@@ -1,229 +0,0 @@
-package net.oschina.app.bean;
-
-import java.io.Serializable;
-import java.util.List;
-
-import com.thoughtworks.xstream.annotations.XStreamAlias;
-import com.thoughtworks.xstream.annotations.XStreamImplicit;
-
-/**
- * 帖子实体类
- *
- * @author FireAnt(http://my.oschina.net/LittleDY)
- * @created 2014年10月9日 下午6:02:47
- *
- */
-@SuppressWarnings("serial")
-@XStreamAlias("post")
-public class Post extends Entity {
-
- public final static int CATALOG_ASK = 1;
- public final static int CATALOG_SHARE = 2;
- public final static int CATALOG_OTHER = 3;
- public final static int CATALOG_JOB = 4;
- public final static int CATALOG_SITE = 5;
-
- @XStreamAlias("title")
- private String title;
-
- @XStreamAlias("portrait")
- private String portrait;
-
- @XStreamAlias("url")
- private String url;
-
- @XStreamAlias("body")
- private String body;
-
- @XStreamAlias("author")
- private String author;
-
- @XStreamAlias("authorid")
- private int authorId;
-
- @XStreamAlias("answerCount")
- private int answerCount;
-
- @XStreamAlias("viewCount")
- private int viewCount;
-
- @XStreamAlias("pubDate")
- private String pubDate;
-
- @XStreamAlias("catalog")
- private int catalog;
-
- @XStreamAlias("isnoticeme")
- private int isNoticeMe;
-
- @XStreamAlias("favorite")
- private int favorite;
-
- @XStreamAlias("tags")
- private Tags tags;
-
- @XStreamAlias("answer")
- private Answer answer;
-
- @XStreamAlias("event")
- private Event event;
-
- public Event getEvent() {
- return event;
- }
-
- public void setEvent(Event event) {
- this.event = event;
- }
-
- public String getTitle() {
- return title;
- }
-
- public void setTitle(String title) {
- this.title = title;
- }
-
- public String getPortrait() {
- return portrait;
- }
-
- public void setPortrait(String portrait) {
- this.portrait = portrait;
- }
-
- public String getUrl() {
- return url;
- }
-
- public void setUrl(String url) {
- this.url = url;
- }
-
- public String getBody() {
- return body;
- }
-
- public void setBody(String body) {
- this.body = body;
- }
-
- public String getAuthor() {
- return author;
- }
-
- public void setAuthor(String author) {
- this.author = author;
- }
-
- public int getAuthorId() {
- return authorId;
- }
-
- public void setAuthorId(int authorId) {
- this.authorId = authorId;
- }
-
- public int getAnswerCount() {
- return answerCount;
- }
-
- public void setAnswerCount(int answerCount) {
- this.answerCount = answerCount;
- }
-
- public int getViewCount() {
- return viewCount;
- }
-
- public void setViewCount(int viewCount) {
- this.viewCount = viewCount;
- }
-
- public String getPubDate() {
- return pubDate;
- }
-
- public void setPubDate(String pubDate) {
- this.pubDate = pubDate;
- }
-
- public int getCatalog() {
- return catalog;
- }
-
- public void setCatalog(int catalog) {
- this.catalog = catalog;
- }
-
- public int getIsNoticeMe() {
- return isNoticeMe;
- }
-
- public void setIsNoticeMe(int isNoticeMe) {
- this.isNoticeMe = isNoticeMe;
- }
-
- public int getFavorite() {
- return favorite;
- }
-
- public void setFavorite(int favorite) {
- this.favorite = favorite;
- }
-
- public Post.Tags getTags() {
- return tags;
- }
-
- public void setTags(Tags tags) {
- this.tags = tags;
- }
-
- public Answer getAnswer() {
- return answer;
- }
-
- public void setAnswer(Answer answer) {
- this.answer = answer;
- }
-
- @XStreamAlias("answer")
- public class Answer implements Serializable {
-
- @XStreamAlias("name")
- private String name;
-
- @XStreamAlias("time")
- private String time;
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getTime() {
- return time;
- }
-
- public void setTime(String time) {
- this.time = time;
- }
- }
-
- public class Tags implements Serializable {
- @XStreamImplicit(itemFieldName="tag")
- private List tags;
-
- public List getTags() {
- return tags;
- }
-
- public void setTags(List tags) {
- this.tags = tags;
- }
- }
-}
diff --git a/app/src/main/java/net/oschina/app/bean/PostDetail.java b/app/src/main/java/net/oschina/app/bean/PostDetail.java
deleted file mode 100644
index 017c5bf86dd52ef899f320dd245bcd02a9638195..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/bean/PostDetail.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package net.oschina.app.bean;
-
-import com.thoughtworks.xstream.annotations.XStreamAlias;
-
-/**
- * 帖子详情
- * @author FireAnt(http://my.oschina.net/LittleDY)
- * @version 创建时间:2014年10月11日 下午3:28:33
- *
- */
-@SuppressWarnings("serial")
-@XStreamAlias("oschina")
-public class PostDetail extends Entity {
-
- @XStreamAlias("post")
- private Post post;
-
- public Post getPost() {
- return post;
- }
-
- public void setPost(Post post) {
- this.post = post;
- }
-
-}
diff --git a/app/src/main/java/net/oschina/app/bean/PostList.java b/app/src/main/java/net/oschina/app/bean/PostList.java
deleted file mode 100644
index 06c848db8b669fc67569401d1bce681ab00973af..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/bean/PostList.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package net.oschina.app.bean;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import com.thoughtworks.xstream.annotations.XStreamAlias;
-
-/**
- * 帖子实体类列表
- * @author FireAnt(http://my.oschina.net/LittleDY)
- * @created 2014年10月9日 下午6:10:11
- *
- */
-@SuppressWarnings("serial")
-@XStreamAlias("oschina")
-public class PostList extends Entity implements ListEntity {
-
- public final static String PREF_READED_POST_LIST = "readed_post_list.pref";
-
- @XStreamAlias("pagesize")
- private int pageSize;
-
- @XStreamAlias("postCount")
- private int postCount;
-
- @XStreamAlias("posts")
- private List postlist = new ArrayList();
-
- public int getPageSize() {
- return pageSize;
- }
- public int getPostCount() {
- return postCount;
- }
- public List getPostlist() {
- return postlist;
- }
- @Override
- public List getList() {
- return postlist;
- }
-}
diff --git a/app/src/main/java/net/oschina/app/bean/Report.java b/app/src/main/java/net/oschina/app/bean/Report.java
deleted file mode 100644
index 02c7e9ccaeb6fb31008d8793c32f0b66168f6069..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/bean/Report.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package net.oschina.app.bean;
-
-/**
- * 举报实体类
- *
- * @author 火蚁(http://my.oschina.net/LittleDY)
- * @version 1.0
- * @created 2014-02-13
- */
-public class Report extends Entity {
- private static final long serialVersionUID = 1L;
-
- public static final byte TYPE_QUESTION = 0x02;// 问题
-
- private int objId;//需要举报的id
- private String url;// 举报的链接地址
- private byte objType;// 举报的类型
- private int reason;// 原因
- private String otherReason;// 其他原因
-
- public int getObjId() {
- return objId;
- }
-
- public void setObjId(int objId) {
- this.objId = objId;
- }
-
- public String getUrl() {
- return url;
- }
-
- public void setUrl(String url) {
- this.url = url;
- }
-
- public byte getObjType() {
- return objType;
- }
-
- public void setObjType(byte objType) {
- this.objType = objType;
- }
-
- public int getReason() {
- return reason;
- }
-
- public void setReason(int reason) {
- this.reason = reason;
- }
-
- public String getOtherReason() {
- return otherReason;
- }
-
- public void setOtherReason(String otherReason) {
- this.otherReason = otherReason;
- }
-}
diff --git a/app/src/main/java/net/oschina/app/bean/Result.java b/app/src/main/java/net/oschina/app/bean/Result.java
deleted file mode 100644
index 3f0a4eeab2d944dd36d23bb77f675ec6f11361f7..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/bean/Result.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package net.oschina.app.bean;
-
-import java.io.Serializable;
-
-import com.thoughtworks.xstream.annotations.XStreamAlias;
-
-/**
- * 数据操作结果实体类
- *
- * @author liux (http://my.oschina.net/liux)
- * @version 1.0
- * @created 2012-3-21
- */
-@SuppressWarnings("serial")
-@XStreamAlias("result")
-public class Result implements Serializable {
-
- @XStreamAlias("errorCode")
- private int errorCode;
-
- @XStreamAlias("errorMessage")
- private String errorMessage;
-
- public boolean OK() {
- return errorCode == 1;
- }
-
- public int getErrorCode() {
- return errorCode;
- }
-
- public void setErrorCode(int errorCode) {
- this.errorCode = errorCode;
- }
-
- public String getErrorMessage() {
- return errorMessage;
- }
-
- public void setErrorMessage(String errorMessage) {
- this.errorMessage = errorMessage;
- }
-}
diff --git a/app/src/main/java/net/oschina/app/bean/ResultBean.java b/app/src/main/java/net/oschina/app/bean/ResultBean.java
deleted file mode 100644
index 687c82a5a197ea4e11d2cb6ddd43e0aa0e702d48..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/bean/ResultBean.java
+++ /dev/null
@@ -1,81 +0,0 @@
-package net.oschina.app.bean;
-
-import com.thoughtworks.xstream.annotations.XStreamAlias;
-
-/**
- * 操作结果实体类
- *
- * @author FireAnt(http://my.oschina.net/LittleDY)
- * @version 创建时间:2014年10月14日 下午2:59:27
- *
- */
-@SuppressWarnings("serial")
-@XStreamAlias("oschina")
-public class ResultBean extends Base {
-
- @XStreamAlias("result")
- private Result result;
-
- @XStreamAlias("notice")
- private Notice notice;
-
- @XStreamAlias("comment")
- private Comment comment;
-
- //现在pub_message接口返回的是comment对象。
- //@XStreamAlias("message")
- private MessageDetail message;
-
- @XStreamAlias("relation")
- private int relation;
-
- public Result getResult() {
- return result;
- }
-
- public void setResult(Result result) {
- this.result = result;
- }
-
- public int getRelation() {
- return relation;
- }
-
- public void setRelation(int relation) {
- this.relation = relation;
- }
-
- public Notice getNotice() {
- return notice;
- }
-
- public void setNotice(Notice notice) {
- this.notice = notice;
- }
-
- public Comment getComment() {
- return comment;
- }
-
- public void setComment(Comment comment) {
- this.comment = comment;
- }
-
- public MessageDetail getMessage() {
- //现在pub_message接口返回的是comment对象。所以要转成message
- message = new MessageDetail();
- if(comment!=null) {
- message.setId(comment.getId());
- message.setPortrait(comment.getPortrait());
- message.setAuthor(comment.getAuthor());
- message.setAuthorId(comment.getId());
- message.setContent(comment.getContent());
- message.setPubDate(comment.getPubDate());
- }
- return message;
- }
-
- public void setMessage(MessageDetail message) {
- this.message = message;
- }
-}
diff --git a/app/src/main/java/net/oschina/app/bean/SearchList.java b/app/src/main/java/net/oschina/app/bean/SearchList.java
deleted file mode 100644
index 4e212dd92d8dd5be3a5b38b074c64d9e9005b3fd..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/bean/SearchList.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package net.oschina.app.bean;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import com.thoughtworks.xstream.annotations.XStreamAlias;
-
-/**
- * 搜索实体类
- *
- * @author FireAnt(http://my.oschina.net/LittleDY)
- * @created 2014年12月5日 上午11:19:44
- *
- */
-@SuppressWarnings("serial")
-@XStreamAlias("oschina")
-public class SearchList extends Entity implements ListEntity {
-
- public final static String CATALOG_ALL = "all";
- public final static String CATALOG_NEWS = "news";
- public final static String CATALOG_POST = "post";
- public final static String CATALOG_SOFTWARE = "software";
- public final static String CATALOG_BLOG = "blog";
-
- @XStreamAlias("pagesize")
- private int pageSize;
-
- @XStreamAlias("results")
- private List list = new ArrayList();
-
- public int getPageSize() {
- return pageSize;
- }
-
- @Override
- public List getList() {
- return list;
- }
-
- public void setList(List list) {
- this.list = list;
- }
-}
diff --git a/app/src/main/java/net/oschina/app/bean/SearchResult.java b/app/src/main/java/net/oschina/app/bean/SearchResult.java
deleted file mode 100644
index e414f412cc8bd3dceeaa9ea77eac6b22204b71cb..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/bean/SearchResult.java
+++ /dev/null
@@ -1,88 +0,0 @@
-package net.oschina.app.bean;
-
-import com.thoughtworks.xstream.annotations.XStreamAlias;
-
-/**
- * 搜索结果实体类
- */
-@SuppressWarnings("serial")
-@XStreamAlias("result")
-public class SearchResult extends Entity {
-
- @XStreamAlias("objid")
- private int id;
-
- @XStreamAlias("type")
- private String type;
-
- @XStreamAlias("title")
- private String title;
-
- @XStreamAlias("description")
- private String description;
-
- @XStreamAlias("url")
- private String url;
-
- @XStreamAlias("pubDate")
- private String pubDate;
-
- @XStreamAlias("author")
- private String author;
-
- public int getId() {
- return id;
- }
-
- public void setId(int id) {
- this.id = id;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public String getTitle() {
- return title;
- }
-
- public void setTitle(String title) {
- this.title = title;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public String getUrl() {
- return url;
- }
-
- public void setUrl(String url) {
- this.url = url;
- }
-
- public String getPubDate() {
- return pubDate;
- }
-
- public void setPubDate(String pubDate) {
- this.pubDate = pubDate;
- }
-
- public String getAuthor() {
- return author;
- }
-
- public void setAuthor(String author) {
- this.author = author;
- }
-}
diff --git a/app/src/main/java/net/oschina/app/bean/ShakeObject.java b/app/src/main/java/net/oschina/app/bean/ShakeObject.java
deleted file mode 100644
index 865de1269247c1c048daf715320416613c1721da..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/bean/ShakeObject.java
+++ /dev/null
@@ -1,113 +0,0 @@
-package net.oschina.app.bean;
-
-import com.thoughtworks.xstream.annotations.XStreamAlias;
-
-@XStreamAlias("oschina")
-public class ShakeObject {
-
- @XStreamAlias("randomtype")
- private String randomtype; // 数据类型
- @XStreamAlias("id")
- private String id; // 数据id
- @XStreamAlias("title")
- private String title; // 帖子标题
- @XStreamAlias("detail")
- private String detail; // 内容
- @XStreamAlias("author")
- private String author; // 作者
- @XStreamAlias("authorid")
- private String authorid; // 作者id
- @XStreamAlias("image")
- private String image; // 头像地址
- @XStreamAlias("pubDate")
- private String pubDate; // 收录日期
- @XStreamAlias("commentCount")
- private String commentCount;
- @XStreamAlias("url")
- private String url;
-
- public static final String RANDOMTYPE_NEWS = "1";
- public static final String RANDOMTYPE_BLOG = "2";
- public static final String RANDOMTYPE_SOFTWARE = "3";
-
- public String getRandomtype() {
- return randomtype;
- }
-
- public void setRandomtype(String randomtype) {
- this.randomtype = randomtype;
- }
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getTitle() {
- return title;
- }
-
- public void setTitle(String title) {
- this.title = title;
- }
-
- public String getDetail() {
- return detail;
- }
-
- public void setDetail(String detail) {
- this.detail = detail;
- }
-
- public String getAuthor() {
- return author;
- }
-
- public void setAuthor(String author) {
- this.author = author;
- }
-
- public String getAuthorid() {
- return authorid;
- }
-
- public void setAuthorid(String authorid) {
- this.authorid = authorid;
- }
-
- public String getImage() {
- return image;
- }
-
- public void setImage(String image) {
- this.image = image;
- }
-
- public String getPubDate() {
- return pubDate;
- }
-
- public void setPubDate(String pubDate) {
- this.pubDate = pubDate;
- }
-
- public String getCommentCount() {
- return commentCount;
- }
-
- public void setCommentCount(String commentCount) {
- this.commentCount = commentCount;
- }
-
- public String getUrl() {
- return url;
- }
-
- public void setUrl(String url) {
- this.url = url;
- }
-
-}
diff --git a/app/src/main/java/net/oschina/app/bean/SimpleBackPage.java b/app/src/main/java/net/oschina/app/bean/SimpleBackPage.java
deleted file mode 100644
index 7e40b7f95860bac0148e44ddb1cd0b141f4ac102..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/bean/SimpleBackPage.java
+++ /dev/null
@@ -1,185 +0,0 @@
-package net.oschina.app.bean;
-
-import net.oschina.app.R;
-import net.oschina.app.fragment.AboutOSCFragment;
-import net.oschina.app.fragment.ActiveFragment;
-import net.oschina.app.fragment.BrowserFragment;
-import net.oschina.app.fragment.CommentFrament;
-import net.oschina.app.fragment.EventAppliesFragment;
-import net.oschina.app.fragment.EventFragment;
-import net.oschina.app.fragment.FeedBackFragment;
-import net.oschina.app.fragment.MessageDetailFragment;
-import net.oschina.app.fragment.MyInformationFragment;
-import net.oschina.app.fragment.MyInformationFragmentDetail;
-import net.oschina.app.fragment.QuestionTagFragment;
-import net.oschina.app.fragment.SettingsFragment;
-import net.oschina.app.fragment.SettingsNotificationFragment;
-import net.oschina.app.fragment.SoftWareTweetsFrament;
-import net.oschina.app.fragment.TweetLikeUsersFragment;
-import net.oschina.app.fragment.TweetPubFragment;
-import net.oschina.app.fragment.TweetRecordFragment;
-import net.oschina.app.fragment.TweetsFragment;
-import net.oschina.app.fragment.UserBlogFragment;
-import net.oschina.app.fragment.UserCenterFragment;
-import net.oschina.app.team.fragment.NoteBookFragment;
-import net.oschina.app.team.fragment.NoteEditFragment;
-import net.oschina.app.team.fragment.TeamActiveFragment;
-import net.oschina.app.team.fragment.TeamDiaryDetailFragment;
-import net.oschina.app.team.fragment.TeamDiscussFragment;
-import net.oschina.app.team.fragment.TeamIssueFragment;
-import net.oschina.app.team.fragment.TeamMemberInformationFragment;
-import net.oschina.app.team.fragment.TeamProjectFragment;
-import net.oschina.app.team.fragment.TeamProjectMemberSelectFragment;
-import net.oschina.app.team.viewpagefragment.MyIssuePagerfragment;
-import net.oschina.app.team.viewpagefragment.TeamDiaryFragment;
-import net.oschina.app.team.viewpagefragment.TeamIssueViewPageFragment;
-import net.oschina.app.team.viewpagefragment.TeamProjectViewPagerFragment;
-import net.oschina.app.viewpagerfragment.BlogViewPagerFragment;
-import net.oschina.app.viewpagerfragment.EventViewPagerFragment;
-import net.oschina.app.viewpagerfragment.FriendsViewPagerFragment;
-import net.oschina.app.viewpagerfragment.NoticeViewPagerFragment;
-import net.oschina.app.viewpagerfragment.OpensourceSoftwareFragment;
-import net.oschina.app.viewpagerfragment.QuestViewPagerFragment;
-import net.oschina.app.viewpagerfragment.SearchViewPageFragment;
-import net.oschina.app.viewpagerfragment.UserFavoriteViewPagerFragment;
-
-public enum SimpleBackPage {
-
- COMMENT(1, R.string.actionbar_title_comment, CommentFrament.class),
-
- QUEST(2, R.string.actionbar_title_questions, QuestViewPagerFragment.class),
-
- TWEET_PUB(3, R.string.actionbar_title_tweetpub, TweetPubFragment.class),
-
- SOFTWARE_TWEETS(4, R.string.actionbar_title_softtweet,
- SoftWareTweetsFrament.class),
-
- USER_CENTER(5, R.string.actionbar_title_user_center,
- UserCenterFragment.class),
-
- USER_BLOG(6, R.string.actionbar_title_user_blog, UserBlogFragment.class),
-
- MY_INFORMATION(7, R.string.actionbar_title_my_information,
- MyInformationFragment.class),
-
- MY_ACTIVE(8, R.string.actionbar_title_active, ActiveFragment.class),
-
- MY_MES(9, R.string.actionbar_title_mes, NoticeViewPagerFragment.class),
-
- OPENSOURCE_SOFTWARE(10, R.string.actionbar_title_softwarelist,
- OpensourceSoftwareFragment.class),
-
- MY_FRIENDS(11, R.string.actionbar_title_my_friends,
- FriendsViewPagerFragment.class),
-
- QUESTION_TAG(12, R.string.actionbar_title_question,
- QuestionTagFragment.class),
-
- MESSAGE_DETAIL(13, R.string.actionbar_title_message_detail,
- MessageDetailFragment.class),
-
- USER_FAVORITE(14, R.string.actionbar_title_user_favorite,
- UserFavoriteViewPagerFragment.class),
-
- SETTING(15, R.string.actionbar_title_setting, SettingsFragment.class),
-
- SETTING_NOTIFICATION(16, R.string.actionbar_title_setting_notification,
- SettingsNotificationFragment.class),
-
- ABOUT_OSC(17, R.string.actionbar_title_about_osc, AboutOSCFragment.class),
-
- BLOG(18, R.string.actionbar_title_blog_area, BlogViewPagerFragment.class),
-
- RECORD(19, R.string.actionbar_title_tweetpub, TweetRecordFragment.class),
-
- SEARCH(20, R.string.actionbar_title_search, SearchViewPageFragment.class),
-
- EVENT_LIST(21, R.string.actionbar_title_event, EventViewPagerFragment.class),
-
- EVENT_APPLY(22, R.string.actionbar_title_event_apply,
- EventAppliesFragment.class),
-
- SAME_CITY(23, R.string.actionbar_title_same_city, EventFragment.class),
-
- NOTE(24, R.string.actionbar_title_note, NoteBookFragment.class),
-
- NOTE_EDIT(25, R.string.actionbar_title_noteedit, NoteEditFragment.class),
-
- BROWSER(26, R.string.app_name, BrowserFragment.class),
-
- DYNAMIC(27, R.string.team_dynamic, TeamActiveFragment.class),
-
- MY_INFORMATION_DETAIL(28, R.string.actionbar_title_my_information,
- MyInformationFragmentDetail.class),
-
- FEED_BACK(29, R.string.str_feedback_title, FeedBackFragment.class),
-
- TEAM_USER_INFO(30, R.string.str_team_userinfo,
- TeamMemberInformationFragment.class),
-
- MY_ISSUE_PAGER(31, R.string.str_team_my_issue, MyIssuePagerfragment.class),
-
- TEAM_PROJECT_MAIN(32, 0, TeamProjectViewPagerFragment.class),
-
- TEAM_ISSUECATALOG_ISSUE_LIST(33, 0, TeamIssueFragment.class),
-
- TEAM_ACTIVE(34, R.string.team_actvie, TeamActiveFragment.class),
-
- TEAM_ISSUE(35, R.string.team_issue, TeamIssueViewPageFragment.class),
-
- TEAM_DISCUSS(36, R.string.team_discuss, TeamDiscussFragment.class),
-
- TEAM_DIRAY(37, R.string.team_diary, TeamDiaryFragment.class),
-
- TEAM_DIRAY_DETAIL(38, R.string.team_diary_detail, TeamDiaryDetailFragment.class),
-
- TEAM_PROJECT_MEMBER_SELECT(39, 0, TeamProjectMemberSelectFragment.class),
-
- TEAM_PROJECT(40, R.string.team_project, TeamProjectFragment.class),
-
- TWEET_LIKE_USER_LIST(41, 0, TweetLikeUsersFragment.class),
-
- TWEET_TOPIC_LIST(42, 0, TweetsFragment.class);
-
- private int title;
- private Class> clz;
- private int value;
-
- private SimpleBackPage(int value, int title, Class> clz) {
- this.value = value;
- this.title = title;
- this.clz = clz;
- }
-
- public int getTitle() {
- return title;
- }
-
- public void setTitle(int title) {
- this.title = title;
- }
-
- public Class> getClz() {
- return clz;
- }
-
- public void setClz(Class> clz) {
- this.clz = clz;
- }
-
- public int getValue() {
- return value;
- }
-
- public void setValue(int value) {
- this.value = value;
- }
-
- public static SimpleBackPage getPageByValue(int val) {
- for (SimpleBackPage p : values()) {
- if (p.getValue() == val)
- return p;
- }
- return null;
- }
-}
diff --git a/app/src/main/java/net/oschina/app/bean/SingInResult.java b/app/src/main/java/net/oschina/app/bean/SingInResult.java
deleted file mode 100644
index b4396268dde021d4043174c15b0599877d84450e..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/bean/SingInResult.java
+++ /dev/null
@@ -1,67 +0,0 @@
-package net.oschina.app.bean;
-
-import net.oschina.app.AppException;
-
-import org.json.JSONException;
-import org.json.JSONObject;
-
-/**
- * 签到返回结果实体类
- * @author FireAnt(http://my.oschina.net/LittleDY)
- * @created 2014年10月22日 下午1:43:13
- *
- */
-public class SingInResult {
-
- public final static String NODE_MES = "msg";
- public final static String NODE_ERROR = "error";
-
- private String message;// 成功消息
- private String errorMes;// 错误消息
- private boolean ok;// 是否成功
-
- public String getMessage() {
- return message;
- }
-
- public void setMessage(String message) {
- this.message = message;
- }
-
- public String getErrorMes() {
- return errorMes;
- }
-
- public void setErrorMes(String errorMes) {
- this.errorMes = errorMes;
- }
-
- public boolean isOk() {
- return ok;
- }
-
- public void setOk(boolean ok) {
- this.ok = ok;
- }
-
- public static SingInResult parse(String jsonStr) throws AppException {
- SingInResult jsonResult = new SingInResult();
- try {
- JSONObject jsonObject = new JSONObject(jsonStr);
- // 如果有错误信息则表示不成功
- if (jsonObject.isNull(NODE_ERROR)) {
- jsonResult.setOk(true);
- }
- if (!jsonObject.isNull(NODE_ERROR)) {
- jsonResult.setErrorMes(jsonObject.getString(NODE_ERROR));
- }
- if (!jsonObject.isNull(NODE_MES)) {
- jsonResult.setMessage(jsonObject.getString(NODE_MES));
- }
- } catch (JSONException e) {
- // 抛出一个json解析错误的异常
- throw AppException.json(e);
- }
- return jsonResult;
- }
-}
diff --git a/app/src/main/java/net/oschina/app/bean/Software.java b/app/src/main/java/net/oschina/app/bean/Software.java
deleted file mode 100644
index 3564a489fba6e43917d25b4b4be13b8aea0f79a0..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/bean/Software.java
+++ /dev/null
@@ -1,202 +0,0 @@
-package net.oschina.app.bean;
-
-import com.thoughtworks.xstream.annotations.XStreamAlias;
-
-/**
- * 软件实体类
- *
- * @author FireAnt(http://my.oschina.net/LittleDY)
- * @created 2014年10月23日 下午3:03:25
- *
- */
-@SuppressWarnings("serial")
-@XStreamAlias("software")
-public class Software extends Entity {
-
- @XStreamAlias("title")
- private String title;
-
- @XStreamAlias("author")
- private String author;
-
- @XStreamAlias("authorid")
- private int authorId;
-
- @XStreamAlias("recommended")
- private int recommended;
-
- @XStreamAlias("extensiontitle")
- private String extensionTitle;
-
- @XStreamAlias("license")
- private String license;
-
- @XStreamAlias("body")
- private String body;
-
- @XStreamAlias("homepage")
- private String homepage;
-
- @XStreamAlias("document")
- private String document;
-
- @XStreamAlias("download")
- private String download;
-
- @XStreamAlias("logo")
- private String logo;
-
- @XStreamAlias("language")
- private String language;
-
- @XStreamAlias("os")
- private String os;
-
- @XStreamAlias("recordtime")
- private String recordtime;
-
- @XStreamAlias("url")
- private String url;
-
- @XStreamAlias("favorite")
- private int favorite;
-
- @XStreamAlias("tweetCount")
- private int tweetCount;
-
- public String getTitle() {
- return title;
- }
-
- public void setTitle(String title) {
- this.title = title;
- }
-
- public String getAuthor() {
- return author;
- }
-
- public void setAuthor(String author) {
- this.author = author;
- }
-
- public int getAuthorId() {
- return authorId;
- }
-
- public void setAuthorId(int authorId) {
- this.authorId = authorId;
- }
-
- public int getRecommended() {
- return recommended;
- }
-
- public void setRecommended(int recommended) {
- this.recommended = recommended;
- }
-
- public String getExtensionTitle() {
- return extensionTitle;
- }
-
- public void setExtensionTitle(String extensionTitle) {
- this.extensionTitle = extensionTitle;
- }
-
- public String getLicense() {
- return license;
- }
-
- public void setLicense(String license) {
- this.license = license;
- }
-
- public String getBody() {
- return body;
- }
-
- public void setBody(String body) {
- this.body = body;
- }
-
- public String getHomepage() {
- return homepage;
- }
-
- public void setHomepage(String homepage) {
- this.homepage = homepage;
- }
-
- public String getDocument() {
- return document;
- }
-
- public void setDocument(String document) {
- this.document = document;
- }
-
- public String getDownload() {
- return download;
- }
-
- public void setDownload(String download) {
- this.download = download;
- }
-
- public String getLogo() {
- return logo;
- }
-
- public void setLogo(String logo) {
- this.logo = logo;
- }
-
- public String getLanguage() {
- return language;
- }
-
- public void setLanguage(String language) {
- this.language = language;
- }
-
- public String getOs() {
- return os;
- }
-
- public void setOs(String os) {
- this.os = os;
- }
-
- public String getRecordtime() {
- return recordtime;
- }
-
- public void setRecordtime(String recordtime) {
- this.recordtime = recordtime;
- }
-
- public String getUrl() {
- return url;
- }
-
- public void setUrl(String url) {
- this.url = url;
- }
-
- public int getFavorite() {
- return favorite;
- }
-
- public void setFavorite(int favorite) {
- this.favorite = favorite;
- }
-
- public int getTweetCount() {
- return tweetCount;
- }
-
- public void setTweetCount(int tweetCount) {
- this.tweetCount = tweetCount;
- }
-}
diff --git a/app/src/main/java/net/oschina/app/bean/SoftwareCatalogList.java b/app/src/main/java/net/oschina/app/bean/SoftwareCatalogList.java
deleted file mode 100644
index c14e52a514a43f7e12b26a5bd5931239a556bad0..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/bean/SoftwareCatalogList.java
+++ /dev/null
@@ -1,67 +0,0 @@
-package net.oschina.app.bean;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import com.thoughtworks.xstream.annotations.XStreamAlias;
-
-/**
- * 开源软件分类列表实体
- * @author FireAnt(http://my.oschina.net/LittleDY)
- * @created 2014年12月2日 上午10:54:10
- *
- */
-@SuppressWarnings("serial")
-@XStreamAlias("oschina")
-public class SoftwareCatalogList extends Entity implements ListEntity {
-
- @XStreamAlias("softwarecount")
- private int softwarecount;
- @XStreamAlias("softwareTypes")
- private List softwarecataloglist = new ArrayList();
-
- public int getSoftwarecount() {
- return softwarecount;
- }
-
- public void setSoftwarecount(int softwarecount) {
- this.softwarecount = softwarecount;
- }
-
- public List getSoftwarecataloglist() {
- return softwarecataloglist;
- }
-
- public void setSoftwarecataloglist(List softwarecataloglist) {
- this.softwarecataloglist = softwarecataloglist;
- }
-
- @Override
- public List> getList() {
- return softwarecataloglist;
- }
-
- @XStreamAlias("softwareType")
- public class SoftwareType extends Entity {
-
- @XStreamAlias("name")
- private String name;
- @XStreamAlias("tag")
- private int tag;
-
- public String getName() {
- return name;
- }
- public void setName(String name) {
- this.name = name;
- }
- public int getTag() {
- return tag;
- }
- public void setTag(int tag) {
- this.tag = tag;
- }
-
- }
-
-}
diff --git a/app/src/main/java/net/oschina/app/bean/SoftwareDec.java b/app/src/main/java/net/oschina/app/bean/SoftwareDec.java
deleted file mode 100644
index 74db5284a39633901ba3996ecff7238bbfd44a7d..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/bean/SoftwareDec.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package net.oschina.app.bean;
-
-import com.thoughtworks.xstream.annotations.XStreamAlias;
-
-/**
- * 软件列表
- *
- * @author FireAnt(http://my.oschina.net/LittleDY)
- * @created 2015年1月20日 下午3:34:52
- *
- */
-@SuppressWarnings("serial")
-@XStreamAlias("software")
-public class SoftwareDec extends Entity {
- @XStreamAlias("name")
- private String name;
- @XStreamAlias("description")
- private String description;
- @XStreamAlias("url")
- private String url;
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public String getUrl() {
- return url;
- }
-
- public void setUrl(String url) {
- this.url = url;
- }
-}
diff --git a/app/src/main/java/net/oschina/app/bean/SoftwareDetail.java b/app/src/main/java/net/oschina/app/bean/SoftwareDetail.java
deleted file mode 100644
index b4d7689a18a78b6f71c6bc7b391b09efa65425b5..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/bean/SoftwareDetail.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package net.oschina.app.bean;
-
-import com.thoughtworks.xstream.annotations.XStreamAlias;
-
-/**
- * 软件详情实体类
- *
- * @author FireAnt(http://my.oschina.net/LittleDY)
- * @version 创建时间:2014年10月23日 下午3:10:54
- *
- */
-@SuppressWarnings("serial")
-@XStreamAlias("oschina")
-public class SoftwareDetail extends Entity {
-
- @XStreamAlias("software")
- private Software software;
-
- public Software getSoftware() {
- return software;
- }
-
- public void setSoftware(Software software) {
- this.software = software;
- }
-}
diff --git a/app/src/main/java/net/oschina/app/bean/SoftwareList.java b/app/src/main/java/net/oschina/app/bean/SoftwareList.java
deleted file mode 100644
index bc5bd6e21e20510986b2ec668315dc154edcdd16..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/bean/SoftwareList.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package net.oschina.app.bean;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import com.thoughtworks.xstream.annotations.XStreamAlias;
-
-@SuppressWarnings("serial")
-@XStreamAlias("oschina")
-public class SoftwareList extends Entity implements ListEntity {
-
- public final static String PREF_READED_SOFTWARE_LIST = "readed_software_list.pref";
-
- public final static String CATALOG_RECOMMEND = "recommend";
- public final static String CATALOG_TIME = "time";
- public final static String CATALOG_VIEW = "view";
- public final static String CATALOG_LIST_CN = "list_cn";
-
- @XStreamAlias("softwarecount")
- private int softwarecount;
- @XStreamAlias("pagesize")
- private int pagesize;
- @XStreamAlias("softwares")
- private List softwarelist = new ArrayList();
-
- public int getSoftwarecount() {
- return softwarecount;
- }
-
- public void setSoftwarecount(int softwarecount) {
- this.softwarecount = softwarecount;
- }
-
- public int getPagesize() {
- return pagesize;
- }
-
- public void setPagesize(int pagesize) {
- this.pagesize = pagesize;
- }
-
- public List getSoftwarelist() {
- return softwarelist;
- }
-
- public void setSoftwarelist(List softwarelist) {
- this.softwarelist = softwarelist;
- }
-
- @Override
- public List getList() {
- return softwarelist;
- }
-}
diff --git a/app/src/main/java/net/oschina/app/bean/Tweet.java b/app/src/main/java/net/oschina/app/bean/Tweet.java
deleted file mode 100644
index 38de54d17f46ea5408247b537d4693e7888a253e..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/bean/Tweet.java
+++ /dev/null
@@ -1,355 +0,0 @@
-package net.oschina.app.bean;
-
-import android.content.Context;
-import android.os.Bundle;
-import android.os.Parcel;
-import android.os.Parcelable;
-import android.text.SpannableString;
-import android.text.SpannableStringBuilder;
-import android.text.TextPaint;
-import android.text.method.LinkMovementMethod;
-import android.text.style.ClickableSpan;
-import android.view.View;
-import android.widget.TextView;
-import android.widget.TextView.BufferType;
-
-import com.thoughtworks.xstream.annotations.XStreamAlias;
-
-import net.oschina.app.AppContext;
-import net.oschina.app.base.BaseListFragment;
-import net.oschina.app.util.UIHelper;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * 动弹实体类
- *
- * @author liux (http://my.oschina.net/liux),kymjs(kymjs123@gmail.com)
- * @version 1.1 添加语音动弹功能
- * @created 2012-3-21
- * @changed 2014-12-1
- */
-@SuppressWarnings("serial")
-@XStreamAlias("tweet")
-public class Tweet extends Entity implements Parcelable {
-
- @XStreamAlias("portrait")
- private String portrait;
- @XStreamAlias("author")
- private String author;
- @XStreamAlias("authorid")
- private int authorid;
- @XStreamAlias("body")
- private String body;
- @XStreamAlias("appclient")
- private int appclient;
- @XStreamAlias("commentCount")
- private String commentCount;
- @XStreamAlias("pubDate")
- private String pubDate;
- @XStreamAlias("imgSmall")
- private String imgSmall;
- @XStreamAlias("imgBig")
- private String imgBig;
- @XStreamAlias("attach")
- private String attach;
-
- @XStreamAlias("likeCount")
- private int likeCount;
-
- @XStreamAlias("isLike")
- private int isLike;
-
- @XStreamAlias("likeList")
- private List likeUser = new ArrayList();
-
- private String imageFilePath;
- private String audioPath;
-
- public Tweet() {
- }
-
- public Tweet(Parcel dest) {
- id = dest.readInt();
- portrait = dest.readString();
- author = dest.readString();
- authorid = dest.readInt();
- body = dest.readString();
- appclient = dest.readInt();
- commentCount = dest.readString();
- pubDate = dest.readString();
- imgSmall = dest.readString();
- imgBig = dest.readString();
- attach = dest.readString();
- imageFilePath = dest.readString();
- audioPath = dest.readString();
- isLike = dest.readInt();
- }
-
- public String getAttach() {
- return attach;
- }
-
- public void setAttach(String attach) {
- this.attach = attach;
- }
-
- public String getPortrait() {
- return portrait;
- }
-
- public void setPortrait(String portrait) {
- this.portrait = portrait;
- }
-
- public String getAuthor() {
- return author;
- }
-
- public void setAuthor(String author) {
- this.author = author;
- }
-
- public int getAuthorid() {
- return authorid;
- }
-
- public void setAuthorid(int authorid) {
- this.authorid = authorid;
- }
-
- public String getBody() {
- return body;
- }
-
- public void setBody(String body) {
- this.body = body;
- }
-
- public int getAppclient() {
- return appclient;
- }
-
- public void setAppclient(int appclient) {
- this.appclient = appclient;
- }
-
- public String getCommentCount() {
- return commentCount;
- }
-
- public void setCommentCount(String commentCount) {
- this.commentCount = commentCount;
- }
-
- public String getPubDate() {
- return pubDate;
- }
-
- public void setPubDate(String pubDate) {
- this.pubDate = pubDate;
- }
-
- public String getImgSmall() {
- return imgSmall;
- }
-
- public void setImgSmall(String imgSmall) {
- this.imgSmall = imgSmall;
- }
-
- public String getImgBig() {
- return imgBig;
- }
-
- public void setImgBig(String imgBig) {
- this.imgBig = imgBig;
- }
-
- public String getImageFilePath() {
- return imageFilePath;
- }
-
- public void setImageFilePath(String imageFilePath) {
- this.imageFilePath = imageFilePath;
- }
-
- public String getAudioPath() {
- return audioPath;
- }
-
- public void setAudioPath(String audioPath) {
- this.audioPath = audioPath;
- }
-
- public List getLikeUser() {
- return likeUser;
- }
-
- public void setLikeUser(List likeUser) {
- this.likeUser = likeUser;
- }
-
- public int getLikeCount() {
- return likeCount;
- }
-
- public void setLikeCount(int likeCount) {
- this.likeCount = likeCount;
- }
-
- public int getIsLike() {
- return isLike;
- }
-
- public void setIsLike(int isLike) {
- this.isLike = isLike;
- }
-
- @Override
- public int describeContents() {
- return 0;
- }
-
- @Override
- public void writeToParcel(Parcel dest, int flags) {
- dest.writeInt(id);
- dest.writeString(portrait);
- dest.writeString(author);
- dest.writeInt(authorid);
- dest.writeString(body);
- dest.writeInt(appclient);
- dest.writeString(commentCount);
- dest.writeString(pubDate);
- dest.writeString(imgSmall);
- dest.writeString(imgBig);
- dest.writeString(attach);
- dest.writeString(imageFilePath);
- dest.writeString(audioPath);
- dest.writeInt(isLike);
- }
-
- public static final Parcelable.Creator CREATOR = new Creator() {
-
- @Override
- public Tweet[] newArray(int size) {
- return new Tweet[size];
- }
-
- @Override
- public Tweet createFromParcel(Parcel source) {
- return new Tweet(source);
- }
- };
-
- public void setLikeUsers(Context contet, TextView likeUser, boolean limit) {
- // 构造多个超链接的html, 通过选中的位置来获取用户名
- if (getLikeCount() > 0 && getLikeUser() != null
- && !getLikeUser().isEmpty()) {
- likeUser.setVisibility(View.VISIBLE);
- likeUser.setMovementMethod(LinkMovementMethod.getInstance());
- likeUser.setFocusable(false);
- likeUser.setLongClickable(false);
- likeUser.setText(addClickablePart(contet, limit), BufferType.SPANNABLE);
- } else {
- likeUser.setVisibility(View.GONE);
- likeUser.setText("");
- }
- }
-
- /**
- * @return
- */
- private SpannableStringBuilder addClickablePart(final Context context,
- boolean limit) {
-
- StringBuilder sbBuilder = new StringBuilder();
- int showCunt = getLikeUser().size();
- if (limit && showCunt > 4) {
- showCunt = 4;
- }
-
- // 如果已经点赞,始终让该用户在首位
- if (getIsLike() == 1) {
-
- for (int i = 0; i < getLikeUser().size(); i++) {
- if (getLikeUser().get(i).getId() == AppContext.getInstance()
- .getLoginUid()) {
- getLikeUser().remove(i);
- }
- }
- getLikeUser().add(0, AppContext.getInstance().getLoginUser());
- }
-
- for (int i = 0; i < showCunt; i++) {
- sbBuilder.append(getLikeUser().get(i).getName()).append("、");
- }
-
- String likeUsersStr = sbBuilder.substring(0, sbBuilder.lastIndexOf("、"));
-
- // 第一个赞图标
- // ImageSpan span = new ImageSpan(AppContext.getInstance(),
- // R.drawable.ic_unlike_small);
- SpannableString spanStr = new SpannableString("");
- // spanStr.setSpan(span, 0, 1, Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
-
- SpannableStringBuilder ssb = new SpannableStringBuilder(spanStr);
- ssb.append(likeUsersStr);
-
- String[] likeUsers = likeUsersStr.split("、");
-
- if (likeUsers.length > 0) {
- // 最后一个
- for (int i = 0; i < likeUsers.length; i++) {
- final String name = likeUsers[i];
- final int start = likeUsersStr.indexOf(name) + spanStr.length();
- final int index = i;
- ssb.setSpan(new ClickableSpan() {
- @Override
- public void onClick(View widget) {
- User user = getLikeUser().get(index);
- UIHelper.showUserCenter(context, user.getId(),
- user.getName());
- }
-
- @Override
- public void updateDrawState(TextPaint ds) {
- super.updateDrawState(ds);
- // ds.setColor(R.color.link_color); // 设置文本颜色
- // 去掉下划线
- ds.setUnderlineText(false);
- }
- }, start, start + name.length(), 0);
- }
- }
- if (likeUsers.length < getLikeCount()) {
- ssb.append("等");
- int start = ssb.length();
- String more = getLikeCount() + "人";
- ssb.append(more);
- ssb.setSpan(new ClickableSpan() {
-
- @Override
- public void onClick(View widget) {
- Bundle bundle = new Bundle();
- bundle.putInt(BaseListFragment.BUNDLE_KEY_CATALOG, getId());
- UIHelper.showSimpleBack(context,
- SimpleBackPage.TWEET_LIKE_USER_LIST, bundle);
- }
-
- @Override
- public void updateDrawState(TextPaint ds) {
- super.updateDrawState(ds);
- // ds.setColor(R.color.link_color); // 设置文本颜色
- // 去掉下划线
- ds.setUnderlineText(false);
- }
-
- }, start, start + more.length(), 0);
- return ssb.append("觉得很赞");
- } else {
- return ssb.append("觉得很赞");
- }
- }
-}
diff --git a/app/src/main/java/net/oschina/app/bean/TweetDetail.java b/app/src/main/java/net/oschina/app/bean/TweetDetail.java
deleted file mode 100644
index fbb850a4bc5dbfa486da4645f16fbfa1ac27afc4..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/bean/TweetDetail.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package net.oschina.app.bean;
-
-import com.thoughtworks.xstream.annotations.XStreamAlias;
-
-/**
- * @author HuangWenwei
- *
- * @date 2014年10月16日
- */
-@SuppressWarnings("serial")
-@XStreamAlias("oschina")
-public class TweetDetail extends Entity {
-
- @XStreamAlias("tweet")
- private Tweet tweet;
-
- public Tweet getTweet() {
- return tweet;
- }
- public void setTweet(Tweet tweet) {
- this.tweet = tweet;
- }
-}
diff --git a/app/src/main/java/net/oschina/app/bean/TweetLike.java b/app/src/main/java/net/oschina/app/bean/TweetLike.java
deleted file mode 100644
index 2faf97d670d7374ad145ad36e7a0b37e1a70ba1b..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/bean/TweetLike.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package net.oschina.app.bean;
-
-import com.thoughtworks.xstream.annotations.XStreamAlias;
-
-/**
- * 点赞消息实体类
- * LikeTweet.java
- *
- * @author 火蚁(http://my.oschina.net/u/253900)
- *
- * @data 2015-4-10 上午10:09:15
- */
-@SuppressWarnings("serial")
-@XStreamAlias("mytweet")
-public class TweetLike extends Entity {
-
- @XStreamAlias("user")
- private User user;
-
- @XStreamAlias("tweet")
- private Tweet tweet;
-
- @XStreamAlias("datatime")
- private String datatime;
-
- @XStreamAlias("appclient")
- private int appClient;
-
- public User getUser() {
- return user;
- }
-
- public void setUser(User user) {
- this.user = user;
- }
-
- public Tweet getTweet() {
- return tweet;
- }
-
- public void setTweet(Tweet tweet) {
- this.tweet = tweet;
- }
-
- public String getDatatime() {
- return datatime;
- }
-
- public void setDatatime(String datatime) {
- this.datatime = datatime;
- }
-
- public int getAppClient() {
- return appClient;
- }
-
- public void setAppClient(int appClient) {
- this.appClient = appClient;
- }
-}
-
diff --git a/app/src/main/java/net/oschina/app/bean/TweetLikeList.java b/app/src/main/java/net/oschina/app/bean/TweetLikeList.java
deleted file mode 100644
index aa22120703357cbf9547feb62aa368730d89ee55..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/bean/TweetLikeList.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package net.oschina.app.bean;
-
-import java.util.List;
-
-import com.thoughtworks.xstream.annotations.XStreamAlias;
-
-/**
- * LikeTweetList.java
- *
- * @author 火蚁(http://my.oschina.net/u/253900)
- *
- * @data 2015-4-10 上午10:11:48
- */
-@SuppressWarnings("serial")
-@XStreamAlias("oschina")
-public class TweetLikeList implements ListEntity {
-
- @XStreamAlias("likeList")
- private List list;
-
- @Override
- public List getList() {
- // TODO Auto-generated method stub
- return list;
- }
-
- public void setList(List list) {
- this.list = list;
- }
-
-}
-
diff --git a/app/src/main/java/net/oschina/app/bean/TweetLikeUserList.java b/app/src/main/java/net/oschina/app/bean/TweetLikeUserList.java
deleted file mode 100644
index df3ee1c359d03d14f828f027f31173bda91ff213..0000000000000000000000000000000000000000
--- a/app/src/main/java/net/oschina/app/bean/TweetLikeUserList.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package net.oschina.app.bean;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import com.thoughtworks.xstream.annotations.XStreamAlias;
-
-/**
- * TweetLikeUserList.java
- *
- * @author 火蚁(http://my.oschina.net/u/253900)
- *
- * @data 2015-3-26 下午4:23:32
- */
-@SuppressWarnings("serial")
-@XStreamAlias("oschina")
-public class TweetLikeUserList implements ListEntity {
-
- @XStreamAlias("likeList")
- private List