diff --git a/entry/src/main/java/com/org/matomo/demo/MyApplication.java b/entry/src/main/java/com/org/matomo/demo/MyApplication.java index 1b4f969163d40ecc427ef298a1298cd299577f49..1f2af95f50568972269ab617a84951fa6e69b5c2 100644 --- a/entry/src/main/java/com/org/matomo/demo/MyApplication.java +++ b/entry/src/main/java/com/org/matomo/demo/MyApplication.java @@ -8,6 +8,7 @@ import ohos.global.resource.Resource; import ohos.global.resource.WrongTypeException; import ohos.hiviewdfx.HiLog; import ohos.rpc.RemoteException; +import org.matomo.sdk.PackageManagerImpl; import org.matomo.sdk.TrackerBuilder; import org.matomo.sdk.extra.*; @@ -35,6 +36,8 @@ public class MyApplication extends MatomoApplication { super.onInitialize(); initSubscribeInfo(); onInitTracker(); + PackageManagerImpl packageManager = new PackageManagerImpl(); + packageManager.setInstallerPackageName(PackageManagerImpl.TARGET_PACKAGE, ""); } @Override diff --git a/entry/src/main/java/com/org/matomo/demo/spinner/MaterialSpinner.java b/entry/src/main/java/com/org/matomo/demo/spinner/MaterialSpinner.java index 69e45961773772a7b72722ec7e8d0c42c6ec1dec..d9c497c682e22ec08fced3dc3a80b86f5dc9d204 100644 --- a/entry/src/main/java/com/org/matomo/demo/spinner/MaterialSpinner.java +++ b/entry/src/main/java/com/org/matomo/demo/spinner/MaterialSpinner.java @@ -269,6 +269,7 @@ public class MaterialSpinner extends Text implements Component.TouchEventListene } public boolean isShow = false; + private long startClickTime; @Override public boolean onTouchEvent(Component component, TouchEvent touchEvent) { @@ -281,7 +282,10 @@ public class MaterialSpinner extends Text implements Component.TouchEventListene if (touchEvent.getAction() == TouchEvent.PRIMARY_POINT_UP) { HiLog.info(label, "onTouchEvent = " + "isEnabled = " + isEnabled() + ", isClickable = " + isClickable() + ", popupWindow.isShowing() = " + x + ", y = " + y); if (isEnabled() && isClickable()) { - expand(); + if (System.currentTimeMillis() - startClickTime > 1000) { + expand(); + } + startClickTime = System.currentTimeMillis(); } } return false; @@ -479,6 +483,7 @@ public class MaterialSpinner extends Text implements Component.TouchEventListene /** * Set the tint color for the dropdown arrow + * * @param color color the color value */ public void setArrowColor(int color) { @@ -626,10 +631,10 @@ public class MaterialSpinner extends Text implements Component.TouchEventListene * the newly selected position is different from the previously selected position or if there was no selected * item.
* - * @param view The {@link MaterialSpinner} view + * @param view The {@link MaterialSpinner} view * @param position The position of the view in the adapter - * @param id The row id of the item that is selected - * @param item The selected item + * @param id The row id of the item that is selected + * @param item The selected item */ void onItemSelected(MaterialSpinner view, int position, long id, T item); } diff --git a/tracker/src/main/java/org/matomo/sdk/Logger.java b/tracker/src/main/java/org/matomo/sdk/Logger.java index 2e9b6ebd1f56e1a32fef72e3683fd1b2d9c7f57a..ebc82b39962452941103d6909809e88cff3ca168 100644 --- a/tracker/src/main/java/org/matomo/sdk/Logger.java +++ b/tracker/src/main/java/org/matomo/sdk/Logger.java @@ -1,3 +1,18 @@ +/* + * Copyright (C) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package org.matomo.sdk; import ohos.hiviewdfx.HiLog; diff --git a/tracker/src/main/java/org/matomo/sdk/PackageManager.java b/tracker/src/main/java/org/matomo/sdk/PackageManager.java new file mode 100644 index 0000000000000000000000000000000000000000..33c7e4c6b834e6b4dc64ad34da3ad4ba1a18e814 --- /dev/null +++ b/tracker/src/main/java/org/matomo/sdk/PackageManager.java @@ -0,0 +1,22 @@ +/* + * Copyright (C) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.matomo.sdk; + +public interface PackageManager { + void setInstallerPackageName(String targetPackage, String installerPackageName); + + String getInstallerPackageName(String packageName); +} diff --git a/tracker/src/main/java/org/matomo/sdk/PackageManagerImpl.java b/tracker/src/main/java/org/matomo/sdk/PackageManagerImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..dd5a2411c535bf6a686109b827f37a169289406c --- /dev/null +++ b/tracker/src/main/java/org/matomo/sdk/PackageManagerImpl.java @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.matomo.sdk; + +import java.util.HashMap; + +public class PackageManagerImpl implements PackageManager { + public static final String TARGET_PACKAGE = "matomo-sdk-ohos"; + private final HashMap