Search in sources :

Example 1 with FullScreenSwipeRefreshLayout

use of com.klinker.android.twitter.views.swipe_refresh_layout.FullScreenSwipeRefreshLayout in project Talon-for-Twitter by klinker24.

the class ChoosenListActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    overridePendingTransition(R.anim.activity_slide_up, R.anim.activity_slide_down);
    context = this;
    sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
    settings = AppSettings.getInstance(this);
    if (settings.advanceWindowed) {
        setUpWindow();
    }
    Utils.setUpPopupTheme(this, settings);
    actionBar = getActionBar();
    actionBar.setTitle(getResources().getString(R.string.lists));
    setContentView(R.layout.ptr_list_layout);
    if (!settings.isTwitterLoggedIn) {
        Intent login = new Intent(context, LoginActivity.class);
        startActivity(login);
        finish();
    }
    mPullToRefreshLayout = (FullScreenSwipeRefreshLayout) findViewById(R.id.swipe_refresh_layout);
    spinner = (LinearLayout) findViewById(R.id.list_progress);
    mPullToRefreshLayout.setOnRefreshListener(new FullScreenSwipeRefreshLayout.OnRefreshListener() {

        @Override
        public void onRefresh() {
            onRefreshStarted();
        }
    });
    if (settings.addonTheme) {
        mPullToRefreshLayout.setColorScheme(settings.accentInt, SwipeProgressBar.COLOR2, settings.accentInt, SwipeProgressBar.COLOR3);
    } else {
        if (settings.theme != AppSettings.THEME_LIGHT) {
            mPullToRefreshLayout.setColorScheme(context.getResources().getColor(R.color.app_color), SwipeProgressBar.COLOR2, context.getResources().getColor(R.color.app_color), SwipeProgressBar.COLOR3);
        } else {
            mPullToRefreshLayout.setColorScheme(context.getResources().getColor(R.color.app_color), getResources().getColor(R.color.light_ptr_1), context.getResources().getColor(R.color.app_color), getResources().getColor(R.color.light_ptr_2));
        }
    }
    listView = (AsyncListView) findViewById(R.id.listView);
    listView.setOnScrollListener(new AbsListView.OnScrollListener() {

        @Override
        public void onScrollStateChanged(AbsListView absListView, int i) {
        }

        @Override
        public void onScroll(AbsListView absListView, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
            final int lastItem = firstVisibleItem + visibleItemCount;
            if (lastItem == totalItemCount && canRefresh) {
                getLists();
            }
        }
    });
    BitmapLruCache cache = App.getInstance(context).getBitmapCache();
    ArrayListLoader loader = new ArrayListLoader(cache, context);
    ItemManager.Builder builder = new ItemManager.Builder(loader);
    builder.setPreloadItemsEnabled(true).setPreloadItemsCount(50);
    builder.setThreadPoolSize(4);
    listView.setItemManager(builder.build());
    listName = getIntent().getStringExtra("list_name");
    listId = Long.parseLong(getIntent().getStringExtra("list_id"));
    actionBar.setTitle(listName);
    getLists();
    Utils.setActionBar(context);
}
Also used : BitmapLruCache(uk.co.senab.bitmapcache.BitmapLruCache) ArrayListLoader(com.klinker.android.twitter.adapters.ArrayListLoader) ItemManager(org.lucasr.smoothie.ItemManager) FullScreenSwipeRefreshLayout(com.klinker.android.twitter.views.swipe_refresh_layout.FullScreenSwipeRefreshLayout) AbsListView(android.widget.AbsListView) Intent(android.content.Intent) Point(android.graphics.Point)

Example 2 with FullScreenSwipeRefreshLayout

use of com.klinker.android.twitter.views.swipe_refresh_layout.FullScreenSwipeRefreshLayout in project Talon-for-Twitter by klinker24.

