// 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.animation.ValueAnimator; import android.app.Activity; import android.content.res.Configuration; import android.content.res.Resources; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentManager; import android.support.v4.widget.DrawerLayout; import android.support.v7.app.ActionBarDrawerToggle; import android.support.v7.widget.Toolbar; import android.util.SparseIntArray; import android.view.LayoutInflater; import android.view.MenuItem; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import butterknife.ButterKnife; import com.oliodevices.assist.app.activities.MainActivity; import com.oliodevices.assist.app.core.OlioApplication; import com.oliodevices.assist.app.events.NavigationOpenedEvent; import com.squareup.otto.Bus; import java.lang.annotation.Annotation; public class NavigationFragment extends Fragment { private class DrawerToggle extends ActionBarDrawerToggle { private float mLastOffset; private boolean mNeedsUpdate; private CharSequence mTitle; final NavigationFragment this$0; public void onDrawerClosed(View view) { super.onDrawerClosed(view); if (!mActivated && (getActivity() instanceof MainActivity)) { ((MainActivity)getActivity()).showTitle(); } mLastOffset = 0.0F; mNeedsUpdate = true; } public void onDrawerOpened(View view) { super.onDrawerOpened(view); mTitle = getActivity().getTitle(); if (getActivity() instanceof MainActivity) { ((MainActivity)getActivity()).hideTitle(); } mActivated = false; mNeedsUpdate = false; } public void onDrawerSlide(View view, float f) { super.onDrawerSlide(view, f); if (mLastOffset == 0.0F && f > 0.0F) { OlioApplication.getApplication().getBus().post(new NavigationOpenedEvent()); mLastOffset = f; } } public void onDrawerStateChanged(int i) { super.onDrawerStateChanged(i); if (i != 0 && mNeedsUpdate) { updateWatchLabel(); mNeedsUpdate = false; } } public void setDrawerSlide(float f) { super.onDrawerSlide(null, f); } public DrawerToggle(Activity activity, DrawerLayout drawerlayout, Toolbar toolbar, int i, int j) { this$0 = NavigationFragment.this; super(activity, drawerlayout, toolbar, i, j); mNeedsUpdate = true; } } public static interface MainActivityScreen extends Annotation { } public static interface NavigationCallbacks { public abstract void goToConfigScreen(int i); public abstract boolean isPaired(); public abstract void onBackPressed(); } static final boolean $assertionsDisabled; public static final int SCREEN_ABOUT = 8; public static final int SCREEN_INFO_ACCOUNT = 6; public static final int SCREEN_INFO_PERSONAL = 5; public static final int SCREEN_SERVICES_ACTIVITY = 2; public static final int SCREEN_SERVICES_RULES = 4; public static final int SCREEN_SERVICES_SETTINGS = 3; public static final int SCREEN_SERVICES_SUGGESTIONS = 1; public static final int SCREEN_SUPPORT = 7; public static final int SCREEN_WATCH_CONFIG = 0; public static final int SCREEN_WATCH_CONFIG_RETAIL = 9; static SparseIntArray mButtonsToScreenMap; boolean mActivated; private int mAnimDuration; NavigationCallbacks mCallbacks; View mContainerView; DrawerLayout mDrawerLayout; DrawerToggle mDrawerToggle; public NavigationFragment() { } private void addDebugOptions(View view) { view = (ViewGroup)ButterKnife.findById(view, 0x7f0d0129); } public void onActivityCreated(Bundle bundle) { super.onActivityCreated(bundle); setHasOptionsMenu(true); } public void onAttach(Activity activity) { super.onAttach(activity); if (activity instanceof NavigationCallbacks) { mCallbacks = (NavigationCallbacks)activity; return; } else { throw new ClassCastException(String.format("%s must implement NavigationCallbacks", new Object[] { activity.getClass() })); } } public void onConfigurationChanged(Configuration configuration) { super.onConfigurationChanged(configuration); mDrawerToggle.onConfigurationChanged(configuration); } public View onCreateView(LayoutInflater layoutinflater, ViewGroup viewgroup, Bundle bundle) { layoutinflater = layoutinflater.inflate(0x7f03003d, viewgroup, false); ButterKnife.inject(this, layoutinflater); mAnimDuration = getResources().getInteger(0x10e0001); return layoutinflater; } public void onDetach() { super.onDetach(); mCallbacks = null; } void onOptionSelected(View view) { if (mCallbacks != null) { int i = mButtonsToScreenMap.get(view.getId()); mCallbacks.goToConfigScreen(i); } mActivated = true; } public boolean onOptionsItemSelected(MenuItem menuitem) { return mDrawerToggle.onOptionsItemSelected(menuitem) || super.onOptionsItemSelected(menuitem); } public void onResume() { super.onResume(); updateWatchLabel(); updateDrawerIndicator(); } public void setup(int i, DrawerLayout drawerlayout, Toolbar toolbar) { mDrawerLayout = drawerlayout; mDrawerLayout.setDrawerShadow(0x7f020068, 0x800003); mContainerView = ButterKnife.findById(mDrawerLayout, i); mContainerView.setOnTouchListener(new android.view.View.OnTouchListener() { final NavigationFragment this$0; public boolean onTouch(View view, MotionEvent motionevent) { return true; } { this$0 = NavigationFragment.this; super(); } }); mDrawerToggle = new DrawerToggle(getActivity(), drawerlayout, toolbar, 0x7f0600a5, 0x7f0600a4); drawerlayout.post(new Runnable() { final NavigationFragment this$0; public void run() { mDrawerToggle.syncState(); } { this$0 = NavigationFragment.this; super(); } }); drawerlayout.setDrawerListener(mDrawerToggle); } public void updateDrawerIndicator() { if (!isResumed()) goto _L2; else goto _L1 _L1: boolean flag; if (getFragmentManager().getBackStackEntryCount() > 0) { flag = true; } else { flag = false; } if (!flag) goto _L4; else goto _L3 _L3: if (mDrawerToggle.isDrawerIndicatorEnabled()) goto _L5; else goto _L2 _L2: return; _L5: mDrawerToggle.setToolbarNavigationClickListener(new android.view.View.OnClickListener() { final NavigationFragment this$0; public void onClick(View view) { mCallbacks.onBackPressed(); } { this$0 = NavigationFragment.this; super(); } }); mDrawerLayout.setDrawerLockMode(1); ValueAnimator valueanimator = ValueAnimator.ofFloat(new float[] { 1.0F }).setDuration(mAnimDuration); valueanimator.addUpdateListener(new android.animation.ValueAnimator.AnimatorUpdateListener() { final NavigationFragment this$0; public void onAnimationUpdate(ValueAnimator valueanimator2) { float f = ((Float)valueanimator2.getAnimatedValue()).floatValue(); mDrawerToggle.setDrawerSlide(f); if (f >= 1.0F) { mDrawerToggle.setDrawerIndicatorEnabled(false); } } { this$0 = NavigationFragment.this; super(); } }); valueanimator.start(); return; _L4: if (!mDrawerToggle.isDrawerIndicatorEnabled()) { mDrawerToggle.setToolbarNavigationClickListener(null); mDrawerLayout.setDrawerLockMode(0); mDrawerToggle.setDrawerIndicatorEnabled(true); ValueAnimator valueanimator1 = ValueAnimator.ofFloat(new float[] { 1.0F, 0.0F }).setDuration(mAnimDuration); valueanimator1.addUpdateListener(new android.animation.ValueAnimator.AnimatorUpdateListener() { final NavigationFragment this$0; public void onAnimationUpdate(ValueAnimator valueanimator2) { float f = ((Float)valueanimator2.getAnimatedValue()).floatValue(); mDrawerToggle.setDrawerSlide(f); } { this$0 = NavigationFragment.this; super(); } }); valueanimator1.start(); return; } if (true) goto _L2; else goto _L6 _L6: } public void updateWatchLabel() { Object obj = getView(); if (!$assertionsDisabled && obj == null) { throw new AssertionError(); } obj = (TextView)ButterKnife.findById(((View) (obj)), 0x7f0d012a); if (mCallbacks != null && mCallbacks.isPaired()) { ((TextView) (obj)).setText(getString(0x7f06010b)); return; } else { ((TextView) (obj)).setText(getString(0x7f06010a)); return; } } static { boolean flag; if (!com/oliodevices/assist/app/fragments/NavigationFragment.desiredAssertionStatus()) { flag = true; } else { flag = false; } $assertionsDisabled = flag; mButtonsToScreenMap = new SparseIntArray(8); mButtonsToScreenMap.put(0x7f0d012a, 0); mButtonsToScreenMap.put(0x7f0d012c, 3); mButtonsToScreenMap.put(0x7f0d012b, 4); mButtonsToScreenMap.put(0x7f0d012d, 5); mButtonsToScreenMap.put(0x7f0d012e, 6); mButtonsToScreenMap.put(0x7f0d012f, 7); mButtonsToScreenMap.put(0x7f0d0130, 8); mButtonsToScreenMap.put(0x7f0d0131, 9); } }