This file contains hidden or 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
| <?xml version="1.0" encoding="utf-8"?> | |
| <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
| xmlns:tools="http://schemas.android.com/tools" | |
| android:id="@+id/activity_main" | |
| android:layout_width="match_parent" | |
| android:layout_height="match_parent" | |
| android:paddingBottom="@dimen/activity_vertical_margin" | |
| android:paddingLeft="@dimen/activity_horizontal_margin" | |
| android:paddingRight="@dimen/activity_horizontal_margin" | |
| android:paddingTop="@dimen/activity_vertical_margin" |
This file contains hidden or 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
| public class MainActivity extends AppCompatActivity { | |
| @BindView(R.id.editTextHour) | |
| EditText editTextHour; | |
| @BindView(R.id.editTextMinute) | |
| EditText editTextMinute; | |
| @BindView(R.id.textViewOutput) | |
| TextView textViewOutput; |
This file contains hidden or 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
| <?xml version="1.0" encoding="utf-8"?> | |
| <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
| xmlns:app="http://schemas.android.com/apk/res-auto" | |
| xmlns:tools="http://schemas.android.com/tools" | |
| android:layout_width="match_parent" | |
| android:layout_height="match_parent" | |
| tools:context="co.prandroid.firstkotlin.MainActivity"> | |
| <EditText | |
| android:id="@+id/editTextValue" |
This file contains hidden or 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
| package co.prandroid.firstkotlin | |
| import android.support.v7.app.AppCompatActivity | |
| import android.os.Bundle | |
| import android.view.View | |
| import kotlinx.android.synthetic.main.activity_main.* | |
| class MainActivity : AppCompatActivity() { | |
| override fun onCreate(savedInstanceState: Bundle?) { |
This file contains hidden or 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
| <android.support.v7.widget.RecyclerView | |
| android:id="@+id/mRecyclerView" | |
| android:layout_width="match_parent" | |
| android:layout_height="wrap_content" | |
| android:layout_marginTop="64dp" | |
| app:layout_constraintLeft_toLeftOf="parent" | |
| app:layout_constraintRight_toRightOf="parent" | |
| app:layout_constraintHorizontal_bias="0.0" | |
| app:layout_constraintBottom_toBottomOf="parent" | |
| app:layout_constraintVertical_bias="0.09" |
This file contains hidden or 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
| package co.prandroid.recylerviewkotlin | |
| /** | |
| * Created by dharmakshetri on 6/24/17. | |
| */ | |
| class Movie (val url:String, val name: String, val year: Int?) |
This file contains hidden or 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
| package co.prandroid.recylerviewkotlin | |
| import android.content.Context | |
| import android.widget.Toast | |
| /** | |
| * Created by dharmakshetri on 6/24/17. | |
| */ | |
| object Utils { |
This file contains hidden or 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
| lass MovieAdapter(context: Context, val items: List<Movie>): RecyclerView.Adapter<MovieAdapter.MyViewHolder>(){ | |
| var c=context; | |
| override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MyViewHolder{ | |
| val v = LayoutInflater.from(parent.context) | |
| .inflate(R.layout.listitem, parent, false) | |
| return MyViewHolder(v) | |
| } |
This file contains hidden or 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
| mRecyclerView.layoutManager = LinearLayoutManager(this) | |
| mRecyclerView.addItemDecoration(SimpleDividerItemDecoration(this)) | |
| // specify an adapter (see also next example) | |
| mRecyclerView.adapter = MovieAdapter(applicationContext,Utils.getMovies()) | |
| } | |
| // choose the layout between Linear and Grid | |
| fun typeLayout(view: View){ |
This file contains hidden or 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
| val user1 = User("john", 12345) | |
| val user2 = User("john", 123451) | |
| val user3 = User("john", 12345) | |
| println("==") | |
| println(user1==user2) | |
| println(user1==user3) | |
| println(" euquals") | |
| println(user1.equals(user2)) |