the class TimelineSearchFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreateView(inflater, container, null);
    translucent = getArguments().getBoolean("translucent", false);
    searchQuery = getArguments().getString("search");
    settings = AppSettings.getInstance(context);
    inflater = LayoutInflater.from(context);
    layout = inflater.inflate(R.layout.ptr_list_layout, null);
    mPullToRefreshLayout = (FullScreenSwipeRefreshLayout) layout.findViewById(R.id.swipe_refresh_layout);
    mPullToRefreshLayout.setFullScreen(false);
    mPullToRefreshLayout.setOnRefreshListener(new FullScreenSwipeRefreshLayout.OnRefreshListener() {

        @Override
        public void onRefresh() {
            onRefreshStarted();
        }
    });
    if (settings.addonTheme) {
        mPullToRefreshLayout.setColorScheme(settings.accentInt, SwipeProgressBar.COLOR2, settings.accentInt, SwipeProgressBar.COLOR3);
    } else {
        if (settings.theme != AppSettings.THEME_LIGHT) {
            mPullToRefreshLayout.setColorScheme(context.getResources().getColor(R.color.app_color), SwipeProgressBar.COLOR2, context.getResources().getColor(R.color.app_color), SwipeProgressBar.COLOR3);
        } else {
            mPullToRefreshLayout.setColorScheme(context.getResources().getColor(R.color.app_color), getResources().getColor(R.color.light_ptr_1), context.getResources().getColor(R.color.app_color), getResources().getColor(R.color.light_ptr_2));
        }
    }
    listView = (AsyncListView) layout.findViewById(R.id.listView);
    if (translucent) {
        if (Utils.hasNavBar(context)) {
            View footer = new View(context);
            footer.setOnClickListener(null);
            footer.setOnLongClickListener(null);
            ListView.LayoutParams params = new ListView.LayoutParams(ListView.LayoutParams.MATCH_PARENT, Utils.getNavBarHeight(context));
            footer.setLayoutParams(params);
            listView.addFooterView(footer);
            listView.setFooterDividersEnabled(false);
        }
    }
    spinner = (LinearLayout) layout.findViewById(R.id.list_progress);
    spinner.setVisibility(View.GONE);
    BitmapLruCache cache = App.getInstance(context).getBitmapCache();
    CursorListLoader loader = new CursorListLoader(cache, context);
    ItemManager.Builder builder = new ItemManager.Builder(loader);
    builder.setPreloadItemsEnabled(true).setPreloadItemsCount(10);
    builder.setThreadPoolSize(2);
    listView.setItemManager(builder.build());
    doSearch(searchQuery);
    return layout;
}
Also used : BitmapLruCache(uk.co.senab.bitmapcache.BitmapLruCache) CursorListLoader(com.klinker.android.twitter.adapters.CursorListLoader) AsyncListView(org.lucasr.smoothie.AsyncListView) ListView(android.widget.ListView) ItemManager(org.lucasr.smoothie.ItemManager) FullScreenSwipeRefreshLayout(com.klinker.android.twitter.views.swipe_refresh_layout.FullScreenSwipeRefreshLayout) AsyncListView(org.lucasr.smoothie.AsyncListView) View(android.view.View) ListView(android.widget.ListView)

Example 3 with FullScreenSwipeRefreshLayout

use of com.klinker.android.twitter.views.swipe_refresh_layout.FullScreenSwipeRefreshLayout in project Talon-for-Twitter by klinker24.

the class TwitterSearchFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreateView(inflater, container, null);
    this.translucent = getArguments().getBoolean("translucent", false);
    this.searchQuery = getArguments().getString("search");
    this.onlyStatus = getArguments().getBoolean("only_status", false);
    settings = AppSettings.getInstance(context);
    inflater = LayoutInflater.from(context);
    layout = inflater.inflate(R.layout.ptr_list_layout, null);
    mPullToRefreshLayout = (FullScreenSwipeRefreshLayout) layout.findViewById(R.id.swipe_refresh_layout);
    mPullToRefreshLayout.setFullScreen(false);
    mPullToRefreshLayout.setOnRefreshListener(new FullScreenSwipeRefreshLayout.OnRefreshListener() {

        @Override
        public void onRefresh() {
            onRefreshStarted();
        }
    });
    if (settings.addonTheme) {
        mPullToRefreshLayout.setColorScheme(settings.accentInt, SwipeProgressBar.COLOR2, settings.accentInt, SwipeProgressBar.COLOR3);
    } else {
        if (settings.theme != AppSettings.THEME_LIGHT) {
            mPullToRefreshLayout.setColorScheme(context.getResources().getColor(R.color.app_color), SwipeProgressBar.COLOR2, context.getResources().getColor(R.color.app_color), SwipeProgressBar.COLOR3);
        } else {
            mPullToRefreshLayout.setColorScheme(context.getResources().getColor(R.color.app_color), getResources().getColor(R.color.light_ptr_1), context.getResources().getColor(R.color.app_color), getResources().getColor(R.color.light_ptr_2));
        }
    }
    listView = (AsyncListView) layout.findViewById(R.id.listView);
    listView.setOnScrollListener(new AbsListView.OnScrollListener() {

        @Override
        public void onScrollStateChanged(AbsListView absListView, int i) {
        }

        @Override
        public void onScroll(AbsListView absListView, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
            final int lastItem = firstVisibleItem + visibleItemCount;
            if (lastItem == totalItemCount && canRefresh) {
                getMore();
            }
        }
    });
    if (translucent) {
        if (Utils.hasNavBar(context)) {
            View footer = new View(context);
            footer.setOnClickListener(null);
            footer.setOnLongClickListener(null);
            ListView.LayoutParams params = new ListView.LayoutParams(ListView.LayoutParams.MATCH_PARENT, Utils.getNavBarHeight(context));
            footer.setLayoutParams(params);
            listView.addFooterView(footer);
            listView.setFooterDividersEnabled(false);
        }
    }
    spinner = (LinearLayout) layout.findViewById(R.id.list_progress);
    spinner.setVisibility(View.GONE);
    if (searchQuery != null && !searchQuery.equals("")) {
        BitmapLruCache cache = App.getInstance(context).getBitmapCache();
        ArrayListLoader loader = new ArrayListLoader(cache, context);
        ItemManager.Builder builder = new ItemManager.Builder(loader);
        builder.setPreloadItemsEnabled(true).setPreloadItemsCount(10);
        builder.setThreadPoolSize(2);
        listView.setItemManager(builder.build());
    }
    if (onlyStatus) {
        try {
            findStatus(Long.parseLong(searchQuery));
        } catch (Exception e) {
        }
    } else {
        doSearch(searchQuery);
    }
    return layout;
}
Also used : ArrayListLoader(com.klinker.android.twitter.adapters.ArrayListLoader) ItemManager(org.lucasr.smoothie.ItemManager) FullScreenSwipeRefreshLayout(com.klinker.android.twitter.views.swipe_refresh_layout.FullScreenSwipeRefreshLayout) AbsListView(android.widget.AbsListView) AsyncListView(org.lucasr.smoothie.AsyncListView) View(android.view.View) AbsListView(android.widget.AbsListView) ListView(android.widget.ListView) BitmapLruCache(uk.co.senab.bitmapcache.BitmapLruCache) AsyncListView(org.lucasr.smoothie.AsyncListView) AbsListView(android.widget.AbsListView) ListView(android.widget.ListView)

