Skip to content
This repository has been archived by the owner on Apr 20, 2021. It is now read-only.

Commit

Permalink
Generate source
Browse files Browse the repository at this point in the history
new ViewModelStore
  • Loading branch information
passsy committed Jul 10, 2018
1 parent 5174f05 commit c5fbfa9
Show file tree
Hide file tree
Showing 13 changed files with 320 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import android.app.VoiceInteractor;
import android.app.assist.AssistContent;
import android.arch.lifecycle.Lifecycle;
import android.arch.lifecycle.ViewModelStore;
import android.content.BroadcastReceiver;
import android.content.ComponentCallbacks;
import android.content.ComponentName;
Expand Down Expand Up @@ -2670,6 +2671,27 @@ public void call(final Integer resid) {
superCall.call(resid);
}

public ViewModelStore getViewModelStore() {
if (mPlugins.isEmpty()) {
return getOriginal().super_getViewModelStore();
}

final ListIterator<ActivityPlugin> iterator = mPlugins.listIterator(mPlugins.size());

final CallFun0<ViewModelStore> superCall = new CallFun0<ViewModelStore>("getViewModelStore()") {

@Override
public ViewModelStore call() {
if (iterator.hasPrevious()) {
return iterator.previous().getViewModelStore(this);
} else {
return getOriginal().super_getViewModelStore();
}
}
};
return superCall.call();
}

