当前位置: 首页>>代码示例>>Java>>正文


Java Activity类代码示例

本文整理汇总了Java中com.google.api.services.plus.model.Activity的典型用法代码示例。如果您正苦于以下问题:Java Activity类的具体用法?Java Activity怎么用?Java Activity使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Activity类属于com.google.api.services.plus.model包,在下文中一共展示了Activity类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的com.google.api.services.plus.model.Activity类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。