Search in sources :

Example 11 with HoloTextView

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

the class ConversationFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);
    settings = AppSettings.getInstance(getActivity());
    tweetId = getArguments().getLong("tweet_id", 0l);
    isRunning = true;
    layout = inflater.inflate(R.layout.conversation_fragment, null, false);
    final AsyncListView replyList = (AsyncListView) layout.findViewById(R.id.listView);
    final LinearLayout progressSpinner = (LinearLayout) layout.findViewById(R.id.list_progress);
    final HoloTextView none = (HoloTextView) layout.findViewById(R.id.no_conversation);
    none.setText(getResources().getString(R.string.no_tweets));
    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);
    replyList.setItemManager(builder.build());
    getReplies(replyList, tweetId, progressSpinner, none);
    return layout;
}
Also used : BitmapLruCache(uk.co.senab.bitmapcache.BitmapLruCache) ArrayListLoader(com.klinker.android.twitter.adapters.ArrayListLoader) ItemManager(org.lucasr.smoothie.ItemManager) HoloTextView(com.klinker.android.twitter.views.HoloTextView) LinearLayout(android.widget.LinearLayout) AsyncListView(org.lucasr.smoothie.AsyncListView)

Example 12 with HoloTextView

use of com.klinker.android.twitter.views.HoloTextView 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 13 with HoloTextView

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

the class MainDrawerArrayAdapter method getView.

