Search in sources :

Example 1 with CategoriesArrayAdapter

use of com.klinker.android.twitter.adapters.CategoriesArrayAdapter in project Talon-for-Twitter by klinker24.

the class CategoryFragment method getSuggestions.

public void getSuggestions() {
    new Thread(new Runnable() {

        @Override
        public void run() {
            try {
                Twitter twitter = Utils.getTwitter(context, DrawerActivity.settings);
                int i = 0;
                final ResponseList<Category> categories = twitter.getSuggestedUserCategories();
                Collections.sort(categories, new Comparator<Category>() {

                    public int compare(Category result1, Category result2) {
                        return result1.getName().compareTo(result2.getName());
                    }
                });
                ((Activity) context).runOnUiThread(new Runnable() {

                    @Override
                    public void run() {
                        listView.setAdapter(new CategoriesArrayAdapter(context, categories));
                        listView.setVisibility(View.VISIBLE);
                        LinearLayout spinner = (LinearLayout) layout.findViewById(R.id.list_progress);
                        spinner.setVisibility(View.GONE);
                    }
                });
            } catch (Throwable e) {
                e.printStackTrace();
                ((Activity) context).runOnUiThread(new Runnable() {

                    @Override
                    public void run() {
                        Toast.makeText(context, getResources().getString(R.string.no_location), Toast.LENGTH_SHORT).show();
                    }
                });
            }
        }
    }).start();
}
Also used : Category(twitter4j.Category) CategoriesArrayAdapter(com.klinker.android.twitter.adapters.CategoriesArrayAdapter) Twitter(twitter4j.Twitter) DrawerActivity(com.klinker.android.twitter.activities.drawer_activities.DrawerActivity) Activity(android.app.Activity) LinearLayout(android.widget.LinearLayout)

Aggregations

Activity (android.app.Activity)1 LinearLayout (android.widget.LinearLayout)1 DrawerActivity (com.klinker.android.twitter.activities.drawer_activities.DrawerActivity)1 CategoriesArrayAdapter (com.klinker.android.twitter.adapters.CategoriesArrayAdapter)1 Category (twitter4j.Category)1 Twitter (twitter4j.Twitter)1