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;
}
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();
}
});
}
}
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();
}
}
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();
}
}
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;
}
Aggregations