Panagiotis Triantafyllou

huawei map

...@@ -116,6 +116,7 @@ ...@@ -116,6 +116,7 @@
116 <entry key="..\:/Users/Warply/Documents/Warply/Android/warply_android_sdk_maven_plugin/warply_android_sdk/src/main/res/layout/activity_more_for_you.xml" value="0.22" /> 116 <entry key="..\:/Users/Warply/Documents/Warply/Android/warply_android_sdk_maven_plugin/warply_android_sdk/src/main/res/layout/activity_more_for_you.xml" value="0.22" />
117 <entry key="..\:/Users/Warply/Documents/Warply/Android/warply_android_sdk_maven_plugin/warply_android_sdk/src/main/res/layout/activity_past_coupons.xml" value="0.358695652173913" /> 117 <entry key="..\:/Users/Warply/Documents/Warply/Android/warply_android_sdk_maven_plugin/warply_android_sdk/src/main/res/layout/activity_past_coupons.xml" value="0.358695652173913" />
118 <entry key="..\:/Users/Warply/Documents/Warply/Android/warply_android_sdk_maven_plugin/warply_android_sdk/src/main/res/layout/activity_shops.xml" value="0.36666666666666664" /> 118 <entry key="..\:/Users/Warply/Documents/Warply/Android/warply_android_sdk_maven_plugin/warply_android_sdk/src/main/res/layout/activity_shops.xml" value="0.36666666666666664" />
119 + <entry key="..\:/Users/Warply/Documents/Warply/Android/warply_android_sdk_maven_plugin/warply_android_sdk/src/main/res/layout/activity_shops_huawei.xml" value="0.23157894736842105" />
119 <entry key="..\:/Users/Warply/Documents/Warply/Android/warply_android_sdk_maven_plugin/warply_android_sdk/src/main/res/layout/activity_steps.xml" value="0.358695652173913" /> 120 <entry key="..\:/Users/Warply/Documents/Warply/Android/warply_android_sdk_maven_plugin/warply_android_sdk/src/main/res/layout/activity_steps.xml" value="0.358695652173913" />
120 <entry key="..\:/Users/Warply/Documents/Warply/Android/warply_android_sdk_maven_plugin/warply_android_sdk/src/main/res/layout/activity_telco.xml" value="0.36666666666666664" /> 121 <entry key="..\:/Users/Warply/Documents/Warply/Android/warply_android_sdk_maven_plugin/warply_android_sdk/src/main/res/layout/activity_telco.xml" value="0.36666666666666664" />
121 <entry key="..\:/Users/Warply/Documents/Warply/Android/warply_android_sdk_maven_plugin/warply_android_sdk/src/main/res/layout/activity_webview.xml" value="0.4282238442822384" /> 122 <entry key="..\:/Users/Warply/Documents/Warply/Android/warply_android_sdk_maven_plugin/warply_android_sdk/src/main/res/layout/activity_webview.xml" value="0.4282238442822384" />
......
1 apply plugin: 'com.android.application' 1 apply plugin: 'com.android.application'
2 //apply plugin: 'com.google.gms.google-services' 2 //apply plugin: 'com.google.gms.google-services'
3 +//apply plugin: 'com.huawei.agconnect'
3 4
4 android { 5 android {
5 compileSdkVersion 31 6 compileSdkVersion 31
...@@ -23,16 +24,22 @@ android { ...@@ -23,16 +24,22 @@ android {
23 signingConfigs { 24 signingConfigs {
24 config { 25 config {
25 // Set the parameters based on the actual signing information. 26 // Set the parameters based on the actual signing information.
26 - keyAlias 'warplydemo' 27 + keyAlias 'democosmote'
27 - keyPassword 'warplydemo' 28 + keyPassword 'democosmote'
28 - storeFile file('../keystore/warplydemo.jks') 29 + storeFile file('../keystore/democosmote.jks')
29 - storePassword 'warplydemo' 30 + storePassword 'democosmote'
31 + }
32 + debug {
33 + keyAlias 'androiddebugkey'
34 + keyPassword 'android'
35 + storeFile file('../keystore/debug.keystore')
36 + storePassword 'android'
30 } 37 }
31 } 38 }
32 39
33 buildTypes { 40 buildTypes {
34 debug { 41 debug {
35 - 42 + signingConfig signingConfigs.debug
36 } 43 }
37 release { 44 release {
38 signingConfig signingConfigs.config 45 signingConfig signingConfigs.config
......
...@@ -10,7 +10,7 @@ buildscript { ...@@ -10,7 +10,7 @@ buildscript {
10 dependencies { 10 dependencies {
11 classpath 'com.android.tools.build:gradle:7.0.4' 11 classpath 'com.android.tools.build:gradle:7.0.4'
12 classpath 'com.google.gms:google-services:4.3.10' 12 classpath 'com.google.gms:google-services:4.3.10'
13 - classpath 'com.huawei.agconnect:agcp:1.6.2.300' 13 + classpath 'com.huawei.agconnect:agcp:1.7.2.300'
14 classpath 'io.github.gradle-nexus:publish-plugin:1.1.0' 14 classpath 'io.github.gradle-nexus:publish-plugin:1.1.0'
15 15
16 // NOTE: Do not place your application dependencies here; they belong 16 // NOTE: Do not place your application dependencies here; they belong
......
No preview for this file type
...@@ -2,7 +2,7 @@ apply plugin: 'com.android.library' ...@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
2 2
3 ext { 3 ext {
4 PUBLISH_GROUP_ID = 'ly.warp' 4 PUBLISH_GROUP_ID = 'ly.warp'
5 - PUBLISH_VERSION = '4.5.4.6rc41' 5 + PUBLISH_VERSION = '4.5.4.6rc42'
6 PUBLISH_ARTIFACT_ID = 'warply-android-sdk' 6 PUBLISH_ARTIFACT_ID = 'warply-android-sdk'
7 } 7 }
8 8
...@@ -89,6 +89,8 @@ dependencies { ...@@ -89,6 +89,8 @@ dependencies {
89 implementation 'com.huawei.hms:base:6.6.0.300' 89 implementation 'com.huawei.hms:base:6.6.0.300'
90 implementation 'com.huawei.hms:push:6.7.0.300' 90 implementation 'com.huawei.hms:push:6.7.0.300'
91 implementation 'com.huawei.hms:ads-identifier:3.4.56.300' 91 implementation 'com.huawei.hms:ads-identifier:3.4.56.300'
92 + implementation 'com.huawei.hms:maps:6.9.0.300'
93 + implementation 'com.huawei.hms:maps-basic:6.9.0.300'
92 94
93 //------------------------------ SQLCipher -----------------------------// 95 //------------------------------ SQLCipher -----------------------------//
94 api "net.zetetic:android-database-sqlcipher:4.5.2" 96 api "net.zetetic:android-database-sqlcipher:4.5.2"
......
...@@ -12,6 +12,8 @@ ...@@ -12,6 +12,8 @@
12 <uses-permission 12 <uses-permission
13 android:name="android.permission.REQUEST_INSTALL_PACKAGES" 13 android:name="android.permission.REQUEST_INSTALL_PACKAGES"
14 tools:node="remove" /> 14 tools:node="remove" />
15 + <uses-permission android:name="com.huawei.appmarket.service.commondata.permission.GET_COMMON_DATA"/>
16 + <uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
15 17
16 <application android:largeHeap="true"> 18 <application android:largeHeap="true">
17 <!-- <meta-data--> 19 <!-- <meta-data-->
...@@ -88,6 +90,12 @@ ...@@ -88,6 +90,12 @@
88 android:theme="@style/SDKAppTheme" /> 90 android:theme="@style/SDKAppTheme" />
89 91
90 <activity 92 <activity
93 + android:name="ly.warp.sdk.activities.ShopsHuaweiActivity"
94 + android:exported="false"
95 + android:screenOrientation="portrait"
96 + android:theme="@style/SDKAppTheme" />
97 +
98 + <activity
91 android:name="ly.warp.sdk.activities.CouponShareActivity" 99 android:name="ly.warp.sdk.activities.CouponShareActivity"
92 android:exported="false" 100 android:exported="false"
93 android:screenOrientation="portrait" 101 android:screenOrientation="portrait"
......
...@@ -36,6 +36,7 @@ import ly.warp.sdk.io.models.Coupon; ...@@ -36,6 +36,7 @@ import ly.warp.sdk.io.models.Coupon;
36 import ly.warp.sdk.io.models.Couponset; 36 import ly.warp.sdk.io.models.Couponset;
37 import ly.warp.sdk.io.models.Merchant; 37 import ly.warp.sdk.io.models.Merchant;
38 import ly.warp.sdk.services.EventCouponsService; 38 import ly.warp.sdk.services.EventCouponsService;
39 +import ly.warp.sdk.utils.WarplyDeviceInfoCollector;
39 import ly.warp.sdk.utils.WarplyManagerHelper; 40 import ly.warp.sdk.utils.WarplyManagerHelper;
40 import ly.warp.sdk.utils.managers.WarplyAnalyticsManager; 41 import ly.warp.sdk.utils.managers.WarplyAnalyticsManager;
41 42
...@@ -131,10 +132,17 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener ...@@ -131,10 +132,17 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
131 if (view.getId() == R.id.ll_shops) { 132 if (view.getId() == R.id.ll_shops) {
132 WarplyAnalyticsManager.logTrackersEvent(this, "click", "SeeShops"); 133 WarplyAnalyticsManager.logTrackersEvent(this, "click", "SeeShops");
133 134
135 + if (WarplyDeviceInfoCollector.isPackageInstalled("com.android.vending", getPackageManager())) {
134 Intent intent = new Intent(CouponInfoActivity.this, ShopsActivity.class); 136 Intent intent = new Intent(CouponInfoActivity.this, ShopsActivity.class);
135 intent.putExtra("couponset", (Serializable) mCouponset); 137 intent.putExtra("couponset", (Serializable) mCouponset);
136 startActivity(intent); 138 startActivity(intent);
137 return; 139 return;
140 + } else {
141 + Intent intent = new Intent(CouponInfoActivity.this, ShopsHuaweiActivity.class);
142 + intent.putExtra("couponset", (Serializable) mCouponset);
143 + startActivity(intent);
144 + return;
145 + }
138 } 146 }
139 if (view.getId() == R.id.ll_website) { 147 if (view.getId() == R.id.ll_website) {
140 WarplyAnalyticsManager.logTrackersEvent(this, "click", "SeeShopWebsite"); 148 WarplyAnalyticsManager.logTrackersEvent(this, "click", "SeeShopWebsite");
......
...@@ -69,7 +69,7 @@ public class ShopsActivity extends FragmentActivity implements View.OnClickListe ...@@ -69,7 +69,7 @@ public class ShopsActivity extends FragmentActivity implements View.OnClickListe
69 private Couponset mCouponset; 69 private Couponset mCouponset;
70 private GoogleMap mMap; 70 private GoogleMap mMap;
71 private ClusterManager<Merchant> mClusterManager; 71 private ClusterManager<Merchant> mClusterManager;
72 - SupportMapFragment mMapView; 72 + private SupportMapFragment mMapView;
73 private MerchantList mMerchantList = new MerchantList(); 73 private MerchantList mMerchantList = new MerchantList();
74 private AlertDialog mAlertDialogNoShopsAvailable; 74 private AlertDialog mAlertDialogNoShopsAvailable;
75 private Merchant mMerchant; 75 private Merchant mMerchant;
......
1 +package ly.warp.sdk.activities;
2 +
3 +import android.Manifest;
4 +import android.content.ActivityNotFoundException;
5 +import android.content.Context;
6 +import android.content.Intent;
7 +import android.content.pm.PackageManager;
8 +import android.net.Uri;
9 +import android.os.Bundle;
10 +import android.os.Handler;
11 +import android.os.Looper;
12 +import android.text.TextUtils;
13 +import android.util.Log;
14 +import android.view.View;
15 +import android.widget.ImageView;
16 +import android.widget.LinearLayout;
17 +import android.widget.TextView;
18 +
19 +import androidx.annotation.NonNull;
20 +import androidx.appcompat.app.AlertDialog;
21 +import androidx.core.app.ActivityCompat;
22 +import androidx.core.content.ContextCompat;
23 +import androidx.fragment.app.FragmentActivity;
24 +
25 +import com.bumptech.glide.Glide;
26 +import com.bumptech.glide.load.engine.DiskCacheStrategy;
27 +import com.google.android.material.bottomsheet.BottomSheetDialog;
28 +import com.huawei.hms.maps.CameraUpdate;
29 +import com.huawei.hms.maps.CameraUpdateFactory;
30 +import com.huawei.hms.maps.HuaweiMap;
31 +import com.huawei.hms.maps.MapsInitializer;
32 +import com.huawei.hms.maps.OnMapReadyCallback;
33 +import com.huawei.hms.maps.SupportMapFragment;
34 +import com.huawei.hms.maps.model.LatLng;
35 +import com.huawei.hms.maps.model.Marker;
36 +import com.huawei.hms.maps.model.MarkerOptions;
37 +
38 +import java.util.ArrayList;
39 +
40 +import io.github.inflationx.viewpump.ViewPumpContextWrapper;
41 +import ly.warp.sdk.R;
42 +import ly.warp.sdk.io.callbacks.CallbackReceiver;
43 +import ly.warp.sdk.io.models.Couponset;
44 +import ly.warp.sdk.io.models.Merchant;
45 +import ly.warp.sdk.io.models.MerchantList;
46 +import ly.warp.sdk.io.request.WarplyMerchantsRequest;
47 +import ly.warp.sdk.utils.WarplyManagerHelper;
48 +import ly.warp.sdk.utils.constants.WarpConstants;
49 +import ly.warp.sdk.utils.managers.WarplyAnalyticsManager;
50 +import ly.warp.sdk.utils.managers.WarplyManager;
51 +
52 +
53 +public class ShopsHuaweiActivity extends FragmentActivity implements View.OnClickListener, OnMapReadyCallback,
54 + HuaweiMap.OnMapLoadedCallback, HuaweiMap.OnMarkerClickListener {
55 +
56 + // ===========================================================
57 + // Constants
58 + // ===========================================================
59 +
60 + public final static float DEFAULT_LOCATION_ZOOM = 6.2f;
61 +
62 + // ===========================================================
63 + // Fields
64 + // ===========================================================
65 +
66 + private ImageView mIvBack;
67 + private Couponset mCouponset;
68 + private HuaweiMap mMap;
69 + // private ClusterManager<Merchant> mClusterManager;
70 + private SupportMapFragment mSupportMapFragment;
71 + private MerchantList mMerchantList = new MerchantList();
72 + private AlertDialog mAlertDialogNoShopsAvailable;
73 + private Merchant mMerchant;
74 +
75 + // ===========================================================
76 + // Methods for/from SuperClass/Interfaces
77 + // ===========================================================
78 +
79 + @Override
80 + public void onCreate(Bundle savedInstanceState) {
81 + super.onCreate(savedInstanceState);
82 + MapsInitializer.initialize(this);
83 + setContentView(R.layout.activity_shops_huawei);
84 +
85 + mCouponset = (Couponset) getIntent().getSerializableExtra("couponset");
86 + for (Merchant merchant : WarplyManagerHelper.getMerchantList()) {
87 + if (merchant.getUuid().equals(mCouponset.getMerchantUuid())) {
88 + mMerchant = merchant;
89 + break;
90 + }
91 + }
92 +
93 + mIvBack = findViewById(R.id.iv_shops_back);
94 + mSupportMapFragment = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.mv_shops_huawei);
95 + mSupportMapFragment.getMapAsync(this);
96 + mIvBack.setOnClickListener(this);
97 + }
98 +
99 + @Override
100 + public void onResume() {
101 + super.onResume();
102 + WarplyAnalyticsManager.logTrackersEvent(this, "screen", "ShopsScreen");
103 + }
104 +
105 + @Override
106 + public void onClick(View view) {
107 + if (view.getId() == R.id.iv_shops_back) {
108 + onBackPressed();
109 + }
110 + }
111 +
112 + @Override
113 + protected void attachBaseContext(Context newBase) {
114 + super.attachBaseContext(ViewPumpContextWrapper.wrap(newBase));
115 + }
116 +
117 +// @Override
118 +// public void onRequestPermissionsResult(
119 +// int requestCode,
120 +// String permissions[],
121 +// int[] grantResults) {
122 +// switch (requestCode) {
123 +// case REQUEST_PERMISSION_PHONE_STATE:
124 +// if (grantResults.length > 0
125 +// && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
126 +// Toast.makeText(MainActivity.this, "Permission Granted!", Toast.LENGTH_SHORT).show();
127 +// } else {
128 +// Toast.makeText(MainActivity.this, "Permission Denied!", Toast.LENGTH_SHORT).show();
129 +// }
130 +// }
131 +// }
132 +
133 + @Override
134 + public void onMapReady(HuaweiMap huaweiMap) {
135 + mMap = huaweiMap;
136 +
137 + if (ActivityCompat.checkSelfPermission(this,
138 + Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED
139 + && ActivityCompat.checkSelfPermission(this,
140 + Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
141 + if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
142 + mMap.setMyLocationEnabled(true);
143 + }
144 + } else {
145 + mMap.setMyLocationEnabled(false);
146 +// ActivityCompat.requestPermissions(this,
147 +// new String[]{Manifest.permission.ACCESS_FINE_LOCATION,
148 +// Manifest.permission.ACCESS_COARSE_LOCATION}, 501);
149 + }
150 +
151 + mMap.setMyLocationEnabled(false);
152 + mMap.setMapType(HuaweiMap.MAP_TYPE_NORMAL);
153 + mMap.setMinZoomPreference(DEFAULT_LOCATION_ZOOM);
154 + mMap.setLatLngBoundsForCameraTarget(WarpConstants.GREECE_BOUNDS_HUAWEI);
155 + mMap.getUiSettings().setZoomControlsEnabled(true);
156 + mMap.getUiSettings().setZoomGesturesEnabled(true);
157 + mMap.getUiSettings().setCompassEnabled(false);
158 + mMap.getUiSettings().setMyLocationButtonEnabled(false);
159 + mMap.getUiSettings().setMapToolbarEnabled(false);
160 + mMap.getUiSettings().setTiltGesturesEnabled(false);
161 + mMap.getUiSettings().setRotateGesturesEnabled(false);
162 + mMap.setOnMapLoadedCallback(this);
163 + mMap.setOnMarkerClickListener(/*mClusterManager*/this);
164 + mMap.setMarkersClustering(true);
165 + }
166 +
167 + @Override
168 + public void onMapLoaded() {
169 + if (mMap != null) {
170 + CameraUpdate camUpdate;
171 + camUpdate = CameraUpdateFactory.newLatLngBounds(WarpConstants.GREECE_BOUNDS_HUAWEI, 48);
172 + mMap.animateCamera(camUpdate);
173 + }
174 +//
175 +// if (mClusterManager == null) {
176 +// mClusterManager = new ClusterManager<>(this, mMap);
177 +// mClusterManager.setOnClusterClickListener(this);
178 +//// mMap.setOnMarkerClickListener(/*mClusterManager*/this);
179 +// }
180 +//
181 + if (mCouponset != null) {
182 + ArrayList<String> uuids = new ArrayList<>();
183 + uuids.add(mCouponset.getMerchantUuid());
184 + new Thread(() -> {
185 + if (!Thread.currentThread().isInterrupted()) {
186 + WarplyManager.getMerchantsMultilingual(new WarplyMerchantsRequest()
187 + .setIsMultilingual(true)
188 + .setParentUuids(uuids)
189 + , mMerchantsCallback);
190 + }
191 + Thread.currentThread().interrupt();
192 + }).start();
193 + }
194 + }
195 +
196 +// @Override
197 +// public boolean onClusterClick(Cluster<Merchant> cluster) {
198 +// if (mMap != null) {
199 +// mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(cluster.getPosition(),
200 +// (float) Math.floor(mMap.getCameraPosition().zoom + 1)), 300, null);
201 +//
202 +//// mMap.clear();
203 +//// mClusterManager.clearItems();
204 +//// mClusterManager.addItems(cluster.getItems());
205 +//// mClusterManager.cluster();
206 +// }
207 +// return true;
208 +// }
209 +
210 + @Override
211 + public boolean onMarkerClick(@NonNull Marker marker) {
212 + for (Merchant merch : mMerchantList) {
213 + if (merch.getUuid().equals(marker.getSnippet())) {
214 + WarplyAnalyticsManager.logTrackersEvent(this, "click", ("ShopsScreenMarker").concat(":").concat(marker.getSnippet()));
215 + final BottomSheetDialog bottomSheetDialog = new BottomSheetDialog(this);
216 + bottomSheetDialog.setContentView(R.layout.dl_map_pin);
217 +
218 + ImageView dialogClose = (ImageView) bottomSheetDialog.findViewById(R.id.iv_map_pin_close);
219 + dialogClose.setOnClickListener(view -> bottomSheetDialog.dismiss());
220 +
221 + TextView pinTitle = (TextView) bottomSheetDialog.findViewById(R.id.tv_pin_title);
222 + pinTitle.setText(merch.getAdminName());
223 +
224 + ImageView pinLogo = (ImageView) bottomSheetDialog.findViewById(R.id.iv_pin_logo);
225 + if (!TextUtils.isEmpty(merch.getImgPreview())) {
226 + Glide.with(this)
227 +// .setDefaultRequestOptions(
228 +// RequestOptions
229 +// .placeholderOf(R.drawable.ic_default_contact_photo)
230 +// .error(R.drawable.ic_default_contact_photo))
231 + .load(merch.getImgPreview())
232 + .diskCacheStrategy(DiskCacheStrategy.DATA)
233 + .into(pinLogo);
234 + }
235 +
236 + TextView pinName = (TextView) bottomSheetDialog.findViewById(R.id.tv_pin_name);
237 + pinName.setText(merch.getName());
238 +
239 + TextView pinDays = (TextView) bottomSheetDialog.findViewById(R.id.tv_pin_days);
240 + pinDays.setText(merch.getSnippet()); //TODO: wrong getter
241 +
242 + TextView pinTel = (TextView) bottomSheetDialog.findViewById(R.id.tv_pin_tel);
243 + pinTel.setText(merch.getTelephone());
244 +
245 + TextView pinAddress = (TextView) bottomSheetDialog.findViewById(R.id.tv_pin_address);
246 + pinAddress.setText(merch.getAddress());
247 +
248 + LinearLayout pinDirections = (LinearLayout) bottomSheetDialog.findViewById(R.id.ll_directions);
249 + pinDirections.setOnClickListener(view -> {
250 + Uri hmmIntentUri = Uri.parse("petalmaps://navigation?daddr=" + merch.getLatitude() + "," + merch.getLongitude());
251 + Intent mapIntent = new Intent(Intent.ACTION_VIEW, hmmIntentUri);
252 + if (mapIntent.resolveActivity(getPackageManager()) != null) {
253 + startActivity(mapIntent);
254 + } else {
255 + noMapAvailableDialog();
256 + }
257 + });
258 +
259 + bottomSheetDialog.show();
260 +
261 + return false;
262 + }
263 + }
264 +
265 + return false;
266 + }
267 +
268 + // ===========================================================
269 + // Methods
270 + // ===========================================================
271 +
272 + private void showNoShopsAvailableDialog() {
273 + if (!isFinishing()) {
274 + mAlertDialogNoShopsAvailable = new AlertDialog.Builder(this)
275 + .setTitle(R.string.cos_dlg_no_shops_title)
276 + .setMessage(R.string.cos_dlg_no_shops)
277 + .setCancelable(false)
278 + .setPositiveButton(R.string.cos_dlg_no_shops_positive, (dialogPositive, whichPositive) -> {
279 + dialogPositive.dismiss();
280 + openWebsite();
281 +
282 + })
283 + .setNegativeButton(R.string.cos_dlg_negative_button2, (dialogNegative, whichNegative) -> {
284 + dialogNegative.dismiss();
285 + onBackPressed();
286 + })
287 + .show();
288 + }
289 + }
290 +
291 + private void noMapAvailableDialog() {
292 + if (!isFinishing()) {
293 + mAlertDialogNoShopsAvailable = new AlertDialog.Builder(this)
294 + .setTitle(R.string.cos_dlg_error_title)
295 + .setMessage(R.string.cos_dlg_no_map)
296 + .setCancelable(false)
297 + .setPositiveButton("ΟΚ", (dialogPositive, whichPositive) -> {
298 + dialogPositive.dismiss();
299 + })
300 + .show();
301 + }
302 + }
303 +
304 + private void openWebsite() {
305 + WarplyAnalyticsManager.logTrackersEvent(this, "click", "SeeShopWebsite");
306 +
307 + if (!TextUtils.isEmpty(mMerchant.getWebsite())) {
308 + try {
309 + Intent intent = new Intent(Intent.ACTION_VIEW);
310 + intent.setData(Uri.parse(mMerchant.getWebsite()));
311 + startActivity(intent);
312 + } catch (ActivityNotFoundException e) {
313 + e.printStackTrace();
314 + }
315 + }
316 + }
317 +
318 + private final CallbackReceiver<MerchantList> mMerchantsCallback = new CallbackReceiver<MerchantList>() {
319 + @Override
320 + public void onSuccess(MerchantList result) {
321 + mMerchantList.clear();
322 + mMerchantList.addAll(result);
323 +
324 + new Handler(Looper.getMainLooper()).post(() -> {
325 +// if (mClusterManager != null) {
326 +// mMap.clear();
327 +// mClusterManager.clearItems();
328 +// if (result != null) {
329 +// mClusterManager.addItems(result);
330 +// }
331 +// mClusterManager.cluster();
332 +// }
333 +
334 + int nonNullCoords = 0;
335 + for (Merchant merchCoords : result) {
336 + if (merchCoords.getLatitude() != 0.0 && merchCoords.getLongitude() != 0.0) {
337 + nonNullCoords++;
338 + }
339 + }
340 +
341 + if (result.size() == 0 || nonNullCoords == 0) {
342 + showNoShopsAvailableDialog();
343 + return;
344 + }
345 +
346 + for (Merchant merch : result) {
347 + mMap.addMarker(new MarkerOptions()
348 + .position(new LatLng(merch.getLatitude(), merch.getLongitude()))
349 + .anchor(0.5f, 0.5f)
350 + .title(merch.getTitle())
351 + .snippet(merch.getUuid())
352 + .clusterable(true));
353 + }
354 + });
355 + }
356 +
357 + @Override
358 + public void onFailure(int errorCode) {
359 + Log.v("SHOPS_HUAWEI_ACTIVITY", String.valueOf(errorCode));
360 + }
361 + };
362 +
363 + // ===========================================================
364 + // Inner and Anonymous Classes
365 + // ===========================================================
366 +
367 +}
...@@ -385,7 +385,7 @@ public class WarplyDeviceInfoCollector { ...@@ -385,7 +385,7 @@ public class WarplyDeviceInfoCollector {
385 return json; 385 return json;
386 } 386 }
387 387
388 - public boolean isPackageInstalled(String packageName, PackageManager packageManager) { 388 + public static boolean isPackageInstalled(String packageName, PackageManager packageManager) {
389 try { 389 try {
390 return packageManager.getApplicationInfo(packageName, 0).enabled; 390 return packageManager.getApplicationInfo(packageName, 0).enabled;
391 } catch (PackageManager.NameNotFoundException e) { 391 } catch (PackageManager.NameNotFoundException e) {
......
...@@ -83,6 +83,11 @@ public class WarpConstants { ...@@ -83,6 +83,11 @@ public class WarpConstants {
83 new LatLng(41.97761, 28.62522) 83 new LatLng(41.97761, 28.62522)
84 ); 84 );
85 85
86 + public static final com.huawei.hms.maps.model.LatLngBounds GREECE_BOUNDS_HUAWEI = new com.huawei.hms.maps.model.LatLngBounds(
87 + new com.huawei.hms.maps.model.LatLng(34.75261, 19.33079),
88 + new com.huawei.hms.maps.model.LatLng(41.97761, 28.62522)
89 + );
90 +
86 /* Result codes */ 91 /* Result codes */
87 92
88 public static final int RESULT_CODE_SUCCESS = 1; 93 public static final int RESULT_CODE_SUCCESS = 1;
......
1 +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
2 + xmlns:app="http://schemas.android.com/apk/res-auto"
3 + xmlns:tools="http://schemas.android.com/tools"
4 + android:layout_width="match_parent"
5 + android:layout_height="match_parent"
6 + android:background="@android:color/white">
7 +
8 + <androidx.constraintlayout.widget.ConstraintLayout
9 + android:id="@+id/cl_loyalty_wallet_header"
10 + android:layout_width="match_parent"
11 + android:layout_height="48dp"
12 + android:background="@android:color/white">
13 +
14 + <ImageView
15 + android:id="@+id/iv_shops_back"
16 + android:layout_width="48dp"
17 + android:layout_height="48dp"
18 + android:layout_marginStart="16dp"
19 + android:scaleType="centerInside"
20 + android:src="@drawable/ic_back"
21 + app:layout_constraintBottom_toBottomOf="parent"
22 + app:layout_constraintStart_toStartOf="parent"
23 + app:layout_constraintTop_toTopOf="parent" />
24 +
25 + <TextView
26 + fontPath="fonts/pf_square_sans_pro_medium.ttf"
27 + android:layout_width="wrap_content"
28 + android:layout_height="wrap_content"
29 + android:text="@string/cos_coupon_shops_title"
30 + android:textColor="@color/grey"
31 + android:textSize="17sp"
32 + app:layout_constraintBottom_toBottomOf="parent"
33 + app:layout_constraintEnd_toEndOf="parent"
34 + app:layout_constraintStart_toStartOf="parent"
35 + app:layout_constraintTop_toTopOf="parent" />
36 + </androidx.constraintlayout.widget.ConstraintLayout>
37 +
38 + <RelativeLayout
39 + android:id="@+id/cl_loyalty_info_view_inner"
40 + android:layout_width="match_parent"
41 + android:layout_height="match_parent"
42 + android:layout_below="@+id/cl_loyalty_wallet_header">
43 +
44 + <fragment
45 + android:id="@+id/mv_shops_huawei"
46 + class="com.huawei.hms.maps.SupportMapFragment"
47 + android:layout_width="match_parent"
48 + android:layout_height="match_parent"/>
49 + </RelativeLayout>
50 +</RelativeLayout>
...@@ -146,6 +146,7 @@ ...@@ -146,6 +146,7 @@
146 <string name="cos_dlg_coupon_depleted_title">Το κουπόνι εξαντλήθηκε</string> 146 <string name="cos_dlg_coupon_depleted_title">Το κουπόνι εξαντλήθηκε</string>
147 <string name="cos_dlg_coupon_depleted_message">Μείνε συντονισμένος για νέες προσφορές και κουπόνια.</string> 147 <string name="cos_dlg_coupon_depleted_message">Μείνε συντονισμένος για νέες προσφορές και κουπόνια.</string>
148 <string name="cos_dlg_no_shops">Ο συνεργάτης διαθέτει μόνο ηλεκτρονικό κατάστημα για ηλεκτρονικές παραγγελίες.</string> 148 <string name="cos_dlg_no_shops">Ο συνεργάτης διαθέτει μόνο ηλεκτρονικό κατάστημα για ηλεκτρονικές παραγγελίες.</string>
149 + <string name="cos_dlg_no_map">Το πρόγραμμα Χάρτες Petal λείπει.</string>
149 <string name="cos_dlg_no_shops_title">Καταστήματα συνεργάτη</string> 150 <string name="cos_dlg_no_shops_title">Καταστήματα συνεργάτη</string>
150 <string name="cos_dlg_no_shops_positive">Δες το eshop</string> 151 <string name="cos_dlg_no_shops_positive">Δες το eshop</string>
151 152
......