-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Android fixes #13
Android fixes #13
Conversation
android/src/ti/map/ViewProxy.java
Outdated
|
||
TiUIView mapview = new TiUIMapView(this, activity); | ||
|
||
// ((TiUIMapView) view).createMapFragment(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove the comment if not needed
android/src/ti/map/ViewProxy.java
Outdated
@@ -1226,7 +1238,8 @@ private float handleGetZoomLevel() | |||
public void setLocation(Object location) | |||
{ | |||
if (location instanceof HashMap) { | |||
HashMap dict = (HashMap) location; | |||
HashMap<String, Object> dict = new HashMap<>(); | |||
dict.put("", location); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
empty key
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well, that way no warnings from compiler because of wrong hashmap type
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if that has to be diffrent, I don´t know :-D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the warning: [rawtypes] found raw type: HashMap
warnings have been there the whole time. If you make a ti clean
and build again you'll see many other warnings like
HashMap centerOffsetProperty = (HashMap) anno.getProperty(MapModule.PROPERTY_CENTER_OFFSET);
[ERROR] [GRADLE] ^
[ERROR] [GRADLE] missing type arguments for generic class HashMap<K,V>
but it still builds fine. I would rather keep the part from before and we fix those warnings at another point. I've not tested setLocation but dict.put("", location);
doesn't look right either 🤣
why did you do the PR on my fork 😄 ? |
|
because you need to test first |
will do on main repo if found for good :-) |
this fragment bug, also with your further improvements, which did not take any properties, just rendering the world.... take me hours over hours... this morning, I finally get it to work :-) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comments removed
in the maps.zip are demo map tiles, that will show the offlineOverlay feature |
offline tiles work fine. Make sure to add the properties to the docs (https://github.com/m1ga/ti.map/blob/master/apidoc/View.yml).
but my fork is not up to date (only one PR with iOS stuff) and I can test it from your fork or the official repo too 😄 This only makes me double the work since I have to test it here and in the tidev repo. I rather prefer doing the PR in the main repo right way or no PR and just use your fork until its ready 😉 |
ok, I will also check if I can fix tidev#480 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
left some comments. In case you don't use Android Studio: use it 😄 makes it easier to spot unused variables and imports!
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.view.ViewGroup; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unused imports
// @Override | ||
// public View onCreateView(LayoutInflater arg0, ViewGroup arg1, Bundle arg2) { | ||
// Log.e(TAG, " onCreateView"); | ||
// View v = super.onCreateView(arg0, arg1, arg2); | ||
// return v; | ||
// } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove if not needed
android/src/ti/map/TiUIMapView.java
Outdated
private float maxZoomPreference = 20; | ||
private LatLngBounds boundingRegion; | ||
private Context mainContext; | ||
private GroundOverlay overlayBackground; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
never used
android/src/ti/map/TiUIMapView.java
Outdated
private Context mainContext; | ||
private GroundOverlay overlayBackground; | ||
private Integer backgroundColor = null; | ||
private boolean transactionCommitted = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unused
mapView = new MapView(proxy.getActivity(), gOptions); | ||
container.addView(mapView); | ||
mapView.onCreate(Bundle.EMPTY); | ||
mapView.onResume(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is that onResume
needed?
android/src/ti/map/TiUIMapView.java
Outdated
// Intercept the touch event to find out the correct clicksource if clicking | ||
// on the info window. | ||
protected boolean interceptTouchEvent(MotionEvent ev) | ||
{ | ||
if (ev.getAction() == MotionEvent.ACTION_UP && selectedAnnotation != null) { | ||
TiMapInfoWindow infoWindow = selectedAnnotation.getMapInfoWindow(); | ||
TiMarker timarker = selectedAnnotation.getTiMarker(); | ||
if (infoWindow != null && timarker != null) { | ||
Marker marker = timarker.getMarker(); | ||
if (map != null && marker != null && marker.isInfoWindowShown()) { | ||
Point markerPoint = map.getProjection().toScreenLocation(marker.getPosition()); | ||
infoWindow.analyzeTouchEvent(ev, markerPoint, selectedAnnotation.getIconImageHeight()); | ||
} | ||
} | ||
} | ||
return false; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why did you move that function? Unnecessary change 😄
import android.content.res.AssetFileDescriptor; | ||
import android.graphics.Bitmap; | ||
import android.graphics.Bitmap.CompressFormat; | ||
import android.graphics.BitmapFactory; | ||
import android.os.AsyncTask; | ||
import android.os.Environment; | ||
import android.os.Handler; | ||
import android.os.Message; | ||
import com.google.android.gms.maps.model.Tile; | ||
import com.google.android.gms.maps.model.TileProvider; | ||
import java.io.ByteArrayOutputStream; | ||
import java.io.File; | ||
import java.io.FileDescriptor; | ||
import java.io.FileInputStream; | ||
import java.io.IOException; | ||
import org.appcelerator.kroll.KrollDict; | ||
import org.appcelerator.kroll.common.AsyncResult; | ||
import org.appcelerator.kroll.common.Log; | ||
import org.appcelerator.kroll.common.TiMessenger; | ||
import org.appcelerator.titanium.TiApplication; | ||
import org.appcelerator.titanium.TiC; | ||
import org.appcelerator.titanium.io.TiBaseFile; | ||
import org.appcelerator.titanium.io.TiFileFactory; | ||
import org.appcelerator.titanium.io.TiFileProvider; | ||
import org.appcelerator.titanium.proxy.TiViewProxy; | ||
import org.appcelerator.titanium.util.TiFileHelper2; | ||
import org.appcelerator.titanium.util.TiRHelper; | ||
import org.appcelerator.titanium.view.TiDrawableReference; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
only
import android.graphics.Bitmap;
import com.google.android.gms.maps.model.Tile;
import com.google.android.gms.maps.model.TileProvider;
import org.appcelerator.titanium.proxy.TiViewProxy;
import org.appcelerator.titanium.view.TiDrawableReference;
import java.io.ByteArrayOutputStream;
are used
android/src/ti/map/ViewProxy.java
Outdated
TiUIView view = new TiUIMapView(this); | ||
return view; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove the variable and just return new...
Fixes for FragmentManager: No view found for id 0x2 (unknown) for fragment SupportMapFragment tidev#282
and corrections now the mapView works as expected
Feat: added code for offlineOverlay image tiles like my PR soon to be done for iOS for offlineOverlay map features....