Skip to content

Instantly share code, notes, and snippets.

View Android TopSheetDialog Implementation by Taskito.md
<style name="TopSheet_DialogAnimation">
  <item name="android:windowEnterAnimation">@anim/slide_out_from_top</item>
  <item name="android:windowExitAnimation">@anim/slide_back_to_top</item>
</style>

slide_out_from_top

@jayrambhia
jayrambhia / BattleshipActivity.kt
Last active Aug 20, 2018
Battleship game in Kotlin
View BattleshipActivity.kt
class BattleshipActivity: AppCompatActivity() {
private lateinit var gridAdpater: UiCellAdapter
private lateinit var myBoard: Board
private lateinit var otherBoard: Board
private val width: Int = 10
override fun onCreate(savedInstanceState: Bundle?) {
@jayrambhia
jayrambhia / appstore1.kt
Last active May 9, 2019
Redux implementation in Kotlin
View appstore1.kt
data class AppState(val searchState: SearchState = SearchState())
class AppStore: Store<AppState>(
initialState = AppState(),
reducers = listOf(::reduceSearchState)) {
companion object {
val instance by lazy {
AppStore()
}
@jayrambhia
jayrambhia / ColorDetector.java
Last active Jun 26, 2018
ColorDetector - Lint detector
View ColorDetector.java
public class ColorDetector extends ResourceXmlDetector {
private static final String ID = "CustomColors";
private static final String DESCRIPTION = "Custom colors used";
private static final String EXPLANATION = "Use pre-defined (allowed) colors only";
private static final Category CATEGORY = Category.CORRECTNESS;
private static final int PRIORITY = 6;
private static final Severity SEVERITY = Severity.ERROR;
public static final Issue ISSUE = Issue.create(
View FullScreenComponentSpec-1.java
@LayoutSpec(events = { LikeChangeEvent.class })
public class FullScreenComponentSpec {
... other stuff
@OnEvent(ClickEvent.class)
static void onLikeButtonClicked(ComponentContext c, @State boolean isLiked, @Prop GifItem gif, @Prop Component gifComponent) {
FullScreenComponent.updateLikeButtonAsync(c, !isLiked);
FullScreenComponent.dispatchLikeChangeEvent(FullScreenComponent.getLikeChangeEventHandler(c), !isLiked, gif.getId());
@jayrambhia
jayrambhia / EventHandler.java
Last active Apr 28, 2017
Events with Litho
View EventHandler.java
final EventDispatcher likeEventDispatcher = new EventDispatcher() {
@Override
public Object dispatchOnEvent(EventHandler eventHandler, Object eventState) {
// Do stuff here
return null;
}
};
HasEventDispatcher hasEventDispatcher = new HasEventDispatcher() {
@Override
@jayrambhia
jayrambhia / FullScreenComponentSpec.java
Last active Apr 26, 2017
Component Navigation with Litho
View FullScreenComponentSpec.java
@LayoutSpec
public class FullScreenComponentSpec {
@OnCreateInitialState
static void createInitialState(ComponentContext c, StateValue<Boolean> isLiked, @Prop boolean initLiked) {
isLiked.set(initLiked);
}
@OnCreateLayout
static ComponentLayout onCreateLayout(ComponentContext context, @Prop RequestManager glide, @Prop GifItem gif, @State boolean isLiked) {
@jayrambhia
jayrambhia / GifItem.java
Last active Apr 24, 2017
Android Litho State
View GifItem.java
public class GifItem {
private final String id;
private final String image;
private final boolean isLiked;
public GifItem(JsonObject json, boolean isLiked) {
this.id = json.get("id").getAsString();
JsonObject image = json.get("images").getAsJsonObject().get("original").getAsJsonObject();
this.image = image.get("url").getAsString();
@jayrambhia
jayrambhia / GifItem.java
Last active Jun 24, 2017
GIF search engine with Litho and Giphy for Android
View GifItem.java
public class GifItem {
private final String id;
private final String image;
public GifItem(JsonObject json) {
this.id = json.get("id").getAsString();
JsonObject image = json.get("images").getAsJsonObject().get("original").getAsJsonObject();
this.image = image.get("url").getAsString();
}
View lenx_privacy_policy.txt
Privacy Policy
Fenchtose built Lenx app as a commercial app. This SERVICE is provided by Fenchtose is intended for use as is.
This page is used to inform website visitors regarding my policies with the collection, use, and
disclosure of Personal Information if anyone decided to use my Service.
If you choose to use my Service, then you agree to the collection and use of information in
relation with this policy. The Personal Information that I collect are used for providing and
improving the Service. I will not use or share your information with anyone except as described
in this Privacy Policy.