How do I disable gestures in Mapbox v10.0? - java

The guide mentions disabling User Interactions for Kotlin here.
mapView = findViewById(R.id.mapView)
mapboxMap = mapView.getMapboxMap()
mapboxMap.gestures(); //Method not found??
I don't know how to code in Kotlin. I can't work it around to work with Java. In Java, it says it cannot resolve symbol 'gestures'.
Same problem with other features.

You need to get a reference to the GesturesPlugin, try this:
final GesturesPlugin gesturesPlugin = GesturesUtils.getGestures((mapView));
gesturesPlugin.setPitchEnabled(false);
gesturesPlugin.setScrollEnabled(false);
}

Related

Problems implementing the new sensitive clipboard code in Android SDK 13

Has anyone else tried to mark their clipboard copied data as sensitive as per the following recommendation?
https://developer.android.com/about/versions/13/features/copy-paste
clipData.apply {
description.extras = PersistableBundle().apply {
putBoolean(ClipDescription.EXTRA_IS_SENSITIVE, true)
}
}
When I tried to do so, I don't find a clipData.apply method.
How can I set the sensitivity settings in an android app Java code?
apply() is a Kotlin scope function. You appear to be programming in Java, so the Kotlin syntax will not work for you.
By eyeball, the Java equivalent would be:
PersistableBundle extras = new PersistableBundle();
extras.putBoolean(ClipDescription.EXTRA_IS_SENSITIVE, true);
clipData.getDescription().setExtras(extras);

Is there a way to do auto exposure from a fixed point in Camera X?

