blob: 13b70a88508cf652f041a597ea6047db41b66b51 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
package com.mapswithme.maps.bookmarks;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.CallSuper;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.StyleRes;
import android.support.v4.app.Fragment;
import com.mapswithme.maps.R;
import com.mapswithme.maps.base.BaseToolbarActivity;
import com.mapswithme.maps.bookmarks.data.BookmarkManager;
import com.mapswithme.util.SharedPropertiesUtils;
import com.mapswithme.util.ThemeUtils;
public class BookmarkCategoriesActivity extends BaseToolbarActivity
{
public static final int REQ_CODE_DOWNLOAD_BOOKMARK_CATEGORY = 102;
public static void start(@NonNull Context context)
{
context.startActivity(new Intent(context, BookmarkCategoriesActivity.class));
}
@CallSuper
@Override
public void onResume()
{
super.onResume();
// Disable all notifications in BM on appearance of this activity.
// It allows to significantly improve performance in case of bookmarks
// modification. All notifications will be sent on activity's disappearance.
BookmarkManager.INSTANCE.setNotificationsEnabled(false);
}
@CallSuper
@Override
public void onPause()
{
// Allow to send all notifications in BM.
BookmarkManager.INSTANCE.setNotificationsEnabled(true);
super.onPause();
}
@Override
@StyleRes
public int getThemeResourceId(@NonNull String theme)
{
return ThemeUtils.getWindowBgThemeResourceId(theme);
}
@Override
protected Class<? extends Fragment> getFragmentClass()
{
return BookmarkCategoriesPagerFragment.class;
}
@Override
protected int getContentLayoutResId()
{
return R.layout.bookmarks_activity;
}
public static void startForResult(@NonNull Activity context, int initialPage,
@Nullable String catalogDeeplink)
{
Bundle args = new Bundle();
args.putInt(BookmarkCategoriesPagerFragment.ARG_CATEGORIES_PAGE, initialPage);
args.putString(BookmarkCategoriesPagerFragment.ARG_CATALOG_DEEPLINK, catalogDeeplink);
Intent intent = new Intent(context, BookmarkCategoriesActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP).putExtras(args);
context.startActivityForResult(intent, REQ_CODE_DOWNLOAD_BOOKMARK_CATEGORY);
}
public static void startForResult(@NonNull Activity context)
{
int initialPage = SharedPropertiesUtils.getLastVisibleBookmarkCategoriesPage(context);
startForResult(context, initialPage, null);
}
}
|