// 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_QTDB_VERSION = 3;
// 
// Path: app/src/main/java/com/antest1/kcanotify/KcaConstants.java
// public static final List<String> PREFS_BOOLEAN_LIST = Arrays.asList(PREF_BOOLEAN_ARRAY);
// 
// Path: app/src/main/java/com/antest1/kcanotify/KcaUtils.java
// public static Boolean getBooleanPreferences(Context ctx, String key) {
//     SharedPreferences pref = ctx.getSharedPreferences("pref", Context.MODE_PRIVATE);
//     return pref.getBoolean(key, false);
// }
// 
// Path: app/src/main/java/com/antest1/kcanotify/KcaUtils.java
// public static int getId(String resourceName, Class<?> c) {
//     try {
//         Field idField = c.getDeclaredField(resourceName);
//         return idField.getInt(idField);
//     } catch (Exception e) {
//         throw new RuntimeException("No resource ID found for: "
//                 + resourceName + " / " + c, e);
//     }
// }
// 
// Path: app/src/main/java/com/antest1/kcanotify/KcaUtils.java
// public static String getStringPreferences(Context ctx, String key) {
//     SharedPreferences pref = ctx.getSharedPreferences("pref", Context.MODE_PRIVATE);
//     try {
//         return String.valueOf(pref.getInt(key, 0));
//     } catch (Exception e) {
//         // Nothing to do
//     }
//     return pref.getString(key, "");
// }


import android.content.SharedPreferences;
import android.graphics.PorterDuff;
import android.os.Bundle;
import androidx.core.content.ContextCompat;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.widget.ImageView;
import android.widget.ScrollView;
import android.widget.TextView;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonElement;
import com.google.gson.JsonSyntaxException;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import static com.antest1.kcanotify.KcaConstants.KCANOTIFY_DB_VERSION;
import static com.antest1.kcanotify.KcaConstants.KCANOTIFY_QTDB_VERSION;
import static com.antest1.kcanotify.KcaConstants.PREFS_BOOLEAN_LIST;
import static com.antest1.kcanotify.KcaUtils.getBooleanPreferences;
import static com.antest1.kcanotify.KcaUtils.getId;
import static com.antest1.kcanotify.KcaUtils.getStringPreferences;
                        public boolean onTouch(View view, MotionEvent motionEvent) {
                            switch (motionEvent.getAction()) {
                                case MotionEvent.ACTION_DOWN:
                                    int y = (int) motionEvent.getY();
                                    int direction = 1;
                                    if (y < scroll_h_layout / 2) direction = -1;
                                    scroll_touch_count = 0;
                                    autoScrollScheduler = Executors.newSingleThreadScheduledExecutor();
                                    autoScrollScheduler.scheduleAtFixedRate(auto_scroll(direction), 800, 200, TimeUnit.MILLISECONDS);
                                    break;
                                case MotionEvent.ACTION_UP:
                                    autoScrollScheduler.shutdown();
                                    break;
                            }
                            return false;
                        }
                    });
                }
            });
        }
    }

    public void setText(String type_key) {
        if (type_key.startsWith(DB_PREFIX)) {
            value_text = dbHelper.getValue(key);
            if (value_text == null) value_text = "<null>";
        } else if (type_key.startsWith(PREF_PREFIX)) {
            if (PREFS_BOOLEAN_LIST.contains(key)) {
                value_text = String.valueOf(getBooleanPreferences(getApplicationContext(), key));
            } else {
// 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_QTDB_VERSION = 3;
// 
// Path: app/src/main/java/com/antest1/kcanotify/KcaConstants.java
// public static final List<String> PREFS_BOOLEAN_LIST = Arrays.asList(PREF_BOOLEAN_ARRAY);
// 
// Path: app/src/main/java/com/antest1/kcanotify/KcaUtils.java
// public static Boolean getBooleanPreferences(Context ctx, String key) {
//     SharedPreferences pref = ctx.getSharedPreferences("pref", Context.MODE_PRIVATE);
//     return pref.getBoolean(key, false);
// }
// 
// Path: app/src/main/java/com/antest1/kcanotify/KcaUtils.java
// public static int getId(String resourceName, Class<?> c) {
//     try {
//         Field idField = c.getDeclaredField(resourceName);
//         return idField.getInt(idField);
//     } catch (Exception e) {
//         throw new RuntimeException("No resource ID found for: "
//                 + resourceName + " / " + c, e);
//     }
// }
// 
// Path: app/src/main/java/com/antest1/kcanotify/KcaUtils.java
// public static String getStringPreferences(Context ctx, String key) {
//     SharedPreferences pref = ctx.getSharedPreferences("pref", Context.MODE_PRIVATE);
//     try {
//         return String.valueOf(pref.getInt(key, 0));
//     } catch (Exception e) {
//         // Nothing to do
//     }
//     return pref.getString(key, "");
// }


// Path: app/src/main/java/com/antest1/kcanotify/KcaInspectorDetailActivity.java
import android.content.SharedPreferences;
import android.graphics.PorterDuff;
import android.os.Bundle;
import androidx.core.content.ContextCompat;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.widget.ImageView;
import android.widget.ScrollView;
import android.widget.TextView;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonElement;
import com.google.gson.JsonSyntaxException;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import static com.antest1.kcanotify.KcaConstants.KCANOTIFY_DB_VERSION;
import static com.antest1.kcanotify.KcaConstants.KCANOTIFY_QTDB_VERSION;
import static com.antest1.kcanotify.KcaConstants.PREFS_BOOLEAN_LIST;
import static com.antest1.kcanotify.KcaUtils.getBooleanPreferences;
import static com.antest1.kcanotify.KcaUtils.getId;
import static com.antest1.kcanotify.KcaUtils.getStringPreferences;

                        public boolean onTouch(View view, MotionEvent motionEvent) {
                            switch (motionEvent.getAction()) {
                                case MotionEvent.ACTION_DOWN:
                                    int y = (int) motionEvent.getY();
                                    int direction = 1;
                                    if (y < scroll_h_layout / 2) direction = -1;
                                    scroll_touch_count = 0;
                                    autoScrollScheduler = Executors.newSingleThreadScheduledExecutor();
                                    autoScrollScheduler.scheduleAtFixedRate(auto_scroll(direction), 800, 200, TimeUnit.MILLISECONDS);
                                    break;
                                case MotionEvent.ACTION_UP:
                                    autoScrollScheduler.shutdown();
                                    break;
                            }
                            return false;
                        }
                    });
                }
            });
        }
    }

    public void setText(String type_key) {
        if (type_key.startsWith(DB_PREFIX)) {
            value_text = dbHelper.getValue(key);
            if (value_text == null) value_text = "<null>";
        } else if (type_key.startsWith(PREF_PREFIX)) {
            if (PREFS_BOOLEAN_LIST.contains(key)) {
                value_text = String.valueOf(getBooleanPreferences(getApplicationContext(), key));
            } else {
                value_text = getStringPreferences(getApplicationContext(), key);