List of usage examples for android.support.v4.app Fragment getActivity
public Activity getActivity()
From source file:com.dycody.android.idealnote.async.CategoryMenuTask.java
public CategoryMenuTask(Fragment mFragment) { mFragmentWeakReference = new WeakReference<>(mFragment); this.mainActivity = (MainActivity) mFragment.getActivity(); }
From source file:com.kangsoo.pharmacy.fragment.FragmentPagerAdapter.java
public FragmentPagerAdapter(Fragment fragment) { super(fragment.getChildFragmentManager()); fragmentManager = fragment.getChildFragmentManager(); this.activity = (ActionBarActivity) fragment.getActivity(); }
From source file:com.ykhdzr.flow.Flow.java
private void fromFragment() { Fragment fragment = ((Fragment) src); if (forResult) { fragment.startActivityForResult(intent(fragment.getActivity()), requestCode); } else {//w w w. j ava 2s . co m fragment.startActivity(intent(fragment.getActivity())); } }
From source file:com.mvcoding.financius.ui.ActivityStarter.java
private ActivityStarter(@NonNull Fragment fragment, @NonNull Class activityClass) { this.fragment = checkNotNull(fragment, "Fragment cannot be null."); this.context = checkNotNull(fragment.getActivity(), "Fragment must be attached to Activity."); this.activityClass = checkNotNull(activityClass, "Activity class cannot be null."); this.intent = createIntent(context, activityClass); }
From source file:org.alfresco.mobile.android.application.fragments.node.details.NodeDetailsActionMode.java
public NodeDetailsActionMode(Fragment f, Node selectedNode) { this.fragmentRef = new WeakReference<>(f); this.activityRef = new WeakReference<>(f.getActivity()); this.selectedItems = new ArrayList<>(1); addNode(selectedNode);/*from w w w. j a v a 2 s .c o m*/ this.multiSelectionEnable = false; }
From source file:com.mvcoding.financius.feature.ActivityStarter.java
private ActivityStarter(@NonNull Fragment fragment, @NonNull Class activityClass) { mFragment = fragment;//from w w w .ja va 2s. co m mContext = fragment.getActivity(); mIntent = createIntent(mContext, activityClass); }
From source file:com.normalexception.app.rx8club.fragment.FragmentUtils.java
/** * Update the pagination text/*from w ww . java 2 s. c o m*/ * @param thisPage the page we are currently on * @param finalPage the last page of the category/thread */ public static String[] updatePagination(final Fragment src, String thisPage, String finalPage) { try { if (!thisPage.equals("") && !finalPage.equals("")) { final boolean first, prev, next, last; String myThisPage = thisPage; String myFinalPage = finalPage; final TextView pagination = (TextView) src.getView().findViewById(R.id.paginationText); String label = pagination.getText().toString(); label = label.replace("X", thisPage); label = label.replace("Y", finalPage); final String finalizedLabel = label; // Set up our buttons prev = Integer.parseInt(thisPage) == 1 ? false : true; first = Integer.parseInt(thisPage) == 1 ? false : true; next = Integer.parseInt(finalPage) > Integer.parseInt(thisPage) ? true : false; last = Integer.parseInt(thisPage) == Integer.parseInt(finalPage) ? false : true; // Update GUI components src.getActivity().runOnUiThread(new Runnable() { public void run() { src.getView().findViewById(R.id.previousButton).setEnabled(prev); src.getView().findViewById(R.id.firstButton).setEnabled(first); src.getView().findViewById(R.id.nextButton).setEnabled(next); src.getView().findViewById(R.id.lastButton).setEnabled(last); pagination.setText(finalizedLabel); } }); return new String[] { myThisPage, myFinalPage }; } } catch (Exception e) { Log.e(TAG, "Error Parsing Pagination", e); } return null; }
From source file:org.ambient.control.home.roomitems.ClimateStrategy.java
@Override public View onCreateView(Fragment context, Entity entity) { Climate climate = (Climate) entity;/*from w w w . j av a 2 s .c o m*/ LayoutInflater inflater = (LayoutInflater) context.getActivity() .getSystemService(Context.LAYOUT_INFLATER_SERVICE); RelativeLayout itemContent = (RelativeLayout) inflater.inflate(R.layout.layout_room_item_heating_content, null); updateIcon(itemContent, climate.getTemperatureMode()); return itemContent; }
From source file:com.grottworkshop.gwsviewmodellibrary.viewmodel.ViewModelHelper.java
public void onDestroy(@NonNull Fragment fragment) { if (mViewModel == null) { //no viewmodel for this fragment return;//from www .ja va 2s .c om } if (fragment.getActivity().isFinishing()) { removeViewModel(fragment.getActivity()); } else if (fragment.isRemoving()) { Log.d("mode", "Removing viewmodel - fragment replaced"); removeViewModel(fragment.getActivity()); } }
From source file:net.granoeste.scaffold.util.TrackerToLog.java
@Override public void trackOperation(final Fragment fragment, final String operation) { if (fragment == null) { return;//from w ww . j a va2 s. c o m } if (fragment.getActivity() == null) { return; } track(fragment.getActivity(), makeLogTag(((Object) fragment).getClass()), operation); }