當前位置: 首頁>>代碼示例>>Java>>正文


Java Fragment.getClass方法代碼示例

本文整理匯總了Java中android.support.v4.app.Fragment.getClass方法的典型用法代碼示例。如果您正苦於以下問題:Java Fragment.getClass方法的具體用法?Java Fragment.getClass怎麽用?Java Fragment.getClass使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.support.v4.app.Fragment的用法示例。


在下文中一共展示了Fragment.getClass方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setTabHide

import android.support.v4.app.Fragment; //導入方法依賴的package包/類
public static void setTabHide(Fragment caller, FloatingActionButton chatHead) {
    if (myAdapter.getItem(mViewPager.getCurrentItem()).getClass() == caller.getClass()) {
        if (tabsLayout.getVisibility() == View.VISIBLE) {
            tabsLayout.setVisibility(View.GONE, true, R.anim.fade_out);
        }
        if (chatHead.isVisible()) {
            chatHead.hide();
        }
    }
}
 
開發者ID:89luca89,項目名稱:ThunderMusic,代碼行數:11,代碼來源:OnlineActivity.java

示例2: setTabShow

import android.support.v4.app.Fragment; //導入方法依賴的package包/類
public static void setTabShow(Fragment caller, FloatingActionButton chatHead) {
    if (myAdapter.getItem(mViewPager.getCurrentItem()).getClass() == caller.getClass()) {
        if (tabsLayout.getVisibility() == View.GONE) {
            tabsLayout.setVisibility(View.VISIBLE, true, R.anim.fade_in);
        }

        if (!chatHead.isVisible()) {
            chatHead.show();
        }
    }
}
 
開發者ID:89luca89,項目名稱:ThunderMusic,代碼行數:12,代碼來源:OnlineActivity.java

示例3: FragmentPagerItem

import android.support.v4.app.Fragment; //導入方法依賴的package包/類
protected FragmentPagerItem(String title, @NonNull Fragment fragment) {
    this(title, fragment.getClass(), fragment.getArguments());
    this.fragment = fragment;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:5,代碼來源:FragmentPagerItem.java

示例4: init

import android.support.v4.app.Fragment; //導入方法依賴的package包/類
private void init() {
        addPreferencesFromResource(R.xml.settings);

        if (Utils.DONATED) {
            getPreferenceScreen().removePreference(findPreference(KEY_AD_VIEW));
        }

        SwitchPreferenceCompat forceEnglish = (SwitchPreferenceCompat) findPreference(KEY_FORCE_ENGLISH);
        if (Resources.getSystem().getConfiguration().locale.getLanguage().startsWith("en")) {
            getPreferenceScreen().removePreference(forceEnglish);
        } else {
            forceEnglish.setOnPreferenceChangeListener(this);
        }
/*
        if (Utils.hideStartActivity()) {
            ((PreferenceCategory) findPreference(KEY_USER_INTERFACE))
                    .removePreference(findPreference(KEY_MATERIAL_ICON));
        } else {
            findPreference(KEY_MATERIAL_ICON).setOnPreferenceChangeListener(this);
        }
*/
        findPreference(KEY_RESET_DATA).setOnPreferenceClickListener(this);
        findPreference(KEY_UPDATE_NOTIFICATION).setOnPreferenceChangeListener(this);
        findPreference(KEY_CHECK_UPDATE).setOnPreferenceClickListener(this);
        findPreference(KEY_DARK_THEME).setOnPreferenceChangeListener(this);
        findPreference(KEY_BANNER_RESIZER).setOnPreferenceClickListener(this);
        findPreference(KEY_HIDE_BANNER).setOnPreferenceChangeListener(this);
        findPreference(KEY_ACCENT_COLOR).setOnPreferenceClickListener(this);
        findPreference(KEY_SECTIONS_ICON).setOnPreferenceChangeListener(this);
        findPreference(KEY_APPLY_ON_BOOT_TEST).setOnPreferenceClickListener(this);
        findPreference(KEY_LOGCAT).setOnPreferenceClickListener(this);

        if (Utils.existFile("/proc/last_kmsg") || Utils.existFile("/sys/fs/pstore/console-ramoops")) {
            findPreference(KEY_LAST_KMSG).setOnPreferenceClickListener(this);
        } else {
            ((PreferenceCategory) findPreference(KEY_DEBUGGING_CATEGORY)).removePreference(
                    findPreference(KEY_LAST_KMSG));
        }

        findPreference(KEY_DMESG).setOnPreferenceClickListener(this);
        findPreference(KEY_SET_PASSWORD).setOnPreferenceClickListener(this);
        findPreference(KEY_DELETE_PASSWORD).setOnPreferenceClickListener(this);

        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M
                || !FingerprintManagerCompat.from(getActivity()).isHardwareDetected()) {
            ((PreferenceCategory) findPreference(KEY_SECURITY_CATEGORY)).removePreference(
                    findPreference(KEY_FINGERPRINT));
        } else {
            mFingerprint = findPreference(KEY_FINGERPRINT);
            mFingerprint.setEnabled(!Prefs.getString("password", "", getActivity()).isEmpty());
        }

        PreferenceCategory sectionsCategory = (PreferenceCategory) findPreference(KEY_SECTIONS);
        for (NavigationActivity.NavigationFragment navigationFragment : NavigationActivity.sFragments) {
            Fragment fragment = navigationFragment.mFragment;
            int id = navigationFragment.mId;

            if (fragment != null && fragment.getClass() != SettingsFragment.class) {
                SwitchPreferenceCompat switchPreference = new SwitchPreferenceCompat(
                        new ContextThemeWrapper(getActivity(), R.style.Preference_SwitchPreferenceCompat_Material));
                switchPreference.setSummary(getString(id));
                switchPreference.setKey(fragment.getClass().getSimpleName() + "_enabled");
                switchPreference.setChecked(Prefs.getBoolean(fragment.getClass().getSimpleName()
                        + "_enabled", true, getActivity()));
                switchPreference.setOnPreferenceChangeListener(this);
                switchPreference.setPersistent(false);
                sectionsCategory.addPreference(switchPreference);
            }
        }
    }
 
