<commit_before>package cz.helmisek.android.androidrxvipersample.core.viewmodel;

import android.content.Context;
import android.databinding.Bindable;
import android.databinding.ObservableField;

import com.android.databinding.library.baseAdapters.BR;

import cz.helmisek.android.androidrxviper.core.viewmodel.ViewModel;
import cz.helmisek.android.androidrxvipersample.core.entity.api.CurrentWeatherEntity;
import cz.helmisek.android.androidrxvipersample.core.interactor.WeatherInteractor;
import cz.helmisek.android.androidrxvipersample.databinding.ActivityWeatherBinding;
import cz.kinst.jakub.view.StatefulLayout;
import retrofit2.Response;
import rx.functions.Action1;


/**
 * Created by <NAME> on 11.10.16.
 */

public class WeatherActivityViewModel extends ViewModel<WeatherInteractor, ActivityWeatherBinding>
{

	public final ObservableField<StatefulLayout.State> state = new ObservableField<>(StatefulLayout.State.CONTENT);

	private CurrentWeatherEntity mCurrentWeatherEntity;


	public WeatherActivityViewModel(Context context)
	{
		super(context);
	}


	@Override
	public WeatherInteractor initInteractor(Context context)
	{
		return new WeatherInteractor(context);
	}


	@Override
	public void subscribe()
	{
		prepareWeatherInformation();
	}


	@Override
	public void unsubscribe()
	{
	}


	private void prepareWeatherInformation()
	{
		getInteractor().loadCurrentWeather("london").subscribe(new Action1<Response<CurrentWeatherEntity>>()
		{
			@Override
			public void call(Response<CurrentWeatherEntity> currentWeatherEntityResponse)
			{
				if(currentWeatherEntityResponse.isSuccessful())
				{
					setCurrentWeatherEntity(currentWeatherEntityResponse.body());
					state.set(StatefulLayout.State.CONTENT);
				}
				else
				{
					state.set(StatefulLayout.State.EMPTY);
				}
			}
		});
	}


	@Bindable
	public CurrentWeatherEntity getCurrentWeatherEntity()
	{
		return this.mCurrentWeatherEntity;<commit_msg>comments update<commit_after>package cz.helmisek.android.androidrxvipersample.core.viewmodel;

import android.content.Context;
import android.databinding.Bindable;
import android.databinding.ObservableField;

import com.android.databinding.library.baseAdapters.BR;

import cz.helmisek.android.androidrxviper.core.viewmodel.ViewModel;
import cz.helmisek.android.androidrxvipersample.core.entity.api.CurrentWeatherEntity;
import cz.helmisek.android.androidrxvipersample.core.interactor.WeatherInteractor;
import cz.helmisek.android.androidrxvipersample.databinding.ActivityWeatherBinding;
import cz.kinst.jakub.view.StatefulLayout;
import retrofit2.Response;
import rx.functions.Action1;


/**
 * Created by <NAME> on 11.10.16.
 */

public class WeatherActivityViewModel extends ViewModel<WeatherInteractor, ActivityWeatherBinding>
{

	public final ObservableField<StatefulLayout.State> state = new ObservableField<>(StatefulLayout.State.CONTENT);

	private CurrentWeatherEntity mCurrentWeatherEntity;


	public WeatherActivityViewModel(Context context)
	{
		super(context);
	}


	@Override
	public WeatherInteractor initInteractor(Context context)
	{
		return new WeatherInteractor(context);
	}


	@Override
	public void subscribe()
	{
		prepareWeatherInformation();
	}


	@Override
	public void unsubscribe()
	{
	}


	private void prepareWeatherInformation()
	{
		getInteractor().loadCurrentWeather("london").subscribe(new Action1<Response<CurrentWeatherEntity>>()
		{
			@Override
			public void call(Response<CurrentWeatherEntity> currentWeatherEntityResponse)
			{
				if(currentWeatherEntityResponse.isSuccessful())
				{
					setCurrentWeatherEntity(currentWeatherEntityResponse.body());
					state.set(StatefulLayout.State.CONTENT);
				}
				else
				{
					state.set(StatefulLayout.State.EMPTY);
				}
			}
		});
	}


	/* ---- Binding related ---- */


	@Bindable
	public CurrentWeatherEntity getCurrentWeatherEntity()
	{
		return this.mCurrentWeatherEntity;
{'fraction_non_alphanumeric': 0.09550706033376123, 'fraction_numerical': 0.004621309370988447, 'mean_word_length': 5.592216582064298, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3234436', 'n_tokens_mistral': 1321, 'n_tokens_neox': 1156, 'n_words': 174}