Search in sources :

Example 21 with NonNull

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;
}
Also used : ArrayList(java.util.ArrayList) ByteString(okio.ByteString) NonNull(androidx.annotation.NonNull)

Example 22 with NonNull

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;
}
Also used : CountyEntity(com.github.gzuliyujiang.wheelpicker.entity.CountyEntity) ArrayList(java.util.ArrayList) CityEntity(com.github.gzuliyujiang.wheelpicker.entity.CityEntity) ProvinceEntity(com.github.gzuliyujiang.wheelpicker.entity.ProvinceEntity) NonNull(androidx.annotation.NonNull)

Example 23 with NonNull

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;
}
Also used : Dialog(android.app.Dialog) LayoutInflater(android.view.LayoutInflater) BindView(butterknife.BindView) View(android.view.View) NonNull(androidx.annotation.NonNull)

Example 24 with NonNull

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;
}
Also used : Date(java.util.Date) NonNull(androidx.annotation.NonNull)

Example 25 with NonNull

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);
}
Also used : Context(android.content.Context) ViewGroup(android.view.ViewGroup) TextView(android.widget.TextView) LinearLayout(android.widget.LinearLayout) SuppressLint(android.annotation.SuppressLint) NonNull(androidx.annotation.NonNull)

Aggregations

NonNull (androidx.annotation.NonNull)1200 View (android.view.View)192 ArrayList (java.util.ArrayList)154 Context (android.content.Context)128 Nullable (androidx.annotation.Nullable)128 TextView (android.widget.TextView)118 Intent (android.content.Intent)115 List (java.util.List)110 Recipient (org.thoughtcrime.securesms.recipients.Recipient)109 IOException (java.io.IOException)103 Bundle (android.os.Bundle)102 WorkerThread (androidx.annotation.WorkerThread)94 LayoutInflater (android.view.LayoutInflater)89 RecipientId (org.thoughtcrime.securesms.recipients.RecipientId)82 AlertDialog (androidx.appcompat.app.AlertDialog)77 Log (org.signal.core.util.logging.Log)76 Cursor (android.database.Cursor)68 ViewGroup (android.view.ViewGroup)65 LinkedList (java.util.LinkedList)64 Stream (com.annimon.stream.Stream)62