forked from organicmaps/organicmaps
Splitted MapFragment from MWMActivity.
This commit is contained in:
parent
2812445d7e
commit
af21689c09
24 changed files with 446 additions and 439 deletions
|
@ -184,7 +184,7 @@ LOCAL_SRC_FILES := \
|
|||
com/mapswithme/maps/bookmarks/data/BookmarkManager.cpp \
|
||||
com/mapswithme/maps/bookmarks/data/BookmarkCategory.cpp \
|
||||
com/mapswithme/maps/VideoTimer.cpp \
|
||||
com/mapswithme/maps/MWMActivity.cpp \
|
||||
com/mapswithme/maps/MapFragment.cpp \
|
||||
com/mapswithme/maps/MWMApplication.cpp \
|
||||
com/mapswithme/maps/Lifecycle.cpp \
|
||||
com/mapswithme/maps/LocationState.cpp \
|
||||
|
|
|
@ -19,14 +19,14 @@
|
|||
extern "C"
|
||||
{
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_mapswithme_maps_MWMActivity_nativeOnLocationError(JNIEnv * env, jobject thiz,
|
||||
Java_com_mapswithme_maps_MapFragment_nativeOnLocationError(JNIEnv * env, jobject thiz,
|
||||
int errorCode)
|
||||
{
|
||||
g_framework->OnLocationError(errorCode);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_mapswithme_maps_MWMActivity_nativeLocationUpdated(JNIEnv * env, jobject thiz,
|
||||
Java_com_mapswithme_maps_MapFragment_nativeLocationUpdated(JNIEnv * env, jobject thiz,
|
||||
jlong time, jdouble lat, jdouble lon,
|
||||
jfloat accuracy, jdouble altitude, jfloat speed, jfloat bearing)
|
||||
{
|
||||
|
@ -60,7 +60,7 @@ extern "C"
|
|||
#pragma clang optimize off
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_mapswithme_maps_MWMActivity_nativeCompassUpdated(JNIEnv * env, jobject thiz,
|
||||
Java_com_mapswithme_maps_MapFragment_nativeCompassUpdated(JNIEnv * env, jobject thiz,
|
||||
jlong time, jdouble magneticNorth, jdouble trueNorth, jdouble accuracy)
|
||||
{
|
||||
location::CompassInfo info;
|
||||
|
@ -100,7 +100,7 @@ extern "C"
|
|||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_mapswithme_maps_MWMActivity_nativeConnectDownloadButton(JNIEnv * env, jobject thiz)
|
||||
Java_com_mapswithme_maps_MapFragment_nativeConnectDownloadButton(JNIEnv * env, jobject thiz)
|
||||
{
|
||||
CountryStatusDisplay * display = g_framework->GetCountryStatusDisplay();
|
||||
|
||||
|
@ -114,7 +114,7 @@ extern "C"
|
|||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_mapswithme_maps_MWMActivity_nativeDownloadCountry(JNIEnv * env, jobject thiz, jobject idx, jint options)
|
||||
Java_com_mapswithme_maps_MapFragment_nativeDownloadCountry(JNIEnv * env, jobject thiz, jobject idx, jint options)
|
||||
{
|
||||
storage::TIndex index = storage::ToNative(idx);
|
||||
storage::ActiveMapsLayout & layout = storage_utils::GetMapLayout();
|
||||
|
@ -125,44 +125,27 @@ extern "C"
|
|||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_mapswithme_maps_MWMActivity_nativeStorageConnected(JNIEnv * env, jobject thiz)
|
||||
Java_com_mapswithme_maps_MapFragment_nativeStorageConnected(JNIEnv * env, jobject thiz)
|
||||
{
|
||||
android::Platform::Instance().OnExternalStorageStatusChanged(true);
|
||||
g_framework->AddLocalMaps();
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_mapswithme_maps_MWMActivity_nativeStorageDisconnected(JNIEnv * env, jobject thiz)
|
||||
Java_com_mapswithme_maps_MapFragment_nativeStorageDisconnected(JNIEnv * env, jobject thiz)
|
||||
{
|
||||
android::Platform::Instance().OnExternalStorageStatusChanged(false);
|
||||
g_framework->RemoveLocalMaps();
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_mapswithme_maps_MWMActivity_nativeScale(JNIEnv * env, jobject thiz, jdouble k)
|
||||
Java_com_mapswithme_maps_MapFragment_nativeScale(JNIEnv * env, jobject thiz, jdouble k)
|
||||
{
|
||||
g_framework->Scale(static_cast<double>(k));
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_com_mapswithme_maps_MWMActivity_nativeIsInChina(JNIEnv * env, jobject thiz,
|
||||
jdouble lat, jdouble lon)
|
||||
{
|
||||
char const * arr[] = { "cn", "hk", "mo" };
|
||||
|
||||
string const code = g_framework->GetCountryCode(lat, lon);
|
||||
LOG(LDEBUG, ("Current country ISO code = ", code));
|
||||
|
||||
for (size_t i = 0; i < ARRAY_SIZE(arr); ++i)
|
||||
if (code == arr[i])
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_com_mapswithme_maps_MWMActivity_showMapForUrl(JNIEnv * env, jobject thiz, jstring url)
|
||||
Java_com_mapswithme_maps_MapFragment_showMapForUrl(JNIEnv * env, jobject thiz, jstring url)
|
||||
{
|
||||
return g_framework->ShowMapForURL(jni::ToNativeString(env, url));
|
||||
}
|
|
@ -907,7 +907,7 @@ void InitNVEvent(JavaVM* vm)
|
|||
};
|
||||
|
||||
jclass k;
|
||||
k = (env)->FindClass ("com/nvidia/devtech/NvEventQueueActivity");
|
||||
k = (env)->FindClass ("com/nvidia/devtech/NvEventQueueFragment");
|
||||
(env)->RegisterNatives(k, methods, dimof(methods));
|
||||
|
||||
s_InitEGL.QueryID(env, k);
|
||||
|
|
|
@ -5,12 +5,10 @@
|
|||
android:layout_height="match_parent"
|
||||
android:gravity="bottom">
|
||||
|
||||
<android.view.SurfaceView
|
||||
android:id="@+id/map_surfaceview"
|
||||
<FrameLayout
|
||||
android:id="@+id/map_fragment_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="bottom|center_horizontal"
|
||||
android:background="@android:color/transparent"/>
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
<include
|
||||
android:id="@+id/toolbar_search"
|
||||
|
|
|
@ -4,12 +4,10 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<android.view.SurfaceView
|
||||
android:id="@+id/map_surfaceview"
|
||||
<FrameLayout
|
||||
android:id="@+id/map_fragment_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="bottom|center_horizontal"
|
||||
android:background="@android:color/transparent"/>
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
<com.mapswithme.maps.widget.placepage.PlacePageView
|
||||
android:id="@+id/info_box"
|
||||
|
|
|
@ -5,12 +5,10 @@
|
|||
android:layout_height="match_parent"
|
||||
android:gravity="bottom">
|
||||
|
||||
<android.view.SurfaceView
|
||||
android:id="@+id/map_surfaceview"
|
||||
<FrameLayout
|
||||
android:id="@+id/map_fragment_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="bottom|center_horizontal"
|
||||
android:background="@android:color/transparent"/>
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
<com.mapswithme.maps.widget.placepage.PlacePageView
|
||||
android:id="@+id/info_box"
|
||||
|
|
|
@ -3,41 +3,40 @@
|
|||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="@dimen/bottom_panel_width"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:background="@drawable/ic_toolbar_tablet_bg"
|
||||
android:clipChildren="false"
|
||||
android:background="@drawable/ic_toolbar_tablet_bg">
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/btn__more"
|
||||
style="@style/Widget.MapButtonBottom"
|
||||
android:layout_width="@dimen/bottom_button_width"
|
||||
android:layout_height="@dimen/bottom_panel_height"
|
||||
android:layout_gravity="center"
|
||||
android:onClick="onMoreClicked"
|
||||
android:src="@drawable/ic_settings"/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/btn__bookmarks"
|
||||
style="@style/Widget.MapButtonBottom"
|
||||
android:layout_width="@dimen/bottom_button_width"
|
||||
android:layout_height="@dimen/bottom_panel_height"
|
||||
android:layout_gravity="center"
|
||||
android:onClick="onBookmarksClicked"
|
||||
android:src="@drawable/ic_bookmark"/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/btn__search"
|
||||
style="@style/Widget.MapButtonBottom"
|
||||
android:layout_width="@dimen/bottom_button_width"
|
||||
android:layout_height="@dimen/bottom_panel_height"
|
||||
android:layout_gravity="center"
|
||||
android:onClick="onSearchClicked"
|
||||
android:src="@drawable/ic_search"/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/map_button_myposition"
|
||||
android:id="@+id/btn__myposition"
|
||||
style="@style/Widget.MapButtonBottom"
|
||||
android:layout_width="@dimen/bottom_button_width"
|
||||
android:layout_height="@dimen/bottom_panel_height"
|
||||
android:layout_gravity="center"
|
||||
android:onClick="onMyPositionClicked"
|
||||
android:src="@drawable/ic_my_position"/>
|
||||
|
||||
</LinearLayout>
|
|
@ -23,7 +23,6 @@
|
|||
android:layout_height="@dimen/zoom_buttom_size"
|
||||
android:layout_above="@+id/map_button_minus"
|
||||
android:layout_alignParentRight="true"
|
||||
android:onClick="onPlusClicked"
|
||||
android:src="@drawable/ic_zoom_in"/>
|
||||
|
||||
<ImageButton
|
||||
|
@ -34,7 +33,6 @@
|
|||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_marginBottom="382dp"
|
||||
android:onClick="onMinusClicked"
|
||||
android:src="@drawable/ic_zoom_out"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
|
|
@ -4,12 +4,10 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<android.view.SurfaceView
|
||||
android:id="@+id/map_surfaceview"
|
||||
<FrameLayout
|
||||
android:id="@+id/map_fragment_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="bottom|center_horizontal"
|
||||
android:background="@android:color/transparent"/>
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
<com.mapswithme.maps.widget.placepage.PlacePageView
|
||||
android:id="@+id/info_box"
|
||||
|
|
7
android/res/layout/fragment_map.xml
Normal file
7
android/res/layout/fragment_map.xml
Normal file
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.view.SurfaceView
|
||||
android:id="@+id/map_surfaceview"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@android:color/transparent"/>
|
|
@ -5,12 +5,10 @@
|
|||
android:layout_height="match_parent"
|
||||
android:gravity="bottom">
|
||||
|
||||
<android.view.SurfaceView
|
||||
android:id="@+id/map_surfaceview"
|
||||
<FrameLayout
|
||||
android:id="@+id/map_fragment_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="bottom|center_horizontal"
|
||||
android:background="@android:color/transparent"/>
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
<include
|
||||
android:id="@+id/toolbar_search"
|
||||
|
|
|
@ -12,12 +12,11 @@
|
|||
android:layout_weight="1">
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/map_button_myposition"
|
||||
android:id="@+id/btn__myposition"
|
||||
style="@style/Widget.MapButtonBottom"
|
||||
android:layout_width="@dimen/bottom_button_width"
|
||||
android:layout_height="@dimen/bottom_panel_height"
|
||||
android:layout_gravity="center"
|
||||
android:onClick="onMyPositionClicked"
|
||||
android:src="@drawable/ic_my_position"/>
|
||||
|
||||
</FrameLayout>
|
||||
|
@ -28,11 +27,11 @@
|
|||
android:layout_weight="1">
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/btn__search"
|
||||
style="@style/Widget.MapButtonBottom"
|
||||
android:layout_width="@dimen/bottom_button_width"
|
||||
android:layout_height="@dimen/bottom_panel_height"
|
||||
android:layout_gravity="center"
|
||||
android:onClick="onSearchClicked"
|
||||
android:src="@drawable/ic_search"/>
|
||||
|
||||
</FrameLayout>
|
||||
|
@ -43,11 +42,11 @@
|
|||
android:layout_weight="1">
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/btn__bookmarks"
|
||||
style="@style/Widget.MapButtonBottom"
|
||||
android:layout_width="@dimen/bottom_button_width"
|
||||
android:layout_height="@dimen/bottom_panel_height"
|
||||
android:layout_gravity="center"
|
||||
android:onClick="onBookmarksClicked"
|
||||
android:src="@drawable/ic_bookmark"/>
|
||||
|
||||
</FrameLayout>
|
||||
|
@ -58,11 +57,11 @@
|
|||
android:layout_weight="1">
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/btn__more"
|
||||
style="@style/Widget.MapButtonBottom"
|
||||
android:layout_width="@dimen/bottom_button_width"
|
||||
android:layout_height="@dimen/bottom_panel_height"
|
||||
android:layout_gravity="center"
|
||||
android:onClick="onMoreClicked"
|
||||
android:src="@drawable/ic_settings"/>
|
||||
|
||||
</FrameLayout>
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
android:layout_height="@dimen/zoom_buttom_size"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_below="@id/anchor_center"
|
||||
android:onClick="onPlusClicked"
|
||||
android:src="@drawable/ic_zoom_in"/>
|
||||
|
||||
<ImageButton
|
||||
|
@ -41,7 +40,6 @@
|
|||
android:layout_height="@dimen/zoom_buttom_size"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_below="@+id/map_button_plus"
|
||||
android:onClick="onMinusClicked"
|
||||
android:src="@drawable/ic_zoom_out"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
|
|
@ -1,30 +1,24 @@
|
|||
package com.mapswithme.maps;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Point;
|
||||
import android.location.Location;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.os.Handler;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.support.v4.app.FragmentTransaction;
|
||||
import android.support.v4.content.LocalBroadcastManager;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.text.SpannableStringBuilder;
|
||||
import android.text.Spanned;
|
||||
import android.text.TextUtils;
|
||||
import android.text.style.AbsoluteSizeSpan;
|
||||
import android.util.Log;
|
||||
import android.util.Pair;
|
||||
|
@ -49,11 +43,9 @@ import com.mapswithme.country.DownloadFragment;
|
|||
import com.mapswithme.country.StorageOptions;
|
||||
import com.mapswithme.maps.Framework.OnBalloonListener;
|
||||
import com.mapswithme.maps.MapStorage.Index;
|
||||
import com.mapswithme.maps.ads.AdsManager;
|
||||
import com.mapswithme.maps.ads.LikesManager;
|
||||
import com.mapswithme.maps.ads.MenuAd;
|
||||
import com.mapswithme.maps.api.ParsedMmwRequest;
|
||||
import com.mapswithme.maps.background.WorkerService;
|
||||
import com.mapswithme.maps.base.MWMFragmentActivity;
|
||||
import com.mapswithme.maps.bookmarks.BookmarkActivity;
|
||||
import com.mapswithme.maps.bookmarks.BookmarkCategoriesActivity;
|
||||
import com.mapswithme.maps.bookmarks.data.Bookmark;
|
||||
|
@ -62,7 +54,6 @@ import com.mapswithme.maps.bookmarks.data.MapObject;
|
|||
import com.mapswithme.maps.bookmarks.data.MapObject.ApiPoint;
|
||||
import com.mapswithme.maps.bookmarks.data.ParcelablePoint;
|
||||
import com.mapswithme.maps.data.RoutingResultCodes;
|
||||
import com.mapswithme.maps.downloader.DownloadHelper;
|
||||
import com.mapswithme.maps.location.LocationHelper;
|
||||
import com.mapswithme.maps.location.LocationPredictor;
|
||||
import com.mapswithme.maps.search.SearchActivity;
|
||||
|
@ -87,16 +78,14 @@ import com.mapswithme.util.statistics.Statistics;
|
|||
import com.nineoldandroids.animation.Animator;
|
||||
import com.nineoldandroids.animation.ObjectAnimator;
|
||||
import com.nineoldandroids.view.ViewHelper;
|
||||
import com.nvidia.devtech.NvEventQueueActivity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Stack;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class MWMActivity extends NvEventQueueActivity
|
||||
implements LocationHelper.LocationListener, OnBalloonListener,
|
||||
BasePlacePageAnimationController.OnVisibilityChangedListener, OnClickListener, Framework.RoutingListener
|
||||
public class MWMActivity extends MWMFragmentActivity
|
||||
implements LocationHelper.LocationListener, OnBalloonListener, View.OnTouchListener, BasePlacePageAnimationController.OnVisibilityChangedListener,
|
||||
OnClickListener, Framework.RoutingListener, MapFragment.MapRenderingListener
|
||||
{
|
||||
public static final String EXTRA_TASK = "map_task";
|
||||
private final static String TAG = "MWMActivity";
|
||||
|
@ -111,10 +100,12 @@ public class MWMActivity extends NvEventQueueActivity
|
|||
private static final String EXTRA_SEARCH_RES_SINGLE = "search_res_index";
|
||||
// Map tasks that we run AFTER rendering initialized
|
||||
private final Stack<MapTask> mTasks = new Stack<>();
|
||||
private BroadcastReceiver mExternalStorageReceiver = null;
|
||||
private BroadcastReceiver mExternalStorageReceiver;
|
||||
private StoragePathManager mPathManager = new StoragePathManager();
|
||||
private AlertDialog mStorageDisconnectedDialog = null;
|
||||
private AlertDialog mStorageDisconnectedDialog;
|
||||
private ImageButton mLocationButton;
|
||||
// map
|
||||
private MapFragment mMapFragment;
|
||||
// Place page
|
||||
private PlacePageView mPlacePage;
|
||||
private View mRlStartRouting;
|
||||
|
@ -132,7 +123,6 @@ public class MWMActivity extends NvEventQueueActivity
|
|||
private TextView mTvTurnDistance;
|
||||
|
||||
private boolean mNeedCheckUpdate = true;
|
||||
private boolean mRenderingInitialized = false;
|
||||
private int mLocationStateModeListenerId = -1;
|
||||
// Initialized to invalid combination to force update on the first check
|
||||
private boolean mStorageAvailable = false;
|
||||
|
@ -149,17 +139,7 @@ public class MWMActivity extends NvEventQueueActivity
|
|||
private static final String IS_KITKAT_MIGRATION_COMPLETED = "KitKatMigrationCompleted";
|
||||
// for routing
|
||||
private static final String IS_ROUTING_DISCLAIMER_APPROVED = "IsDisclaimerApproved";
|
||||
// ads in vertical toolbar
|
||||
private static final String MENU_ADS_ENABLED = "MenuLinksEnabled";
|
||||
private BroadcastReceiver mUpdateAdsReceiver = new BroadcastReceiver()
|
||||
{
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent)
|
||||
{
|
||||
updateToolbarAds();
|
||||
}
|
||||
};
|
||||
private boolean mAreToolbarAdsUpdated;
|
||||
|
||||
private boolean mIsFragmentContainer;
|
||||
|
||||
private LocationPredictor mLocationPredictor;
|
||||
|
@ -222,33 +202,6 @@ public class MWMActivity extends NvEventQueueActivity
|
|||
LocationState.INSTANCE.invalidatePosition();
|
||||
}
|
||||
|
||||
@SuppressWarnings("UnusedDeclaration")
|
||||
public void OnDownloadCountryClicked(final int group, final int country, final int region, final int options)
|
||||
{
|
||||
runOnUiThread(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
final MapStorage.Index index = new Index(group, country, region);
|
||||
if (options == -1)
|
||||
nativeDownloadCountry(index, options);
|
||||
else
|
||||
{
|
||||
long size = MapStorage.INSTANCE.countryRemoteSizeInBytes(index, options);
|
||||
DownloadHelper.downloadWithCellularCheck(MWMActivity.this, size, MapStorage.INSTANCE.countryName(index), new DownloadHelper.OnDownloadListener()
|
||||
{
|
||||
@Override
|
||||
public void onDownload()
|
||||
{
|
||||
nativeDownloadCountry(index, options);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void checkUserMarkActivation()
|
||||
{
|
||||
final Intent intent = getIntent();
|
||||
|
@ -272,10 +225,8 @@ public class MWMActivity extends NvEventQueueActivity
|
|||
}
|
||||
|
||||
@Override
|
||||
public void OnRenderingInitialized()
|
||||
public void onRenderingInitialized()
|
||||
{
|
||||
mRenderingInitialized = true;
|
||||
|
||||
runOnUiThread(new Runnable()
|
||||
{
|
||||
@Override
|
||||
|
@ -302,82 +253,11 @@ public class MWMActivity extends NvEventQueueActivity
|
|||
mTasks.pop().run(this);
|
||||
}
|
||||
|
||||
private Activity getActivity() { return this; }
|
||||
|
||||
@Override
|
||||
public void ReportUnsupported()
|
||||
{
|
||||
runOnUiThread(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
new AlertDialog.Builder(getActivity())
|
||||
.setMessage(getString(R.string.unsupported_phone))
|
||||
.setCancelable(false)
|
||||
.setPositiveButton(getString(R.string.close), new DialogInterface.OnClickListener()
|
||||
{
|
||||
@Override
|
||||
public void onClick(DialogInterface dlg, int which)
|
||||
{
|
||||
getActivity().moveTaskToBack(true);
|
||||
dlg.dismiss();
|
||||
}
|
||||
})
|
||||
.create()
|
||||
.show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void checkMeasurementSystem()
|
||||
{
|
||||
UnitLocale.initializeCurrentUnits();
|
||||
}
|
||||
|
||||
private native void nativeScale(double k);
|
||||
|
||||
public void onPlusClicked(View v)
|
||||
{
|
||||
nativeScale(3.0 / 2);
|
||||
}
|
||||
|
||||
public void onMinusClicked(View v)
|
||||
{
|
||||
nativeScale(2.0 / 3);
|
||||
}
|
||||
|
||||
public void onBookmarksClicked(View v)
|
||||
{
|
||||
showBookmarks();
|
||||
}
|
||||
|
||||
private void showBookmarks()
|
||||
{
|
||||
// TODO open in fragment?
|
||||
startActivity(new Intent(this, BookmarkCategoriesActivity.class));
|
||||
}
|
||||
|
||||
public void onMyPositionClicked(View v)
|
||||
{
|
||||
final LocationState state = LocationState.INSTANCE;
|
||||
state.switchToNextMode();
|
||||
}
|
||||
|
||||
private void ShowAlertDlg(int tittleID)
|
||||
{
|
||||
new AlertDialog.Builder(this)
|
||||
.setCancelable(false)
|
||||
.setMessage(tittleID)
|
||||
.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener()
|
||||
{
|
||||
@Override
|
||||
public void onClick(DialogInterface dlg, int which) { dlg.dismiss(); }
|
||||
})
|
||||
.create()
|
||||
.show();
|
||||
}
|
||||
|
||||
private void checkKitkatMigrationMove()
|
||||
{
|
||||
final boolean kmlMoved = MWMApplication.get().nativeGetBoolean(IS_KML_MOVED, false);
|
||||
|
@ -388,7 +268,7 @@ public class MWMActivity extends NvEventQueueActivity
|
|||
MWMApplication.get().nativeSetBoolean(IS_KML_MOVED, true);
|
||||
else
|
||||
{
|
||||
ShowAlertDlg(R.string.bookmark_move_fail);
|
||||
UiUtils.showAlertDialog(this, R.string.bookmark_move_fail);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -400,23 +280,18 @@ public class MWMActivity extends NvEventQueueActivity
|
|||
public void moveFilesFinished(String newPath)
|
||||
{
|
||||
MWMApplication.get().nativeSetBoolean(IS_KITKAT_MIGRATION_COMPLETED, true);
|
||||
ShowAlertDlg(R.string.kitkat_migrate_ok);
|
||||
UiUtils.showAlertDialog(MWMActivity.this, R.string.kitkat_migrate_ok);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void moveFilesFailed()
|
||||
{
|
||||
ShowAlertDlg(R.string.kitkat_migrate_failed);
|
||||
UiUtils.showAlertDialog(MWMActivity.this, R.string.kitkat_migrate_failed);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if PRO version is running on KITKAT or greater sdk.
|
||||
* If so - checks whether LITE version is installed and contains maps on sd card and then copies them to own directory on sdcard.
|
||||
*/
|
||||
|
||||
private void checkLiteMapsInPro()
|
||||
{
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT &&
|
||||
|
@ -431,13 +306,13 @@ public class MWMActivity extends NvEventQueueActivity
|
|||
@Override
|
||||
public void moveFilesFinished(String newPath)
|
||||
{
|
||||
ShowAlertDlg(R.string.move_lite_maps_to_pro_ok);
|
||||
UiUtils.showAlertDialog(MWMActivity.this, R.string.move_lite_maps_to_pro_ok);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void moveFilesFailed()
|
||||
{
|
||||
ShowAlertDlg(R.string.move_lite_maps_to_pro_failed);
|
||||
UiUtils.showAlertDialog(MWMActivity.this, R.string.move_lite_maps_to_pro_failed);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
@ -474,10 +349,31 @@ public class MWMActivity extends NvEventQueueActivity
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConfigurationChanged(Configuration newConfig)
|
||||
private void showBookmarks()
|
||||
{
|
||||
super.onConfigurationChanged(newConfig);
|
||||
// TODO open in fragment?
|
||||
startActivity(new Intent(this, BookmarkCategoriesActivity.class));
|
||||
}
|
||||
|
||||
private void showSearchIfUpdated()
|
||||
{
|
||||
if (!MapStorage.INSTANCE.updateMaps(R.string.search_update_maps, this, new MapStorage.UpdateFunctor()
|
||||
{
|
||||
@Override
|
||||
public void doUpdate()
|
||||
{
|
||||
showDownloader(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doCancel()
|
||||
{
|
||||
showSearch();
|
||||
}
|
||||
}))
|
||||
{
|
||||
showSearch();
|
||||
}
|
||||
}
|
||||
|
||||
private void showSearch()
|
||||
|
@ -503,32 +399,6 @@ public class MWMActivity extends NvEventQueueActivity
|
|||
startActivity(new Intent(this, SearchActivity.class));
|
||||
}
|
||||
|
||||
public void onSearchClicked(View v)
|
||||
{
|
||||
if (!MapStorage.INSTANCE.updateMaps(R.string.search_update_maps, this, new MapStorage.UpdateFunctor()
|
||||
{
|
||||
@Override
|
||||
public void doUpdate()
|
||||
{
|
||||
showDownloader(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doCancel()
|
||||
{
|
||||
showSearch();
|
||||
}
|
||||
}))
|
||||
{
|
||||
showSearch();
|
||||
}
|
||||
}
|
||||
|
||||
public void onMoreClicked(View v)
|
||||
{
|
||||
setVerticalToolbarVisible(true);
|
||||
}
|
||||
|
||||
private void setVerticalToolbarVisible(boolean showVerticalToolbar)
|
||||
{
|
||||
if (mVerticalToolbarAnimation != null ||
|
||||
|
@ -620,7 +490,7 @@ public class MWMActivity extends NvEventQueueActivity
|
|||
final String httpUrl = Framework.getHttpGe0Url(loc.getLatitude(), loc.getLongitude(), Framework.getDrawScale(), "");
|
||||
final String body = getString(R.string.my_position_share_sms, geoUrl, httpUrl);
|
||||
// we use shortest message we can have here
|
||||
ShareAction.getAnyShare().shareWithText(getActivity(), body, "");
|
||||
ShareAction.getAnyShare().shareWithText(this, body, "");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -673,15 +543,11 @@ public class MWMActivity extends NvEventQueueActivity
|
|||
@Override
|
||||
public void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
// Use full-screen on Kindle Fire only
|
||||
if (Utils.isAmazonDevice())
|
||||
{
|
||||
getWindow().addFlags(android.view.WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||
getWindow().clearFlags(android.view.WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
|
||||
}
|
||||
setContentView(R.layout.map);
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
setContentView(R.layout.map);
|
||||
initViews();
|
||||
|
||||
// Log app start events - successful installation means that user has passed DownloadResourcesActivity
|
||||
MWMApplication.get().onMwmCreate(this);
|
||||
|
||||
|
@ -689,10 +555,6 @@ public class MWMActivity extends NvEventQueueActivity
|
|||
if (MWMApplication.get().nativeIsBenchmarking())
|
||||
getWindow().addFlags(android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
|
||||
nativeConnectDownloadButton();
|
||||
|
||||
initViews();
|
||||
|
||||
Framework.nativeSetRoutingListener(this);
|
||||
Framework.nativeConnectBalloonListeners(this);
|
||||
|
||||
|
@ -707,12 +569,11 @@ public class MWMActivity extends NvEventQueueActivity
|
|||
{
|
||||
String value = intent.getStringExtra(EXTRA_SCREENSHOTS_TASK);
|
||||
if (value.equals(SCREENSHOTS_TASK_LOCATE))
|
||||
onMyPositionClicked(null);
|
||||
{
|
||||
switchNextLocationState();
|
||||
}
|
||||
}
|
||||
|
||||
updateToolbarAds();
|
||||
LocalBroadcastManager.getInstance(this).registerReceiver(mUpdateAdsReceiver, new IntentFilter(WorkerService.ACTION_UPDATE_MENU_ADS));
|
||||
|
||||
mLocationPredictor = new LocationPredictor(new Handler(), this);
|
||||
mLikesManager = new LikesManager(this);
|
||||
mMemLogging = new MemLogging(this);
|
||||
|
@ -720,11 +581,11 @@ public class MWMActivity extends NvEventQueueActivity
|
|||
|
||||
private void initViews()
|
||||
{
|
||||
mLocationButton = (ImageButton) findViewById(R.id.map_button_myposition);
|
||||
yotaSetup();
|
||||
setUpPlacePage();
|
||||
setUpRoutingBox();
|
||||
setUpToolbars();
|
||||
setupMap();
|
||||
setupYota();
|
||||
setupPlacePage();
|
||||
setupRoutingBox();
|
||||
setupToolbars();
|
||||
if (findViewById(R.id.fragment_container) != null)
|
||||
{
|
||||
mIsFragmentContainer = true;
|
||||
|
@ -736,52 +597,24 @@ public class MWMActivity extends NvEventQueueActivity
|
|||
}
|
||||
}
|
||||
|
||||
private void updateToolbarAds()
|
||||
private void setupMap()
|
||||
{
|
||||
final List<MenuAd> ads = AdsManager.getMenuAds();
|
||||
if (ads != null && !mAreToolbarAdsUpdated && MWMApplication.get().nativeGetBoolean(MENU_ADS_ENABLED, true))
|
||||
mMapFragment = (MapFragment) getSupportFragmentManager().findFragmentByTag(MapFragment.FRAGMENT_TAG);
|
||||
if (mMapFragment == null)
|
||||
{
|
||||
mAreToolbarAdsUpdated = true;
|
||||
int startAdMenuPosition = 7;
|
||||
for (final MenuAd ad : ads)
|
||||
{
|
||||
final View view = getLayoutInflater().inflate(R.layout.item_bottom_toolbar, mVerticalToolbar, false);
|
||||
final TextView textView = (TextView) view.findViewById(R.id.tv__bottom_item_text);
|
||||
textView.setText(ad.getTitle());
|
||||
try
|
||||
{
|
||||
textView.setTextColor(Color.parseColor(ad.getHexColor()));
|
||||
} catch (IllegalArgumentException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
final ImageView imageView = (ImageView) view.findViewById(R.id.iv__bottom_icon);
|
||||
imageView.setImageBitmap(ad.getIcon());
|
||||
|
||||
view.setOnClickListener(new OnClickListener()
|
||||
{
|
||||
@Override
|
||||
public void onClick(View v)
|
||||
{
|
||||
final String appPackage = ad.getAppPackage();
|
||||
if (!TextUtils.isEmpty(appPackage) && Utils.isPackageInstalled(appPackage))
|
||||
Utils.launchPackage(MWMActivity.this, appPackage);
|
||||
else
|
||||
{
|
||||
final Intent it = new Intent(Intent.ACTION_VIEW);
|
||||
it.setData(Uri.parse(ad.getAppUrl()));
|
||||
startActivity(it);
|
||||
}
|
||||
}
|
||||
});
|
||||
mVerticalToolbar.addView(view, startAdMenuPosition++);
|
||||
}
|
||||
mMapFragment = (MapFragment) MapFragment.instantiate(this, MapFragment.class.getName(), null);
|
||||
getSupportFragmentManager().beginTransaction().
|
||||
replace(R.id.map_fragment_container, mMapFragment, MapFragment.FRAGMENT_TAG).commit();
|
||||
}
|
||||
}
|
||||
|
||||
private void setUpToolbars()
|
||||
private void setupToolbars()
|
||||
{
|
||||
mBottomToolbar = (ViewGroup) findViewById(R.id.map_bottom_toolbar);
|
||||
mBottomToolbar.findViewById(R.id.btn__more).setOnClickListener(this);
|
||||
mBottomToolbar.findViewById(R.id.btn__search).setOnClickListener(this);
|
||||
mBottomToolbar.findViewById(R.id.btn__bookmarks).setOnClickListener(this);
|
||||
mLocationButton = (ImageButton) mBottomToolbar.findViewById(R.id.btn__myposition);
|
||||
mVerticalToolbar = (ViewGroup) findViewById(R.id.map_bottom_vertical_toolbar);
|
||||
mVerticalToolbar.findViewById(R.id.btn_download_maps).setOnClickListener(this);
|
||||
mVerticalToolbar.findViewById(R.id.btn_share).setOnClickListener(this);
|
||||
|
@ -805,9 +638,12 @@ public class MWMActivity extends NvEventQueueActivity
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
findViewById(R.id.map_button_plus).setOnClickListener(this);
|
||||
findViewById(R.id.map_button_minus).setOnClickListener(this);
|
||||
}
|
||||
|
||||
private void setUpPlacePage()
|
||||
private void setupPlacePage()
|
||||
{
|
||||
mPlacePage = (PlacePageView) findViewById(R.id.info_box);
|
||||
mPlacePage.setOnVisibilityChangedListener(this);
|
||||
|
@ -818,7 +654,7 @@ public class MWMActivity extends NvEventQueueActivity
|
|||
mPbRoutingProgress = (ProgressBar) mRlStartRouting.findViewById(R.id.pb__routing_progress);
|
||||
}
|
||||
|
||||
private void setUpRoutingBox()
|
||||
private void setupRoutingBox()
|
||||
{
|
||||
mRlRoutingBox = (RelativeLayout) findViewById(R.id.rl__routing_box);
|
||||
mRlRoutingBox.setVisibility(View.GONE);
|
||||
|
@ -835,13 +671,11 @@ public class MWMActivity extends NvEventQueueActivity
|
|||
mRlTurnByTurnBox.findViewById(R.id.btn__close).setOnClickListener(this);
|
||||
}
|
||||
|
||||
private void yotaSetup()
|
||||
private void setupYota()
|
||||
{
|
||||
final View yopmeButton = findViewById(R.id.yop_it);
|
||||
if (!Yota.isYota())
|
||||
{
|
||||
yopmeButton.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
else
|
||||
{
|
||||
yopmeButton.setOnClickListener(new OnClickListener()
|
||||
|
@ -909,7 +743,7 @@ public class MWMActivity extends NvEventQueueActivity
|
|||
mTasks.add(mapTask);
|
||||
intent.removeExtra(EXTRA_TASK);
|
||||
|
||||
if (mRenderingInitialized)
|
||||
if (mMapFragment.isRenderingInitialized())
|
||||
runTasks();
|
||||
|
||||
// mark intent as consumed
|
||||
|
@ -917,17 +751,10 @@ public class MWMActivity extends NvEventQueueActivity
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop()
|
||||
{
|
||||
super.onStop();
|
||||
mRenderingInitialized = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLocationError(int errorCode)
|
||||
{
|
||||
nativeOnLocationError(errorCode);
|
||||
mMapFragment.nativeOnLocationError(errorCode);
|
||||
|
||||
// Notify user about turned off location services
|
||||
if (errorCode == LocationHelper.ERROR_DENIED)
|
||||
|
@ -986,7 +813,7 @@ public class MWMActivity extends NvEventQueueActivity
|
|||
if (!l.getProvider().equals(LocationHelper.LOCATION_PREDICTOR_PROVIDER))
|
||||
mLocationPredictor.reset(l);
|
||||
|
||||
nativeLocationUpdated(
|
||||
mMapFragment.nativeLocationUpdated(
|
||||
l.getTime(),
|
||||
l.getLatitude(),
|
||||
l.getLongitude(),
|
||||
|
@ -1071,7 +898,7 @@ public class MWMActivity extends NvEventQueueActivity
|
|||
trueNorth = LocationUtils.correctCompassAngle(rotation, trueNorth);
|
||||
final double north = (trueNorth >= 0.0) ? trueNorth : magneticNorth;
|
||||
|
||||
nativeCompassUpdated(time, magneticNorth, trueNorth, accuracy);
|
||||
mMapFragment.nativeCompassUpdated(time, magneticNorth, trueNorth, accuracy);
|
||||
if (mPlacePage.getState() != State.HIDDEN)
|
||||
mPlacePage.refreshAzimuth(north);
|
||||
}
|
||||
|
@ -1181,7 +1008,7 @@ public class MWMActivity extends NvEventQueueActivity
|
|||
if (available && writeable)
|
||||
{
|
||||
// Add local maps to the model
|
||||
nativeStorageConnected();
|
||||
mMapFragment.nativeStorageConnected();
|
||||
|
||||
// @TODO enable downloader button and dismiss blocking popup
|
||||
|
||||
|
@ -1191,7 +1018,7 @@ public class MWMActivity extends NvEventQueueActivity
|
|||
else if (available)
|
||||
{
|
||||
// Add local maps to the model
|
||||
nativeStorageConnected();
|
||||
mMapFragment.nativeStorageConnected();
|
||||
|
||||
// @TODO disable downloader button and dismiss blocking popup
|
||||
|
||||
|
@ -1201,7 +1028,7 @@ public class MWMActivity extends NvEventQueueActivity
|
|||
else
|
||||
{
|
||||
// Remove local maps from the model
|
||||
nativeStorageDisconnected();
|
||||
mMapFragment.nativeStorageDisconnected();
|
||||
|
||||
// @TODO enable downloader button and show blocking popup
|
||||
|
||||
|
@ -1465,24 +1292,6 @@ public class MWMActivity extends NvEventQueueActivity
|
|||
}
|
||||
}
|
||||
|
||||
private native void nativeStorageConnected();
|
||||
|
||||
private native void nativeStorageDisconnected();
|
||||
|
||||
private native void nativeConnectDownloadButton();
|
||||
|
||||
private native void nativeDownloadCountry(MapStorage.Index index, int options);
|
||||
|
||||
private native void nativeOnLocationError(int errorCode);
|
||||
|
||||
private native void nativeLocationUpdated(long time, double lat, double lon, float accuracy, double altitude, float speed, float bearing);
|
||||
|
||||
private native void nativeCompassUpdated(long time, double magneticNorth, double trueNorth, double accuracy);
|
||||
|
||||
private native boolean nativeIsInChina(double lat, double lon);
|
||||
|
||||
public native boolean showMapForUrl(String url);
|
||||
|
||||
@Override
|
||||
public void onPreviewVisibilityChanged(boolean isVisible)
|
||||
{
|
||||
|
@ -1523,6 +1332,24 @@ public class MWMActivity extends NvEventQueueActivity
|
|||
case R.id.rl__routing_go:
|
||||
followRoute();
|
||||
break;
|
||||
case R.id.map_button_plus:
|
||||
mMapFragment.nativeScale(3.0 / 2);
|
||||
break;
|
||||
case R.id.map_button_minus:
|
||||
mMapFragment.nativeScale(2 / 3.0);
|
||||
break;
|
||||
case R.id.btn__more:
|
||||
setVerticalToolbarVisible(true);
|
||||
break;
|
||||
case R.id.btn__search:
|
||||
showSearchIfUpdated();
|
||||
break;
|
||||
case R.id.btn__bookmarks:
|
||||
showBookmarks();
|
||||
break;
|
||||
case R.id.btn__myposition:
|
||||
switchNextLocationState();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -1567,7 +1394,7 @@ public class MWMActivity extends NvEventQueueActivity
|
|||
|
||||
private void showRoutingDisclaimer()
|
||||
{
|
||||
new AlertDialog.Builder(getActivity())
|
||||
new AlertDialog.Builder(this)
|
||||
.setMessage(getString(R.string.routing_disclaimer))
|
||||
.setCancelable(false)
|
||||
.setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener()
|
||||
|
@ -1605,6 +1432,12 @@ public class MWMActivity extends NvEventQueueActivity
|
|||
Framework.nativeCloseRouting();
|
||||
}
|
||||
|
||||
private void switchNextLocationState()
|
||||
{
|
||||
final LocationState state = LocationState.INSTANCE;
|
||||
state.switchToNextMode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTouch(View view, MotionEvent event)
|
||||
{
|
||||
|
@ -1621,12 +1454,13 @@ public class MWMActivity extends NvEventQueueActivity
|
|||
hideInfoView();
|
||||
result = true;
|
||||
}
|
||||
result |= super.onTouch(view, event);
|
||||
// TODO pass fragment touch
|
||||
result |= mMapFragment.onTouch(view, event);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onKeyUp(int keyCode, KeyEvent event)
|
||||
public boolean onKeyUp(int keyCode, @NonNull KeyEvent event)
|
||||
{
|
||||
if (keyCode == KeyEvent.KEYCODE_MENU)
|
||||
{
|
||||
|
@ -1756,7 +1590,7 @@ public class MWMActivity extends NvEventQueueActivity
|
|||
@Override
|
||||
public boolean run(MWMActivity target)
|
||||
{
|
||||
return target.showMapForUrl(mUrl);
|
||||
return target.mMapFragment.showMapForUrl(mUrl);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
141
android/src/com/mapswithme/maps/MapFragment.java
Normal file
141
android/src/com/mapswithme/maps/MapFragment.java
Normal file
|
@ -0,0 +1,141 @@
|
|||
package com.mapswithme.maps;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.mapswithme.maps.downloader.DownloadHelper;
|
||||
import com.nvidia.devtech.NvEventQueueFragment;
|
||||
|
||||
public class MapFragment extends NvEventQueueFragment
|
||||
{
|
||||
public interface MapRenderingListener
|
||||
{
|
||||
void onRenderingInitialized();
|
||||
}
|
||||
|
||||
public static final String FRAGMENT_TAG = MapFragment.class.getSimpleName();
|
||||
|
||||
private boolean mIsRenderingInitialized;
|
||||
|
||||
protected native void nativeStorageConnected();
|
||||
|
||||
protected native void nativeStorageDisconnected();
|
||||
|
||||
protected native void nativeConnectDownloadButton();
|
||||
|
||||
protected native void nativeDownloadCountry(MapStorage.Index index, int options);
|
||||
|
||||
protected native void nativeOnLocationError(int errorCode);
|
||||
|
||||
protected native void nativeLocationUpdated(long time, double lat, double lon, float accuracy, double altitude, float speed, float bearing);
|
||||
|
||||
protected native void nativeCompassUpdated(long time, double magneticNorth, double trueNorth, double accuracy);
|
||||
|
||||
protected native void nativeScale(double k);
|
||||
|
||||
public native boolean showMapForUrl(String url);
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
super.onCreate(savedInstanceState);
|
||||
setRetainInstance(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState)
|
||||
{
|
||||
return inflater.inflate(R.layout.fragment_map, container, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(View view, @Nullable Bundle savedInstanceState)
|
||||
{
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
nativeConnectDownloadButton();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStop()
|
||||
{
|
||||
super.onStop();
|
||||
mIsRenderingInitialized = false;
|
||||
}
|
||||
|
||||
public boolean isRenderingInitialized()
|
||||
{
|
||||
return mIsRenderingInitialized;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void OnRenderingInitialized()
|
||||
{
|
||||
mIsRenderingInitialized = true;
|
||||
|
||||
final Activity host = getActivity();
|
||||
if (host != null && host instanceof MapRenderingListener)
|
||||
{
|
||||
final MapRenderingListener listener = (MapRenderingListener) host;
|
||||
listener.onRenderingInitialized();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ReportUnsupported()
|
||||
{
|
||||
getActivity().runOnUiThread(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
new AlertDialog.Builder(getActivity())
|
||||
.setMessage(getString(R.string.unsupported_phone))
|
||||
.setCancelable(false)
|
||||
.setPositiveButton(getString(R.string.close), new DialogInterface.OnClickListener()
|
||||
{
|
||||
@Override
|
||||
public void onClick(DialogInterface dlg, int which)
|
||||
{
|
||||
getActivity().moveTaskToBack(true);
|
||||
dlg.dismiss();
|
||||
}
|
||||
})
|
||||
.create()
|
||||
.show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@SuppressWarnings("UnusedDeclaration")
|
||||
public void OnDownloadCountryClicked(final int group, final int country, final int region, final int options)
|
||||
{
|
||||
getActivity().runOnUiThread(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
final MapStorage.Index index = new MapStorage.Index(group, country, region);
|
||||
if (options == -1)
|
||||
nativeDownloadCountry(index, options);
|
||||
else
|
||||
{
|
||||
long size = MapStorage.INSTANCE.countryRemoteSizeInBytes(index, options);
|
||||
DownloadHelper.downloadWithCellularCheck(getActivity(), size, MapStorage.INSTANCE.countryName(index), new DownloadHelper.OnDownloadListener()
|
||||
{
|
||||
@Override
|
||||
public void onDownload()
|
||||
{
|
||||
nativeDownloadCountry(index, options);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
39
android/src/com/mapswithme/maps/base/MWMFragment.java
Normal file
39
android/src/com/mapswithme/maps/base/MWMFragment.java
Normal file
|
@ -0,0 +1,39 @@
|
|||
package com.mapswithme.maps.base;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
|
||||
public class MWMFragment extends Fragment
|
||||
{
|
||||
@Override
|
||||
public void onCreate(Bundle arg0)
|
||||
{
|
||||
super.onCreate(arg0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart()
|
||||
{
|
||||
super.onStart();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStop()
|
||||
{
|
||||
super.onStop();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume()
|
||||
{
|
||||
super.onResume();
|
||||
org.alohalytics.Statistics.logEvent("$onResume", this.getClass().getSimpleName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause()
|
||||
{
|
||||
super.onPause();
|
||||
org.alohalytics.Statistics.logEvent("$onPause", this.getClass().getSimpleName());
|
||||
}
|
||||
}
|
|
@ -8,6 +8,7 @@ import android.view.MenuItem;
|
|||
import android.view.inputmethod.InputMethodManager;
|
||||
|
||||
import com.mapswithme.maps.MWMApplication;
|
||||
import com.mapswithme.util.Utils;
|
||||
import com.mapswithme.util.statistics.Statistics;
|
||||
|
||||
import ru.mail.mrgservice.MRGService;
|
||||
|
@ -17,6 +18,12 @@ public class MWMFragmentActivity extends ActionBarActivity
|
|||
@Override
|
||||
protected void onCreate(Bundle arg0)
|
||||
{
|
||||
// Use full-screen on Kindle Fire only
|
||||
if (Utils.isAmazonDevice())
|
||||
{
|
||||
getWindow().addFlags(android.view.WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||
getWindow().clearFlags(android.view.WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
|
||||
}
|
||||
super.onCreate(arg0);
|
||||
|
||||
MWMApplication.get().initStats();
|
||||
|
|
|
@ -226,7 +226,7 @@ class DownloadChunkTask extends AsyncTask<Void, byte[], Boolean>
|
|||
return false;
|
||||
} finally
|
||||
{
|
||||
//Log.i(TAG, "End downloading chunk " + getChunkID());
|
||||
//Log.i(FRAGMENT_TAG, "End downloading chunk " + getChunkID());
|
||||
|
||||
if (urlConnection != null)
|
||||
urlConnection.disconnect();
|
||||
|
|
|
@ -134,7 +134,7 @@ public class StoragePathManager
|
|||
|
||||
public void updateExternalStorages()
|
||||
{
|
||||
ArrayList<String> paths = new ArrayList<String>();
|
||||
ArrayList<String> paths = new ArrayList<>();
|
||||
|
||||
if (Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT)
|
||||
parseKitkatStorages(paths);
|
||||
|
@ -247,17 +247,17 @@ public class StoragePathManager
|
|||
|
||||
public boolean moveBookmarks()
|
||||
{
|
||||
ArrayList<String> pathes = new ArrayList<String>();
|
||||
ArrayList<String> paths = new ArrayList<>();
|
||||
if (Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT)
|
||||
parseStorages(pathes);
|
||||
parseStorages(paths);
|
||||
|
||||
ArrayList<String> approvedPathes = new ArrayList<String>();
|
||||
for (String path : pathes)
|
||||
ArrayList<String> approvedPaths = new ArrayList<>();
|
||||
for (String path : paths)
|
||||
{
|
||||
String mwmPath = path + Constants.MWM_DIR_POSTFIX;
|
||||
File f = new File(mwmPath);
|
||||
if (f.exists() || f.canRead() || f.isDirectory())
|
||||
approvedPathes.add(mwmPath);
|
||||
approvedPaths.add(mwmPath);
|
||||
}
|
||||
final String settingsDir = Framework.nativeGetSettingsDir();
|
||||
final String writableDir = Framework.nativeGetWritableDir();
|
||||
|
@ -266,9 +266,9 @@ public class StoragePathManager
|
|||
|
||||
LinkedHashSet<File> bookmarks = new LinkedHashSet<File>();
|
||||
if (!settingsDir.equals(writableDir))
|
||||
approvedPathes.add(writableDir);
|
||||
approvedPaths.add(writableDir);
|
||||
|
||||
for (String path : approvedPathes)
|
||||
for (String path : approvedPaths)
|
||||
{
|
||||
if (!path.equals(settingsDir))
|
||||
accumulateFiles(path, bookmarkFileExt, bookmarks);
|
||||
|
|
|
@ -357,6 +357,20 @@ public final class UiUtils
|
|||
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
|
||||
}
|
||||
|
||||
public static void showAlertDialog(Activity activity, int titleId)
|
||||
{
|
||||
new AlertDialog.Builder(activity)
|
||||
.setCancelable(false)
|
||||
.setMessage(titleId)
|
||||
.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener()
|
||||
{
|
||||
@Override
|
||||
public void onClick(DialogInterface dlg, int which) { dlg.dismiss(); }
|
||||
})
|
||||
.create()
|
||||
.show();
|
||||
}
|
||||
|
||||
// utility class
|
||||
private UiUtils()
|
||||
{}
|
||||
|
|
|
@ -169,7 +169,7 @@ public class Egl10Wrapper extends BaseEglWrapper
|
|||
{
|
||||
if (holder == null)
|
||||
{
|
||||
LogIt("createEGLSurface failed, m_cachedSurfaceHolder is null");
|
||||
LogIt("createEGLSurface failed, mCachedSurfaceHolder is null");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -156,7 +156,7 @@ public class Egl14Wrapper extends BaseEglWrapper
|
|||
{
|
||||
if (holder == null)
|
||||
{
|
||||
LogIt("createEGLSurface failed, m_cachedSurfaceHolder is null");
|
||||
LogIt("createEGLSurface failed, mCachedSurfaceHolder is null");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,56 +1,48 @@
|
|||
package com.nvidia.devtech;
|
||||
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.SurfaceHolder;
|
||||
import android.view.SurfaceHolder.Callback;
|
||||
import android.view.SurfaceView;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.mapswithme.maps.R;
|
||||
import com.mapswithme.maps.base.MWMFragmentActivity;
|
||||
import com.mapswithme.maps.base.MWMFragment;
|
||||
import com.mapswithme.util.log.Logger;
|
||||
import com.mapswithme.util.log.StubLogger;
|
||||
|
||||
public abstract class NvEventQueueActivity extends MWMFragmentActivity implements View.OnTouchListener
|
||||
public abstract class NvEventQueueFragment extends MWMFragment implements View.OnTouchListener, View.OnFocusChangeListener
|
||||
{
|
||||
private static final String TAG = "NvEventQueueActivity";
|
||||
private static final String TAG = NvEventQueueFragment.class.getSimpleName();
|
||||
|
||||
private final Logger mLog = StubLogger.get();
|
||||
|
||||
private EglWrapper mEglWrapper = null;
|
||||
protected SurfaceHolder m_cachedSurfaceHolder = null;
|
||||
private int m_surfaceWidth = 0;
|
||||
private int m_surfaceHeight = 0;
|
||||
private EglWrapper mEglWrapper;
|
||||
protected SurfaceHolder mCachedSurfaceHolder;
|
||||
private int mSurfaceWidth;
|
||||
private int mSurfaceHeight;
|
||||
|
||||
private int m_displayDensity = 0;
|
||||
private int mDisplayDensity;
|
||||
|
||||
private int m_fixedWidth = 0;
|
||||
private int m_fixedHeight = 0;
|
||||
private boolean mIsNativeLaunched;
|
||||
|
||||
private boolean m_nativeLaunched = false;
|
||||
|
||||
public void setFixedSize(int fw, int fh)
|
||||
{
|
||||
m_fixedWidth = fw;
|
||||
m_fixedHeight = fh;
|
||||
}
|
||||
|
||||
public int getDisplayDensity()
|
||||
{
|
||||
return m_displayDensity;
|
||||
}
|
||||
private int mLastPointerId;
|
||||
|
||||
public int getSurfaceWidth()
|
||||
{
|
||||
return m_surfaceWidth;
|
||||
return mSurfaceWidth;
|
||||
}
|
||||
|
||||
public int getSurfaceHeight()
|
||||
{
|
||||
return m_surfaceHeight;
|
||||
return mSurfaceHeight;
|
||||
}
|
||||
|
||||
protected native boolean onCreateNative();
|
||||
|
@ -78,99 +70,95 @@ public abstract class NvEventQueueActivity extends MWMFragmentActivity implement
|
|||
public native boolean multiTouchEvent(int action, boolean hasFirst,
|
||||
boolean hasSecond, int x0, int y0, int x1, int y1, MotionEvent event);
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
final SurfaceView surfaceView = (SurfaceView) findViewById(R.id.map_surfaceview);
|
||||
final DisplayMetrics metrics = new DisplayMetrics();
|
||||
getActivity().getWindowManager().getDefaultDisplay().getMetrics(metrics);
|
||||
mDisplayDensity = metrics.densityDpi;
|
||||
mIsNativeLaunched = true;
|
||||
onCreateNative();
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState)
|
||||
{
|
||||
return super.onCreateView(inflater, container, savedInstanceState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(View view, @Nullable Bundle savedInstanceState)
|
||||
{
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
final SurfaceView surfaceView = (SurfaceView) view.findViewById(R.id.map_surfaceview);
|
||||
surfaceView.setOnFocusChangeListener(this);
|
||||
surfaceView.setOnTouchListener(this);
|
||||
|
||||
final SurfaceHolder holder = surfaceView.getHolder();
|
||||
holder.setType(SurfaceHolder.SURFACE_TYPE_GPU);
|
||||
|
||||
final DisplayMetrics metrics = new DisplayMetrics();
|
||||
getWindowManager().getDefaultDisplay().getMetrics(metrics);
|
||||
m_displayDensity = metrics.densityDpi;
|
||||
|
||||
holder.addCallback(new Callback()
|
||||
{
|
||||
@Override
|
||||
public void surfaceCreated(SurfaceHolder holder)
|
||||
{
|
||||
m_cachedSurfaceHolder = holder;
|
||||
if (m_fixedWidth != 0 && m_fixedHeight != 0)
|
||||
holder.setFixedSize(m_fixedWidth, m_fixedHeight);
|
||||
onSurfaceCreatedNative(m_surfaceWidth, m_surfaceHeight, getDisplayDensity());
|
||||
mCachedSurfaceHolder = holder;
|
||||
onSurfaceCreatedNative(mSurfaceWidth, mSurfaceHeight, mDisplayDensity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void surfaceChanged(SurfaceHolder holder, int format, int width, int height)
|
||||
{
|
||||
m_cachedSurfaceHolder = holder;
|
||||
m_surfaceWidth = width;
|
||||
m_surfaceHeight = height;
|
||||
onSurfaceChangedNative(m_surfaceWidth, m_surfaceHeight, getDisplayDensity());
|
||||
mCachedSurfaceHolder = holder;
|
||||
mSurfaceWidth = width;
|
||||
mSurfaceHeight = height;
|
||||
onSurfaceChangedNative(mSurfaceWidth, mSurfaceHeight, mDisplayDensity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void surfaceDestroyed(SurfaceHolder holder)
|
||||
{
|
||||
m_cachedSurfaceHolder = null;
|
||||
mCachedSurfaceHolder = null;
|
||||
onSurfaceDestroyedNative();
|
||||
}
|
||||
});
|
||||
|
||||
m_nativeLaunched = true;
|
||||
onCreateNative();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart()
|
||||
public void onStart()
|
||||
{
|
||||
super.onStart();
|
||||
if (m_nativeLaunched)
|
||||
onStartNative();
|
||||
onStartNative();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onRestart()
|
||||
{
|
||||
super.onRestart();
|
||||
if (m_nativeLaunched)
|
||||
onRestartNative();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume()
|
||||
public void onResume()
|
||||
{
|
||||
super.onResume();
|
||||
if (m_nativeLaunched)
|
||||
onResumeNative();
|
||||
onResumeNative();
|
||||
onFocusChangedNative(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWindowFocusChanged(boolean hasFocus)
|
||||
public void onFocusChange(View v, boolean hasFocus)
|
||||
{
|
||||
if (m_nativeLaunched)
|
||||
onFocusChangedNative(hasFocus);
|
||||
super.onWindowFocusChanged(hasFocus);
|
||||
onFocusChangedNative(hasFocus);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause()
|
||||
public void onPause()
|
||||
{
|
||||
super.onPause();
|
||||
if (m_nativeLaunched)
|
||||
onPauseNative();
|
||||
onPauseNative();
|
||||
onFocusChangedNative(getActivity().hasWindowFocus());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop()
|
||||
public void onStop()
|
||||
{
|
||||
super.onStop();
|
||||
if (m_nativeLaunched)
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB || !getActivity().isChangingConfigurations())
|
||||
// if configuration is changed - EGL shouldn't be reinitialized
|
||||
onStopNative();
|
||||
}
|
||||
|
||||
|
@ -178,29 +166,25 @@ public abstract class NvEventQueueActivity extends MWMFragmentActivity implement
|
|||
public void onDestroy()
|
||||
{
|
||||
super.onDestroy();
|
||||
if (m_nativeLaunched)
|
||||
{
|
||||
onDestroyNative();
|
||||
CleanupEGL();
|
||||
}
|
||||
onStopNative();
|
||||
onDestroyNative();
|
||||
CleanupEGL();
|
||||
}
|
||||
|
||||
private int m_lastPointerId = 0;
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onTouch(View v, MotionEvent event)
|
||||
{
|
||||
// TODO refactor ?
|
||||
final int count = event.getPointerCount();
|
||||
|
||||
if (!m_nativeLaunched || count == 0)
|
||||
return super.onTouchEvent(event);
|
||||
if (!mIsNativeLaunched || count == 0)
|
||||
return false;
|
||||
|
||||
switch (count)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
m_lastPointerId = event.getPointerId(0);
|
||||
mLastPointerId = event.getPointerId(0);
|
||||
|
||||
final int x0 = (int) event.getX();
|
||||
final int y0 = (int) event.getY();
|
||||
|
@ -215,7 +199,7 @@ public abstract class NvEventQueueActivity extends MWMFragmentActivity implement
|
|||
final int x1 = (int) event.getX(1);
|
||||
final int y1 = (int) event.getY(1);
|
||||
|
||||
if (event.getPointerId(0) == m_lastPointerId)
|
||||
if (event.getPointerId(0) == mLastPointerId)
|
||||
return multiTouchEvent(event.getAction(), true, true,
|
||||
x0, y0, x1, y1, event);
|
||||
else
|
||||
|
@ -230,6 +214,7 @@ public abstract class NvEventQueueActivity extends MWMFragmentActivity implement
|
|||
*
|
||||
* @return True if successful
|
||||
*/
|
||||
@SuppressWarnings("UnusedDeclaration")
|
||||
protected boolean InitEGL()
|
||||
{
|
||||
mEglWrapper = EglWrapper.GetEgl(mLog);
|
||||
|
@ -237,21 +222,22 @@ public abstract class NvEventQueueActivity extends MWMFragmentActivity implement
|
|||
}
|
||||
|
||||
/**
|
||||
* Called to clean up m_egl. This function should not be called by the
|
||||
* inheriting activity, but can be overridden if needed.
|
||||
* Called to clean up EGL. This function should not be called by the
|
||||
* inheriting fragment, but can be overridden if needed.
|
||||
*/
|
||||
protected boolean CleanupEGL()
|
||||
{
|
||||
return mEglWrapper != null && mEglWrapper.TerminateEGL();
|
||||
}
|
||||
|
||||
@SuppressWarnings("UnusedDeclaration")
|
||||
protected boolean CreateSurfaceEGL()
|
||||
{
|
||||
if (!mEglWrapper.CreateSurfaceEGL(m_cachedSurfaceHolder))
|
||||
if (!mEglWrapper.CreateSurfaceEGL(mCachedSurfaceHolder))
|
||||
return false;
|
||||
|
||||
m_surfaceHeight = mEglWrapper.GetSurfaceHeight();
|
||||
m_surfaceWidth = mEglWrapper.GetSurfaceWidth();
|
||||
mSurfaceHeight = mEglWrapper.GetSurfaceHeight();
|
||||
mSurfaceWidth = mEglWrapper.GetSurfaceWidth();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -259,37 +245,49 @@ public abstract class NvEventQueueActivity extends MWMFragmentActivity implement
|
|||
* Destroys the EGLSurface used for rendering. This function should not be
|
||||
* called by the inheriting activity, but can be overridden if needed.
|
||||
*/
|
||||
@SuppressWarnings("UnusedDeclaration")
|
||||
protected boolean DestroySurfaceEGL()
|
||||
{
|
||||
return mEglWrapper.DestroySurfaceEGL();
|
||||
}
|
||||
|
||||
@SuppressWarnings("UnusedDeclaration")
|
||||
public boolean BindSurfaceAndContextEGL()
|
||||
{
|
||||
return mEglWrapper.Bind();
|
||||
}
|
||||
|
||||
@SuppressWarnings("UnusedDeclaration")
|
||||
public boolean UnbindSurfaceAndContextEGL()
|
||||
{
|
||||
return mEglWrapper.Unbind();
|
||||
}
|
||||
|
||||
@SuppressWarnings("UnusedDeclaration")
|
||||
public boolean SwapBuffersEGL()
|
||||
{
|
||||
return mEglWrapper.SwapBuffersEGL();
|
||||
}
|
||||
|
||||
@SuppressWarnings("UnusedDeclaration")
|
||||
public int GetErrorEGL()
|
||||
{
|
||||
return mEglWrapper.GetErrorEGL();
|
||||
}
|
||||
|
||||
public void OnRenderingInitialized()
|
||||
{
|
||||
}
|
||||
@SuppressWarnings("UnusedDeclaration")
|
||||
public void OnRenderingInitialized() {}
|
||||
|
||||
@SuppressWarnings("UnusedDeclaration")
|
||||
public void ReportUnsupported()
|
||||
{
|
||||
Log.i(TAG, "this phone GPU is unsupported");
|
||||
}
|
||||
|
||||
@SuppressWarnings("UnusedDeclaration")
|
||||
public void finish()
|
||||
{
|
||||
if (isAdded())
|
||||
getActivity().finish();
|
||||
}
|
||||
}
|
|
@ -40,7 +40,7 @@ public class MapActivityTest extends ActivityInstrumentationTestCase2<MWMActivit
|
|||
solo.waitForActivity(SearchActivity.class, TIME_OUT);
|
||||
solo.getActivityMonitor().getLastActivity().finish();
|
||||
|
||||
solo.clickOnView(activity.findViewById(R.id.map_button_myposition));
|
||||
solo.clickOnView(activity.findViewById(R.id.btn__myposition));
|
||||
|
||||
// check zoom in/out doesn't crash us
|
||||
int randomNumderOfClicks = new Random().nextInt(10) + 5;
|
||||
|
|
Loading…
Add table
Reference in a new issue