本文整理匯總了Java中com.google.android.gms.maps.GoogleMap.CancelableCallback方法的典型用法代碼示例。如果您正苦於以下問題:Java GoogleMap.CancelableCallback方法的具體用法?Java GoogleMap.CancelableCallback怎麽用?Java GoogleMap.CancelableCallback使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.google.android.gms.maps.GoogleMap
的用法示例。
在下文中一共展示了GoogleMap.CancelableCallback方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: cameraCorrection
import com.google.android.gms.maps.GoogleMap; //導入方法依賴的package包/類
private static void cameraCorrection(final Context ctx, final GoogleMap gmap, final LatLng start, final LatLng end, final VMargin padding) {
GoogleMap.CancelableCallback cameraOnFinish=new GoogleMap.CancelableCallback(){
@Override
public void onFinish() {
cameraCorrection(ctx, gmap, start, end, padding);
}
@Override
public void onCancel() {
// TODO: Implement this method
}
};
Point addr_startPoint=gmap.getProjection().toScreenLocation(start);
Point addr_endPoint = gmap.getProjection().toScreenLocation(end);
DisplayMetrics dm=ctx.getResources().getDisplayMetrics();
int maxX=dm.widthPixels;
if (addr_startPoint.y < padding.searchbar_margin || addr_endPoint.y < padding.searchbar_margin) {
gmap.animateCamera(CameraUpdateFactory.zoomBy(-1f), 1000, cameraOnFinish);
android.util.Log.d("jos", "Batas atas");
} else if (addr_startPoint.x < dp2px(ctx, 10) || addr_endPoint.x < dp2px(ctx, 10) || addr_startPoint.x > maxX - dp2px(ctx, 10) || addr_endPoint.x > maxX - dp2px(ctx, 10)) {
gmap.animateCamera(CameraUpdateFactory.zoomBy(-0.2f), 1000, cameraOnFinish);
android.util.Log.d("jos", "Batas samping");
} else if (addr_startPoint.y > (dm.heightPixels - padding.tariffview_margin) || addr_endPoint.y > (dm.heightPixels - padding.tariffview_margin)) {
gmap.animateCamera(CameraUpdateFactory.zoomBy(-0.2f), 1000, cameraOnFinish);
android.util.Log.d("jos", "Batas bawah");
}else{
if(camcallback!=null) camcallback.onComplete();
}
android.util.Log.d("jos", "batas: " + (dm.heightPixels - padding.tariffview_margin));
android.util.Log.d("jos", "marker: " + addr_endPoint.y);
android.util.Log.d("jos", "70dp: " + dp2px(ctx, 70));
}