Search in sources :

Example 6 with NetworkedCacheableImageView

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

the class TimelineArrayAdapter method newView.

public View newView(ViewGroup viewGroup) {
    View v = null;
    final ViewHolder holder = new ViewHolder();
    if (settings.addonTheme) {
        try {
            Context viewContext = null;
            if (res == null) {
                res = context.getPackageManager().getResourcesForApplication(settings.addonThemePackage);
            }
            try {
                viewContext = context.createPackageContext(settings.addonThemePackage, Context.CONTEXT_IGNORE_SECURITY);
            } catch (PackageManager.NameNotFoundException e) {
                e.printStackTrace();
            } catch (Exception e) {
                e.printStackTrace();
            }
            if (res != null && viewContext != null) {
                int id = res.getIdentifier("tweet", "layout", settings.addonThemePackage);
                v = LayoutInflater.from(viewContext).inflate(res.getLayout(id), null);
                holder.name = (TextView) v.findViewById(res.getIdentifier("name", "id", settings.addonThemePackage));
                holder.profilePic = (ImageView) v.findViewById(res.getIdentifier("profile_pic", "id", settings.addonThemePackage));
                holder.time = (TextView) v.findViewById(res.getIdentifier("time", "id", settings.addonThemePackage));
                holder.tweet = (TextView) v.findViewById(res.getIdentifier("tweet", "id", settings.addonThemePackage));
                holder.reply = (EditText) v.findViewById(res.getIdentifier("reply", "id", settings.addonThemePackage));
                holder.favorite = (ImageButton) v.findViewById(res.getIdentifier("favorite", "id", settings.addonThemePackage));
                holder.retweet = (ImageButton) v.findViewById(res.getIdentifier("retweet", "id", settings.addonThemePackage));
                holder.favCount = (TextView) v.findViewById(res.getIdentifier("fav_count", "id", settings.addonThemePackage));
                holder.retweetCount = (TextView) v.findViewById(res.getIdentifier("retweet_count", "id", settings.addonThemePackage));
                holder.expandArea = (LinearLayout) v.findViewById(res.getIdentifier("expansion", "id", settings.addonThemePackage));
                holder.replyButton = (ImageButton) v.findViewById(res.getIdentifier("reply_button", "id", settings.addonThemePackage));
                holder.image = (ImageView) v.findViewById(res.getIdentifier("image", "id", settings.addonThemePackage));
                holder.retweeter = (TextView) v.findViewById(res.getIdentifier("retweeter", "id", settings.addonThemePackage));
                holder.background = (LinearLayout) v.findViewById(res.getIdentifier("background", "id", settings.addonThemePackage));
                holder.playButton = (ImageView) v.findViewById(res.getIdentifier("play_button", "id", settings.addonThemePackage));
                holder.screenTV = (TextView) v.findViewById(res.getIdentifier("screenname", "id", settings.addonThemePackage));
                try {
                    holder.quoteButton = (ImageButton) v.findViewById(res.getIdentifier("quote_button", "id", settings.addonThemePackage));
                    holder.shareButton = (ImageButton) v.findViewById(res.getIdentifier("share_button", "id", settings.addonThemePackage));
                } catch (Exception e) {
                // they don't exist because the theme was made before they were added
                }
                try {
                    holder.isAConversation = (ImageView) v.findViewById(res.getIdentifier("is_a_conversation", "id", settings.addonThemePackage));
                } catch (Exception e) {
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
            v = inflater.inflate(layout, viewGroup, false);
            holder.name = (TextView) v.findViewById(R.id.name);
            holder.profilePic = (ImageView) v.findViewById(R.id.profile_pic);
            holder.time = (TextView) v.findViewById(R.id.time);
            holder.tweet = (TextView) v.findViewById(R.id.tweet);
            holder.reply = (EditText) v.findViewById(R.id.reply);
            holder.favorite = (ImageButton) v.findViewById(R.id.favorite);
            holder.retweet = (ImageButton) v.findViewById(R.id.retweet);
            holder.favCount = (TextView) v.findViewById(R.id.fav_count);
            holder.retweetCount = (TextView) v.findViewById(R.id.retweet_count);
            holder.expandArea = (LinearLayout) v.findViewById(R.id.expansion);
            holder.replyButton = (ImageButton) v.findViewById(R.id.reply_button);
            holder.image = (NetworkedCacheableImageView) v.findViewById(R.id.image);
            holder.retweeter = (TextView) v.findViewById(R.id.retweeter);
            holder.background = (LinearLayout) v.findViewById(R.id.background);
            holder.playButton = (NetworkedCacheableImageView) v.findViewById(R.id.play_button);
            holder.screenTV = (TextView) v.findViewById(R.id.screenname);
            try {
                holder.quoteButton = (ImageButton) v.findViewById(R.id.quote_button);
                holder.shareButton = (ImageButton) v.findViewById(R.id.share_button);
            } catch (Exception x) {
            // theme was made before they were added
            }
            try {
                holder.isAConversation = (ImageView) v.findViewById(R.id.is_a_conversation);
            } catch (Exception x) {
            }
        }
    } else {
        v = inflater.inflate(layout, viewGroup, false);
        holder.name = (TextView) v.findViewById(R.id.name);
        holder.profilePic = (ImageView) v.findViewById(R.id.profile_pic);
        holder.time = (TextView) v.findViewById(R.id.time);
        holder.tweet = (TextView) v.findViewById(R.id.tweet);
        holder.reply = (EditText) v.findViewById(R.id.reply);
        holder.favorite = (ImageButton) v.findViewById(R.id.favorite);
        holder.retweet = (ImageButton) v.findViewById(R.id.retweet);
        holder.favCount = (TextView) v.findViewById(R.id.fav_count);
        holder.retweetCount = (TextView) v.findViewById(R.id.retweet_count);
        holder.expandArea = (LinearLayout) v.findViewById(R.id.expansion);
        holder.replyButton = (ImageButton) v.findViewById(R.id.reply_button);
        holder.image = (NetworkedCacheableImageView) v.findViewById(R.id.image);
        holder.retweeter = (TextView) v.findViewById(R.id.retweeter);
        holder.background = (LinearLayout) v.findViewById(R.id.background);
        holder.playButton = (NetworkedCacheableImageView) v.findViewById(R.id.play_button);
        holder.screenTV = (TextView) v.findViewById(R.id.screenname);
        try {
            holder.quoteButton = (ImageButton) v.findViewById(R.id.quote_button);
            holder.shareButton = (ImageButton) v.findViewById(R.id.share_button);
        } catch (Exception x) {
        // theme was made before they were added
        }
        try {
            holder.isAConversation = (ImageView) v.findViewById(R.id.is_a_conversation);
        } catch (Exception x) {
        }
    }
    // sets up the font sizes
    holder.tweet.setTextSize(settings.textSize);
    holder.name.setTextSize(settings.textSize + 4);
    holder.screenTV.setTextSize(settings.textSize - 2);
    holder.time.setTextSize(settings.textSize - 3);
    holder.retweeter.setTextSize(settings.textSize - 3);
    holder.favCount.setTextSize(settings.textSize + 1);
    holder.retweetCount.setTextSize(settings.textSize + 1);
    holder.reply.setTextSize(settings.textSize);
    v.setTag(holder);
    return v;
}
Also used : Context(android.content.Context) EditText(android.widget.EditText) NetworkedCacheableImageView(com.klinker.android.twitter.views.NetworkedCacheableImageView) ImageView(android.widget.ImageView) View(android.view.View) TextView(android.widget.TextView) RejectedExecutionException(java.util.concurrent.RejectedExecutionException) IOException(java.io.IOException) NetworkedCacheableImageView(com.klinker.android.twitter.views.NetworkedCacheableImageView) ImageButton(android.widget.ImageButton) PackageManager(android.content.pm.PackageManager) TextView(android.widget.TextView) NetworkedCacheableImageView(com.klinker.android.twitter.views.NetworkedCacheableImageView) ImageView(android.widget.ImageView) LinearLayout(android.widget.LinearLayout)

Example 7 with NetworkedCacheableImageView

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

the class InteractionsCursorAdapter method newView.

@Override
public View newView(Context context, Cursor cursor, ViewGroup viewGroup) {
    View v = null;
    final ViewHolder holder = new ViewHolder();
    v = inflater.inflate(layout, viewGroup, false);
    holder.title = (HoloTextView) v.findViewById(R.id.title);
    holder.text = (HoloTextView) v.findViewById(R.id.text);
    holder.background = (LinearLayout) v.findViewById(R.id.background);
    holder.picture = (NetworkedCacheableImageView) v.findViewById(R.id.picture);
    // sets up the font sizes
    holder.title.setTextSize(15);
    holder.text.setTextSize(14);
    v.setTag(holder);
    return v;
}
Also used : NetworkedCacheableImageView(com.klinker.android.twitter.views.NetworkedCacheableImageView) View(android.view.View) HoloTextView(com.klinker.android.twitter.views.HoloTextView)

Example 8 with NetworkedCacheableImageView

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

the class MultiplePicsGridAdapter method getView.

@Override
public View getView(final int position, View convertView, ViewGroup parent) {
    if (convertView == null) {
        LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        convertView = inflater.inflate(R.layout.picture, null);
        AbsListView.LayoutParams params = new AbsListView.LayoutParams(gridWidth, gridWidth);
        convertView.setLayoutParams(params);
        ViewHolder holder = new ViewHolder();
        holder.iv = (NetworkedCacheableImageView) convertView.findViewById(R.id.picture);
        convertView.setTag(holder);
    }
    final ViewHolder holder = (ViewHolder) convertView.getTag();
    holder.iv.loadImage(text.get(position), false, new NetworkedCacheableImageView.OnImageLoadedListener() {

        @Override
        public void onImageLoaded(CacheableBitmapDrawable result) {
            holder.iv.setBackgroundDrawable(null);
        }
    });
    holder.iv.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            Intent viewImage = new Intent(context, PhotoPagerActivity.class);
            viewImage.putExtra("url", pics);
            viewImage.putExtra("start_page", position);
            context.startActivity(viewImage);
        }
    });
    return convertView;
}
Also used : AbsListView(android.widget.AbsListView) Intent(android.content.Intent) NetworkedCacheableImageView(com.klinker.android.twitter.views.NetworkedCacheableImageView) View(android.view.View) AbsListView(android.widget.AbsListView) PhotoPagerActivity(com.klinker.android.twitter.activities.photo_viewer.PhotoPagerActivity) NetworkedCacheableImageView(com.klinker.android.twitter.views.NetworkedCacheableImageView) LayoutInflater(android.view.LayoutInflater) CacheableBitmapDrawable(uk.co.senab.bitmapcache.CacheableBitmapDrawable)

