コード例 #1
0
  protected void onCreate(Bundle savedInstanceState) {
    startFullScreen();

    super.onCreate(savedInstanceState);

    setContentView(R.layout.mobicom_image_full_screen);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    AttachmentView mediaImageViewView = (AttachmentView) findViewById(R.id.full_screen_image);
    ProgressBar progressBar = (ProgressBar) findViewById(R.id.full_screen_progress_bar);
    mediaImageViewView.setProressBar(progressBar);
    String messageJson = getIntent().getStringExtra(MobiComKitConstants.MESSAGE_JSON_INTENT);

    if (!TextUtils.isEmpty(messageJson)) {
      message = (Message) GsonUtils.getObjectFromJson(messageJson, Message.class);
    }

    if (message != null && message.getFilePaths() != null && !message.getFilePaths().isEmpty()) {
      mediaImageViewView.setMessage(message);
    }
  }
コード例 #2
0
 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
   int i = item.getItemId();
   if (i == R.id.shareOptions) {
     Intent shareIntent = new Intent();
     shareIntent.setAction(Intent.ACTION_SEND);
     Uri uri = Uri.fromFile(new File(message.getFilePaths().get(0)));
     shareIntent.putExtra(Intent.EXTRA_STREAM, uri);
     shareIntent.setType(FileUtils.getMimeType(new File(message.getFilePaths().get(0))));
     startActivity(Intent.createChooser(shareIntent, ""));
   } else if (i == R.id.forward) {
     Intent intent = new Intent();
     intent.putExtra(
         MobiComKitConstants.MESSAGE_JSON_INTENT,
         GsonUtils.getJsonFromObject(message, Message.class));
     setResult(RESULT_OK, intent);
     this.finish();
     return true;
   }
   return super.onOptionsItemSelected(item);
 }