<commit_before>package com.bastienleonard.tomate.ui.breaktimer;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.os.SystemClock;
import android.support.annotation.IntDef;
import android.support.annotation.Nullable;
import android.widget.TextView;

import com.bastienleonard.tomate.BaseActivity;
import com.bastienleonard.tomate.R;
import com.bastienleonard.tomate.utils.SoundUtils;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.Locale;

public class BreakTimerActivity extends BaseActivity implements Handler.Callback {
    private static final String TAG = "BreakTimerActivity";
    private static final String EXTRA_BREAK_TYPE = "breakType";
    @Retention(RetentionPolicy.SOURCE)
    @IntDef({BREAK_TYPE_SHORT, BREAK_TYPE_LONG})
    public @interface BreakType {}
    public static final int BREAK_TYPE_SHORT = 0;
    public static final int BREAK_TYPE_LONG = 1;

    private static final int WHAT_UPDATE_TIMER = 1;
    private static final long REFRESH_DELAY = 500L;

    private static final String STATE_BREAK_TYPE = "breakType";
    private static final String STATE_RUNNING = "running";
    private static final String STATE_REMAINING_TIME = "remainingTime";
    private static final String STATE_LAST_TICK = "lastTick";

    private Handler mHandler;

    private int mBreakType;
    private boolean mRunning;
    private long mRemainingTime;
    private long mLastTick;

    private TextView mTime;

    public static void fillIntent(Intent intent, @BreakType int breakType) {
        intent.putExtra(EXTRA_BREAK_TYPE, breakType);
    }

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.timer_activity);
        setupToolbar();

        if (savedInstanceState == null) {
            mBreakType = getIntent().getIntExtra(EXTRA_BREAK_TYPE, -1);
            mRunning = true;

            switch (mBreakType) {
                case BREAK_TYPE_SHORT:
                    //mRemainingTime = 5 * 60 * 1000L;
                    mRemainingTime = 5 * 1000L;
                    break;
                case BREAK_TYPE_LONG:
                    mRemainingTime = 15 * 60 * 1000L;
                    break;
            }

            mLastTick = SystemClock.elapsedRealtime();
        } else {
            mBreakType = savedInstanceState.getInt(STATE_BREAK_TYPE);
            mRunning = savedInstanceState.getBoolean(STATE_RUNNING);
            mRemainingTime = savedInstanceState.getLong(STATE_REMAINING_TIME);
            mLastTick = savedInstanceState.getLong(STATE_LAST_TICK);
        }

        mTime = (TextView) findViewById(R.id.time);<commit_msg>Fix short break duration<commit_after>package com.bastienleonard.tomate.ui.breaktimer;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.os.SystemClock;
import android.support.annotation.IntDef;
import android.support.annotation.Nullable;
import android.widget.TextView;

import com.bastienleonard.tomate.BaseActivity;
import com.bastienleonard.tomate.R;
import com.bastienleonard.tomate.utils.SoundUtils;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.Locale;

public class BreakTimerActivity extends BaseActivity implements Handler.Callback {
    private static final String TAG = "BreakTimerActivity";
    private static final String EXTRA_BREAK_TYPE = "breakType";
    @Retention(RetentionPolicy.SOURCE)
    @IntDef({BREAK_TYPE_SHORT, BREAK_TYPE_LONG})
    public @interface BreakType {}
    public static final int BREAK_TYPE_SHORT = 0;
    public static final int BREAK_TYPE_LONG = 1;

    private static final int WHAT_UPDATE_TIMER = 1;
    private static final long REFRESH_DELAY = 500L;

    private static final String STATE_BREAK_TYPE = "breakType";
    private static final String STATE_RUNNING = "running";
    private static final String STATE_REMAINING_TIME = "remainingTime";
    private static final String STATE_LAST_TICK = "lastTick";

    private Handler mHandler;

    private int mBreakType;
    private boolean mRunning;
    private long mRemainingTime;
    private long mLastTick;

    private TextView mTime;

    public static void fillIntent(Intent intent, @BreakType int breakType) {
        intent.putExtra(EXTRA_BREAK_TYPE, breakType);
    }

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.timer_activity);
        setupToolbar();

        if (savedInstanceState == null) {
            mBreakType = getIntent().getIntExtra(EXTRA_BREAK_TYPE, -1);
            mRunning = true;

            switch (mBreakType) {
                case BREAK_TYPE_SHORT:
                    mRemainingTime = 5 * 60 * 1000L;
                    break;
                case BREAK_TYPE_LONG:
                    mRemainingTime = 15 * 60 * 1000L;
                    break;
            }

            mLastTick = SystemClock.elapsedRealtime();
        } else {
            mBreakType = savedInstanceState.getInt(STATE_BREAK_TYPE);
            mRunning = savedInstanceState.getBoolean(STATE_RUNNING);
            mRemainingTime = savedInstanceState.getLong(STATE_REMAINING_TIME);
            mLastTick = savedInstanceState.getLong(STATE_LAST_TICK);
        }

        mTime = (TextView) findViewById(R.id.time);
{'fraction_non_alphanumeric': 0.0754818951540263, 'fraction_numerical': 0.008827238335435058, 'mean_word_length': 3.115641215715345, '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': '5328825', 'n_tokens_mistral': 1653, 'n_tokens_neox': 1514, 'n_words': 361}