Android Open Source - GradleAndroid-App Result Activity






From Project

Back to project page GradleAndroid-App.

License

The source code is released under:

Apache License

If you think the Android project GradleAndroid-App listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.android.app.function.qrcode.activity;
//  www  . ja  va 2 s .  c  om
import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.util.TypedValue;
import android.widget.ImageView;
import android.widget.LinearLayout.LayoutParams;
import android.widget.TextView;

import com.android.app.function.R;
import com.android.app.function.qrcode.decode.DecodeThread;


public class ResultActivity extends Activity {

  private ImageView mResultImage;
  private TextView mResultText;

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

    Bundle extras = getIntent().getExtras();

    mResultImage = (ImageView) findViewById(R.id.result_image);
    mResultText = (TextView) findViewById(R.id.result_text);

    if (null != extras) {
      int width = extras.getInt("width");
      int height = extras.getInt("height");

      LayoutParams lps = new LayoutParams(width, height);
      lps.topMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 30, getResources().getDisplayMetrics());
      lps.leftMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 20, getResources().getDisplayMetrics());
      lps.rightMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 20, getResources().getDisplayMetrics());
      
      mResultImage.setLayoutParams(lps);

      String result = extras.getString("result");
      mResultText.setText(result);

      Bitmap barcode = null;
      byte[] compressedBitmap = extras.getByteArray(DecodeThread.BARCODE_BITMAP);
      if (compressedBitmap != null) {
        barcode = BitmapFactory.decodeByteArray(compressedBitmap, 0, compressedBitmap.length, null);
        // Mutable copy:
        barcode = barcode.copy(Bitmap.Config.RGB_565, true);
      }

      mResultImage.setImageBitmap(barcode);
    }
  }
}




Java Source Code List

com.android.app.AbstractListActivity.java
com.android.app.MainActivity.java
com.android.app.custom.CustomActivity.java
com.android.app.custom.activity.Activity.java
com.android.app.function.FunctionActivity.java
com.android.app.function.qrcode.activity.CaptureActivity.java
com.android.app.function.qrcode.activity.ResultActivity.java
com.android.app.function.qrcode.camera.AutoFocusManager.java
com.android.app.function.qrcode.camera.CameraConfigurationManager.java
com.android.app.function.qrcode.camera.CameraManager.java
com.android.app.function.qrcode.camera.PreviewCallback.java
com.android.app.function.qrcode.camera.open.OpenCameraInterface.java
com.android.app.function.qrcode.decode.DecodeFormatManager.java
com.android.app.function.qrcode.decode.DecodeHandler.java
com.android.app.function.qrcode.decode.DecodeThread.java
com.android.app.function.qrcode.utils.BeepManager.java
com.android.app.function.qrcode.utils.CaptureActivityHandler.java
com.android.app.function.qrcode.utils.InactivityTimer.java