public VoiceInteractor getVoiceInteractor() {
if (mPlugins.isEmpty()) {
return getOriginal().super_getVoiceInteractor();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import android.app.VoiceInteractor;
import android.app.assist.AssistContent;
import android.arch.lifecycle.Lifecycle;
import android.arch.lifecycle.ViewModelStore;
import android.content.ActivityNotFoundException;
import android.content.BroadcastReceiver;
import android.content.ComponentCallbacks;
Expand Down Expand Up @@ -1138,6 +1139,16 @@ public void setTheme(final int resid) {
((CallVoid1<Integer>) mSuperListeners.pop()).call(resid);
}

/**
* Returns the {@link ViewModelStore} associated with this activity
*
* @return a {@code ViewModelStore}
*/
public ViewModelStore getViewModelStore() {
verifyMethodCalledFromDelegate("getViewModelStore()");
return ((CallFun0<ViewModelStore>) mSuperListeners.pop()).call();
}

/**
* Retrieve the active {@link VoiceInteractor} that the user is going through to
* interact with this activity.
Expand Down Expand Up @@ -5041,6 +5052,13 @@ Theme getTheme(final CallFun0<Theme> superCall) {
}
}

ViewModelStore getViewModelStore(final CallFun0<ViewModelStore> superCall) {
synchronized (mSuperListeners) {
mSuperListeners.push(superCall);
return getViewModelStore();
}
}

VoiceInteractor getVoiceInteractor(final CallFun0<VoiceInteractor> superCall) {
synchronized (mSuperListeners) {
mSuperListeners.push(superCall);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import android.app.VoiceInteractor;
import android.app.assist.AssistContent;
import android.arch.lifecycle.Lifecycle;
import android.arch.lifecycle.ViewModelStore;
import android.content.ActivityNotFoundException;
import android.content.BroadcastReceiver;
import android.content.ComponentCallbacks;
Expand Down Expand Up @@ -1430,6 +1431,17 @@ public void setTheme(final int resid) {
delegate.setTheme(resid);
}

/**
* Returns the {@link ViewModelStore} associated with this activity
*
* @return a {@code ViewModelStore}
*/
@NonNull
@Override
public ViewModelStore getViewModelStore() {
return delegate.getViewModelStore();
}

/**
* Retrieve the active {@link VoiceInteractor} that the user is going through to
* interact with this activity.
Expand Down Expand Up @@ -5149,6 +5161,17 @@ public Theme super_getTheme() {
return super.getTheme();
}

/**
* Returns the {@link ViewModelStore} associated with this activity
*
* @return a {@code ViewModelStore}
*/
@NonNull
@Override
public ViewModelStore super_getViewModelStore() {
return super.getViewModelStore();
}

/**
* Retrieve the active {@link VoiceInteractor} that the user is going through to
* interact with this activity.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import android.app.VoiceInteractor;
import android.app.assist.AssistContent;
import android.arch.lifecycle.Lifecycle;
import android.arch.lifecycle.ViewModelStore;
import android.content.BroadcastReceiver;
import android.content.ComponentCallbacks;
import android.content.ComponentCallbacks2;
Expand Down Expand Up @@ -344,6 +345,8 @@ void enforceUriPermission(final Uri uri, final String readPermission, final Stri

void setTheme(final int resid);

ViewModelStore getViewModelStore();

VoiceInteractor getVoiceInteractor();

Drawable getWallpaper();
Expand Down Expand Up @@ -1041,6 +1044,8 @@ void super_enforceUriPermission(final Uri uri, final String readPermission, fina

Theme super_getTheme();

ViewModelStore super_getViewModelStore();

VoiceInteractor super_getVoiceInteractor();

Drawable super_getWallpaper();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.Dialog;
import android.arch.lifecycle.ViewModelStore;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
Expand Down Expand Up @@ -431,6 +432,8 @@ public void setAllowReturnTransitionOverlap(final boolean allow) {

/**
* Return the {@link Context} this fragment is currently associated with.
*
* @see #requireContext()
*/
@Nullable
@Override
Expand Down Expand Up @@ -502,7 +505,9 @@ public Object getExitTransition() {
*
* @param transition The Transition to use to move Views out of the Scene when the Fragment
* is being closed not due to popping the back stack. <code>transition</code>
* must be an android.transition.Transition.
* must be an
* {@link Transition android.transition.Transition} or
* {@link android.support.transition.Transition android.support.transition.Transition}.
*/
@Override
public void setExitTransition(@Nullable final Object transition) {
Expand Down Expand Up @@ -565,7 +570,9 @@ public Object getReenterTransition() {
*
* @param transition The Transition to use to move Views into the scene when reentering from a
* previously-started Activity. <code>transition</code>
* must be an android.transition.Transition.
* must be an
* {@link Transition android.transition.Transition} or
* {@link android.support.transition.Transition android.support.transition.Transition}.
*/
@Override
public void setReenterTransition(@Nullable final Object transition) {
Expand Down Expand Up @@ -602,7 +609,8 @@ public Object getReturnTransition() {
*
* @param transition The Transition to use to move Views out of the Scene when the Fragment
* is preparing to close. <code>transition</code> must be an
* android.transition.Transition.
* {@link Transition android.transition.Transition} or
* {@link android.support.transition.Transition android.support.transition.Transition}.
*/
@Override
public void setReturnTransition(@Nullable final Object transition) {
Expand Down Expand Up @@ -631,7 +639,9 @@ public Object getSharedElementEnterTransition() {
* value will cause transferred shared elements to blink to the final position.
*
* @param transition The Transition to use for shared elements transferred into the content
* Scene. <code>transition</code> must be an android.transition.Transition.
* Scene. <code>transition</code> must be an
* {@link Transition android.transition.Transition} or
* {@link android.support.transition.Transition android.support.transition.Transition}.
*/
@Override
public void setSharedElementEnterTransition(@Nullable final Object transition) {
Expand Down Expand Up @@ -666,7 +676,9 @@ public Object getSharedElementReturnTransition() {
* {@link #setSharedElementEnterTransition(Object)}.
*
* @param transition The Transition to use for shared elements transferred out of the content
* Scene. <code>transition</code> must be an android.transition.Transition.
* Scene. <code>transition</code> must be an
* {@link Transition android.transition.Transition} or
* {@link android.support.transition.Transition android.support.transition.Transition}.
*/
@Override
public void setSharedElementReturnTransition(@Nullable final Object transition) {
Expand Down Expand Up @@ -750,6 +762,12 @@ public View getView() {
return delegate.getView();
}

@NonNull
@Override
public ViewModelStore getViewModelStore() {
return delegate.getViewModelStore();
}

/**
* Return the current value of {@link #setCancelable(boolean)}.
*/
Expand Down Expand Up @@ -1315,8 +1333,8 @@ public boolean shouldShowRequestPermissionRationale(@NonNull final String permis
/**
* Display the dialog, adding the fragment to the given FragmentManager. This
* is a convenience for explicitly creating a transaction, adding the
* fragment to it with the given tag, and committing it. This does
* <em>not</em> add the transaction to the back stack. When the fragment
* fragment to it with the given tag, and {@link FragmentTransaction#commit() committing} it.
* This does <em>not</em> add the transaction to the fragment back stack. When the fragment
* is dismissed, a new transaction will be executed to remove it from
* the activity.
*
Expand All @@ -1331,7 +1349,7 @@ public void show(final FragmentManager manager, final String tag) {

/**
* Display the dialog, adding the fragment using an existing transaction
* and then committing the transaction.
* and then {@link FragmentTransaction#commit() committing} the transaction.
*
* @param transaction An existing transaction in which to add the fragment.
* @param tag The tag for this fragment, as per
Expand All @@ -1344,6 +1362,23 @@ public int show(final FragmentTransaction transaction, final String tag) {
return delegate.show(transaction, tag);
}

/**
* Display the dialog, immediately adding the fragment to the given FragmentManager. This
* is a convenience for explicitly creating a transaction, adding the
* fragment to it with the given tag, and calling {@link FragmentTransaction#commitNow()}.
* This does <em>not</em> add the transaction to the fragment back stack. When the fragment
* is dismissed, a new transaction will be executed to remove it from
* the activity.
*
* @param manager The FragmentManager this fragment will be added to.
* @param tag The tag for this fragment, as per
* {@link FragmentTransaction#add(Fragment, String) FragmentTransaction.add}.
*/
@Override
public void showNow(final FragmentManager manager, final String tag) {
delegate.showNow(manager, tag);
}

/**
* Call {@link Activity#startActivity(Intent)} from the fragment's
* containing Activity.
Expand Down Expand Up @@ -1480,6 +1515,8 @@ public boolean super_getAllowReturnTransitionOverlap() {

/**
* Return the {@link Context} this fragment is currently associated with.
*
* @see #requireContext()
*/
@Nullable
@Override
Expand Down Expand Up @@ -1659,6 +1696,12 @@ public View super_getView() {
return super.getView();
}

@NonNull
@Override
public ViewModelStore super_getViewModelStore() {
return super.getViewModelStore();
}

/**
* Return the current value of {@link #setCancelable(boolean)}.
*/
Expand Down Expand Up @@ -2443,7 +2486,9 @@ public void super_setExitSharedElementCallback(final SharedElementCallback callb
*
* @param transition The Transition to use to move Views out of the Scene when the Fragment
* is being closed not due to popping the back stack. <code>transition</code>
* must be an android.transition.Transition.
* must be an
* {@link Transition android.transition.Transition} or
* {@link android.support.transition.Transition android.support.transition.Transition}.
*/

@Override
Expand Down Expand Up @@ -2504,7 +2549,9 @@ public void super_setMenuVisibility(final boolean menuVisible) {
*
* @param transition The Transition to use to move Views into the scene when reentering from a
* previously-started Activity. <code>transition</code>
* must be an android.transition.Transition.
* must be an
* {@link Transition android.transition.Transition} or
* {@link android.support.transition.Transition android.support.transition.Transition}.
*/

@Override
Expand Down Expand Up @@ -2544,7 +2591,8 @@ public void super_setRetainInstance(final boolean retain) {
*
* @param transition The Transition to use to move Views out of the Scene when the Fragment
* is preparing to close. <code>transition</code> must be an
* android.transition.Transition.
* {@link Transition android.transition.Transition} or
* {@link android.support.transition.Transition android.support.transition.Transition}.
*/

@Override
Expand All @@ -2559,7 +2607,9 @@ public void super_setReturnTransition(@Nullable final Object transition) {
* value will cause transferred shared elements to blink to the final position.
*
* @param transition The Transition to use for shared elements transferred into the content
* Scene. <code>transition</code> must be an android.transition.Transition.
* Scene. <code>transition</code> must be an
* {@link Transition android.transition.Transition} or
* {@link android.support.transition.Transition android.support.transition.Transition}.
*/

@Override
Expand All @@ -2577,7 +2627,9 @@ public void super_setSharedElementEnterTransition(@Nullable final Object transit
* {@link #setSharedElementEnterTransition(Object)}.
*
* @param transition The Transition to use for shared elements transferred out of the content
* Scene. <code>transition</code> must be an android.transition.Transition.
* Scene. <code>transition</code> must be an
* {@link Transition android.transition.Transition} or
* {@link android.support.transition.Transition android.support.transition.Transition}.
*/

@Override
Expand Down Expand Up @@ -2703,8 +2755,8 @@ public boolean super_shouldShowRequestPermissionRationale(@NonNull final String
/**
* Display the dialog, adding the fragment to the given FragmentManager. This
* is a convenience for explicitly creating a transaction, adding the
* fragment to it with the given tag, and committing it. This does
* <em>not</em> add the transaction to the back stack. When the fragment
* fragment to it with the given tag, and {@link FragmentTransaction#commit() committing} it.
* This does <em>not</em> add the transaction to the fragment back stack. When the fragment
* is dismissed, a new transaction will be executed to remove it from
* the activity.
*
Expand All @@ -2720,7 +2772,7 @@ public void super_show(final FragmentManager manager, final String tag) {

/**
* Display the dialog, adding the fragment using an existing transaction
* and then committing the transaction.
* and then {@link FragmentTransaction#commit() committing} the transaction.
*
* @param transaction An existing transaction in which to add the fragment.
* @param tag The tag for this fragment, as per
Expand All @@ -2734,6 +2786,24 @@ public int super_show(final FragmentTransaction transaction, final String tag) {
return super.show(transaction, tag);
}

/**
* Display the dialog, immediately adding the fragment to the given FragmentManager. This
* is a convenience for explicitly creating a transaction, adding the
* fragment to it with the given tag, and calling {@link FragmentTransaction#commitNow()}.
* This does <em>not</em> add the transaction to the fragment back stack. When the fragment
* is dismissed, a new transaction will be executed to remove it from
* the activity.
*
* @param manager The FragmentManager this fragment will be added to.
* @param tag The tag for this fragment, as per
* {@link FragmentTransaction#add(Fragment, String) FragmentTransaction.add}.
*/

@Override
public void super_showNow(final FragmentManager manager, final String tag) {
super.showNow(manager, tag);
}

/**
* Call {@link Activity#startActivity(Intent)} from the fragment's
* containing Activity.
Expand Down
Loading

0 comments on commit c5fbfa9

Please sign in to comment.