Example 4 with FullScreenSwipeRefreshLayout

use of com.klinker.android.twitter.views.swipe_refresh_layout.FullScreenSwipeRefreshLayout in project Talon-for-Twitter by klinker24.

the class UserListFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreateView(inflater, container, null);
    settings = AppSettings.getInstance(context);
    View layout = LayoutInflater.from(context).inflate(R.layout.ptr_list_layout, container, false);
    changeNoRetweetersText(layout);
    mPullToRefreshLayout = (FullScreenSwipeRefreshLayout) layout.findViewById(R.id.swipe_refresh_layout);
    mPullToRefreshLayout.setOnRefreshListener(new FullScreenSwipeRefreshLayout.OnRefreshListener() {

        @Override
        public void onRefresh() {
            onRefreshStarted();
        }
    });
    if (settings.addonTheme) {
        mPullToRefreshLayout.setColorScheme(settings.accentInt, SwipeProgressBar.COLOR2, settings.accentInt, SwipeProgressBar.COLOR3);
    } else {
        if (settings.theme != AppSettings.THEME_LIGHT) {
            mPullToRefreshLayout.setColorScheme(context.getResources().getColor(R.color.app_color), SwipeProgressBar.COLOR2, context.getResources().getColor(R.color.app_color), SwipeProgressBar.COLOR3);
        } else {
            mPullToRefreshLayout.setColorScheme(context.getResources().getColor(R.color.app_color), getResources().getColor(R.color.light_ptr_1), context.getResources().getColor(R.color.app_color), getResources().getColor(R.color.light_ptr_2));
        }
    }
    spinner = (LinearLayout) layout.findViewById(R.id.list_progress);
    noContent = (LinearLayout) layout.findViewById(R.id.no_content);
    listView = (AsyncListView) layout.findViewById(R.id.listView);
    BitmapLruCache cache = App.getInstance(context).getBitmapCache();
    ArrayListLoader loader = new ArrayListLoader(cache, context);
    ItemManager.Builder builder = new ItemManager.Builder(loader);
    builder.setPreloadItemsEnabled(true).setPreloadItemsCount(50);
    builder.setThreadPoolSize(4);
    listView.setItemManager(builder.build());
    tweetId = getArguments().getLong("id", 0);
    onRefreshStarted();
    return layout;
}
Also used : BitmapLruCache(uk.co.senab.bitmapcache.BitmapLruCache) ArrayListLoader(com.klinker.android.twitter.adapters.ArrayListLoader) ItemManager(org.lucasr.smoothie.ItemManager) FullScreenSwipeRefreshLayout(com.klinker.android.twitter.views.swipe_refresh_layout.FullScreenSwipeRefreshLayout) AsyncListView(org.lucasr.smoothie.AsyncListView) View(android.view.View)

Example 5 with FullScreenSwipeRefreshLayout

use of com.klinker.android.twitter.views.swipe_refresh_layout.FullScreenSwipeRefreshLayout in project Talon-for-Twitter by klinker24.

