|
3 | 3 | import android.text.TextUtils; |
4 | 4 | import android.widget.ImageView; |
5 | 5 | import android.widget.RelativeLayout; |
| 6 | +import android.widget.ImageButton; |
| 7 | +import android.view.ViewGroup; |
6 | 8 |
|
7 | 9 | import com.facebook.react.ReactApplication; |
8 | 10 | import com.facebook.react.ReactRootView; |
@@ -441,6 +443,22 @@ private void convertToConfig(ReadableMap readableMap){ |
441 | 443 | ReadableArray array = readableMap.getArray(JConstans.PRIVACY_DIALOG_THEME); |
442 | 444 | builder.setDialogTheme(array.getInt(0), array.getInt(1),array.getInt(2), array.getInt(3), array.getBoolean(4)); |
443 | 445 | } |
| 446 | + // 弹窗是否需要关闭 |
| 447 | + if (readableMap.hasKey(JConstans.PRIVACY_NEED_CLOSE) && readableMap.hasKey(JConstans.PRIVACY_CLOSE_THEME)) { |
| 448 | + boolean needClose = readableMap.getBoolean(JConstans.PRIVACY_NEED_CLOSE); |
| 449 | + if(needClose) { |
| 450 | + //自定义返回按钮示例 |
| 451 | + ImageButton sampleReturnBtn = new ImageButton(reactContext); |
| 452 | + sampleReturnBtn.setImageResource(R.drawable.umcsdk_return_bg); |
| 453 | + RelativeLayout.LayoutParams returnLP = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); |
| 454 | + // 返回按钮样式 |
| 455 | + ReadableArray array = readableMap.hasKey(JConstans.PRIVACY_CLOSE_THEME) ? readableMap.getArray(JConstans.PRIVACY_CLOSE_THEME) : null; |
| 456 | + returnLP.setMargins(array.getInt(0), array.getInt(1),array.getInt(2), array.getInt(3)); |
| 457 | + sampleReturnBtn.setLayoutParams(returnLP); |
| 458 | + builder.addCustomView(sampleReturnBtn,true,null); |
| 459 | + } |
| 460 | + } |
| 461 | + |
444 | 462 | } |
445 | 463 |
|
446 | 464 | private ReactRootView convertToView(ReadableMap readableMap){ |
|
0 commit comments