• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java Moment类的典型用法和代码示例

java 1次浏览

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

Moment类属于com.google.android.gms.plus.model.moments包,在下文中一共展示了Moment类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: onCreate

点赞 3

import com.google.android.gms.plus.model.moments.Moment; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.list_moments_activity);
    PlusOptions options = PlusOptions.builder().addActivityTypes(MomentUtil.ACTIONS).build();
    mGoogleApiClient = new GoogleApiClient.Builder(this)
            .addConnectionCallbacks(this)
            .addOnConnectionFailedListener(this)
            .addApi(Plus.API, options)
            .addScope(Plus.SCOPE_PLUS_LOGIN)
            .build();

    mListItems = new ArrayList<Moment>();
    mMomentListAdapter = new MomentListAdapter(this, android.R.layout.simple_list_item_1,
            mListItems);
    mMomentListView = (ListView) findViewById(R.id.moment_list);
    mMomentListView.setOnItemClickListener(this);
    mResolvingError = savedInstanceState != null
            && savedInstanceState.getBoolean(STATE_RESOLVING_ERROR, false);

    int available = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);
    if (available != CommonStatusCodes.SUCCESS) {
        showDialog(DIALOG_GET_GOOGLE_PLAY_SERVICES);
    }
}
 

开发者ID:TerribleDev,
项目名称:XamarinAdmobTutorial,
代码行数:26,
代码来源:ListMomentsActivity.java

示例2: getView

点赞 3

import com.google.android.gms.plus.model.moments.Moment; //导入依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    View resultView = convertView;
    if (resultView == null) {
        resultView = mLayoutInflater.inflate(R.layout.moment_row, null);
    }

    Moment moment = mItems.get(position);
    if (moment != null) {
        TextView typeView = (TextView) resultView.findViewById(R.id.moment_type);
        TextView titleView = (TextView) resultView.findViewById(R.id.moment_title);

        String type = Uri.parse(moment.getType()).getPath().substring(1);
        typeView.setText(type);

        if (moment.getTarget() != null) {
            titleView.setText(moment.getTarget().getName());
        }
    }

    return resultView;
}
 

开发者ID:TerribleDev,
项目名称:XamarinAdmobTutorial,
代码行数:23,
代码来源:ListMomentsActivity.java

示例3: onItemClick

点赞 3

import com.google.android.gms.plus.model.moments.Moment; //导入依赖的package包/类
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
    if (mGoogleApiClient.isConnected()) {
        TextView textView = (TextView) view;
        String momentType = (String) textView.getText();
        String targetUrl = MomentUtil.MOMENT_TYPES.get(momentType);

        ItemScope target = new ItemScope.Builder().setUrl(targetUrl).build();

        Moment.Builder momentBuilder = new Moment.Builder();
        momentBuilder.setType("http://schemas.google.com/" + momentType);
        momentBuilder.setTarget(target);

        ItemScope result = MomentUtil.getResultFor(momentType);
        if (result != null) {
          momentBuilder.setResult(result);
        }

        Plus.MomentsApi.write(mGoogleApiClient, momentBuilder.build());
    }
}
 

开发者ID:TerribleDev,
项目名称:XamarinAdmobTutorial,
代码行数:22,
代码来源:MomentActivity.java

示例4: onItemClick

点赞 3

import com.google.android.gms.plus.model.moments.Moment; //导入依赖的package包/类
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
    if (mGoogleApiClient.isConnected()) {
        TextView textView = (TextView) view;
        String momentType = (String) textView.getText();
        String targetUrl = MomentUtil.MOMENT_TYPES.get(momentType);

        ItemScope target = new ItemScope.Builder().setUrl(targetUrl).build();

        Moment.Builder momentBuilder = new Moment.Builder();
        momentBuilder.setType("http://schemas.google.com/" + momentType);
        momentBuilder.setTarget(target);

        ItemScope result = MomentUtil.getResultFor(momentType);
        if (result != null) {
            momentBuilder.setResult(result);
        }

        Plus.MomentsApi.write(mGoogleApiClient, momentBuilder.build()).setResultCallback(this);
    }
}
 

开发者ID:benbek,
项目名称:HereAStory-Android,
代码行数:22,
代码来源:MomentActivity.java

示例5: onMomentsLoaded

点赞 3

import com.google.android.gms.plus.model.moments.Moment; //导入依赖的package包/类
/**
 * Callback to notify that the currently authenticated users activities have been retrieved.
 * 
 * @param status the status returned from the request to fetch moments.
 * @param moments an immutable buffer containing the activities of the user.
 * @param nextPageToken a token to retrieve older user activities.
 * @param updated the time at which this collection of moments was last updated. Formatted as an RFC 3339 timestamp.
 */