@Override
public View getView(final int position, View convertView, ViewGroup parent) {
    View rowView = convertView;
    String settingName = text.get(position);
    if (rowView == null) {
        LayoutInflater inflater = context.getLayoutInflater();
        rowView = inflater.inflate(R.layout.drawer_list_item, null);
        ViewHolder viewHolder = new ViewHolder();
        viewHolder.name = (HoloTextView) rowView.findViewById(R.id.title);
        viewHolder.icon = (ImageView) rowView.findViewById(R.id.icon);
        rowView.setTag(viewHolder);
    }
    ViewHolder holder = (ViewHolder) rowView.getTag();
    holder.name.setText(settingName);
    holder.name.setTextSize(18);
    try {
        if (text.get(position).equals(context.getResources().getString(R.string.timeline))) {
            TypedArray a = context.getTheme().obtainStyledAttributes(new int[] { R.attr.timelineItem });
            int resource = a.getResourceId(0, 0);
            a.recycle();
            holder.icon.setImageResource(resource);
        } else if (text.get(position).equals(context.getResources().getString(R.string.mentions)) || text.get(position).equals(AppSettings.getInstance(context).secondScreenName)) {
            TypedArray a = context.getTheme().obtainStyledAttributes(new int[] { R.attr.mentionItem });
            int resource = a.getResourceId(0, 0);
            a.recycle();
            holder.icon.setImageResource(resource);
        } else if (text.get(position).equals(context.getResources().getString(R.string.direct_messages))) {
            TypedArray a = context.getTheme().obtainStyledAttributes(new int[] { R.attr.directMessageItem });
            int resource = a.getResourceId(0, 0);
            a.recycle();
            holder.icon.setImageResource(resource);
        } else if (text.get(position).equals(context.getResources().getString(R.string.retweets))) {
            TypedArray a = context.getTheme().obtainStyledAttributes(new int[] { R.attr.retweetButton });
            int resource = a.getResourceId(0, 0);
            a.recycle();
            holder.icon.setImageResource(resource);
        } else if (text.get(position).equals(context.getResources().getString(R.string.favorite_tweets))) {
            TypedArray a = context.getTheme().obtainStyledAttributes(new int[] { R.attr.favoritedButton });
            int resource = a.getResourceId(0, 0);
            a.recycle();
            holder.icon.setImageResource(resource);
        } else if (text.get(position).equals(context.getResources().getString(R.string.favorite_users)) || text.get(position).equals(context.getString(R.string.favorite_users_tweets))) {
            TypedArray a = context.getTheme().obtainStyledAttributes(new int[] { R.attr.favUser });
            int resource = a.getResourceId(0, 0);
            a.recycle();
            holder.icon.setImageResource(resource);
        } else if (text.get(position).equals(context.getResources().getString(R.string.discover)) || text.get(position).equals(context.getString(R.string.world_trends)) || text.get(position).equals(context.getString(R.string.local_trends))) {
            TypedArray a = context.getTheme().obtainStyledAttributes(new int[] { R.attr.links });
            int resource = a.getResourceId(0, 0);
            a.recycle();
            holder.icon.setImageResource(resource);
        } else if (text.get(position).equals(context.getResources().getString(R.string.search))) {
            TypedArray a = context.getTheme().obtainStyledAttributes(new int[] { R.attr.search_icon });
            int resource = a.getResourceId(0, 0);
            a.recycle();
            holder.icon.setImageResource(resource);
        } else if (text.get(position).equals(context.getResources().getString(R.string.lists))) {
            TypedArray a = context.getTheme().obtainStyledAttributes(new int[] { R.attr.listIcon });
            int resource = a.getResourceId(0, 0);
            a.recycle();
            holder.icon.setImageResource(resource);
        } else if (text.get(position).equals(context.getResources().getString(R.string.saved_searches)) || pageTypes.get(position) == AppSettings.PAGE_TYPE_SAVED_SEARCH) {
            TypedArray a = context.getTheme().obtainStyledAttributes(new int[] { R.attr.search_icon });
            int resource = a.getResourceId(0, 0);
            a.recycle();
            holder.icon.setImageResource(resource);
        } else if (text.get(position).equals(context.getResources().getString(R.string.links))) {
            TypedArray a = context.getTheme().obtainStyledAttributes(new int[] { R.attr.links });
            int resource = a.getResourceId(0, 0);
            a.recycle();
            holder.icon.setImageResource(resource);
        } else if (text.get(position).equals(context.getResources().getString(R.string.pictures))) {
            TypedArray a = context.getTheme().obtainStyledAttributes(new int[] { R.attr.picturePlaceholder });
            int resource = a.getResourceId(0, 0);
            a.recycle();
            holder.icon.setImageResource(resource);
        } else if (text.get(position).equals(context.getString(R.string.activity))) {
            TypedArray a = context.getTheme().obtainStyledAttributes(new int[] { R.attr.notification_button });
            int resource = a.getResourceId(0, 0);
            a.recycle();
            holder.icon.setImageResource(resource);
        } else {
            TypedArray a = context.getTheme().obtainStyledAttributes(new int[] { R.attr.listIcon });
            int resource = a.getResourceId(0, 0);
            a.recycle();
            holder.icon.setImageResource(resource);
        }
    } catch (OutOfMemoryError e) {
    }
    if (highlightedCurrent == position) {
        if (!DrawerActivity.settings.addonTheme) {
            holder.icon.setColorFilter(context.getResources().getColor(R.color.app_color));
            holder.name.setTextColor(context.getResources().getColor(R.color.app_color));
        } else {
            holder.icon.setColorFilter(DrawerActivity.settings.accentInt);
            holder.name.setTextColor(DrawerActivity.settings.accentInt);
        }
    } else {
        TypedArray a = context.getTheme().obtainStyledAttributes(new int[] { R.attr.textColor });
        int resource = a.getResourceId(0, 0);
        holder.icon.setColorFilter(context.getResources().getColor(resource));
        holder.name.setTextColor(context.getResources().getColor(resource));
    }
    return rowView;
}
Also used : LayoutInflater(android.view.LayoutInflater) TypedArray(android.content.res.TypedArray) HoloTextView(com.klinker.android.twitter.views.HoloTextView) ImageView(android.widget.ImageView) View(android.view.View)

Aggregations

HoloTextView (com.klinker.android.twitter.views.HoloTextView)13 View (android.view.View)8 Intent (android.content.Intent)6 Handler (android.os.Handler)6 NetworkedCacheableImageView (com.klinker.android.twitter.views.NetworkedCacheableImageView)6 TypedArray (android.content.res.TypedArray)4 Point (android.graphics.Point)4 Editable (android.text.Editable)4 TextWatcher (android.text.TextWatcher)4 LayoutInflater (android.view.LayoutInflater)3 ViewConfiguration (android.view.ViewConfiguration)3 ImageView (android.widget.ImageView)3 TextView (android.widget.TextView)3 IOException (java.io.IOException)3 Field (java.lang.reflect.Field)3 AsyncListView (org.lucasr.smoothie.AsyncListView)3 BitmapLruCache (uk.co.senab.bitmapcache.BitmapLruCache)3 AlertDialog (android.app.AlertDialog)2 ColorDrawable (android.graphics.drawable.ColorDrawable)2 InputMethodManager (android.view.inputmethod.InputMethodManager)2