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;
}
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;
}
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();
}
}
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;
}
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;
}
Aggregations