analysis: full official-app reverse artifacts (jadx sources, ghidra libcxsdk decomp, authoritative protocol conclusions) + docs
This commit is contained in:
@@ -0,0 +1,252 @@
|
||||
package cn.com.magnity.magnitycx;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.view.ContextMenu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
import cn.com.magnity.magnitycx.sdk.MagParameter;
|
||||
import cn.com.magnity.magnitycx.sdk.UsbConnection;
|
||||
import com.baidu.mobstat.StatService;
|
||||
import com.google.zxing.BinaryBitmap;
|
||||
import com.google.zxing.ChecksumException;
|
||||
import com.google.zxing.FormatException;
|
||||
import com.google.zxing.NotFoundException;
|
||||
import com.google.zxing.RGBLuminanceSource;
|
||||
import com.google.zxing.Result;
|
||||
import com.google.zxing.common.HybridBinarizer;
|
||||
import com.google.zxing.qrcode.QRCodeReader;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class AboutAboutActivity extends AppCompatActivity {
|
||||
private ImageView imageView_;
|
||||
private PackageInfo packInfo_;
|
||||
private TextView tvCompanyCaption_;
|
||||
private TextView tvCompany_;
|
||||
private TextView tvFWVersionCaption_;
|
||||
private TextView tvFWVersion_;
|
||||
private TextView tvHWVersionCaption_;
|
||||
private TextView tvHWVersion_;
|
||||
private TextView tvProductTypeCaption_;
|
||||
private TextView tvProductType_;
|
||||
private TextView tvRightCaption_;
|
||||
private TextView tvRight_;
|
||||
private TextView tvSWVersionCaption_;
|
||||
private TextView tvSWVersion_;
|
||||
|
||||
@Override // android.support.v7.app.AppCompatActivity, android.support.v4.app.FragmentActivity, android.support.v4.app.BaseFragmentActivityGingerbread, android.app.Activity
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_about_about);
|
||||
ActionBar actionBar = getSupportActionBar();
|
||||
actionBar.setHomeButtonEnabled(true);
|
||||
actionBar.setDisplayHomeAsUpEnabled(true);
|
||||
setTitle(R.string.settingsAboutAbout);
|
||||
PackageManager packageManager = getPackageManager();
|
||||
try {
|
||||
this.packInfo_ = packageManager.getPackageInfo(getPackageName(), 0);
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
this.packInfo_ = null;
|
||||
}
|
||||
this.tvProductTypeCaption_ = (TextView) findViewById(R.id.id_text1);
|
||||
this.tvProductTypeCaption_.setText(R.string.productType);
|
||||
this.tvProductType_ = (TextView) findViewById(R.id.id_text2);
|
||||
if (UsbConnection.getInstance().isConnected()) {
|
||||
switch (MagApplication.magParameter.basePara1.devType) {
|
||||
case 0:
|
||||
this.tvProductType_.setText(R.string.c1);
|
||||
break;
|
||||
case 1:
|
||||
this.tvProductType_.setText(R.string.c3);
|
||||
break;
|
||||
case 2:
|
||||
this.tvProductType_.setText(R.string.c3p);
|
||||
break;
|
||||
case 3:
|
||||
this.tvProductType_.setText(R.string.core160);
|
||||
break;
|
||||
case 4:
|
||||
default:
|
||||
this.tvProductType_.setText("");
|
||||
break;
|
||||
case 5:
|
||||
this.tvProductType_.setText(R.string.c1pro);
|
||||
break;
|
||||
case 6:
|
||||
this.tvProductType_.setText(R.string.c1prolite);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
this.tvProductType_.setText("");
|
||||
}
|
||||
View view = findViewById(R.id.id_swVersion);
|
||||
this.tvSWVersionCaption_ = (TextView) view.findViewById(R.id.id_text1);
|
||||
this.tvSWVersionCaption_.setText(R.string.swVersion);
|
||||
this.tvSWVersion_ = (TextView) view.findViewById(R.id.id_text2);
|
||||
if (this.packInfo_ != null) {
|
||||
this.tvSWVersion_.setText(this.packInfo_.versionName);
|
||||
}
|
||||
View view2 = findViewById(R.id.id_right);
|
||||
this.tvRightCaption_ = (TextView) view2.findViewById(R.id.id_text1);
|
||||
this.tvRightCaption_.setText(R.string.right);
|
||||
this.tvRight_ = (TextView) view2.findViewById(R.id.id_text2);
|
||||
this.tvRight_.setText(R.string.juge);
|
||||
View view3 = findViewById(R.id.id_fwVersion);
|
||||
this.tvFWVersionCaption_ = (TextView) view3.findViewById(R.id.id_text1);
|
||||
this.tvFWVersionCaption_.setText(R.string.fwVersion);
|
||||
this.tvFWVersion_ = (TextView) view3.findViewById(R.id.id_text2);
|
||||
if (UsbConnection.getInstance().isConnected()) {
|
||||
this.tvFWVersion_.setText(Integer.toString(MagApplication.magParameter.basePara1.swVersion));
|
||||
} else {
|
||||
this.tvFWVersion_.setText("");
|
||||
}
|
||||
View view4 = findViewById(R.id.id_hwVersion);
|
||||
this.tvHWVersionCaption_ = (TextView) view4.findViewById(R.id.id_text1);
|
||||
this.tvHWVersionCaption_.setText(R.string.hwVersion);
|
||||
this.tvHWVersion_ = (TextView) view4.findViewById(R.id.id_text2);
|
||||
if (UsbConnection.getInstance().isConnected()) {
|
||||
this.tvHWVersion_.setText(Integer.toString(MagApplication.magParameter.basePara1.hwVersion));
|
||||
} else {
|
||||
this.tvHWVersion_.setText("");
|
||||
}
|
||||
View view5 = findViewById(R.id.id_company);
|
||||
this.tvCompanyCaption_ = (TextView) view5.findViewById(R.id.id_text1);
|
||||
this.tvCompanyCaption_.setText(R.string.company);
|
||||
this.tvCompany_ = (TextView) view5.findViewById(R.id.id_text2);
|
||||
this.tvCompany_.setText("http://www.magnity.com.cn");
|
||||
this.tvCompany_.setTextColor(-12211576);
|
||||
this.tvCompany_.setPaintFlags(8);
|
||||
view5.setOnClickListener(new MagClickListener());
|
||||
this.imageView_ = (ImageView) findViewById(R.id.id_barcodeView);
|
||||
registerForContextMenu(this.imageView_);
|
||||
}
|
||||
|
||||
@Override // android.support.v7.app.AppCompatActivity, android.support.v4.app.FragmentActivity, android.app.Activity
|
||||
protected void onDestroy() {
|
||||
unregisterForContextMenu(this.imageView_);
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override // android.app.Activity, android.view.View.OnCreateContextMenuListener
|
||||
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
|
||||
super.onCreateContextMenu(menu, v, menuInfo);
|
||||
menu.add(0, 2, 1, R.string.menu_read_barcode);
|
||||
}
|
||||
|
||||
@Override // android.app.Activity
|
||||
public boolean onContextItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case 1:
|
||||
shareOnlineImage(this.imageView_);
|
||||
break;
|
||||
case 2:
|
||||
StatService.onEvent(getApplicationContext(), MagParameter.EVENT_ENTER_WECHAT_STORE_ID, MagParameter.EVENT_ENTER_WECHAT_STORE);
|
||||
readBarcode(this.imageView_);
|
||||
break;
|
||||
}
|
||||
return super.onContextItemSelected(item);
|
||||
}
|
||||
|
||||
@Override // android.support.v4.app.FragmentActivity, android.app.Activity
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
StatService.onPause(this);
|
||||
}
|
||||
|
||||
@Override // android.support.v7.app.AppCompatActivity, android.support.v4.app.FragmentActivity, android.app.Activity
|
||||
protected void onPostResume() {
|
||||
super.onPostResume();
|
||||
StatService.onResume(this);
|
||||
}
|
||||
|
||||
private void shareOnlineImage(ImageView v) {
|
||||
Bitmap bmp = ((BitmapDrawable) v.getDrawable()).getBitmap();
|
||||
try {
|
||||
File file = new File(getExternalFilesDir("temp"), "barcode.jpg");
|
||||
try {
|
||||
FileOutputStream out = new FileOutputStream(file);
|
||||
bmp.compress(Bitmap.CompressFormat.JPEG, 100, out);
|
||||
out.close();
|
||||
if (file.exists()) {
|
||||
Intent intent = new Intent("android.intent.action.SEND");
|
||||
intent.putExtra("android.intent.extra.STREAM", Uri.fromFile(file));
|
||||
intent.addFlags(1);
|
||||
intent.setType("image/*");
|
||||
startActivity(Intent.createChooser(intent, getResources().getString(R.string.menu_share_barcode)));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
} catch (Exception e2) {
|
||||
}
|
||||
}
|
||||
|
||||
private void readBarcode(ImageView v) {
|
||||
Result re = null;
|
||||
try {
|
||||
Bitmap bmp = ((BitmapDrawable) v.getDrawable()).getBitmap();
|
||||
int width = bmp.getWidth();
|
||||
int height = bmp.getHeight();
|
||||
int[] data = new int[width * height];
|
||||
bmp.getPixels(data, 0, width, 0, 0, width, height);
|
||||
RGBLuminanceSource source = new RGBLuminanceSource(width, height, data);
|
||||
BinaryBitmap bitmap1 = new BinaryBitmap(new HybridBinarizer(source));
|
||||
QRCodeReader reader = new QRCodeReader();
|
||||
try {
|
||||
try {
|
||||
re = reader.decode(bitmap1);
|
||||
} catch (NotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} catch (ChecksumException e2) {
|
||||
e2.printStackTrace();
|
||||
} catch (FormatException e3) {
|
||||
e3.printStackTrace();
|
||||
}
|
||||
if (re == null) {
|
||||
Toast.makeText(this, R.string.tip_barcode_fail, 0).show();
|
||||
} else {
|
||||
Toast.makeText(this, String.format(getResources().getString(R.string.tip_goto_store), re.getText()), 0).show();
|
||||
StoreActivity.actionStart(this, re.getText());
|
||||
}
|
||||
} catch (Exception e4) {
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.app.Activity
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.home:
|
||||
super.onBackPressed();
|
||||
break;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
private class MagClickListener implements View.OnClickListener {
|
||||
private MagClickListener() {
|
||||
}
|
||||
|
||||
@Override // android.view.View.OnClickListener
|
||||
public void onClick(View v) {
|
||||
switch (v.getId()) {
|
||||
case R.id.id_company /* 2131624064 */:
|
||||
Uri uri = Uri.parse("http://www.magnity.com.cn");
|
||||
Intent intent = new Intent("android.intent.action.VIEW", uri);
|
||||
AboutAboutActivity.this.startActivity(intent);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user