This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// references : https://github.com/firebase/firebase-android-sdk/issues/1952#issuecomment-713094146 | |
// error handling page | |
class ErrorActivity : AppCompatActivity() { | |
companion object { | |
private const val ERROR_TEXT = "ERROR_TEXT" | |
fun start(context: Context, errorText: String) = with(context) { | |
val intent = Intent(this, ErrorActivity::class.java).apply { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void releaseWrapperAndLocalPosition( | |
WrapperAndLocalPosition wrapperAndLocalPosition | |
) { | |
wrapperAndLocalPosition.mInUse = false; | |
wrapperAndLocalPosition.mWrapper = null; | |
wrapperAndLocalPosition.mLocalPosition = -1; | |
mReusableHolder = wrapperAndLocalPosition; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@NonNull | |
private WrapperAndLocalPosition findWrapperAndLocalPosition( | |
int globalPosition | |
) { | |
WrapperAndLocalPosition result; | |
if (mReusableHolder.mInUse) { | |
result = new WrapperAndLocalPosition(); | |
} else { | |
mReusableHolder.mInUse = true; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ConcatAdapterController implements NestedAdapterWrapper.Callback { | |
private WrapperAndLocalPosition mReusableHolder = new WrapperAndLocalPosition(); | |
static class WrapperAndLocalPosition { | |
NestedAdapterWrapper mWrapper; | |
int mLocalPosition; | |
boolean mInUse; | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ConcatAdapterController implements NestedAdapterWrapper.Callback { | |
.. | |
public long getItemId(int globalPosition) { | |
WrapperAndLocalPosition wrapperAndPos = findWrapperAndLocalPosition(globalPosition); | |
Long globalItemId = wrapperAndPos.mWrapper.getItemId(wrapperAndPos.mLocalPosition); | |
releaseWrapperAndLocalPosition(wrapperAndPos); | |
return globalItemId; | |
} | |
.. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ConcatAdapterController implements NestedAdapterWrapper.Callback { | |
.. | |
public int getItemViewType(int globalPosition) { | |
WrapperAndLocalPosition wrapperAndPos = findWrapperAndLocalPosition(globalPosition); | |
int itemViewType = wrapperAndPos.mWrapper.getItemViewType(wrapperAndPos.mLocalPosition); | |
releaseWrapperAndLocalPosition(wrapperAndPos); | |
return itemViewType; | |
} | |
.. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class NestedAdapterWrapper { | |
@NonNull | |
private final StableIdStorage.StableIdLookup mStableIdLookup; | |
public long getItemId(int localPosition) { | |
long localItemId = adapter.getItemId(localPosition); | |
return mStableIdLookup.localToGlobal(localItemId); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class NestedAdapterWrapper { | |
@NonNull | |
private final ViewTypeStorage.ViewTypeLookup mViewTypeLookup; | |
NestedAdapterWrapper( | |
Adapter<ViewHolder> adapter, | |
final Callback callback, | |
ViewTypeStorage viewTypeStorage, | |
StableIdStorage.StableIdLookup stableIdLookup | |
) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class NestedAdapterWrapper { | |
int getItemViewType(int localPosition) { | |
return mViewTypeLookup.localToGlobal( | |
adapter.getItemViewType(localPosition) | |
); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ConcatAdapterController implements NestedAdapterWrapper.Callback { | |
... | |
@NonNull | |
private final ConcatAdapter.Config.StableIdMode mStableIdMode; | |
... | |
} |
NewerOlder