forked from organicmaps/organicmaps
The Great Reformatting.
This commit is contained in:
parent
1740f54723
commit
a1067f7e25
47 changed files with 441 additions and 386 deletions
|
@ -15,7 +15,8 @@
|
|||
<com.mapswithme.maps.widget.ArrowView
|
||||
android:id="@+id/av_direction"
|
||||
android:layout_width="@dimen/margin_large"
|
||||
android:layout_height="@dimen/margin_large"/>
|
||||
android:layout_height="@dimen/margin_large"
|
||||
android:layout_marginRight="@dimen/margin_small"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/info_box_geo_distance"
|
||||
|
@ -23,7 +24,6 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginLeft="@dimen/margin_small"
|
||||
android:fontFamily="@string/robotoRegular"
|
||||
android:textColor="@android:color/white"/>
|
||||
</LinearLayout>
|
||||
|
|
|
@ -18,6 +18,7 @@ public class LocationButtonImageSetter
|
|||
}
|
||||
|
||||
private final static Map<ButtonState, Integer> STATE_TO_RES = new HashMap<ButtonState, Integer>();
|
||||
|
||||
static
|
||||
{
|
||||
STATE_TO_RES.put(ButtonState.NO_LOCATION, R.drawable.ic_my_position);
|
||||
|
@ -34,7 +35,7 @@ public class LocationButtonImageSetter
|
|||
button.setImageDrawable(draw);
|
||||
|
||||
if (draw instanceof AnimationDrawable)
|
||||
((AnimationDrawable)draw).start();
|
||||
((AnimationDrawable) draw).start();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -14,30 +14,38 @@ public class LocationState
|
|||
public static final int COMPASS_FOLLOW = 1;
|
||||
|
||||
public native int getCompassProcessMode();
|
||||
|
||||
public native void setCompassProcessMode(int mode);
|
||||
|
||||
public native int getLocationProcessMode();
|
||||
|
||||
public native void setLocationProcessMode(int mode);
|
||||
|
||||
public native void startCompassFollowing();
|
||||
|
||||
public native void stopCompassFollowing();
|
||||
|
||||
public native void stopCompassFollowingAndRotateMap();
|
||||
|
||||
public native int addCompassStatusListener(Object l);
|
||||
|
||||
public native void removeCompassStatusListener(int slotID);
|
||||
|
||||
public native void onStartLocation();
|
||||
|
||||
public native void onStopLocation();
|
||||
|
||||
public native boolean hasPosition();
|
||||
|
||||
public native boolean hasCompass();
|
||||
|
||||
public native boolean isFirstPosition();
|
||||
|
||||
public native boolean isCentered();
|
||||
|
||||
public native void animateToPositionAndEnqueueLocationProcessMode(int mode);
|
||||
|
||||
public native void turnOff();
|
||||
|
||||
public native boolean isVisible();
|
||||
}
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
package com.mapswithme.maps;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.pm.PackageManager.NameNotFoundException;
|
||||
import android.os.Build;
|
||||
import android.os.Environment;
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
import android.provider.Settings.Secure;
|
||||
|
||||
import com.google.android.gms.ads.identifier.AdvertisingIdClient;
|
||||
import com.google.android.gms.ads.identifier.AdvertisingIdClient.Info;
|
||||
import com.google.android.gms.common.GooglePlayServicesNotAvailableException;
|
||||
import com.google.android.gms.common.GooglePlayServicesRepairableException;
|
||||
import com.mapswithme.maps.MapStorage.Index;
|
||||
import com.mapswithme.maps.background.Notifier;
|
||||
import com.mapswithme.maps.bookmarks.data.BookmarkManager;
|
||||
|
@ -20,14 +21,9 @@ import com.mapswithme.util.FbUtil;
|
|||
import com.mapswithme.util.Utils;
|
||||
import com.mapswithme.util.log.Logger;
|
||||
import com.mapswithme.util.log.SimpleLogger;
|
||||
import com.mapswithme.util.log.StubLogger;
|
||||
import com.mobileapptracker.MobileAppTracker;
|
||||
|
||||
import com.google.android.gms.ads.identifier.AdvertisingIdClient;
|
||||
import com.google.android.gms.ads.identifier.AdvertisingIdClient.Info;
|
||||
import com.google.android.gms.common.GooglePlayServicesRepairableException;
|
||||
import com.google.android.gms.common.GooglePlayServicesNotAvailableException;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
public class MWMApplication extends android.app.Application implements MapStorage.Listener
|
||||
|
@ -135,7 +131,7 @@ public class MWMApplication extends android.app.Application implements MapStorag
|
|||
|
||||
// init native framework
|
||||
nativeInit(getApkPath(), extStoragePath, extTmpPath,
|
||||
getOBBGooglePath(), m_isPro, m_isYota);
|
||||
getOBBGooglePath(), m_isPro, m_isYota);
|
||||
|
||||
getMapStorage().subscribe(this);
|
||||
|
||||
|
@ -186,8 +182,7 @@ public class MWMApplication extends android.app.Application implements MapStorag
|
|||
try
|
||||
{
|
||||
return getPackageManager().getApplicationInfo(getPackageName(), 0).sourceDir;
|
||||
}
|
||||
catch (final NameNotFoundException e)
|
||||
} catch (final NameNotFoundException e)
|
||||
{
|
||||
Log.e(TAG, "Can't get apk path from PackageManager");
|
||||
return "";
|
||||
|
@ -229,6 +224,7 @@ public class MWMApplication extends android.app.Application implements MapStorag
|
|||
{
|
||||
return m_isPro;
|
||||
}
|
||||
|
||||
public boolean hasBookmarks()
|
||||
{
|
||||
return m_isPro || m_isYota;
|
||||
|
@ -265,11 +261,13 @@ public class MWMApplication extends android.app.Application implements MapStorag
|
|||
/// @{
|
||||
static public final int FACEBOOK = 0;
|
||||
static public final int BUYPRO = 1;
|
||||
|
||||
public native boolean shouldShowDialog(int dlg);
|
||||
|
||||
static public final int OK = 0;
|
||||
static public final int LATER = 1;
|
||||
static public final int NEVER = 2;
|
||||
|
||||
public native void submitDialogResult(int dlg, int res);
|
||||
/// @}
|
||||
|
||||
|
@ -277,13 +275,19 @@ public class MWMApplication extends android.app.Application implements MapStorag
|
|||
|
||||
/// Dealing with Settings
|
||||
public native boolean nativeGetBoolean(String name, boolean defaultValue);
|
||||
|
||||
public native void nativeSetBoolean(String name, boolean value);
|
||||
|
||||
public native int nativeGetInt(String name, int defaultValue);
|
||||
|
||||
public native void nativeSetInt(String name, int value);
|
||||
|
||||
public native long nativeGetLong(String name, long defaultValue);
|
||||
|
||||
public native void nativeSetLong(String name, long value);
|
||||
|
||||
public native double nativeGetDouble(String name, double defaultValue);
|
||||
|
||||
public native void nativeSetDouble(String name, double value);
|
||||
|
||||
public void onMwmStart(Activity activity)
|
||||
|
@ -294,7 +298,7 @@ public class MWMApplication extends android.app.Application implements MapStorag
|
|||
|
||||
private MobileAppTracker mMobileAppTracker = null;
|
||||
private final Logger mLogger = //StubLogger.get();
|
||||
SimpleLogger.get("MAT");
|
||||
SimpleLogger.get("MAT");
|
||||
|
||||
public void onMwmResume(Activity activity)
|
||||
{
|
||||
|
@ -342,7 +346,8 @@ public class MWMApplication extends android.app.Application implements MapStorag
|
|||
// Collect Google Play Advertising ID
|
||||
new Thread(new Runnable()
|
||||
{
|
||||
@Override public void run()
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
// See sample code at http://developer.android.com/google/play-services/id.html
|
||||
try
|
||||
|
@ -350,22 +355,19 @@ public class MWMApplication extends android.app.Application implements MapStorag
|
|||
Info adInfo = AdvertisingIdClient.getAdvertisingIdInfo(getApplicationContext());
|
||||
mMobileAppTracker.setGoogleAdvertisingId(adInfo.getId(), adInfo.isLimitAdTrackingEnabled());
|
||||
mLogger.d("Got Google User ID");
|
||||
}
|
||||
catch (IOException e)
|
||||
} catch (IOException e)
|
||||
{
|
||||
// Unrecoverable error connecting to Google Play services (e.g.,
|
||||
// the old version of the service doesn't support getting AdvertisingId).
|
||||
mLogger.d("IOException");
|
||||
}
|
||||
catch (GooglePlayServicesNotAvailableException e)
|
||||
} catch (GooglePlayServicesNotAvailableException e)
|
||||
{
|
||||
// Google Play services is not available entirely.
|
||||
// Use ANDROID_ID instead
|
||||
// AlexZ: we can't use Android ID from 1st of August, 2014, according to Google policies
|
||||
// mMobileAppTracker.setAndroidId(Secure.getString(getContentResolver(), Secure.ANDROID_ID));
|
||||
mLogger.d("GooglePlayServicesNotAvailableException");
|
||||
}
|
||||
catch (GooglePlayServicesRepairableException e)
|
||||
} catch (GooglePlayServicesRepairableException e)
|
||||
{
|
||||
// Encountered a recoverable error connecting to Google Play services.
|
||||
mLogger.d("GooglePlayServicesRepairableException");
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
package com.mapswithme.maps;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class MapStorage
|
||||
{
|
||||
public static final int GROUP = -2;
|
||||
|
@ -23,8 +23,11 @@ public class MapStorage
|
|||
public interface Listener
|
||||
{
|
||||
public void onCountryStatusChanged(Index idx);
|
||||
|
||||
public void onCountryProgress(Index idx, long current, long total);
|
||||
};
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
public static class Index implements Serializable
|
||||
{
|
||||
|
@ -68,7 +71,7 @@ public class MapStorage
|
|||
ret.setCountry(position);
|
||||
else
|
||||
{
|
||||
assert(ret.getRegion() == -1);
|
||||
assert (ret.getRegion() == -1);
|
||||
ret.setRegion(position);
|
||||
}
|
||||
|
||||
|
@ -134,13 +137,19 @@ public class MapStorage
|
|||
}
|
||||
|
||||
public native int countriesCount(Index idx);
|
||||
|
||||
public native int countryStatus(Index idx);
|
||||
|
||||
public native long countryLocalSizeInBytes(Index idx);
|
||||
|
||||
public native long countryRemoteSizeInBytes(Index idx);
|
||||
|
||||
public native String countryName(Index idx);
|
||||
|
||||
public native String countryFlag(Index idx);
|
||||
|
||||
public native void downloadCountry(Index idx);
|
||||
|
||||
public native void deleteCountry(Index idx);
|
||||
|
||||
public native Index findIndexByFile(String name);
|
||||
|
@ -148,6 +157,7 @@ public class MapStorage
|
|||
public native void showCountry(Index idx);
|
||||
|
||||
public native int subscribe(Listener l);
|
||||
|
||||
public native void unsubscribe(int slotId);
|
||||
|
||||
private native String[] nativeGetMapsWithoutSearch();
|
||||
|
@ -169,6 +179,7 @@ public class MapStorage
|
|||
public interface UpdateFunctor
|
||||
{
|
||||
public void doUpdate();
|
||||
|
||||
public void doCancel();
|
||||
}
|
||||
|
||||
|
@ -211,31 +222,31 @@ public class MapStorage
|
|||
}
|
||||
|
||||
new AlertDialog.Builder(context)
|
||||
.setMessage(msg)
|
||||
.setPositiveButton(context.getString(R.string.download), new DialogInterface.OnClickListener()
|
||||
{
|
||||
@Override
|
||||
public void onClick(DialogInterface dlg, int which)
|
||||
{
|
||||
dlg.dismiss();
|
||||
.setMessage(msg)
|
||||
.setPositiveButton(context.getString(R.string.download), new DialogInterface.OnClickListener()
|
||||
{
|
||||
@Override
|
||||
public void onClick(DialogInterface dlg, int which)
|
||||
{
|
||||
dlg.dismiss();
|
||||
|
||||
runDownloadCountries(indexes);
|
||||
runDownloadCountries(indexes);
|
||||
|
||||
fn.doUpdate();
|
||||
}
|
||||
})
|
||||
.setNegativeButton(context.getString(R.string.later), new DialogInterface.OnClickListener()
|
||||
{
|
||||
@Override
|
||||
public void onClick(DialogInterface dlg, int which)
|
||||
{
|
||||
dlg.dismiss();
|
||||
fn.doUpdate();
|
||||
}
|
||||
})
|
||||
.setNegativeButton(context.getString(R.string.later), new DialogInterface.OnClickListener()
|
||||
{
|
||||
@Override
|
||||
public void onClick(DialogInterface dlg, int which)
|
||||
{
|
||||
dlg.dismiss();
|
||||
|
||||
fn.doCancel();
|
||||
}
|
||||
})
|
||||
.create()
|
||||
.show();
|
||||
fn.doCancel();
|
||||
}
|
||||
})
|
||||
.create()
|
||||
.show();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -3,57 +3,59 @@ package com.mapswithme.maps;
|
|||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
public class VideoTimer {
|
||||
public class VideoTimer
|
||||
{
|
||||
|
||||
private static String TAG = "VideoTimer";
|
||||
|
||||
Timer m_timer;
|
||||
|
||||
private native void nativeInit();
|
||||
private native void nativeRun();
|
||||
|
||||
|
||||
public class VideoTimerTask extends TimerTask {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
nativeRun();
|
||||
}
|
||||
}
|
||||
|
||||
VideoTimerTask m_timerTask;
|
||||
int m_interval;
|
||||
|
||||
public VideoTimer()
|
||||
{
|
||||
m_interval = 1000 / 60;
|
||||
nativeInit();
|
||||
}
|
||||
|
||||
void start()
|
||||
{
|
||||
m_timerTask = new VideoTimerTask();
|
||||
m_timer = new Timer("VideoTimer");
|
||||
m_timer.scheduleAtFixedRate(m_timerTask, 0, m_interval);
|
||||
}
|
||||
|
||||
void resume()
|
||||
{
|
||||
m_timerTask = new VideoTimerTask();
|
||||
m_timer = new Timer("VideoTimer");
|
||||
m_timer.scheduleAtFixedRate(m_timerTask, 0, m_interval);
|
||||
}
|
||||
|
||||
void pause()
|
||||
{
|
||||
m_timer.cancel();
|
||||
// m_timer.purge();
|
||||
}
|
||||
|
||||
void stop()
|
||||
{
|
||||
m_timer.cancel();
|
||||
// m_timer.purge();
|
||||
}
|
||||
private static String TAG = "VideoTimer";
|
||||
|
||||
Timer m_timer;
|
||||
|
||||
private native void nativeInit();
|
||||
|
||||
private native void nativeRun();
|
||||
|
||||
|
||||
public class VideoTimerTask extends TimerTask
|
||||
{
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
nativeRun();
|
||||
}
|
||||
}
|
||||
|
||||
VideoTimerTask m_timerTask;
|
||||
int m_interval;
|
||||
|
||||
public VideoTimer()
|
||||
{
|
||||
m_interval = 1000 / 60;
|
||||
nativeInit();
|
||||
}
|
||||
|
||||
void start()
|
||||
{
|
||||
m_timerTask = new VideoTimerTask();
|
||||
m_timer = new Timer("VideoTimer");
|
||||
m_timer.scheduleAtFixedRate(m_timerTask, 0, m_interval);
|
||||
}
|
||||
|
||||
void resume()
|
||||
{
|
||||
m_timerTask = new VideoTimerTask();
|
||||
m_timer = new Timer("VideoTimer");
|
||||
m_timer.scheduleAtFixedRate(m_timerTask, 0, m_interval);
|
||||
}
|
||||
|
||||
void pause()
|
||||
{
|
||||
m_timer.cancel();
|
||||
}
|
||||
|
||||
void stop()
|
||||
{
|
||||
m_timer.cancel();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package com.mapswithme.maps.api;
|
||||
|
||||
public class Const
|
||||
|
@ -6,7 +5,7 @@ public class Const
|
|||
|
||||
/* Request extras */
|
||||
static final String AUTHORITY = "com.mapswithme.maps.api";
|
||||
public static final String EXTRA_URL = AUTHORITY + ".url";
|
||||
public static final String EXTRA_URL = AUTHORITY + ".url";
|
||||
public static final String EXTRA_TITLE = AUTHORITY + ".title";
|
||||
public static final String EXTRA_API_VERSION = AUTHORITY + ".version";
|
||||
public static final String EXTRA_CALLER_APP_INFO = AUTHORITY + ".caller_app_info";
|
||||
|
|
|
@ -35,19 +35,26 @@ public class ParsedMmwRequest
|
|||
private double mZoomLevel;
|
||||
|
||||
|
||||
public double getLat() { return mLat; }
|
||||
public double getLon() { return mLon; }
|
||||
public String getName() { return mName;}
|
||||
public double getLat() { return mLat; }
|
||||
|
||||
public double getLon() { return mLon; }
|
||||
|
||||
public String getName() { return mName;}
|
||||
|
||||
public boolean isPickPointMode() { return mPickPoint; }
|
||||
|
||||
public boolean hasCustomButtonName() { return !TextUtils.isEmpty(mCustomButtonName); }
|
||||
public String getCustomButtonName() { return mCustomButtonName; }
|
||||
|
||||
public String getCustomButtonName() { return mCustomButtonName; }
|
||||
|
||||
private String mName;
|
||||
private String mId;
|
||||
|
||||
public static ParsedMmwRequest getCurrentRequest() { return sCurrentRequest; }
|
||||
public static boolean hasRequest() { return sCurrentRequest != null; }
|
||||
public static void setCurrentRequest(ParsedMmwRequest request) { sCurrentRequest = request; }
|
||||
public static ParsedMmwRequest getCurrentRequest() { return sCurrentRequest; }
|
||||
|
||||
public static boolean hasRequest() { return sCurrentRequest != null; }
|
||||
|
||||
public static void setCurrentRequest(ParsedMmwRequest request) { sCurrentRequest = request; }
|
||||
|
||||
public static ParsedMmwRequest extractFromIntent(Intent data, Context context)
|
||||
{
|
||||
|
@ -68,15 +75,26 @@ public class ParsedMmwRequest
|
|||
}
|
||||
|
||||
// Response data
|
||||
public ApplicationInfo getCallerInfo() { return mCallerInfo; }
|
||||
public boolean hasTitle() { return mTitle != null; }
|
||||
public String getTitle() { return mTitle; }
|
||||
public ApplicationInfo getCallerInfo()
|
||||
{
|
||||
return mCallerInfo;
|
||||
}
|
||||
|
||||
public boolean hasTitle() { return mTitle != null; }
|
||||
|
||||
public String getTitle() { return mTitle; }
|
||||
|
||||
// Request data
|
||||
public boolean hasPoint() { return mHasPoint; }
|
||||
public void setHasPoint(boolean hasPoint) { mHasPoint = hasPoint; }
|
||||
public boolean hasPendingIntent() { return mPendingIntent != null; }
|
||||
public boolean doReturnOnBalloonClick() { return mReturnOnBalloonClick; }
|
||||
public boolean hasPoint()
|
||||
{
|
||||
return mHasPoint;
|
||||
}
|
||||
|
||||
public void setHasPoint(boolean hasPoint) { mHasPoint = hasPoint; }
|
||||
|
||||
public boolean hasPendingIntent() { return mPendingIntent != null; }
|
||||
|
||||
public boolean doReturnOnBalloonClick() { return mReturnOnBalloonClick; }
|
||||
|
||||
public void setPointData(double lat, double lon, String name, String id)
|
||||
{
|
||||
|
@ -106,17 +124,16 @@ public class ParsedMmwRequest
|
|||
if (success)
|
||||
{
|
||||
i.putExtra(Const.EXTRA_MWM_RESPONSE_POINT_LAT, mLat)
|
||||
.putExtra(Const.EXTRA_MWM_RESPONSE_POINT_LON, mLon)
|
||||
.putExtra(Const.EXTRA_MWM_RESPONSE_POINT_NAME, mName)
|
||||
.putExtra(Const.EXTRA_MWM_RESPONSE_POINT_ID, mId)
|
||||
.putExtra(Const.EXTRA_MWM_RESPONSE_ZOOM, mZoomLevel);
|
||||
.putExtra(Const.EXTRA_MWM_RESPONSE_POINT_LON, mLon)
|
||||
.putExtra(Const.EXTRA_MWM_RESPONSE_POINT_NAME, mName)
|
||||
.putExtra(Const.EXTRA_MWM_RESPONSE_POINT_ID, mId)
|
||||
.putExtra(Const.EXTRA_MWM_RESPONSE_ZOOM, mZoomLevel);
|
||||
}
|
||||
try
|
||||
{
|
||||
mPendingIntent.send(context, success ? Activity.RESULT_OK : Activity.RESULT_CANCELED, i);
|
||||
return true;
|
||||
}
|
||||
catch (final Exception e)
|
||||
} catch (final Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -138,7 +155,8 @@ public class ParsedMmwRequest
|
|||
}
|
||||
|
||||
/**
|
||||
* Do not use constructor externally. Use {@link ParsedMmwRequest#extractFromIntent(Intent, Context)} instead.
|
||||
* Do not use constructor externally. Use {@link ParsedMmwRequest#extractFromIntent(Intent, Context)} instead.
|
||||
*/
|
||||
private ParsedMmwRequest() {}
|
||||
private ParsedMmwRequest()
|
||||
{}
|
||||
}
|
||||
|
|
|
@ -16,8 +16,8 @@ import com.mapswithme.maps.guides.GuidesUtils;
|
|||
public class Notifier
|
||||
{
|
||||
private final static int ID_UPDATE_AVAIL = 0x1;
|
||||
private final static int ID_GUIDE_AVAIL = 0x2;
|
||||
private final static int ID_DOWNLOAD_STATUS = 0x3;
|
||||
private final static int ID_GUIDE_AVAIL = 0x2;
|
||||
private final static int ID_DOWNLOAD_STATUS = 0x3;
|
||||
|
||||
private final NotificationManager mNotificationManager;
|
||||
private final Context mContext;
|
||||
|
@ -81,8 +81,8 @@ public class Notifier
|
|||
public NotificationCompat.Builder getBuilder()
|
||||
{
|
||||
return new NotificationCompat.Builder(mContext)
|
||||
.setAutoCancel(true)
|
||||
.setSmallIcon(R.drawable.ic_notification);
|
||||
.setAutoCancel(true)
|
||||
.setSmallIcon(R.drawable.ic_notification);
|
||||
}
|
||||
|
||||
public void placeGuideAvailable(String packageName, String title, String content)
|
||||
|
@ -91,10 +91,10 @@ public class Notifier
|
|||
.getActivity(mContext, 0, GuidesUtils.getGoogleStoreIntentForPackage(packageName), 0);
|
||||
|
||||
final Notification guideNoti = getBuilder()
|
||||
.setContentIntent(pi)
|
||||
.setContentTitle(title)
|
||||
.setContentText(content)
|
||||
.build();
|
||||
.setContentIntent(pi)
|
||||
.setContentTitle(title)
|
||||
.setContentText(content)
|
||||
.build();
|
||||
|
||||
mNotificationManager.notify(ID_GUIDE_AVAIL, guideNoti);
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ public class MapsWithMeBaseActivity extends FragmentActivity
|
|||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
@Override
|
||||
@Override
|
||||
protected void onCreate(Bundle arg0)
|
||||
{
|
||||
super.onCreate(arg0);
|
||||
|
@ -51,7 +51,7 @@ public class MapsWithMeBaseActivity extends FragmentActivity
|
|||
|
||||
public MWMApplication getMwmApplication()
|
||||
{
|
||||
return (MWMApplication)getApplication();
|
||||
return (MWMApplication) getApplication();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -50,7 +50,7 @@ public class MapsWithMeBaseListActivity extends ListActivity
|
|||
|
||||
public MWMApplication getMwmApplication()
|
||||
{
|
||||
return (MWMApplication)getApplication();
|
||||
return (MWMApplication) getApplication();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -38,7 +38,7 @@ public class BookmarkCategoriesActivity extends AbstractBookmarkCategoryActivity
|
|||
if (getAdapter().isActiveItem(position))
|
||||
{
|
||||
startActivity(new Intent(BookmarkCategoriesActivity.this, BookmarkListActivity.class)
|
||||
.putExtra(BookmarkActivity.PIN_SET, position));
|
||||
.putExtra(BookmarkActivity.PIN_SET, position));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -50,7 +50,7 @@ public class BookmarkCategoriesActivity extends AbstractBookmarkCategoryActivity
|
|||
public void onCreateContextMenu(ContextMenu menu, View v,
|
||||
ContextMenuInfo menuInfo)
|
||||
{
|
||||
mSelectedPosition = ((AdapterView.AdapterContextMenuInfo)menuInfo).position;
|
||||
mSelectedPosition = ((AdapterView.AdapterContextMenuInfo) menuInfo).position;
|
||||
if (getAdapter().isActiveItem(mSelectedPosition))
|
||||
{
|
||||
getMenuInflater().inflate(R.menu.bookmark_categories_context_menu, menu);
|
||||
|
|
|
@ -52,7 +52,7 @@ public class BookmarkCategoriesAdapter extends AbstractBookmarkCategoryAdapter
|
|||
{
|
||||
final View hintView = LayoutInflater.from(getContext()).inflate(R.layout.bookmark_hint, null);
|
||||
if (super.getCount() > 0)
|
||||
((TextView)hintView.findViewById(R.id.bookmarks_usage_hint)).setText(R.string.bookmarks_usage_hint_import_only);
|
||||
((TextView) hintView.findViewById(R.id.bookmarks_usage_hint)).setText(R.string.bookmarks_usage_hint_import_only);
|
||||
return hintView;
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,7 @@ public class BookmarkCategoriesAdapter extends AbstractBookmarkCategoryAdapter
|
|||
{
|
||||
convertView = LayoutInflater.from(getContext()).inflate(R.layout.bmk_category_item, null);
|
||||
final PinSetHolder holder = new PinSetHolder((TextView) convertView.findViewById(R.id.psi_name),
|
||||
(CheckBox) convertView.findViewById(R.id.pin_set_visible));
|
||||
(CheckBox) convertView.findViewById(R.id.pin_set_visible));
|
||||
convertView.setTag(holder);
|
||||
holder.visibilityCheckBox.setOnCheckedChangeListener(new OnCheckedChangeListener()
|
||||
{
|
||||
|
@ -68,9 +68,9 @@ public class BookmarkCategoriesAdapter extends AbstractBookmarkCategoryAdapter
|
|||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked)
|
||||
{
|
||||
BookmarkCategoriesAdapter.this
|
||||
.getBookmarkManager()
|
||||
.getCategoryById(holder.categoryId)
|
||||
.setVisibility(isChecked);
|
||||
.getBookmarkManager()
|
||||
.getCategoryById(holder.categoryId)
|
||||
.setVisibility(isChecked);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ public class BookmarkCategoriesAdapter extends AbstractBookmarkCategoryAdapter
|
|||
// category ID
|
||||
psh.categoryId = position;
|
||||
// name
|
||||
psh.name.setText(set.getName() + " ("+String.valueOf(set.getSize())+")");
|
||||
psh.name.setText(set.getName() + " (" + String.valueOf(set.getSize()) + ")");
|
||||
// visibility
|
||||
psh.visibilityCheckBox.setChecked(set.isVisible());
|
||||
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
package com.mapswithme.maps.bookmarks;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.drawable.Drawable;
|
||||
|
@ -24,9 +19,14 @@ import com.mapswithme.maps.bookmarks.data.Track;
|
|||
import com.mapswithme.maps.location.LocationService;
|
||||
import com.mapswithme.util.UiUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
public class BookmarkListAdapter extends BaseAdapter
|
||||
implements LocationService.Listener
|
||||
implements LocationService.Listener
|
||||
{
|
||||
private final Activity mContext;
|
||||
private final BookmarkCategory mCategory;
|
||||
|
@ -58,8 +58,9 @@ public class BookmarkListAdapter extends BaseAdapter
|
|||
{
|
||||
return 3; // bookmark + track + section
|
||||
}
|
||||
final static int TYPE_TRACK = 0;
|
||||
final static int TYPE_BMK = 1;
|
||||
|
||||
final static int TYPE_TRACK = 0;
|
||||
final static int TYPE_BMK = 1;
|
||||
final static int TYPE_SECTION = 2;
|
||||
|
||||
@Override
|
||||
|
@ -92,7 +93,7 @@ public class BookmarkListAdapter extends BaseAdapter
|
|||
if (convertView == null)
|
||||
{
|
||||
sectionView = LayoutInflater.from(mContext).inflate(R.layout.list_separator_base, null);
|
||||
sectionName = (TextView)sectionView.findViewById(R.id.text);
|
||||
sectionName = (TextView) sectionView.findViewById(R.id.text);
|
||||
sectionView.setTag(sectionName);
|
||||
}
|
||||
else
|
||||
|
@ -115,9 +116,9 @@ public class BookmarkListAdapter extends BaseAdapter
|
|||
|
||||
final PinHolder holder = (PinHolder) convertView.getTag();
|
||||
if (type == TYPE_BMK)
|
||||
holder.set((Bookmark)getItem(position));
|
||||
holder.set((Bookmark) getItem(position));
|
||||
else
|
||||
holder.set((Track)getItem(position));
|
||||
holder.set((Track) getItem(position));
|
||||
|
||||
return convertView;
|
||||
}
|
||||
|
@ -127,7 +128,7 @@ public class BookmarkListAdapter extends BaseAdapter
|
|||
{
|
||||
return mCategory.getSize()
|
||||
+ (isSectionEmpty(SECTION_TRACKS) ? 0 : 1)
|
||||
+ (isSectionEmpty(SECTION_BMKS) ? 0 : 1);
|
||||
+ (isSectionEmpty(SECTION_BMKS) ? 0 : 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -128,9 +128,9 @@ public class ChooseBookmarkCategoryActivity extends AbstractBookmarkCategoryActi
|
|||
mRootView = getLayoutInflater().inflate(R.layout.choose_category_footer, null);
|
||||
getListView().addFooterView(mRootView);
|
||||
|
||||
mNewName = (EditText)mRootView.findViewById(R.id.chs_footer_field);
|
||||
mNewName = (EditText) mRootView.findViewById(R.id.chs_footer_field);
|
||||
|
||||
mAddButton = (Button)mRootView.findViewById(R.id.chs_footer_button);
|
||||
mAddButton = (Button) mRootView.findViewById(R.id.chs_footer_button);
|
||||
mAddButton.setOnClickListener(this);
|
||||
|
||||
mRootView.findViewById(R.id.chs_footer_create_button).setOnClickListener(new OnClickListener()
|
||||
|
@ -143,7 +143,7 @@ public class ChooseBookmarkCategoryActivity extends AbstractBookmarkCategoryActi
|
|||
}
|
||||
});
|
||||
|
||||
mCancel = (ImageButton)mRootView.findViewById(R.id.chs_footer_cancel_button);
|
||||
mCancel = (ImageButton) mRootView.findViewById(R.id.chs_footer_cancel_button);
|
||||
mCancel.setOnClickListener(this);
|
||||
|
||||
mNewLayout = mRootView.findViewById(R.id.chs_footer_new_layout);
|
||||
|
@ -155,7 +155,7 @@ public class ChooseBookmarkCategoryActivity extends AbstractBookmarkCategoryActi
|
|||
{
|
||||
if (actionId == EditorInfo.IME_ACTION_DONE ||
|
||||
(event.getAction() == KeyEvent.ACTION_DOWN &&
|
||||
event.getKeyCode() == KeyEvent.KEYCODE_ENTER))
|
||||
event.getKeyCode() == KeyEvent.KEYCODE_ENTER))
|
||||
{
|
||||
createCategory();
|
||||
return true;
|
||||
|
@ -170,7 +170,7 @@ public class ChooseBookmarkCategoryActivity extends AbstractBookmarkCategoryActi
|
|||
final int index = mManager.createCategory(getBookmarkFromIntent(), name);
|
||||
|
||||
getIntent().putExtra(BookmarkActivity.PIN_SET, index)
|
||||
.putExtra(BookmarkActivity.PIN, new ParcelablePoint(index, 0));
|
||||
.putExtra(BookmarkActivity.PIN, new ParcelablePoint(index, 0));
|
||||
|
||||
switchToAddButton();
|
||||
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package com.mapswithme.maps.bookmarks;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.view.LayoutInflater;
|
||||
|
@ -14,6 +12,8 @@ import com.mapswithme.maps.R;
|
|||
import com.mapswithme.maps.bookmarks.data.Icon;
|
||||
import com.mapswithme.util.UiUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/// SingleChoise list view don't add radio button to custom view.
|
||||
public class IconsAdapter extends ArrayAdapter<Icon>
|
||||
{
|
||||
|
@ -33,7 +33,7 @@ public class IconsAdapter extends ArrayAdapter<Icon>
|
|||
LayoutInflater inflater = LayoutInflater.from(getContext());
|
||||
convertView = inflater.inflate(R.layout.color_row, parent, false);
|
||||
convertView.setTag(new SpinnerViewHolder((ImageView) convertView.findViewById(R.id.row_color_image),
|
||||
(ImageView) convertView.findViewById(R.id.selected_mark)));
|
||||
(ImageView) convertView.findViewById(R.id.selected_mark)));
|
||||
}
|
||||
SpinnerViewHolder holder = (SpinnerViewHolder) convertView.getTag();
|
||||
if (position == mCheckedPosition)
|
||||
|
|
|
@ -67,15 +67,20 @@ public class BookmarkCategory
|
|||
}
|
||||
|
||||
private native int getBookmarksCount(int id);
|
||||
|
||||
private native int getTracksCount(int id);
|
||||
|
||||
private native int getSize(int id);
|
||||
|
||||
private native Bookmark getBookmark(int id, int index, Class<Bookmark> bookmarkClazz);
|
||||
private native Track getTrack(int id, int index, Class<Track> trackClazz);
|
||||
|
||||
private native Track getTrack(int id, int index, Class<Track> trackClazz);
|
||||
|
||||
private native boolean isVisible(int id);
|
||||
private native void setVisibility(int id, boolean v);
|
||||
|
||||
private native void setVisibility(int id, boolean v);
|
||||
|
||||
private native String getName(int id);
|
||||
private native void setName(int old, String n);
|
||||
|
||||
private native void setName(int old, String n);
|
||||
}
|
||||
|
|
|
@ -5,9 +5,9 @@ import java.util.HashMap;
|
|||
public class BookmarkIconManager
|
||||
{
|
||||
private static String[] ICONS = {
|
||||
"placemark-red", "placemark-blue", "placemark-purple", "placemark-yellow",
|
||||
"placemark-pink", "placemark-brown", "placemark-green", "placemark-orange"
|
||||
};
|
||||
"placemark-red", "placemark-blue", "placemark-purple", "placemark-yellow",
|
||||
"placemark-pink", "placemark-brown", "placemark-green", "placemark-orange"
|
||||
};
|
||||
|
||||
|
||||
static Icon getIcon(String type)
|
||||
|
|
|
@ -1,15 +1,14 @@
|
|||
package com.mapswithme.maps.bookmarks.data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Point;
|
||||
import android.util.Pair;
|
||||
|
||||
import com.mapswithme.maps.MWMApplication;
|
||||
import com.mapswithme.util.statistics.Statistics;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BookmarkManager
|
||||
{
|
||||
private static BookmarkManager sManager;
|
||||
|
@ -46,6 +45,7 @@ public class BookmarkManager
|
|||
{
|
||||
nativeDeleteTrack(track.getCategoryId(), track.getTrackId());
|
||||
}
|
||||
|
||||
private native void nativeDeleteTrack(int cat, int trk);
|
||||
|
||||
public int addBookmarkToLastEditedCategory(String name, double lat, double lon)
|
||||
|
|
|
@ -26,6 +26,6 @@ public class Icon
|
|||
@Override
|
||||
public boolean equals(Object o)
|
||||
{
|
||||
return mType.equals(((Icon)o).getType());
|
||||
return mType.equals(((Icon) o).getType());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -88,10 +88,14 @@ public abstract class MapObject
|
|||
return true;
|
||||
}
|
||||
|
||||
public double getScale() { return 0; };
|
||||
public String getName() { return mName; }
|
||||
public double getLat() { return mLat; }
|
||||
public double getLon() { return mLon; }
|
||||
public double getScale() { return 0; }
|
||||
|
||||
public String getName() { return mName; }
|
||||
|
||||
public double getLat() { return mLat; }
|
||||
|
||||
public double getLon() { return mLon; }
|
||||
|
||||
public String getPoiTypeName() { return mTypeName; }
|
||||
|
||||
public abstract MapObjectType getType();
|
||||
|
|
|
@ -22,10 +22,13 @@ public class Track
|
|||
mColor = color;
|
||||
}
|
||||
|
||||
public String getName() { return mName; }
|
||||
public String getLengthString() { return mLengthString;}
|
||||
public int getColor() { return mColor; }
|
||||
public String getName() { return mName; }
|
||||
|
||||
public String getLengthString() { return mLengthString;}
|
||||
|
||||
public int getColor() { return mColor; }
|
||||
|
||||
public int getTrackId() { return mTrackId; }
|
||||
|
||||
public int getTrackId() { return mTrackId; }
|
||||
public int getCategoryId() { return mCategoryId; }
|
||||
}
|
||||
|
|
|
@ -1,5 +1,12 @@
|
|||
package com.mapswithme.maps.downloader;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.os.AsyncTask;
|
||||
import android.util.Log;
|
||||
|
||||
import com.mapswithme.util.StringUtils;
|
||||
import com.mapswithme.util.Utils;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
@ -11,13 +18,6 @@ import java.util.Map;
|
|||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.os.AsyncTask;
|
||||
import android.util.Log;
|
||||
|
||||
import com.mapswithme.util.StringUtils;
|
||||
import com.mapswithme.util.Utils;
|
||||
|
||||
class DownloadChunkTask extends AsyncTask<Void, byte[], Boolean>
|
||||
{
|
||||
private static final String TAG = "DownloadChunkTask";
|
||||
|
@ -101,9 +101,9 @@ class DownloadChunkTask extends AsyncTask<Void, byte[], Boolean>
|
|||
void start()
|
||||
{
|
||||
if (Utils.apiEqualOrGreaterThan(11))
|
||||
executeOnExecutor(s_exec, (Void[])null);
|
||||
executeOnExecutor(s_exec, (Void[]) null);
|
||||
else
|
||||
execute((Void[])null);
|
||||
execute((Void[]) null);
|
||||
}
|
||||
|
||||
static long parseContentRange(String contentRangeValue)
|
||||
|
@ -116,8 +116,7 @@ class DownloadChunkTask extends AsyncTask<Void, byte[], Boolean>
|
|||
try
|
||||
{
|
||||
return Long.parseLong(contentRangeValue.substring(slashIndex + 1));
|
||||
}
|
||||
catch (final NumberFormatException ex)
|
||||
} catch (final NumberFormatException ex)
|
||||
{
|
||||
// Return -1 at the end of function
|
||||
}
|
||||
|
@ -157,7 +156,7 @@ class DownloadChunkTask extends AsyncTask<Void, byte[], Boolean>
|
|||
urlConnection.setRequestProperty("Range", StringUtils.formatUsingUsLocale("bytes=%d-", m_beg));
|
||||
}
|
||||
|
||||
final Map<?,?> requestParams = urlConnection.getRequestProperties();
|
||||
final Map<?, ?> requestParams = urlConnection.getRequestProperties();
|
||||
|
||||
if (m_postBody != null)
|
||||
{
|
||||
|
@ -185,8 +184,8 @@ class DownloadChunkTask extends AsyncTask<Void, byte[], Boolean>
|
|||
// we've set error code so client should be notified about the error
|
||||
m_httpErrorCode = FILE_SIZE_CHECK_FAILED;
|
||||
Log.w(TAG, "Error for " + urlConnection.getURL() +
|
||||
": Server replied with code " + err +
|
||||
", aborting download. " + Utils.mapPrettyPrint(requestParams));
|
||||
": Server replied with code " + err +
|
||||
", aborting download. " + Utils.mapPrettyPrint(requestParams));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -203,7 +202,7 @@ class DownloadChunkTask extends AsyncTask<Void, byte[], Boolean>
|
|||
// we've set error code so client should be notified about the error
|
||||
m_httpErrorCode = FILE_SIZE_CHECK_FAILED;
|
||||
Log.w(TAG, "Error for " + urlConnection.getURL() +
|
||||
": Invalid file size received (" + contentLength + ") while expecting " + m_expectedFileSize +
|
||||
": Invalid file size received (" + contentLength + ") while expecting " + m_expectedFileSize +
|
||||
". Aborting download.");
|
||||
return false;
|
||||
}
|
||||
|
@ -211,24 +210,21 @@ class DownloadChunkTask extends AsyncTask<Void, byte[], Boolean>
|
|||
}
|
||||
|
||||
return downloadFromStream(new BufferedInputStream(urlConnection.getInputStream(), 65536));
|
||||
}
|
||||
catch (final MalformedURLException ex)
|
||||
} catch (final MalformedURLException ex)
|
||||
{
|
||||
Log.d(TAG, "Invalid url: " + m_url);
|
||||
|
||||
// Notify the client about error
|
||||
m_httpErrorCode = INVALID_URL;
|
||||
return false;
|
||||
}
|
||||
catch (final IOException ex)
|
||||
} catch (final IOException ex)
|
||||
{
|
||||
Log.d(TAG, "IOException in doInBackground for URL: " + m_url, ex);
|
||||
|
||||
// Notify the client about error
|
||||
m_httpErrorCode = IO_ERROR;
|
||||
return false;
|
||||
}
|
||||
finally
|
||||
} finally
|
||||
{
|
||||
//Log.i(TAG, "End downloading chunk " + getChunkID());
|
||||
|
||||
|
@ -246,7 +242,7 @@ class DownloadChunkTask extends AsyncTask<Void, byte[], Boolean>
|
|||
/// try to introduce dynamic buffer size to read in one query.
|
||||
private boolean downloadFromStream(InputStream stream)
|
||||
{
|
||||
final int arrSize[] = { 64, 32, 1 };
|
||||
final int arrSize[] = {64, 32, 1};
|
||||
int ret = -1;
|
||||
|
||||
for (int i = 0; i < arrSize.length; ++i)
|
||||
|
@ -256,8 +252,7 @@ class DownloadChunkTask extends AsyncTask<Void, byte[], Boolean>
|
|||
// download chunk from stream
|
||||
ret = downloadFromStreamImpl(stream, arrSize[i] * 1024);
|
||||
break;
|
||||
}
|
||||
catch (final IOException ex)
|
||||
} catch (final IOException ex)
|
||||
{
|
||||
Log.d(TAG, "IOException in downloadFromStream for chunk size: " + arrSize[i], ex);
|
||||
}
|
||||
|
|
|
@ -18,8 +18,7 @@ public class GuidesUtils
|
|||
// throws if has no package
|
||||
pm.getPackageInfo(appId, PackageManager.GET_META_DATA);
|
||||
return true;
|
||||
}
|
||||
catch (final NameNotFoundException e)
|
||||
} catch (final NameNotFoundException e)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package com.mapswithme.maps.promo;
|
||||
|
||||
import android.content.Context;
|
||||
|
|
|
@ -24,7 +24,7 @@ import java.net.URL;
|
|||
import java.util.Scanner;
|
||||
|
||||
public class PromocodeActivationDialog extends Dialog
|
||||
implements OnClickListener, PromoActivationRequest.RequestListener
|
||||
implements OnClickListener, PromoActivationRequest.RequestListener
|
||||
{
|
||||
private EditText mPromoText;
|
||||
private TextView mErrorText;
|
||||
|
@ -54,7 +54,7 @@ public class PromocodeActivationDialog extends Dialog
|
|||
@Override
|
||||
public URL createUrl(String promoCode) throws MalformedURLException
|
||||
{
|
||||
final String strUrl = "https://mwm.cbapps.de/" + promoCode;
|
||||
final String strUrl = "https://mwm.cbapps.de/" + promoCode;
|
||||
return new URL(strUrl);
|
||||
}
|
||||
};
|
||||
|
@ -152,7 +152,7 @@ public class PromocodeActivationDialog extends Dialog
|
|||
|
||||
final String promoCode = mPromoText.getText().toString().trim();
|
||||
|
||||
new Thread()
|
||||
new Thread()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
|
@ -160,8 +160,7 @@ public class PromocodeActivationDialog extends Dialog
|
|||
try
|
||||
{
|
||||
mComputerBildRequest.doRequst(promoCode);
|
||||
}
|
||||
catch (Exception e)
|
||||
} catch (Exception e)
|
||||
{
|
||||
onError(e);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package com.mapswithme.maps.promo.request;
|
||||
|
||||
import com.mapswithme.util.Utils;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
@ -7,8 +9,6 @@ import java.net.HttpURLConnection;
|
|||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
|
||||
import com.mapswithme.util.Utils;
|
||||
|
||||
public abstract class PromoActivationRequest
|
||||
{
|
||||
protected RequestListener mRequestListener;
|
||||
|
@ -22,7 +22,7 @@ public abstract class PromoActivationRequest
|
|||
public abstract boolean parseResponse(InputStream is);
|
||||
|
||||
/**
|
||||
* Creates {@link URL} for specific server using passed promocode.
|
||||
* Creates {@link URL} for specific server using passed promocode.
|
||||
*
|
||||
* @param promoCode promocode to activate
|
||||
* @return {@link URL} using promocode
|
||||
|
@ -55,7 +55,7 @@ public abstract class PromoActivationRequest
|
|||
InputStream in = null;
|
||||
try
|
||||
{
|
||||
urlConnection= (HttpURLConnection) url.openConnection();
|
||||
urlConnection = (HttpURLConnection) url.openConnection();
|
||||
in = new BufferedInputStream(urlConnection.getInputStream());
|
||||
|
||||
boolean success = parseResponse(in);
|
||||
|
@ -64,13 +64,11 @@ public abstract class PromoActivationRequest
|
|||
else
|
||||
mRequestListener.onFailure();
|
||||
|
||||
}
|
||||
catch (IOException e)
|
||||
} catch (IOException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
mRequestListener.onError(e);
|
||||
}
|
||||
finally
|
||||
} finally
|
||||
{
|
||||
Utils.closeStream(in);
|
||||
urlConnection.disconnect();
|
||||
|
@ -81,7 +79,9 @@ public abstract class PromoActivationRequest
|
|||
public interface RequestListener
|
||||
{
|
||||
public void onSuccess();
|
||||
|
||||
public void onFailure();
|
||||
|
||||
public void onError(Exception ex);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ public class StoragePathActivity extends MapsWithMeBaseListActivity
|
|||
|
||||
private StoragePathManager.StoragePathAdapter getAdapter()
|
||||
{
|
||||
return (StoragePathManager.StoragePathAdapter)getListView().getAdapter();
|
||||
return (StoragePathManager.StoragePathAdapter) getListView().getAdapter();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -452,6 +452,7 @@ public class MapInfoView extends LinearLayout implements View.OnClickListener
|
|||
mDistanceText = (TextView) mGeoLayout.findViewById(R.id.info_box_geo_distance);
|
||||
mAvDirection = (ArrowView) mGeoLayout.findViewById(R.id.av_direction);
|
||||
mAvDirection.setDrawCircle(true);
|
||||
mAvDirection.setVisibility(View.GONE); // should be hidden until first compas update
|
||||
mTvCoords = (TextView) mGeoLayout.findViewById(R.id.info_box_geo_location);
|
||||
mTvCoords.setOnClickListener(this);
|
||||
|
||||
|
@ -547,7 +548,10 @@ public class MapInfoView extends LinearLayout implements View.OnClickListener
|
|||
l.getLatitude(), l.getLongitude(), northAzimuth);
|
||||
|
||||
if (da.getAthimuth() >= 0)
|
||||
{
|
||||
mAvDirection.setVisibility(View.VISIBLE);
|
||||
mAvDirection.setAzimut(da.getAthimuth());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,21 +9,20 @@ import com.mapswithme.util.log.SimpleLogger;
|
|||
import com.mapswithme.util.statistics.Statistics;
|
||||
|
||||
|
||||
|
||||
public class FbUtil
|
||||
{
|
||||
|
||||
public static Logger mLogger = SimpleLogger.get("MWM_FB");
|
||||
|
||||
public final static String[] SUPPORTED_PACKAGES = {
|
||||
"com.mapswithme.maps",
|
||||
"com.mapswithme.maps.pro",
|
||||
"com.mapswithme.maps",
|
||||
"com.mapswithme.maps.pro",
|
||||
};
|
||||
|
||||
public static void activate(Context context)
|
||||
{
|
||||
if (!Statistics.INSTANCE.isStatisticsEnabled(context))
|
||||
return;
|
||||
if (!Statistics.INSTANCE.isStatisticsEnabled(context))
|
||||
return;
|
||||
|
||||
final String thisPackageName = context.getPackageName();
|
||||
|
||||
|
@ -48,5 +47,5 @@ public class FbUtil
|
|||
AppEventsLogger.activateApp(context, context.getString(R.string.fb_app_id));
|
||||
}
|
||||
|
||||
private FbUtil() {};
|
||||
private FbUtil() {}
|
||||
}
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
package com.mapswithme.util;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.view.inputmethod.InputMethodSubtype;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public class Language
|
||||
{
|
||||
static public String getDefault()
|
||||
|
|
|
@ -3,12 +3,12 @@ package com.mapswithme.util;
|
|||
public class MathUtils
|
||||
{
|
||||
|
||||
public static double average(double ... vals)
|
||||
public static double average(double... vals)
|
||||
{
|
||||
double sum = 0;
|
||||
for (double val : vals)
|
||||
sum += val;
|
||||
return sum/vals.length;
|
||||
return sum / vals.length;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
package com.mapswithme.util;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import android.text.Spannable;
|
||||
import android.text.SpannableStringBuilder;
|
||||
import android.text.style.CharacterStyle;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public class StringUtils
|
||||
{
|
||||
/**
|
||||
* Set span for the FIRST occurrence of EACH token.
|
||||
* Set span for the FIRST occurrence of EACH token.
|
||||
*
|
||||
* @param input
|
||||
* @param spanStyle
|
||||
* @param tokens
|
||||
* @return
|
||||
*/
|
||||
public static CharSequence setSpansForTokens(String input, CharacterStyle spanStyle, String ... tokens)
|
||||
public static CharSequence setSpansForTokens(String input, CharacterStyle spanStyle, String... tokens)
|
||||
{
|
||||
final SpannableStringBuilder spanStrBuilder = new SpannableStringBuilder(input);
|
||||
|
||||
|
@ -36,7 +36,7 @@ public class StringUtils
|
|||
return spanStrBuilder;
|
||||
}
|
||||
|
||||
public static String formatUsingUsLocale(String pattern, Object ... args)
|
||||
public static String formatUsingUsLocale(String pattern, Object... args)
|
||||
{
|
||||
return String.format(Locale.US, pattern, args);
|
||||
}
|
||||
|
|
|
@ -25,11 +25,11 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
final public class Utils
|
||||
public class Utils
|
||||
{
|
||||
private static final String TAG = "Utils";
|
||||
|
||||
public static String firstNotEmpty(String ... args)
|
||||
public static String firstNotEmpty(String... args)
|
||||
{
|
||||
for (int i = 0; i < args.length; i++)
|
||||
if (!TextUtils.isEmpty(args[i]))
|
||||
|
@ -45,8 +45,7 @@ final public class Utils
|
|||
try
|
||||
{
|
||||
stream.close();
|
||||
}
|
||||
catch (final IOException e)
|
||||
} catch (final IOException e)
|
||||
{
|
||||
Log.e(TAG, "Can't close stream", e);
|
||||
}
|
||||
|
@ -93,7 +92,7 @@ final public class Utils
|
|||
{
|
||||
final android.util.TypedValue value = new android.util.TypedValue();
|
||||
final boolean b = activity.getTheme().resolveAttribute(attr, value, true);
|
||||
assert(b);
|
||||
assert (b);
|
||||
final android.util.DisplayMetrics metrics = new android.util.DisplayMetrics();
|
||||
activity.getWindowManager().getDefaultDisplay().getMetrics(metrics);
|
||||
return value.getDimension(metrics);
|
||||
|
@ -150,13 +149,13 @@ final public class Utils
|
|||
{
|
||||
// This is different classes in different packages
|
||||
final android.content.ClipboardManager clipboard =
|
||||
(android.content.ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
(android.content.ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
final ClipData clip = ClipData.newPlainText("maps.me: " + text, text);
|
||||
clipboard.setPrimaryClip(clip);
|
||||
}
|
||||
}
|
||||
|
||||
public static <K,V> String mapPrettyPrint(Map<K, V> map)
|
||||
public static <K, V> String mapPrettyPrint(Map<K, V> map)
|
||||
{
|
||||
if (map == null)
|
||||
return "[null]";
|
||||
|
@ -167,9 +166,9 @@ final public class Utils
|
|||
String joined = "";
|
||||
for (final K key : map.keySet())
|
||||
{
|
||||
final String keyVal = key + "=" + map.get(key);
|
||||
final String keyVal = key + "=" + map.get(key);
|
||||
if (joined.length() > 0)
|
||||
joined = TextUtils.join(",", new Object[] { joined, keyVal });
|
||||
joined = TextUtils.join(",", new Object[]{joined, keyVal});
|
||||
else
|
||||
joined = keyVal;
|
||||
}
|
||||
|
@ -188,11 +187,10 @@ final public class Utils
|
|||
return mItem;
|
||||
}
|
||||
|
||||
public static Object[] asObjectArray(Object ... args)
|
||||
public static Object[] asObjectArray(Object... args)
|
||||
{
|
||||
return args;
|
||||
}
|
||||
|
||||
// utility class
|
||||
private Utils() {}
|
||||
}
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
package com.mapswithme.util;
|
||||
|
||||
import com.mapswithme.maps.MWMApplication;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.location.Location;
|
||||
import android.os.Build;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.mapswithme.maps.MWMApplication;
|
||||
|
||||
public class Yota
|
||||
{
|
||||
public static boolean isYota()
|
||||
|
@ -15,22 +15,21 @@ public class Yota
|
|||
return Build.DEVICE.contains("yotaphone");
|
||||
}
|
||||
|
||||
private final static String YOPME_AUTHORITY = "com.mapswithme.yopme";
|
||||
public final static String ACTION_PREFERENCE = YOPME_AUTHORITY + ".preference";
|
||||
public final static String ACTION_SHOW_RECT = YOPME_AUTHORITY + ".show_rect";
|
||||
public final static String ACTION_LOCATION = YOPME_AUTHORITY + ".location";
|
||||
private final static String YOPME_AUTHORITY = "com.mapswithme.yopme";
|
||||
public final static String ACTION_PREFERENCE = YOPME_AUTHORITY + ".preference";
|
||||
public final static String ACTION_SHOW_RECT = YOPME_AUTHORITY + ".show_rect";
|
||||
public final static String ACTION_LOCATION = YOPME_AUTHORITY + ".location";
|
||||
|
||||
public final static String EXTRA_LAT = YOPME_AUTHORITY + ".lat";
|
||||
public final static String EXTRA_LON = YOPME_AUTHORITY + ".lon";
|
||||
public final static String EXTRA_ZOOM = YOPME_AUTHORITY + ".zoom";
|
||||
public final static String EXTRA_NAME = YOPME_AUTHORITY + ".name";
|
||||
public final static String EXTRA_MODE = YOPME_AUTHORITY + ".mode";
|
||||
public final static String EXTRA_IS_POI = YOPME_AUTHORITY + ".is_poi";
|
||||
|
||||
public final static String EXTRA_HAS_LOCATION = YOPME_AUTHORITY + ".haslocation";
|
||||
public final static String EXTRA_MY_LAT = YOPME_AUTHORITY + ".mylat";
|
||||
public final static String EXTRA_MY_LON = YOPME_AUTHORITY + ".mylon";
|
||||
public final static String EXTRA_LAT = YOPME_AUTHORITY + ".lat";
|
||||
public final static String EXTRA_LON = YOPME_AUTHORITY + ".lon";
|
||||
public final static String EXTRA_ZOOM = YOPME_AUTHORITY + ".zoom";
|
||||
public final static String EXTRA_NAME = YOPME_AUTHORITY + ".name";
|
||||
public final static String EXTRA_MODE = YOPME_AUTHORITY + ".mode";
|
||||
public final static String EXTRA_IS_POI = YOPME_AUTHORITY + ".is_poi";
|
||||
|
||||
public final static String EXTRA_HAS_LOCATION = YOPME_AUTHORITY + ".haslocation";
|
||||
public final static String EXTRA_MY_LAT = YOPME_AUTHORITY + ".mylat";
|
||||
public final static String EXTRA_MY_LON = YOPME_AUTHORITY + ".mylon";
|
||||
|
||||
|
||||
public static void showLocation(Context context, double zoom)
|
||||
|
@ -42,8 +41,8 @@ public class Yota
|
|||
public static void showMap(Context context, double vpLat, double vpLon, double zoom, String name, boolean addLastKnown)
|
||||
{
|
||||
final Intent poiYotaIntent = populateIntent(ACTION_SHOW_RECT, vpLat, vpLon,
|
||||
zoom, name, addLastKnown,
|
||||
!TextUtils.isEmpty(name));
|
||||
zoom, name, addLastKnown,
|
||||
!TextUtils.isEmpty(name));
|
||||
context.startService(poiYotaIntent);
|
||||
}
|
||||
|
||||
|
@ -52,11 +51,11 @@ public class Yota
|
|||
boolean addLastKnow, boolean isPoi)
|
||||
{
|
||||
final Intent i = new Intent(action)
|
||||
.putExtra(EXTRA_LAT, lat)
|
||||
.putExtra(EXTRA_LON, lon)
|
||||
.putExtra(EXTRA_ZOOM, zoom)
|
||||
.putExtra(EXTRA_NAME, name)
|
||||
.putExtra(EXTRA_IS_POI, isPoi);
|
||||
.putExtra(EXTRA_LAT, lat)
|
||||
.putExtra(EXTRA_LON, lon)
|
||||
.putExtra(EXTRA_ZOOM, zoom)
|
||||
.putExtra(EXTRA_NAME, name)
|
||||
.putExtra(EXTRA_IS_POI, isPoi);
|
||||
|
||||
if (addLastKnow)
|
||||
{
|
||||
|
@ -64,8 +63,8 @@ public class Yota
|
|||
if (lastLocation != null)
|
||||
{
|
||||
i.putExtra(EXTRA_HAS_LOCATION, true)
|
||||
.putExtra(EXTRA_MY_LAT, lastLocation.getLatitude())
|
||||
.putExtra(EXTRA_MY_LON, lastLocation.getLongitude());
|
||||
.putExtra(EXTRA_MY_LAT, lastLocation.getLatitude())
|
||||
.putExtra(EXTRA_MY_LON, lastLocation.getLongitude());
|
||||
}
|
||||
else
|
||||
i.putExtra(EXTRA_HAS_LOCATION, false);
|
||||
|
@ -74,5 +73,5 @@ public class Yota
|
|||
return i;
|
||||
}
|
||||
|
||||
private Yota() {};
|
||||
private Yota() {}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
package com.mapswithme.util.log;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
public class FileLogger extends Logger
|
||||
{
|
||||
static private volatile FileWriter m_file = null;
|
||||
|
@ -16,8 +16,7 @@ public class FileLogger extends Logger
|
|||
{
|
||||
m_file.write(tag + ": " + str + m_separator);
|
||||
m_file.flush();
|
||||
}
|
||||
catch (IOException ex)
|
||||
} catch (IOException ex)
|
||||
{
|
||||
Log.e(tag, ex.toString());
|
||||
}
|
||||
|
@ -36,8 +35,7 @@ public class FileLogger extends Logger
|
|||
{
|
||||
m_file = new FileWriter(path + "android-logging.txt");
|
||||
m_separator = System.getProperty("line.separator");
|
||||
}
|
||||
catch (IOException ex)
|
||||
} catch (IOException ex)
|
||||
{
|
||||
Log.e(tag, ex.toString());
|
||||
}
|
||||
|
|
|
@ -13,14 +13,16 @@ public abstract class Logger
|
|||
this.tag = tag;
|
||||
}
|
||||
|
||||
static protected String join(Object ... args)
|
||||
static protected String join(Object... args)
|
||||
{
|
||||
return (args != null ? TextUtils.join(", ", args) : "");
|
||||
}
|
||||
|
||||
public abstract void d(String message);
|
||||
|
||||
public abstract void e(String message);
|
||||
|
||||
public abstract void d(String message, Object ... args);
|
||||
public abstract void e(String message, Object ... args);
|
||||
public abstract void d(String message, Object... args);
|
||||
|
||||
public abstract void e(String message, Object... args);
|
||||
}
|
||||
|
|
|
@ -5,18 +5,19 @@ import android.util.Log;
|
|||
public class SimpleLogger extends Logger
|
||||
{
|
||||
public static SimpleLogger get() { return new SimpleLogger(); }
|
||||
|
||||
public static SimpleLogger get(String tag) { return new SimpleLogger(tag); }
|
||||
|
||||
@Override
|
||||
public void d(String message)
|
||||
{
|
||||
d(message, (Object[])null);
|
||||
d(message, (Object[]) null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void e(String message)
|
||||
{
|
||||
e(message, (Object[])null);
|
||||
e(message, (Object[]) null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -32,5 +33,6 @@ public class SimpleLogger extends Logger
|
|||
}
|
||||
|
||||
private SimpleLogger() {}
|
||||
|
||||
private SimpleLogger(String tag) { super(tag); }
|
||||
}
|
||||
|
|
|
@ -1,22 +1,26 @@
|
|||
package com.mapswithme.util.statistics;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import com.mapswithme.util.Utils;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class Event
|
||||
{
|
||||
protected String mName;
|
||||
protected Map<String, String> mParams;
|
||||
protected StatisticsEngine mEngine;
|
||||
|
||||
public void setName(String name) { mName = name; }
|
||||
public void setParams(Map<String, String> params) { mParams = params; }
|
||||
public void setEngine(StatisticsEngine engine) { mEngine = engine; }
|
||||
public void setName(String name) { mName = name; }
|
||||
|
||||
public void setParams(Map<String, String> params) { mParams = params; }
|
||||
|
||||
public void setEngine(StatisticsEngine engine) { mEngine = engine; }
|
||||
|
||||
public String getName() { return mName; }
|
||||
|
||||
public String getName() { return mName; }
|
||||
public Map<String, String> getParams() { return mParams; }
|
||||
public StatisticsEngine getEngine() { return mEngine; }
|
||||
|
||||
public StatisticsEngine getEngine() { return mEngine; }
|
||||
|
||||
public boolean hasParams()
|
||||
{
|
||||
|
@ -33,10 +37,10 @@ public class Event
|
|||
{
|
||||
final StringBuilder sb = new StringBuilder(getClass().getSimpleName());
|
||||
sb.append("[name = ")
|
||||
.append(getName())
|
||||
.append(", params: ")
|
||||
.append(Utils.mapPrettyPrint(getParams()))
|
||||
.append("]");
|
||||
.append(getName())
|
||||
.append(", params: ")
|
||||
.append(Utils.mapPrettyPrint(getParams()))
|
||||
.append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
|
|
@ -12,11 +12,11 @@ public class FlurryEngine extends StatisticsEngine
|
|||
{
|
||||
|
||||
private boolean mDebug = false;
|
||||
private final String mKey;
|
||||
private final String mKey;
|
||||
|
||||
public FlurryEngine(boolean isDebug, String key)
|
||||
{
|
||||
mKey = key;
|
||||
mKey = key;
|
||||
mDebug = isDebug;
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ public enum Statistics
|
|||
private final boolean DEBUG = false;
|
||||
private final Logger mLogger = DEBUG ? SimpleLogger.get("MwmStatistics") : StubLogger.get();
|
||||
// Statistics counters
|
||||
private int mBookmarksCreated= 0;
|
||||
private int mBookmarksCreated = 0;
|
||||
private int mSharedTimes = 0;
|
||||
|
||||
|
||||
|
@ -64,9 +64,9 @@ public enum Statistics
|
|||
public void trackBackscreenCall(Context context, String from)
|
||||
{
|
||||
final Event event = getEventBuilder().reset()
|
||||
.setName("Yota back screen call")
|
||||
.addParam("from", from)
|
||||
.getEvent();
|
||||
.setName("Yota back screen call")
|
||||
.addParam("from", from)
|
||||
.getEvent();
|
||||
|
||||
trackIfEnabled(context, event);
|
||||
}
|
||||
|
@ -89,9 +89,9 @@ public enum Statistics
|
|||
public void trackSearchCategoryClicked(Context context, String category)
|
||||
{
|
||||
final Event event = getEventBuilder().reset()
|
||||
.setName("Search category clicked")
|
||||
.addParam("category", category)
|
||||
.getEvent();
|
||||
.setName("Search category clicked")
|
||||
.addParam("category", category)
|
||||
.getEvent();
|
||||
|
||||
trackIfEnabled(context, event);
|
||||
}
|
||||
|
@ -114,10 +114,10 @@ public enum Statistics
|
|||
public void trackSearchContextChanged(Context context, String from, String to)
|
||||
{
|
||||
final Event event = getEventBuilder().reset()
|
||||
.setName("Search context changed")
|
||||
.addParam("from", from)
|
||||
.addParam("to", to)
|
||||
.getEvent();
|
||||
.setName("Search context changed")
|
||||
.addParam("from", from)
|
||||
.addParam("to", to)
|
||||
.getEvent();
|
||||
|
||||
trackIfEnabled(context, event);
|
||||
}
|
||||
|
@ -125,10 +125,10 @@ public enum Statistics
|
|||
public void trackColorChanged(Context context, String from, String to)
|
||||
{
|
||||
final Event event = getEventBuilder().reset()
|
||||
.setName("Color changed")
|
||||
.addParam("from", from)
|
||||
.addParam("to", to)
|
||||
.getEvent();
|
||||
.setName("Color changed")
|
||||
.addParam("from", from)
|
||||
.addParam("to", to)
|
||||
.getEvent();
|
||||
|
||||
trackIfEnabled(context, event);
|
||||
}
|
||||
|
@ -136,9 +136,9 @@ public enum Statistics
|
|||
public void trackBookmarkCreated(Context context)
|
||||
{
|
||||
final Event event = getEventBuilder().reset()
|
||||
.setName("Bookmark created")
|
||||
.addParam("Count", String.valueOf(++mBookmarksCreated))
|
||||
.getEvent();
|
||||
.setName("Bookmark created")
|
||||
.addParam("Count", String.valueOf(++mBookmarksCreated))
|
||||
.getEvent();
|
||||
|
||||
trackIfEnabled(context, event);
|
||||
}
|
||||
|
@ -146,10 +146,10 @@ public enum Statistics
|
|||
public void trackPlaceShared(Context context, String channel)
|
||||
{
|
||||
final Event event = getEventBuilder().reset()
|
||||
.setName("Place Shared")
|
||||
.addParam("Channel", channel)
|
||||
.addParam("Count", String.valueOf(++mSharedTimes))
|
||||
.getEvent();
|
||||
.setName("Place Shared")
|
||||
.addParam("Channel", channel)
|
||||
.addParam("Count", String.valueOf(++mSharedTimes))
|
||||
.getEvent();
|
||||
|
||||
trackIfEnabled(context, event);
|
||||
}
|
||||
|
@ -170,12 +170,12 @@ public enum Statistics
|
|||
{
|
||||
ensureConfigured(MWMApplication.get());
|
||||
//@formatter:off
|
||||
final Event event = getEventBuilder().reset()
|
||||
.setName("API called")
|
||||
.addParam("Caller ID", request.getCallerInfo().packageName)
|
||||
.getEvent();
|
||||
//@formatter:on
|
||||
trackIfEnabled(MWMApplication.get(), event);
|
||||
final Event event = getEventBuilder().reset()
|
||||
.setName("API called")
|
||||
.addParam("Caller ID", request.getCallerInfo().packageName)
|
||||
.getEvent();
|
||||
//@formatter:on
|
||||
trackIfEnabled(MWMApplication.get(), event);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -241,8 +241,8 @@ public enum Statistics
|
|||
}
|
||||
|
||||
eventBuilder.addParam("Categories count", String.valueOf(categoriesCount))
|
||||
.addParam("Foreground time", String.valueOf(MWMApplication.get().getForegroundTime()))
|
||||
.setName("One time PRO stat");
|
||||
.addParam("Foreground time", String.valueOf(MWMApplication.get().getForegroundTime()))
|
||||
.setName("One time PRO stat");
|
||||
|
||||
trackIfEnabled(activity, eventBuilder.getEvent());
|
||||
}
|
||||
|
@ -272,10 +272,10 @@ public enum Statistics
|
|||
// We track if user turned on/off
|
||||
// statistics to understand data better.
|
||||
getEventBuilder().reset()
|
||||
.setName("Statistics status changed")
|
||||
.addParam("Enabled", String.valueOf(isEnabled))
|
||||
.getEvent()
|
||||
.post();
|
||||
.setName("Statistics status changed")
|
||||
.addParam("Enabled", String.valueOf(isEnabled))
|
||||
.getEvent()
|
||||
.post();
|
||||
}
|
||||
|
||||
private boolean isActiveUser(Context context, double foregroundTime)
|
||||
|
|
|
@ -8,6 +8,8 @@ public abstract class StatisticsEngine
|
|||
public void configure(Context context, Bundle params) {}
|
||||
|
||||
abstract public void onStartSession(Context context);
|
||||
|
||||
abstract public void onEndSession(Context context);
|
||||
|
||||
abstract public void postEvent(Event event);
|
||||
}
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
package com.nvidia.devtech;
|
||||
|
||||
import javax.microedition.khronos.egl.EGL10;
|
||||
import android.opengl.EGL14;
|
||||
|
||||
import javax.microedition.khronos.egl.EGL10;
|
||||
|
||||
abstract public class BaseEglWrapper extends EglWrapper
|
||||
{
|
||||
private static final int EGL_RENDERABLE_TYPE = 0x3040;
|
||||
|
@ -24,50 +25,50 @@ abstract public class BaseEglWrapper extends EglWrapper
|
|||
|
||||
protected int[] GetConfigAttributes10()
|
||||
{
|
||||
final int[] configAttributes = new int[] {EGL10.EGL_RED_SIZE, redSize,
|
||||
EGL10.EGL_GREEN_SIZE, greenSize,
|
||||
EGL10.EGL_BLUE_SIZE, blueSize,
|
||||
EGL10.EGL_ALPHA_SIZE, alphaSize,
|
||||
EGL10.EGL_STENCIL_SIZE, stencilSize,
|
||||
EGL10.EGL_DEPTH_SIZE, depthSize,
|
||||
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
|
||||
EGL10.EGL_NONE };
|
||||
final int[] configAttributes = new int[]{EGL10.EGL_RED_SIZE, redSize,
|
||||
EGL10.EGL_GREEN_SIZE, greenSize,
|
||||
EGL10.EGL_BLUE_SIZE, blueSize,
|
||||
EGL10.EGL_ALPHA_SIZE, alphaSize,
|
||||
EGL10.EGL_STENCIL_SIZE, stencilSize,
|
||||
EGL10.EGL_DEPTH_SIZE, depthSize,
|
||||
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
|
||||
EGL10.EGL_NONE};
|
||||
|
||||
return configAttributes;
|
||||
}
|
||||
|
||||
protected int[] GetSurfaceAttributes10()
|
||||
{
|
||||
return new int[] { EGL10.EGL_NONE };
|
||||
return new int[]{EGL10.EGL_NONE};
|
||||
}
|
||||
|
||||
protected int[] GetContextAttributes10()
|
||||
{
|
||||
return new int[] { EGL_CONTEXT_CLIENT_VERSION, 2, EGL10.EGL_NONE };
|
||||
return new int[]{EGL_CONTEXT_CLIENT_VERSION, 2, EGL10.EGL_NONE};
|
||||
}
|
||||
|
||||
protected int[] GetConfigAttributes14()
|
||||
{
|
||||
final int[] configAttributes = new int[] {EGL14.EGL_RED_SIZE, redSize,
|
||||
EGL14.EGL_GREEN_SIZE, greenSize,
|
||||
EGL14.EGL_BLUE_SIZE, blueSize,
|
||||
EGL14.EGL_ALPHA_SIZE, alphaSize,
|
||||
EGL14.EGL_STENCIL_SIZE, stencilSize,
|
||||
EGL14.EGL_DEPTH_SIZE, depthSize,
|
||||
EGL14.EGL_RENDERABLE_TYPE, EGL14.EGL_OPENGL_ES2_BIT,
|
||||
EGL14.EGL_NONE };
|
||||
final int[] configAttributes = new int[]{EGL14.EGL_RED_SIZE, redSize,
|
||||
EGL14.EGL_GREEN_SIZE, greenSize,
|
||||
EGL14.EGL_BLUE_SIZE, blueSize,
|
||||
EGL14.EGL_ALPHA_SIZE, alphaSize,
|
||||
EGL14.EGL_STENCIL_SIZE, stencilSize,
|
||||
EGL14.EGL_DEPTH_SIZE, depthSize,
|
||||
EGL14.EGL_RENDERABLE_TYPE, EGL14.EGL_OPENGL_ES2_BIT,
|
||||
EGL14.EGL_NONE};
|
||||
|
||||
return configAttributes;
|
||||
}
|
||||
|
||||
protected int[] GetSurfaceAttributes14()
|
||||
{
|
||||
return new int[] { EGL14.EGL_NONE };
|
||||
return new int[]{EGL14.EGL_NONE};
|
||||
}
|
||||
|
||||
protected int[] GetContextAttributes14()
|
||||
{
|
||||
return new int[] { EGL14.EGL_CONTEXT_CLIENT_VERSION, 2, EGL14.EGL_NONE };
|
||||
return new int[]{EGL14.EGL_CONTEXT_CLIENT_VERSION, 2, EGL14.EGL_NONE};
|
||||
}
|
||||
|
||||
protected boolean ValidateSurfaceSize()
|
||||
|
|
|
@ -3,33 +3,33 @@ package com.nvidia.devtech;
|
|||
import android.os.Build;
|
||||
import android.view.SurfaceHolder;
|
||||
|
||||
import javax.microedition.khronos.egl.EGL10;
|
||||
import javax.microedition.khronos.egl.EGLDisplay;
|
||||
import javax.microedition.khronos.egl.EGLConfig;
|
||||
import javax.microedition.khronos.egl.EGLContext;
|
||||
import javax.microedition.khronos.egl.EGLSurface;
|
||||
|
||||
import com.mapswithme.util.Utils;
|
||||
import com.mapswithme.util.log.Logger;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
|
||||
import javax.microedition.khronos.egl.EGL10;
|
||||
import javax.microedition.khronos.egl.EGLConfig;
|
||||
import javax.microedition.khronos.egl.EGLContext;
|
||||
import javax.microedition.khronos.egl.EGLDisplay;
|
||||
import javax.microedition.khronos.egl.EGLSurface;
|
||||
|
||||
public class Egl10Wrapper extends BaseEglWrapper
|
||||
{
|
||||
private static final String TAG = "Egl10Wrapper";
|
||||
|
||||
final private EGL10 mEgl = (EGL10)EGLContext.getEGL();
|
||||
final private EGL10 mEgl = (EGL10) EGLContext.getEGL();
|
||||
|
||||
private EGLDisplay mDisplay = EGL10.EGL_NO_DISPLAY;
|
||||
private EGLContext mContext = EGL10.EGL_NO_CONTEXT;
|
||||
private EGLSurface mSurface = EGL10.EGL_NO_SURFACE;
|
||||
private EGLConfig mConfig = null;
|
||||
private EGLConfig mConfig = null;
|
||||
|
||||
private EGLConfig[] mConfigs = new EGLConfig[40];
|
||||
|
||||
private int mChoosenConfigIndex = 0;
|
||||
private int mActualConfigsNumber[] = new int[] {0};
|
||||
private int mActualConfigsNumber[] = new int[]{0};
|
||||
|
||||
private Logger mLog = null;
|
||||
|
||||
|
@ -39,7 +39,7 @@ public class Egl10Wrapper extends BaseEglWrapper
|
|||
}
|
||||
|
||||
private class EGLConfigComparator extends ConfigComparatorBase
|
||||
implements Comparator<EGLConfig>
|
||||
implements Comparator<EGLConfig>
|
||||
{
|
||||
EGLConfigComparator()
|
||||
{
|
||||
|
@ -49,7 +49,7 @@ public class Egl10Wrapper extends BaseEglWrapper
|
|||
@Override
|
||||
public int compare(EGLConfig l, EGLConfig r)
|
||||
{
|
||||
final int [] value = new int[1];
|
||||
final int[] value = new int[1];
|
||||
|
||||
/// splitting by EGL_CONFIG_CAVEAT,
|
||||
/// firstly selecting EGL_NONE, then EGL_SLOW_CONFIG
|
||||
|
@ -62,7 +62,9 @@ public class Egl10Wrapper extends BaseEglWrapper
|
|||
|
||||
return CompareConfigs(rcav, lcav);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
@Override
|
||||
public boolean InitEGL()
|
||||
|
@ -289,7 +291,7 @@ public class Egl10Wrapper extends BaseEglWrapper
|
|||
{
|
||||
final int sizes[] = new int[1];
|
||||
mEgl.eglQuerySurface(mDisplay, mSurface, EGL10.EGL_WIDTH, sizes);
|
||||
return sizes[0];
|
||||
return sizes[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -364,7 +366,7 @@ public class Egl10Wrapper extends BaseEglWrapper
|
|||
final int depth = value[0];
|
||||
mEgl.eglGetConfigAttrib(mDisplay, config, EGL10.EGL_CONFIG_CAVEAT, value);
|
||||
final String caveat = (value[0] == EGL10.EGL_NONE) ? "EGL_NONE" :
|
||||
(value[0] == EGL10.EGL_SLOW_CONFIG) ? "EGL_SLOW_CONFIG" : "EGL_NON_CONFORMANT_CONFIG";
|
||||
(value[0] == EGL10.EGL_SLOW_CONFIG) ? "EGL_SLOW_CONFIG" : "EGL_NON_CONFORMANT_CONFIG";
|
||||
mEgl.eglGetConfigAttrib(mDisplay, config, EGL10.EGL_BUFFER_SIZE, value);
|
||||
final int buffer = value[0];
|
||||
mEgl.eglGetConfigAttrib(mDisplay, config, EGL10.EGL_LEVEL, value);
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
package com.nvidia.devtech;
|
||||
|
||||
import android.opengl.EGL14;
|
||||
import android.opengl.EGLDisplay;
|
||||
import android.opengl.EGLContext;
|
||||
import android.opengl.EGLSurface;
|
||||
import android.opengl.EGLConfig;
|
||||
|
||||
import android.opengl.EGLContext;
|
||||
import android.opengl.EGLDisplay;
|
||||
import android.opengl.EGLSurface;
|
||||
import android.view.SurfaceHolder;
|
||||
|
||||
import com.mapswithme.util.log.Logger;
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
package com.nvidia.devtech;
|
||||
|
||||
import android.view.SurfaceHolder;
|
||||
|
||||
import android.opengl.EGL14;
|
||||
import android.opengl.EGLDisplay;
|
||||
import android.view.SurfaceHolder;
|
||||
|
||||
import com.mapswithme.util.Utils;
|
||||
import com.mapswithme.util.log.Logger;
|
||||
|
@ -11,15 +10,25 @@ import com.mapswithme.util.log.Logger;
|
|||
abstract public class EglWrapper
|
||||
{
|
||||
public abstract boolean InitEGL();
|
||||
|
||||
public abstract boolean TerminateEGL();
|
||||
|
||||
public abstract boolean CreateSurfaceEGL(SurfaceHolder holder);
|
||||
|
||||
public abstract boolean DestroySurfaceEGL();
|
||||
|
||||
public abstract boolean SwapBuffersEGL();
|
||||
|
||||
public abstract int GetSurfaceWidth();
|
||||
|
||||
public abstract int GetSurfaceHeight();
|
||||
|
||||
public abstract boolean IsInitialized();
|
||||
|
||||
public abstract boolean Bind();
|
||||
|
||||
public abstract boolean Unbind();
|
||||
|
||||
public abstract int GetErrorEGL();
|
||||
|
||||
enum EglVersion
|
||||
|
@ -35,9 +44,9 @@ abstract public class EglWrapper
|
|||
switch (version)
|
||||
{
|
||||
case Egl:
|
||||
return new Egl10Wrapper(logger);
|
||||
return new Egl10Wrapper(logger);
|
||||
case Egl14:
|
||||
return new Egl14Wrapper(logger);
|
||||
return new Egl14Wrapper(logger);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
|
@ -14,16 +14,6 @@ import com.mapswithme.maps.base.MapsWithMeBaseActivity;
|
|||
import com.mapswithme.util.log.Logger;
|
||||
import com.mapswithme.util.log.StubLogger;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
|
||||
import javax.microedition.khronos.egl.EGL10;
|
||||
import javax.microedition.khronos.egl.EGL11;
|
||||
import javax.microedition.khronos.egl.EGLConfig;
|
||||
import javax.microedition.khronos.egl.EGLContext;
|
||||
import javax.microedition.khronos.egl.EGLDisplay;
|
||||
import javax.microedition.khronos.egl.EGLSurface;
|
||||
|
||||
public abstract class NvEventQueueActivity extends MapsWithMeBaseActivity implements View.OnTouchListener
|
||||
{
|
||||
private static final String TAG = "NvEventQueueActivity";
|
||||
|
|
Loading…
Add table
Reference in a new issue