Search in sources :

Example 41 with Nullable

use of android.support.annotation.Nullable in project fresco by facebook.

the class DraweeScaleTypeFragment method onCreateView.

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    final View view = inflater.inflate(R.layout.fragment_drawee_scale_type, container, false);
    mDraweeTop1 = (SimpleDraweeView) view.findViewById(R.id.drawee_view_top_1);
    mDraweeTop2 = (SimpleDraweeView) view.findViewById(R.id.drawee_view_top_2);
    mDraweeMain = (SimpleDraweeView) view.findViewById(R.id.drawee_view);
    mSpinner = (Spinner) view.findViewById(R.id.spinner);
    mDraweeTop1.setImageURI(URI_1);
    mDraweeTop1.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            changeMainDraweeUri(URI_1);
        }
    });
    mDraweeTop2.setImageURI(URI_2);
    mDraweeTop2.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            changeMainDraweeUri(URI_2);
        }
    });
    changeMainDraweeUri(URI_1);
    final SimpleScaleTypeAdapter adapter = SimpleScaleTypeAdapter.createForAllScaleTypes();
    mSpinner.setAdapter(adapter);
    mSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {

        @Override
        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
            final SimpleScaleTypeAdapter.Entry spinnerEntry = (SimpleScaleTypeAdapter.Entry) adapter.getItem(position);
            changeMainDraweeScaleType(spinnerEntry.scaleType, spinnerEntry.focusPoint);
        }

        @Override
        public void onNothingSelected(AdapterView<?> parent) {
        }
    });
    mSpinner.setSelection(0);
    return view;
}
Also used : SimpleScaleTypeAdapter(com.facebook.fresco.samples.showcase.common.SimpleScaleTypeAdapter) AdapterView(android.widget.AdapterView) SimpleDraweeView(com.facebook.drawee.view.SimpleDraweeView) View(android.view.View) AdapterView(android.widget.AdapterView) Nullable(android.support.annotation.Nullable)

Example 42 with Nullable

use of android.support.annotation.Nullable in project facebook-android-sdk by facebook.

the class PlaceholderFragment method onCreateView.

@Nullable
@Override
public View onCreateView(final LayoutInflater inflater, final ViewGroup container, @Nullable final Bundle savedInstanceState) {
    View view = super.onCreateView(inflater, container, savedInstanceState);
    if (view == null) {
        view = inflater.inflate(R.layout.fragment_placeholder, container, false);
    }
    final Bundle arguments = getArguments();
    if (arguments != null) {
        final int height = arguments.getInt(HEIGHT_KEY, -1);
        if (height >= 0) {
            view.getLayoutParams().height = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, height, getResources().getDisplayMetrics());
        }
        final String text = arguments.getString(TEXT_KEY);
        final int textResourceId = arguments.getInt(TEXT_RESOURCE_ID_KEY, -1);
        final TextView textView = (TextView) view.findViewById(R.id.text_view);
        if (textView != null) {
            if (text != null) {
                textView.setText(text);
            } else if (textResourceId > 0) {
                textView.setText(textResourceId);
            }
        }
    }
    if (onClickListener != null) {
        view.setOnClickListener(onClickListener);
    }
    return view;
}
Also used : Bundle(android.os.Bundle) TextView(android.widget.TextView) TextView(android.widget.TextView) View(android.view.View) Nullable(android.support.annotation.Nullable)

Example 43 with Nullable

use of android.support.annotation.Nullable in project stetho by facebook.

the class AccessibilityNodeInfoWrapper method getDescription.

