當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。