This repository has been archived by the owner on Dec 28, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 477
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
51 changed files
with
883 additions
and
908 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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
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
72 changes: 72 additions & 0 deletions
72
app/src/main/java/com/simplecity/amp_library/ui/adapters/LoggingViewModelAdapter.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
package com.simplecity.amp_library.ui.adapters; | ||
|
||
import android.support.annotation.Nullable; | ||
import android.util.Log; | ||
|
||
import com.crashlytics.android.Crashlytics; | ||
import com.simplecityapps.recycler_adapter.adapter.CompletionListUpdateCallback; | ||
import com.simplecityapps.recycler_adapter.adapter.ViewModelAdapter; | ||
import com.simplecityapps.recycler_adapter.model.ViewModel; | ||
|
||
import java.util.List; | ||
|
||
import io.reactivex.disposables.Disposable; | ||
|
||
public class LoggingViewModelAdapter extends ViewModelAdapter { | ||
|
||
private static final String TAG = "LoggingVMAdapter"; | ||
|
||
private String tag; | ||
|
||
public LoggingViewModelAdapter(String tag) { | ||
this.tag = tag; | ||
} | ||
|
||
@Nullable | ||
@Override | ||
public synchronized Disposable setItems(List<ViewModel> items, @Nullable CompletionListUpdateCallback callback) { | ||
|
||
Crashlytics.log(Log.DEBUG, TAG, String.format("setItems called for: '%s'", tag)); | ||
|
||
return super.setItems(items, new CompletionListUpdateCallback() { | ||
|
||
@Override | ||
public void onComplete() { | ||
|
||
Crashlytics.log(Log.DEBUG, TAG, String.format("setItems complete for: '%s'. Dispatching updates.", tag)); | ||
|
||
if (callback != null) { | ||
callback.onComplete(); | ||
} | ||
} | ||
|
||
@Override | ||
public void onInserted(int position, int count) { | ||
if (callback != null) { | ||
callback.onInserted(position, count); | ||
} | ||
} | ||
|
||
@Override | ||
public void onRemoved(int position, int count) { | ||
if (callback != null) { | ||
callback.onRemoved(position, count); | ||
} | ||
} | ||
|
||
@Override | ||
public void onMoved(int fromPosition, int toPosition) { | ||
if (callback != null) { | ||
callback.onMoved(fromPosition, toPosition); | ||
} | ||
} | ||
|
||
@Override | ||
public void onChanged(int position, int count, Object payload) { | ||
if (callback != null) { | ||
callback.onChanged(position, count, payload); | ||
} | ||
} | ||
}); | ||
} | ||
} |
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
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
Oops, something went wrong.