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


Java CloudEntity类代码示例

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


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

示例1: getView

import com.google.cloud.backend.core.CloudEntity; //导入依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    View view = convertView != null ?
            convertView : mInflater.inflate(R.layout.row_post, parent, false);

    CloudEntity ce = getItem(position);
    if (ce != null) {
        TextView message = (TextView) view.findViewById(R.id.messageContent);
        TextView signature = (TextView) view.findViewById(R.id.signature);
        if (message != null) {
            message.setText(ce.get("message").toString());
        }
        if (signature != null) {
            signature.setText(getAuthor(ce) + " " + SDF.format(ce.getCreatedAt()));
        }
    }

    return view;
}
 
开发者ID:pkill9,项目名称:POSproject,代码行数:20,代码来源:PostAdapter.java

示例2: onSendButtonPressed

import com.google.cloud.backend.core.CloudEntity; //导入依赖的package包/类
/**
 * onClick method.
 */
public void onSendButtonPressed(View view) {

    // create a CloudEntity with the new post
    CloudEntity newPost = new CloudEntity("Guestbook");
    newPost.put("message", Integer.toString(testint) );
    testint ++;
   
    // create a response handler that will receive the result or an error
    CloudCallbackHandler<CloudEntity> handler = new CloudCallbackHandler<CloudEntity>() {
        @Override
        public void onComplete(final CloudEntity result) {
            mPosts.add(0, result);
            updateGuestbookView();
            mSendBtn.setEnabled(true);
        }

        @Override
        public void onError(final IOException exception) {
            handleEndpointException(exception);
        }
    };
    // execute the insertion with the handler
    mProcessingFragment.getCloudBackend().insert(newPost, handler);
    mSendBtn.setEnabled(true);
}
 
开发者ID:pkill9,项目名称:POSproject,代码行数:29,代码来源:CookActivity.java

示例3: listPosts

import com.google.cloud.backend.core.CloudEntity; //导入依赖的package包/类
/**
 * Retrieves the list of all posts from the backend and updates the UI. For
 * demonstration in this sample, the query that is executed is:
 * "SELECT * FROM Guestbook ORDER BY _createdAt DESC LIMIT 50" This query
 * will be re-executed when matching entity is updated.
 */
private void listPosts() {
    // create a response handler that will receive the result or an error
    CloudCallbackHandler<List<CloudEntity>> handler =
            new CloudCallbackHandler<List<CloudEntity>>() {
                @Override
                public void onComplete(List<CloudEntity> results) {
                    mAnnounceTxt.setText(R.string.announce_success);
                    mPosts = results;
                    animateArrival();
                    updateGuestbookView();
                }

                @Override
                public void onError(IOException exception) {
                    mAnnounceTxt.setText(R.string.announce_fail);
                    animateArrival();
                    handleEndpointException(exception);
                }
            };

    // execute the query with the handler
    mProcessingFragment.getCloudBackend().listByKind(
            "Guestbook", CloudEntity.PROP_CREATED_AT, Order.DESC, 50,
            Scope.FUTURE_AND_PAST, handler);
}
 
开发者ID:pkill9,项目名称:POSproject,代码行数:32,代码来源:CookActivity.java

示例4: onContextItemSelected

import com.google.cloud.backend.core.CloudEntity; //导入依赖的package包/类
@Override
public boolean onContextItemSelected(MenuItem item) {
    AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo();
    CloudEntity selectedEntity = mPosts.get(info.position);
    if (!isCloudEntityPicture(selectedEntity)) {
        Toast.makeText(getBaseContext(), "This menu is not available with the item selected",
                Toast.LENGTH_SHORT).show();
        return false;
    }
    switch (item.getItemId()) {
        case R.id.transform_image:
            transformImage(selectedEntity);
            return true;
        default:
            return super.onContextItemSelected(item);
    }
}
 
开发者ID:googlesamples,项目名称:io2014-codelabs,代码行数:18,代码来源:GuestbookActivity.java

