Search in sources :

Example 46 with ImageView

use of android.widget.ImageView in project glitch-hq-android by tinyspeck.

the class EncyclopediaItemsInCategoryListViewAdapter method getView.

public View getView(int position, View convertView, ViewGroup parent) {
    ViewHolder holder = null;
    if (convertView != null) {
        holder = (ViewHolder) convertView.getTag();
    }
    if (holder == null) {
        convertView = m_inflater.inflate(R.layout.encyclopedia_items_in_category_list_item, null);
        holder = new ViewHolder();
        holder.name = (TextView) convertView.findViewById(R.id.encyclopedia_items_in_category_name);
        holder.name.setTypeface(m_application.m_vagFont);
        holder.icon = (ImageView) convertView.findViewById(R.id.encyclopedia_items_in_category_icon);
        holder.whole = (View) convertView.findViewById(R.id.encyclopedia_items_in_category_item);
        convertView.setTag(holder);
    }
    holder = (ViewHolder) convertView.getTag();
    if (position < getCount()) {
        glitchItem item = m_itemList.get(position);
        holder.name.setText(item.name);
        DrawableURL.Show(holder.icon, item.icon, false);
        holder.whole.setTag(position);
        holder.whole.setOnClickListener(new OnClickListener() {

            public void onClick(View v) {
                glitchItem item = m_itemList.get((Integer) v.getTag());
                EncyclopediaItemDetailFragment f = new EncyclopediaItemDetailFragment(m_bf, item);
                ((HomeScreen) m_act).setCurrentFragment(f, true);
            }
        });
    }
    return convertView;
}
Also used : OnClickListener(android.view.View.OnClickListener) BaseFragment.glitchItem(com.tinyspeck.glitchhq.BaseFragment.glitchItem) TextView(android.widget.TextView) ImageView(android.widget.ImageView) View(android.view.View)

Example 47 with ImageView

use of android.widget.ImageView in project glitch-hq-android by tinyspeck.

the class ActivityListViewAdapter method getView.

