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
<layout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:tools="http://schemas.android.com/tools"> | |
<data> | |
<variable | |
name="event" | |
type="com.vsay.demo.mvpdatabinding.models.Event" /> | |
</data> |
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
@Override | |
public void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
ActivityDetailBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_detail); | |
//This is just initalize the mEvent instance | |
mEvent = new Gson().fromJson(getIntent().getStringExtra(Constants.EVENT_EXTRA), Event.class); | |
binding.setEvent(mEvent); | |
} |
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 EventHandler { | |
public Context mContext; | |
public EventHandler(Context context) { | |
this.mContext = context; | |
} | |
public void onEventClicked(View circleImageView, Event event) { | |
if (mContext != null) { | |
Intent intent = new Intent(mContext, DetailActivity.class); |
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 ImageBinder { | |
private ImageBinder() { | |
//NO-OP | |
} | |
@BindingAdapter({"imageURL"}) | |
public static void loadImage(ImageView view, String imageUrl) { | |
Picasso.with(view.getContext()) | |
.load(imageUrl) |
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
@Override | |
public FeedViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { | |
FeedItemBinding viewDataBinding = DataBindingUtil.inflate(LayoutInflater.from(parent.getContext()), R.layout.feed_item, parent, false); | |
return new FeedViewHolder(viewDataBinding); | |
} | |
@Override | |
public void onBindViewHolder(final FeedViewHolder holder, int position) { | |
holder.feedItemBinding.setEvent(events.get(position)); | |
holder.feedItemBinding.setEventHandler(mEventHandler); |
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
<TextView | |
android:id="@+id/locationLine" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:text="@{@string/locationLine(event.locationLine1, event.locationLine2)}" | |
android:textSize="@dimen/text_normal" | |
android:textStyle="bold" /> |
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
<layout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto"> | |
<data> | |
<variable | |
name="event" | |
type="com.vsay.demo.mvpdatabinding.models.Event" /> | |
</data> | |
<de.hdodenhof.circleimageview.CircleImageView | |
android:id="@+id/imageURL" | |
android:layout_width="@dimen/circle_img_dimen" |
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
<layout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto"> | |
<data> | |
<variable | |
name="event" | |
type="com.vsay.demo.mvpdatabinding.models.Event" /> | |
<variable | |
name="eventHandler" |
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 com.template.test.testmvptemplate; // your application package | |
import android.support.v7.app.AppCompatActivity; | |
public abstract class BaseActivity extends AppCompatActivity { | |
// TODO: add any relevance methods | |
} |
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 com.template.test.testmvptemplate; // your application package | |
import android.support.v4.app.Fragment; | |
public class BaseFragment extends Fragment { | |
// TODO: add any relevance methods | |
} |
OlderNewer