// Path: app/src/main/java/com/antest1/kcanotify/DropLogActivity.java
// public static String convertMillsToDate(long timestamp) {
//     Date d = new Date(timestamp);
//     SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd", Locale.US);
//     return dateFormat.format(d);
// }
// 
// Path: app/src/main/java/com/antest1/kcanotify/KcaConstants.java
// public static final String ERROR_TYPE_RESLOG = "RL";
// 
// Path: app/src/main/java/com/antest1/kcanotify/KcaConstants.java
// public static final int KCANOTIFY_DB_VERSION = 5;
// 
// Path: app/src/main/java/com/antest1/kcanotify/KcaConstants.java
// public static final int KCANOTIFY_RESOURCELOG_VERSION = 1;


import android.app.DatePickerDialog;
import android.content.DialogInterface;
import android.graphics.PorterDuff;
import android.os.AsyncTask;
import android.os.Bundle;
import com.google.android.material.tabs.TabLayout;
import androidx.core.content.ContextCompat;
import androidx.viewpager.widget.ViewPager;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
import com.google.gson.JsonObject;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import static com.antest1.kcanotify.DropLogActivity.convertMillsToDate;
import static com.antest1.kcanotify.KcaConstants.ERROR_TYPE_RESLOG;
import static com.antest1.kcanotify.KcaConstants.KCANOTIFY_DB_VERSION;
import static com.antest1.kcanotify.KcaConstants.KCANOTIFY_RESOURCELOG_VERSION;
    TextView interval_d, interval_w, interval_m;
    TextView export_msg;
    Spinner interval_select;
    ImageView showhide_btn;
    int tab_position = 0;
    long start_timestamp, end_timestamp;

    public int interval_value = INTERVAL_1D;

    public ResourceLogActivity() {
        LocaleUtils.updateConfig(this);
    }

    public static boolean getChartHiddenState() {
        return is_hidden;
    }

    private String getStringWithLocale(int id) {
        return KcaUtils.getStringWithLocale(getApplicationContext(), getBaseContext(), id);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_resourcelog);
        toolbar = findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);
        getSupportActionBar().setTitle(getStringWithLocale(R.string.action_reslog));
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);

// Path: app/src/main/java/com/antest1/kcanotify/DropLogActivity.java
// public static String convertMillsToDate(long timestamp) {
//     Date d = new Date(timestamp);
//     SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd", Locale.US);
//     return dateFormat.format(d);
// }
// 
// Path: app/src/main/java/com/antest1/kcanotify/KcaConstants.java
// public static final String ERROR_TYPE_RESLOG = "RL";
// 
// Path: app/src/main/java/com/antest1/kcanotify/KcaConstants.java
// public static final int KCANOTIFY_DB_VERSION = 5;
// 
// Path: app/src/main/java/com/antest1/kcanotify/KcaConstants.java
// public static final int KCANOTIFY_RESOURCELOG_VERSION = 1;


// Path: app/src/main/java/com/antest1/kcanotify/ResourceLogActivity.java
import android.app.DatePickerDialog;
import android.content.DialogInterface;
import android.graphics.PorterDuff;
import android.os.AsyncTask;
import android.os.Bundle;
import com.google.android.material.tabs.TabLayout;
import androidx.core.content.ContextCompat;
import androidx.viewpager.widget.ViewPager;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
import com.google.gson.JsonObject;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import static com.antest1.kcanotify.DropLogActivity.convertMillsToDate;
import static com.antest1.kcanotify.KcaConstants.ERROR_TYPE_RESLOG;
import static com.antest1.kcanotify.KcaConstants.KCANOTIFY_DB_VERSION;
import static com.antest1.kcanotify.KcaConstants.KCANOTIFY_RESOURCELOG_VERSION;

    TextView interval_d, interval_w, interval_m;
    TextView export_msg;
    Spinner interval_select;
    ImageView showhide_btn;
    int tab_position = 0;
    long start_timestamp, end_timestamp;

    public int interval_value = INTERVAL_1D;

    public ResourceLogActivity() {
        LocaleUtils.updateConfig(this);
    }

    public static boolean getChartHiddenState() {
        return is_hidden;
    }

    private String getStringWithLocale(int id) {
        return KcaUtils.getStringWithLocale(getApplicationContext(), getBaseContext(), id);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_resourcelog);
        toolbar = findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);
        getSupportActionBar().setTitle(getStringWithLocale(R.string.action_reslog));
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);

        dbHelper = new KcaDBHelper(getApplicationContext(), null, KCANOTIFY_DB_VERSION);