当前位置: 首页>>代码示例>>Java>>正文


Java LayoutInflater.cloneInContext方法代码示例

本文整理汇总了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;
}
 
开发者ID:duyp,项目名称:mvvm-template,代码行数:21,代码来源:BaseBottomSheetDialog.java

示例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;
}
 
开发者ID:Adyen,项目名称:adyen-android,代码行数:32,代码来源:IssuerSelectionFragment.java

示例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;
}
 
开发者ID:JessYanCoding,项目名称:ProgressManager,代码行数:9,代码来源:a.java

示例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;
}
 
开发者ID:adithya321,项目名称:SOS-The-Healthcare-Companion,代码行数:11,代码来源:LoginFragment.java

示例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);
}
 
开发者ID:wangyupeng1-iri,项目名称:springreplugin,代码行数:16,代码来源:PluginContext.java

示例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;
}
 
开发者ID:Adyen,项目名称:adyen-android,代码行数:51,代码来源:QiwiWalletFragment.java

示例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;
}
 
开发者ID:Adyen,项目名称:adyen-android,代码行数:65,代码来源:PaymentMethodSelectionFragment.java


注:本文中的android.view.LayoutInflater.cloneInContext方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。