Search in sources :

Example 36 with OnClickListener

use of android.view.View.OnClickListener 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 37 with OnClickListener

use of android.view.View.OnClickListener in project glitch-hq-android by tinyspeck.

the class BaseFragment method setupSidebarButton.

private void setupSidebarButton(View root) {
    final Button btnSidebar = (Button) root.findViewById(R.id.btnSidebar);
    if (btnSidebar != null) {
        btnSidebar.setVisibility(View.VISIBLE);
        btnSidebar.setOnClickListener(new OnClickListener() {

            public void onClick(View arg0) {
                HomeScreen activity = (HomeScreen) getActivity();
                activity.showSidebar();
            }
        });
    }
}
Also used : Button(android.widget.Button) OnClickListener(android.view.View.OnClickListener) ImageView(android.widget.ImageView) View(android.view.View)

Example 38 with OnClickListener

use of android.view.View.OnClickListener in project glitch-hq-android by tinyspeck.

the class EncyclopediaGiantsListFragment method init.

private void init(View root) {
    boolean bUpdateData = (m_giantsList == null);
    m_btnBack = (Button) m_root.findViewById(R.id.btnBack);
    m_btnBack.setText("Encyclopedia");
    m_btnBack.setSingleLine();
    m_btnBack.setEllipsize(TruncateAt.END);
    m_btnBack.setOnClickListener(new OnClickListener() {

        public void onClick(View v) {
            FragmentManager fm = getFragmentManager();
            fm.popBackStack();
        }
    });
    m_btnBack.setVisibility(View.VISIBLE);
    m_btnSidebar = (Button) m_root.findViewById(R.id.btnSidebar);
    m_btnSidebar.setVisibility(View.GONE);
    if (bUpdateData) {
        m_giantsList = new Vector<glitchGiant>();
    }
    TextView title = (TextView) root.findViewById(R.id.encyclopedia_giants_list_title);
    title.setTypeface(m_application.m_vagFont);
    m_adapter = new EncyclopediaGiantsListListViewAdapter(this, m_giantsList);
    m_listView = (LinearListView) root.findViewById(R.id.encyclopedia_giants_list_list);
    m_listView.setAdapter(m_adapter);
    if (bUpdateData) {
        getEncyclopediaGiantsList();
    } else {
        showEncyclopediaGiantsListPage();
    }
}
Also used : FragmentManager(android.support.v4.app.FragmentManager) OnClickListener(android.view.View.OnClickListener) TextView(android.widget.TextView) TextView(android.widget.TextView) ScrollView(android.widget.ScrollView) View(android.view.View)

Example 39 with OnClickListener

use of android.view.View.OnClickListener in project glitch-hq-android by tinyspeck.

the class AchievementCategoriesFragment method init.

private void init(View root) {
    boolean bUpdateData = (m_categoriesList == null);
    if (m_fromEncyclopedia) {
        Button m_btnBack = (Button) m_root.findViewById(R.id.btnBack);
        m_btnBack.setText("Encyclopedia");
        m_btnBack.setSingleLine();
        m_btnBack.setEllipsize(TruncateAt.END);
        m_btnBack.setOnClickListener(new OnClickListener() {

            public void onClick(View v) {
                FragmentManager fm = getFragmentManager();
                fm.popBackStack();
            }
        });
        m_btnBack.setVisibility(View.VISIBLE);
        Button m_btnSidebar = (Button) m_root.findViewById(R.id.btnSidebar);
        m_btnSidebar.setVisibility(View.GONE);
    }
    if (bUpdateData) {
        m_categoriesList = new Vector<glitchAchievementCategory>();
    }
    TextView title = (TextView) root.findViewById(R.id.categories_title);
    title.setTypeface(m_application.m_vagFont);
    m_adapter = new AchievementCategoriesListViewAdapter(this, m_categoriesList);
    m_listView = (LinearListView) root.findViewById(R.id.categories_list);
    m_listView.setAdapter(m_adapter);
    if (bUpdateData) {
        getCategories();
    } else {
        showCategoriesPage();
    }
}
Also used : FragmentManager(android.support.v4.app.FragmentManager) Button(android.widget.Button) OnClickListener(android.view.View.OnClickListener) TextView(android.widget.TextView) TextView(android.widget.TextView) View(android.view.View)

Example 40 with OnClickListener

use of android.view.View.OnClickListener in project glitch-hq-android by tinyspeck.

the class AchievementCategoriesListViewAdapter 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.category_list_item, null);
        holder = new ViewHolder();
        holder.name = (TextView) convertView.findViewById(R.id.category_name);
        holder.name.setTypeface(m_application.m_vagFont);
        holder.count = (TextView) convertView.findViewById(R.id.category_count);
        holder.count.setTypeface(m_application.m_vagLightFont);
        holder.whole = (View) convertView.findViewById(R.id.category_item);
        convertView.setTag(holder);
    }
    holder = (ViewHolder) convertView.getTag();
    if (position < getCount()) {
        glitchAchievementCategory category = m_categoriesList.get(position);
        holder.name.setText(category.name);
        holder.count.setText(category.completed + "/" + category.total);
    }
    holder.whole.setTag(position);
    holder.whole.setOnClickListener(new OnClickListener() {

        public void onClick(View arg0) {
            glitchAchievementCategory category = m_categoriesList.get((Integer) arg0.getTag());
            AchievementsFragment fm = new AchievementsFragment(category);
            ((HomeScreen) m_act).setCurrentFragment(fm, true);
        }
    });
    return convertView;
}
Also used : BaseFragment.glitchAchievementCategory(com.tinyspeck.glitchhq.BaseFragment.glitchAchievementCategory) OnClickListener(android.view.View.OnClickListener) TextView(android.widget.TextView) View(android.view.View)

Aggregations

OnClickListener (android.view.View.OnClickListener)794 View (android.view.View)792 TextView (android.widget.TextView)492 Button (android.widget.Button)265 ImageView (android.widget.ImageView)256 Intent (android.content.Intent)183 ListView (android.widget.ListView)112 AdapterView (android.widget.AdapterView)91 ScrollView (android.widget.ScrollView)52 LinearLayout (android.widget.LinearLayout)49 Bundle (android.os.Bundle)43 LayoutInflater (android.view.LayoutInflater)35 ViewGroup (android.view.ViewGroup)30 ArrayList (java.util.ArrayList)30 BindView (butterknife.BindView)29 KeyEvent (android.view.KeyEvent)28 EditText (android.widget.EditText)28 DialogInterface (android.content.DialogInterface)27 OnItemClickListener (android.widget.AdapterView.OnItemClickListener)25 FragmentManager (android.support.v4.app.FragmentManager)23