<commit_before>package yuku.alkitab.base.ac;

import android.app.Activity;
import android.os.Bundle;
import android.text.SpannableStringBuilder;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.TextView;
import yuku.afw.App;
import yuku.afw.V;
import yuku.afw.widget.EasyAdapter;
import yuku.alkitab.base.S;
import yuku.alkitab.base.model.Ari;
import yuku.alkitab.base.model.ReadingPlan;
import yuku.alkitab.base.model.Version;
import yuku.alkitab.base.util.ReadingPlanManager;
import yuku.alkitab.debug.R;

import java.io.InputStream;

public class ReadingPlanActivity extends Activity {

	private ReadingPlan readingPlan;
	private int dayNumber;

	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		setContentView(R.layout.activity_reading_plan);
		ListView lsTodayReadings = V.get(this, R.id.lsTodayReadings);
		ListView lsDailyPlan = V.get(this, R.id.lsDailyPlan);


		loadDayNumber();
		loadReadingPlan();

		TodayReadingsAdapter todayReadingsAdapter = new TodayReadingsAdapter();
		todayReadingsAdapter.load();
		lsTodayReadings.setAdapter(todayReadingsAdapter);

		DailyPlanAdapter dailyPlanAdapter = new DailyPlanAdapter();
		lsDailyPlan.setAdapter(dailyPlanAdapter);

		setListViewHeightBasedOnChildren(lsTodayReadings);
		setListViewHeightBasedOnChildren(lsDailyPlan);

	}

	private void loadDayNumber() {
		//TODO: proper method. Testing only
		dayNumber = 0;
	}

	private void loadReadingPlan() {
		//TODO: proper method. Testing only
		InputStream is = App.context.getResources().openRawResource(R.raw.wsts);
		ReadingPlan res = ReadingPlanManager.readVersion1(is);

		readingPlan = res;
	}<commit_msg>nav button left and right are now usable.<commit_after>package yuku.alkitab.base.ac;

import android.app.Activity;
import android.os.Bundle;
import android.text.SpannableStringBuilder;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageButton;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.TextView;
import yuku.afw.App;
import yuku.afw.V;
import yuku.afw.widget.EasyAdapter;
import yuku.alkitab.base.S;
import yuku.alkitab.base.model.Ari;
import yuku.alkitab.base.model.ReadingPlan;
import yuku.alkitab.base.model.Version;
import yuku.alkitab.base.util.ReadingPlanManager;
import yuku.alkitab.debug.R;

import java.io.InputStream;

public class ReadingPlanActivity extends Activity {

	private ReadingPlan readingPlan;
	private int dayNumber;
	private TodayReadingsAdapter todayReadingsAdapter;
	private ImageButton bLeft;
	private ImageButton bRight;

	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		setContentView(R.layout.activity_reading_plan);
		ListView lsTodayReadings = V.get(this, R.id.lsTodayReadings);
		ListView lsDailyPlan = V.get(this, R.id.lsDailyPlan);

		loadDayNumber();
		loadReadingPlan();

		//List view
		todayReadingsAdapter = new TodayReadingsAdapter();
		todayReadingsAdapter.load();
		lsTodayReadings.setAdapter(todayReadingsAdapter);

		final DailyPlanAdapter dailyPlanAdapter = new DailyPlanAdapter();
		lsDailyPlan.setAdapter(dailyPlanAdapter);

		setListViewHeightBasedOnChildren(lsTodayReadings);
		setListViewHeightBasedOnChildren(lsDailyPlan);

		//button
		bLeft = V.get(this, R.id.bLeft);
		bRight = V.get(this, R.id.bRight);

		updateButtonStatus();

		bLeft.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(final View v) {
				changeDay(-1);
			}
		});

		bRight.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(final View v) {
				changeDay(+1);
			}
		});

	}

	private void changeDay(int day) {
		dayNumber += day;
		todayReadingsAdapter.load();
		todayReadingsAdapter.notifyDataSetChanged();

		updateButtonStatus();
	}

	private void updateButtonStatus() {            //TODO look disabled
		if (dayNumber == 0) {
			bLeft.setEnabled(false);
			bRight.setEnabled(true);
		} else if (dayNumber == readingPlan.duration - 1) {
			bLeft.setEnabled(true);
			bRight.setEnabled(false);
		} else {
			bLeft.setEnabled(true);
			bRight.setEnabled(true);
		}
	}

	private void loadDayNumber() {
		//TODO: proper method. Testing only
		dayNumber = 0;
	}

	private void loadReadingPlan() {
		//TODO: proper method. Testing only
		InputStream is = App.context.getResources().openRawResource(R.raw.wsts);
		ReadingPlan res = ReadingPlanManager.readVersion1(is);

		readingPlan = res;
	}
{'fraction_non_alphanumeric': 0.10418927718688951, 'fraction_numerical': 0.0017364879531148252, 'mean_word_length': 5.168674698795181, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4150590', 'n_tokens_mistral': 1641, 'n_tokens_neox': 1427, 'n_words': 288}