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
Tasks | |
Skills | |
Social | |
Messages | |
Messages | |
Party | |
Purchase Gems | |
Subscription | |
Guilds | |
Challenges |
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 MainActivity : AppCompatActivity() { | |
private val viewModel: NetworkStatusViewModel by lazy { | |
ViewModelProvider( | |
this, | |
object : ViewModelProvider.Factory { | |
override fun <T : ViewModel?> create(modelClass: Class<T>): T { | |
val networkStatusTracker = NetworkStatusTracker(this@MainActivity) | |
return NetworkStatusViewModel(networkStatusTracker) as T | |
} |
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 Info(val text: String) | |
// Module | |
val bag = Kodein.Module("module name") { | |
bind<Info>() with provider { Info("Hello Kodein") } | |
} | |
// MainActivity | |
class MainActivity : AppCompatActivity(), KodeinAware { |
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 Info(val text: String) | |
// Module | |
val bag = Module { | |
singleton { Info("Hello Katana") } | |
} | |
// MainActivity | |
class MainActivity : AppCompatActivity() { |
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 Info(val text: String) | |
// Module | |
@Module | |
class Bag { | |
@Provides | |
fun sayHelloDagger2(): Info { | |
return Info("Hello Dagger 2") | |
} | |
} |
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 Info(val text: String) | |
// Module | |
val bag = module { | |
single { Info("Hello Koin") } | |
} | |
// MainActivity | |
class MainActivity : AppCompatActivity() { | |
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
// Reference taken from | |
// https://www.raywenderlich.com/262-dependency-injection-in-android-with-dagger-2-and-kotlin | |
class Parent { | |
private val child = Child() | |
} | |
class Parent(private val child: Child) |
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
// MainActivity.java | |
public class MainActivity extends AppCompactActivity{ | |
public static String extra_item_id = "some item id"; | |
public static boolean extra_wanna_show = true; | |
public static String getExtraItemId(){ | |
return extra_item_id; | |
} | |
public static boolean getExtraWannaShow(){ |
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
// MainActivity.java | |
private void onSomeItemSelected(Item item) { | |
Intent intent = new Intent(this, SomeAwesomeAndHyperRealisticDetailActivity.class); | |
intent.putExtra(SomeAwesomeAndHyperRealisticDetailActivity.EXTRA_ITEM_ID, "id"); | |
intent.putExtra(SomeAwesomeAndHyperRealisticDetailActivity.EXTRA_WANNA_SHOW, true); | |
startActivity(intent); | |
} | |
// SomeAwesomeAndHyperRealisticDetailActivity.java | |
public static String EXTRA_ITEM_ID = "EXTRA_ITEM_ID"; |
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
import android.content.Intent; | |
import android.os.Bundle; | |
import android.support.v7.app.AppCompatActivity; | |
import android.widget.Button; | |
import android.widget.EditText; | |
import butterknife.BindView; | |
import butterknife.ButterKnife; | |
import butterknife.OnClick; |
NewerOlder