Home
last modified time | relevance | path

Searched refs:context (Results 1 – 25 of 277) sorted by relevance

12345678910>>...12

/developers/samples/android/tv/ChannelsPrograms/Application/src/main/java/com/example/android/tv/channelsprograms/model/
DMockDatabase.java42 public static Subscription getTvShowSubscription(Context context) { in getTvShowSubscription() argument
45 context, in getTvShowSubscription()
57 public static Subscription getVideoSubscription(Context context) { in getVideoSubscription() argument
60 context, in getVideoSubscription()
72 public static Subscription getCatVideosSubscription(Context context) { in getCatVideosSubscription() argument
75 context, in getCatVideosSubscription()
82 Context context, in findOrCreateSubscription() argument
87 String title = context.getString(titleResource); in findOrCreateSubscription()
89 Subscription subscription = findSubscriptionByTitle(context, title); in findOrCreateSubscription()
96 context.getString(descriptionResource), in findOrCreateSubscription()
[all …]
/developers/samples/android/input/autofill/AutofillFramework/kotlinApp/Application/src/main/java/com/example/android/autofillframework/multidatasetservice/settings/
DMyPreferences.kt31 private fun getPrefs(context: Context): SharedPreferences { in getPrefs()
32 … return context.applicationContext.getSharedPreferences(SHARED_PREF_KEY, Context.MODE_PRIVATE) in getPrefs()
38 fun isResponseAuth(context: Context): Boolean { in isResponseAuth()
39 return getPrefs(context).getBoolean(RESPONSE_AUTH_KEY, false) in isResponseAuth()
42 fun setResponseAuth(context: Context, responseAuth: Boolean) { in setResponseAuth()
43 getPrefs(context).edit().putBoolean(RESPONSE_AUTH_KEY, responseAuth).apply() in setResponseAuth()
49 fun isDatasetAuth(context: Context): Boolean { in isDatasetAuth()
50 return getPrefs(context).getBoolean(DATASET_AUTH_KEY, false) in isDatasetAuth()
53 fun setDatasetAuth(context: Context, datasetAuth: Boolean) { in setDatasetAuth()
54 getPrefs(context).edit().putBoolean(DATASET_AUTH_KEY, datasetAuth).apply() in setDatasetAuth()
[all …]
/developers/samples/android/deprecated/wearable/wear/Notifications/Wearable/src/main/java/com/example/android/support/wearable/notifications/
DNotificationPresets.java53 private static Notification.Builder buildBasicNotification(Context context) { in buildBasicNotification() argument
54 return new Notification.Builder(context) in buildBasicNotification()
55 .setContentTitle(context.getString(R.string.example_content_title)) in buildBasicNotification()
56 .setContentText(context.getString(R.string.example_content_text)) in buildBasicNotification()
58 .setContentIntent(PendingIntent.getActivity(context, 0, in buildBasicNotification()
59 new Intent(context, MainActivity.class), 0)) in buildBasicNotification()
69 public Notification buildNotification(Context context) { in buildNotification() argument
70 PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, in buildNotification()
71 new Intent(context, MainActivity.class), 0); in buildNotification()
73 Notification page2 = buildBasicNotification(context) in buildNotification()
[all …]
/developers/samples/android/input/autofill/AutofillFramework/kotlinApp/Application/src/main/java/com/example/android/autofillframework/multidatasetservice/datasource/
DSharedPrefsAutofillRepository.kt37 private fun getPrefs(context: Context): SharedPreferences { in <lambda>()
38 … return context.applicationContext.getSharedPreferences(SHARED_PREF_KEY, Context.MODE_PRIVATE) in <lambda>()
41 …override fun getFilledAutofillFieldCollection(context: Context, focusedAutofillHints: List<String>, in <lambda>()
45 val clientFormDataStringSet = getAllAutofillDataStringSet(context) in <lambda>()
71 …override fun saveFilledAutofillFieldCollection(context: Context, filledAutofillFieldCollection: Fi… in <lambda>()
72 val datasetName = "dataset-" + getDatasetNumber(context) in <lambda>()
74 val allAutofillData = getAllAutofillDataStringSet(context) in <lambda>()
77 saveAllAutofillDataStringSet(context, allAutofillData) in <lambda>()
78 incrementDatasetNumber(context) in <lambda>()
81 override fun clear(context: Context) { in <lambda>()
[all …]
/developers/samples/android/deprecated/wearable/wear/Notifications/Application/src/main/java/com/example/android/support/wearable/notifications/
DNotificationPresets.java70 private static NotificationCompat.Builder applyBasicOptions(Context context, in applyBasicOptions() argument
77 context, R.string.example_notification_deleted)); in applyBasicOptions()
78 options.actionsPreset.apply(context, builder, wearableOptions); in applyBasicOptions()
82 context.getResources(), R.drawable.example_large_icon)); in applyBasicOptions()
88 builder.setContentIntent(NotificationUtil.getExamplePendingIntent(context, in applyBasicOptions()
104 public Notification[] buildNotifications(Context context, BuildOptions options) { in buildNotifications() argument
105 NotificationCompat.Builder builder = new NotificationCompat.Builder(context); in buildNotifications()
108 applyBasicOptions(context, builder, wearableOptions, options); in buildNotifications()
121 public Notification[] buildNotifications(Context context, BuildOptions options) { in buildNotifications() argument
158 NotificationCompat.Builder builder = new NotificationCompat.Builder(context) in buildNotifications()
[all …]
DActionsPresets.java45 public void apply(Context context, NotificationCompat.Builder builder, in apply() argument
56 public void apply(Context context, NotificationCompat.Builder builder, in apply() argument
59 context.getString(R.string.example_action), in apply()
60 NotificationUtil.getExamplePendingIntent(context, in apply()
72 public void apply(Context context, NotificationCompat.Builder builder, in apply() argument
75 context.getString(R.string.example_action_long_title), in apply()
76 NotificationUtil.getExamplePendingIntent(context, in apply()
88 public void apply(Context context, NotificationCompat.Builder builder, in apply() argument
91 .setLabel(context.getString(R.string.example_reply_label)) in apply()
95 context.getString(R.string.example_reply_action), in apply()
[all …]
/developers/samples/android/deprecated/wearable/wear/WearMessagingApp/Wearable/src/main/java/com/example/android/wearable/wear/messaging/mock/
DMockDatabase.java63 public static Chat createChat(Context context, Collection<Profile> participants, Profile user) { in createChat() argument
84 Collection<Chat> allChats = getAllChats(context); in createChat()
92 persistsChats(context, allChats); in createChat()
97 private static void persistsChats(Context context, Collection<Chat> chats) { in persistsChats() argument
98 SharedPreferencesHelper.writeChatsToJsonPref(context, new ArrayList<>(chats)); in persistsChats()
118 public static Collection<Chat> getAllChats(Context context) { in getAllChats() argument
120 return SharedPreferencesHelper.readChatsFromJsonPref(context); in getAllChats()
134 public static Chat findChatById(Context context, String id) { in findChatById() argument
135 return findChat(getAllChats(context), id); in findChatById()
144 private static void updateLastMessage(Context context, Chat chat, Message lastMessage) { in updateLastMessage() argument
[all …]
/developers/samples/android/admin/DeviceOwner/Application/src/main/java/com/example/android/deviceowner/
DDeviceOwnerReceiver.java36 public void onProfileProvisioningComplete(Context context, Intent intent) { in onProfileProvisioningComplete() argument
39 (DevicePolicyManager) context.getSystemService(Context.DEVICE_POLICY_SERVICE); in onProfileProvisioningComplete()
40 ComponentName componentName = getComponentName(context); in onProfileProvisioningComplete()
41 manager.setProfileName(componentName, context.getString(R.string.profile_name)); in onProfileProvisioningComplete()
43 Intent launch = new Intent(context, MainActivity.class); in onProfileProvisioningComplete()
45 context.startActivity(launch); in onProfileProvisioningComplete()
52 public static ComponentName getComponentName(Context context) { in getComponentName() argument
53 return new ComponentName(context.getApplicationContext(), DeviceOwnerReceiver.class); in getComponentName()
/developers/samples/android/deprecated/wearable/wear/WearMessagingApp/Wearable/src/main/java/com/example/android/wearable/wear/messaging/util/
DSharedPreferencesHelper.java52 public static Profile readUserFromJsonPref(Context context) { in readUserFromJsonPref() argument
53 SharedPreferences sharedPreferences = context.getSharedPreferences(Constants.PREFS_NAME, 0); in readUserFromJsonPref()
72 public static void writeUserToJsonPref(Context context, Profile user) { in writeUserToJsonPref() argument
73 SharedPreferences sharedPreferences = context.getSharedPreferences(Constants.PREFS_NAME, 0); in writeUserToJsonPref()
85 public static List<Profile> readContactsFromJsonPref(Context context) { in readContactsFromJsonPref() argument
87 return getList(context, Profile.class, Constants.PREFS_CONTACTS_KEY); in readContactsFromJsonPref()
102 public static void writeContactsToJsonPref(Context context, List<Profile> contacts) { in writeContactsToJsonPref() argument
103 setList(context, contacts, Constants.PREFS_CONTACTS_KEY); in writeContactsToJsonPref()
113 public static List<Chat> readChatsFromJsonPref(Context context) throws IOException { in readChatsFromJsonPref() argument
115 return getList(context, Chat.class, Constants.PREFS_CHATS_KEY); in readChatsFromJsonPref()
[all …]
/developers/samples/android/notification/MessagingService/Application/src/main/java/com/example/android/messagingservice/
DMessageLogger.java39 public static void logMessage(Context context, String message) { in logMessage() argument
40 SharedPreferences prefs = getPrefs(context); in logMessage()
47 public static SharedPreferences getPrefs(Context context) { in getPrefs() argument
48 return context.getSharedPreferences(PREF_MESSAGE, Context.MODE_PRIVATE); in getPrefs()
51 public static String getAllMessages(Context context) { in getAllMessages() argument
52 return getPrefs(context).getString(LOG_KEY, ""); in getAllMessages()
55 public static void clear(Context context) { in clear() argument
56 getPrefs(context).edit().remove(LOG_KEY).apply(); in clear()
/developers/samples/android/ui/activityscenetransition/ActivitySceneTransitionBasic/Application/src/main/java/com/example/android/activityscenetransitionbasic/
DSquareFrameLayout.java28 public SquareFrameLayout(Context context) { in SquareFrameLayout() argument
29 super(context); in SquareFrameLayout()
32 public SquareFrameLayout(Context context, AttributeSet attrs) { in SquareFrameLayout() argument
33 super(context, attrs); in SquareFrameLayout()
36 public SquareFrameLayout(Context context, AttributeSet attrs, int defStyleAttr) { in SquareFrameLayout() argument
37 super(context, attrs, defStyleAttr); in SquareFrameLayout()
40 public SquareFrameLayout(Context context, AttributeSet attrs, in SquareFrameLayout() argument
42 super(context, attrs, defStyleAttr, defStyleRes); in SquareFrameLayout()
/developers/samples/android/wearable/wear/WearAccessibilityApp/Wearable/src/main/java/com/example/android/wearable/wear/wearaccessibilityapp/
DMockDatabase.java38 public static MessagingStyleCommsAppData getMessagingStyleData(Context context) { in getMessagingStyleData() argument
39 return MessagingStyleCommsAppData.getInstance(context); in getMessagingStyleData()
60 public static MessagingStyleCommsAppData getInstance(Context context) { in getInstance() argument
62 sInstance = getSync(context); in getInstance()
67 private static synchronized MessagingStyleCommsAppData getSync(Context context) { in getSync() argument
69 sInstance = new MessagingStyleCommsAppData(context); in getSync()
75 private MessagingStyleCommsAppData(Context context) { in MessagingStyleCommsAppData() argument
93 IconCompat.createWithResource(context, R.drawable.me_macdonald)) in MessagingStyleCommsAppData()
102 IconCompat.createWithResource(context, R.drawable.famous_fryer)) in MessagingStyleCommsAppData()
110 .setIcon(IconCompat.createWithResource(context, R.drawable.wendy_wonda)) in MessagingStyleCommsAppData()
[all …]
/developers/samples/android/content/WidgetData/Application/src/main/java/com/example/android/widgetdata/
DWeatherWidgetProvider.java88 public void onEnabled(Context context) { in onEnabled() argument
93 final ContentResolver r = context.getContentResolver(); in onEnabled()
95 final AppWidgetManager mgr = AppWidgetManager.getInstance(context); in onEnabled()
96 final ComponentName cn = new ComponentName(context, WeatherWidgetProvider.class); in onEnabled()
110 final Context context = ctx; in onReceive() local
115 final ContentResolver r = context.getContentResolver(); in onReceive()
132 final AppWidgetManager mgr = AppWidgetManager.getInstance(context); in onReceive()
133 … final ComponentName cn = new ComponentName(context, WeatherWidgetProvider.class); in onReceive()
152 private RemoteViews buildLayout(Context context, int appWidgetId, boolean largeLayout) { in buildLayout() argument
157 final Intent intent = new Intent(context, WeatherWidgetService.class); in buildLayout()
[all …]
/developers/samples/android/tv/ChannelsPrograms/Application/src/main/java/com/example/android/tv/channelsprograms/util/
DSharedPreferencesHelper.java60 public static List<Subscription> readSubscriptions(Context context) { in readSubscriptions() argument
61 return getList(context, Subscription.class, PREFS_SUBSCRIPTIONS_KEY); in readSubscriptions()
70 public static void storeSubscriptions(Context context, List<Subscription> subscriptions) { in storeSubscriptions() argument
71 setList(context, subscriptions, PREFS_SUBSCRIPTIONS_KEY); in storeSubscriptions()
81 public static List<Movie> readMovies(Context context, long channelId) { in readMovies() argument
82 return getList(context, Movie.class, PREFS_SUBSCRIBED_MOVIES_PREFIX + channelId); in readMovies()
92 public static void storeMovies(Context context, long channelId, List<Movie> movies) { in storeMovies() argument
93 setList(context, movies, PREFS_SUBSCRIBED_MOVIES_PREFIX + channelId); in storeMovies()
107 private static <T> List<T> getList(Context context, Class<T> clazz, String key) { in getList() argument
109 context.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE); in getList()
[all …]
DTvUtil.java63 public static long createChannel(Context context, Subscription subscription) { in createChannel() argument
67 context.getContentResolver() in createChannel()
99 context.getContentResolver() in createChannel()
108 Bitmap bitmap = convertToBitmap(context, subscription.getChannelLogo()); in createChannel()
109 ChannelLogoUtils.storeChannelLogo(context, channelId, bitmap); in createChannel()
114 public static int getNumberOfChannels(Context context) { in getNumberOfChannels() argument
116 context.getContentResolver() in getNumberOfChannels()
135 public static Bitmap convertToBitmap(Context context, int resourceId) { in convertToBitmap() argument
136 Drawable drawable = context.getDrawable(resourceId); in convertToBitmap()
149 return BitmapFactory.decodeResource(context.getResources(), resourceId); in convertToBitmap()
[all …]
/developers/samples/android/input/autofill/AutofillFramework/Application/src/main/java/com/example/android/autofill/app/view/autofillable/
DScrollableCustomVirtualView.java35 public ScrollableCustomVirtualView(Context context) { in ScrollableCustomVirtualView() argument
36 this(context, null); in ScrollableCustomVirtualView()
39 public ScrollableCustomVirtualView(Context context, AttributeSet attrs) { in ScrollableCustomVirtualView() argument
40 this(context, attrs, 0); in ScrollableCustomVirtualView()
44 public ScrollableCustomVirtualView(Context context, @Nullable AttributeSet attrs, in ScrollableCustomVirtualView() argument
46 this(context, attrs, defStyleAttr, 0); in ScrollableCustomVirtualView()
49 public ScrollableCustomVirtualView(Context context, @Nullable AttributeSet attrs, in ScrollableCustomVirtualView() argument
51 super(context, attrs, defStyleAttr, defStyleRes); in ScrollableCustomVirtualView()
52 mGestureDetector = new GestureDetector(context, this); in ScrollableCustomVirtualView()
/developers/samples/android/wearable/wear/JumpingJack/Wearable/src/main/java/com/example/android/wearable/jumpingjack/
DUtils.java36 public final static void vibrate(Context context, int duration) { in vibrate() argument
40 Vibrator v = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE); in vibrate()
48 public static void saveCounterToPreference(Context context, int value) { in saveCounterToPreference() argument
49 SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(context); in saveCounterToPreference()
62 public static int getCounterFromPreference(Context context) { in getCounterFromPreference() argument
63 SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(context); in getCounterFromPreference()
/developers/samples/android/input/autofill/AutofillFramework/Application/src/main/java/com/example/android/autofill/app/view/widget/
DInfoButton.java28 public InfoButton(Context context) { in InfoButton() argument
29 this(context, null); in InfoButton()
32 public InfoButton(Context context, AttributeSet attrs) { in InfoButton() argument
33 this(context, attrs, 0); in InfoButton()
36 public InfoButton(Context context, AttributeSet attrs, int defStyleAttr) { in InfoButton() argument
37 super(context, attrs, defStyleAttr); in InfoButton()
38 TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.InfoButton, in InfoButton()
/developers/samples/android/notification/Bubbles/app/src/main/java/com/example/android/bubbles/data/
DNotificationHelper.kt36 class NotificationHelper(private val context: Context) { in <lambda>() constant in com.example.android.bubbles.data.NotificationHelper
48 private val notificationManager = context.getSystemService(NotificationManager::class.java) in <lambda>()
55 context.getString(R.string.channel_new_messages), in <lambda>()
59 description = context.getString(R.string.channel_new_messages_description) in <lambda>()
69 context.resources, in <lambda>()
78 val builder = Notification.Builder(context, CHANNEL_NEW_MESSAGES) in <lambda>()
83 … .setDesiredHeight(context.resources.getDimensionPixelSize(R.dimen.bubble_height)) in <lambda>()
99 context, in <lambda>()
102 Intent(context, BubbleActivity::class.java) in <lambda>()
122 context, in <lambda>()
[all …]
/developers/samples/android/admin/AppRestrictionEnforcer/Application/src/main/java/com/example/android/apprestrictionenforcer/
DEnforcerDeviceAdminReceiver.java36 public void onProfileProvisioningComplete(Context context, Intent intent) { in onProfileProvisioningComplete() argument
38 Intent launch = new Intent(context, EnableProfileActivity.class); in onProfileProvisioningComplete()
40 context.startActivity(launch); in onProfileProvisioningComplete()
47 public static ComponentName getComponentName(Context context) { in getComponentName() argument
48 return new ComponentName(context.getApplicationContext(), in getComponentName()
/developers/samples/android/admin/BasicManagedProfile/Application/src/main/java/com/example/android/basicmanagedprofile/
DBasicDeviceAdminReceiver.java36 public void onProfileProvisioningComplete(Context context, Intent intent) { in onProfileProvisioningComplete() argument
38 Intent launch = new Intent(context, EnableProfileActivity.class); in onProfileProvisioningComplete()
40 context.startActivity(launch); in onProfileProvisioningComplete()
47 public static ComponentName getComponentName(Context context) { in getComponentName() argument
48 return new ComponentName(context.getApplicationContext(), BasicDeviceAdminReceiver.class); in getComponentName()
/developers/samples/android/ui/views/FloatingActionButton/FloatingActionButtonBasic/Application/src/main/java/com/example/android/floatingactionbuttonbasic/
DFloatingActionButton.java63 public FloatingActionButton(Context context) { in FloatingActionButton() argument
64 this(context, null, 0, 0); in FloatingActionButton()
67 public FloatingActionButton(Context context, AttributeSet attrs) { in FloatingActionButton() argument
68 this(context, attrs, 0, 0); in FloatingActionButton()
71 public FloatingActionButton(Context context, AttributeSet attrs, int defStyleAttr) { in FloatingActionButton() argument
72 this(context, attrs, defStyleAttr, 0); in FloatingActionButton()
75 public FloatingActionButton(Context context, AttributeSet attrs, int defStyleAttr, in FloatingActionButton() argument
77 super(context, attrs, defStyleAttr); in FloatingActionButton()
/developers/samples/android/media/Camera2Basic/Application/src/main/java/com/example/android/camera2basic/
DAutoFitTextureView.java31 public AutoFitTextureView(Context context) { in AutoFitTextureView() argument
32 this(context, null); in AutoFitTextureView()
35 public AutoFitTextureView(Context context, AttributeSet attrs) { in AutoFitTextureView() argument
36 this(context, attrs, 0); in AutoFitTextureView()
39 public AutoFitTextureView(Context context, AttributeSet attrs, int defStyle) { in AutoFitTextureView() argument
40 super(context, attrs, defStyle); in AutoFitTextureView()
/developers/samples/android/media/Camera2Video/Application/src/main/java/com/example/android/camera2video/
DAutoFitTextureView.java31 public AutoFitTextureView(Context context) { in AutoFitTextureView() argument
32 this(context, null); in AutoFitTextureView()
35 public AutoFitTextureView(Context context, AttributeSet attrs) { in AutoFitTextureView() argument
36 this(context, attrs, 0); in AutoFitTextureView()
39 public AutoFitTextureView(Context context, AttributeSet attrs, int defStyle) { in AutoFitTextureView() argument
40 super(context, attrs, defStyle); in AutoFitTextureView()
/developers/samples/android/views/EmojiCompat/app/src/main/java/com/example/android/emojicompat/
DCustomTextView.java37 public CustomTextView(Context context) { in CustomTextView() argument
38 this(context, null); in CustomTextView()
41 public CustomTextView(Context context, @Nullable AttributeSet attrs) { in CustomTextView() argument
42 this(context, attrs, 0); in CustomTextView()
45 public CustomTextView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { in CustomTextView() argument
46 super(context, attrs, defStyleAttr); in CustomTextView()

12345678910>>...12