開發者ID:morogoku,項目名稱:MTweaks-KernelAdiutorMOD,代碼行數:71,代碼來源:SettingsFragment.java

示例5: init

import android.support.v4.app.Fragment; //導入方法依賴的package包/類
private void init() {
    addPreferencesFromResource(R.xml.settings);

    if (Utils.DONATED) {
        getPreferenceScreen().removePreference(findPreference(KEY_AD_VIEW));
    }

    SwitchPreferenceCompat forceEnglish = (SwitchPreferenceCompat) findPreference(KEY_FORCE_ENGLISH);
    if (Resources.getSystem().getConfiguration().locale.getLanguage().startsWith("en")) {
        getPreferenceScreen().removePreference(forceEnglish);
    } else {
        forceEnglish.setOnPreferenceChangeListener(this);
    }

    if (Utils.hideStartActivity()) {
        ((PreferenceCategory) findPreference(KEY_USER_INTERFACE))
                .removePreference(findPreference(KEY_MATERIAL_ICON));
    } else {
        findPreference(KEY_MATERIAL_ICON).setOnPreferenceChangeListener(this);
    }

    findPreference(KEY_DARK_THEME).setOnPreferenceChangeListener(this);
    findPreference(KEY_BANNER_RESIZER).setOnPreferenceClickListener(this);
    findPreference(KEY_HIDE_BANNER).setOnPreferenceChangeListener(this);
    findPreference(KEY_ACCENT_COLOR).setOnPreferenceClickListener(this);
    findPreference(KEY_SECTIONS_ICON).setOnPreferenceChangeListener(this);
    findPreference(KEY_APPLY_ON_BOOT_TEST).setOnPreferenceClickListener(this);
    findPreference(KEY_LOGCAT).setOnPreferenceClickListener(this);

    if (Utils.existFile("/proc/last_kmsg") || Utils.existFile("/sys/fs/pstore/console-ramoops")) {
        findPreference(KEY_LAST_KMSG).setOnPreferenceClickListener(this);
    } else {
        ((PreferenceCategory) findPreference(KEY_DEBUGGING_CATEGORY)).removePreference(
                findPreference(KEY_LAST_KMSG));
    }

    findPreference(KEY_DMESG).setOnPreferenceClickListener(this);
    findPreference(KEY_SET_PASSWORD).setOnPreferenceClickListener(this);
    findPreference(KEY_DELETE_PASSWORD).setOnPreferenceClickListener(this);

    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M
            || !FingerprintManagerCompat.from(getActivity()).isHardwareDetected()) {
        ((PreferenceCategory) findPreference(KEY_SECURITY_CATEGORY)).removePreference(
                findPreference(KEY_FINGERPRINT));
    } else {
        mFingerprint = findPreference(KEY_FINGERPRINT);
        mFingerprint.setEnabled(!Prefs.getString("password", "", getActivity()).isEmpty());
    }

    PreferenceCategory sectionsCategory = (PreferenceCategory) findPreference(KEY_SECTIONS);
    for (NavigationActivity.NavigationFragment navigationFragment : NavigationActivity.sFragments) {
        Fragment fragment = navigationFragment.mFragment;
        int id = navigationFragment.mId;

        if (fragment != null && fragment.getClass() != SettingsFragment.class) {
            SwitchPreferenceCompat switchPreference = new SwitchPreferenceCompat(
                    new ContextThemeWrapper(getActivity(), R.style.Preference_SwitchPreferenceCompat_Material));
            switchPreference.setSummary(getString(id));
            switchPreference.setKey(fragment.getClass().getSimpleName() + "_enabled");
            switchPreference.setChecked(Prefs.getBoolean(fragment.getClass().getSimpleName()
                    + "_enabled", true, getActivity()));
            switchPreference.setOnPreferenceChangeListener(this);
            switchPreference.setPersistent(false);
            sectionsCategory.addPreference(switchPreference);
        }
    }
}
 
