package com.maxiee.heartbeat.ui;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.widget.TextView;

import com.maxiee.heartbeat.R;
import com.maxiee.heartbeat.model.Crash;

/**
 * Created by maxiee on 15-7-11.
 */
public class CrashDetailActivity extends AppCompatActivity {

    private Toolbar mToolbar;
    private TextView mTvCrash;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_crash_detail);

        mToolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(mToolbar);
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);

        mTvCrash = (TextView) findViewById(R.id.tv_crash);

        Intent intent = getIntent();
        String crash = intent.getStringExtra(Crash.LOG);
        mTvCrash.setText(crash);

        setTitle(getString(R.string.settings_crash));
    }
}

@@ -27,16 +27,90 @@
 at.ui;%0A%0A
+import android.content.ClipData;%0Aimport android.content.ClipboardManager;%0A
 import a
@@ -350,16 +350,72 @@
 oolbar;%0A
+import android.view.Menu;%0Aimport android.view.MenuItem;%0A
 import a
@@ -437,16 +437,45 @@
 extView;
+%0Aimport android.widget.Toast;
 %0A%0Aimport
@@ -704,16 +704,43 @@
 TvCrash;
+%0A    private String mCrash;
 %0A%0A    @O
@@ -1174,16 +1174,10 @@
     
-String c
+mC
 rash
@@ -1238,17 +1238,18 @@
 setText(
-c
+mC
 rash);%0A%0A
@@ -1307,11 +1307,999 @@
 );%0A    %7D
+%0A%0A    @Override%0A    public boolean onCreateOptionsMenu(Menu menu) %7B%0A        getMenuInflater().inflate(R.menu.menu_crash_detail, menu);%0A        return true;%0A    %7D%0A%0A    @Override%0A    public boolean onOptionsItemSelected(MenuItem item) %7B%0A        int id = item.getItemId();%0A        if(id == R.id.clip_board) %7B%0A            ClipboardManager clipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);%0A            ClipData clip = ClipData.newPlainText(%22crash report%22, mCrash);%0A            clipboard.setPrimaryClip(clip);%0A            Toast.makeText(CrashDetailActivity.this, getString(R.string.copy_finished), Toast.LENGTH_LONG).show();%0A        %7D%0A        if(id == R.id.share) %7B%0A            Intent sendIntent = new Intent();%0A            sendIntent.setAction(Intent.ACTION_SEND);%0A            sendIntent.putExtra(Intent.EXTRA_TEXT, mCrash);%0A            sendIntent.setType(%22text/plain%22);%0A            startActivity(sendIntent);%0A        %7D%0A        return super.onOptionsItemSelected(item);%0A    %7D
 %0A%7D%0A

copy to clipboard and share text.