androidx.collection.ArraySet Java Examples
The following examples show how to use
androidx.collection.ArraySet.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TimesBase.java From prayer-times-android with Apache License 2.0 | 6 votes |
protected void createDefaultAlarms() { if (alarms.isEmpty()) { for (Vakit v : Vakit.values()) { Alarm alarm = new Alarm(); alarm.setCity((Times) this); alarm.setEnabled(false); alarm.setMins(0); alarm.setRemoveNotification(false); alarm.setVibrate(false); alarm.setWeekdays(new HashSet<>(Alarm.ALL_WEEKDAYS)); alarm.setTimes(new ArraySet<>(Collections.singletonList(v))); alarms.add(alarm); } save(); } }
Example #2
Source File: SkillSettingsPreferenceFragment.java From Easer with GNU General Public License v3.0 | 6 votes |
private static Set<String> getEventSkillsInUse(Context context) { Set<String> skillSet = new ArraySet<>(); EventDataStorage eventDataStorage = new EventDataStorage(context); for (String event : eventDataStorage.list()) { EventData eventData; try { eventData = eventDataStorage.get(event).getEventData(); } catch (RequiredDataNotFoundException e) { throw new AssertionError(e); } EventSkill eventSkill = LocalSkillRegistry.getInstance().event().findSkill(eventData); if (eventSkill != null) skillSet.add(eventSkill.id()); } return skillSet; }
Example #3
Source File: ConditionHolderService.java From Easer with GNU General Public License v3.0 | 6 votes |
private void setTrackers() { ConditionDataStorage conditionDataStorage = new ConditionDataStorage(this); for (String name : conditionDataStorage.list()) { Intent intent = new Intent(ACTION_TRACKER_SATISFIED); Uri turi = uri.buildUpon().appendPath(name).build(); intent.addCategory(CATEGORY_NOTIFY_HOLDER); intent.setData(turi); PendingIntent positive = PendingIntent.getBroadcast(this, 0, intent, 0); intent.setAction(ACTION_TRACKER_UNSATISFIED); PendingIntent negative = PendingIntent.getBroadcast(this, 0, intent, 0); ConditionStructure conditionStructure = null; try { conditionStructure = conditionDataStorage.get(name); } catch (RequiredDataNotFoundException e) { throw new AssertionError(e); } ConditionData conditionData = conditionStructure.getData(); Tracker tracker = LocalSkillRegistry.getInstance().condition().findSkill(conditionData) .tracker(this, conditionData, positive, negative); tracker.start(); trackerMap.put(name, tracker); associateMap.put(name, new ArraySet<Uri>()); } }
Example #4
Source File: SkillSettingsPreferenceFragment.java From Easer with GNU General Public License v3.0 | 6 votes |
private static Set<String> getConditionSkillsInUse(Context context) { Set<String> skillSet = new ArraySet<>(); ConditionDataStorage conditionDataStorage = new ConditionDataStorage(context); for (String condition : conditionDataStorage.list()) { ConditionData conditionData; try { conditionData = conditionDataStorage.get(condition).getData(); } catch (RequiredDataNotFoundException e) { throw new AssertionError(e); } ConditionSkill conditionSkill = LocalSkillRegistry.getInstance().condition().findSkill(conditionData); if (conditionSkill != null) skillSet.add(conditionSkill.id()); } return skillSet; }
Example #5
Source File: LocationUSourceData.java From Easer with GNU General Public License v3.0 | 6 votes |
LocationUSourceData(@NonNull String data, @NonNull PluginDataFormat format, int version) throws IllegalStorageDataException { switch (format) { default: try { JSONObject jsonObject = new JSONObject(data); { locations = new ArraySet<>(); JSONArray arrayLocation = jsonObject.getJSONArray(K_LOCATION); for (int i = 0; i < arrayLocation.length(); i++) { JSONArray latLong = arrayLocation.getJSONArray(i); locations.add(new LatLong(latLong.getDouble(0), latLong.getDouble(1))); } } radius = jsonObject.getInt(K_RADIUS); listenMinTime = jsonObject.getLong(K_LISTEN_MIN_TIME); thresholdAge = jsonObject.getLong(K_THRESHOLD_AGE); thresholdAccuracy = jsonObject.getInt(K_THRESHOLD_ACCURACY); } catch (JSONException e) { throw new IllegalStorageDataException(e); } } }
Example #6
Source File: CalendarSkillViewFragment.java From Easer with GNU General Public License v3.0 | 6 votes |
@NonNull @Override public CalendarUSourceData getData() throws InvalidDataInputException { if (type == Type.condition) { CalendarMatchType matchType = CalendarMatchType.ANY; int selected_rb = rg_event_title.getCheckedRadioButtonId(); if (selected_rb == rb_event_title_any.getId()) { matchType = CalendarMatchType.ANY; } else if (selected_rb == rb_event_title_pattern.getId()) { matchType = CalendarMatchType.EVENT_TITLE; } return new CalendarUSourceData(calendar_id, new CalConditionInnerData(matchType, ti_event_title_pattern.getText().toString().trim(), cb_all_day_event.isChecked())); } else { ArraySet<String> conditions = new ArraySet<>(); for (int i = 0; i < cb_conditions.length; i++) { if (cb_conditions[i].isChecked()) conditions.add(CalEventInnerData.condition_name[i]); } return new CalendarUSourceData(calendar_id, new CalEventInnerData(conditions)); } }
Example #7
Source File: CalEventInnerData.java From Easer with GNU General Public License v3.0 | 6 votes |
CalEventInnerData(@NonNull String data, @NonNull PluginDataFormat format, int version) throws IllegalStorageDataException { switch (format) { default: try { JSONObject jsonObject = new JSONObject(data); this.conditions = new ArraySet<>(); JSONArray jsonArray_conditions = jsonObject.optJSONArray(T_condition); for (int i = 0; i < jsonArray_conditions.length(); i++) { String condition = jsonArray_conditions.getString(i); for (int j = 0; j < condition_name.length; j++) { this.conditions.add(condition); } } } catch (JSONException e) { throw new IllegalStorageDataException(e); } } }
Example #8
Source File: WebTimes.java From prayer-times-android with Apache License 2.0 | 6 votes |
private void cleanTimes() { Set<String> keys = new ArraySet<>(); keys.addAll(times.keySet()); LocalDate date = LocalDate.now(); int y = date.getYear(); int m = date.getMonthOfYear(); List<String> remove = new ArrayList<>(); for (String key : keys) { if (key == null) continue; int year = FastParser.parseInt(key.substring(0, 4)); if (year < y) keys.remove(key); else if (year == y) { int month = FastParser.parseInt(key.substring(5, 7)); if (month < m) remove.add(key); } } times.removeAll(remove); }
Example #9
Source File: WebTimes.java From prayer-times-android with Apache License 2.0 | 6 votes |
private void cleanTimes() { Set<String> keys = new ArraySet<>(); keys.addAll(times.keySet()); LocalDate date = LocalDate.now(); int y = date.getYear(); int m = date.getMonthOfYear(); List<String> remove = new ArrayList<>(); for (String key : keys) { if (key == null) continue; int year = FastParser.parseInt(key.substring(0, 4)); if (year < y) keys.remove(key); else if (year == y) { int month = FastParser.parseInt(key.substring(5, 7)); if (month < m) remove.add(key); } } times.removeAll(remove); }
Example #10
Source File: TimesBase.java From prayer-times-android with Apache License 2.0 | 6 votes |
protected void createDefaultAlarms() { if (alarms.isEmpty()) { for (Vakit v : Vakit.values()) { Alarm alarm = new Alarm(); alarm.setCity((Times) this); alarm.setEnabled(false); alarm.setMins(0); alarm.setRemoveNotification(false); alarm.setVibrate(false); alarm.setWeekdays(new HashSet<>(Alarm.ALL_WEEKDAYS)); alarm.setTimes(new ArraySet<>(Collections.singletonList(v))); alarms.add(alarm); } save(); } }
Example #11
Source File: ViewModel.java From brickkit-android with Apache License 2.0 | 5 votes |
/** * Get the {@link ViewModelUpdateListener}. This is required in order to protect from a NPE. * * @return the set of {@link ViewModelUpdateListener} */ protected @NonNull Set<ViewModelUpdateListener> getUpdateListeners() { if (updateListeners == null) { updateListeners = new ArraySet<>(); } return updateListeners; }
Example #12
Source File: PagesConverter.java From QuranyApp with Apache License 2.0 | 5 votes |
@TypeConverter public String fromPagesToString(ArraySet<Integer> pages){ if (pages == null){ return null; } // create json Gson gson = new Gson(); Type type = new TypeToken<ArraySet<Integer>>(){}.getType(); return gson.toJson(pages,type); }
Example #13
Source File: ConnectivitySkillViewFragment.java From Easer with GNU General Public License v3.0 | 5 votes |
@ValidData @NonNull @Override public ConnectivityEventData getData() throws InvalidDataInputException { Set<Integer> checked = new ArraySet<>(); for (int i = 0; i < checkBoxes.length; i++) { if (checkBoxes[i].isChecked()) { checked.add(values[i]); } } if (checked.size() == 0) throw new InvalidDataInputException(); return new ConnectivityEventData(checked); }
Example #14
Source File: SkillSettingsPreferenceFragment.java From Easer with GNU General Public License v3.0 | 5 votes |
private static Set<String> getOperationSkillsInUse(Context context) { Set<String> skillSet = new ArraySet<>(); ProfileDataStorage profileDataStorage = new ProfileDataStorage(context); for (String profile : profileDataStorage.list()) { ProfileStructure profileStructure; try { profileStructure = profileDataStorage.get(profile); } catch (RequiredDataNotFoundException e) { throw new AssertionError(e); } skillSet.addAll(profileStructure.pluginIds()); } return skillSet; }
Example #15
Source File: LocationUSourceData.java From Easer with GNU General Public License v3.0 | 5 votes |
private LocationUSourceData(Parcel in) { locations = new ArraySet<>(Arrays.asList(Objects.requireNonNull(in.createTypedArray(LatLong.CREATOR)))); radius = in.readInt(); listenMinTime = in.readLong(); thresholdAge = in.readLong(); thresholdAccuracy = in.readInt(); }
Example #16
Source File: PagesConverter.java From QuranyApp with Apache License 2.0 | 5 votes |
@TypeConverter public ArraySet<Integer> toPagesList(String pages){ if (pages == null){ return null ; } Gson gson = new Gson(); Type type = new TypeToken<ArraySet<Integer>>(){}.getType(); return gson.fromJson(pages,type); }
Example #17
Source File: LocationUSourceData.java From Easer with GNU General Public License v3.0 | 5 votes |
public LocationUSourceData(ArraySet<LatLong> locations, int radius, long listenMinTime, long thresholdAge, int thresholdAccuracy) { this.locations = locations; this.radius = radius; this.listenMinTime = listenMinTime; this.thresholdAge = thresholdAge; this.thresholdAccuracy = thresholdAccuracy; }
Example #18
Source File: LocationUSourceDataFactory.java From Easer with GNU General Public License v3.0 | 5 votes |
@ValidData @NonNull @Override public LocationUSourceData dummyData() { return new LocationUSourceData( new ArraySet<LatLong>(Arrays.asList(new LatLong(12, 32), new LatLong(23, 34))), 100, 5 * 60, 10 * 60, 200 ); }
Example #19
Source File: Utils.java From Easer with GNU General Public License v3.0 | 5 votes |
@NonNull public static Set<String> extractPlaceholder(@NonNull String str) { Set<String> set = new ArraySet<>(); Matcher matcher = pattern_placeholder.matcher(str); while (matcher.find()) { String placeholder = matcher.group(); set.add(placeholder); } return set; }
Example #20
Source File: BundledSound.java From prayer-times-android with Apache License 2.0 | 5 votes |
@Override public Set<AppSound> getAppSounds() { ArraySet<AppSound> set = new ArraySet<>(); for (Sound sound : subSounds.values()) { set.addAll(sound.getAppSounds()); } return set; }
Example #21
Source File: CustomIpActivity.java From netanalysis-sdk-android with Apache License 2.0 | 5 votes |
@Override public void onClick(View v) { switch (v.getId()) { case R.id.txt_submit: { Set<String> ipSet = new ArraySet<>(); customIPs.clear(); for (AppCompatEditText edit : edits) { String ip; if (edit.getText() == null || TextUtils.isEmpty(ip = edit.getText().toString().trim())) continue; ipSet.add(ip); customIPs.add(ip); } mSharedPreferences.edit() .putStringSet("custom_ips", ipSet) .apply(); Intent result = new Intent(); result.putStringArrayListExtra("custom_ips", (ArrayList<String>) customIPs); setResult(RESULT_OK, result); finish(); break; } } }
Example #22
Source File: BundledSound.java From prayer-times-android with Apache License 2.0 | 5 votes |
@Override public Set<AppSound> getAppSounds() { ArraySet<AppSound> set = new ArraySet<>(); for (Sound sound : subSounds.values()) { set.addAll(sound.getAppSounds()); } return set; }
Example #23
Source File: AndroidTimeZoneProvider.java From prayer-times-android with Apache License 2.0 | 5 votes |
@NonNull @Override public Set<String> getAvailableIDs() { ArraySet<String> set = new ArraySet<>(); Collections.addAll(set, TimeZone.getAvailableIDs()); return set; }
Example #24
Source File: AndroidTimeZoneProvider.java From prayer-times-android with Apache License 2.0 | 5 votes |
@NonNull @Override public Set<String> getAvailableIDs() { ArraySet<String> set = new ArraySet<>(); Collections.addAll(set, TimeZone.getAvailableIDs()); return set; }
Example #25
Source File: DataModel.java From brickkit-android with Apache License 2.0 | 5 votes |
/** * Get the {@link DataModelUpdateListener}. This is required in order to protect from a NPE. * * @return the set of {@link DataModelUpdateListener} */ protected @NonNull Set<DataModelUpdateListener> getUpdateListeners() { if (updateListeners == null) { updateListeners = new ArraySet<>(); } return updateListeners; }
Example #26
Source File: LiveDataAwareSet.java From prayer-times-android with Apache License 2.0 | 4 votes |
public LiveDataAwareSet() { this(new ArraySet<>()); }
Example #27
Source File: ManageAffiliationIdsFragment.java From android-testdpc with Apache License 2.0 | 4 votes |
@TargetApi(VERSION_CODES.O) @Override protected void saveItems(List<String> items) { mDevicePolicyManager.setAffiliationIds(mAdminComponent, new ArraySet<>(items)); }
Example #28
Source File: Alarm.java From prayer-times-android with Apache License 2.0 | 4 votes |
public void setWeekdays(Set<Integer> weekdays) { this.weekdays = new ArraySet<>(weekdays); }
Example #29
Source File: Alarm.java From prayer-times-android with Apache License 2.0 | 4 votes |
public void setTimes(Set<Vakit> times) { this.times = new ArraySet<>(times); }
Example #30
Source File: ReadLog.java From QuranyApp with Apache License 2.0 | 4 votes |
@Ignore public ReadLog(long date, String strDate, ArraySet<Integer> pages) { this.date = date; this.strDate = strDate; this.pages = pages; }