正在查看: Tasker v6.5.11 应用的 DaySelect.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Tasker v6.5.11 应用的 DaySelect.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package net.dinglisch.android.taskerm;
import android.content.ComponentName;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.GridView;
import android.widget.ListAdapter;
import android.widget.Spinner;
import android.widget.SpinnerAdapter;
import android.widget.TextView;
import com.joaomgcd.taskerm.spawn.RFactory;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
public class DaySelect extends MyActivity implements View.OnClickListener, AdapterView.OnItemClickListener, AdapterView.OnItemSelectedListener {
private LayoutInflater A;
private Button B;
private Button C;
private Button D;
private w1 E;
private Spinner v;
private GridView x;
private a z;
private GridView[] w = new GridView[2];
private a[] y = new a[2];
public class a extends BaseAdapter {
int i;
int q;
boolean[] r;
class C0250a {
TextView a;
View b;
C0250a() {
}
}
public a(int i, Set<Integer> set) {
this.q = i;
if (i == 1) {
this.i = 7;
} else if (i == 0) {
this.i = 32;
} else {
this.i = 12;
}
this.r = new boolean[this.i];
if (set != null) {
Iterator<Integer> it = set.iterator();
while (it.hasNext()) {
int intValue = it.next().intValue();
if (i != 2) {
intValue--;
}
this.r[intValue] = true;
}
}
}
public Set<Integer> a() {
HashSet hashSet = new HashSet();
for (int i = 0; i < this.i; i++) {
if (this.r[i]) {
if (this.q == 2) {
hashSet.add(Integer.valueOf(i));
} else {
hashSet.add(Integer.valueOf(i + 1));
}
}
}
if (hashSet.size() == this.i) {
return null;
}
return hashSet;
}
public void b(int i, boolean z) {
this.r[i] = z;
}
public void c(int i) {
this.r[i] = !r0[i];
}
@Override
public final int getCount() {
return this.i;
}
@Override
public final Object getItem(int i) {
return new Integer(i + 1);
}
@Override
public final long getItemId(int i) {
return i + 1;
}
@Override
public View getView(int i, View view, ViewGroup viewGroup) {
C0250a c0250a;
if (view == null) {
view = DaySelect.this.A.inflate(2131493215, (ViewGroup) null);
c0250a = new C0250a();
c0250a.a = (TextView) view.findViewById(2131297590);
c0250a.b = view.findViewById(2131297321);
if (tp.e0()) {
up.v(view);
}
view.setTag(c0250a);
} else {
c0250a = (C0250a) view.getTag();
}
int i2 = this.q;
if (i2 == 1) {
c0250a.a.setText(w1.C[i]);
} else if (i2 == 0) {
c0250a.a.setText(i == 31 ? vh.g(DaySelect.this, 2131891189, new Object[0]) : Integer.toString(i + 1));
} else {
c0250a.a.setText(w1.B[i]);
}
c0250a.a.setBackgroundResource(tp.y(DaySelect.this, this.r[i]));
return view;
}
}
private boolean i0() {
Set<Integer> a2 = this.z.a();
Set<Integer> a3 = this.y[1].a();
Set<Integer> a4 = this.y[0].a();
boolean z = j0() == 1;
if (a2 == null || ((z && a3 == null) || (!z && a4 == null))) {
dq.a0(this, 2131887112, new Object[0]);
return false;
}
if (a2.size() != 0 || (!(z && a3.size() == 0) && (z || a4.size() != 0))) {
return true;
}
dq.a0(this, 2131887113, new Object[0]);
return false;
}
private int j0() {
return this.v.getSelectedItemPosition();
}
public static Intent k0(w1 w1Var) {
Intent intent = new Intent();
intent.setComponent(new ComponentName(th.B(), DaySelect.class.getName()));
if (w1Var != null) {
intent.putExtra("context", w1Var.U(0).c0());
}
return intent;
}
private void m0() {
Intent intent = new Intent();
Bundle bundle = new Bundle();
o0(bundle);
intent.putExtras(bundle);
setResult(-1, intent);
}
private void o0(Bundle bundle) {
l0();
bundle.putBundle("context", this.E.U(0).c0());
}
private void p0(boolean z) {
int j0 = j0();
for (int i = 0; i < this.y[j0].getCount(); i++) {
this.y[j0].b(i, z);
}
this.y[j0].notifyDataSetChanged();
}
private void q0(boolean z) {
int j0 = j0();
for (int i = 0; i < this.y[j0].getCount(); i++) {
this.y[j0].b(i, false);
}
while (z < this.y[j0].getCount()) {
this.y[j0].b(z, true);
z += 2;
}
this.y[j0].notifyDataSetChanged();
}
public w1 l0() {
this.E.m1(this.z.a(), this.y[1].a(), this.y[0].a());
return this.E;
}
public void n0() {
setContentView(2131493214);
Button button = (Button) findViewById(2131296541);
this.B = button;
button.setOnClickListener(this);
Button button2 = (Button) findViewById(2131296457);
this.C = button2;
button2.setOnClickListener(this);
Button button3 = (Button) findViewById(2131296542);
this.D = button3;
button3.setOnClickListener(this);
ArrayAdapter<String> f1 = dq.f1(this, RFactory.layout.icon_select_dialog);
Spinner spinner = (Spinner) findViewById(2131296809);
this.v = spinner;
spinner.setAdapter((SpinnerAdapter) f1);
this.v.setSelection(0, true);
this.v.setOnItemSelectedListener(this);
GridView gridView = (GridView) findViewById(2131297132);
this.x = gridView;
gridView.setOnItemClickListener(this);
this.w[1] = (GridView) findViewById(2131297698);
this.w[1].setOnItemClickListener(this);
this.w[0] = (GridView) findViewById(2131297131);
this.w[0].setOnItemClickListener(this);
if (tp.e0()) {
int w = tp.w(this, 2131165291);
this.x.setVerticalSpacing(w);
this.x.setHorizontalSpacing(w);
for (GridView gridView2 : this.w) {
gridView2.setVerticalSpacing(w);
gridView2.setHorizontalSpacing(w);
}
}
dq.M2(this, 2131297238, 2131889547);
dq.M2(this, 2131297710, 2131891202);
tp.a0(this, 2131297710, false);
tp.a0(this, 2131297238, false);
}
@Override
public void onBackPressed() {
if (i0()) {
m0();
finish();
}
}
@Override
public void onClick(View view) {
if (this.C.equals(view)) {
p0(true);
} else if (this.B.equals(view)) {
p0(false);
} else if (this.D.equals(view)) {
q0(false);
}
}
@Override
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
setResult(0);
this.A = LayoutInflater.from(this);
n0();
net.dinglisch.android.taskerm.a.T(this, true).setTitle(vh.g(this, 2131886723, new Object[0]));
if (bundle == null) {
bundle = getIntent().getExtras();
}
r0((bundle == null || !bundle.containsKey("context")) ? null : new w1(new qi(bundle.getBundle("context"))));
}
@Override
public void onDestroy() {
super.onDestroy();
this.v = null;
this.w = null;
this.x = null;
this.y = null;
this.z = null;
this.A = null;
this.B = null;
this.C = null;
this.D = null;
this.E = null;
}
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long j) {
GridView[] gridViewArr = this.w;
if (adapterView == gridViewArr[1]) {
this.y[1].c(i);
this.y[1].notifyDataSetInvalidated();
} else if (adapterView == gridViewArr[0]) {
this.y[0].c(i);
this.y[0].notifyDataSetInvalidated();
} else {
this.z.c(i);
this.z.notifyDataSetInvalidated();
}
adapterView.setSelection(i);
}
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long j) {
this.w[1 - i].setVisibility(4);
this.w[i].setVisibility(0);
this.y[i].notifyDataSetChanged();
}
@Override
public void onNothingSelected(AdapterView<?> adapterView) {
}
@Override
public boolean onOptionsItemSelected(MenuItem menuItem) {
int itemId = menuItem.getItemId();
if (itemId == 1) {
finish();
} else if (itemId == 16908332 && i0()) {
m0();
finish();
}
return true;
}
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
super.onPrepareOptionsMenu(menu);
menu.clear();
net.dinglisch.android.taskerm.a.d(this, 1, menu);
return true;
}
@Override
public void onSaveInstanceState(Bundle bundle) {
o0(bundle);
}
public void r0(w1 w1Var) {
if (w1Var == null) {
this.E = new w1();
} else {
this.E = w1Var;
}
a aVar = new a(2, this.E.c1());
this.z = aVar;
this.x.setAdapter((ListAdapter) aVar);
this.y[1] = new a(1, this.E.i1());
this.w[1].setAdapter((ListAdapter) this.y[1]);
this.y[0] = new a(0, this.E.b1());
this.w[0].setAdapter((ListAdapter) this.y[0]);
this.v.setSelection(this.E.i1().size() > 0 ? 1 : 0, true);
if (this.E.D0()) {
getActionBar().setSubtitle(this.E.getName());
}
}
}