// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov. // Jad home page: http://www.geocities.com/kpdus/jad.html // Decompiler options: braces fieldsfirst space lnc package com.oliodevices.assist.app.fragments; import android.content.res.Resources; import android.os.AsyncTask; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentActivity; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.ScrollView; import android.widget.Switch; import android.widget.TextView; import butterknife.ButterKnife; import com.jmedeisis.draglinearlayout.DragLinearLayout; import com.olio.data.object.assistant.CategoriesToIgnore; import com.olio.util.ALog; import com.oliodevices.assist.app.core.ServicesUtil; // Referenced classes of package com.oliodevices.assist.app.fragments: // BaseFragment, NotificationActionsFragment public class ServicesListFragment extends BaseFragment { private static final String ARG_IS_EDIT_MODE = "is_edit_mode"; private static final String ARG_TAB = "tab"; private static final String STATE_CATEGORIES_TO_IGNORE = "categories_to_ignore"; private static final String STATE_ITEMS_IN_CATEGORY = "items_in_category_%s"; private com.olio.communication.notifications.NotificationFilters.Category mCategories[]; private CategoriesToIgnore mCategoriesToIgnore; private AsyncTask mGetDataTask; private boolean mIsAlreadyLoaded; private boolean mIsEditMode; DragLinearLayout mMainView; ScrollView mScrollView; private int mTab; public ServicesListFragment() { mCategoriesToIgnore = (new CategoriesToIgnore()).getDefaultObject(); } private View createCategoryView(final com.olio.communication.notifications.NotificationFilters.Category category) { int i = 0; View view = LayoutInflater.from(getActivity()).inflate(0x7f030070, mMainView, false); View view1 = ButterKnife.findById(view, 0x7f0d01a6); TextView textview = (TextView)ButterKnife.findById(view, 0x7f0d0076); ImageView imageview = (ImageView)ButterKnife.findById(view, 0x7f0d0134); Switch switch1 = (Switch)ButterKnife.findById(view, 0x7f0d01a1); View view2 = ButterKnife.findById(view, 0x7f0d0187); textview.setText(ServicesUtil.getLabelForCategory(category)); imageview.setImageDrawable(getResources().getDrawable(ServicesUtil.getDrawableForCategory(category))); switch1.setChecked(ServicesUtil.isCategoryEnabled(mCategoriesToIgnore, category)); if (!mIsEditMode) { i = 8; } view2.setVisibility(i); view1.setOnClickListener(new android.view.View.OnClickListener() { final ServicesListFragment this$0; final com.olio.communication.notifications.NotificationFilters.Category val$category; public void onClick(View view3) { if (!mIsEditMode) { startFragment(NotificationActionsFragment.newInstance(category)); } } { this$0 = ServicesListFragment.this; category = category1; super(); } }); switch1.setVisibility(8); return view; } public static Fragment newInstance(int i, boolean flag) { ServicesListFragment serviceslistfragment = new ServicesListFragment(); Bundle bundle = new Bundle(); bundle.putInt("tab", i); bundle.putBoolean("is_edit_mode", flag); serviceslistfragment.setArguments(bundle); return serviceslistfragment; } private void populateMainView() { int i = 0; ALog.d("populateMainView", new Object[0]); if (mMainView.getChildCount() > 0) { mMainView.removeAllViews(); } com.olio.communication.notifications.NotificationFilters.Category acategory[] = mCategories; for (int j = acategory.length; i < j; i++) { View view = createCategoryView(acategory[i]); mMainView.addDragView(view, ButterKnife.findById(view, 0x7f0d0187)); } } private void refreshUI() { int k = mMainView.getChildCount(); int i = 0; while (i < k) { View view = ButterKnife.findById(mMainView.getChildAt(i), 0x7f0d0187); if (view != null) { int j; if (mIsEditMode) { j = 0; } else { j = 8; } view.setVisibility(j); } i++; } } private void retrieveDataItems() { ALog.v("retrieveDataItems", new Object[0]); mGetDataTask = (new AsyncTask() { final ServicesListFragment this$0; protected volatile Object doInBackground(Object aobj[]) { return doInBackground((Void[])aobj); } protected transient Void doInBackground(Void avoid[]) { if (isCancelled()) { return null; } else { ALog.v("doInBackground", new Object[0]); mCategoriesToIgnore = CategoriesToIgnore.get(getActivity().getContentResolver()); return null; } } protected volatile void onPostExecute(Object obj) { onPostExecute((Void)obj); } protected void onPostExecute(Void void1) { if (!isCancelled()) { ALog.v("onPostExecute", new Object[0]); if (isAdded()) { populateMainView(); return; } } } { this$0 = ServicesListFragment.this; super(); } }).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, new Void[0]); } public void onActivityCreated(Bundle bundle) { super.onActivityCreated(bundle); mTab; JVM INSTR tableswitch 1 3: default 36 // 1 87 // 2 97 // 3 107; goto _L1 _L2 _L3 _L4 _L1: break; /* Loop/switch isn't completed */ _L4: break MISSING_BLOCK_LABEL_107; _L5: mMainView.setContainerScrollView(mScrollView); mMainView.setOnViewSwapListener(new com.jmedeisis.draglinearlayout.DragLinearLayout.OnViewSwapListener() ); if (bundle == null && !mIsAlreadyLoaded) { retrieveDataItems(); } else if (bundle != null) { mCategoriesToIgnore = (CategoriesToIgnore)bundle.getParcelable("categories_to_ignore"); } populateMainView(); mIsAlreadyLoaded = true; return; _L2: mCategories = ServicesUtil.getOrderedEarlierCategories(); goto _L5 _L3: mCategories = ServicesUtil.getOrderedNowCategories(); goto _L5 mCategories = ServicesUtil.getOrderedLaterCategories(); goto _L5 } public void onCreate(Bundle bundle) { super.onCreate(bundle); bundle = getArguments(); mTab = bundle.getInt("tab"); mIsEditMode = bundle.getBoolean("is_edit_mode"); } public View onCreateView(LayoutInflater layoutinflater, ViewGroup viewgroup, Bundle bundle) { layoutinflater = layoutinflater.inflate(0x7f030044, viewgroup, false); ButterKnife.inject(this, layoutinflater); return layoutinflater; } public void onDetach() { if (mGetDataTask != null) { mGetDataTask.cancel(true); } super.onDetach(); } public void onSaveInstanceState(Bundle bundle) { super.onSaveInstanceState(bundle); com.olio.communication.notifications.NotificationFilters.Category acategory[] = mCategories; int j = acategory.length; for (int i = 0; i < j; i++) { com.olio.communication.notifications.NotificationFilters.Category category = acategory[i]; bundle.putParcelable("categories_to_ignore", mCategoriesToIgnore); } } public void setEditMode(boolean flag) { mIsEditMode = flag; refreshUI(); } /* static CategoriesToIgnore access$202(ServicesListFragment serviceslistfragment, CategoriesToIgnore categoriestoignore) { serviceslistfragment.mCategoriesToIgnore = categoriestoignore; return categoriestoignore; } */ }