@Override
public void onMomentsLoaded(ConnectionResult status, MomentBuffer moments,
        String nextPageToken, String updated) {
    if (status.getErrorCode() == ConnectionResult.SUCCESS) {
        try {
            for (Moment moment : moments) {
                // Make the activities available to our adapter.
                // Each moment must be frozen in order to persist it outside of the
                // MomentBuffer.
                mListItems.add(moment.freeze());
            }
        } finally {
            moments.close();
        }

        mMomentListAdapter.notifyDataSetChanged();
    } else {
        Log.e(TAG, "Error when loading moments: " + status.getErrorCode());
    }
}
 

开发者ID:vicfryzel,
项目名称:gplus-photohunt-client-android,
代码行数:29,
代码来源:ProfileActivity.java

示例6: getView

点赞 3

import com.google.android.gms.plus.model.moments.Moment; //导入依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    View v = convertView;
    if (v == null) {
        LayoutInflater vi = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        v = vi.inflate(R.layout.moment_list_item, null);
    }
    Moment moment = items.get(position);
    if (moment != null) {
        TextView typeView = (TextView)v.findViewById(R.id.moment_type);
        TextView titleView = (TextView)v.findViewById(R.id.moment_title);
        typeView.setText("Voted");

        if (moment.getTarget() != null) {
            titleView.setText(moment.getTarget().getName());
        }
    }

    return v;

}
 

开发者ID:vicfryzel,
项目名称:gplus-photohunt-client-android,
代码行数:22,
代码来源:ProfileActivity.java

示例7: onCreate

点赞 3

import com.google.android.gms.plus.model.moments.Moment; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.list_moments_activity);
    mPlusClient = new PlusClient.Builder(this, this, this)
            .setActions(MomentUtil.ACTIONS)
            .build();

    mListItems = new ArrayList<Moment>();
    mMomentListAdapter = new MomentListAdapter(this, android.R.layout.simple_list_item_1,
            mListItems);
    mMomentListView = (ListView) findViewById(R.id.moment_list);
    mMomentListView.setOnItemClickListener(this);
    mResolvingError = savedInstanceState != null
            && savedInstanceState.getBoolean(STATE_RESOLVING_ERROR, false);

    int available = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);
    if (available != ConnectionResult.SUCCESS) {
        showDialog(DIALOG_GET_GOOGLE_PLAY_SERVICES);
    }
}
 

开发者ID:laurion,
项目名称:wabbit-client,
代码行数:22,
代码来源:ListMomentsActivity.java

示例8: onItemClick

点赞 3

import com.google.android.gms.plus.model.moments.Moment; //导入依赖的package包/类
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
    TextView textView = (TextView) view;
    String momentType = (String) textView.getText();
    String targetUrl = MomentUtil.MOMENT_TYPES.get(momentType);

    ItemScope target = new ItemScope.Builder().setUrl(targetUrl).build();

    Moment.Builder momentBuilder = new Moment.Builder();
    momentBuilder.setType("http://schemas.google.com/" + momentType);
    momentBuilder.setTarget(target);

    ItemScope result = MomentUtil.getResultFor(momentType);
    if (result != null) {
      momentBuilder.setResult(result);
    }

    mPlusClient.writeMoment(momentBuilder.build());
}
 

开发者ID:laurion,
项目名称:wabbit-client,
代码行数:20,
代码来源:MomentActivity.java

示例9: write

点赞 2

import com.google.android.gms.plus.model.moments.Moment; //导入依赖的package包/类
public final PendingResult<Status> write(GoogleApiClient paramGoogleApiClient, final Moment paramMoment)
{
  return paramGoogleApiClient.b(new c(this.Ea)
  {
    protected void a(hs paramAnonymoushs)
    {
      paramAnonymoushs.writeMoment(paramMoment);
      a(Status.nA);
    }
  });
}
 

开发者ID:mmmsplay10,
项目名称:QuizUpWinner,
代码行数:12,
代码来源:hz.java

示例10: writeMoment

点赞 2

import com.google.android.gms.plus.model.moments.Moment; //导入依赖的package包/类
public void writeMoment(Moment paramMoment)
{
  bP();
  try
  {
    ey localey = ey.a((id)paramMoment);
    ((hr)bQ()).a(localey);
    return;
  }
  catch (RemoteException localRemoteException)
  {
    throw new IllegalStateException(localRemoteException);
  }
}
 

开发者ID:mmmsplay10,
项目名称:QuizUpWinner,
代码行数:15,
代码来源:hs.java

示例11: onItemClick

点赞 2

