Java Code Examples for android.support.v4.app.Fragment#getClass()

The following examples show how to use android.support.v4.app.Fragment#getClass() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EncounterTaskList.java    From sana.mobile with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void onAttachFragment(Fragment fragment) {
    Log.d(TAG, "onStart()");
    super.onAttachFragment(fragment);
    Locales.updateLocale(this, getString(R.string.force_locale));
    if (fragment.getClass() == EncounterTaskListFragment.class) {
        mListFragment = (EncounterTaskListFragment) fragment;
        mListFragment.setOnModelItemSelectedListener(this);
        showProgressDialogFragment(getString(R.string.network_synchronizing));
    } else if (fragment.getClass() == EncounterTaskListCompleteFragment.class) {
        mCompleteListFragment = (EncounterTaskListCompleteFragment) fragment;
        mCompleteListFragment.setOnModelItemSelectedListener(this);
        showProgressDialogFragment(getString(R.string.network_synchronizing));
    }
}
 
Example 2
Source File: PatientsList.java    From sana.mobile with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void onAttachFragment(Fragment fragment) {
    Log.d(TAG, "onStart()");
    super.onAttachFragment(fragment);
    Locales.updateLocale(this, getString(R.string.force_locale));
    if (fragment.getClass() == PatientListFragment.class) {
        mFragmentPatientList = (PatientListFragment) fragment;
        mFragmentPatientList.setOnPatientSelectedListener(this);
        mFragmentPatientList.setOnScrollCompleteListener(this);
        if (mFragmentPatientList.sync(this, Subjects.CONTENT_URI)) {
            showProgressDialog(getString(R.string.general_synchronizing),
                    getString(R.string.general_fetching_patients));
        }
    }
}
 
Example 3
Source File: RxPermissionsResult.java    From RxPermissionsResult with Apache License 2.0 5 votes vote down vote up
@Nullable private Fragment getTargetFragment(List<Fragment> fragments) {
  if (fragments == null) return null;

  for (Fragment fragment : fragments) {
    if(fragment != null && fragment.isVisible() && fragment.getClass() == clazz) {
      return fragment;
    } else if (fragment != null && fragment.getChildFragmentManager() != null) {
      List<Fragment> childFragments = fragment.getChildFragmentManager().getFragments();
      Fragment candidate = getTargetFragment(childFragments);
      if (candidate != null) return candidate;
    }
  }

  return null;
}
 
Example 4
Source File: RxPermissionsResult.java    From RxPermissionsResult with Apache License 2.0 5 votes vote down vote up
@Nullable private Fragment getTargetFragment(List<Fragment> fragments) {
  if (fragments == null) return null;

  for (Fragment fragment : fragments) {
    if(fragment != null && fragment.isVisible() && fragment.getClass() == clazz) {
      return fragment;
    } else if (fragment != null && fragment.getChildFragmentManager() != null) {
      List<Fragment> childFragments = fragment.getChildFragmentManager().getFragments();
      Fragment candidate = getTargetFragment(childFragments);
      if (candidate != null) return candidate;
    }
  }

  return null;
}
 
Example 5
Source File: PatientRunner.java    From sana.mobile with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void onAttachFragment(Fragment fragment) {
    super.onAttachFragment(fragment);
    if (fragment.getClass() == PatientRunnerFragment.class) {
        //mFragmentPatientRunner = (PatientRunnerFragment) fragment;
        mRunnerFragment = (PatientRunnerFragment) fragment;
        mRunnerFragment.setProcedureListener(this);
    }
}
 
Example 6
Source File: ProcedureRunner.java    From sana.mobile with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void onAttachFragment(Fragment fragment) {
    Locales.updateLocale(this, getString(R.string.force_locale));
    super.onAttachFragment(fragment);
    if (fragment.getClass() == ProcedureRunnerFragment.class) {
        mProcedureRunnerFragment = (ProcedureRunnerFragment) fragment;
        mProcedureRunnerFragment.setProcedureListener(this);
    }
}
 
Example 7
Source File: EncounterList.java    From sana.mobile with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void onAttachFragment(Fragment fragment) {
    Log.d(TAG, "onStart()");
    super.onAttachFragment(fragment);
    Locales.updateLocale(this, getString(R.string.force_locale));
    if (fragment.getClass() == EncounterListFragment.class) {
        mListFragment = (EncounterListFragment) fragment;
        mListFragment.setOnModelItemSelectedListener(this);
        //showProgressDialogFragment(null);
    }
}
 
Example 8
Source File: MainActivity.java    From android-multibackstack with Apache License 2.0 4 votes vote down vote up
private boolean isRootTabFragment(@NonNull Fragment fragment, int tabId) {
  return fragment.getClass() == rootTabFragment(tabId).getClass();
}