Skip to content

Instantly share code, notes, and snippets.

View muratcanbur's full-sized avatar

Murat Can BUR muratcanbur

View GitHub Profile
@muratcanbur
muratcanbur / BaseMockitoTest.kt
Last active April 15, 2019 10:50 — forked from ufuk/BaseMockito2JUnit4Test.java
Performs "verify no more interactions" check automatically for all mock objects (works with Mockito version 2). For detailed description: https://ufukuzun.wordpress.com/2019/04/09/ne-olup-bittiginden-habersiz-testlere-derman-mockscollector/ (Turkish)
@RunWith(AndroidJUnit4::class)
abstract class BaseMockitoTest {
private val mockitoMocksCollector = MockitoMocksCollector()
@After
fun after() {
val allMocks = mockitoMocksCollector.getAllMocks()
allMocks.forEach { mock ->
verifyNoMoreInteractions(mock)

Make your multiple type view adapter with annotations!

Gist for Making a Multiple View Types Adapter With Annotations

Pretty easy to use.

  1. Create your delegate adapters, implementing DelegateAdapter, and with the annotation DelegateAdapterType. e.g:
@DelegateAdapterType(itemType = 0)
@muratcanbur
muratcanbur / android_lifecycle_recommendations.md
Created April 26, 2017 06:45 — forked from kaushikgopal/android_lifecycle_recommendations.md
Notes on opportune moments to do "stuff" in the Android Lifecycle
  • In general you want to try and put things in onStart and onStop for logical start and stops.

Activity

onCreate

  • Dagger inject self into graph
  • setContentView(R.layout.xxx)
  • Butterknife.bind(this)
  • RxJava CompositeSubscription.add (if NON UI related work being done)
  • realm = Realm.getDefaultInstance();
@muratcanbur
muratcanbur / Proguard config
Created November 8, 2016 12:28 — forked from PaNaVTEC/Proguard config
Proguard config
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /Users/panavtec/Documents/android-sdk-macosx/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the ProGuard
# include property in project.properties.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
[user]
email = salim.kayabasi@gmail.com
name = Salim KAYABAŞI
[core]
autocrlf = true
editor = 'C:/Program Files (x86)/Notepad++/notepad++.exe' -multiInst -notabbar -nosession -noPlugin
[color]
diff = auto
status = auto
branch = auto
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- google's material design colours from
http://www.google.com/design/spec/style/color.html#color-ui-color-palette -->
<!--reds-->
<color name="md_red_50">#fde0dc</color>
<color name="md_red_100">#f9bdbb</color>
<color name="md_red_200">#f69988</color>