本文整理汇总了Java中android.view.LayoutInflater.cloneInContext方法的典型用法代码示例。如果您正苦于以下问题:Java LayoutInflater.cloneInContext方法的具体用法?Java LayoutInflater.cloneInContext怎么用?Java LayoutInflater.cloneInContext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.LayoutInflater
的用法示例。
在下文中一共展示了LayoutInflater.cloneInContext方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreateView
import android.view.LayoutInflater; //导入方法依赖的package包/类
@Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
final Context contextThemeWrapper = new ContextThemeWrapper(getContext(), getContext().getTheme());
LayoutInflater themeAwareInflater = inflater.cloneInContext(contextThemeWrapper);
View view = themeAwareInflater.inflate(layoutRes(), container, false);
unbinder = ButterKnife.bind(this, view);
view.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override public void onGlobalLayout() {
view.getViewTreeObserver().removeOnGlobalLayoutListener(this);
View parent = getDialog().findViewById(R.id.design_bottom_sheet);
if (parent != null) {
bottomSheetBehavior = BottomSheetBehavior.from(parent);
if (bottomSheetBehavior != null) {
bottomSheetBehavior.setBottomSheetCallback(bottomSheetCallback);
bottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
}
}
}
});
return view;
}
示例2: onCreateView
import android.view.LayoutInflater; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
Log.d(TAG, "onCreateView()");
final View fragmentView;
final Context contextThemeWrapper = new ContextThemeWrapper(getActivity(), theme);
LayoutInflater localInflater = inflater.cloneInContext(contextThemeWrapper);
fragmentView = localInflater.inflate(R.layout.issuer_selection_fragment, container, false);
for (InputDetail inputDetail : paymentMethod.getInputDetails()) {
if (inputDetail.getKey().equals("idealIssuer") || inputDetail.getKey().equals("issuer")) {
issuers = inputDetail.getItems();
break;
}
}
final IssuerListAdapter issuerListAdapter = new IssuerListAdapter(getActivity(), issuers);
final ListView listView = (ListView) fragmentView.findViewById(R.id.issuer_methods_list);
listView.setAdapter(issuerListAdapter);
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(final AdapterView<?> adapterView, final View view, final int i, final long l) {
String selectedIssuer = issuers.get(i).getId();
issuerSelectionListener.onIssuerSelected(selectedIssuer);
}
});
if (getActivity() instanceof CheckoutActivity) {
((CheckoutActivity) getActivity()).setActionBarTitle(paymentMethod.getName());
}
return fragmentView;
}
示例3: onGetLayoutInflater
import android.view.LayoutInflater; //导入方法依赖的package包/类
@Override
public LayoutInflater onGetLayoutInflater() {
final LayoutInflater result = Activity.this.getLayoutInflater();
if (onUseFragmentManagerInflaterFactory()) {
return result.cloneInContext(Activity.this);
}
return result;
}
示例4: onCreateView
import android.view.LayoutInflater; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
final Context contextThemeWrapper = new ContextThemeWrapper(getActivity(), R.style.DarkTheme);
LayoutInflater localInflater = inflater.cloneInContext(contextThemeWrapper);
View view = localInflater.inflate(R.layout.fragment_login, container, false);
ButterKnife.bind(this, view);
sharedPreferences = getActivity().getSharedPreferences("Profile", MODE_PRIVATE);
return view;
}
示例5: getSystemService
import android.view.LayoutInflater; //导入方法依赖的package包/类
@Override
public Object getSystemService(String name) {
if (LAYOUT_INFLATER_SERVICE.equals(name)) {
if (mInflater == null) {
LayoutInflater inflater = (LayoutInflater) super.getSystemService(name);
// 新建一个,设置其工厂
mInflater = inflater.cloneInContext(this);
mInflater.setFactory(mFactory);
// 再新建一个,后续可再次设置工厂
mInflater = mInflater.cloneInContext(this);
}
return mInflater;
}
return super.getSystemService(name);
}
示例6: onCreateView
import android.view.LayoutInflater; //导入方法依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
final View fragmentView;
final Context contextThemeWrapper = new ContextThemeWrapper(getActivity(), theme);
LayoutInflater localInflater = inflater.cloneInContext(contextThemeWrapper);
fragmentView = localInflater.inflate(R.layout.qiwi_wallet_fragment, container, false);
final EditText telephoneNumber = (EditText) fragmentView.findViewById(R.id.telephone_number_edit_text);
final Spinner countryCode = (Spinner) fragmentView.findViewById(R.id.country_code_spinner);
Collection<InputDetail> inputDetails = paymentMethod.getInputDetails();
for (InputDetail inputDetail : inputDetails) {
if ("qiwiwallet.telephoneNumberPrefix".equals(inputDetail.getKey())) {
java.util.ArrayList<String> countryCodes = new java.util.ArrayList<>();
for (InputDetail.Item country : inputDetail.getItems()) {
countryCodes.add(country.getName() + " (" + country.getId() + ")");
}
ArrayAdapter<String> adapter = new ArrayAdapter<>(getActivity(), android.R.layout.select_dialog_item, countryCodes);
countryCode.setAdapter(adapter);
// TODO: Use a proper list adapter here to get rid of string magic below.
}
}
final Button confirmButton = (Button) fragmentView.findViewById(R.id.collect_direct_debit_data);
confirmButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String countryCodeString = countryCode.getSelectedItem().toString();
String strippedCountryCode = countryCodeString.substring(countryCodeString.indexOf("+"), countryCodeString.indexOf(")"));
qiwiWalletPaymentDetailsListener.onPaymentDetails(strippedCountryCode, telephoneNumber.getText().toString());
}
});
confirmButton.setEnabled(true);
final TextView amountTextview = (TextView) fragmentView.findViewById(R.id.amount_text_view);
final String valueString = AmountUtil.format(amount, true, StringUtils.getLocale(getActivity()));
final String amountString = getString(R.string.payButton_formatted, valueString);
amountTextview.setText(amountString);
if (getActivity() instanceof CheckoutActivity) {
((CheckoutActivity) getActivity()).setActionBarTitle(paymentMethod.getName());
}
return fragmentView;
}
示例7: onCreateView
import android.view.LayoutInflater; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
Log.d(TAG, "onCreateView()");
final View fragmentView;
final Context contextThemeWrapper = new ContextThemeWrapper(getActivity(), theme);
LayoutInflater localInflater = inflater.cloneInContext(contextThemeWrapper);
fragmentView = localInflater.inflate(R.layout.payment_method_selection_fragment, container, false);
final PaymentListAdapter paymentListAdapter = new PaymentListAdapter(
getActivity(), paymentMethods);
final ListView listView = (ListView) fragmentView.findViewById(android.R.id.list);
listView.setAdapter(paymentListAdapter);
final PaymentListAdapter adyenUIPreferredPaymentListAdapter = new PaymentListAdapter(
getActivity(), preferredPaymentMethods);
final ListView preferredListView = (ListView) fragmentView.findViewById(R.id.preferred_payment_methods_list);
preferredListView.setAdapter(adyenUIPreferredPaymentListAdapter);
listView.setOnItemClickListener(new OnPaymentMethodClick());
preferredListView.setOnItemClickListener(new OnPreferredPaymentMethodClick());
ViewTreeObserver listVTO = listView.getViewTreeObserver();
listVTO.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
listView.getViewTreeObserver().removeGlobalOnLayoutListener(this);
resizeListView(listView, true);
}
});
ViewTreeObserver preferredListVTO = preferredListView.getViewTreeObserver();
preferredListVTO.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
preferredListView.getViewTreeObserver().removeGlobalOnLayoutListener(this);
resizeListView(preferredListView, false);
}
});
preferredPaymentMethodsLayout = fragmentView.findViewById(R.id.preferred_payment_methods_layout);
/*
paymentMethods.clear();
preferredPaymentMethods.clear();
preferredPaymentMethods.addAll(((CheckoutActivity) getActivity()).getPreferredPaymentMethods());
paymentMethods.addAll(((CheckoutActivity) getActivity()).getAvailablePaymentMethods());
adyenUIPreferredPaymentListAdapter.notifyDataSetChanged();
paymentListAdapter.notifyDataSetChanged();
*/
if (preferredPaymentMethods.isEmpty()) {
preferredPaymentMethodsLayout.setVisibility(View.GONE);
} else {
preferredPaymentMethodsLayout.setVisibility(View.VISIBLE);
}
if (getActivity() instanceof CheckoutActivity) {
((CheckoutActivity) getActivity()).setActionBarTitle(R.string.paymentMethods_title);
}
return fragmentView;
}