I am working on an app that requires me to set the exposure of the frame always from the centre of the preview image. I am working on CameraXin Android and I was wondering if there is a clean way of doing this?
P.s: Java Snippets are appreciated.
Thanks
Edit:
I have implemented a function for doing the same but because it's not activated by tap it's way harder to tell if my function is working correctly or is it normal autofocus and auto exposure.
The following is the code that I have implemented and because of the project restriction I am bound to use CameraX "1.0.0-alpha06" version:
private void setUpTapToFocus(CameraControl cameraControl) {
Log.v("Metering Point","inFunction");
//Can't use sensorOrientedMeteringPointFactory because of CameraX version
MeteringPointFactory factory = new SensorOrientedMeteringPointFactory(viewFinder.getWidth(),viewFinder.getHeight());
int centerWidth = viewFinder.getWidth()/2;
int centerHeight = viewFinder.getHeight()/2;
MeteringPoint point = factory.createPoint(centerWidth,centerHeight);
cameraControl.startFocusAndMetering(FocusMeteringAction.Builder.from(point).
.setAutoFocusCallback(isSuccess -> Log.v("SKAXC Point","Focused").
.setAutoCancelDuration(1,TimeUnit.SECONDS).build());
}
onCreate(){
CameraControl cameraControl = CameraX.getCameraControl(CameraX.LensFacing.BACK);
setUpTapToFocus(cameraControl);
}

Android , What is the difference between these codes?

i was watching thenewboston's tutorial about fragments and i came across this line of code..
#Override
public void sendtex(String top, String bottom) {
BottomFregment_class bottomFregment = (BottomFregment_class) getSupportFragmentManager().findFragmentById(R.id.Main);
bottomFregment.finale(top,bottom);
}
this was to change TextView by getting text from another fragment! and "sendtext is implemented method from that fragment"
i replaced
BottomFregment_class bottomFregment = (BottomFregment_class) getSupportFragmentManager().findFragmentById(R.id.Main);
bottomFregment.finale(top,bottom);
with
BottomFregment_class bottomFregmentClass = new BottomFregment_class();
bottomFregmentClass.finale(top,bottom);
and everything worked fine!
i want to know that is there any difference in between these two codes?
or will this cause any performance issues?
In the first, you fetch an existing fragment, maybe with some data in there, on the other one you create an empty one.

Offline tile caching using MapBox Android SDK

I have a working iOS prototype using the iOS tile-caching technique as shown below (Objective-C code):
RMTileCache * tileCache = [[RMTileCache alloc] initWithExpiryPeriod:0];
[tileCache setBackgroundCacheDelegate:self];
RMMapboxSource * tileSource = [[RMMapboxSource alloc] initWithMapID:mapID];
[tileCache beginBackgroundCacheForTileSource:tileSource southWest:southWest northEast:northEasth minZoom:minZoom maxZoom:maxZoom];
What this basically does is download the map, cache the tiles permanently and make it possible for the app to run offline in the future. Since we're going through the official payed API, this is of course not violating any of the legal restrictions.
Now I'd like to achieve the same on Android. I have the SDK running in Android Studio and a working project with a remote map using the Map ID, basically this (Android Eclipse layout XML):
<com.mapbox.mapboxsdk.views.MapView
android:id="#+id/mapview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
mapid=“my_map_id" />
This works fine, but the solution has to be completely offline once the caching is done. My question is: is there a Java equivalent of the iOS source code above in the MapBox SDK? I attempted to look in the API, but could not find a solid reference to the tile caching system. And after some painful time trying to get it running based on the method names and code documentation, I gave up.
I'm running the latest GitHub distribution of MapBox along with the latest Android Studio, everything's up and running fine, but can't find the code to accomplish this. I don’t necessarily need an API reference, a few lines of code showing how it’s done would be enough.
Offline Tile Caching support is now available in the Mapbox Android SDK as of version 0.5.1. It was released on 20-December-2014. Here's a basic example of how to get started:
OfflineMapDownloader offlineMapDownloader = OfflineMapDownloader.getOfflineMapDownloader(getActivity());
BoundingBox boundingBox = mapView.getBoundingBox();
CoordinateSpan span = new CoordinateSpan(boundingBox.getLatitudeSpan(), boundingBox.getLongitudeSpan());
CoordinateRegion coordinateRegion = new CoordinateRegion(mapView.getCenter(), span);
offlineMapDownloader.beginDownloadingMapID("MapboxMapID", coordinateRegion, (int) mapView.getZoomLevel(), (int) mapView.getZoomLevel());
To load a previously saved map:
ArrayList<OfflineMapDatabase> offlineMapDatabases = offlineMapDownloader.getMutableOfflineMapDatabases();
OfflineMapDatabase db = offlineMapDatabases.get(0);
OfflineMapTileProvider tp = new OfflineMapTileProvider(getActivity(), db);
offlineMapOverlay = new TilesOverlay(tp);
mapView.addOverlay(offlineMapOverlay);
I asked this question to the support team, here's the answer:
"We don't currently have a release date for the Android SDK or for this feature, because both are in very early stages of development.
--
Tom MacWright
support#mapbox.com"
It's a very good product, I hope we can use it soon in Android.
In your layout file there must be:
<com.mapbox.mapboxsdk.views.MapView
android:id="#+id/yourMapViewId"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
In code where you want to initialize MapView:
File file = new File("your full path to tiles db");
MBTilesLayer mbTilesLayer = new MBTilesLayer(file);
MapView mapView = (MapView) findViewById(R.id.yourMapViewId);
mapView.setTileSource(mbTilesLayer);

YouTubeEmbededPlayer GWT HowTo stop videos?

I am trying to use the youtube video gwt api.
The youtube-player works but how can I stop videos? I didnt find a command for that...
I created my player following:
protected YouTubeEmbeddedPlayer _youTubeEmbeddedPlayer;
_youTubeEmbeddedPlayer = new YouTubeEmbeddedPlayer(youTubeVideoID);
That´s the YouTube Player:
https://code.google.com/p/gwt-youtube-api/wiki/EmbededPlayer
By using YouTubePlayerWrapper.
You can stop video by calling the method
youTubePlayerWrapper.stopVideo();
This answer may not resolve the problem mentioned with the same library. In fact I tried multiple different library with every library having some issues. So end up creating my own wrapper. I have made it public check it if you can use it https://github.com/pandurangpatil/gwt-youtube

Categories

Resources