<commit_before>package com.itachi1706.cheesecakeutilities.Modules.ORDCountdown;

import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.TextView;

import com.github.lzyzsd.circleprogress.ArcProgress;
import com.itachi1706.cheesecakeutilities.BaseActivity;
import com.itachi1706.cheesecakeutilities.R;
import com.itachi1706.cheesecakeutilities.RecyclerAdapters.StringRecyclerAdapter;

import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import java.util.concurrent.TimeUnit;

public class ORDActivity extends BaseActivity {

    RecyclerView recyclerView;
    TextView ordCounter, ordDaysLabel, ordProgress;
    ArcProgress progressBar;
    long ordDays, ptpDays, popDays;

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

        recyclerView = (RecyclerView) findViewById(R.id.ord_recycler_view);
        ordDaysLabel = (TextView) findViewById(R.id.ord_days_counter);
        ordCounter = (TextView) findViewById(R.id.ord_counter);
        ordProgress = (TextView) findViewById(R.id.ord_precentage);
        progressBar = (ArcProgress)  findViewById(R.id.ord_progressbar);
    }

    @Override
    protected void onResume() {
        super.onResume();
        if (recyclerView != null) {
            recyclerView.setHasFixedSize(true);
            LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
            linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
            recyclerView.setLayoutManager(linearLayoutManager);
            recyclerView.setItemAnimator(new DefaultItemAnimator());

            // Set up layout
            SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this);
            long ord = sp.getLong(ORDSettingsActivity.SP_ORD, 0);
            long ptp = sp.getLong(ORDSettingsActivity.SP_PTP, 0);
            long pop = sp.getLong(ORDSettingsActivity.SP_POP, 0);
            long enlist = sp.getLong(ORDSettingsActivity.SP_ENLIST, 0);
            long currentTime = System.currentTimeMillis();
            List<String> menuItems = new ArrayList<>();
            if (ptp != 0) {
                // Normal Batch
                if (currentTime > ptp) {
                    menuItems.add("PTP Phase Ended"); // PTP LOH
                } else {
                    long duration = ptp - currentTime;
                    ptpDays = TimeUnit.MILLISECONDS.toDays(duration) + 1;
                    menuItems.add(getResources().getQuantityString(R.plurals.ord_days_countdown, (int) ptpDays, ptpDays, "Start of BMT Phase"));
                }
            }

            if (pop != 0) {
                if (currentTime > pop) {
                    menuItems.add("POP LOH"); // POP LOH
                } else {
                    long duration = pop - currentTime;
                    popDays = TimeUnit.MILLISECONDS.toDays(duration) + 1;
                    menuItems.add(getResources().getQuantityString(R.plurals.ord_days_countdown, (int) popDays, popDays, "POP"));
                }
            } else {
                menuItems.add("POP Date not defined. Please define in settings");
            }

            if (ord != 0) {
                if (currentTime > ord) {
                    // ORD LOH
                    ordDaysLabel.setText("LOH");
                    ordCounter.setText("ORD");
                    ordProgress.setText("100% Completed");
                    progressBar.setProgress(100);
                } else {
                    long duration = ord - currentTime;
                    ordDays = TimeUnit.MILLISECONDS.toDays(duration) + 1;
                    ordDaysLabel.setText(getResources().getQuantityString(R.plurals.ord_days, (int) ordDays));
                    ordCounter.setText(ordDays + "");

                    double difference = ((TimeUnit.MILLISECONDS.toDays(currentTime-enlist)) / (double)(TimeUnit.MILLISECONDS.toDays(ord - enlist))) * 100.0;
                    ordProgress.setText((Math.round(difference * 100.0)/100.0) + "% completed");
                    progressBar.setProgress((int)difference);

                    int weekends = calculateWeekends();
                    int weekdays = calculateWeekdays(weekends);
                    menuItems.add(weekdays + " Weekdays");
                    menuItems.add(weekends + " Weekends");
                }
            } else {
                menuItems.add("ORD Date not defined. Please define in settings");
            }


            StringRecyclerAdapter adapter = new StringRecyclerAdapter(menuItems);
            recyclerView.setAdapter(adapter);
        }
    }

    private int calculateWeekends() {
        if (ordDays == 0) return 0;
        int weekends = 0;<commit_msg>Made it such that toast does not appear when one of the options is clicked<commit_after>package com.itachi1706.cheesecakeutilities.Modules.ORDCountdown;

import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.TextView;

import com.github.lzyzsd.circleprogress.ArcProgress;
import com.itachi1706.cheesecakeutilities.BaseActivity;
import com.itachi1706.cheesecakeutilities.R;
import com.itachi1706.cheesecakeutilities.RecyclerAdapters.StringRecyclerAdapter;

import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import java.util.concurrent.TimeUnit;

public class ORDActivity extends BaseActivity {

    RecyclerView recyclerView;
    TextView ordCounter, ordDaysLabel, ordProgress;
    ArcProgress progressBar;
    long ordDays, ptpDays, popDays;

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

        recyclerView = (RecyclerView) findViewById(R.id.ord_recycler_view);
        ordDaysLabel = (TextView) findViewById(R.id.ord_days_counter);
        ordCounter = (TextView) findViewById(R.id.ord_counter);
        ordProgress = (TextView) findViewById(R.id.ord_precentage);
        progressBar = (ArcProgress)  findViewById(R.id.ord_progressbar);
    }

    @Override
    protected void onResume() {
        super.onResume();
        if (recyclerView != null) {
            recyclerView.setHasFixedSize(true);
            LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
            linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
            recyclerView.setLayoutManager(linearLayoutManager);
            recyclerView.setItemAnimator(new DefaultItemAnimator());

            // Set up layout
            SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this);
            long ord = sp.getLong(ORDSettingsActivity.SP_ORD, 0);
            long ptp = sp.getLong(ORDSettingsActivity.SP_PTP, 0);
            long pop = sp.getLong(ORDSettingsActivity.SP_POP, 0);
            long enlist = sp.getLong(ORDSettingsActivity.SP_ENLIST, 0);
            long currentTime = System.currentTimeMillis();
            List<String> menuItems = new ArrayList<>();
            if (ptp != 0) {
                // Normal Batch
                if (currentTime > ptp) {
                    menuItems.add("PTP Phase Ended"); // PTP LOH
                } else {
                    long duration = ptp - currentTime;
                    ptpDays = TimeUnit.MILLISECONDS.toDays(duration) + 1;
                    menuItems.add(getResources().getQuantityString(R.plurals.ord_days_countdown, (int) ptpDays, ptpDays, "Start of BMT Phase"));
                }
            }

            if (pop != 0) {
                if (currentTime > pop) {
                    menuItems.add("POP LOH"); // POP LOH
                } else {
                    long duration = pop - currentTime;
                    popDays = TimeUnit.MILLISECONDS.toDays(duration) + 1;
                    menuItems.add(getResources().getQuantityString(R.plurals.ord_days_countdown, (int) popDays, popDays, "POP"));
                }
            } else {
                menuItems.add("POP Date not defined. Please define in settings");
            }

            if (ord != 0) {
                if (currentTime > ord) {
                    // ORD LOH
                    ordDaysLabel.setText("LOH");
                    ordCounter.setText("ORD");
                    ordProgress.setText("100% Completed");
                    progressBar.setProgress(100);
                } else {
                    long duration = ord - currentTime;
                    ordDays = TimeUnit.MILLISECONDS.toDays(duration) + 1;
                    ordDaysLabel.setText(getResources().getQuantityString(R.plurals.ord_days, (int) ordDays));
                    ordCounter.setText(ordDays + "");

                    double difference = ((TimeUnit.MILLISECONDS.toDays(currentTime-enlist)) / (double)(TimeUnit.MILLISECONDS.toDays(ord - enlist))) * 100.0;
                    ordProgress.setText((Math.round(difference * 100.0)/100.0) + "% completed");
                    progressBar.setProgress((int)difference);

                    int weekends = calculateWeekends();
                    int weekdays = calculateWeekdays(weekends);
                    menuItems.add(weekdays + " Weekdays");
                    menuItems.add(weekends + " Weekends");
                }
            } else {
                menuItems.add("ORD Date not defined. Please define in settings");
            }


            StringRecyclerAdapter adapter = new StringRecyclerAdapter(menuItems, false);
            recyclerView.setAdapter(adapter);
        }
    }

    private int calculateWeekends() {
        if (ordDays == 0) return 0;
        int weekends = 0;
{'fraction_non_alphanumeric': 0.09662070304913575, 'fraction_numerical': 0.009710623422023694, 'mean_word_length': 2.234610552763819, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 13, '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': '6893806', 'n_tokens_mistral': 2978, 'n_tokens_neox': 2733, 'n_words': 522}