Search in sources :

Example 11 with TextButtonItem

use of com.abewy.klyph.items.TextButtonItem in project Klyph by jonathangerbaud.

the class KlyphFragment method onRequestNewestError.

private void onRequestNewestError(RequestError error) {
    Log.d("StreamListFragment", "error " + error.toString());
    if (getView() == null || getActivity() == null)
        return;
    int errorText = this.errorNewestText;
    if (!ConnectionState.getInstance(getView().getContext()).isOnline()) {
        errorText = R.string.request_connexion_error;
    }
    TextButtonItem errorItem = new TextButtonItem();
    errorItem.setText(getString(errorText));
    // TODO This is not a good coding practice !
    errorItem.setButtonListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            loadNewest();
        }
    });
    getAdapter().insert(errorItem, 0);
    getAdapter().notifyDataSetChanged();
    if (mPullToRefreshLayout != null)
        mPullToRefreshLayout.setRefreshComplete();
    newestLoading = false;
}
Also used : TextButtonItem(com.abewy.klyph.items.TextButtonItem) KlyphListView(com.abewy.android.apps.klyph.widget.KlyphListView) ListEmptyView(com.abewy.android.apps.klyph.view.ListEmptyView) View(android.view.View) AbsListView(android.widget.AbsListView) ListView(android.widget.ListView)

Aggregations

TextButtonItem (com.abewy.klyph.items.TextButtonItem)11 View (android.view.View)5 AbsListView (android.widget.AbsListView)5 GraphObject (com.abewy.android.apps.klyph.core.graph.GraphObject)5 ListEmptyView (com.abewy.android.apps.klyph.view.ListEmptyView)5 AdapterView (android.widget.AdapterView)2 ListView (android.widget.ListView)2 Response (com.abewy.android.apps.klyph.core.request.Response)2 AsyncRequest (com.abewy.android.apps.klyph.request.AsyncRequest)2 KlyphGridView (com.abewy.android.apps.klyph.widget.KlyphGridView)2 KlyphListView (com.abewy.android.apps.klyph.widget.KlyphListView)2 TextButtonItemHolder (com.abewy.android.apps.klyph.adapter.holder.TextButtonItemHolder)1