import android.os.Message;
import androidx.annotation.NonNull;
import androidx.viewpager.widget.ViewPager;
import android.util.Log;
import android.view.Gravity;
@ -32,6 +35,7 @@ import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.blankj.utilcode.util.LogUtils;
import com.electric.chargingpile.R;
import com.electric.chargingpile.application.MainApplication;
import com.electric.chargingpile.data.Pic;
@ -48,6 +52,7 @@ import com.electric.chargingpile.view.SlideShowView;
import com.squareup.okhttp.Request;
import com.squareup.okhttp.Response;
import org.jetbrains.annotations.NotNull;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
@ -58,9 +63,12 @@ import java.util.ArrayList;
import java.util.List;
import cn.sharesdk.onekeyshare.OnekeyShare;
import pub.devrel.easypermissions.AfterPermissionGranted;
import pub.devrel.easypermissions.AppSettingsDialog;
import pub.devrel.easypermissions.EasyPermissions;
public class ZhanDetailsNew extends Activity implements OnClickListener {
public class ZhanDetailsNew extends Activity implements OnClickListener, EasyPermissions.PermissionCallbacks {
private ImageView iv_down, phone;
private LinearLayout ll_menu;
private ImageView ivBack, ivType, ivZhan, iv_call;
@ -104,7 +112,8 @@ public class ZhanDetailsNew extends Activity implements OnClickListener {
private EditText claimer;
public final static int RESULT_0 = 0;
public final static int RESULT_1 = 1;
private static final int RC_TELL_PERM = 124;
private String telNum;
// private ViewPager viewPager;
// private ArrayList<View> pageview;
@ -791,12 +800,8 @@ public class ZhanDetailsNew extends Activity implements OnClickListener {
.setPositiveButton("呼叫", new View.OnClickListener() {
@Override
public void onClick(View v) {
String telNum = zhan.getTelephone().toString();
Intent intent = new Intent();
intent.setAction("android.intent.action.CALL");
intent.addCategory("android.intent.category.DEFAULT");
intent.setData(Uri.parse("tel:" + telNum));
ZhanDetailsNew.this.startActivity(intent);
telNum = zhan.getTelephone().toString();
tellTask();
}
}).setNegativeButton("取消", new View.OnClickListener() {
@Override
@ -1091,4 +1096,44 @@ public class ZhanDetailsNew extends Activity implements OnClickListener {
}
}).start();
}
@AfterPermissionGranted(RC_TELL_PERM)
public void tellTask() {
if (hasTellPermission()) {
// Have permission, do the thing!
// Toast.makeText(this, "TODO: Camera things", Toast.LENGTH_LONG).show();
Intent intent = new Intent();
intent.setAction("android.intent.action.CALL");
intent.addCategory("android.intent.category.DEFAULT");
intent.setData(Uri.parse("tel:" + telNum));
ZhanDetailsNew.this.startActivity(intent);
} else {
LogUtils.e("@@@@@@@");
// Ask for one permission
EasyPermissions.requestPermissions(
this,
"该功能需要开启拨号权限,是否前往开启?",
RC_TELL_PERM,
Manifest.permission.CALL_PHONE);
}
}
private boolean hasTellPermission() {
return EasyPermissions.hasPermissions(this, Manifest.permission.CALL_PHONE);
}
@Override
public void onPermissionsGranted(int requestCode, @NonNull @NotNull List<String> perms) {
}
@Override
public void onPermissionsDenied(int requestCode, List<String> perms) {
if (EasyPermissions.somePermissionPermanentlyDenied(this, perms)) {
// TODO add by hyg20200525
new AppSettingsDialog.Builder(ZhanDetailsNew.this).build().show();
// new AppSettingsDialog.Builder(InputCodeActivity.this,
// "该功能需要开启拨号权限,是否前往开启??").build().show();
}
}
}
|
||
| 1 | 1 |
|
| 2 | 2 |
|
| 3 | 3 |
|
| 4 |
|
|
| 4 | 5 |
|
| 5 | 6 |
|
| 6 | 7 |
|
|
||
| 26 | 27 |
|
| 27 | 28 |
|
| 28 | 29 |
|
| 30 |
|
|
| 29 | 31 |
|
| 30 | 32 |
|
| 31 | 33 |
|
| 32 | 34 |
|
| 35 |
|
|
| 33 | 36 |
|
| 34 | 37 |
|
| 35 | 38 |
|
|
||
| 38 | 41 |
|
| 39 | 42 |
|
| 40 | 43 |
|
| 44 |
|
|
| 41 | 45 |
|
| 42 | 46 |
|
| 43 | 47 |
|
|
||
| 78 | 82 |
|
| 79 | 83 |
|
| 80 | 84 |
|
| 85 |
|
|
| 81 | 86 |
|
| 82 | 87 |
|
| 83 | 88 |
|
|
||
| 99 | 104 |
|
| 100 | 105 |
|
| 101 | 106 |
|
| 107 |
|
|
| 108 |
|
|
| 109 |
|
|
| 102 | 110 |
|
| 103 |
|
|
| 111 |
|
|
| 104 | 112 |
|
| 113 |
|
|
| 105 | 114 |
|
| 106 | 115 |
|
| 107 | 116 |
|
|
||
| 792 | 801 |
|
| 793 | 802 |
|
| 794 | 803 |
|
| 804 |
|
|
| 795 | 805 |
|
| 796 | 806 |
|
| 797 | 807 |
|
|
||
| 952 | 962 |
|
| 953 | 963 |
|
| 954 | 964 |
|
| 965 |
|
|
| 955 | 966 |
|
| 956 | 967 |
|
| 957 |
|
|
| 958 |
|
|
| 959 |
|
|
| 960 |
|
|
| 961 |
|
|
| 962 |
|
|
| 968 |
|
|
| 969 |
|
|
| 963 | 970 |
|
| 964 | 971 |
|
| 965 | 972 |
|
|
||
| 1528 | 1535 |
|
| 1529 | 1536 |
|
| 1530 | 1537 |
|
| 1538 |
|
|
| 1539 |
|
|
| 1540 |
|
|
| 1541 |
|
|
| 1542 |
|
|
| 1543 |
|
|
| 1544 |
|
|
| 1545 |
|
|
| 1546 |
|
|
| 1547 |
|
|
| 1548 |
|
|
| 1549 |
|
|
| 1550 |
|
|
| 1551 |
|
|
| 1552 |
|
|
| 1553 |
|
|
| 1554 |
|
|
| 1555 |
|
|
| 1556 |
|
|
| 1557 |
|
|
| 1558 |
|
|
| 1559 |
|
|
| 1560 |
|
|
| 1561 |
|
|
| 1562 |
|
|
| 1563 |
|
|
| 1564 |
|
|
| 1565 |
|
|
| 1566 |
|
|
| 1567 |
|
|
| 1568 |
|
|
| 1569 |
|
|
| 1570 |
|
|
| 1571 |
|
|
| 1572 |
|
|
| 1573 |
|
|
| 1574 |
|
|
| 1575 |
|
|
| 1576 |
|
|
| 1577 |
|
|
| 1578 |
|
|
| 1531 | 1579 |
|
| 1532 | 1580 |
|
| 1533 | 1581 |
|
|
||
| 402 | 402 |
|
| 403 | 403 |
|
| 404 | 404 |
|
| 405 |
|
|
| 405 |
|
|
| 406 | 406 |
|
| 407 | 407 |
|
| 408 | 408 |
|
|
||
| 419 | 419 |
|
| 420 | 420 |
|
| 421 | 421 |
|
| 422 |
|
|
| 422 |
|
|
| 423 | 423 |
|
| 424 | 424 |
|
| 425 | 425 |
|
|
||
| 436 | 436 |
|
| 437 | 437 |
|
| 438 | 438 |
|
| 439 |
|
|
| 440 |
|
|
| 441 |
|
|
| 442 |
|
|
| 443 |
|
|
| 444 |
|
|
| 445 |
|
|
| 446 |
|
|
| 447 |
|
|
| 448 |
|
|
| 449 |
|
|
| 450 |
|
|
| 451 |
|
|
| 452 |
|
|
| 453 |
|
|
| 454 |
|
|
| 455 |
|
|
| 456 |
|
|
| 457 |
|
|
| 458 |
|
|
| 459 |
|
|
| 460 |
|
|
| 461 |
|
|
| 462 |
|
|
| 463 |
|
|
| 464 |
|
|
| 465 |
|
|
| 466 |
|
|
| 467 |
|
|
| 468 |
|
|
| 469 |
|
|
| 470 |
|
|
| 471 |
|
|
| 472 |
|
|
| 473 |
|
|
| 474 |
|
|
| 475 |
|
|
| 476 |
|
|
| 477 |
|
|
| 478 |
|
|
| 479 |
|
|
| 480 |
|
|
| 481 |
|
|
| 482 |
|
|
| 483 |
|
|
| 484 |
|
|
| 485 |
|
|
| 486 |
|
|
| 487 |
|
|
| 488 |
|
|
| 489 |
|
|
| 490 |
|
|
| 491 |
|
|
| 492 |
|
|
| 493 |
|
|
| 494 |
|
|
| 495 |
|
|
| 496 |
|
|
| 497 |
|
|
| 498 |
|
|
| 499 |
|
|
| 500 |
|
|
| 501 |
|
|
| 439 |
|
|
| 440 |
|
|
| 441 |
|
|
| 442 |
|
|
| 443 |
|
|
| 444 |
|
|
| 445 |
|
|
| 446 |
|
|
| 447 |
|
|
| 448 |
|
|
| 449 |
|
|
| 450 |
|
|
| 451 |
|
|
| 452 |
|
|
| 453 |
|
|
| 454 |
|
|
| 455 |
|
|
| 456 |
|
|
| 457 |
|
|
| 458 |
|
|
| 459 |
|
|
| 460 |
|
|
| 461 |
|
|
| 462 |
|
|
| 463 |
|
|
| 464 |
|
|
| 465 |
|
|
| 466 |
|
|
| 467 |
|
|
| 468 |
|
|
| 469 |
|
|
| 470 |
|
|
| 471 |
|
|
| 472 |
|
|
| 473 |
|
|
| 474 |
|
|
| 475 |
|
|
| 476 |
|
|
| 477 |
|
|
| 478 |
|
|
| 479 |
|
|
| 480 |
|
|
| 481 |
|
|
| 482 |
|
|
| 483 |
|
|
| 484 |
|
|
| 485 |
|
|
| 486 |
|
|
| 487 |
|
|
| 488 |
|
|
| 489 |
|
|
| 490 |
|
|
| 491 |
|
|
| 492 |
|
|
| 493 |
|
|
| 494 |
|
|
| 495 |
|
|
| 496 |
|
|
| 497 |
|
|
| 498 |
|
|
| 499 |
|
|
| 500 |
|
|
| 501 |
|
|
| 502 | 502 |
|
| 503 | 503 |
|
| 504 | 504 |
|