示例5: getAuthor

import com.google.cloud.backend.core.CloudEntity; //导入依赖的package包/类
/**
 * Gets the author field of the CloudEntity.
 *
 * @param post the CloudEntity
 * @return author string
 */
private String getAuthor(CloudEntity post) {
    if (post.getCreatedBy() != null) {
        return " " + post.getCreatedBy().replaceFirst("@.*", "");
    } else {
        return "<anonymous>";
    }
}
 
开发者ID:pkill9,项目名称:POSproject,代码行数:14,代码来源:PostAdapter.java

示例6: onBroadcastMessageReceived

import com.google.cloud.backend.core.CloudEntity; //导入依赖的package包/类
/**
 * Method called via OnListener in {@link CloudBackendFragment}.
 */
@Override
public void onBroadcastMessageReceived(List<CloudEntity> l) {
    for (CloudEntity e : l) {
        String message = (String) e.get(BROADCAST_PROP_MESSAGE);
        int duration = Integer.parseInt((String) e.get(BROADCAST_PROP_DURATION));
        Toast.makeText(this, message, duration).show();
        Log.i(Consts.TAG, "A message was recieved with content: " + message);
    }
}
 
开发者ID:pkill9,项目名称:POSproject,代码行数:13,代码来源:CookActivity.java

示例7: transformImage

import com.google.cloud.backend.core.CloudEntity; //导入依赖的package包/类
private void transformImage(CloudEntity selectedEntity) {
    String entityMessage = selectedEntity.get("message").toString();
    CloudCallbackHandler<BlobAccess> handlerForProcessImage = new CloudCallbackHandler<BlobAccess>() {
        @Override
        public void onComplete(final BlobAccess blobAccessResult) {
            Toast.makeText(getBaseContext(), "Uploading the transformed image", Toast.LENGTH_SHORT).show();
            String pictureMesage = BLOB_PICTURE_MESSAGE_PREFIX + BLOB_PICTURE_DELIMITER
                    + blobAccessResult.getAccessUrl();
            insertNewMessage(pictureMesage);
        }

        @Override
        public void onError(final IOException exception) {
            handleEndpointException(exception);
        }
    };

    BucketAndObjectName bucketAndObjectName = parsePictureMessageToBucketAndObject(entityMessage);
    CloudBackend.ImageTransformationParam param = new CloudBackend.ImageTransformationParam();
    param.bucketName = bucketAndObjectName.bucketName;
    param.objectName = bucketAndObjectName.objectName;
    param.accessModeForTransformedImage = "PUBLIC_READ";

    Toast.makeText(getBaseContext(), "Transforming the image", Toast.LENGTH_SHORT).show();
    findViewById(R.id.progress_horizontal).setVisibility(View.VISIBLE);
    mProcessingFragment.getCloudBackend().transformImage(param, handlerForProcessImage);
}
 
开发者ID:googlesamples,项目名称:io2014-codelabs,代码行数:28,代码来源:GuestbookActivity.java

示例8: onBroadcastMessageReceived

import com.google.cloud.backend.core.CloudEntity; //导入依赖的package包/类
/**
 * Method called via OnListener in {@link com.google.cloud.backend.core.CloudBackendFragment}.
 */
@Override
public void onBroadcastMessageReceived(List<CloudEntity> l) {
    for (CloudEntity e : l) {
        String message = (String) e.get(BROADCAST_PROP_MESSAGE);
        int duration = Integer.parseInt((String) e.get(BROADCAST_PROP_DURATION));
        Toast.makeText(this, message, duration).show();
        Log.i(Consts.TAG, "A message was recieved with content: " + message);
    }
}
 
开发者ID:googlesamples,项目名称:io2014-codelabs,代码行数:13,代码来源:GuestbookActivity.java

示例9: insertNewMessage