開發者ID:AyushR1,項目名稱:KernelAdiutor-Mod,代碼行數:68,代碼來源:SettingsFragment.java

示例6: innerLinkToFragment

import android.support.v4.app.Fragment; //導入方法依賴的package包/類
private static void innerLinkToFragment(FragmentManager fragmentManager, @NonNull Uri uri, @NonNull INLFragmentRoutingCallback callback, boolean linkFromActivity)
{
    if(fragmentManager == null) return;

    smartInit();

    List<Fragment> addedFragmentList = fragmentManager.getFragments();

    String url = uri.toString();

    ArrayList<Mapping> targetFragmentMappings = linkFromActivity ? mMasterFragmentMappings : mChildFragmentMappings;

    for(Mapping mapping : targetFragmentMappings)
    {
        if(mapping.isMatched(url))
        {
            boolean isTargetHasBeenAdded = false;
            Fragment existingTargetFragment = null;

            Class<? extends Fragment> target = mapping.getTargetFragment();

            if(target == null) break;

            if(addedFragmentList != null && !addedFragmentList.isEmpty())
            {
                for(Fragment f : addedFragmentList)
                {
                    if(f == null) continue;

                    Class<? extends Fragment> fClass = f.getClass();

                    if(target.equals(fClass))
                    {
                        isTargetHasBeenAdded = true;

                        existingTargetFragment = f;

                        break;
                    }
                }
            }

            Bundle extras = mapping.parseExtras(url);

            if(isTargetHasBeenAdded)
            {
                callback.onFragmentRouting(existingTargetFragment, extras, true);

                return;
            }

            try
            {
                callback.onFragmentRouting(target.newInstance(), extras, false);

                return;
            }
            catch (Exception e)
            {
                e.printStackTrace();
            }

            break;
        }
    }

    callback.onFragmentRouting(null, null, false);
}
 
開發者ID:kfrozen,項目名稱:DeeplinkRouter,代碼行數:69,代碼來源:DPRouter.java


注:本文中的android.support.v4.app.Fragment.getClass方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。