public View getView(int position, View convertView, ViewGroup parent) {
    ViewHolder holder = null;
    if (convertView != null)
        holder = (ViewHolder) convertView.getTag();
    if (holder == null) {
        convertView = m_inflater.inflate(R.layout.list_item, null);
        holder = new ViewHolder();
        holder.name = (TextView) convertView.findViewById(R.id.activity_who);
        holder.icon = (ImageView) convertView.findViewById(R.id.icon_skill);
        holder.to_who = (TextView) convertView.findViewById(R.id.activity_reply_to_who);
        holder.replyIcon = (ImageView) convertView.findViewById(R.id.reply_icon);
        holder.description = (TextView) convertView.findViewById(R.id.activity_what);
        holder.time = (TextView) convertView.findViewById(R.id.activity_when);
        holder.divider = (View) convertView.findViewById(R.id.list_diveider);
        holder.name.setTypeface(m_application.m_vagFont);
        holder.to_who.setTypeface(m_application.m_vagFont);
        holder.whole = (View) convertView.findViewById(R.id.actfeed_item);
        //          holder.description.setTypeface( m_application.m_vagFont );
        holder.time.setTypeface(m_application.m_vagLightFont);
        holder.addBack = (Button) convertView.findViewById(R.id.btnAddBack);
        holder.notNow = (Button) convertView.findViewById(R.id.btnNotNow);
        holder.request_buttons = convertView.findViewById(R.id.request_buttons);
        convertView.setTag(holder);
    }
    holder = (ViewHolder) convertView.getTag();
    if (position < getCount()) {
        glitchActivity act = m_actList.get(position);
        holder.name.setText(act.who);
        if (act.avatar != null)
            DrawableURL.CropShow(holder.icon, act.avatar);
        else
            holder.icon.setImageResource(act.icon);
        holder.description.setText(act.what);
        holder.time.setText(act.when);
        if (position == getCount() - 1)
            holder.divider.setVisibility(View.GONE);
        else
            holder.divider.setVisibility(View.VISIBLE);
        if (holder.request_buttons != null)
            holder.request_buttons.setVisibility(View.GONE);
        if (act.type.equalsIgnoreCase("status_reply")) {
            String toname = "";
            if (act.in_reply_to != null) {
                toname = act.in_reply_to.who;
                if (((HomeScreen) m_act).getPlayerID().equalsIgnoreCase(act.in_reply_to.playerID)) {
                    toname = "you";
                    holder.to_who.setTextColor(0xff707070);
                } else
                    holder.to_who.setTextColor(0xff000000);
            }
            holder.replyIcon.setImageResource(R.drawable.replyicon);
            holder.replyIcon.setVisibility(View.VISIBLE);
            holder.to_who.setVisibility(View.VISIBLE);
            holder.to_who.setText(toname);
        } else if (act.type.equalsIgnoreCase("photo")) {
            holder.replyIcon.setImageResource(R.drawable.snap_feed_icon);
            holder.replyIcon.setVisibility(View.VISIBLE);
            holder.to_who.setVisibility(View.GONE);
        } else if (act.type.equalsIgnoreCase("photo-comment") || act.type.equalsIgnoreCase("photo-comment-received")) {
            String toname = "";
            if (act.in_reply_to != null) {
                toname = act.in_reply_to.who;
                holder.to_who.setTextColor(0xff005471);
                if (((HomeScreen) m_act).getPlayerID().equalsIgnoreCase(act.in_reply_to.playerID))
                    toname = "Your snapshot";
                else
                    toname += "'s snapshot";
            }
            holder.replyIcon.setImageResource(R.drawable.replyicon);
            holder.replyIcon.setVisibility(View.VISIBLE);
            holder.to_who.setVisibility(View.VISIBLE);
            holder.to_who.setText(toname);
        } else {
            holder.to_who.setVisibility(View.GONE);
            holder.replyIcon.setVisibility(View.GONE);
        }
        if (act.type.equalsIgnoreCase("request_group_invite")) {
            holder.request_buttons.setVisibility(View.VISIBLE);
            holder.notNow.setText(R.string.btn_decline);
            holder.addBack.setText(R.string.btn_join);
            holder.addBack.setTag(act.id);
            holder.notNow.setTag(act.id);
            holder.addBack.setOnClickListener(new OnClickListener() {

                public void onClick(View v) {
                    FlurryAgent.logEvent("Activity - Group Request - Join button pressed");
                    sendRequest((String) v.getTag(), "activity.joinGroup");
                }
            });
            holder.notNow.setOnClickListener(new OnClickListener() {

                public void onClick(View v) {
                    FlurryAgent.logEvent("Activity - Group Request - Decline button pressed");
                    sendRequest((String) v.getTag(), "activity.declineGroup");
                }
            });
        } else if (act.type.equalsIgnoreCase("request_friend_add")) {
            holder.addBack.setTag(act.id);
            holder.notNow.setTag(act.id);
            holder.request_buttons.setVisibility(View.VISIBLE);
            holder.addBack.setText(R.string.btn_add_back);
            holder.notNow.setText(R.string.btn_not_now);
            holder.addBack.setOnClickListener(new OnClickListener() {

                public void onClick(View v) {
                    FlurryAgent.logEvent("Activity - Friend Request - Add Back button pressed");
                    sendRequest((String) v.getTag(), "activity.addBuddy");
                }
            });
            holder.notNow.setOnClickListener(new OnClickListener() {

                public void onClick(View v) {
                    FlurryAgent.logEvent("Activity - Friend Request - Not Now button pressed");
                    sendRequest((String) v.getTag(), "activity.declineBuddy");
                }
            });
        }
    }
    holder.whole.setTag(position);
    holder.whole.setOnClickListener(new OnClickListener() {

        public void onClick(View arg0) {
            glitchActivity currentActivity = m_actList.get((Integer) arg0.getTag());
            String backBtnName;
            if (m_bf instanceof ActivityFragment) {
                backBtnName = "Feed";
            } else if (m_bf instanceof ProfileFragment) {
                backBtnName = ((ProfileFragment) m_bf).getPlayerName();
            } else {
                backBtnName = "Back";
            }
            if (currentActivity.type.equalsIgnoreCase("request_friend_add")) {
                ProfileFragment f = new ProfileFragment(m_bf, currentActivity.playerID, true);
                ((HomeScreen) m_act).setCurrentFragment(f, true);
            } else if (currentActivity.type.equalsIgnoreCase("photo")) {
                SnapDetailFragment f = new SnapDetailFragment(currentActivity.who, currentActivity.playerID, currentActivity.photo_id, currentActivity.secret, backBtnName);
                ((HomeScreen) m_act).setCurrentFragment(f, true);
            } else if (currentActivity.type.equalsIgnoreCase("photo-comment") || currentActivity.type.equalsIgnoreCase("photo-comment-received")) {
                SnapDetailFragment f = new SnapDetailFragment(currentActivity.in_reply_to.who, currentActivity.in_reply_to.playerID, currentActivity.photo_id, currentActivity.secret, backBtnName);
                ((HomeScreen) m_act).setCurrentFragment(f, true);
            } else {
                ActivityDetailFragment f = new ActivityDetailFragment(m_bf, currentActivity.who, currentActivity.playerID, currentActivity.id);
                ((HomeScreen) m_act).setCurrentFragment(f, true);
            }
        }
    });
    return convertView;
}
Also used : OnClickListener(android.view.View.OnClickListener) ImageView(android.widget.ImageView) TextView(android.widget.TextView) View(android.view.View) BaseFragment.glitchActivity(com.tinyspeck.glitchhq.BaseFragment.glitchActivity)

