use of org.qii.weiciyuan.bean.MessageBean in project weiciyuan by qii.
the class HomeOtherGroupTimeLineDBTask method updateCount.
static void updateCount(String msgId, int commentCount, int repostCount) {
String sql = "select * from " + HomeOtherGroupTable.HomeOtherGroupDataTable.TABLE_NAME + " where " + HomeOtherGroupTable.HomeOtherGroupDataTable.MBLOGID + " = " + msgId + " order by " + HomeOtherGroupTable.HomeOtherGroupDataTable.ID + " asc limit 50";
Cursor c = getRsd().rawQuery(sql, null);
Gson gson = new Gson();
while (c.moveToNext()) {
String id = c.getString(c.getColumnIndex(HomeOtherGroupTable.HomeOtherGroupDataTable.ID));
String json = c.getString(c.getColumnIndex(HomeOtherGroupTable.HomeOtherGroupDataTable.JSONDATA));
if (!TextUtils.isEmpty(json)) {
try {
MessageBean value = gson.fromJson(json, MessageBean.class);
value.setComments_count(commentCount);
value.setReposts_count(repostCount);
String[] args = { id };
ContentValues cv = new ContentValues();
cv.put(HomeOtherGroupTable.HomeOtherGroupDataTable.JSONDATA, gson.toJson(value));
getWsd().update(HomeOtherGroupTable.HomeOtherGroupDataTable.TABLE_NAME, cv, HomeOtherGroupTable.HomeOtherGroupDataTable.ID + "=?", args);
} catch (JsonSyntaxException e) {
}
}
}
}
use of org.qii.weiciyuan.bean.MessageBean in project weiciyuan by qii.
the class FriendsTimeLineDBTask method getHomeLineMsgList.
private static MessageListBean getHomeLineMsgList(String accountId, int limitCount) {
Gson gson = new Gson();
MessageListBean result = new MessageListBean();
int limit = limitCount > AppConfig.DEFAULT_MSG_COUNT_50 ? limitCount : AppConfig.DEFAULT_MSG_COUNT_50;
List<MessageBean> msgList = new ArrayList<MessageBean>();
String sql = "select * from " + HomeTable.HomeDataTable.TABLE_NAME + " where " + HomeTable.HomeDataTable.ACCOUNTID + " = " + accountId + " order by " + HomeTable.HomeDataTable.ID + " asc limit " + limit;
Cursor c = getRsd().rawQuery(sql, null);
while (c.moveToNext()) {
String json = c.getString(c.getColumnIndex(HomeTable.HomeDataTable.JSONDATA));
if (!TextUtils.isEmpty(json)) {
try {
MessageBean value = gson.fromJson(json, MessageBean.class);
if (!value.isMiddleUnreadItem() && !TextUtils.isEmpty(value.getText())) {
value.getListViewSpannableString();
}
msgList.add(value);
} catch (JsonSyntaxException e) {
AppLogger.e(e.getMessage());
}
} else {
msgList.add(null);
}
}
//delete the null flag at the head positon and the end position
for (int i = msgList.size() - 1; i >= 0; i--) {
if (msgList.get(i) == null) {
msgList.remove(i);
} else {
break;
}
}
for (int i = 0; i < msgList.size(); i++) {
if (msgList.get(i) == null) {
msgList.remove(i);
} else {
break;
}
}
result.setStatuses(msgList);
c.close();
return result;
}
use of org.qii.weiciyuan.bean.MessageBean in project weiciyuan by qii.
the class HomeOtherGroupTimeLineDBTask method get.
static MessageListBean get(String accountId, String groupId, int limitCount) {
Gson gson = new Gson();
MessageListBean result = new MessageListBean();
int limit = limitCount > AppConfig.DEFAULT_MSG_COUNT_50 ? limitCount : AppConfig.DEFAULT_MSG_COUNT_50;
List<MessageBean> msgList = new ArrayList<MessageBean>();
String sql = "select * from " + HomeOtherGroupTable.HomeOtherGroupDataTable.TABLE_NAME + " where " + HomeOtherGroupTable.HomeOtherGroupDataTable.ACCOUNTID + " = " + accountId + " and " + HomeOtherGroupTable.HomeOtherGroupDataTable.GROUPID + " = " + groupId + " order by " + HomeOtherGroupTable.HomeOtherGroupDataTable.ID + " asc limit " + limit;
Cursor c = getRsd().rawQuery(sql, null);
while (c.moveToNext()) {
String json = c.getString(c.getColumnIndex(HomeOtherGroupTable.HomeOtherGroupDataTable.JSONDATA));
if (!TextUtils.isEmpty(json)) {
try {
MessageBean value = gson.fromJson(json, MessageBean.class);
if (!value.isMiddleUnreadItem()) {
value.getListViewSpannableString();
}
msgList.add(value);
} catch (JsonSyntaxException e) {
AppLogger.e(e.getMessage());
}
} else {
msgList.add(null);
}
}
//delete the null flag at the head positon and the end position
for (int i = msgList.size() - 1; i >= 0; i--) {
if (msgList.get(i) == null) {
msgList.remove(i);
} else {
break;
}
}
for (int i = 0; i < msgList.size(); i++) {
if (msgList.get(i) == null) {
msgList.remove(i);
} else {
break;
}
}
result.setStatuses(msgList);
c.close();
return result;
}
use of org.qii.weiciyuan.bean.MessageBean in project weiciyuan by qii.
the class GalleryActivity method onCreate.
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.galleryactivity_layout);
animationView = (ImageView) findViewById(R.id.animation);
currentViewPositionLayout = findViewById(R.id.position_layout);
position = (TextView) findViewById(R.id.position);
TextView sum = (TextView) findViewById(R.id.sum);
// rect = ((AnimationRect) getIntent().getParcelableArrayListExtra("rect")).scaledBitmapRect;
MessageBean msg = getIntent().getParcelableExtra("msg");
ArrayList<String> tmp = msg.getThumbnailPicUrls();
for (int i = 0; i < tmp.size(); i++) {
urls.add(tmp.get(i).replace("thumbnail", "large"));
}
sum.setText(String.valueOf(urls.size()));
//jump to new gallery animation activity
if (urls.size() < 10 && ImageUtility.isThisBitmapCanRead(FileManager.getFilePathFromUrl(urls.get(0), FileLocationMethod.picture_large))) {
Intent intent = new Intent(this, GalleryAnimationActivity.class);
intent.putExtra("msg", getIntent().getParcelableExtra("msg"));
intent.putExtra("rect", getIntent().getParcelableArrayListExtra("rect"));
intent.putExtra("position", getIntent().getIntExtra("position", 0));
startActivity(intent);
overridePendingTransition(0, 0);
finish();
return;
}
pager = (ViewPager) findViewById(R.id.pager);
pager.setAdapter(new ImagePagerAdapter());
pager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
@Override
public void onPageSelected(int position) {
super.onPageSelected(position);
GalleryActivity.this.position.setText(String.valueOf(position + 1));
}
});
pager.setCurrentItem(getIntent().getIntExtra("position", 0));
pager.setOffscreenPageLimit(1);
pager.setPageTransformer(true, new ZoomOutPageTransformer());
pager.setPadding(0, Utility.dip2px(STATUS_BAR_HEIGHT_DP_UNIT), 0, 0);
}
use of org.qii.weiciyuan.bean.MessageBean in project weiciyuan by qii.
the class GalleryAnimationActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.galleryactivity_animation_layout);
rectList = getIntent().getParcelableArrayListExtra("rect");
MessageBean msg = getIntent().getParcelableExtra("msg");
ArrayList<String> tmp = msg.getThumbnailPicUrls();
for (int i = 0; i < tmp.size(); i++) {
urls.add(tmp.get(i).replace("thumbnail", "large"));
}
boolean disableHardwareLayerType = false;
for (String url : urls) {
if (url.contains(".gif")) {
disableHardwareLayerType = true;
break;
}
}
position = (TextView) findViewById(R.id.position);
initPosition = getIntent().getIntExtra("position", 0);
pager = (ViewPager) findViewById(R.id.pager);
pager.setAdapter(new ImagePagerAdapter(getSupportFragmentManager()));
final boolean finalDisableHardwareLayerType = disableHardwareLayerType;
pager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
@Override
public void onPageSelected(int position) {
super.onPageSelected(position);
GalleryAnimationActivity.this.position.setText(String.valueOf(position + 1));
}
@Override
public void onPageScrollStateChanged(int scrollState) {
if (scrollState != ViewPager.SCROLL_STATE_IDLE && finalDisableHardwareLayerType) {
final int childCount = pager.getChildCount();
for (int i = 0; i < childCount; i++) {
View child = pager.getChildAt(i);
if (child.getLayerType() != View.LAYER_TYPE_NONE) {
child.setLayerType(View.LAYER_TYPE_NONE, null);
}
}
}
}
});
pager.setCurrentItem(getIntent().getIntExtra("position", 0));
pager.setOffscreenPageLimit(1);
pager.setPageTransformer(true, new ZoomOutPageTransformer());
TextView sum = (TextView) findViewById(R.id.sum);
sum.setText(String.valueOf(urls.size()));
background = AnimationUtility.getAppContentView(this);
if (savedInstanceState != null) {
showBackgroundImmediately();
}
}
Aggregations