List of usage examples for android.content Intent CATEGORY_APP_CALENDAR
String CATEGORY_APP_CALENDAR
To view the source code for android.content Intent CATEGORY_APP_CALENDAR.
Click Source Link
From source file:com.farmerbb.taskbar.activity.KeyboardShortcutActivity.java
@SuppressWarnings("deprecation") @Override//ww w . j a va2s . c o m protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Perform different actions depending on how this activity was launched switch (getIntent().getAction()) { case Intent.ACTION_MAIN: Intent selector = getIntent().getSelector(); Set<String> categories = selector != null ? selector.getCategories() : getIntent().getCategories(); if (categories.contains(Intent.CATEGORY_APP_MAPS)) { SharedPreferences pref = U.getSharedPreferences(this); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N && pref.getBoolean("freeform_hack", false) && isInMultiWindowMode() && !FreeformHackHelper.getInstance().isFreeformHackActive()) { U.startFreeformHack(this, false, false); } Intent startStopIntent; if (pref.getBoolean("taskbar_active", false)) startStopIntent = new Intent("com.farmerbb.taskbar.QUIT"); else startStopIntent = new Intent("com.farmerbb.taskbar.START"); startStopIntent.setPackage(BuildConfig.APPLICATION_ID); sendBroadcast(startStopIntent); } else if (categories.contains(Intent.CATEGORY_APP_CALENDAR)) U.lockDevice(this); break; case Intent.ACTION_ASSIST: if (U.isServiceRunning(this, StartMenuService.class)) { LocalBroadcastManager.getInstance(this) .sendBroadcast(new Intent("com.farmerbb.taskbar.TOGGLE_START_MENU")); } else { Intent intent = new Intent("com.google.android.googlequicksearchbox.TEXT_ASSIST"); if (intent.resolveActivity(getPackageManager()) == null) intent = new Intent(SearchManager.INTENT_ACTION_GLOBAL_SEARCH); if (intent.resolveActivity(getPackageManager()) != null) { SharedPreferences pref = U.getSharedPreferences(this); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N && pref.getBoolean("freeform_hack", false) && isInMultiWindowMode()) { intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_MULTIPLE_TASK); U.launchAppMaximized(getApplicationContext(), intent); } else { intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); } } } break; } finish(); }
From source file:com.nbplus.vbroadlauncher.fragment.LauncherFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View v = inflater.inflate(R.layout.fragment_launcher, container, false); mMainViewLayout = (LinearLayout) v.findViewById(R.id.main_view_layout); // push agent ??. mPushServiceStatus = (ImageView) v.findViewById(R.id.ic_nav_wifi); if (((BaseActivity) getActivity()).isPushServiceConnected()) { mPushServiceStatus.setImageResource(R.drawable.ic_nav_wifi_on); } else {/*from w w w. jav a 2 s. c o m*/ mPushServiceStatus.setImageResource(R.drawable.ic_nav_wifi_off); } mVillageName = (TextView) v.findViewById(R.id.launcher_village_name); mVillageName.setText(LauncherSettings.getInstance(getActivity()).getVillageName()); mApplicationsView = (LinearLayout) v.findViewById(R.id.ic_nav_apps); mApplicationsView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(getActivity(), ShowApplicationActivity.class); startActivity(intent); getActivity().overridePendingTransition(R.anim.fade_in, R.anim.fade_out); } }); mServiceTreeMap = (LinearLayout) v.findViewById(R.id.ic_nav_show_map); mServiceTreeMap.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (!NetworkUtils.isConnected(getActivity())) { ((BaseActivity) getActivity()).showNetworkConnectionAlertDialog(); return; } Intent intent = new Intent(getActivity(), BroadcastWebViewActivity.class); ShortcutData data = new ShortcutData(Constants.SHORTCUT_TYPE_WEB_DOCUMENT_SERVER, R.string.btn_show_map, getActivity().getResources().getString(R.string.addr_show_map), R.drawable.ic_menu_04, R.drawable.ic_menu_shortcut_02_selector, 0, null); VBroadcastServer serverInfo = LauncherSettings.getInstance(getActivity()).getServerInformation(); data.setDomain(serverInfo.getDocServer()); intent.putExtra(Constants.EXTRA_NAME_SHORTCUT_DATA, data); startActivity(intent); } }); mOutdoorMode = (LinearLayout) v.findViewById(R.id.ic_nav_outdoor); mOutdoorText = (TextView) v.findViewById(R.id.tv_outdoor); if (LauncherSettings.getInstance(getActivity()).isOutdoorMode()) { mOutdoorText.setTextColor(getResources().getColor(R.color.btn_color_absentia_on)); mOutdoorText.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_nav_absentia_on, 0, 0, 0); } else { mOutdoorText.setTextColor(getResources().getColor(R.color.btn_color_absentia_off)); mOutdoorText.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_nav_absentia_off, 0, 0, 0); } mOutdoorMode.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Toast toast; boolean mode = false; if (LauncherSettings.getInstance(getActivity()).isOutdoorMode()) { LauncherSettings.getInstance(getActivity()).setIsOutdoorMode(false); mOutdoorText.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_nav_absentia_off, 0, 0, 0); mOutdoorText.setTextColor(getResources().getColor(R.color.btn_color_absentia_off)); toast = Toast.makeText(getActivity(), R.string.outdoor_mode_off, Toast.LENGTH_SHORT); toast.setGravity(Gravity.CENTER_VERTICAL, 0, 0); toast.show(); } else { mode = true; LauncherSettings.getInstance(getActivity()).setIsOutdoorMode(true); mOutdoorText.setTextColor(getResources().getColor(R.color.btn_color_absentia_on)); mOutdoorText.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_nav_absentia_on, 0, 0, 0); toast = Toast.makeText(getActivity(), R.string.outdoor_mode_on, Toast.LENGTH_SHORT); toast.setGravity(Gravity.CENTER_VERTICAL, 0, 0); toast.show(); } HomeLauncherApplication application = (HomeLauncherApplication) getActivity() .getApplicationContext(); if (application != null) { application.outdoorModeChanged(mode); } } }); // ?? ? mIoTDataSync = (LinearLayout) v.findViewById(R.id.ic_iot_data_sync); mIoTDataSyncText = (TextView) v.findViewById(R.id.tv_iot_data_sync); mIoTDataSync.setOnClickListener(mIoTSyncClickListener); mIoTDataSync.setClickable(true); mIoTDataSync.setEnabled(true); mTextClock = (TextClock) v.findViewById(R.id.text_clock); if (mTextClock != null) { mTextClock.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { try { Intent intent = new Intent(Intent.ACTION_MAIN); intent.addCategory(Intent.CATEGORY_APP_CALENDAR); startActivity(intent); getActivity().overridePendingTransition(R.anim.fade_in, R.anim.fade_out); } catch (ActivityNotFoundException e) { e.printStackTrace(); AlertDialog.Builder alert = new AlertDialog.Builder(getActivity()); alert.setPositiveButton(R.string.alert_ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Intent i = new Intent( android.provider.Settings.ACTION_MANAGE_APPLICATIONS_SETTINGS); i.addCategory(Intent.CATEGORY_DEFAULT); startActivity(i); } }); alert.setMessage(R.string.alert_calendar_not_found); alert.show(); } } }); } mWeatherView = (WeatherView) v.findViewById(R.id.weather_view); mMainViewLeftPanel = (LinearLayout) v.findViewById(R.id.main_view_left_panel); mMainViewRightPanel = (LinearLayout) v.findViewById(R.id.main_view_right_panel); LayoutInflater layoutInflater = (LayoutInflater) getActivity() .getSystemService(Context.LAYOUT_INFLATER_SERVICE); // add main shortcut. ArrayList<ShortcutData> mainShortcutDatas = LauncherSettings.getInstance(getActivity()) .getLauncherMainShortcuts(); mMainShortcutGridLayout = (GridLayout) v.findViewById(R.id.main_shortcut_grid); float dp;// = DisplayUtils.getDimension(getActivity(), R.dimen.launcher_ic_menu_main_shortcut_width); // float widthPx = DisplayUtils.pxFromDp(getActivity(), dp); // // dp = DisplayUtils.getDimension(getActivity(), R.dimen.launcher_ic_menu_main_shortcut_height); // float heightPx = DisplayUtils.pxFromDp(getActivity(), dp); dp = DisplayUtils.getDimension(getActivity(), R.dimen.launcher_ic_menu_main_shortcut_font_size); float mainShortcutFontPx = DisplayUtils.pxFromDp(getActivity(), dp); for (int i = 0; i < mMainShortcutGridLayout.getColumnCount(); i++) { /** * right shortcut panel */ ShortcutData data = mainShortcutDatas.get(i); FrameLayout btnLayout = (FrameLayout) layoutInflater.inflate(R.layout.launcher_menu_top_item, mMainShortcutGridLayout, false);//new Button(getActivity()); mMainShortcutGridLayout.addView(btnLayout); if (data.getPushType() != null && data.getPushType().length > 0) { data.setLauncherButton(btnLayout); mPushNotifiableShorcuts.add(data); } btnLayout.setBackgroundResource(data.getIconBackResId()); // GridLayout.LayoutParams lp = (GridLayout.LayoutParams)btnLayout.getLayoutParams(); // lp.width = (int)widthPx; // lp.height = (int)heightPx; // btnLayout.setLayoutParams(lp); TextView label = (TextView) btnLayout.findViewById(R.id.menu_item_label); label.setText(data.getName()); label.setTextSize(TypedValue.COMPLEX_UNIT_PX, mainShortcutFontPx); label.setTextColor(getResources().getColor(R.color.white)); label.setTypeface(null, Typeface.BOLD); label.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); ImageView icon = (ImageView) btnLayout.findViewById(R.id.menu_item_image); icon.setImageResource(data.getIconResId()); btnLayout.setTag(data); btnLayout.setOnClickListener(this); } // add other shortcuts. mShorcutGridLayout = (GridLayout) v.findViewById(R.id.shortcut_grid); ArrayList<ShortcutData> shortcutDatas = LauncherSettings.getInstance(getActivity()).getLauncherShortcuts(); int columnNum = mShorcutGridLayout.getColumnCount(); final int MAX_ROW_NUM = 3; int shortcutNum = shortcutDatas.size() > (columnNum * MAX_ROW_NUM) ? (columnNum * MAX_ROW_NUM) : shortcutDatas.size(); dp = DisplayUtils.getDimension(getActivity(), R.dimen.launcher_ic_menu_shortcut_font_size); float btnFontPx = DisplayUtils.pxFromDp(getActivity(), dp); for (int i = 0; i < shortcutNum; i++) { /** * right shortcut panel */ ShortcutData data = shortcutDatas.get(i); FrameLayout btnLayout = (FrameLayout) layoutInflater.inflate(R.layout.launcher_menu_item, mShorcutGridLayout, false);//new Button(getActivity()); mShorcutGridLayout.addView(btnLayout); if (data.getPushType() != null && data.getPushType().length > 0) { data.setLauncherButton(btnLayout); mPushNotifiableShorcuts.add(data); } btnLayout.setBackgroundResource(data.getIconBackResId()); TextView label = (TextView) btnLayout.findViewById(R.id.menu_item_label); label.setText(data.getName()); label.setTextSize(TypedValue.COMPLEX_UNIT_PX, btnFontPx); label.setTextColor(getResources().getColor(R.color.white)); label.setTypeface(null, Typeface.BOLD); label.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); ImageView icon = (ImageView) btnLayout.findViewById(R.id.menu_item_image); icon.setImageResource(data.getIconResId()); btnLayout.setTag(data); btnLayout.setOnClickListener(this); } setContentViewByOrientation(); return v; }