正在查看: St.John's v1.0.9 应用的 SchoolStoreCatItemDetailActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: St.John's v1.0.9 应用的 SchoolStoreCatItemDetailActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.mcb.stjohnsemschool.activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Typeface;
import android.os.Bundle;
import android.view.MenuItem;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import com.bumptech.glide.Glide;
import com.google.firebase.analytics.FirebaseAnalytics;
import com.mcb.stjohnsemschool.utils.Utility;
import java.text.DecimalFormat;
public class SchoolStoreCatItemDetailActivity extends AppCompatActivity {
private String catName;
private Context context;
private DecimalFormat df;
private Typeface fontFace;
private String imagePath;
private String itemName;
private TextView mCatName;
private TextView mGST;
private ImageView mImage;
private TextView mItemName;
private TextView mMRP;
private TextView mPrice;
private double mrp;
private double price;
private int quantity;
private SharedPreferences sharedPreferences;
private boolean showGST;
private boolean showItemPrice;
private boolean showMRP;
private String taxName;
private int taxType;
private double taxValue;
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);
setContentView(R.layout.activity_school_store_cat_item_details);
this.context = getApplicationContext();
getSupportActionBar().setTitle("Item Details");
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowTitleEnabled(true);
getSupportActionBar().setHomeButtonEnabled(true);
this.fontFace = Utility.getFontStyle(this);
SharedPreferences sharedPrefs = Utility.getSharedPrefs(this.context);
this.sharedPreferences = sharedPrefs;
this.showMRP = sharedPrefs.getBoolean("ShowMRP", false);
this.showItemPrice = this.sharedPreferences.getBoolean("ShowItemPrice", false);
this.showGST = this.sharedPreferences.getBoolean("ShowGST", false);
this.df = new DecimalFormat("##.##");
initializations();
}
private void initializations() {
this.mCatName = (TextView) findViewById(R.id.txv_sub_cat_name);
this.mItemName = (TextView) findViewById(R.id.txv_item_name);
this.mPrice = (TextView) findViewById(R.id.txv_item_price);
this.mMRP = (TextView) findViewById(R.id.txv_mrp);
this.mGST = (TextView) findViewById(R.id.txv_gst);
this.mImage = (ImageView) findViewById(R.id.img_item);
this.mCatName.setTypeface(this.fontFace);
this.mItemName.setTypeface(this.fontFace, 1);
this.mPrice.setTypeface(this.fontFace, 1);
this.mMRP.setTypeface(this.fontFace, 1);
this.mGST.setTypeface(this.fontFace);
this.mMRP.setPaintFlags(16);
Bundle extras = getIntent().getExtras();
this.imagePath = extras.getString("ImagePath", this.imagePath);
this.itemName = extras.getString("ItemName", this.itemName);
this.catName = extras.getString("SchoolStoreItemCategoryName", this.catName);
this.price = extras.getDouble("AssignedItemPrice", this.price);
this.mrp = extras.getDouble("Mrp", this.mrp);
this.taxValue = extras.getDouble("TaxValue", this.taxValue);
this.taxType = extras.getInt("TaxType", this.taxType);
this.quantity = extras.getInt("AssignedItemQuantity", this.quantity);
this.taxName = extras.getString("TaxName", this.taxName);
this.mImage.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(SchoolStoreCatItemDetailActivity.this.context, (Class<?>) ImageZoomInAndOutActivity.class);
intent.putExtra("ImagePath", SchoolStoreCatItemDetailActivity.this.imagePath);
SchoolStoreCatItemDetailActivity.this.startActivity(intent);
}
});
String str = this.imagePath;
if (str != null && str.length() > 0 && !this.imagePath.equalsIgnoreCase("null")) {
Glide.with(this).load(this.imagePath).into(this.mImage);
} else {
this.mImage.setImageResource(R.drawable.noimage);
}
String str2 = this.catName;
if (str2 != null && str2.length() > 0 && !this.catName.equalsIgnoreCase("null")) {
this.mCatName.setText(this.catName);
this.mCatName.setVisibility(0);
} else {
this.mCatName.setVisibility(8);
}
String str3 = this.itemName;
if (str3 != null && str3.length() > 0 && !this.itemName.equalsIgnoreCase("null")) {
this.mItemName.setText(this.itemName);
this.mItemName.setVisibility(0);
} else {
this.mItemName.setVisibility(8);
}
double d = this.price * this.quantity;
int i = this.taxType;
double d2 = 0.0d;
if (i != 0) {
if (i == 1) {
double d3 = this.taxValue;
d2 = d - (d3 > 0.0d ? (d / (d3 + 100.0d)) * 100.0d : d);
} else {
double d4 = this.taxValue;
if (d4 > 0.0d) {
d2 = (d * d4) / 100.0d;
}
}
}
this.mPrice.setText("Rs." + this.df.format(this.price));
this.mMRP.setText("Rs." + this.df.format(this.mrp));
TextView textView = this.mGST;
StringBuilder sb = new StringBuilder();
sb.append(Utility.isStringHasValue(this.taxName) ? this.taxName : "GST");
sb.append(": Rs.");
sb.append(this.df.format(d2));
textView.setText(sb.toString());
if (!this.showMRP) {
this.mMRP.setVisibility(8);
} else if (this.mrp > this.price) {
this.mMRP.setVisibility(0);
} else {
this.mMRP.setVisibility(8);
}
if (this.showItemPrice) {
this.mPrice.setVisibility(0);
if (this.showGST) {
this.mGST.setVisibility(0);
return;
} else {
this.mGST.setVisibility(8);
return;
}
}
this.mPrice.setVisibility(8);
this.mGST.setVisibility(8);
}
public boolean onOptionsItemSelected(MenuItem menuItem) {
if (menuItem.getItemId() == 16908332) {
onBackPressed();
return true;
}
return super.onOptionsItemSelected(menuItem);
}
protected void onResume() {
String string = getSharedPreferences("", 0).getString("usernamekey", "");
Bundle bundle = new Bundle();
bundle.putString("user_name", string);
FirebaseAnalytics.getInstance(this).logEvent("PAGE_STORE_CATEGORY_ITEM_DETAILS", bundle);
super.onResume();
}
}