Skip to content

Instantly share code, notes, and snippets.

View furkanaskin's full-sized avatar

faskN furkanaskin

View GitHub Profile
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
progressbar.visibility = View.VISIBLE
rv_photos.layoutManager = LinearLayoutManager(this)
rv_photos.adapter = PhotosAdapter(ArrayList())
override fun setMenuVisibility(menuVisible: Boolean) {
super.setMenuVisibility(menuVisible)
if (menuVisible){
// This routes the system back button to this Fragment
requireFragmentManager().beginTransaction()
.setPrimaryNavigationFragment(this)
.commit()
}
}
fun nonInlined(block: () -> Unit) {
println("before")
block()
println("after")
}
public void nonInlined(Function block) {
System.out.println("before");
block.invoke();
System.out.println("after");
}
nonInlined {
println("do something here")
}
nonInlined(new Function() {
@Override
public void invoke() {
System.out.println("do something here");
}
});
inline fun inlined(block: () -> Unit) {
println("before")
block()
println("after")
}
inlined {
println("do something here")
}
System.out.println("before");
System.out.println("do something here");
System.out.println("after");
public void doSomething() {
System.out.print("doSomething start");
System.out.print("doSomethingElse");
}