Search in sources :

Example 11 with Entity

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

the class SettingsActivity method feedback.

private void feedback() {
    Entity source = new Entity();
    source.setId("304050252938418");
    source.setName(getString(R.string.app_name));
    source.setTb(ParseUtility.profileTb(source.getId()));
    FeedActivity.start(this, source);
}
Also used : Entity(com.androidquery.simplefeed.data.Entity)

Example 12 with Entity

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

the class CommentFragment method renderNote.

private void renderNote(FeedItem item) {
    PQuery aq = super.aq.id(header).find(R.id.note_box);
    Entity from = item.getFrom();
    aq.id(R.id.name).text(from.getName());
    aq.id(R.id.subject).text(item.getSubject());
    aq.id(R.id.meta).text(item.getCachedTime(System.currentTimeMillis()));
    String tb = from.getTb();
    aq.id(R.id.tb).image(tb, true, true, 0, R.drawable.ic_menu_report_image, null, AQuery.FADE_IN_NETWORK);
    String body = item.getMessage();
    body = patchImg(body);
    AQUtility.debug("body", body);
    WebView wv = aq.id(R.id.web).visible().getWebView();
    wv.loadDataWithBaseURL(null, body, "text/html", "utf-8", null);
    aq.id(R.id.content_box).gone();
    renderCount();
}
Also used : Entity(com.androidquery.simplefeed.data.Entity) PQuery(com.androidquery.simplefeed.PQuery) WebView(android.webkit.WebView)

Example 13 with Entity

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

the class CommentFragment method renderNormal.

private void renderNormal(FeedItem item) {
    Entity from = item.getFrom();
    String name = from.getName();
    if (name == null) {
        return;
    }
    if (act.isTablet()) {
        aq.id(R.id.action_box).visible();
    }
    aq.id(R.id.list).visible();
    PQuery aq = super.aq.id(header).find(R.id.normal_box);
    aq.visible();
    aq.id(R.id.name).text(name);
    String desc = item.getDesc();
    String subject = item.getSubject();
    if (act.isTablet() && subject != null) {
        desc = subject;
    }
    aq.id(R.id.desc).text(desc, BufferType.SPANNABLE, true);
    if (maxLines) {
        aq.getTextView().setMaxLines(2);
    }
    aq.id(R.id.meta).text(item.getCachedTime(System.currentTimeMillis()));
    String tb = from.getTb();
    aq.id(R.id.tb).image(tb, true, true, 0, R.drawable.ic_menu_report_image, null, AQuery.FADE_IN_NETWORK);
    String contentTb = item.getContentTb();
    String contentDesc = item.getContentDesc();
    if (drawContent && (contentTb != null || contentDesc != null)) {
        aq.id(R.id.content_box).visible();
        int icon = 0;
        if (contentTb != null) {
            int tbw = item.getCTbWidth();
            if (tbw == 0)
                tbw = 90;
            aq.id(R.id.content_tb).width(tbw, false).height(tbw / 2, false);
            aq.tag(item);
            aq.image(contentTb, true, true, 0, R.drawable.ic_menu_report_image, null, AQuery.FADE_IN_NETWORK, AQuery.RATIO_PRESERVE);
            icon = item.getActionIcon();
            aq.id(R.id.content_ph).visible();
        } else {
            aq.id(R.id.content_tb).clear().gone();
            aq.id(R.id.content_ph).gone();
        }
        aq.id(R.id.content_action);
        if (icon != 0) {
            aq.visible().image(IconUtility.getCached(icon));
        } else {
            aq.gone();
        }
        aq.id(R.id.content_name).text(item.getContentName(), BufferType.SPANNABLE, true).tag(item);
        aq.id(R.id.content_desc).text(contentDesc, BufferType.SPANNABLE, true);
        aq.id(R.id.content_meta).text(item.getContentMeta(), BufferType.SPANNABLE, true);
    } else {
        aq.id(R.id.content_box).gone();
    }
    renderCount();
}
Also used : Entity(com.androidquery.simplefeed.data.Entity) PQuery(com.androidquery.simplefeed.PQuery)

Example 14 with Entity

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

the class AppUtility method getDefaultSource.

public static Entity getDefaultSource(FeedMode mode) {
    Entity entity = new Entity();
    entity.setId("me");
    entity.setName(PrefUtility.get(AppUtility.USER_NAME, MainApplication.get(R.string.me)));
    String type = "feed";
    if (FeedMode.NEWS.equals(mode)) {
        type = "home";
    }
    entity.setMode(type);
    return entity;
}
Also used : Entity(com.androidquery.simplefeed.data.Entity)

Example 15 with Entity

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

the class DialogUtility method makeActions.

public static List<ActionItem> makeActions(Activity act, Entity source, FeedItem item, boolean delete) {
    List<ActionItem> result = new ArrayList<ActionItem>();
    if (item.isLikeable()) {
        result.add(new ActionItem(R.string.like, R.drawable.ics_like, R.string.like));
    }
    if (item.isCommentable()) {
        result.add(new ActionItem(R.string.comment, R.drawable.ics_comment_write, R.string.comment));
        result.add(new ActionItem(R.string.see_comments, R.drawable.ic_menu_start_conversation, R.string.see_comments, item.getCommentCount()));
    }
    Entity from = item.getFrom();
    Entity to = item.getTo();
    if (from.getId() != null && !from.equals(source)) {
        result.add(new ActionItem(R.id.name, from.getTb(), "@ " + from.getName()));
    }
    if (to.getId() != null && !to.equals(from) && !to.equals(source)) {
        result.add(new ActionItem(R.id.name2, to.getTb(), "@ " + to.getName()));
    }
    /*
		Place place = item.getPlace();
		
		if(place != null){
			result.add(new Item(R.string.n_checkins, place.getTb(), "@ " + place.getName()));
		}
		*/
    String type = item.getType();
    String ctb = item.getContentTb();
    String link = item.getLink();
    AQUtility.debug("type", type);
    if (link != null) {
        if (ctb == null)
            ctb = from.getTb();
        if ("photo".equals(type)) {
            result.add(new ActionItem(R.id.content_tb, ctb, act.getString(R.string.view_photo)));
        } else if ("link".equals(type) && !link.contains("facebook.com")) {
            result.add(new ActionItem(R.id.content_name, ctb, act.getString(R.string.view_web)));
        } else if ("video".equals(type)) {
            result.add(new ActionItem(R.id.content_tb, ctb, act.getString(R.string.play_video)));
        }
    }
    if (delete && item.isRemovable()) {
        result.add(new ActionItem(R.string.delete, R.drawable.ic_menu_delete, R.string.delete));
    }
    return result;
}
Also used : Entity(com.androidquery.simplefeed.data.Entity) ArrayList(java.util.ArrayList)

Aggregations

Entity (com.androidquery.simplefeed.data.Entity)15 PQuery (com.androidquery.simplefeed.PQuery)4 FeedMode (com.androidquery.simplefeed.enums.FeedMode)3 ArrayList (java.util.ArrayList)3 Intent (android.content.Intent)2 ActionBar (android.app.ActionBar)1 PendingIntent (android.app.PendingIntent)1 Uri (android.net.Uri)1 WebView (android.webkit.WebView)1 ArrayAdapter (android.widget.ArrayAdapter)1 FeedItem (com.androidquery.simplefeed.data.FeedItem)1 JSONArray (org.json.JSONArray)1 JSONObject (org.json.JSONObject)1