@Nullable
public static CharSequence getDescription(View view) {
    AccessibilityNodeInfoCompat node = createNodeInfoFromView(view);
    try {
        CharSequence contentDescription = node.getContentDescription();
        CharSequence nodeText = node.getText();
        boolean hasNodeText = !TextUtils.isEmpty(nodeText);
        boolean isEditText = view instanceof EditText;
        // EditText's prioritize their own text content over a contentDescription
        if (!TextUtils.isEmpty(contentDescription) && (!isEditText || !hasNodeText)) {
            return contentDescription;
        }
        if (hasNodeText) {
            return nodeText;
        }
        // comma separated, becomes the description.
        if (view instanceof ViewGroup) {
            final StringBuilder concatChildDescription = new StringBuilder();
            final String separator = ", ";
            ViewGroup viewGroup = (ViewGroup) view;
            for (int i = 0, count = viewGroup.getChildCount(); i < count; i++) {
                final View child = viewGroup.getChildAt(i);
                AccessibilityNodeInfoCompat childNodeInfo = AccessibilityNodeInfoCompat.obtain();
                ViewCompat.onInitializeAccessibilityNodeInfo(child, childNodeInfo);
                CharSequence childNodeDescription = null;
                if (AccessibilityUtil.isSpeakingNode(childNodeInfo, child) && !AccessibilityUtil.isAccessibilityFocusable(childNodeInfo, child)) {
                    childNodeDescription = getDescription(child);
                }
                if (!TextUtils.isEmpty(childNodeDescription)) {
                    if (concatChildDescription.length() > 0) {
                        concatChildDescription.append(separator);
                    }
                    concatChildDescription.append(childNodeDescription);
                }
                childNodeInfo.recycle();
            }
            return concatChildDescription.length() > 0 ? concatChildDescription.toString() : null;
        }
        return null;
    } finally {
        node.recycle();
    }
}
Also used : EditText(android.widget.EditText) ViewGroup(android.view.ViewGroup) AccessibilityNodeInfoCompat(android.support.v4.view.accessibility.AccessibilityNodeInfoCompat) View(android.view.View) Nullable(android.support.annotation.Nullable)

Example 44 with Nullable

use of android.support.annotation.Nullable in project CloudReader by youlookwhat.

the class BaseFragment method onCreateView.

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View ll = inflater.inflate(R.layout.fragment_base, null);
    bindingView = DataBindingUtil.inflate(getActivity().getLayoutInflater(), setContent(), null, false);
    RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
    bindingView.getRoot().setLayoutParams(params);
    mContainer = (RelativeLayout) ll.findViewById(R.id.container);
    mContainer.addView(bindingView.getRoot());
    return ll;
}
Also used : RelativeLayout(android.widget.RelativeLayout) ImageView(android.widget.ImageView) View(android.view.View) Nullable(android.support.annotation.Nullable)

Example 45 with Nullable

use of android.support.annotation.Nullable in project Android-skin-support by ximsfei.

the class FirstFragment method onCreateView.

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_first, null);
    view.findViewById(R.id.image_button).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Toast.makeText(getActivity(), "Image Button", Toast.LENGTH_SHORT).show();
        }
    });
    view.findViewById(R.id.checked_text_view).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
            CheckedTextView checkedTextView = (CheckedTextView) v;
            checkedTextView.toggle();
        //                checkedMap.put(position, checkedTextView.isChecked());
        }
    });
    MultiAutoCompleteTextView autoCompleteTextView = (MultiAutoCompleteTextView) view.findViewById(R.id.auto);
    String[] arr = { "aa", "aab", "aac" };
    ArrayAdapter<String> arrayAdapter = new ArrayAdapter<String>(getActivity(), android.R.layout.simple_list_item_1, arr);
    autoCompleteTextView.setAdapter(arrayAdapter);
    autoCompleteTextView.setThreshold(1);
    autoCompleteTextView.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());
    return view;
}
Also used : CheckedTextView(android.widget.CheckedTextView) MultiAutoCompleteTextView(android.widget.MultiAutoCompleteTextView) CheckedTextView(android.widget.CheckedTextView) View(android.view.View) MultiAutoCompleteTextView(android.widget.MultiAutoCompleteTextView) ArrayAdapter(android.widget.ArrayAdapter) Nullable(android.support.annotation.Nullable)

Aggregations

Nullable (android.support.annotation.Nullable)582 View (android.view.View)315 TextView (android.widget.TextView)163 RecyclerView (android.support.v7.widget.RecyclerView)85 BindView (butterknife.BindView)57 ImageView (android.widget.ImageView)52 ArrayList (java.util.ArrayList)43 IOException (java.io.IOException)36 Bundle (android.os.Bundle)35 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)35 Intent (android.content.Intent)32 ViewGroup (android.view.ViewGroup)32 Cursor (android.database.Cursor)29 Uri (android.net.Uri)27 File (java.io.File)24 AdapterView (android.widget.AdapterView)22 List (java.util.List)20 NonNull (android.support.annotation.NonNull)19 Context (android.content.Context)15 Bitmap (android.graphics.Bitmap)15