Skip to content

Commit

Permalink
update code 2.4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
tonlion committed Nov 27, 2019
1 parent 23bbfbd commit 5e7cff2
Show file tree
Hide file tree
Showing 25 changed files with 347 additions and 60 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/feature/*/build/
/HBuilder-SourceTool-as/.gradle/
/HBuilder-SourceTool-as/.idea/
/HBuilder-SourceTool-as/*/build/
/HBuilder-SourceTool-as/gradle.properties
Binary file modified HBuilder-SourceTool-as/app/libs/dev-tools-base-release.aar
Binary file not shown.
Binary file not shown.
Binary file modified HBuilder-SourceTool-as/app/libs/uniapp-release.aar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
import android.view.Window;
import android.view.WindowManager;

import com.bun.miitmdid.core.JLibrary;

import org.json.JSONException;
import org.json.JSONObject;

Expand All @@ -34,6 +36,8 @@
import io.dcloud.common.adapter.util.DeviceInfo;
import io.dcloud.common.adapter.util.Logger;
import io.dcloud.common.adapter.util.PermissionUtil;
import io.dcloud.common.constant.DOMException;
import io.dcloud.common.miitmdid.MiitHelper;
import io.dcloud.common.util.JSUtil;
import io.dcloud.common.util.PdrUtil;
import io.dcloud.common.util.StringUtil;
Expand Down Expand Up @@ -64,7 +68,7 @@ public class DeviceFeatureImpl implements IFeature, ISysEventListener {
private Context mContext;

@Override
public String execute(final IWebview pWebViewImpl, String pActionName, final String[] pJsArgs) {
public String execute(final IWebview pWebViewImpl, final String pActionName, final String[] pJsArgs) {
switch(pActionName) {
case "getCurrentType": {
return DeviceInfo.getNetWorkType();
Expand Down Expand Up @@ -238,10 +242,54 @@ public void onDenied(String streamPerName) {
}
});
break;
case "getOAID":
case "getVAID":
case "getAAID":
final String callbackDeviceId = pJsArgs[0];
if (DeviceInfo.oaids == null || DeviceInfo.oaids.equalsIgnoreCase("||")) {
JLibrary.InitEntry(pWebViewImpl.getContext());
MiitHelper helper = new MiitHelper(new MiitHelper.AppIdsUpdater() {
@Override
public void OnIdsAvalid(String ids, boolean isSupport) {
if (isSupport) {
execDeviceId(pWebViewImpl, pActionName, callbackDeviceId, ids);
}
}
});
boolean isSupport = helper.getDeviceIds(pWebViewImpl.getActivity());
if (!isSupport){
JSUtil.execCallback(pWebViewImpl,callbackDeviceId,DOMException.toJSON(401,"not support"),JSUtil.ERROR,true,false);
}
} else {
execDeviceId(pWebViewImpl, pActionName, callbackDeviceId, DeviceInfo.oaids);
}
break;
}
return null;
}

private void execDeviceId(IWebview pWebViewImpl, String pActionName, String callbackId, String oaids) {
String[] idArray = oaids.split("\\|");
try {
switch (pActionName) {
case "getOAID":
String oaid = idArray.length > 0 ? idArray[0] : "";
JSUtil.execCallback(pWebViewImpl, callbackId, new JSONObject("{'oaid':'" + oaid + "'}"), JSUtil.OK, false);
break;
case "getVAID":
String vaid = idArray.length > 1 ? idArray[1] : "";
JSUtil.execCallback(pWebViewImpl, callbackId, new JSONObject("{'vaid':'" + vaid + "'}"), JSUtil.OK, false);
break;
case "getAAID":
String aaid = idArray.length > 2 ? idArray[2] : "";
JSUtil.execCallback(pWebViewImpl, callbackId, new JSONObject("{'aaid':'" + aaid + "'}"), JSUtil.OK, false);
break;
}
}catch (Exception e) {
JSUtil.execCallback(pWebViewImpl, callbackId, DOMException.toJSON(401,e.getMessage()), JSUtil.ERROR, true,false);
}
}

static final int MAX_BRIGHTNESS = 255;

/**
Expand Down
4 changes: 2 additions & 2 deletions feature/media/res/drawable/video_shape_seek_ball.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
android:shape="oval">

<size
android:width="14dip"
android:height="14dip"/>
android:width="16dip"
android:height="16dip"/>
<solid android:color="@color/video_seek_ball"/>
</shape>
2 changes: 2 additions & 0 deletions feature/media/res/layout/video_layout_bottom_bar.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@
android:layout_weight="1"
android:maxHeight="1.5dp"
android:minHeight="1.5dp"
android:paddingTop="15dp"
android:paddingBottom="15dp"
android:background="@android:color/transparent"
android:progressDrawable="@drawable/video_layer_seek_progress"
android:thumb="@drawable/video_shape_seek_ball"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@ public void initOptionsPlayerView(IjkPlayerView playerView, JSONObject options)
isAutoPlay = mOptions.optBoolean("autoplay", isAutoPlay);
isLoopPlay = mOptions.optBoolean("loop", isLoopPlay);
setPoster(mOptions.optString("poster"));
playerView.setMutePlayer(mOptions.optBoolean("muted", false));
if (!mOptions.isNull("muted")) {
playerView.setMutePlayer(mOptions.optBoolean("muted", false));
}
playerView.setPageGesture(mOptions.optBoolean("page-gesture", false));
playerView.setProgressVisibility(mOptions.optBoolean("show-progress", true));
playerView.setFullscreenBntVisibility(mOptions.optBoolean("show-fullscreen-btn", true));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1608,7 +1608,7 @@ public void setMutePlayer(boolean isMute) {
mAudioManager.abandonAudioFocus(null);
mAudioManager.setStreamMute(AudioManager.STREAM_MUSIC, true);
} else {
mAudioManager.requestAudioFocus(null, AudioManager.STREAM_MUSIC, AudioManager.AUDIOFOCUS_GAIN);
mAudioManager.requestAudioFocus(null, AudioManager.STREAM_MUSIC, AudioManager.AUDIOFOCUS_GAIN_TRANSIENT);
mAudioManager.setStreamMute(AudioManager.STREAM_MUSIC, false);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -472,9 +472,6 @@ private void openVideo() {
// we shouldn't clear the target state, because somebody might have
// called start() previously
release(false);
// 声音控制
AudioManager am = (AudioManager) mAppContext.getSystemService(Context.AUDIO_SERVICE);
am.requestAudioFocus(null, AudioManager.STREAM_MUSIC, AudioManager.AUDIOFOCUS_GAIN);

try {
mMediaPlayer = createPlayer(2);
Expand Down Expand Up @@ -976,6 +973,9 @@ private void toggleMediaControlsVisibility() {
@Override
public void start() {
Log.e("TTAG", "start " + isInPlaybackState());
// 声音控制
AudioManager am = (AudioManager) mAppContext.getSystemService(Context.AUDIO_SERVICE);
am.requestAudioFocus(null, AudioManager.STREAM_MUSIC, AudioManager.AUDIOFOCUS_GAIN_TRANSIENT);
if (isInPlaybackState()) {
mMediaPlayer.start();
mCurrentState = MediaPlayerParams.STATE_PLAYING;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -833,7 +833,7 @@ private static Bitmap cpBitmap(Bitmap orgBitmap) {
Bitmap tmp;
while (orgBitmap.getHeight() * orgBitmap.getRowBytes() >= 32 * 1024) {
tmp = Bitmap.createScaledBitmap(orgBitmap, orgBitmap.getWidth() * 2 / 3, orgBitmap.getHeight() * 2 / 3, true);
orgBitmap.recycle();
orgBitmap.recycle();
orgBitmap = tmp;

}
Expand Down
1 change: 1 addition & 0 deletions feature/uploader/src/io/dcloud/net/JsUpload.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ public JsUpload(IWebview pWebview,JSONObject pJsonObject){

String _requestMethod = pJsonObject.optString("method","POST");
mRequestData = new RequestData(mUrl, _requestMethod);
mRequestData.mChunkSize = pJsonObject.optInt("chunkSize", 0);
mRequestData.unTrustedCAType = pWebview.obtainApp().obtainConfigProperty(ConfigProperty.CONFIG_UNTRUSTEDCA);
mRequestData.addHeader(IWebview.USER_AGENT, pWebview.getWebviewProperty(IWebview.USER_AGENT));
// String cookie = pWebview.getWebviewProperty(mUrl);
Expand Down
16 changes: 10 additions & 6 deletions feature/uploader/src/io/dcloud/net/UploadNetWork.java
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,11 @@ private void initUploadData() throws Exception{
mRequest.setRequestProperty("Charset", "UTF-8");
mRequest.setRequestProperty("Content-Type", "multipart/form-data; boundary=" + boundary);
mRequest.setUseCaches(false);
/*int maxBufferSize = 10 * 1024;
mRequest.setChunkedStreamingMode(maxBufferSize);*/
int maxBufferSize = 10 * 1024;
if (mRequestData.mChunkSize > 0) {
maxBufferSize = mRequestData.mChunkSize *1024;
mRequest.setChunkedStreamingMode(maxBufferSize);
}
initContentLength();
DataOutputStream ds = new DataOutputStream(mRequest.getOutputStream());
//设置所有应该上传的数据
Expand All @@ -189,6 +192,7 @@ private void initUploadData() throws Exception{
mTotalSize = mContentLength;
for(String pKey : _sets){
UploadItem ui = mUploadItems.get(pKey);
// mRequest.setRequestProperty("Content-Length", Integer.toString(((UploadFile) ui).mFileInputS.available()));
ds.writeBytes(twoHyphens + boundary + end);
if(ui instanceof UploadFile) {
mUploadingFile.append(pKey);
Expand All @@ -198,7 +202,7 @@ private void initUploadData() throws Exception{
ds.write(contentType.getBytes());
ds.writeBytes(end);
FileInputStream fStream = ((UploadFile) ui).mFileInputS;
/*int bytesAvailable = fStream.available();
int bytesAvailable = fStream.available();
int bufferSize = Math.min(bytesAvailable, maxBufferSize);
byte[] buffer = new byte[bufferSize];
long curbytes = 0;
Expand All @@ -212,8 +216,8 @@ private void initUploadData() throws Exception{
bytesAvailable = fStream.available();
bufferSize = Math.min(bytesAvailable, maxBufferSize);
bytesRead = fStream.read(buffer, 0, bufferSize);
}*/
int bufferSize = 1024*10;
}
/*int bufferSize = 1024*10;
byte[] buffer = new byte[bufferSize];
int length = -1;
long curbytes = 0;
Expand All @@ -223,7 +227,7 @@ private void initUploadData() throws Exception{
Log.e("UploadNetWort", "initUploadData: mUploadedSize=="+mUploadedSize );
mReqListener.onNetStateChanged(NetState.NET_HANDLE_ING,isAbort);
ds.write(buffer, 0, length);
}
}*/
ds.writeBytes(end);
fStream.close();
}else if(ui instanceof UploadString){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public interface Name {
String ENABLE_SATELLITE = "enableSatellite";
String ENABLE_TRAFFIC = "enableTraffic";
String SHOW_SCALE = "showScale";
String SETTING = "setting";


// marker
Expand Down Expand Up @@ -105,5 +106,7 @@ public static interface EVENT {
String BIND_CALLOUT_TAP = "callouttap";
String BIND_POI_TAP = "poitap";
String BIND_CONTROL_TAP = "controltap";
String BIND_LABEL_TAP = "labeltap";
String BIND_USER_LOCATION_CHANGE = "userlocationchange";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,23 +36,35 @@ public static ArrayList<LatLng> crateLatLngs(JSONArray s) {

public static LatLng crateLatLng(JSONObject item) {
if(item != null && item.containsKey("latitude") && item.containsKey("longitude")) {
return new LatLng(item.getDouble("latitude"), item.getDouble("longitude"));
try {
return new LatLng(item.getDouble("latitude"), item.getDouble("longitude"));
} catch (Exception e){

}
}
return null;
}

public static LatLonPoint createLatLonPoint(JSONObject item) {
if(item != null && item.containsKey("latitude") && item.containsKey("longitude")) {
return new LatLonPoint(item.getDouble("latitude"), item.getDouble("longitude"));
try {
return new LatLonPoint(item.getDouble("latitude"), item.getDouble("longitude"));
}catch (Exception e){

}
}
return null;
}

public static LatLng crateLatLng(Object latitude, Object longitude) {
if(latitude != null && longitude != null) {
double lat = Double.valueOf(latitude.toString());
double lng = Double.valueOf(longitude.toString());
return new LatLng(lat, lng);
try {
double lat = Double.valueOf(latitude.toString());
double lng = Double.valueOf(longitude.toString());
return new LatLng(lat, lng);
} catch (Exception e){

}
}
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,21 @@ public WXMarker getCalloutToWXMarker(Marker m) {
return null;
}

public WXMarker getLabelToWXMarker(Marker m) {
if(m != null) {
Set<String> keys = mMarkerCaches.keySet();
for(String key: keys) {
WXMarker marker = mMarkerCaches.get(key);
if(marker.getLabel() != null) {
if(m.equals(marker.getLabel().getInstance())) {
return marker;
}
}
}
}
return null;
}

/**
* 清理不需要的marker
* @param markers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ public MarkerCallout getCallout() {
return mCallout;
}

public MarkerLabel getLabel() {
return mLabel;
}

public void isShowInfoWindow() {
if(mCallout != null && mCallout.isAlwaysDisPlay()) {
mCallout.setVisible(true);
Expand Down
Loading

0 comments on commit 5e7cff2

Please sign in to comment.