Example 9 with NetworkedCacheableImageView

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

the class PicturesArrayAdapter method newView.

public View newView(ViewGroup viewGroup) {
    View v;
    final ViewHolder holder;
    v = inflater.inflate(R.layout.picture, viewGroup, false);
    holder = new ViewHolder();
    holder.iv = (NetworkedCacheableImageView) v.findViewById(R.id.picture);
    v.setTag(holder);
    return v;
}
Also used : NetworkedCacheableImageView(com.klinker.android.twitter.views.NetworkedCacheableImageView) View(android.view.View)

Example 10 with NetworkedCacheableImageView

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

the class ComposeSecAccActivity method setUpReplyText.

public void setUpReplyText() {
    useAccOne = false;
    useAccTwo = true;
    NetworkedCacheableImageView pic = (NetworkedCacheableImageView) findViewById(R.id.profile_pic);
    HoloTextView currentName = (HoloTextView) findViewById(R.id.current_name);
    if (settings.roundContactImages) {
        pic.loadImage(settings.secondProfilePicUrl, false, null, NetworkedCacheableImageView.CIRCLE);
    } else {
        pic.loadImage(settings.secondProfilePicUrl, false, null);
    }
    currentName.setText("@" + settings.secondScreenName);
    // for failed notification
    if (!sharedPrefs.getString("draft", "").equals("")) {
        reply.setText(sharedPrefs.getString("draft", ""));
        reply.setSelection(reply.getText().length());
    }
    String to = getIntent().getStringExtra("user") + (isDM ? "" : " ");
    if ((!to.equals("null ") && !isDM) || (isDM && !to.equals("null"))) {
        if (!isDM) {
            Log.v("username_for_noti", "to place: " + to);
            reply.setText(to);
            reply.setSelection(reply.getText().toString().length());
        } else {
            contactEntry.setText(to);
            reply.requestFocus();
        }
        sharedPrefs.edit().putString("draft", "").commit();
    }
    notiId = getIntent().getLongExtra("id", 0);
    replyText = getIntent().getStringExtra("reply_to_text");
    // Get intent, action and MIME type
    Intent intent = getIntent();
    String action = intent.getAction();
    String type = intent.getType();
    if (Intent.ACTION_SEND.equals(action) && type != null) {
        if ("text/plain".equals(type)) {
            // Handle text being sent
            handleSendText(intent);
        } else if (type.startsWith("image/")) {
            // Handle single image being sent
            handleSendImage(intent);
        }
    }
}
Also used : NetworkedCacheableImageView(com.klinker.android.twitter.views.NetworkedCacheableImageView) Intent(android.content.Intent) HoloTextView(com.klinker.android.twitter.views.HoloTextView)

Aggregations

NetworkedCacheableImageView (com.klinker.android.twitter.views.NetworkedCacheableImageView)13 View (android.view.View)10 HoloTextView (com.klinker.android.twitter.views.HoloTextView)6 Intent (android.content.Intent)4 LinearLayout (android.widget.LinearLayout)4 CacheableBitmapDrawable (uk.co.senab.bitmapcache.CacheableBitmapDrawable)4 Context (android.content.Context)3 ImageView (android.widget.ImageView)3 TextView (android.widget.TextView)3 IOException (java.io.IOException)3 PackageManager (android.content.pm.PackageManager)2 TypedArray (android.content.res.TypedArray)2 Point (android.graphics.Point)2 ColorDrawable (android.graphics.drawable.ColorDrawable)2 Handler (android.os.Handler)2 Editable (android.text.Editable)2 TextWatcher (android.text.TextWatcher)2 LayoutInflater (android.view.LayoutInflater)2 AbsListView (android.widget.AbsListView)2 EditText (android.widget.EditText)2