MBBD Trace v1.0版本的 MD5 值为:f0273367d111799d70c685af03877187
以下内容为反编译后的 BloodJannatActivity.java 源代码,内容仅作参考
package com.bipul.trace;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.Uri;
import android.os.Bundle;
import android.util.SparseBooleanArray;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import com.bipul.trace.RequestNetwork;
import com.bumptech.glide.Glide;
import com.google.firebase.FirebaseApp;
import com.google.firebase.database.ChildEventListener;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.GenericTypeIndicator;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import de.hdodenhof.circleimageview.CircleImageView;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Random;
public class BloodJannatActivity extends AppCompatActivity {
private ChildEventListener _profiles_child_listener;
private RequestNetwork.RequestListener _rq_request_listener;
private SharedPreferences b;
private AlertDialog.Builder d;
private ImageView imageview1;
private ImageView imageview2;
private ImageView imageview3;
private LinearLayout linear2;
private ListView listview1;
private LinearLayout morebtn;
private RequestNetwork rq;
private LinearLayout searchbtn;
private LinearLayout statusbtn;
private TextView textview21;
private TextView textview22;
private FirebaseDatabase _firebase = FirebaseDatabase.getInstance();
private double n = 0.0d;
private double length = 0.0d;
private ArrayList<HashMap<String, Object>> m = new ArrayList<>();
private DatabaseReference profiles = this._firebase.getReference("profiles");
private Intent i = new Intent();
private Intent ii = new Intent();
@Override
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
setContentView(R.layout.blood_jannat);
initialize(bundle);
FirebaseApp.initializeApp(this);
if (ContextCompat.checkSelfPermission(this, "android.permission.CALL_PHONE") != -1) {
initializeLogic();
} else {
ActivityCompat.requestPermissions(this, new String[]{"android.permission.CALL_PHONE"}, 1000);
}
}
@Override
public void onRequestPermissionsResult(int i, String[] strArr, int[] iArr) {
super.onRequestPermissionsResult(i, strArr, iArr);
if (i == 1000) {
initializeLogic();
}
}
private void initialize(Bundle bundle) {
this.linear2 = (LinearLayout) findViewById(R.id.linear2);
this.listview1 = (ListView) findViewById(R.id.listview1);
this.textview22 = (TextView) findViewById(R.id.textview22);
this.statusbtn = (LinearLayout) findViewById(R.id.statusbtn);
this.textview21 = (TextView) findViewById(R.id.textview21);
this.searchbtn = (LinearLayout) findViewById(R.id.searchbtn);
this.morebtn = (LinearLayout) findViewById(R.id.morebtn);
this.imageview3 = (ImageView) findViewById(R.id.imageview3);
this.imageview1 = (ImageView) findViewById(R.id.imageview1);
this.imageview2 = (ImageView) findViewById(R.id.imageview2);
this.rq = new RequestNetwork(this);
this.b = getSharedPreferences("bipul", 0);
this.d = new AlertDialog.Builder(this);
this.listview1.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, final int i, long j) {
BloodJannatActivity.this.d.setTitle("Blood Donor");
BloodJannatActivity.this.d.setIcon(R.drawable.r67_2);
BloodJannatActivity.this.d.setMessage("Name: ".concat(((HashMap) BloodJannatActivity.this.m.get(i)).get("name").toString().concat("\nPhone: ".concat(((HashMap) BloodJannatActivity.this.m.get(i)).get("mobile").toString().concat("\nBlood Group: ".concat(((HashMap) BloodJannatActivity.this.m.get(i)).get("bloodType").toString().concat("\nAddress: ".concat(((HashMap) BloodJannatActivity.this.m.get(i)).get("address").toString().concat("\n------\nDon't distrub him, or Don't try to harassment. otherwise we can report to police.")))))))));
BloodJannatActivity.this.d.setPositiveButton("Call Now", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i2) {
BloodJannatActivity.this.ii.setAction("android.intent.action.CALL");
BloodJannatActivity.this.ii.setData(Uri.parse("tel:".concat(((HashMap) BloodJannatActivity.this.m.get(i)).get("mobile").toString())));
BloodJannatActivity.this.startActivity(BloodJannatActivity.this.ii);
}
});
BloodJannatActivity.this.d.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i2) {
}
});
BloodJannatActivity.this.d.create().show();
}
});
this.statusbtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
BloodJannatActivity.this.finish();
}
});
this.searchbtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
BloodJannatActivity.this.i.setClass(BloodJannatActivity.this.getApplicationContext(), SearchActivity.class);
BloodJannatActivity.this.startActivity(BloodJannatActivity.this.i);
}
});
this.morebtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
BloodJannatActivity.this.i.setClass(BloodJannatActivity.this.getApplicationContext(), MoreActivity.class);
BloodJannatActivity.this.startActivity(BloodJannatActivity.this.i);
}
});
this._profiles_child_listener = new ChildEventListener() {
@Override
public void onChildAdded(DataSnapshot dataSnapshot, String str) {
GenericTypeIndicator<HashMap<String, Object>> genericTypeIndicator = new GenericTypeIndicator<HashMap<String, Object>>() {
};
dataSnapshot.getKey();
HashMap hashMap = (HashMap) dataSnapshot.getValue(genericTypeIndicator);
}
@Override
public void onChildChanged(DataSnapshot dataSnapshot, String str) {
GenericTypeIndicator<HashMap<String, Object>> genericTypeIndicator = new GenericTypeIndicator<HashMap<String, Object>>() {
};
dataSnapshot.getKey();
HashMap hashMap = (HashMap) dataSnapshot.getValue(genericTypeIndicator);
}
@Override
public void onChildMoved(DataSnapshot dataSnapshot, String str) {
}
@Override
public void onChildRemoved(DataSnapshot dataSnapshot) {
GenericTypeIndicator<HashMap<String, Object>> genericTypeIndicator = new GenericTypeIndicator<HashMap<String, Object>>() {
};
dataSnapshot.getKey();
HashMap hashMap = (HashMap) dataSnapshot.getValue(genericTypeIndicator);
}
@Override
public void onCancelled(DatabaseError databaseError) {
databaseError.getCode();
databaseError.getMessage();
}
};
this.profiles.addChildEventListener(this._profiles_child_listener);
this._rq_request_listener = new RequestNetwork.RequestListener() {
@Override
public void onResponse(String str, String str2, HashMap<String, Object> hashMap) {
BloodJannatActivity.this.m = (ArrayList) new Gson().fromJson(str2, new TypeToken<ArrayList<HashMap<String, Object>>>() {
}.getType());
BloodJannatActivity.this.b.edit().putString("blood", str2).commit();
BloodJannatActivity.this.listview1.setAdapter((ListAdapter) new Listview1Adapter(BloodJannatActivity.this.m));
((BaseAdapter) BloodJannatActivity.this.listview1.getAdapter()).notifyDataSetChanged();
}
@Override
public void onErrorResponse(String str, String str2) {
if (!BloodJannatActivity.this.b.getString("blood", "").equals("jannat")) {
BloodJannatActivity.this.m = (ArrayList) new Gson().fromJson(BloodJannatActivity.this.b.getString("blood", ""), new TypeToken<ArrayList<HashMap<String, Object>>>() {
}.getType());
BloodJannatActivity.this.listview1.setAdapter((ListAdapter) new Listview1Adapter(BloodJannatActivity.this.m));
((BaseAdapter) BloodJannatActivity.this.listview1.getAdapter()).notifyDataSetChanged();
}
}
};
}
private void initializeLogic() {
this.rq.startRequestNetwork("GET", "https://opensheet.elk.sh/1hpbgr9-t-5TO3xYrQboRNtBLV8TN1UXVqGHdLBq41R4/blood", "bipul", this._rq_request_listener);
}
public class Listview1Adapter extends BaseAdapter {
ArrayList<HashMap<String, Object>> _data;
public Listview1Adapter(ArrayList<HashMap<String, Object>> arrayList) {
this._data = arrayList;
}
@Override
public int getCount() {
return this._data.size();
}
@Override
public HashMap<String, Object> getItem(int i) {
return this._data.get(i);
}
@Override
public long getItemId(int i) {
return i;
}
@Override
public View getView(int i, View view, ViewGroup viewGroup) {
LayoutInflater layoutInflater = BloodJannatActivity.this.getLayoutInflater();
if (view == null) {
view = layoutInflater.inflate(R.layout.blood, (ViewGroup) null);
}
LinearLayout linearLayout = (LinearLayout) view.findViewById(R.id.linear1);
LinearLayout linearLayout2 = (LinearLayout) view.findViewById(R.id.linear2);
LinearLayout linearLayout3 = (LinearLayout) view.findViewById(R.id.linear3);
LinearLayout linearLayout4 = (LinearLayout) view.findViewById(R.id.linear4);
CircleImageView circleImageView = (CircleImageView) view.findViewById(R.id.img);
TextView textView = (TextView) view.findViewById(R.id.blood);
ImageView imageView = (ImageView) view.findViewById(R.id.imageview1);
TextView textView2 = (TextView) view.findViewById(R.id.nmbr);
TextView textView3 = (TextView) view.findViewById(R.id.address);
((TextView) view.findViewById(R.id.name)).setText(((HashMap) BloodJannatActivity.this.m.get(i)).get("name").toString());
if (((HashMap) BloodJannatActivity.this.m.get(i)).containsKey("photo")) {
Glide.with(BloodJannatActivity.this.getApplicationContext()).load(Uri.parse(((HashMap) BloodJannatActivity.this.m.get(i)).get("photo").toString())).into(circleImageView);
}
if (((HashMap) BloodJannatActivity.this.m.get(i)).containsKey("bloodType")) {
textView.setText(((HashMap) BloodJannatActivity.this.m.get(i)).get("bloodType").toString());
}
if (((HashMap) BloodJannatActivity.this.m.get(i)).containsKey("address")) {
textView3.setText(((HashMap) BloodJannatActivity.this.m.get(i)).get("address").toString());
}
if (((HashMap) BloodJannatActivity.this.m.get(i)).containsKey("mobile")) {
textView2.setText(((HashMap) BloodJannatActivity.this.m.get(i)).get("mobile").toString());
}
return view;
}
}
@Deprecated
public void showMessage(String str) {
Toast.makeText(getApplicationContext(), str, 0).show();
}
@Deprecated
public int getLocationX(View view) {
int[] iArr = new int[2];
view.getLocationInWindow(iArr);
return iArr[0];
}
@Deprecated
public int getLocationY(View view) {
int[] iArr = new int[2];
view.getLocationInWindow(iArr);
return iArr[1];
}
@Deprecated
public int getRandom(int i, int i2) {
return new Random().nextInt((i2 - i) + 1) + i;
}
@Deprecated
public ArrayList<Double> getCheckedItemPositionsToArray(ListView listView) {
ArrayList<Double> arrayList = new ArrayList<>();
SparseBooleanArray checkedItemPositions = listView.getCheckedItemPositions();
for (int i = 0; i < checkedItemPositions.size(); i++) {
if (checkedItemPositions.valueAt(i)) {
arrayList.add(Double.valueOf(checkedItemPositions.keyAt(i)));
}
}
return arrayList;
}
@Deprecated
public float getDip(int i) {
return TypedValue.applyDimension(1, i, getResources().getDisplayMetrics());
}
@Deprecated
public int getDisplayWidthPixels() {
return getResources().getDisplayMetrics().widthPixels;
}
@Deprecated
public int getDisplayHeightPixels() {
return getResources().getDisplayMetrics().heightPixels;
}
}