diff options
| author | Ralf Kistner <ralf@embarkmobile.com> | 2015-05-03 17:36:36 +0300 |
|---|---|---|
| committer | Ralf Kistner <ralf@embarkmobile.com> | 2015-05-03 19:05:06 +0300 |
| commit | c74750c3e6a3937408fb54cbfcd7d069f5e056e3 (patch) | |
| tree | 9ab017db62d75a8d8afb806cea118f68962b1dc8 /sample/src/main/java/example/zxing/ToolbarCaptureActivity.java | |
| parent | 0bc95038bb5ce1c3863aa92afb9860662aa86d07 (diff) | |
| download | zxing-android-embedded-c74750c3e6a3937408fb54cbfcd7d069f5e056e3.tar.xz | |
Sample with AppCompat/Toolbar Activity.
Diffstat (limited to 'sample/src/main/java/example/zxing/ToolbarCaptureActivity.java')
| -rw-r--r-- | sample/src/main/java/example/zxing/ToolbarCaptureActivity.java | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/sample/src/main/java/example/zxing/ToolbarCaptureActivity.java b/sample/src/main/java/example/zxing/ToolbarCaptureActivity.java new file mode 100644 index 00000000..f4dee3ee --- /dev/null +++ b/sample/src/main/java/example/zxing/ToolbarCaptureActivity.java @@ -0,0 +1,57 @@ +package example.zxing; + +import android.os.Bundle; +import android.support.v7.app.ActionBarActivity; +import android.support.v7.widget.Toolbar; + +import com.journeyapps.barcodescanner.CaptureManager; +import com.journeyapps.barcodescanner.DefaultBarcodeScannerView; + +/** + * + */ +public class ToolbarCaptureActivity extends ActionBarActivity { + private CaptureManager capture; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + setContentView(R.layout.capture_appcompat); + Toolbar toolbar = (Toolbar) findViewById(R.id.my_awesome_toolbar); + toolbar.setTitle("Scan Barcode"); + setSupportActionBar(toolbar); + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + + + DefaultBarcodeScannerView view = (DefaultBarcodeScannerView)findViewById(R.id.zxing_barcode_scanner); + + capture = new CaptureManager(this, view); + capture.initializeFromIntent(getIntent(), savedInstanceState); + capture.decode(); + } + + @Override + protected void onResume() { + super.onResume(); + capture.onResume(); + } + + @Override + protected void onPause() { + super.onPause(); + capture.onPause(); + } + + @Override + protected void onDestroy() { + super.onDestroy(); + capture.onDestroy(); + } + + @Override + protected void onSaveInstanceState(Bundle outState) { + super.onSaveInstanceState(outState); + capture.onSaveInstanceState(outState); + } +} |
