Search in sources :

Example 1 with FeedItem

use of com.androidquery.simplefeed.data.FeedItem in project simplefacebook by androidquery.

the class NotificationFragment method itemClicked.

public void itemClicked(AdapterView<?> parent, View v, int pos, long id) {
    FeedItem item = (FeedItem) notis.getItem(pos);
    if (item == null)
        return;
    //TODO debug
    if (PrefUtility.isTestDevice()) {
    //item.setLink("http://www.facebook.com/groups/av8dbuy/");
    //item.setLink("http://www.facebook.com/events/248459785218011/");
    //item.setLink("http://www.facebook.com/hsu.mingchin/posts/10150431527981089?cmntid=10150431631416089");
    //item.setLink("http://www.facebook.com/event.php?eid=257399824315939&view=wall");
    //https://graph.facebook.com/0_276142965771432?locale=fr_FR
    //item.setLink("http://www.facebook.com/photo.php?fbid=101s50467124669668&set=a.287473759667.144316.208428464667&type=1");
    //item.setLink("http://www.facebook.com/photo.php?v=10150448332401110");
    }
    String link = item.getLink();
    if (link == null)
        return;
    Uri uri = Uri.parse(link);
    String fbId = extractItemId(item, link, uri);
    AQUtility.debug(item.getLink(), fbId);
    AQUtility.debug(item.getTo(), item.getTo().getName());
    ajaxRead(item);
    if (fbId != null) {
        CommentActivity.start(act, fbId);
        return;
    }
    fbId = extractUserId(item, link, uri);
    AQUtility.debug("userid", fbId);
    if (fbId != null) {
        Entity source = new Entity();
        source.setId(fbId);
        source.setName(fbId);
        FeedActivity.start(act, source);
        return;
    }
    if (openBrowser(item, link, uri)) {
        IntentUtility.openBrowser(act, link);
        return;
    }
    act.showToast(getString(R.string.marked_read));
    if (shouldIgnore(item, link, uri)) {
        return;
    }
    ErrorReporter.report("can't open:" + item.getType() + ":" + item.getLink() + ":" + item.getDesc());
}
Also used : Entity(com.androidquery.simplefeed.data.Entity) FeedItem(com.androidquery.simplefeed.data.FeedItem) Uri(android.net.Uri)

Example 2 with FeedItem

use of com.androidquery.simplefeed.data.FeedItem in project simplefacebook by androidquery.

the class ImageActivity method initView.

private void initView() {
    photos = new ArrayList<FeedItem>();
    pv = (PagedView) findViewById(R.id.paged);
    pi = (PageIndicator) findViewById(R.id.page_indicator);
    pv.setOnPageChangeListener(new OnPagedViewChangeListener() {

        @Override
        public void onStopTracking(PagedView pagedView) {
        }

        @Override
        public void onStartTracking(PagedView pagedView) {
        }

        @Override
        public void onPageChanged(PagedView pagedView, int previousPage, int newPage) {
            pi.setActiveDot(newPage);
        }
    });
    adapter = new PagedAdapter() {

        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            if (position >= photos.size())
                return PageAdapter.getEmptyView(parent);
            FeedItem item = photos.get(position);
            String url = item.getSource();
            if (url == null)
                return PageAdapter.getEmptyView(parent);
            String name = item.getItemName();
            View cached = photoViews.get(url);
            if (cached == null) {
                convertView = aq.inflate(null, R.layout.item_photo, parent);
                photoViews.put(url, convertView);
            } else {
                convertView = cached;
                return convertView;
            }
            PQuery aq = aq2.recycle(convertView);
            aq.id(R.id.web).progress(R.id.progress).invisible();
            AQUtility.debug("image load url", url);
            aq.webImage(url, true, false, 0xFF000000);
            aq.id(R.id.text).text(name, BufferType.NORMAL, true);
            convertView.setDrawingCacheEnabled(true);
            return convertView;
        }

        @Override
        public long getItemId(int position) {
            return position;
        }

        @Override
        public Object getItem(int position) {
            return photos.get(position);
        }

        @Override
        public int getCount() {
            return photos.size();
        }
    };
    pv.setAdapter(adapter);
}
Also used : PagedView(greendroid.widget.PagedView) FeedItem(com.androidquery.simplefeed.data.FeedItem) ViewGroup(android.view.ViewGroup) OnPagedViewChangeListener(greendroid.widget.PagedView.OnPagedViewChangeListener) PQuery(com.androidquery.simplefeed.PQuery) PagedAdapter(greendroid.widget.PagedAdapter) JSONObject(org.json.JSONObject) PagedView(greendroid.widget.PagedView) View(android.view.View)

Example 3 with FeedItem

use of com.androidquery.simplefeed.data.FeedItem in project simplefacebook by androidquery.

the class CommentActivity method start.

public static void start(Activity act, String itemId) {
    FeedItem item = new FeedItem();
    item.setId(itemId);
    start(act, item);
}
Also used : FeedItem(com.androidquery.simplefeed.data.FeedItem)

Example 4 with FeedItem

use of com.androidquery.simplefeed.data.FeedItem in project simplefacebook by androidquery.

the class ActionFragment method init.

@Override
protected void init() {
    initView();
    Intent intent = act.getIntent();
    FeedItem item = (FeedItem) intent.getSerializableExtra("item");
    AQUtility.debug("action init", item);
    if (item != null) {
        setItem(item);
    }
}
Also used : FeedItem(com.androidquery.simplefeed.data.FeedItem) Intent(android.content.Intent)

Example 5 with FeedItem

use of com.androidquery.simplefeed.data.FeedItem in project simplefacebook by androidquery.

the class CommentFragment method init.

@Override
protected void init() {
    initView();
    Intent intent = act.getIntent();
    FeedItem item = (FeedItem) intent.getSerializableExtra("item");
    if (item != null) {
        drawContent = true;
        maxLines = false;
        item.setCommentable(true);
        setItem(item);
    }
}
Also used : FeedItem(com.androidquery.simplefeed.data.FeedItem) Intent(android.content.Intent)

Aggregations

FeedItem (com.androidquery.simplefeed.data.FeedItem)12 Intent (android.content.Intent)2 Uri (android.net.Uri)1 View (android.view.View)1 ViewGroup (android.view.ViewGroup)1 PQuery (com.androidquery.simplefeed.PQuery)1 Entity (com.androidquery.simplefeed.data.Entity)1 PagedAdapter (greendroid.widget.PagedAdapter)1 PagedView (greendroid.widget.PagedView)1 OnPagedViewChangeListener (greendroid.widget.PagedView.OnPagedViewChangeListener)1 JSONObject (org.json.JSONObject)1