Android Open Source - SimpleReader Category Detail Activity From Project Back to project page SimpleReader .
License The source code is released under:
Apache License
If you think the Android project SimpleReader listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
Java Source Code package com.dreamteam.app.ui;
/ * f r o m w w w . j a v a 2 s . c o m * /
import java.util.ArrayList;
import android.content.Intent;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ImageButton;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import com.dreamteam.app.adapter.CategoryDetailAdapter;
import com.dreamteam.app.commons.AppContext;
import com.dreamteam.app.db.FeedDBManager;
import com.dreamteam.app.entity.Feed;
import com.dreamteam.app.utils.Logger;
import com.dreamteam.app.utils.StringUtils;
import com.dreateam.app.ui.R;
public class CategoryDetailActivity extends BaseActivity
{
private ListView detailList;
private ImageButton mLeftButton;
private ImageButton mRightButton;
private TextView mCenterTitle;
private ArrayList<Feed> feeds = new ArrayList<Feed>();
private CategoryDetailAdapter mAdapter;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
initView();
initData();
}
private void initData()
{
Intent intent = getIntent();
String tableName = intent.getStringExtra("tname" );
Logger.debug("tangl" , "tname" + tableName);
if (StringUtils.isEmpty(tableName)) {
return ;
}
//?????????
FeedDBManager helper = new FeedDBManager(this , FeedDBManager.DB_NAME, null, 1);
SQLiteDatabase db = helper.getWritableDatabase();
Cursor cursor = db.query(tableName, null, null, null, null, null, null);
if (cursor.moveToFirst())
{
for (int i = 0, n = cursor.getCount(); i < n; i++)
{
Feed f = new Feed();
String title = cursor.getString(cursor.getColumnIndex("title" ));
String url = cursor.getString(cursor.getColumnIndex("url" ));
int selectStatus = cursor.getInt(cursor
.getColumnIndex("select_status" ));
f.setTitle(title);
f.setUrl(url);
f.setSelectStatus(selectStatus);
feeds.add(f);
cursor.moveToNext();
}
}
db.close();
//??????
mAdapter = new CategoryDetailAdapter(this , feeds, tableName);
detailList.setAdapter(mAdapter);
}
private void initView()
{
setContentView(R.layout.category_detail);
mLeftButton = (ImageButton) findViewById(R.id.common_left_button);
mRightButton = (ImageButton) findViewById(R.id.common_right_button);
mCenterTitle = (TextView) findViewById(R.id.common_center_text);
mCenterTitle.setText(R.string.feed_detail);
mRightButton.setVisibility(View.GONE);
mLeftButton.setOnClickListener(new OnClickListener()
{
@Override
public void onClick(View v)
{
finish();
}
});
detailList = (ListView) findViewById(R.id.catagory_detail_lv_feed);
detailList.setOnItemClickListener(new OnItemClickListener()
{
@Override
public void onItemClick(AdapterView<?> parent, View view, int position,
long id)
{
if (!AppContext.isNetworkAvailable(CategoryDetailActivity.this))
{
Toast.makeText(CategoryDetailActivity.this, "?????????" , Toast.LENGTH_SHORT).show();
return ;
}
//feed??
}
});
}
}
Java Source Code List com.dreamteam.app.adapter.CategoryDetailAdapter.java com.dreamteam.app.adapter.FeedCategoryAdapter.java com.dreamteam.app.adapter.GridAdapter.java com.dreamteam.app.adapter.GuideViewPagerAdapter.java com.dreamteam.app.adapter.ItemListAdapter.java com.dreamteam.app.adapter.MPagerAdapter.java com.dreamteam.app.commons.AppConfig.java com.dreamteam.app.commons.AppContext.java com.dreamteam.app.commons.HtmlFilter.java com.dreamteam.app.commons.IFlyHelper.java com.dreamteam.app.commons.ItemListEntityParser.java com.dreamteam.app.commons.SectionHelper.java com.dreamteam.app.commons.SeriaHelper.java com.dreamteam.app.commons.SkinManager.java com.dreamteam.app.commons.UIHelper.java com.dreamteam.app.config.Contants.java com.dreamteam.app.db.DbManager.java com.dreamteam.app.db.FavoItemDbHelper.java com.dreamteam.app.db.FeedDBManager.java com.dreamteam.app.db.provider.RSSFeedCategoryProvider.java com.dreamteam.app.entity.FeedItem.java com.dreamteam.app.entity.Feed.java com.dreamteam.app.entity.ItemListEntity.java com.dreamteam.app.entity.RSSFeedCategroy.java com.dreamteam.app.entity.Section.java com.dreamteam.app.img.FileCacheManager.java com.dreamteam.app.img.FileCache.java com.dreamteam.app.img.ICache.java com.dreamteam.app.img.ImageLoadTask.java com.dreamteam.app.img.ImageLoad.java com.dreamteam.app.img.ImageLoader.java com.dreamteam.app.img.MemoryCache.java com.dreamteam.app.rss.Dates.java com.dreamteam.app.rss.Integers.java com.dreamteam.app.rss.MediaAttributes.java com.dreamteam.app.rss.MediaEnclosure.java com.dreamteam.app.rss.MediaThumbnail.java com.dreamteam.app.rss.RSSBase.java com.dreamteam.app.rss.RSSConfig.java com.dreamteam.app.rss.RSSException.java com.dreamteam.app.rss.RSSFault.java com.dreamteam.app.rss.RSSFeed.java com.dreamteam.app.rss.RSSHandler.java com.dreamteam.app.rss.RSSItem.java com.dreamteam.app.rss.RSSLoader.java com.dreamteam.app.rss.RSSParserSPI.java com.dreamteam.app.rss.RSSParser.java com.dreamteam.app.rss.RSSReaderException.java com.dreamteam.app.rss.RSSReader.java com.dreamteam.app.rss.Resources.java com.dreamteam.app.ui.About.java com.dreamteam.app.ui.BaseActivity.java com.dreamteam.app.ui.BaseTitledActivity.java com.dreamteam.app.ui.CategoryDetailActivity.java com.dreamteam.app.ui.ColorListActivity.java com.dreamteam.app.ui.FavoriteItemList.java com.dreamteam.app.ui.FeedCategoryActivity.java com.dreamteam.app.ui.FeedbackUI.java com.dreamteam.app.ui.GuideActivity.java com.dreamteam.app.ui.ImageDialog.java com.dreamteam.app.ui.ImagesBrowseActivity.java com.dreamteam.app.ui.ItemDetailActivity.java com.dreamteam.app.ui.ItemListActivity.java com.dreamteam.app.ui.LocalImageBrowseActivity.java com.dreamteam.app.ui.LoginDialog.java com.dreamteam.app.ui.MainActivity.java com.dreamteam.app.ui.Setting.java com.dreamteam.app.ui.SplashActivity.java com.dreamteam.app.ui.SwitchBgActivity.java com.dreamteam.app.ui.WidgetProvider.java com.dreamteam.app.ui.adapter.ColorListAdapter.java com.dreamteam.app.utils.CategoryNameExchange.java com.dreamteam.app.utils.DateUtils.java com.dreamteam.app.utils.FileUtils.java com.dreamteam.app.utils.HttpUtils.java com.dreamteam.app.utils.ImageLoader.java com.dreamteam.app.utils.ImageUtils.java com.dreamteam.app.utils.Logger.java com.dreamteam.app.utils.MD5.java com.dreamteam.app.utils.StringUtils.java com.dreamteam.app.wallpaper.ChildAdapter.java com.dreamteam.app.wallpaper.GroupGridAdapter.java com.dreamteam.app.wallpaper.ImageBean.java com.dreamteam.app.wallpaper.MyImageView.java com.dreamteam.app.wallpaper.NativeImageLoader.java com.dreamteam.app.wallpaper.WallPaperManager.java com.dreamteam.custom.ui.PathAnimations.java com.dreamteam.custom.ui.PullToRefreshListView.java