private Bundle parserRecProgram() { ServiceInfoDao serInfoDao = new ServiceInfoDaoImpl(this); SharedPreferences spRec = getSharedPreferences("dvb_rec", MODE_WORLD_READABLE | MODE_WORLD_WRITEABLE); // parser rec programme. int recServiceId = spRec.getInt("rec_serviceId", 0); int recNumber = spRec.getInt("rec_logicalNumber", 0); int recServicePos = spRec.getInt("rec_servicePosition", 0); String recServiceName = spRec.getString("rec_serviceName", null); ServiceInfoBean rBean = serInfoDao.getChannelInfoByServiceId(recServiceId, recNumber); Bundle bundle = new Bundle(); if (null != rBean) { bundle.putInt("ServicePos", recServicePos); bundle.putInt("LogicalNumber", recNumber); bundle.putInt("ServiceId", recServiceId); bundle.putString("ServiceName", recServiceName); bundle.putChar("ServiceType", serviceType); bundle.putString("superPwd", superPwd); bundle.putInt("Grade", grade); bundle.putBoolean("RecStatus", recStatus); } return bundle; }
private void go2BootDefaultChannel(int serviceId) { ServiceInfoDao serInfoDao = new ServiceInfoDaoImpl(this); List<ServiceInfoBean> nBeans = serInfoDao.getChannelIdByLogicalNumber(serviceId); ServiceInfoBean nBean = null; if (nBeans.size() != 0) { nBean = nBeans.get(0); } if (null == nBean) { LogUtils.printLog(1, 5, TAG, "--->>> get boot default channel is null !"); finish(); return; } Bundle bundle = new Bundle(); bundle.putInt("ServicePos", nBean.getChannelPosition()); bundle.putInt("LogicalNumber", serviceId); bundle.putInt("ServiceId", serviceId); bundle.putString("ServiceName", nBean.getChannelName()); bundle.putChar("ServiceType", nBean.getServiceType()); bundle.putString("superPwd", superPwd); bundle.putInt("Grade", grade); bundle.putBoolean("RecStatus", recStatus); CommonUtils.skipActivity( SplashActivity.this, TVChannelPlay.class, bundle, Intent.FLAG_ACTIVITY_CLEAR_TOP); }
/** * Add extended data to the extra. * * @param name The name of the extra data, with package prefix. * @param value The char data value. * @return Returns the same extra object, for chaining multiple calls into a single statement. * @see #putExtras * @see #removeExtra * @see #getCharExtra(String, char) */ public Request putExtra(String name, char value) { if (mExtras == null) { mExtras = new Bundle(); } mExtras.putChar(name, value); return this; }
@Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putString("result", result); outState.putChar("lastOp", lastOp); outState.putBoolean("isInEquals", isInEquals); outState.putSerializable("stack", stack.toArray(new String[stack.size()])); }
/** * <Package the service informations for the playing page.> * * @param playChannelName * @return * @see [类、类#方法、类#成员] */ private Bundle packageServiceInfo() { Bundle bundle = new Bundle(); bundle.putInt("ServicePos", servicePos); bundle.putInt("LogicalNumber", logicalNumber); bundle.putInt("ServiceId", serviceId); bundle.putString("ServiceName", serviceName); bundle.putChar("ServiceType", serviceType); bundle.putString("superPwd", superPwd); bundle.putInt("Grade", grade); bundle.putBoolean("RecStatus", recStatus); return bundle; }
/** * <Parser the entrance from launcher.> * * @see [类、类#方法、类#成员] */ private void parserEntrance() { /* Start LinKang, 2013-12-24, Jump to SystemInfoActivity page... */ if (null != entrance && entrance.equalsIgnoreCase(Config.DVB_SYSTEM_INFO)) { CommonUtils.skipActivity( SplashActivity.this, SystemInfoActivity.class, Intent.FLAG_ACTIVITY_CLEAR_TOP); } /* End LinKang, 2013-12-24, Jump to SystemInfoActivity page... */ // check if the ota is downloading now... // For OTADownloaderService may be force to quit... // So here user NativeDownload to get the ota status... NativeDownload nativeDownload = new NativeDownload(); int otaStatus = nativeDownload.downloadGetStatus(); if (otaStatus == 1) { LogUtils.e( TAG, "The OTA is in downloading status for nativeDownload.downloadGetStatus() == 1"); CommonUtils.skipActivity( SplashActivity.this, OTADownloaderActivity.class, Intent.FLAG_ACTIVITY_CLEAR_TOP); return; } else { LogUtils.e( TAG, "The OTA is not in downloading status for nativeDownload.downloadGetStatus() != 1"); } // Factory test if (entrance.equals(Config.DVB_FACTORY_TEST)) { CommonUtils.skipActivity( SplashActivity.this, FactoryTest.class, Intent.FLAG_ACTIVITY_CLEAR_TOP); } // Television Programme if (entrance.equals(Config.DVB_TV_PROGRAMME)) { if (tvList.size() != 0) { Bundle tvBundle = packageServiceInfo(); CommonUtils.skipActivity( SplashActivity.this, TVChannelPlay.class, tvBundle, Intent.FLAG_ACTIVITY_CLEAR_TOP); } else { if (null == searchDialog) { searchDialog = DialogUtils.twoButtonsDialogCreate( SplashActivity.this, getString(R.string.no_program_auto_search), new OnClickListener() { @Override public void onClick(View v) { if (null != searchDialog) { searchDialog.dismiss(); } Bundle bundle = new Bundle(); bundle.putInt("SearchMode", Config.Install_Search_Type_eAUTO_SEARCH); CommonUtils.skipActivity( SplashActivity.this, ChannelSearchProgress.class, bundle, Intent.FLAG_ACTIVITY_CLEAR_TOP); } }, new OnClickListener() { @Override public void onClick(View v) { if (null != searchDialog) { searchDialog.dismiss(); } } }); } } } // Radio programme else if (entrance.equals(Config.DVB_RADIO_PROGRAMME)) { if (radioList.size() != 0) { Bundle radioInfos = packageServiceInfo(); CommonUtils.skipActivity( SplashActivity.this, TVChannelPlay.class, radioInfos, Intent.FLAG_ACTIVITY_CLEAR_TOP); } else { handler.sendEmptyMessage(Config.NO_PROGRAMME); } } // Epg else if (entrance.equals(Config.DVB_EPG)) { if (tvList.size() != 0 || radioList.size() != 0) { Bundle epgInfos = packageServiceInfo(); Bundle bundle = getIntent().getExtras(); if (null == bundle) { LogUtils.e(TAG, "SplashActivity.onKeyDown:: Epg bundle == null"); epgInfos.putChar(Config.DVB_SERVICE_TYPE, Config.SERVICE_TYPE_NOTYPE); } else { char mServiceType = bundle.getChar(Config.DVB_SERVICE_TYPE); if (mServiceType != Config.SERVICE_TYPE_TV && mServiceType != Config.SERVICE_TYPE_RADIO) { mServiceType = Config.SERVICE_TYPE_NOTYPE; } epgInfos.putChar(Config.DVB_SERVICE_TYPE, mServiceType); } CommonUtils.skipActivity( SplashActivity.this, EpgActivity.class, epgInfos, Intent.FLAG_ACTIVITY_CLEAR_TOP); } else { handler.sendEmptyMessage(Config.NO_PROGRAMME); } } // EIT else if (entrance.equals(Config.DVB_EIT)) { if (tvList.size() != 0 || radioList.size() != 0) { Bundle epgInfos = packageServiceInfo(); Bundle bundle = getIntent().getExtras(); if (null == bundle) { LogUtils.e(TAG, "SplashActivity.onKeyDown:: Eit bundle == null"); epgInfos.putChar(Config.DVB_SERVICE_TYPE, Config.SERVICE_TYPE_NOTYPE); } else { char mServiceType = bundle.getChar(Config.DVB_SERVICE_TYPE); if (mServiceType != Config.SERVICE_TYPE_TV && mServiceType != Config.SERVICE_TYPE_RADIO) { mServiceType = Config.SERVICE_TYPE_NOTYPE; } epgInfos.putChar(Config.DVB_SERVICE_TYPE, mServiceType); } CommonUtils.skipActivity( SplashActivity.this, EitActivity.class, epgInfos, Intent.FLAG_ACTIVITY_CLEAR_TOP); } else { handler.sendEmptyMessage(Config.NO_PROGRAMME); } } // Search channels else if (entrance.equals(Config.DVB_CHANNEL_SEARCH)) { CommonUtils.skipActivity( SplashActivity.this, TVChannelSearch.class, Intent.FLAG_ACTIVITY_CLEAR_TOP); } // direct auto search else if (entrance.equals(Config.DVB_DIRECT_SEARCH)) { Bundle bundle = new Bundle(); bundle.putInt("SearchMode", Config.Install_Search_Type_eAUTO_SEARCH); CommonUtils.skipActivity( SplashActivity.this, ChannelSearchProgress.class, bundle, Intent.FLAG_ACTIVITY_CLEAR_TOP); } // all search else if (entrance.equals(Config.DVB_ALL_SEARCH)) { Bundle bundle = new Bundle(); bundle.putInt("SearchMode", Config.Install_Search_Type_eALL_SEARCH); CommonUtils.skipActivity( SplashActivity.this, ChannelSearchProgress.class, bundle, Intent.FLAG_ACTIVITY_CLEAR_TOP); } else if (entrance.equals(Config.DVB_FREQ_SETTING)) { CommonUtils.skipActivity( SplashActivity.this, SearchFreqSettings.class, Intent.FLAG_ACTIVITY_CLEAR_TOP); } else if (entrance.equals(Config.DVB_BOOT_DEFAULT_CHANNEL)) { CommonUtils.skipActivity( SplashActivity.this, BootDefaultServiceActivity.class, Intent.FLAG_ACTIVITY_CLEAR_TOP); } // Edit channels else if (entrance.equals(Config.DVB_CHANNEL_EDIT)) { if (tvList.size() != 0 || radioList.size() != 0) { Bundle editInfos = packageServiceInfo(); CommonUtils.skipActivity( SplashActivity.this, TVChannelEdit.class, editInfos, Intent.FLAG_ACTIVITY_CLEAR_TOP); } else { handler.sendEmptyMessage(Config.NO_PROGRAMME); } } // pvr list else if (entrance.equals(Config.DVB_PVR_LIST)) { CommonUtils.skipActivity( SplashActivity.this, PvrOrderList.class, Intent.FLAG_ACTIVITY_CLEAR_TOP); } else if (entrance.equals(Config.DVB_PVR_PLAY_LIST)) { CommonUtils.skipActivity( SplashActivity.this, PvrPlayList.class, Intent.FLAG_ACTIVITY_CLEAR_TOP); } // Ca status else if (entrance.equals(Config.DVB_CA_STATUS)) { CommonUtils.skipActivity( SplashActivity.this, CaStateInfo.class, Intent.FLAG_ACTIVITY_CLEAR_TOP); } // Ca password settings else if (entrance.equals(Config.DVB_CA_PWD_SETTINGS)) { CommonUtils.skipActivity( SplashActivity.this, CaPasswordSet.class, Intent.FLAG_ACTIVITY_CLEAR_TOP); } // Ca adult grade else if (entrance.equals(Config.DVB_CA_GRADE)) { CommonUtils.skipActivity( SplashActivity.this, CaRateControl.class, Intent.FLAG_ACTIVITY_CLEAR_TOP); } // Ca auth else if (entrance.equals(Config.DVB_CA_AUTH)) { CommonUtils.skipActivity( SplashActivity.this, CaAuthInfo.class, Intent.FLAG_ACTIVITY_CLEAR_TOP); } // Ca email else if (entrance.equals(Config.DVB_CA_EMAIL)) { CommonUtils.skipActivity(SplashActivity.this, CaEmail.class, Intent.FLAG_ACTIVITY_CLEAR_TOP); } // Ca zimu card feeding else if (entrance.equals(Config.DVB_CA_USER_VIEW)) { CommonUtils.skipActivity( SplashActivity.this, PlayControlMain.class, Intent.FLAG_ACTIVITY_CLEAR_TOP); } }
private static void putChar(String key, Bundle bundle) { bundle.putChar(key, getChar()); }
private void deserializeKey(String key, Bundle bundle) throws JSONException { String jsonString = cache.getString(key, "{}"); JSONObject json = new JSONObject(jsonString); String valueType = json.getString(JSON_VALUE_TYPE); if (valueType.equals(TYPE_BOOLEAN)) { bundle.putBoolean(key, json.getBoolean(JSON_VALUE)); } else if (valueType.equals(TYPE_BOOLEAN_ARRAY)) { JSONArray jsonArray = json.getJSONArray(JSON_VALUE); boolean[] array = new boolean[jsonArray.length()]; for (int i = 0; i < array.length; i++) { array[i] = jsonArray.getBoolean(i); } bundle.putBooleanArray(key, array); } else if (valueType.equals(TYPE_BYTE)) { bundle.putByte(key, (byte) json.getInt(JSON_VALUE)); } else if (valueType.equals(TYPE_BYTE_ARRAY)) { JSONArray jsonArray = json.getJSONArray(JSON_VALUE); byte[] array = new byte[jsonArray.length()]; for (int i = 0; i < array.length; i++) { array[i] = (byte) jsonArray.getInt(i); } bundle.putByteArray(key, array); } else if (valueType.equals(TYPE_SHORT)) { bundle.putShort(key, (short) json.getInt(JSON_VALUE)); } else if (valueType.equals(TYPE_SHORT_ARRAY)) { JSONArray jsonArray = json.getJSONArray(JSON_VALUE); short[] array = new short[jsonArray.length()]; for (int i = 0; i < array.length; i++) { array[i] = (short) jsonArray.getInt(i); } bundle.putShortArray(key, array); } else if (valueType.equals(TYPE_INTEGER)) { bundle.putInt(key, json.getInt(JSON_VALUE)); } else if (valueType.equals(TYPE_INTEGER_ARRAY)) { JSONArray jsonArray = json.getJSONArray(JSON_VALUE); int[] array = new int[jsonArray.length()]; for (int i = 0; i < array.length; i++) { array[i] = jsonArray.getInt(i); } bundle.putIntArray(key, array); } else if (valueType.equals(TYPE_LONG)) { bundle.putLong(key, json.getLong(JSON_VALUE)); } else if (valueType.equals(TYPE_LONG_ARRAY)) { JSONArray jsonArray = json.getJSONArray(JSON_VALUE); long[] array = new long[jsonArray.length()]; for (int i = 0; i < array.length; i++) { array[i] = jsonArray.getLong(i); } bundle.putLongArray(key, array); } else if (valueType.equals(TYPE_FLOAT)) { bundle.putFloat(key, (float) json.getDouble(JSON_VALUE)); } else if (valueType.equals(TYPE_FLOAT_ARRAY)) { JSONArray jsonArray = json.getJSONArray(JSON_VALUE); float[] array = new float[jsonArray.length()]; for (int i = 0; i < array.length; i++) { array[i] = (float) jsonArray.getDouble(i); } bundle.putFloatArray(key, array); } else if (valueType.equals(TYPE_DOUBLE)) { bundle.putDouble(key, json.getDouble(JSON_VALUE)); } else if (valueType.equals(TYPE_DOUBLE_ARRAY)) { JSONArray jsonArray = json.getJSONArray(JSON_VALUE); double[] array = new double[jsonArray.length()]; for (int i = 0; i < array.length; i++) { array[i] = jsonArray.getDouble(i); } bundle.putDoubleArray(key, array); } else if (valueType.equals(TYPE_CHAR)) { String charString = json.getString(JSON_VALUE); if (charString != null && charString.length() == 1) { bundle.putChar(key, charString.charAt(0)); } } else if (valueType.equals(TYPE_CHAR_ARRAY)) { JSONArray jsonArray = json.getJSONArray(JSON_VALUE); char[] array = new char[jsonArray.length()]; for (int i = 0; i < array.length; i++) { String charString = jsonArray.getString(i); if (charString != null && charString.length() == 1) { array[i] = charString.charAt(0); } } bundle.putCharArray(key, array); } else if (valueType.equals(TYPE_STRING)) { bundle.putString(key, json.getString(JSON_VALUE)); } else if (valueType.equals(TYPE_STRING_LIST)) { JSONArray jsonArray = json.getJSONArray(JSON_VALUE); int numStrings = jsonArray.length(); ArrayList<String> stringList = new ArrayList<String>(numStrings); for (int i = 0; i < numStrings; i++) { Object jsonStringValue = jsonArray.get(i); stringList.add(i, jsonStringValue == JSONObject.NULL ? null : (String) jsonStringValue); } bundle.putStringArrayList(key, stringList); } else if (valueType.equals(TYPE_ENUM)) { try { String enumType = json.getString(JSON_VALUE_ENUM_TYPE); @SuppressWarnings({"unchecked", "rawtypes"}) Class<? extends Enum> enumClass = (Class<? extends Enum>) Class.forName(enumType); @SuppressWarnings("unchecked") Enum<?> enumValue = Enum.valueOf(enumClass, json.getString(JSON_VALUE)); bundle.putSerializable(key, enumValue); } catch (ClassNotFoundException e) { } catch (IllegalArgumentException e) { } } }
@Override public void onClick(DialogInterface dialog, int which) { Activity ctx = getActivity(); if (ctx == null) { return; } Bundle args = getArguments(); Long accountId = args != null ? args.getLong(KEY_ACCOUNTID) : null; AlertDialog dlg = (AlertDialog) dialog; String format = ((RadioGroup) dlg.findViewById(R.id.format)).getCheckedRadioButtonId() == R.id.csv ? "CSV" : "QIF"; String dateFormat = dateFormatET.getText().toString(); char decimalSeparator = ((RadioGroup) dlg.findViewById(R.id.separator)).getCheckedRadioButtonId() == R.id.dot ? '.' : ','; int handleDeleted; switch (handleDeletedGroup.getCheckedRadioButtonId()) { case R.id.update_balance: handleDeleted = Account.EXPORT_HANDLE_DELETED_UPDATE_BALANCE; break; case R.id.create_helper: handleDeleted = Account.EXPORT_HANDLE_DELETED_CREATE_HELPER; break; default: // -1 handleDeleted = Account.EXPORT_HANDLE_DELETED_DO_NOTHING; } String encoding = (String) ((Spinner) dlg.findViewById(R.id.Encoding)).getSelectedItem(); SharedPreferencesCompat.apply( MyApplication.getInstance() .getSettings() .edit() .putString(MyApplication.PrefKey.EXPORT_FORMAT.getKey(), format) .putString(PREFKEY_EXPORT_DATE_FORMAT, dateFormat) .putString(PREFKEY_EXPORT_ENCODING, encoding) .putInt(ExportTask.KEY_DECIMAL_SEPARATOR, decimalSeparator) .putInt(ExportTask.KEY_EXPORT_HANDLE_DELETED, handleDeleted)); boolean deleteP = deleteCB.isChecked(); boolean notYetExportedP = notYetExportedCB.isChecked(); String fileName = fileNameET.getText().toString(); Result appDirStatus = Utils.checkAppDir(); if (appDirStatus.success) { Bundle b = new Bundle(); b.putInt(ConfirmationDialogFragment.KEY_COMMAND_POSITIVE, R.id.START_EXPORT_COMMAND); if (accountId == null) { } else if (accountId > 0) { b.putLong(KEY_ROWID, accountId); } else { b.putString(KEY_CURRENCY, currency); } b.putString(TaskExecutionFragment.KEY_FORMAT, format); b.putBoolean(ExportTask.KEY_DELETE_P, deleteP); b.putBoolean(ExportTask.KEY_NOT_YET_EXPORTED_P, notYetExportedP); b.putString(TaskExecutionFragment.KEY_DATE_FORMAT, dateFormat); b.putChar(ExportTask.KEY_DECIMAL_SEPARATOR, decimalSeparator); b.putString(TaskExecutionFragment.KEY_ENCODING, encoding); b.putInt(ExportTask.KEY_EXPORT_HANDLE_DELETED, handleDeleted); b.putString(ExportTask.KEY_FILE_NAME, fileName); if (Utils.checkAppFolderWarning()) { ((ConfirmationDialogListener) getActivity()).onPositive(b); } else { b.putInt(ConfirmationDialogFragment.KEY_TITLE, R.string.dialog_title_attention); b.putString( ConfirmationDialogFragment.KEY_MESSAGE, getString(R.string.warning_app_folder_will_be_deleted_upon_uninstall)); b.putString( ConfirmationDialogFragment.KEY_PREFKEY, MyApplication.PrefKey.APP_FOLDER_WARNING_SHOWN.getKey()); ConfirmationDialogFragment.newInstance(b).show(getFragmentManager(), "APP_FOLDER_WARNING"); } } else { Toast.makeText(ctx, appDirStatus.print(ctx), Toast.LENGTH_LONG).show(); } }