use of android.widget.ImageButton in project Klyph by jonathangerbaud.
the class StreamAdapter2 method attachHolder.
@Override
protected void attachHolder(View view) {
ImageView authorProfileImage = (ImageView) view.findViewById(R.id.author_profile_image);
TextView story = (TextView) view.findViewById(R.id.story);
TextView postTime = (TextView) view.findViewById(R.id.post_time);
ImageView sharedAuthorProfileImage = (ImageView) view.findViewById(R.id.shared_author_profile_image);
TextView sharedStory = (TextView) view.findViewById(R.id.shared_story);
TextView sharedPostTime = (TextView) view.findViewById(R.id.shared_post_time);
TextView message = (TextView) view.findViewById(R.id.message);
ImageView postPhoto = (ImageView) view.findViewById(R.id.post_photo);
ImageView postVideoPlay = (ImageView) view.findViewById(R.id.post_video_play);
TextView videoTitle = (TextView) view.findViewById(R.id.post_video_title);
TextView videoUrl = (TextView) view.findViewById(R.id.post_video_url);
ImageView postPicturePlay = (ImageView) view.findViewById(R.id.post_picture_play);
ImageView postLinkBackground = (ImageView) view.findViewById(R.id.stream_link_image_background);
TextView postName = (TextView) view.findViewById(R.id.post_name);
TextView postCaption = (TextView) view.findViewById(R.id.post_caption);
TextView postDescription = (TextView) view.findViewById(R.id.post_description);
HListView streamAlbum = (HListView) view.findViewById(R.id.stream_album);
ViewGroup streamLink = (ViewGroup) view.findViewById(R.id.stream_link);
Button likeButton = (Button) view.findViewById(R.id.like_button);
Button commentButton = (Button) view.findViewById(R.id.comment_button);
ImageButton shareButton = (ImageButton) view.findViewById(R.id.share_button);
ImageButton overflowButton = (ImageButton) view.findViewById(R.id.overflow_button);
ViewGroup buttonBar = (ViewGroup) view.findViewById(R.id.button_bar);
View buttonBarDivider = (View) view.findViewById(R.id.button_bar_divider);
StreamHolder holder = new StreamHolder(authorProfileImage, story, postTime, sharedAuthorProfileImage, sharedStory, sharedPostTime, message, postPhoto, postVideoPlay, videoTitle, videoUrl, postPicturePlay, postLinkBackground, postName, postCaption, postDescription, likeButton, commentButton, shareButton, overflowButton, streamAlbum, streamLink, buttonBar, buttonBarDivider);
setHolder(view, holder);
}
use of android.widget.ImageButton in project SmartAndroidSource by jaychou2012.
the class ActionBar method inflateAction.
/**
* Inflates a {@link View} with the given {@link Action}.
*
* @param action
* the action to inflate
* @return a view
*/
private View inflateAction(Action action) {
View view = mInflater.inflate(getResources().getIdentifier("actionbar_item", "layout", c.getPackageName()), mActionsView, false);
ImageButton labelView = (ImageButton) view.findViewById(getResources().getIdentifier("actionbar_item", "id", c.getPackageName()));
// ImageButton labelView = (ImageButton) view
// .findViewById(R.id.actionbar_item);
labelView.setImageResource(action.getDrawable());
view.setTag(action);
view.setOnClickListener(this);
return view;
}
use of android.widget.ImageButton in project SmartAndroidSource by jaychou2012.
the class TopBar method inflateAction.
/**
* Inflates a {@link View} with the given {@link Action}.
*
* @param action
* the action to inflate
* @return a view
*/
private View inflateAction(Action action) {
View view = mInflater.inflate(getResources().getIdentifier("topbar_item", "layout", c.getPackageName()), mActionsView, false);
ImageButton labelView = (ImageButton) view.findViewById(getResources().getIdentifier("topbar_item", "id", c.getPackageName()));
// ImageButton labelView = (ImageButton) view
// .findViewById(R.id.actionbar_item);
labelView.setImageResource(action.getDrawable());
view.setTag(action);
view.setOnClickListener(this);
return view;
}
use of android.widget.ImageButton in project Talon-for-Twitter by klinker24.
the class TweetFragment method getInfo.
public void getInfo(final View favButton, final TextView favCount, final TextView retweetCount, final long tweetId, final View retweetButton) {
Thread getInfo = new Thread(new Runnable() {
@Override
public void run() {
String location = "";
String via = "";
long realTime = 0;
boolean retweetedByMe = false;
try {
Twitter twitter = getTwitter();
TwitterMultipleImageHelper helper = new TwitterMultipleImageHelper();
status = twitter.showStatus(tweetId);
ArrayList<String> i = new ArrayList<String>();
if (picture) {
i = helper.getImageURLs(status, twitter);
}
final ArrayList<String> images = i;
GeoLocation loc = status.getGeoLocation();
try {
Geocoder geocoder = new Geocoder(context, Locale.getDefault());
List<Address> addresses = geocoder.getFromLocation(loc.getLatitude(), loc.getLongitude(), 1);
if (addresses.size() > 0) {
Address address = addresses.get(0);
location += address.getLocality() + ", " + address.getCountryName();
} else {
location = "";
}
} catch (Exception x) {
location = "";
}
via = android.text.Html.fromHtml(status.getSource()).toString();
final String sfavCount;
if (status.isRetweet()) {
twitter4j.Status status2 = status.getRetweetedStatus();
via = android.text.Html.fromHtml(status2.getSource()).toString();
realTime = status2.getCreatedAt().getTime();
sfavCount = status2.getFavoriteCount() + "";
} else {
realTime = status.getCreatedAt().getTime();
sfavCount = status.getFavoriteCount() + "";
}
retweetedByMe = status.isRetweetedByMe();
final String retCount = "" + status.getRetweetCount();
final String timeDisplay;
if (!settings.militaryTime) {
timeDisplay = DateFormat.getDateInstance(DateFormat.MEDIUM, Locale.US).format(realTime) + " " + DateFormat.getTimeInstance(DateFormat.SHORT, Locale.US).format(realTime);
} else {
timeDisplay = DateFormat.getDateInstance(DateFormat.MEDIUM, Locale.GERMAN).format(realTime) + " " + DateFormat.getTimeInstance(DateFormat.SHORT, Locale.GERMAN).format(realTime);
}
final String fVia = " " + getResources().getString(R.string.via) + " " + via;
final String fLoc = location.equals("") ? "" : "\n" + location;
final boolean fRet = retweetedByMe;
final long fTime = realTime;
final Status fStatus = status;
((Activity) context).runOnUiThread(new Runnable() {
@Override
public void run() {
retweetCount.setText(" " + retCount);
if (retweetButton instanceof ImageButton) {
if (fRet) {
if (!settings.addonTheme) {
((ImageButton) retweetButton).setColorFilter(context.getResources().getColor(R.color.app_color));
} else {
((ImageButton) retweetButton).setColorFilter(settings.accentInt);
}
} else {
((ImageButton) retweetButton).clearColorFilter();
}
} else {
if (fRet) {
if (!settings.addonTheme) {
retweetButton.setBackgroundColor(context.getResources().getColor(R.color.app_color));
} else {
retweetButton.setBackgroundColor(settings.accentInt);
}
} else {
retweetButton.setBackgroundColor(getResources().getColor(android.R.color.transparent));
}
}
timetv.setText(timeDisplay + fVia);
timetv.append(fLoc);
favCount.setText(" " + sfavCount);
if (favButton instanceof ImageButton) {
if (fStatus.isFavorited()) {
TypedArray a = context.getTheme().obtainStyledAttributes(new int[] { R.attr.favoritedButton });
int resource = a.getResourceId(0, 0);
a.recycle();
if (!settings.addonTheme) {
((ImageButton) favButton).setColorFilter(context.getResources().getColor(R.color.app_color));
} else {
((ImageButton) favButton).setColorFilter(settings.accentInt);
}
((ImageButton) favButton).setImageDrawable(context.getResources().getDrawable(resource));
isFavorited = true;
} else {
TypedArray a = context.getTheme().obtainStyledAttributes(new int[] { R.attr.notFavoritedButton });
int resource = a.getResourceId(0, 0);
a.recycle();
((ImageButton) favButton).setImageDrawable(context.getResources().getDrawable(resource));
isFavorited = false;
((ImageButton) favButton).clearColorFilter();
}
} else {
if (fStatus.isFavorited()) {
TypedArray a = context.getTheme().obtainStyledAttributes(new int[] { R.attr.favoritedButton });
int resource = a.getResourceId(0, 0);
a.recycle();
if (!settings.addonTheme) {
favButton.setBackgroundColor(context.getResources().getColor(R.color.app_color));
} else {
favButton.setBackgroundColor(settings.accentInt);
}
isFavorited = true;
} else {
isFavorited = false;
favButton.setBackgroundColor(getResources().getColor(android.R.color.transparent));
}
}
for (String s : images) {
Log.v("talon_image", s);
}
if (images.size() > 1) {
Log.v("talon_images", "size: " + images.size());
try {
mAttacher.setOnViewTapListener(new PhotoViewAttacher.OnViewTapListener() {
@Override
public void onViewTap(View view, float x, float y) {
Intent viewPics = new Intent(context, ViewPictures.class);
viewPics.putExtra("images", images);
startActivity(viewPics);
}
});
} catch (Exception e) {
// addon theme without the attacher
profilePic.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent viewPics = new Intent(context, ViewPictures.class);
viewPics.putExtra("images", images);
startActivity(viewPics);
}
});
}
}
}
});
} catch (Exception e) {
}
}
});
getInfo.setPriority(Thread.MAX_PRIORITY);
getInfo.start();
}
use of android.widget.ImageButton in project Klyph by jonathangerbaud.
the class PostPhotos method onViewCreated.
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
view.setBackgroundResource(AttrUtil.getResourceId(getActivity(), R.attr.actionBarStackedBackground));
setListVisible(false);
ImageButton deleteButton = (ImageButton) view.findViewById(R.id.delete_button);
deleteButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (listener != null)
listener.onPostPhotosDeleteClick();
}
});
super.onViewCreated(view, savedInstanceState);
getGridView().setHorizontalSpacing(0);
defineEmptyText(R.string.empty_list_no_photo);
}
Aggregations