Skip to content

Instantly share code, notes, and snippets.

View nikhilbansal97's full-sized avatar
:octocat:
Learning

Nikhil Bansal nikhilbansal97

:octocat:
Learning
View GitHub Profile
@nikhilbansal97
nikhilbansal97 / MainActivityModel.Kt
Created June 27, 2018 08:35
The model class for the SampleMVP project.
package com.example.nikhil.samplemvp.model
import com.example.nikhil.samplemvp.contract.ContractInterface.*
class MainActivityModel: Model {
private var mCounter = 0
override fun getCounter()= mCounter
@nikhilbansal97
nikhilbansal97 / MainActivityPresenter.Kt
Created June 27, 2018 08:17
The Presenter class for the SampleMVP Project
package com.example.nikhil.samplemvp.presenter
import com.example.nikhil.samplemvp.contract.ContractInterface.*
import com.example.nikhil.samplemvp.model.MainActivityModel
class MainActivityPresenter(_view: View): Presenter {
private var view: View = _view
private var model: Model = MainActivityModel()
@nikhilbansal97
nikhilbansal97 / MainActivity.Kt
Created June 27, 2018 07:29
The MainActivity for the view layer of the SampleMVP project
package com.example.nikhil.samplemvp.view
import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import com.example.nikhil.samplemvp.presenter.MainActivityPresenter
import com.example.nikhil.samplemvp.R
import com.example.nikhil.samplemvp.contract.ContractInterface.*
import kotlinx.android.synthetic.main.activity_main.*
class MainActivity : AppCompatActivity(), View {
@nikhilbansal97
nikhilbansal97 / ContractInterface.Kt
Created June 27, 2018 07:12
ContractInterface for Sample MVP
package com.example.nikhil.samplemvp.contract
interface ContractInterface {
interface View {
fun initView()
fun updateViewData()
}
interface Presenter {
@nikhilbansal97
nikhilbansal97 / MainActivity.java
Created December 29, 2017 04:40
Popular Movies
package com.example.nikhil.popularmovies;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.ListView;
import java.util.ArrayList;
public class MainActivity extends AppCompatActivity {
@nikhilbansal97
nikhilbansal97 / activity_main.xml
Created December 29, 2017 04:38
Popular Movies
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.nikhil.popularmovies.MainActivity">
<ListView
android:id="@+id/movies_list"
android:layout_width="match_parent"
package com.example.nikhil.popularmovies;
import android.content.Context;
import android.support.annotation.LayoutRes;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
package com.example.nikhil.popularmovies;
public class Movie {
// Store the id of the movie poster
private int mImageDrawable;
// Store the name of the movie
private String mName;
// Store the release date of the movie
private String mRelease;
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/imageView_poster"
android:layout_width="150dp"
android:layout_height="200dp"/>
<?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="com.example.nikhil.exoplayer.MainActivity">
<com.google.android.exoplayer2.ui.SimpleExoPlayerView
android:id="@+id/simpleExoPlayerView"