import com.google.android.gms.plus.model.moments.Moment; //导入依赖的package包/类
/**
 * Delete a moment when clicked.
 */
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    Moment moment = mMomentListAdapter.getItem(position);
    if (moment != null) {
        if (mGoogleApiClient.isConnected()) {
            Plus.MomentsApi.remove(mGoogleApiClient, moment.getId());
            Toast.makeText(this, getString(R.string.plus_remove_moment_status),
                    Toast.LENGTH_SHORT).show();
        } else {
            Toast.makeText(this, getString(R.string.greeting_status_sign_in_required),
                    Toast.LENGTH_SHORT).show();
        }
    }
}
 

开发者ID:TerribleDev,
项目名称:XamarinAdmobTutorial,
代码行数:18,
代码来源:ListMomentsActivity.java

示例12: MomentListAdapter

点赞 2

import com.google.android.gms.plus.model.moments.Moment; //导入依赖的package包/类
public MomentListAdapter(Context context, int textViewResourceId,
        ArrayList<Moment> objects) {
    super(context, textViewResourceId, objects);
    mLayoutInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    mItems = objects;

}
 

开发者ID:TerribleDev,
项目名称:XamarinAdmobTutorial,
代码行数:8,
代码来源:ListMomentsActivity.java

示例13: onCreate

点赞 2

import com.google.android.gms.plus.model.moments.Moment; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.list_moments_activity);
    PlusOptions options = PlusOptions.builder().addActivityTypes(MomentUtil.ACTIONS).build();
    mGoogleApiClient = new GoogleApiClient.Builder(this)
            .addConnectionCallbacks(this)
            .addOnConnectionFailedListener(this)
            .addApi(Plus.API, options)
            .addScope(Plus.SCOPE_PLUS_LOGIN)
            .build();

    mListItems = new ArrayList<Moment>();
    mMomentListAdapter = new MomentListAdapter(this, android.R.layout.simple_list_item_1,
            mListItems);
    mMomentListView = (ListView) findViewById(R.id.moment_list);
    mMomentListView.setOnItemClickListener(this);
    mResolvingError = savedInstanceState != null
            && savedInstanceState.getBoolean(STATE_RESOLVING_ERROR, false);

    int available = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);
    if (available != CommonStatusCodes.SUCCESS) {
        showDialog(DIALOG_GET_GOOGLE_PLAY_SERVICES);
    }

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        getActionBar().setDisplayHomeAsUpEnabled(true);
    }
}
 

开发者ID:benbek,
项目名称:HereAStory-Android,
代码行数:30,
代码来源:ListMomentsActivity.java

示例14: onCreate

点赞 2

import com.google.android.gms.plus.model.moments.Moment; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.profile_activity);

    mProfileText = (TextView) findViewById(R.id.profile_text);
    mProfileImageView = (ImageView) findViewById(R.id.profile_photo);
    mImageListView = (ListView) findViewById(R.id.activity_stream);

    mListItems = new ArrayList<Moment>();
    mMomentListAdapter = new MomentListAdapter(this, android.R.layout.simple_list_item_1,
            mListItems);

    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
 

开发者ID:vicfryzel,
项目名称:gplus-photohunt-client-android,
代码行数:16,
代码来源:ProfileActivity.java

示例15: onItemClick

点赞 2

import com.google.android.gms.plus.model.moments.Moment; //导入依赖的package包/类
/**
 * Delete a moment when clicked.
 */
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    Moment moment = mMomentListAdapter.getItem(position);
    if (moment != null) {
        mPlusClient.removeMoment(moment.getId());
        Toast.makeText(this, getString(R.string.plus_remove_moment_status),
                Toast.LENGTH_SHORT).show();
    }
}
 

开发者ID:laurion,
项目名称:wabbit-client,
代码行数:13,
代码来源:ListMomentsActivity.java

示例16: writeMoment

点赞 2

import com.google.android.gms.plus.model.moments.Moment; //导入依赖的package包/类
@Deprecated
public void writeMoment(Moment paramMoment)
{
  this.Du.writeMoment(paramMoment);
}
 

开发者ID:mmmsplay10,
项目名称:QuizUpWinner,
代码行数:6,
代码来源:PlusClient.java

示例17: MomentListAdapter

点赞 2

import com.google.android.gms.plus.model.moments.Moment; //导入依赖的package包/类
public MomentListAdapter(Context ctx, int textViewResourceId, ArrayList<Moment> objects) {
    super(ctx, textViewResourceId, objects);
    items = objects;
}
 

开发者ID:vicfryzel,
项目名称:gplus-photohunt-client-android,
代码行数:5,
代码来源:ProfileActivity.java

示例18: write

点赞 1

import com.google.android.gms.plus.model.moments.Moment; //导入依赖的package包/类
public abstract PendingResult<Status> write(GoogleApiClient paramGoogleApiClient, Moment paramMoment); 

开发者ID:mmmsplay10,
项目名称:QuizUpWinner,
代码行数:2,
代码来源:Moments.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)