下面列出了android.app.ProgressDialog#hide ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
view = inflater.inflate(R.layout.fragment_detail_product, container, false);
android_id = Settings.Secure.getString(getActivity().getContentResolver(), Settings.Secure.ANDROID_ID);
FirebaseApp.initializeApp(getActivity());
firebaseDatabase = FirebaseDatabase.getInstance();
databaseReference = firebaseDatabase.getReference("basket").child(android_id);
btnAddBasket = (FlatButton) view.findViewById(R.id.btnAddBasket);
btnAddBasket.setOnClickListener(this);
progressDialog = new ProgressDialog(getActivity());
progressDialog.setMessage("Ürün Yükleniyor..");
progressDialog.show();
progressDialog.hide();
//OnSuucese kaydet
sliderLayout = (SliderLayout) view.findViewById(R.id.slider);
tvPrice = (TextView) view.findViewById(R.id.tvPrice);
etPiece = (EditText) view.findViewById(R.id.etPiece);
etPiece.addTextChangedListener(this);
imageList = new ArrayList<>();
productIdExstra = getArguments().getInt("id");
urlDetail+=productIdExstra;
Request request = new Request(getActivity(), urlDetail, com.android.volley.Request.Method.GET);
request.requestVolley(this);
return view;
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
view = inflater.inflate(R.layout.fragment_basket, container, false);
android_id = Settings.Secure.getString(getActivity().getContentResolver(), Settings.Secure.ANDROID_ID);
Request requestTemp = new Request(getActivity(), urlTempDesk, com.android.volley.Request.Method.POST);
requestTemp.requestVolleyTempDesk(this, deskID);
progressDialog = new ProgressDialog(getActivity());
progressDialog.setMessage("Sepet Yükleniyor..");
progressDialog.show();
progressDialog.hide();
tvBasketNull = (TextView) view.findViewById(R.id.tvBasketNull);
lvBasket = (ListView) view.findViewById(R.id.lvBasket);
btnOrder = (FlatButton) view.findViewById(R.id.btnOrder);
btnOrder.setOnClickListener(this);
SharedPreferences sharedpreferences = getActivity().getSharedPreferences("userBasket", Context.MODE_PRIVATE);
userFlag = sharedpreferences.getBoolean("user",false);
if (userFlag){
btnOrder.setText("SİPARİŞ VER");
}
productBaskets = new ArrayList<>();
firebaseDatabase = FirebaseDatabase.getInstance();
databaseReference = firebaseDatabase.getReference("basket").child(android_id);
databaseReference.addValueEventListener(this);
return view;
}
public static void uninstall(Context ctx) {
// show loading menu
ProgressDialog dialog = ProgressDialog.show(ctx, "Uninstalling",
"Remounting system...", true);
dialog.show();
// remount system
final String[] result = {""};
Command command = new Command(0, "mount -o rw,remount /system") {
@Override
public void output(int id, String line) {
}
};
runCmd(command);
// check if success
command = new Command(0, "mount|grep system") {
@Override
public void output(int id, String line) {
if(line.contains("rw")) result[0] = "yes";
}
};
runCmd(command);
if(!result[0].equals("yes")) {
dialog.hide();
new AlertDialog.Builder(ctx).setTitle("Error").setMessage("Error remounting system. Sorry! Nothing was touched.").setPositiveButton("OK", null).create().show();
return;
}
result[0] = "";
dialog.setMessage("Moving wpa_supplicant back");
// move wpa_supplicant
command = new Command(0, "mv /system/bin/wpa_supplicant_real /system/bin/wpa_supplicant") {
@Override
public void output(int id, String line) {
}
};
runCmd(command);
// check if success
command = new Command(0, "ls /system/bin/wpa_*") {
@Override
public void output(int id, String line) {
if(line.contains("_real")) result[0] = "yes";
}
};
runCmd(command);
if(result[0].equals("yes")) {
dialog.hide();
new AlertDialog.Builder(ctx).setTitle("Error").setMessage("Error moving wpa_supplicant back. Sorry! Failed.").setPositiveButton("OK", null).create().show();
return;
}
result[0] = "";
dialog.hide();
new AlertDialog.Builder(ctx).setTitle("Success").setMessage("Uninstalled code successfully").setPositiveButton("OK", null).create().show();
}
public static void performInstall(Context ctx) {
// show loading menu
ProgressDialog dialog = ProgressDialog.show(ctx, "Installing",
"Remounting system...", true);
dialog.show();
// remount system
final String[] result = {""};
Command command = new Command(0, "mount -o rw,remount /system") {
@Override
public void output(int id, String line) {
}
};
runCmd(command);
// check if success
command = new Command(0, "mount|grep system") {
@Override
public void output(int id, String line) {
if(line.contains("rw")) result[0] = "yes";
}
};
runCmd(command);
if(!result[0].equals("yes")) {
dialog.hide();
new AlertDialog.Builder(ctx).setTitle("Error").setMessage("Error remounting system. Sorry! Nothing was touched.").setPositiveButton("OK", null).create().show();
return;
}
result[0] = "";
dialog.setMessage("Moving wpa_supplicant");
// move wpa_supplicant
command = new Command(0, "mv /system/bin/wpa_supplicant /system/bin/wpa_supplicant_real") {
@Override
public void output(int id, String line) {
}
};
runCmd(command);
// check if success
command = new Command(0, "ls /system/bin/wpa_*") {
@Override
public void output(int id, String line) {
if(line.contains("_real")) result[0] = "yes";
}
};
runCmd(command);
if(!result[0].equals("yes")) {
dialog.hide();
new AlertDialog.Builder(ctx).setTitle("Error").setMessage("Error moving wpa_supplicant. Sorry! Nothing was touched.").setPositiveButton("OK", null).create().show();
return;
}
result[0] = "";
// inject our script
dialog.setMessage("Injecting our mac changing code");
command = new Command(0, "echo '#!/system/xbin/bash|/system/xbin/busybox ifconfig wlan0 up hw ether $(cat /dev/mac)|/system/bin/wpa_supplicant_real [email protected]' | sed 's/|/\\n/g' > /system/bin/wpa_supplicant", "busybox chmod +x /system/bin/wpa_supplicant") {
@Override
public void output(int id, String line) {
}
};
runCmd(command);
// check if success
if(isInstalled()) {
dialog.hide();
new AlertDialog.Builder(ctx).setTitle("Success").setMessage("Installed code successfully").setPositiveButton("OK", null).create().show();
} else {
//dialog.hide();
//new AlertDialog.Builder(ctx).setTitle("Error").setMessage("Error inserting our wpa_supplicant. Will try to revert now.").setPositiveButton("OK", null).create().show();
dialog.setMessage("Error inserting out wpa_supplicant. Trying to revert...");
command = new Command(0, "mv /system/bin/wpa_supplicant_real /system/bin/wpa_supplicant") {
@Override
public void output(int id, String line) {
}
};
runCmd(command);
command = new Command(0, "ls /system/bin/wpa_*") {
@Override
public void output(int id, String line) {
if(line.contains("_real")) result[0] = "yes";
}
};
runCmd(command);
if(result[0].equals("yes")) {
new AlertDialog.Builder(ctx).setTitle("Error").setMessage("Error reverting wpa_supplicant! System in inconsistent state.").setPositiveButton("OK", null).create().show();
} else {
new AlertDialog.Builder(ctx).setTitle("Error").setMessage("Reverted successfully.").setPositiveButton("OK", null).create().show();
}
dialog.hide();
}
}