Search in sources :

Example 16 with AsyncListView

use of org.lucasr.smoothie.AsyncListView 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 17 with AsyncListView

use of org.lucasr.smoothie.AsyncListView in project Talon-for-Twitter by klinker24.

the class DirectMessageConversation method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    overridePendingTransition(R.anim.activity_slide_up, R.anim.activity_slide_down);
    countHandler = new Handler();
    int currentOrientation = getResources().getConfiguration().orientation;
    if (currentOrientation == Configuration.ORIENTATION_LANDSCAPE) {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
    } else {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT);
    }
    context = this;
    sharedPrefs = getSharedPreferences("com.klinker.android.twitter_world_preferences", 0);
    settings = AppSettings.getInstance(this);
    try {
        ViewConfiguration config = ViewConfiguration.get(this);
        Field menuKeyField = ViewConfiguration.class.getDeclaredField("sHasPermanentMenuKey");
        if (menuKeyField != null) {
            menuKeyField.setAccessible(true);
            menuKeyField.setBoolean(config, false);
        }
    } catch (Exception ex) {
    // Ignore
    }
    if (settings.advanceWindowed) {
        setUpWindow();
    }
    Utils.setUpPopupTheme(this, settings);
    actionBar = getActionBar();
    actionBar.setTitle(getResources().getString(R.string.lists));
    setContentView(R.layout.dm_conversation);
    attachImage = (ImageView) findViewById(R.id.attached_image);
    if (!settings.isTwitterLoggedIn) {
        Intent login = new Intent(context, LoginActivity.class);
        startActivity(login);
        finish();
    }
    listView = (AsyncListView) findViewById(R.id.listView);
    sendButton = (ImageButton) findViewById(R.id.send_button);
    composeBar = (HoloEditText) findViewById(R.id.tweet_content);
    charRemaining = (HoloTextView) findViewById(R.id.char_remaining);
    charRemaining.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(50);
    builder.setThreadPoolSize(4);
    listView.setItemManager(builder.build());
    listName = getIntent().getStringExtra("screenname");
    actionBar.setTitle(getIntent().getStringExtra("name"));
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setDisplayShowHomeEnabled(true);
    actionBar.setIcon(new ColorDrawable(getResources().getColor(android.R.color.transparent)));
    new GetList().execute();
    charRemaining.setText(140 - composeBar.getText().length() + "");
    composeBar.addTextChangedListener(new TextWatcher() {

        @Override
        public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
        }

        @Override
        public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
        }

        @Override
        public void afterTextChanged(Editable editable) {
            countHandler.removeCallbacks(getCount);
            countHandler.postDelayed(getCount, 300);
        }
    });
    sendButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            String status = composeBar.getText().toString();
            new SendDirectMessage().execute(status);
            composeBar.setText("");
            attachImage.setVisibility(View.GONE);
            Toast.makeText(context, getString(R.string.sending), Toast.LENGTH_SHORT).show();
        }
    });
    Utils.setActionBar(context);
}
Also used : CursorListLoader(com.klinker.android.twitter.adapters.CursorListLoader) ItemManager(org.lucasr.smoothie.ItemManager) Handler(android.os.Handler) Intent(android.content.Intent) ImageView(android.widget.ImageView) AsyncListView(org.lucasr.smoothie.AsyncListView) View(android.view.View) HoloTextView(com.klinker.android.twitter.views.HoloTextView) Point(android.graphics.Point) FileNotFoundException(java.io.FileNotFoundException) TwitterException(twitter4j.TwitterException) IOException(java.io.IOException) ViewConfiguration(android.view.ViewConfiguration) Field(java.lang.reflect.Field) BitmapLruCache(uk.co.senab.bitmapcache.BitmapLruCache) ColorDrawable(android.graphics.drawable.ColorDrawable) TextWatcher(android.text.TextWatcher) Editable(android.text.Editable)

Example 18 with AsyncListView

use of org.lucasr.smoothie.AsyncListView in project Talon-for-Twitter by klinker24.

the class ListChooser method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    context = this;
    sharedPrefs = context.getSharedPreferences("com.klinker.android.twitter_world_preferences", 0);
    settings = AppSettings.getInstance(this);
    Utils.setUpTheme(context, settings);
    setContentView(R.layout.list_chooser);
    actionBar = getActionBar();
    actionBar.setTitle(getResources().getString(R.string.lists));
    if (!settings.isTwitterLoggedIn) {
        Intent login = new Intent(context, LoginActivity.class);
        startActivity(login);
        finish();
    }
    listView = (AsyncListView) findViewById(R.id.listView);
    listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
            UserList list = arrayAdapter.getItem(i);
            Intent returnIntent = new Intent();
            returnIntent.putExtra("listId", list.getId());
            returnIntent.putExtra("listName", list.getName());
            setResult(RESULT_OK, returnIntent);
            finish();
        }
    });
    new GetLists().execute();
}
Also used : Intent(android.content.Intent) AdapterView(android.widget.AdapterView) AsyncListView(org.lucasr.smoothie.AsyncListView) View(android.view.View) AdapterView(android.widget.AdapterView) UserList(twitter4j.UserList)

Example 19 with AsyncListView

use of org.lucasr.smoothie.AsyncListView in project Talon-for-Twitter by klinker24.

the class SearchChooser method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    context = this;
    settings = AppSettings.getInstance(this);
    Utils.setUpTheme(context, settings);
    setContentView(R.layout.list_chooser);
    actionBar = getActionBar();
    actionBar.setTitle(getResources().getString(R.string.lists));
    listView = (AsyncListView) findViewById(R.id.listView);
    listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
            String search = adapter.getSearch(i);
            Intent returnIntent = new Intent();
            returnIntent.putExtra("search_query", search);
            setResult(RESULT_OK, returnIntent);
            finish();
        }
    });
    new GetLists().execute();
}
Also used : AdapterView(android.widget.AdapterView) Intent(android.content.Intent) AsyncListView(org.lucasr.smoothie.AsyncListView) View(android.view.View) AdapterView(android.widget.AdapterView)

Aggregations

AsyncListView (org.lucasr.smoothie.AsyncListView)19 View (android.view.View)18 ListView (android.widget.ListView)12 ItemManager (org.lucasr.smoothie.ItemManager)10 BitmapLruCache (uk.co.senab.bitmapcache.BitmapLruCache)10 Intent (android.content.Intent)8 AbsListView (android.widget.AbsListView)8 ArrayListLoader (com.klinker.android.twitter.adapters.ArrayListLoader)8 LinearLayout (android.widget.LinearLayout)4 FullScreenSwipeRefreshLayout (com.klinker.android.twitter.views.swipe_refresh_layout.FullScreenSwipeRefreshLayout)4 ImageView (android.widget.ImageView)3 Resources (android.content.res.Resources)2 Handler (android.os.Handler)2 AdapterView (android.widget.AdapterView)2 TextView (android.widget.TextView)2 CursorListLoader (com.klinker.android.twitter.adapters.CursorListLoader)2 HoloTextView (com.klinker.android.twitter.views.HoloTextView)2 Context (android.content.Context)1 PackageManager (android.content.pm.PackageManager)1 Point (android.graphics.Point)1