import com.google.cloud.backend.core.CloudEntity; //导入依赖的package包/类
private void insertNewMessage(String message) {
    // create a CloudEntity with the new post
    CloudEntity newPost = new CloudEntity("Guestbook");
    newPost.put("message", message);

    // create a response handler that will receive the result or an error
    CloudCallbackHandler<CloudEntity> handler = new CloudCallbackHandler<CloudEntity>() {
        @Override
        public void onComplete(final CloudEntity result) {
            mPosts.add(0, result);
            updateGuestbookView();
            mMessageTxt.setText("");
            mMessageTxt.setEnabled(true);
            mSendBtn.setEnabled(true);
            findViewById(R.id.progress_horizontal).setVisibility(View.GONE);
        }

        @Override
        public void onError(final IOException exception) {
            handleEndpointException(exception);
        }
    };

    findViewById(R.id.progress_horizontal).setVisibility(View.VISIBLE);
    // execute the insertion with the handler
    mProcessingFragment.getCloudBackend().insert(newPost, handler);
    mMessageTxt.setEnabled(false);
    mSendBtn.setEnabled(false);
}
 
开发者ID:googlesamples,项目名称:io2014-codelabs,代码行数:30,代码来源:GuestbookActivity.java

示例10: onSendButtonPressed

import com.google.cloud.backend.core.CloudEntity; //导入依赖的package包/类
/**
 * onClick method.
 */
public void onSendButtonPressed(View view) {

    // create a CloudEntity with the new post
    CloudEntity newPost = new CloudEntity("Guestbook");
    newPost.put("message", mMessageTxt.getText().toString());

    // create a response handler that will receive the result or an error
    CloudCallbackHandler<CloudEntity> handler = new CloudCallbackHandler<CloudEntity>() {
        @Override
        public void onComplete(final CloudEntity result) {
            mPosts.add(0, result);
            updateGuestbookView();
            mMessageTxt.setText("");
            mMessageTxt.setEnabled(true);
            mSendBtn.setEnabled(true);
        }

        @Override
        public void onError(final IOException exception) {
            handleEndpointException(exception);
        }
    };

    // execute the insertion with the handler
    mProcessingFragment.getCloudBackend().insert(newPost, handler);
    mMessageTxt.setEnabled(false);
    mSendBtn.setEnabled(false);
}
 
开发者ID:RexYing,项目名称:healthy-lifestyle,代码行数:32,代码来源:MainActivity.java

示例11: isCloudEntityPicture

import com.google.cloud.backend.core.CloudEntity; //导入依赖的package包/类
private boolean isCloudEntityPicture(CloudEntity e) {
    String entityMessage = e.get("message").toString();
    return entityMessage.startsWith(GuestbookActivity.BLOB_PICTURE_MESSAGE_PREFIX +
            GuestbookActivity.BLOB_PICTURE_DELIMITER);
}
 
开发者ID:googlesamples,项目名称:io2014-codelabs,代码行数:6,代码来源:GuestbookActivity.java

示例12: PostAdapter

import com.google.cloud.backend.core.CloudEntity; //导入依赖的package包/类
/**
 * Creates a new instance of this adapter.
 *
 * @param context
 * @param textViewResourceId
 * @param objects
 */

public PostAdapter(Context context, int textViewResourceId, List<CloudEntity> objects) {
    super(context, textViewResourceId, objects);
    mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
 
开发者ID:pkill9,项目名称:POSproject,代码行数:13,代码来源:PostAdapter.java

示例13: PostAdapter

import com.google.cloud.backend.core.CloudEntity; //导入依赖的package包/类
/**
 * Creates a new instance of this adapter.
 *
 * @param context
 * @param textViewResourceId
 * @param objects
 */
public PostAdapter(Context context, int textViewResourceId, List<CloudEntity> objects) {
    super(context, textViewResourceId, objects);
    mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
 
开发者ID:googlesamples,项目名称:io2014-codelabs,代码行数:12,代码来源:PostAdapter.java


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