Example 48 with ImageView

use of android.widget.ImageView in project glitch-hq-android by tinyspeck.

the class EncyclopediaGiantDetailFragment method showEncyclopediaGiantPage.

private void showEncyclopediaGiantPage() {
    Activity m_act = getActivity();
    String packageName = m_act.getPackageName();
    RelativeLayout topSection = (RelativeLayout) m_root.findViewById(R.id.encyclopedia_giant_detail_top_section);
    int backgroundResID = m_act.getResources().getIdentifier("bg_" + m_giant.id + "_repeat", "drawable", packageName);
    topSection.setBackgroundResource(backgroundResID);
    ImageView icon = (ImageView) m_root.findViewById(R.id.encyclopedia_giant_detail_icon);
    int symbolResID = m_act.getResources().getIdentifier(m_giant.id + "_symbol", "drawable", packageName);
    icon.setImageBitmap(BitmapFactory.decodeResource(m_act.getResources(), symbolResID));
    TextView name = (TextView) m_root.findViewById(R.id.encyclopedia_giant_detail_name_sex);
    name.setTypeface(m_application.m_vagFont);
    name.setText(m_giant.name + " " + m_giant.gender);
    TextView personality = (TextView) m_root.findViewById(R.id.encyclopedia_giant_detail_personality);
    personality.setText(m_giant.personality);
    ImageView image = (ImageView) m_root.findViewById(R.id.encyclopedia_giant_detail_image);
    int imageResID = m_act.getResources().getIdentifier(m_giant.id, "drawable", packageName);
    image.setImageBitmap(BitmapFactory.decodeResource(m_act.getResources(), imageResID));
    TextView desc = (TextView) m_root.findViewById(R.id.encyclopedia_giant_detail_desc);
    desc.setText(m_giant.desc);
    TextView followers = (TextView) m_root.findViewById(R.id.encyclopedia_giant_detail_adherents);
    followers.setText("Adherents are known as \"" + m_giant.followers + "\".");
    TextView skills = (TextView) m_root.findViewById(R.id.encyclopedia_giant_detail_skills);
    String skillsStr = "";
    Iterator<glitchGiantSkill> itr = m_giant.skills.iterator();
    while (itr.hasNext()) {
        glitchGiantSkill skill = itr.next();
        skillsStr += skill.name;
        if (itr.hasNext()) {
            skillsStr += ", ";
        }
    }
    skills.setText(skillsStr);
    m_root.setVisibility(View.VISIBLE);
}
Also used : RelativeLayout(android.widget.RelativeLayout) Activity(android.app.Activity) TextView(android.widget.TextView) ImageView(android.widget.ImageView)

Example 49 with ImageView

use of android.widget.ImageView in project BGARefreshLayout-Android by bingoogolapple.

the class DataEngine method getCustomHeaderView.

public static View getCustomHeaderView(final Context context) {
    View headerView = View.inflate(context, R.layout.view_custom_header, null);
    final BGABanner banner = (BGABanner) headerView.findViewById(R.id.banner);
    banner.setAdapter(new BGABanner.Adapter<ImageView, String>() {

        @Override
        public void fillBannerItem(BGABanner banner, ImageView itemView, String model, int position) {
            Glide.with(itemView.getContext()).load(model).placeholder(R.mipmap.holder).error(R.mipmap.holder).dontAnimate().centerCrop().into(itemView);
        }
    });
    banner.setDelegate(new BGABanner.Delegate<ImageView, String>() {

        @Override
        public void onBannerItemClick(BGABanner banner, ImageView imageView, String model, int position) {
            Toast.makeText(banner.getContext(), "点击了第" + (position + 1) + "页", Toast.LENGTH_SHORT).show();
        }
    });
    App.getInstance().getEngine().getBannerModel().enqueue(new Callback<BannerModel>() {

        @Override
        public void onResponse(Call<BannerModel> call, Response<BannerModel> response) {
            BannerModel bannerModel = response.body();
            banner.setData(R.layout.view_image, bannerModel.imgs, bannerModel.tips);
        }

        @Override
        public void onFailure(Call<BannerModel> call, Throwable t) {
        }
    });
    return headerView;
}
Also used : ImageView(android.widget.ImageView) View(android.view.View) ImageView(android.widget.ImageView) BannerModel(cn.bingoogolapple.refreshlayout.demo.model.BannerModel) BGABanner(cn.bingoogolapple.bgabanner.BGABanner)

