Search in sources :

Example 1 with PQuery

use of com.androidquery.simplefeed.PQuery in project simplefacebook by androidquery.

the class MenuActivity method initActionBar.

private void initActionBar() {
    ActionBar bar = getActionBar();
    if (bar == null)
        return;
    bar.setCustomView(R.layout.action_custom);
    bar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
    PQuery aq = aq2.recycle(bar.getCustomView());
    currentMode = getMode();
    AQUtility.debug("mode", currentMode);
    if (currentMode != null) {
        List<FeedMode> modes = Arrays.asList(FeedMode.values());
        ArrayAdapter<FeedMode> adapter = new ArrayAdapter<FeedMode>(this, R.layout.action_modes, modes);
        adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        currentIndex = modes.indexOf(currentMode);
        aq.id(R.id.spinner_action_bar).adapter(adapter).setSelection(currentIndex).visible().itemSelected(this, "modeSelected");
        if (!isTablet()) {
            aq.id(R.id.text_action_title).gone();
        } else {
            aq.id(R.id.text_action_title).visible();
        }
    } else {
        aq.id(R.id.text_action_title).visible();
        aq.id(R.id.spinner_action_bar).gone();
    }
    Entity entity = getSource();
    if (entity != null) {
        String tb = entity.getTb(handle);
        if (tb != null) {
            aq.id(R.id.image_action_bar).image(tb);
        }
        aq.id(R.id.text_action_title).text(entity.getName());
    } else {
        aq.id(R.id.text_action_title).gone();
    }
}
Also used : Entity(com.androidquery.simplefeed.data.Entity) PQuery(com.androidquery.simplefeed.PQuery) FeedMode(com.androidquery.simplefeed.enums.FeedMode) ActionBar(android.app.ActionBar) ArrayAdapter(android.widget.ArrayAdapter)

Example 2 with PQuery

use of com.androidquery.simplefeed.PQuery in project simplefacebook by androidquery.

the class FeedFragment method initItemView.

private void initItemView(View view) {
    PQuery aq = aq2.recycle(view);
    aq.id(R.id.content_tb).clicked(this);
    aq.id(R.id.content_name).clicked(this);
    aq.id(R.id.button_comment).clicked(this);
    aq.id(R.id.tb).clicked(this);
    aq.id(R.id.name).clicked(this);
    aq.id(R.id.name2).clicked(this);
    if (act.isTablet()) {
        aq.id(R.id.button_like).clicked(this);
        aq.id(R.id.button_source1).clicked(this);
        aq.id(R.id.button_source2).clicked(this);
    }
}
Also used : PQuery(com.androidquery.simplefeed.PQuery)

Example 3 with PQuery

use of com.androidquery.simplefeed.PQuery 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 4 with PQuery

use of com.androidquery.simplefeed.PQuery in project simplefacebook by androidquery.

the class AdhocActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_adhoc);
    aq = new PQuery(this);
    aq2 = new PQuery(this);
    initView();
}
Also used : PQuery(com.androidquery.simplefeed.PQuery)

Example 5 with PQuery

use of com.androidquery.simplefeed.PQuery in project simplefacebook by androidquery.

the class FriendsActivity method itemClicked.

public void itemClicked(AdapterView<?> parent, View view, int pos, long id) {
    Entity entity = getItem(view);
    if (entity == null)
        return;
    if (!selectable) {
        FeedActivity.start(this, entity);
    } else {
        //CheckBox box = (CheckBox) view;
        PQuery aq = aq2.recycle(view);
        aq.id(R.id.checkbox_select);
        boolean checked = aq.isChecked();
        aq.checked(!checked);
        entity.setChecked(!checked);
    }
}
Also used : Entity(com.androidquery.simplefeed.data.Entity) PQuery(com.androidquery.simplefeed.PQuery)

Aggregations

PQuery (com.androidquery.simplefeed.PQuery)12 Entity (com.androidquery.simplefeed.data.Entity)4 View (android.view.View)3 ViewGroup (android.view.ViewGroup)2 ArrayAdapter (android.widget.ArrayAdapter)2 JSONObject (org.json.JSONObject)2 ActionBar (android.app.ActionBar)1 AlertDialog (android.app.AlertDialog)1 DialogInterface (android.content.DialogInterface)1 OnClickListener (android.content.DialogInterface.OnClickListener)1 WebView (android.webkit.WebView)1 TextView (android.widget.TextView)1 MarketService (com.androidquery.service.MarketService)1 PTransformer (com.androidquery.simplefeed.callback.PTransformer)1 FeedItem (com.androidquery.simplefeed.data.FeedItem)1 FeedMode (com.androidquery.simplefeed.enums.FeedMode)1 PagedAdapter (greendroid.widget.PagedAdapter)1 PagedView (greendroid.widget.PagedView)1 OnPagedViewChangeListener (greendroid.widget.PagedView.OnPagedViewChangeListener)1 JSONArray (org.json.JSONArray)1