本文整理汇总了Java中com.google.api.services.plus.model.Activity类的典型用法代码示例。如果您正苦于以下问题:Java Activity类的具体用法?Java Activity怎么用?Java Activity使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Activity类属于com.google.api.services.plus.model包,在下文中一共展示了Activity类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: replaceAll
import com.google.api.services.plus.model.Activity; //导入依赖的package包/类
public void replaceAll(Collection<Activity> items, int start) {
for(Activity a : items) {
if(start < mActivities.size()) {
if(a.getId().equals(mActivities.get(start).getActivity().getId())) {
mActivities.set(start, new Item(a));
} else {
mActivities.add(start, new Item(a));
start++;
}
} else {
mActivities.add(new Item(a));
}
start++;
}
notifyDataSetChanged();
}
开发者ID:gdgjodhpur,项目名称:gdgapp,代码行数:19,代码来源:NewsAdapter.java
示例2: getItemViewType
import com.google.api.services.plus.model.Activity; //导入依赖的package包/类
@Override
public int getItemViewType(int position) {
Item item = getItemInternal(position);
Activity activity = item.getActivity();
if(activity.getObject().getAttachments() == null || activity.getObject().getAttachments().isEmpty())
return 0;
else {
Activity.PlusObject.Attachments attachment = activity.getObject().getAttachments().get(0);
String objectType = attachment.getObjectType();
if(objectType.equals("article"))
return 1;
else if(objectType.equals("video"))
return 2;
else if(objectType.equals("photo"))
return 3;
else if(objectType.equals("album"))
return 4;
else if(objectType.equals("event"))
return 5;
}
return 0;
}
开发者ID:gdgjodhpur,项目名称:gdgapp,代码行数:25,代码来源:NewsAdapter.java
示例3: populatePhoto
import com.google.api.services.plus.model.Activity; //导入依赖的package包/类
private void populatePhoto(ViewHolder mViewHolder, ViewGroup container, Activity.PlusObject.Attachments attachment) {
if(attachment == null)
return;
createAttachmentView(mViewHolder, container, R.layout.news_item_photo, 3);
// Precalc Image Size
if(attachment.getImage() != null && attachment.getImage().getUrl() != null && attachment.getImage().getWidth() != null)
mViewHolder.photo.setDimensions(attachment.getImage().getWidth(), attachment.getImage().getHeight(), attachment.getImage().getUrl());
mViewHolder.photo.setImageDrawable(null);
App.getInstance().getPicasso()
.load(attachment.getImage().getUrl())
.into(mViewHolder.photo);
}
开发者ID:gdgjodhpur,项目名称:gdgapp,代码行数:18,代码来源:NewsAdapter.java
示例4: populateAlbum
import com.google.api.services.plus.model.Activity; //导入依赖的package包/类
private void populateAlbum(ViewHolder mViewHolder, ViewGroup container, Activity.PlusObject.Attachments attachment) {
if(attachment == null)
return;
createAttachmentView(mViewHolder, container, R.layout.news_item_album, 4);
App.getInstance().getPicasso()
.load(attachment.getThumbnails().get(0).getImage().getUrl())
.into(mViewHolder.pic1);
if(attachment.getThumbnails().size() > 1)
App.getInstance().getPicasso()
.load(attachment.getThumbnails().get(1).getImage().getUrl())
.into(mViewHolder.pic2);
if(attachment.getThumbnails().size() > 2)
App.getInstance().getPicasso()
.load(attachment.getThumbnails().get(2).getImage().getUrl())
.into(mViewHolder.pic3);
}
开发者ID:gdgjodhpur,项目名称:gdgapp,代码行数:21,代码来源:NewsAdapter.java
示例5: populateEvent
import com.google.api.services.plus.model.Activity; //导入依赖的package包/类
private void populateEvent(ViewHolder mViewHolder, ViewGroup container, final Activity.PlusObject.Attachments attachment) {
createAttachmentView(mViewHolder, container, R.layout.news_item_event, 5);
TextView title = mViewHolder.attachmentTitle;
String name = attachment.getDisplayName();
if (TextUtils.isEmpty(name)){
title.setVisibility(View.GONE);
} else {
title.setText(name);
title.setClickable(true);
View.OnClickListener mClickEvent = new View.OnClickListener() {
@Override
public void onClick(View view) {
openEventInGPlus(attachment.getUrl());
}
};
mViewHolder.articleImage.setOnClickListener(mClickEvent);
title.setOnClickListener(mClickEvent);
}
TextView content = mViewHolder.attachmentContent;
content.setText(attachment.getContent());
}
开发者ID:gdgjodhpur,项目名称:gdgapp,代码行数:25,代码来源:NewsAdapter.java
示例6: GooglePlusItem
import com.google.api.services.plus.model.Activity; //导入依赖的package包/类
public GooglePlusItem(Comment comment, Activity activity, GooglePlusStreamUser user){
super(SocialNetworkSource.GooglePlus.toString(), Operation.NEW);
if (comment == null) return;
//Id
id = SocialNetworkSource.GooglePlus+"#"+comment.getId();
//Reference to the original post
reference = SocialNetworkSource.GooglePlus+"#"+activity.getId();
//SocialNetwork Name
streamId = SocialNetworkSource.GooglePlus.toString();
//Timestamp of the creation of the post
publicationTime = comment.getPublished().getValue();
description = "Comment";
//User that posted the post
if(user != null) {
streamUser = user;
uid = streamUser.getId();
}
//Popularity of the post
if(comment.getPlusoners() != null){
likes = new Long(comment.getPlusoners().size());
}
}
开发者ID:socialsensor,项目名称:socialmedia-abstractions,代码行数:25,代码来源:GooglePlusItem.java
示例7: deliverResult
import com.google.api.services.plus.model.Activity; //导入依赖的package包/类
@Override
public void deliverResult(List<Activity> activities) {
mIsLoading = false;
if (activities != null) {
if (mActivities == null) {
mActivities = activities;
} else {
mActivities.addAll(activities);
}
}
if (isStarted()) {
// Need to return new ArrayList for some reason or onLoadFinished() is not called
super.deliverResult(mActivities == null ?
null : new ArrayList<Activity>(mActivities));
}
}
开发者ID:amardeshbd,项目名称:google-iosched,代码行数:17,代码来源:SocialStreamFragment.java
示例8: bindView
import com.google.api.services.plus.model.Activity; //导入依赖的package包/类
@Override
public void bindView(View view, Context context, Cursor cursor) {
long id = cursor.getLong(AnnouncementsQuery._ID);
String activityJson = cursor.getString(AnnouncementsQuery.ANNOUNCEMENT_ACTIVITY_JSON);
Activity activity = mActivityCache.get(id);
// TODO: this should be async
if (activity == null) {
try {
activity = mFactory.fromString(activityJson, Activity.class);
} catch (IOException e) {
LOGE(TAG, "Couldn't parse activity JSON: " + activityJson, e);
}
mActivityCache.put(id, activity);
}
PlusStreamRowViewBinder.bindActivityView(view, activity, mImageLoader, true);
}
开发者ID:TheDeltaProgram,项目名称:iosched2013,代码行数:18,代码来源:AnnouncementsFragment.java
示例9: getActivity
import com.google.api.services.plus.model.Activity; //导入依赖的package包/类
/** Get an activity for which we already know the ID. */
private static void getActivity() throws IOException {
// A known public activity ID
String activityId = "z12gtjhq3qn2xxl2o224exwiqruvtda0i";
// We do not need to be authenticated to fetch this activity
View.header1("Get an explicit public activity by ID");
Activity activity = plus.activities().get(activityId).execute();
View.show(activity);
}
开发者ID:sshubhadeep,项目名称:GooglePlusJavaImplementation,代码行数:10,代码来源:GooglePlusConsoleDisplay.java
示例10: onContextItemSelected
import com.google.api.services.plus.model.Activity; //导入依赖的package包/类
@Override
public boolean onContextItemSelected(MenuItem item) {
AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo();
Activity activity = (Activity) mAdapter.getItem(info.position);
switch(item.getItemId()) {
case R.id.share_with_googleplus:
shareWithGooglePlus(activity);
return true;
default:
return super.onContextItemSelected(item);
}
}
开发者ID:gdgjodhpur,项目名称:gdgapp,代码行数:14,代码来源:NewsFragment.java
示例11: shareWithGooglePlus
import com.google.api.services.plus.model.Activity; //导入依赖的package包/类
private void shareWithGooglePlus(Activity activity) {
Intent shareIntent = new PlusShare.Builder(getActivity())
.setType("text/plain")
.setContentUrl(Uri.parse(activity.getUrl()))
.getIntent();
startActivityForResult(shareIntent, 0);
}
开发者ID:gdgjodhpur,项目名称:gdgapp,代码行数:9,代码来源:NewsFragment.java
示例12: populateArticle
import com.google.api.services.plus.model.Activity; //导入依赖的package包/类
private void populateArticle(ViewHolder mViewHolder, ViewGroup container, final Activity.PlusObject.Attachments attachment) {
if(attachment == null)
return;
View attachmentView = createAttachmentView(mViewHolder, container, R.layout.news_item_article, 1);
mViewHolder.title.setText(attachment.getDisplayName());
try {
mViewHolder.attachmentContent.setText(new URL(attachment.getUrl()).getHost());
} catch (MalformedURLException e) {
e.printStackTrace();
}
if(attachment.getImage() == null && attachment.getFullImage() == null)
mViewHolder.articleImage.setVisibility(View.GONE);
else {
String imageUrl = attachment.getImage().getUrl();
if(attachment.getFullImage() != null)
imageUrl = attachment.getFullImage().getUrl();
mViewHolder.articleImage.setImageDrawable(null);
mViewHolder.articleImage.setVisibility(View.VISIBLE);
App.getInstance().getPicasso()
.load(imageUrl)
.into(mViewHolder.articleImage);
}
attachmentView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(attachment.getUrl()));
mContext.startActivity(i);
}
});
}
开发者ID:gdgjodhpur,项目名称:gdgapp,代码行数:37,代码来源:NewsAdapter.java
示例13: populateShare
import com.google.api.services.plus.model.Activity; //导入依赖的package包/类
private void populateShare(Activity item, ViewHolder holder) {
String originallyShared = "";
if(item.getObject().getActor() != null && mContext != null)
originallyShared = "<b><a href=\""+item.getObject().getActor().getUrl()+"\">"+ item.getObject().getActor().getDisplayName() +"</a></b> "+ mContext.getString(R.string.originally_shared)+"<br/><br/>";
if (item.getAnnotation() != null) {
holder.content.setText(fromHtml(item.getAnnotation()));
holder.shareContent.setText(fromHtml(originallyShared + item.getObject().getContent()));
holder.shareContainer.setVisibility(View.VISIBLE);
} else {
holder.shareContainer.setVisibility(View.GONE);
holder.content.setText(fromHtml(originallyShared + item.getObject().getContent()));
}
}
开发者ID:gdgjodhpur,项目名称:gdgapp,代码行数:16,代码来源:NewsAdapter.java
示例14: GooglePlusPost
import com.google.api.services.plus.model.Activity; //导入依赖的package包/类
public GooglePlusPost(Comment comment, Activity activity, GooglePlusAccount user) {
if (comment == null)
return;
//Id
id = Sources.GOOGLE_PLUS + "#" + comment.getId();
//SocialNetwork Name
type = Sources.GOOGLE_PLUS;
//Timestamp of the creation of the post
creationDate = new Date(comment.getPublished().getValue());
description = "Comment";
//User that posted the post
setContributor(user);
//Popularity of the post
if (comment.getPlusoners() != null) {
numLikes = comment.getPlusoners().size();
}
Post originalPost = new Post();
originalPost.setId(Sources.GOOGLE_PLUS + "#" + activity.getId());
addAssociation(new Reference(originalPost, this, Reference.ReferenceType.COMMENT));
}
开发者ID:MKLab-ITI,项目名称:simmo,代码行数:28,代码来源:GooglePlusPost.java
示例15: showActivities
import com.google.api.services.plus.model.Activity; //导入依赖的package包/类
/**
* Exibir as últimas 5 atividades de um usuário.
*
* @param person Usuário.
*/
public void showActivities(Person person) {
List<Activity> activities = getActivities(person.getId(), 5);
for(Activity activity : activities) {
System.out.println("Activity: " + activity.getObject().getContent() + "\n");
}
}
开发者ID:marloncarvalho,项目名称:javamagazine-googleplus,代码行数:12,代码来源:GooglePlus.java
示例16: getActivities
import com.google.api.services.plus.model.Activity; //导入依赖的package包/类
/**
* Obter uma lista contendo as atividades de um usuário no Google+.
*
* @param userID Identificador do usuário que queremos obter as atividades.
* @param maxResults Quantidade máxima de resultados a serem retornados.
* @return Lista de atividades do usuário.
*/
public List<Activity> getActivities(String userID, long maxResults) {
Plus.Activities.List listActivities;
try {
listActivities = plus.activities().list(userID, "public");
listActivities.setMaxResults(maxResults);
ActivityFeed feed = listActivities.execute();
return feed.getItems();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
开发者ID:marloncarvalho,项目名称:javamagazine-googleplus,代码行数:19,代码来源:GooglePlus.java
示例17: getActivity
import com.google.api.services.plus.model.Activity; //导入依赖的package包/类
/**
* Obter uma atividade específica.
*
* @param id Identificador da atividade.
* @return Atividade encontrada.
*/
public Activity getActivity(String id) {
try {
return plus.activities().get(id).execute();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
开发者ID:marloncarvalho,项目名称:javamagazine-googleplus,代码行数:14,代码来源:GooglePlus.java
示例18: onListItemClick
import com.google.api.services.plus.model.Activity; //导入依赖的package包/类
@Override
public void onListItemClick(ListView l, View v, int position, long id) {
Activity activity = mStream.get(position);
Intent postDetailIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(activity.getUrl()));
postDetailIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
UIUtils.preferPackageForIntent(getActivity(), postDetailIntent,
UIUtils.GOOGLE_PLUS_PACKAGE_NAME);
UIUtils.safeOpenLink(getActivity(), postDetailIntent);
}
开发者ID:amardeshbd,项目名称:google-iosched,代码行数:11,代码来源:SocialStreamFragment.java
示例19: onLoadFinished
import com.google.api.services.plus.model.Activity; //导入依赖的package包/类
@Override
public void onLoadFinished(Loader<List<Activity>> listLoader, List<Activity> activities) {
if (activities != null) {
mStream = activities;
}
mStreamAdapter.notifyDataSetChanged();
if (mListViewStatePosition != -1 && isAdded()) {
getListView().setSelectionFromTop(mListViewStatePosition, mListViewStateTop);
mListViewStatePosition = -1;
}
}
开发者ID:amardeshbd,项目名称:google-iosched,代码行数:12,代码来源:SocialStreamFragment.java
示例20: loadInBackground
import com.google.api.services.plus.model.Activity; //导入依赖的package包/类
@Override
public List<Activity> loadInBackground() {
mIsLoading = true;
// Set up the HTTP transport and JSON factory
HttpTransport httpTransport = new NetHttpTransport();
JsonFactory jsonFactory = new JacksonFactory();
JsonHttpRequestInitializer initializer = new GoogleKeyInitializer(
Config.API_KEY);
// Set up the main Google+ class
Plus plus = Plus.builder(httpTransport, jsonFactory)
.setApplicationName(Config.APP_NAME)
.setJsonHttpRequestInitializer(initializer)
.build();
ActivityFeed activities = null;
try {
activities = plus.activities().search(mSearchString)
.setPageToken(mNextPageToken)
.setMaxResults(MAX_RESULTS_PER_REQUEST)
.execute();
mHasError = false;
mNextPageToken = activities.getNextPageToken();
} catch (IOException e) {
e.printStackTrace();
mHasError = true;
mNextPageToken = null;
}
return (activities != null) ? activities.getItems() : null;
}
开发者ID:amardeshbd,项目名称:google-iosched,代码行数:36,代码来源:SocialStreamFragment.java
注:本文中的com.google.api.services.plus.model.Activity类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论