Example 50 with ImageView

use of android.widget.ImageView in project glimmr by brk3.

the class CommentsFragment method onCommentsReady.

@Override
public void onCommentsReady(List<Comment> comments, Exception e) {
    mProgressBar.setVisibility(View.GONE);
    if (FlickrHelper.getInstance().handleFlickrUnavailable(mActivity, e)) {
        return;
    }
    if (comments == null) {
        Log.e(TAG, "onCommentsReady: comments are null");
        return;
    }
    if (BuildConfig.DEBUG) {
        Log.d(getLogTag(), "onCommentsReady, comments.size(): " + comments.size());
    }
    mAdapter = new ArrayAdapter<Comment>(mActivity, R.layout.comment_list_row, (ArrayList<Comment>) comments) {

        @Override
        public View getView(final int position, View convertView, ViewGroup parent) {
            final ViewHolder holder;
            if (convertView == null) {
                convertView = mActivity.getLayoutInflater().inflate(R.layout.comment_list_row, null);
                holder = new ViewHolder();
                holder.textViewUsername = (TextView) convertView.findViewById(R.id.userName);
                holder.textViewCommentDate = (TextView) convertView.findViewById(R.id.commentDate);
                holder.textViewCommentText = (TextView) convertView.findViewById(R.id.commentText);
                holder.imageViewUserIcon = (ImageView) convertView.findViewById(R.id.userIcon);
                convertView.setTag(holder);
            } else {
                holder = (ViewHolder) convertView.getTag();
            }
            final Comment comment = getItem(position);
            holder.textViewUsername.setText(comment.getAuthorName());
            String pTime = mPrettyTime.format(comment.getDateCreate());
            /* keep Oliver happy */
            if ("es".equals(Locale.getDefault().getLanguage())) {
                pTime = capitaliseWord(pTime);
            }
            holder.textViewCommentDate.setText(pTime);
            holder.textViewCommentText.setText(Html.fromHtml(comment.getText()));
            String authorIcon = UrlUtilities.createBuddyIconUrl(comment.getIconFarm(), comment.getIconServer(), comment.getAuthor());
            Picasso.with(mActivity).load(authorIcon).into(holder.imageViewUserIcon);
            holder.imageViewUserIcon.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    Intent profileViewer = new Intent(mActivity, ProfileViewerActivity.class);
                    profileViewer.putExtra(ProfileViewerActivity.KEY_PROFILE_ID, comment.getAuthor());
                    profileViewer.setAction(ProfileViewerActivity.ACTION_VIEW_USER_BY_ID);
                    startActivity(profileViewer);
                }
            });
            return convertView;
        }
    };
    mListView.setAdapter(mAdapter);
}
Also used : Comment(com.googlecode.flickrjandroid.photos.comments.Comment) ViewGroup(android.view.ViewGroup) ArrayList(java.util.ArrayList) Intent(android.content.Intent) ImageView(android.widget.ImageView) View(android.view.View) TextView(android.widget.TextView) ListView(android.widget.ListView) TextView(android.widget.TextView) ImageView(android.widget.ImageView)

Aggregations

ImageView (android.widget.ImageView)2257 View (android.view.View)1144 TextView (android.widget.TextView)1005 Intent (android.content.Intent)200 Drawable (android.graphics.drawable.Drawable)197 LinearLayout (android.widget.LinearLayout)192 Bitmap (android.graphics.Bitmap)178 ViewGroup (android.view.ViewGroup)163 LayoutInflater (android.view.LayoutInflater)159 OnClickListener (android.view.View.OnClickListener)145 AdapterView (android.widget.AdapterView)111 ListView (android.widget.ListView)103 RecyclerView (android.support.v7.widget.RecyclerView)102 FrameLayout (android.widget.FrameLayout)97 Button (android.widget.Button)83 Bundle (android.os.Bundle)81 BitmapDrawable (android.graphics.drawable.BitmapDrawable)80 RelativeLayout (android.widget.RelativeLayout)72 Test (org.junit.Test)70 Context (android.content.Context)69