use of androidx.annotation.NonNull in project k-9 by k9mail.
the class AutocryptGossipHeaderParser method parseAllAutocryptGossipHeaders.
@NonNull
private List<AutocryptGossipHeader> parseAllAutocryptGossipHeaders(String[] headers) {
ArrayList<AutocryptGossipHeader> autocryptHeaders = new ArrayList<>();
for (String header : headers) {
AutocryptGossipHeader autocryptHeader = parseAutocryptGossipHeader(header);
if (autocryptHeader == null) {
Timber.e("Encountered malformed autocrypt-gossip header - skipping!");
continue;
}
autocryptHeaders.add(autocryptHeader);
}
return autocryptHeaders;
}
use of androidx.annotation.NonNull in project AndroidPicker by gzu-liyujiang.
the class TextAddressParser method parseData.
@NonNull
@Override
public List<ProvinceEntity> parseData(@NonNull String text) {
provinces.clear();
String[] fullCodeAndNames = text.split(";");
for (String fullCodeAndName : fullCodeAndNames) {
String[] codeAndName = fullCodeAndName.split(",");
if (codeAndName.length != 2) {
continue;
}
String code = codeAndName[0];
String name = codeAndName[1];
if (code.startsWith("0000", 2)) {
// 省份
ProvinceEntity province = new ProvinceEntity();
province.setCode(code);
province.setName(name);
province.setCityList(new ArrayList<>());
provinces.add(province);
} else if (code.startsWith("00", 4)) {
// 地市
ProvinceEntity province = findProvinceByCode(code.substring(0, 2));
if (province != null) {
CityEntity city = new CityEntity();
city.setCode(code);
city.setName(name);
city.setCountyList(new ArrayList<>());
province.getCityList().add(city);
}
} else {
// 区县
CityEntity city = findCityByCode(code.substring(0, 2), code.substring(2, 4));
if (city != null) {
CountyEntity county = new CountyEntity();
county.setCode(code);
county.setName(name);
city.getCountyList().add(county);
}
}
}
return provinces;
}
use of androidx.annotation.NonNull in project MovieGuide by esoxjem.
the class SortingDialogFragment method onCreateDialog.
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
LayoutInflater inflater = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View dialogView = inflater.inflate(R.layout.sorting_options, null);
unbinder = ButterKnife.bind(this, dialogView);
initViews();
Dialog dialog = new Dialog(getActivity());
dialog.setContentView(dialogView);
dialog.setTitle(R.string.sort_by);
dialog.show();
return dialog;
}
use of androidx.annotation.NonNull in project AndroidPicker by gzu-liyujiang.
the class MonthView method toDayDesc.
@NonNull
protected String toDayDesc(int index) {
FestivalProvider festivalProvider = monthEntity.festivalProvider();
if (festivalProvider == null) {
return "";
}
Date date = DateUtils.specialDayInMonth(monthEntity.date(), index);
String festival = festivalProvider.provideText(date);
if (festival == null) {
festival = "";
}
return festival;
}
use of androidx.annotation.NonNull in project AndroidPicker by gzu-liyujiang.
the class CalendarAdapter method onCreateViewHolder.
@NonNull
@Override
public VH onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
Context context = parent.getContext();
LinearLayout linearLayout = new LinearLayout(context);
linearLayout.setOrientation(LinearLayout.VERTICAL);
linearLayout.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
TextView titleView = itemViewProvider == null ? null : itemViewProvider.provideTitleView(context);
if (titleView == null) {
titleView = new TextView(context);
titleView.setGravity(Gravity.CENTER);
titleView.setTextSize(14);
titleView.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));
int padding = (int) (parent.getResources().getDisplayMetrics().density * 10);
titleView.setPadding(padding, padding, padding, padding);
}
linearLayout.addView(titleView, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
MonthView monthView = itemViewProvider == null ? null : itemViewProvider.provideMonthView(context);
if (monthView == null) {
monthView = new MonthView(context);
}
monthView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
linearLayout.addView(monthView);
return new VH(linearLayout, titleView, monthView);
}
Aggregations