当前位置: 首页>>代码示例>>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;未经允许,请勿转载。