本文整理汇总了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();
}
}
}
示例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();
}
}
}
示例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;
}
示例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);
}
}
}
示例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);
}
}
}
示例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);
}