forked from organicmaps/organicmaps
Unnecessary context links.
This commit is contained in:
parent
cfc987c24a
commit
912723efa5
10 changed files with 14 additions and 34 deletions
|
@ -117,7 +117,7 @@ public class MonkeyEventsReceiver extends BroadcastReceiver
|
|||
@Override
|
||||
public boolean run(final MWMActivity target)
|
||||
{
|
||||
final BookmarkManager bmkManager = BookmarkManager.getBookmarkManager(target);
|
||||
final BookmarkManager bmkManager = BookmarkManager.getBookmarkManager();
|
||||
final int categoriesCount = bmkManager.getCategoriesCount();
|
||||
|
||||
// find category
|
||||
|
|
|
@ -5,21 +5,17 @@ import android.content.pm.PackageManager.NameNotFoundException;
|
|||
import android.os.Build;
|
||||
import android.os.Environment;
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
|
||||
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.background.WorkerService;
|
||||
import com.mapswithme.maps.bookmarks.data.BookmarkManager;
|
||||
import com.mapswithme.maps.guides.GuideInfo;
|
||||
import com.mapswithme.maps.guides.GuidesUtils;
|
||||
import com.mapswithme.maps.location.LocationService;
|
||||
import com.mapswithme.country.ActiveCountryTree;
|
||||
import com.mapswithme.country.StorageOptions;
|
||||
import com.mapswithme.util.Constants;
|
||||
import com.mapswithme.util.FbUtil;
|
||||
import com.mapswithme.util.Utils;
|
||||
|
@ -149,7 +145,7 @@ public class MWMApplication extends android.app.Application implements ActiveCou
|
|||
|
||||
// init BookmarkManager (automatically loads bookmarks)
|
||||
if (hasBookmarks())
|
||||
BookmarkManager.getBookmarkManager(getApplicationContext());
|
||||
BookmarkManager.getBookmarkManager();
|
||||
|
||||
WorkerService.startActionUpdateAds(this);
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ public abstract class AbstractBookmarkCategoryActivity extends MapsWithMeBaseLis
|
|||
{
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
mManager = BookmarkManager.getBookmarkManager(getApplicationContext());
|
||||
mManager = BookmarkManager.getBookmarkManager();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -14,7 +14,7 @@ public abstract class AbstractBookmarkCategoryAdapter extends BaseAdapter
|
|||
public AbstractBookmarkCategoryAdapter(Context context)
|
||||
{
|
||||
mContext = context;
|
||||
mManager = BookmarkManager.getBookmarkManager(context);
|
||||
mManager = BookmarkManager.getBookmarkManager();
|
||||
}
|
||||
|
||||
protected Context getContext()
|
||||
|
|
|
@ -64,7 +64,7 @@ public class BookmarkActivity extends MapsWithMeBaseFragmentActivity
|
|||
// (category index, bookmark index in category).
|
||||
final Point cab = ((ParcelablePoint) getIntent().getParcelableExtra(PIN)).getPoint();
|
||||
|
||||
mManager = BookmarkManager.getBookmarkManager(getApplicationContext());
|
||||
mManager = BookmarkManager.getBookmarkManager();
|
||||
mPin = mManager.getBookmark(cab.x, cab.y);
|
||||
mCurrentCategoryId = mPin.getCategoryId();
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ public class BookmarkListActivity extends MapsWithMeBaseListActivity
|
|||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.bookmarks_list);
|
||||
|
||||
mManager = BookmarkManager.getBookmarkManager(getApplicationContext());
|
||||
mManager = BookmarkManager.getBookmarkManager();
|
||||
|
||||
// Initialize with passed edited set.
|
||||
final int setIndex = getIntent().getIntExtra(BookmarkActivity.PIN_SET, -1);
|
||||
|
|
|
@ -1,17 +1,12 @@
|
|||
package com.mapswithme.maps.bookmarks.data;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
|
||||
public class BookmarkCategory
|
||||
{
|
||||
private final int mId;
|
||||
private String mName;
|
||||
private final Context mContext;
|
||||
|
||||
BookmarkCategory(Context c, int id)
|
||||
BookmarkCategory(int id)
|
||||
{
|
||||
mContext = c;
|
||||
mId = id;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
package com.mapswithme.maps.bookmarks.data;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Pair;
|
||||
|
||||
import com.mapswithme.maps.MWMApplication;
|
||||
import com.mapswithme.util.statistics.Statistics;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -12,26 +10,17 @@ import java.util.List;
|
|||
public class BookmarkManager
|
||||
{
|
||||
private static BookmarkManager sManager;
|
||||
private List<Bookmark> mPins;
|
||||
private List<BookmarkCategory> mPinSets;
|
||||
private final Context mContext;
|
||||
|
||||
private BookmarkManager(Context context)
|
||||
private BookmarkManager()
|
||||
{
|
||||
mContext = context;
|
||||
loadBookmarks();
|
||||
}
|
||||
|
||||
public static BookmarkManager getBookmarkManager(Context context)
|
||||
{
|
||||
if (sManager == null)
|
||||
sManager = new BookmarkManager(context.getApplicationContext());
|
||||
return sManager;
|
||||
}
|
||||
|
||||
public static BookmarkManager getBookmarkManager()
|
||||
{
|
||||
return getBookmarkManager(MWMApplication.get());
|
||||
if (sManager == null)
|
||||
sManager = new BookmarkManager();
|
||||
return sManager;
|
||||
}
|
||||
|
||||
private native void loadBookmarks();
|
||||
|
@ -65,7 +54,7 @@ public class BookmarkManager
|
|||
{
|
||||
if (id < getCategoriesCount())
|
||||
{
|
||||
return new BookmarkCategory(mContext, id);
|
||||
return new BookmarkCategory(id);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -298,7 +298,7 @@ public enum Statistics
|
|||
mEventBuilder.setName(EventParam.PRO_STAT);
|
||||
|
||||
// Number of sets
|
||||
final BookmarkManager manager = BookmarkManager.getBookmarkManager(activity);
|
||||
final BookmarkManager manager = BookmarkManager.getBookmarkManager();
|
||||
final int categoriesCount = manager.getCategoriesCount();
|
||||
if (categoriesCount > 0)
|
||||
{
|
||||
|
|
|
@ -38,7 +38,7 @@ public class MapObjectActivityBMKTest extends ActivityInstrumentationTestCase2<M
|
|||
{
|
||||
super.setUp();
|
||||
|
||||
bookmarkManager = BookmarkManager.getBookmarkManager(getInstrumentation().getTargetContext());
|
||||
bookmarkManager = BookmarkManager.getBookmarkManager();
|
||||
catbmk = bookmarkManager.addNewBookmark(BMK_NAME, BMK_LAT, BMK_LON);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue