APK反编译源代码展示 - 南明离火平台提供

应用版本信息
应用名称:aodNotify
版本号:1.28
包名称:com.jamworks.aodnotificationledlight

MD5 校验值:27813ceda3dbbdad9b1fe97c0bfbda12

反编译源代码说明

SeekBarPreferenceCustomDisabledCount.java 文件包含反编译后的源代码,请注意,该内容仅供学习和参考使用,不得用于非法用途。


package com.jamworks.aodnotificationledlight;

import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.TypedArray;
import android.preference.Preference;
import android.preference.PreferenceManager;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.SeekBar;
import android.widget.TextView;
import com.jamworks.aodnotificationledlight.OverlayService.R;

public class SeekBarPreferenceCustomDisabledCount extends Preference implements SeekBar.OnSeekBarChangeListener {

    private final String f6162b;

    private int f6163c;

    private int f6164d;

    private int f6165e;

    private int f6166f;

    private String f6167g;

    private String f6168h;

    private SeekBar f6169i;

    boolean f6170j;

    private TextView f6171k;

    SharedPreferences.Editor f6172l;

    SharedPreferences f6173m;

    Context f6174n;

    int[] f6175o;

    TextView f6176p;

    TextView f6177q;

    public SeekBarPreferenceCustomDisabledCount(Context context, AttributeSet attributeSet) {
        super(context, attributeSet);
        this.f6162b = getClass().getName();
        this.f6163c = 100;
        this.f6164d = 0;
        this.f6165e = 1;
        this.f6167g = "";
        this.f6168h = "";
        this.f6170j = false;
        this.f6175o = new int[]{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30, 45, 60, 80, 100, 150, 200, 999};
        g(context, attributeSet);
    }

    private String f(AttributeSet attributeSet, String str, String str2, String str3) {
        String attributeValue = attributeSet.getAttributeValue(str, str2);
        if (attributeValue != null) {
            str3 = attributeValue;
        }
        if (str3.length() > 1 && str3.charAt(0) == '@' && str3.contains("@string/")) {
            throw null;
        }
        return str3;
    }

    private void g(Context context, AttributeSet attributeSet) {
        this.f6174n = context;
        h(attributeSet);
        SeekBar seekBar = new SeekBar(context, attributeSet);
        this.f6169i = seekBar;
        seekBar.setMax(this.f6163c - this.f6164d);
        this.f6169i.setOnSeekBarChangeListener(this);
        SharedPreferences defaultSharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
        this.f6173m = defaultSharedPreferences;
        this.f6172l = defaultSharedPreferences.edit();
        setWidgetLayoutResource(R.layout.seek_bar_preference_time);
    }

    private void h(AttributeSet attributeSet) {
        this.f6163c = attributeSet.getAttributeIntValue("http://schemas.android.com/apk/res/android", "max", 100);
        this.f6164d = attributeSet.getAttributeIntValue("http://jamworks.com", "min", 0);
        this.f6167g = f(attributeSet, "http://jamworks.com", "unitsLeft", "");
        this.f6168h = f(attributeSet, "http://jamworks.com", "unitsRight", f(attributeSet, "http://jamworks.com", "units", ""));
        try {
            String attributeValue = attributeSet.getAttributeValue("http://jamworks.com", "interval");
            if (attributeValue != null) {
                this.f6165e = Integer.parseInt(attributeValue);
            }
        } catch (Exception e2) {
            Log.e(this.f6162b, "value", e2);
        }
    }

    public void c(int i2) {
        if (i2 == 0) {
            this.f6171k.setText(this.f6174n.getText(R.string.pref_disabled));
            this.f6177q.setText("");
        } else if (i2 == 21) {
            this.f6171k.setText(this.f6174n.getText(R.string.pref_dynamic));
            this.f6177q.setText("");
        } else {
            this.f6171k.setText(String.valueOf(this.f6175o[i2]));
            this.f6177q.setText("x");
        }
    }