the class UserSearchFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);
    this.translucent = getArguments().getBoolean("translucent", false);
    this.searchQuery = getArguments().getString("search").replaceAll("@", "");
    searchQuery = searchQuery.replace(" TOP", "");
    searchQuery = searchQuery.replace(" -RT", "");
    this.onlyProfile = getArguments().getBoolean("only_profile", false);
    settings = AppSettings.getInstance(context);
    inflater = LayoutInflater.from(context);
    layout = inflater.inflate(R.layout.ptr_list_layout, null);
    mPullToRefreshLayout = (FullScreenSwipeRefreshLayout) layout.findViewById(R.id.swipe_refresh_layout);
    mPullToRefreshLayout.setFullScreen(false);
    mPullToRefreshLayout.setOnRefreshListener(new FullScreenSwipeRefreshLayout.OnRefreshListener() {

        @Override
        public void onRefresh() {
            onRefreshStarted();
        }
    });
    if (settings.addonTheme) {
        mPullToRefreshLayout.setColorScheme(settings.accentInt, SwipeProgressBar.COLOR2, settings.accentInt, SwipeProgressBar.COLOR3);
    } else {
        if (settings.theme != AppSettings.THEME_LIGHT) {
            mPullToRefreshLayout.setColorScheme(context.getResources().getColor(R.color.app_color), SwipeProgressBar.COLOR2, context.getResources().getColor(R.color.app_color), SwipeProgressBar.COLOR3);
        } else {
            mPullToRefreshLayout.setColorScheme(context.getResources().getColor(R.color.app_color), getResources().getColor(R.color.light_ptr_1), context.getResources().getColor(R.color.app_color), getResources().getColor(R.color.light_ptr_2));
        }
    }
    listView = (AsyncListView) layout.findViewById(R.id.listView);
    listView.setOnScrollListener(new AbsListView.OnScrollListener() {

        @Override
        public void onScrollStateChanged(AbsListView absListView, int i) {
        }

        @Override
        public void onScroll(AbsListView absListView, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
            final int lastItem = firstVisibleItem + visibleItemCount;
            if (lastItem == totalItemCount && canRefresh) {
                getMoreUsers(searchQuery.replace("@", ""));
            }
        }
    });
    if (translucent) {
        if (Utils.hasNavBar(context)) {
            View footer = new View(context);
            footer.setOnClickListener(null);
            footer.setOnLongClickListener(null);
            ListView.LayoutParams params = new ListView.LayoutParams(ListView.LayoutParams.MATCH_PARENT, Utils.getNavBarHeight(context));
            footer.setLayoutParams(params);
            listView.addFooterView(footer);
            listView.setFooterDividersEnabled(false);
        }
    }
    spinner = (LinearLayout) layout.findViewById(R.id.list_progress);
    spinner.setVisibility(View.GONE);
    if (searchQuery != null && !searchQuery.equals("") && !searchQuery.contains("@")) {
        BitmapLruCache cache = App.getInstance(context).getBitmapCache();
        ArrayListLoader loader = new ArrayListLoader(cache, context);
        ItemManager.Builder builder = new ItemManager.Builder(loader);
        builder.setPreloadItemsEnabled(true).setPreloadItemsCount(10);
        builder.setThreadPoolSize(2);
        listView.setItemManager(builder.build());
    }
    doUserSearch(searchQuery);
    return layout;
}
Also used : ArrayListLoader(com.klinker.android.twitter.adapters.ArrayListLoader) ItemManager(org.lucasr.smoothie.ItemManager) FullScreenSwipeRefreshLayout(com.klinker.android.twitter.views.swipe_refresh_layout.FullScreenSwipeRefreshLayout) AbsListView(android.widget.AbsListView) AsyncListView(org.lucasr.smoothie.AsyncListView) View(android.view.View) AbsListView(android.widget.AbsListView) ListView(android.widget.ListView) BitmapLruCache(uk.co.senab.bitmapcache.BitmapLruCache) AsyncListView(org.lucasr.smoothie.AsyncListView) AbsListView(android.widget.AbsListView) ListView(android.widget.ListView)

Aggregations

FullScreenSwipeRefreshLayout (com.klinker.android.twitter.views.swipe_refresh_layout.FullScreenSwipeRefreshLayout)6 ItemManager (org.lucasr.smoothie.ItemManager)6 BitmapLruCache (uk.co.senab.bitmapcache.BitmapLruCache)6 ArrayListLoader (com.klinker.android.twitter.adapters.ArrayListLoader)5 View (android.view.View)4 AbsListView (android.widget.AbsListView)4 AsyncListView (org.lucasr.smoothie.AsyncListView)4 ListView (android.widget.ListView)3 Point (android.graphics.Point)2 Intent (android.content.Intent)1 ViewConfiguration (android.view.ViewConfiguration)1 CursorListLoader (com.klinker.android.twitter.adapters.CursorListLoader)1 Field (java.lang.reflect.Field)1 TwitterException (twitter4j.TwitterException)1