List of usage examples for android.content Intent ACTION_LOCALE_CHANGED
String ACTION_LOCALE_CHANGED
To view the source code for android.content Intent ACTION_LOCALE_CHANGED.
Click Source Link
From source file:com.ruesga.rview.receivers.NotificationReceiver.java
@Override public void onReceive(Context context, Intent intent) { final String action = intent != null ? intent.getAction() : null; if (Intent.ACTION_LOCALE_CHANGED.equals(action)) { // If locale changed then recreate the notifications to display the labels // in the correct language NotificationsHelper.recreateNotifications(context); } else if (ACTION_NOTIFICATION_DISMISSED.equals(action)) { dismissNotifications(context, intent); } else if (ACTION_NOTIFICATION_REPLY.equals(action)) { replyToNotification(context, intent); }// www . j ava2 s. co m }
From source file:com.androidinspain.deskclock.data.StopwatchModel.java
StopwatchModel(Context context, SharedPreferences prefs, NotificationModel notificationModel) { mContext = context;/*www. jav a 2s . co m*/ mPrefs = prefs; mNotificationModel = notificationModel; mNotificationManager = NotificationManagerCompat.from(context); // Update stopwatch notification when locale changes. final IntentFilter localeBroadcastFilter = new IntentFilter(Intent.ACTION_LOCALE_CHANGED); mContext.registerReceiver(mLocaleChangedReceiver, localeBroadcastFilter); }
From source file:com.android.deskclock.data.StopwatchModel.java
StopwatchModel(Context context, NotificationModel notificationModel) { mContext = context;/* w w w . j a v a2s .c o m*/ mNotificationModel = notificationModel; mNotificationManager = NotificationManagerCompat.from(context); // Update stopwatch notification when locale changes. final IntentFilter localeBroadcastFilter = new IntentFilter(Intent.ACTION_LOCALE_CHANGED); mContext.registerReceiver(mLocaleChangedReceiver, localeBroadcastFilter); }
From source file:com.android.leanlauncher.LauncherAppState.java
private LauncherAppState() { if (sContext == null) { throw new IllegalStateException("LauncherAppState inited before app context set"); }//from w w w . j a va 2 s. c o m Log.v(Launcher.TAG, "LauncherAppState inited"); // set sIsScreenXLarge and mScreenDensity *before* creating icon cache mIsScreenLarge = isScreenLarge(sContext.getResources()); mScreenDensity = sContext.getResources().getDisplayMetrics().density; recreateWidgetPreviewDb(); mIconCache = new IconCache(sContext); mItemIdToViewId = new ArrayMap<>(); mModel = new LauncherModel(this, mIconCache); final LauncherAppsCompat launcherApps = LauncherAppsCompat.getInstance(sContext); launcherApps.addOnAppsChangedCallback(mModel); // Register intent receivers IntentFilter filter = new IntentFilter(); filter.addAction(Intent.ACTION_LOCALE_CHANGED); filter.addAction(Intent.ACTION_CONFIGURATION_CHANGED); sContext.registerReceiver(mModel, filter); }
From source file:com.android.deskclock.data.TimerModel.java
TimerModel(Context context, SettingsModel settingsModel, NotificationModel notificationModel) { mContext = context;//from ww w . j a v a2 s. c o m mSettingsModel = settingsModel; mNotificationModel = notificationModel; mNotificationManager = NotificationManagerCompat.from(context); mAlarmManager = (AlarmManager) mContext.getSystemService(Context.ALARM_SERVICE); // Clear caches affected by preferences when preferences change. final SharedPreferences prefs = Utils.getDefaultSharedPreferences(mContext); prefs.registerOnSharedPreferenceChangeListener(mPreferenceListener); // Update stopwatch notification when locale changes. final IntentFilter localeBroadcastFilter = new IntentFilter(Intent.ACTION_LOCALE_CHANGED); mContext.registerReceiver(mLocaleChangedReceiver, localeBroadcastFilter); }
From source file:com.onyx.deskclock.deskclock.data.TimerModel.java
TimerModel(Context context, SettingsModel settingsModel, NotificationModel notificationModel) { mContext = context;/*ww w . j a v a 2s . c o m*/ mSettingsModel = settingsModel; mNotificationModel = notificationModel; mNotificationManager = NotificationManagerCompat.from(context); mAlarmManager = (AlarmManager) mContext.getSystemService(Context.ALARM_SERVICE); // Clear caches affected by preferences when preferences change. final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(mContext); prefs.registerOnSharedPreferenceChangeListener(mPreferenceListener); // Update stopwatch notification when locale changes. final IntentFilter localeBroadcastFilter = new IntentFilter(Intent.ACTION_LOCALE_CHANGED); mContext.registerReceiver(mLocaleChangedReceiver, localeBroadcastFilter); }
From source file:com.androidinspain.deskclock.data.TimerModel.java
TimerModel(Context context, SharedPreferences prefs, SettingsModel settingsModel, RingtoneModel ringtoneModel, NotificationModel notificationModel) { mContext = context;/*w w w . j a v a 2s . c o m*/ mPrefs = prefs; mSettingsModel = settingsModel; mRingtoneModel = ringtoneModel; mNotificationModel = notificationModel; mNotificationManager = NotificationManagerCompat.from(context); mAlarmManager = (AlarmManager) mContext.getSystemService(Context.ALARM_SERVICE); // Clear caches affected by preferences when preferences change. prefs.registerOnSharedPreferenceChangeListener(mPreferenceListener); // Update timer notification when locale changes. final IntentFilter localeBroadcastFilter = new IntentFilter(Intent.ACTION_LOCALE_CHANGED); mContext.registerReceiver(mLocaleChangedReceiver, localeBroadcastFilter); }
From source file:com.android.launcher3.widget.DigitalAppWidgetProvider.java
@Override public void onReceive(Context context, Intent intent) { mComtext = context;//w ww.j a va2s . c o m String action = intent.getAction(); Log.i("sai", "onReceive: " + action); super.onReceive(context, intent); if (ACTION_ON_QUARTER_HOUR.equals(action) || Intent.ACTION_DATE_CHANGED.equals(action) || Intent.ACTION_TIMEZONE_CHANGED.equals(action) || Intent.ACTION_TIME_CHANGED.equals(action) || Intent.ACTION_LOCALE_CHANGED.equals(action)) { AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context); if (appWidgetManager != null) { int[] appWidgetIds = appWidgetManager.getAppWidgetIds(getComponentName(context)); for (int appWidgetId : appWidgetIds) { RemoteViews widget = new RemoteViews(context.getPackageName(), R.layout.digital_appwidget); float ratio = WidgetUtils.getScaleRatio(context, null, appWidgetId); // SPRD for bug421127 add am/pm for widget WidgetUtils.setTimeFormat(widget, (int) context.getResources().getDimension(R.dimen.widget_label_font_size), R.id.the_clock); WidgetUtils.setClockSize(context, widget, ratio); //refreshAlarm(context, widget); appWidgetManager.partiallyUpdateAppWidget(appWidgetId, widget); } } if (!ACTION_ON_QUARTER_HOUR.equals(action)) { cancelAlarmOnQuarterHour(context); } startAlarmOnQuarterHour(context); } // cg sai.pan begin else if (BluetoothAdapter.ACTION_STATE_CHANGED.equals(action)) { AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context); if (appWidgetManager != null) { int[] appWidgetIds = appWidgetManager.getAppWidgetIds(getComponentName(context)); for (int appWidgetId : appWidgetIds) { RemoteViews widget = new RemoteViews(context.getPackageName(), R.layout.digital_appwidget); refreshBtStatus(context, widget); appWidgetManager.partiallyUpdateAppWidget(appWidgetId, widget); } } } else if (WifiManager.WIFI_STATE_CHANGED_ACTION.equals(action)) { int wifiStatus = intent.getIntExtra(WifiManager.EXTRA_WIFI_STATE, 0); Log.e("sai", "wifiStatus" + wifiStatus); AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context); if (appWidgetManager != null) { int[] appWidgetIds = appWidgetManager.getAppWidgetIds(getComponentName(context)); for (int appWidgetId : appWidgetIds) { RemoteViews widget = new RemoteViews(context.getPackageName(), R.layout.digital_appwidget); if (WifiManager.WIFI_STATE_ENABLED == wifiStatus || WifiManager.WIFI_STATE_ENABLING == wifiStatus) { widget.setImageViewResource(R.id.wifi, R.drawable.status_wifi_on); } else { widget.setImageViewResource(R.id.wifi, R.drawable.status_wifi_off); } appWidgetManager.partiallyUpdateAppWidget(appWidgetId, widget); } } } else if (WifiManager.NETWORK_STATE_CHANGED_ACTION.equals(action)) { AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context); if (appWidgetManager != null) { int[] appWidgetIds = appWidgetManager.getAppWidgetIds(getComponentName(context)); for (int appWidgetId : appWidgetIds) { RemoteViews widget = new RemoteViews(context.getPackageName(), R.layout.digital_appwidget); refreshWifiStatus(context, widget); } } } else if ("android.net.conn.CONNECTIVITY_CHANGE".equals(action)) { if (isNetworkConnected(context)) { Log.e("sai", "isNetworkConnected true"); requestLocation(context); } else { Log.e("sai", "isNetworkConnected false"); } } }
From source file:com.yattatech.dbtc.activity.AbstractChainTaskScreen.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); final boolean smallLayout = HardwareUtil.SMALL_LAYOUT; if (smallLayout) { Debug.d(mTag, "Running on a very tiny small piece of hardware, let's put ActionBar away"); requestWindowFeature(Window.FEATURE_NO_TITLE); }// w w w . j av a 2 s .c o m setContentView(R.layout.layout_chaintask_screen); mMonth = Calendar.getInstance(); mFilter = new IntentFilter(); mLocaleChangedFilter = new IntentFilter(); mCalendarDayAdapter = new CalendarDayAdapter(); mGridViewDay = (GridView) findViewById(R.id.gridviewDay); mGridView = (GridView) findViewById(R.id.gridview); mTxDateTitle = (TextView) findViewById(R.id.dateTitle); mTxLeftIcon = findViewById(R.id.previous); mTxRightIcon = findViewById(R.id.next); mImgTwitter = (TextView) findViewById(R.id.imgTwitter); mTxTaskname = (TextView) findViewById(R.id.txTaskname); final Bundle bundle = getIntent().getExtras(); mTask = (Task) ((bundle == null) ? null : bundle.getParcelable(Constants.TASK_KEY)); if (mTask == null) { Debug.d(mTag, "Task must be supplied"); throw new IllegalStateException(getClass().getSimpleName() + " cannot be called with Task null"); } mTxTaskname.setText(mTask.mName); mImgTwitter.setOnClickListener(mTwitterClickListener); mGridViewDay.setAdapter(mCalendarDayAdapter); mTxLeftIcon.setOnClickListener(mArrowsClickListener); mTxRightIcon.setOnClickListener(mArrowsClickListener); mFilter.addAction(TWITTER_LOGIN_ACTION); mLocaleChangedFilter.addAction(Intent.ACTION_LOCALE_CHANGED); if (!smallLayout) { setActionBar(); } CurrentDateUtil.updateCurrentDate(); registerReceiver(mLocaleChangedReceiver, mLocaleChangedFilter); }
From source file:com.yattatech.dbtc.activity.MainScreen.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.layout_main_screen); final int color = getResources().getColor(R.color.grey2); final ActionBar actionBar = getActionBar(); mFilter = new IntentFilter(); mLocaleChangedFilter = new IntentFilter(); mTaskList = (DragSortListView) findViewById(R.id.taskList); mTaskListAdapter = new TaskListAdapter(this); final String appKey = getString(R.string.dropbox_key); final String appSecret = getString(R.string.dropbox_secret); final AppKeyPair pair = new AppKeyPair(appKey, appSecret); final AndroidAuthSession session = new AndroidAuthSession(pair); mDropboxAPI = new DropboxAPI<AndroidAuthSession>(session); mToken = FACADE.getDropBoxToken();//from w w w . j a va 2 s . c om mTaskList.setAdapter(mTaskListAdapter); mTaskList.setOnItemClickListener(mTaskListListener); mTaskList.setDropListener(mDropListener); mTaskList.setDragScrollProfile(mScrollProfile); mTaskList.setFloatViewManager(new MainViewManager(mTaskList)); mFilter.addAction(ADD_NEW_TASK_ACTION); mFilter.addAction(EDIT_TASK_ACTION); mFilter.addAction(REMOVE_TASK_ACTION); mFilter.addAction(BACKUP_RESTORE_ACTION); mLocaleChangedFilter.addAction(Intent.ACTION_LOCALE_CHANGED); actionBar.setIcon(R.drawable.ic_task); actionBar.setTitle(R.string.app_name); actionBar.setBackgroundDrawable(new ColorDrawable(color)); Broadcaster.registerLocalReceiver(mReceiver, mFilter); registerReceiver(mLocaleChangedReceiver, mLocaleChangedFilter); registerForContextMenu(mTaskList); final List<Task> tasks = FACADE.getTasks(); mTaskListAdapter.setElements(FACADE.restoreDataOrder(tasks)); }