    protected void i(View view) {
        try {
            this.f6171k = (TextView) view.findViewById(R.id.seekBarPrefValue);
            TextView textView = (TextView) view.findViewById(R.id.seekBarPrefUnitsRight);
            this.f6177q = textView;
            textView.setText(this.f6168h);
            TextView textView2 = (TextView) view.findViewById(R.id.seekBarPrefUnitsLeft);
            this.f6176p = textView2;
            textView2.setText(this.f6167g);
            this.f6171k.setText(String.valueOf(this.f6166f));
            this.f6171k.setMinimumWidth(30);
            this.f6169i.setProgress(this.f6166f - this.f6164d);
            c(this.f6166f);
        } catch (Exception e2) {
            Log.e(this.f6162b, "Error updating seek bar preference", e2);
        }
    }

    @Override
    public void onBindView(View view) {
        super.onBindView(view);
        if (view != null) {
            SeekBar seekBar = (SeekBar) view.findViewById(R.id.seekBarPrefSeekBar);
            this.f6169i = seekBar;
            seekBar.setMax(this.f6163c - this.f6164d);
            this.f6169i.setOnSeekBarChangeListener(this);
        }
        i(view);
    }

    @Override
    protected View onCreateView(ViewGroup viewGroup) {
        View onCreateView = super.onCreateView(viewGroup);
        ((LinearLayout) onCreateView).setOrientation(0);
        return onCreateView;
    }

    @Override
    public void onDependencyChanged(Preference preference, boolean z2) {
        super.onDependencyChanged(preference, z2);
        SeekBar seekBar = this.f6169i;
        if (seekBar != null) {
            seekBar.setEnabled(!z2);
        }
    }

    @Override
    protected Object onGetDefaultValue(TypedArray typedArray, int i2) {
        return Integer.valueOf(typedArray.getInt(i2, 50));
    }

    @Override
    public void onProgressChanged(SeekBar seekBar, int i2, boolean z2) {
        int i3 = this.f6164d;
        int i4 = i2 + i3;
        int i5 = this.f6163c;
        if (i4 > i5) {
            i3 = i5;
        } else if (i4 >= i3) {
            int i6 = this.f6165e;
            if (i6 != 1 && i4 % i6 != 0) {
                i3 = this.f6165e * Math.round(i4 / i6);
                i4 = this.f6163c;
                if (i3 <= i4) {
                    i4 = this.f6164d;
                }
            }
            i3 = i4;
        }
        if (!callChangeListener(Integer.valueOf(i3))) {
            seekBar.setProgress(this.f6166f - this.f6164d);
        } else {
            this.f6166f = i3;
            c(i3);
        }
    }

    @Override
    protected void onSetInitialValue(boolean z2, Object obj) {
        int i2;
        if (z2) {
            this.f6166f = getPersistedInt(this.f6166f);
            return;
        }
        try {
            i2 = ((Integer) obj).intValue();
        } catch (Exception unused) {
            Log.e(this.f6162b, "Invalid default value: " + obj.toString());
            i2 = 0;
        }
        persistInt(i2);
        this.f6166f = i2;
    }

    @Override
    public void onStartTrackingTouch(SeekBar seekBar) {
    }

    @Override
    public void onStopTrackingTouch(SeekBar seekBar) {
        persistInt(this.f6166f);
        this.f6172l.putInt(getKey() + "Count", this.f6175o[this.f6166f]);
        this.f6172l.apply();
        notifyChanged();
    }

    @Override
    public void setEnabled(boolean z2) {
        super.setEnabled(z2);
        this.f6169i.setEnabled(z2);
    }

    public SeekBarPreferenceCustomDisabledCount(Context context, AttributeSet attributeSet, int i2) {
        super(context, attributeSet, i2);
        this.f6162b = getClass().getName();
        this.f6163c = 100;
        this.f6164d = 0;
        this.f6165e = 1;
        this.f6167g = "";
        this.f6168h = "";
        this.f6170j = false;
        this.f6175o = new int[]{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30, 45, 60, 80, 100, 150, 200, 999};
        g(context, attributeSet);
    }
}