List of usage examples for android.view ViewGroup findViewById
@Nullable public final <T extends View> T findViewById(@IdRes int id)
From source file:com.wb.launcher3.Page.java
protected void onAttachedToWindow() { super.onAttachedToWindow(); // Hook up the page indicator ViewGroup parent = (ViewGroup) getParent(); if (mPageIndicator == null && mPageIndicatorViewId > -1) { mPageIndicator = (PageIndicator) parent.findViewById(mPageIndicatorViewId); mPageIndicator.removeAllMarkers(mAllowPagedViewAnimations); ArrayList<PageIndicator.PageMarkerResources> markers = new ArrayList<PageIndicator.PageMarkerResources>(); for (int i = 0; i < getChildCount(); ++i) { markers.add(getPageIndicatorMarker(i)); }/*from w w w. ja v a2 s .c om*/ mPageIndicator.addMarkers(markers, mAllowPagedViewAnimations, isWorkspace());//*/zhangwuba modify 2014-6-6 OnClickListener listener = getPageIndicatorClickListener(); if (listener != null) { mPageIndicator.setOnClickListener(listener); } mPageIndicator.setContentDescription(getPageIndicatorDescription()); } }
From source file:com.serenegiant.autoparrot.BaseAutoPilotFragment.java
@Override protected View internalCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState, final int layout_id) { Bundle args = savedInstanceState;// w w w .ja v a 2 s . c o m if (args == null) { args = getArguments(); } mPrefName = args.getString(KEY_PREF_NAME_AUTOPILOT, mPrefName); mMode = args.getInt(KEY_AUTOPILOT_MODE, mMode); mPref = getActivity().getSharedPreferences(mPrefName, 0); // ??? mCameraAutoWhiteBlance = getInt(mPref, KEY_CAMERA_WHITE_BLANCE, DEFAULT_CAMERA_WHITE_BLANCE); mCameraExposure = mPref.getFloat(KEY_CAMERA_EXPOSURE, DEFAULT_CAMERA_EXPOSURE); mCameraSaturation = mPref.getFloat(KEY_CAMERA_SATURATION, DEFAULT_CAMERA_SATURATION); mCameraPan = getInt(mPref, KEY_CAMERA_PAN, DEFAULT_CAMERA_PAN); mCameraTilt = getInt(mPref, KEY_CAMERA_TILT, DEFAULT_CAMERA_TILT); // // mAutoWhiteBlance = mPref.getBoolean(KEY_AUTO_WHITE_BLANCE, false); mExposure = mPref.getFloat(KEY_EXPOSURE, DEFAULT_EXPOSURE); mSaturation = mPref.getFloat(KEY_SATURATION, DEFAULT_SATURATION); mBrightness = mPref.getFloat(KEY_BRIGHTNESS, DEFAULT_BRIGHTNESS); // mPosterize = mPref.getFloat(KEY_POSTERIZE, DEFAULT_POSTERIZE); // mEnablePosterize = mPref.getBoolean(KEY_ENABLE_POSTERIZE, false); mBinarizeThreshold = mPref.getFloat(KEY_BINARIZE_THRESHOLD, DEFAULT_BINARIZE_THRESHOLD); mTrapeziumRate = (float) Double.parseDouble(mPref.getString(KEY_TRAPEZIUM_RATE, "0.0")); if (Math.abs(mTrapeziumRate) < 0.01f) mTrapeziumRate = 0.0f; // mExtractH = mPref.getFloat(KEY_EXTRACT_H, DEFAULT_EXTRACT_H); mExtractRangeH = mPref.getFloat(KEY_EXTRACT_RANGE_H, DEFAULT_EXTRACT_RANGE_H); mExtractS = mPref.getFloat(KEY_EXTRACT_S, DEFAULT_EXTRACT_S); mExtractRangeS = mPref.getFloat(KEY_EXTRACT_RANGE_S, DEFAULT_EXTRACT_RANGE_S); mExtractV = mPref.getFloat(KEY_EXTRACT_V, DEFAULT_EXTRACT_V); mExtractRangeV = mPref.getFloat(KEY_EXTRACT_RANGE_V, DEFAULT_EXTRACT_RANGE_V); // mEnableGLESExtraction = mPref.getBoolean(KEY_ENABLE_EXTRACTION, DEFAULT_ENABLE_EXTRACTION); // mGLESSmoothType = getInt(mPref, KEY_SMOOTH_TYPE, DEFAULT_SMOOTH_TYPE); // mEnableGLESCanny = mPref.getBoolean(KEY_ENABLE_EDGE_DETECTION, DEFAULT_ENABLE_EDGE_DETECTION); mFillContour = mPref.getBoolean(KEY_FILL_INNER_CONTOUR, DEFAULT_FILL_INNER_CONTOUR); // mEnableNativeExtraction = mPref.getBoolean(KEY_ENABLE_NATIVE_EXTRACTION, false); // mEnableNativeCanny = mPref.getBoolean(KEY_ENABLE_NATIVE_EDGE_DETECTION, DEFAULT_ENABLE_NATIVE_EDGE_DETECTION); mNativeSmoothType = getInt(mPref, KEY_NATIVE_SMOOTH_TYPE, DEFAULT_NATIVE_SMOOTH_TYPE); mMaxThinningLoop = getInt(mPref, KEY_NATIVE_MAX_THINNING_LOOP, DEFAULT_NATIVE_MAX_THINNING_LOOP); // mAreaLimitMin = mPref.getFloat(KEY_AREA_LIMIT_MIN, DEFAULT_AREA_LIMIT_MIN); mAspectLimitMin = mPref.getFloat(KEY_ASPECT_LIMIT_MIN, DEFAULT_ASPECT_LIMIT_MIN); mAreaErrLimit1 = mPref.getFloat(KEY_AREA_ERR_LIMIT1, DEFAULT_AREA_ERR_LIMIT1); mAreaErrLimit2 = mPref.getFloat(KEY_AREA_ERR_LIMIT2, DEFAULT_AREA_ERR_LIMIT2); // mTraceAttitudeYaw = mPref.getFloat(KEY_TRACE_ATTITUDE_YAW, DEFAULT_TRACE_ATTITUDE_YAW); mTraceSpeed = mPref.getFloat(KEY_TRACE_SPEED, DEFAULT_TRACE_SPEED); mTraceAltitudeEnabled = mPref.getBoolean(KEY_TRACE_ALTITUDE_ENABLED, DEFAULT_TRACE_ALTITUDE_ENABLED); mTraceAltitude = Math.min(mPref.getFloat(KEY_TRACE_ALTITUDE, DEFAULT_TRACE_ALTITUDE), mFlightController.getMaxAltitude().current()); // mTraceCurvature = mPref.getFloat(KEY_TRACE_CURVATURE, DEFAULT_TRACE_CURVATURE); mTraceDirectionalReverseBias = mPref.getFloat(KEY_TRACE_DIR_REVERSE_BIAS, DEFAULT_TRACE_DIR_REVERSE_BIAS); mTraceMovingAveTap = mPref.getInt(KEY_TRACE_MOVING_AVE_TAP, DEFAULT_TRACE_MOVING_AVE_TAP); mTraceDecayRate = mPref.getFloat(KEY_TRACE_DECAY_RATE, DEFAULT_TRACE_DECAY_RATE); mTraceSensitivity = mPref.getFloat(KEY_TRACE_SENSITIVITY, DEFAULT_TRACE_SENSITIVITY); // View??? mActionViews.clear(); final ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.fragment_pilot_auto, container, false); mControllerFrame = (ViewGroup) rootView.findViewById(R.id.controller_frame); mControllerFrame.setOnClickListener(mOnClickListener); // ? mTopPanel = rootView.findViewById(R.id.top_panel); mTopPanel.setOnClickListener(mOnClickListener); mTopPanel.setOnLongClickListener(mOnLongClickListener); mActionViews.add(mTopPanel); // mFlatTrimBtn = (ImageButton) rootView.findViewById(R.id.flat_trim_btn); mFlatTrimBtn.setOnClickListener(mOnClickListener); mFlatTrimBtn.setOnLongClickListener(mOnLongClickListener); mActionViews.add(mFlatTrimBtn); // mConfigShowBtn = (ImageButton) rootView.findViewById(R.id.config_show_btn); mConfigShowBtn.setOnClickListener(mOnClickListener); // mBatteryLabel = (TextView) rootView.findViewById(R.id.batteryLabel); mAlertMessage = (TextView) rootView.findViewById(R.id.alert_message); mAlertMessage.setVisibility(View.INVISIBLE); // ? // ?? mBottomPanel = rootView.findViewById(R.id.bottom_panel); mEmergencyBtn = (ImageButton) rootView.findViewById(R.id.emergency_btn); mEmergencyBtn.setOnClickListener(mOnClickListener); // ? mTakeOnOffBtn = (ImageButton) rootView.findViewById(R.id.take_onoff_btn); mTakeOnOffBtn.setOnClickListener(mOnClickListener); mTakeOnOffBtn.setOnLongClickListener(mOnLongClickListener); mActionViews.add(mTakeOnOffBtn); // mRecordBtn = (ImageButton) rootView.findViewById(R.id.record_btn); mRecordBtn.setOnClickListener(mOnClickListener); mRecordBtn.setOnLongClickListener(mOnLongClickListener); // mRecordLabel = (TextView) rootView.findViewById(R.id.record_label); // mTimeLabelTv = (TextView) rootView.findViewById(R.id.time_label); setChildVisibility(mTimeLabelTv, View.INVISIBLE); // ?? mRightSidePanel = rootView.findViewById(R.id.right_side_panel); mActionViews.add(mRightSidePanel); // mCopilotBtn = (ImageButton) rootView.findViewById(R.id.copilot_btn); mCopilotBtn.setOnClickListener(mOnClickListener); mCopilotBtn.setVisibility(mController instanceof ISkyController ? View.VISIBLE : View.GONE); // ? mStillCaptureBtn = (ImageButton) rootView.findViewById(R.id.still_capture_btn); mStillCaptureBtn.setOnClickListener(mOnClickListener); // mVideoRecordingBtn = (ImageButton) rootView.findViewById(R.id.video_capture_btn); mVideoRecordingBtn.setOnClickListener(mOnClickListener); // mTraceButton = (ImageButton) rootView.findViewById(R.id.trace_btn); mTraceButton.setOnClickListener(mOnClickListener); mTraceButton.setOnLongClickListener(mOnLongClickListener); if (mController instanceof ICameraController) { ((ICameraController) mController).setCameraControllerListener(null); ((ICameraController) mController).sendCameraOrientation(0, 0); } mModelView = (IModelView) rootView.findViewById(R.id.drone_view); mModelView.setModel(IModelView.MODEL_NON, AttitudeScreenBase.CTRL_ATTITUDE); ((View) mModelView).setOnClickListener(mOnClickListener); mDetectView = (SurfaceView) rootView.findViewById(R.id.detect_view); mDetectView.setVisibility(View.VISIBLE); //-------------------------------------------------------------------------------- final ConfigPagerAdapter adapter = new ConfigPagerAdapter(inflater); final ViewPager pager = (ViewPager) rootView.findViewById(R.id.pager); pager.setAdapter(adapter); // mTraceTv1 = (TextView) rootView.findViewById(R.id.trace1_tv); mTraceTv2 = (TextView) rootView.findViewById(R.id.trace2_tv); mTraceTv3 = (TextView) rootView.findViewById(R.id.trace3_tv); // mCpuLoadTv = (TextView) rootView.findViewById(R.id.cpu_load_textview); // mFpsSrcTv = (TextView) rootView.findViewById(R.id.fps_src_textview); mFpsSrcTv.setText(null); mFpsResultTv = (TextView) rootView.findViewById(R.id.fps_result_textview); mFpsResultTv.setText(null); return rootView; }
From source file:android.support.v7ox.app.AppCompatDelegateImplV7.java
private ViewGroup createSubDecor() { TypedArray a = mContext.obtainStyledAttributes(R.styleable.AppCompatTheme); if (!a.hasValue(R.styleable.AppCompatTheme_windowActionBar_ox)) { a.recycle();/* w ww.j a v a2 s .com*/ throw new IllegalStateException( "You need to use a Theme.AppCompat theme (or descendant) with this activity."); } if (a.getBoolean(R.styleable.AppCompatTheme_windowNoTitle_ox, false)) { requestWindowFeature(Window.FEATURE_NO_TITLE); } else if (a.getBoolean(R.styleable.AppCompatTheme_windowActionBar_ox, false)) { // Don't allow an action bar if there is no title. requestWindowFeature(FEATURE_SUPPORT_ACTION_BAR); } if (a.getBoolean(R.styleable.AppCompatTheme_windowActionBarOverlay_ox, false)) { requestWindowFeature(FEATURE_SUPPORT_ACTION_BAR_OVERLAY); } if (a.getBoolean(R.styleable.AppCompatTheme_windowActionModeOverlay_ox, false)) { requestWindowFeature(FEATURE_ACTION_MODE_OVERLAY); } mIsFloating = a.getBoolean(R.styleable.AppCompatTheme_android_windowIsFloating, false); a.recycle(); final LayoutInflater inflater = LayoutInflater.from(mContext); ViewGroup subDecor = null; if (!mWindowNoTitle) { if (mIsFloating) { // If we're floating, inflate the dialog title decor subDecor = (ViewGroup) inflater.inflate(R.layout.abc_dialog_title_material, null); // Floating windows can never have an action bar, reset the flags mHasActionBar = mOverlayActionBar = false; } else if (mHasActionBar) { /** * This needs some explanation. As we can not use the android:theme attribute * pre-L, we emulate it by manually creating a LayoutInflater using a * ContextThemeWrapper pointing to actionBarTheme. */ TypedValue outValue = new TypedValue(); mContext.getTheme().resolveAttribute(R.attr.actionBarTheme_ox, outValue, true); Context themedContext; if (outValue.resourceId != 0) { themedContext = new ContextThemeWrapper(mContext, outValue.resourceId); } else { themedContext = mContext; } // Now inflate the view using the themed context and set it as the content view subDecor = (ViewGroup) LayoutInflater.from(themedContext).inflate(R.layout.abc_screen_toolbar, null); mDecorContentParent = (DecorContentParent) subDecor.findViewById(R.id.decor_content_parent); mDecorContentParent.setWindowCallback(getWindowCallback()); /** * Propagate features to DecorContentParent */ if (mOverlayActionBar) { mDecorContentParent.initFeature(FEATURE_SUPPORT_ACTION_BAR_OVERLAY); } if (mFeatureProgress) { mDecorContentParent.initFeature(Window.FEATURE_PROGRESS); } if (mFeatureIndeterminateProgress) { mDecorContentParent.initFeature(Window.FEATURE_INDETERMINATE_PROGRESS); } } } else { if (mOverlayActionMode) { subDecor = (ViewGroup) inflater.inflate(R.layout.abc_screen_simple_overlay_action_mode, null); } else { subDecor = (ViewGroup) inflater.inflate(R.layout.abc_screen_simple, null); } if (Build.VERSION.SDK_INT >= 21) { // If we're running on L or above, we can rely on ViewCompat's // setOnApplyWindowInsetsListener ViewCompat.setOnApplyWindowInsetsListener(subDecor, new OnApplyWindowInsetsListener() { @Override public WindowInsetsCompat onApplyWindowInsets(View v, WindowInsetsCompat insets) { final int top = insets.getSystemWindowInsetTop(); final int newTop = updateStatusGuard(top); if (top != newTop) { insets = insets.replaceSystemWindowInsets(insets.getSystemWindowInsetLeft(), newTop, insets.getSystemWindowInsetRight(), insets.getSystemWindowInsetBottom()); } // Now apply the insets on our view return ViewCompat.onApplyWindowInsets(v, insets); } }); } else { // Else, we need to use our own FitWindowsViewGroup handling ((FitWindowsViewGroup) subDecor) .setOnFitSystemWindowsListener(new FitWindowsViewGroup.OnFitSystemWindowsListener() { @Override public void onFitSystemWindows(Rect insets) { insets.top = updateStatusGuard(insets.top); } }); } } if (subDecor == null) { throw new IllegalArgumentException("AppCompat does not support the current theme features: { " + "windowActionBar: " + mHasActionBar + ", windowActionBarOverlay: " + mOverlayActionBar + ", android:windowIsFloating: " + mIsFloating + ", windowActionModeOverlay: " + mOverlayActionMode + ", windowNoTitle: " + mWindowNoTitle + " }"); } if (mDecorContentParent == null) { mTitleView = (TextView) subDecor.findViewById(R.id.title); } // Make the decor optionally fit system windows, like the window's decor ViewUtils.makeOptionalFitsSystemWindows(subDecor); final ViewGroup decorContent = (ViewGroup) mWindow.findViewById(android.R.id.content); final ContentFrameLayout abcContent = (ContentFrameLayout) subDecor .findViewById(R.id.action_bar_activity_content); // There might be Views already added to the Window's content view so we need to // migrate them to our content view while (decorContent.getChildCount() > 0) { final View child = decorContent.getChildAt(0); decorContent.removeViewAt(0); abcContent.addView(child); } // Now set the Window's content view with the decor mWindow.setContentView(subDecor); // Change our content FrameLayout to use the android.R.id.content id. // Useful for fragments. decorContent.setId(View.NO_ID); abcContent.setId(android.R.id.content); // The decorContent may have a foreground drawable set (windowContentOverlay). // Remove this as we handle it ourselves if (decorContent instanceof FrameLayout) { decorContent.setForeground(null); } abcContent.setAttachListener(new ContentFrameLayout.OnAttachListener() { @Override public void onAttachedFromWindow() { } @Override public void onDetachedFromWindow() { dismissPopups(); } }); return subDecor; }
From source file:com.android.launcher2.Workspace.java
void setFadeForOverScroll(float fade) { if (!isScrollingIndicatorEnabled()) return;//from w ww . ja v a 2 s . com mOverscrollFade = fade; float reducedFade = 0.5f + 0.5f * (1 - fade); final ViewGroup parent = (ViewGroup) getParent(); final ImageView qsbDivider = (ImageView) (parent.findViewById(R.id.qsb_divider)); final ImageView dockDivider = (ImageView) (parent.findViewById(R.id.dock_divider)); final View scrollIndicator = getScrollingIndicator(); cancelScrollingIndicatorAnimations(); if (qsbDivider != null) qsbDivider.setAlpha(reducedFade); if (dockDivider != null) dockDivider.setAlpha(reducedFade); scrollIndicator.setAlpha(1 - fade); }
From source file:com.nekomeshi312.whiteboardcorrection.WhiteBoardCheckFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // TODO Auto-generated method stub if (MyDebug.DEBUG) Log.i(LOG_TAG, "onCreateView"); ViewGroup root = (ViewGroup) inflater.inflate(R.layout.fragment_white_board_check, container, false); final Bundle args = getArguments(); mArgsOK = true;//from w ww . j a va2 s.co m if (args == null) { mArgsOK = false; } else { mMyTag = args.getString(TAG_FRAGMENT); mFilePath = args.getString(TAG_FILE_PATH); mFileName = args.getString(TAG_FILE_NAME); mPicWidth = args.getInt(TAG_WIDTH, -1); mPicHeight = args.getInt(TAG_HEIGHT, -1); mPrevWidth = args.getInt(TAG_PREV_WIDTH, -1); mPrevHeight = args.getInt(TAG_PREV_HEIGHT, -1); mPreviewPoints = args.getDoubleArray(TAG_WB_POS); mIsCaptured = args.getBoolean(TAG_IS_CAPTURED, true); if (mFilePath == null) { Log.w(LOG_TAG, "Invalid picture path"); mArgsOK = false; } if (mFileName == null) { Log.w(LOG_TAG, "Invalid picture name"); mArgsOK = false; } if (mPicWidth < 0) { Log.w(LOG_TAG, "Invalid picture width(" + mPicWidth + ")"); mArgsOK = false; } if (mPicHeight < 0) { Log.w(LOG_TAG, "Invalid picture height(" + mPicHeight + ")"); mArgsOK = false; } if (mPrevWidth < 0) { Log.w(LOG_TAG, "Invalid preview width(" + mPrevWidth + ")"); mArgsOK = false; } if (mPrevHeight < 0) { Log.w(LOG_TAG, "Invalid preview height(" + mPrevHeight + ")"); mArgsOK = false; } if (MyDebug.DEBUG) { Log.d(LOG_TAG, "FilePath = " + mFilePath); Log.d(LOG_TAG, "FileName = " + mFileName); Log.d(LOG_TAG, "PicWidth = " + mPicWidth); Log.d(LOG_TAG, "PicHeight = " + mPicHeight); Log.d(LOG_TAG, "PreviewWidth = " + mPrevWidth); Log.d(LOG_TAG, "PreviewHeight = " + mPrevHeight); if (mPreviewPoints == null) { Log.d(LOG_TAG, "mPreviewPoints = null"); } else { for (int i = 0; i < 4; i++) { Log.d(LOG_TAG, "PrevPoints(" + i + ") = " + mPreviewPoints[i * 2] + ":" + mPreviewPoints[i * 2 + 1]); } } } } ActionBar actionBar = ((SherlockFragmentActivity) mParentActivity).getSupportActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); mCapturedImageView = (ImageView) root.findViewById(R.id.captured_image); mWBCorrectionView = (WhiteBoardAreaView) root.findViewById(R.id.whiteboard_area_correction_view); mWBCorrectionView.setDraggable(true); mWBCheckViewBase = (FrameLayout) root.findViewById(R.id.area_check_view_base); mWBCheckViewBase.getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener() { @Override public void onGlobalLayout() {//?view????????? // TODO Auto-generated method stub if (mIsFirstOnGlobalLayout) { //jpeg?WB??? mIsFirstOnGlobalLayout = false; LoadJpegFileAsyncTask loadJpegTask = new LoadJpegFileAsyncTask(); loadJpegTask.execute(); } } }); return root; }
From source file:de.anderdonau.spacetrader.Main.java
public boolean ExecuteAction(final Boolean CommanderFlees) { // ************************************************************************* // A fight round // Return value indicates whether fight continues into another round // ************************************************************************* Boolean CommanderGotHit, OpponentGotHit; long OpponentHull, ShipHull; int i;//from ww w .ja v a 2 s. c o m int PrevEncounterType; Ship Ship = gameState.Ship; Ship Opponent = gameState.Opponent; Popup popup; CommanderGotHit = false; OpponentHull = Opponent.hull; ShipHull = Ship.hull; // Fire shots if (gameState.EncounterType == GameState.PIRATEATTACK || gameState.EncounterType == GameState.POLICEATTACK || gameState.EncounterType == GameState.TRADERATTACK || gameState.EncounterType == GameState.SPACEMONSTERATTACK || gameState.EncounterType == GameState.DRAGONFLYATTACK || gameState.EncounterType == GameState.POSTMARIEPOLICEENCOUNTER || gameState.EncounterType == GameState.SCARABATTACK || gameState.EncounterType == GameState.FAMOUSCAPATTACK) { CommanderGotHit = ExecuteAttack(Opponent, Ship, CommanderFlees, true); } OpponentGotHit = false; if (!CommanderFlees) { if (gameState.EncounterType == GameState.POLICEFLEE || gameState.EncounterType == GameState.TRADERFLEE || gameState.EncounterType == GameState.PIRATEFLEE) { OpponentGotHit = ExecuteAttack(Ship, Opponent, true, false); } else { OpponentGotHit = ExecuteAttack(Ship, Opponent, false, false); } } if (CommanderGotHit) { ((FragmentEncounter) currentFragment).playerShipNeedsUpdate = true; Bitmap tribble = BitmapFactory.decodeResource(mContext.getResources(), R.drawable.tribble); ViewGroup container = (ViewGroup) findViewById(R.id.container); for (i = 0; i <= GameState.TRIBBLESONSCREEN; ++i) { int resID = mContext.getResources().getIdentifier("tribbleButton" + String.valueOf(i), "id", mContext.getPackageName()); ImageView imageView = (ImageView) container.findViewById(resID); if (imageView == null) { continue; } //noinspection ConstantConditions ViewGroup.MarginLayoutParams marginParams = new ViewGroup.MarginLayoutParams( imageView.getLayoutParams()); marginParams.setMargins(gameState.GetRandom(container.getWidth() - tribble.getWidth()), gameState.GetRandom(container.getHeight() - tribble.getHeight()), 0, 0); RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(marginParams); imageView.setLayoutParams(layoutParams); } } if (OpponentGotHit) { ((FragmentEncounter) currentFragment).opponentShipNeedsUpdate = true; } // Determine whether someone gets destroyed if (Ship.hull <= 0 && Opponent.hull <= 0) { gameState.AutoAttack = false; gameState.AutoFlee = false; if (gameState.EscapePod) { EscapeWithPod(); } else { popup = new Popup(this, "Both Destroyed", "You and your opponent have managed to destroy each other.", "", "OK", cbShowNextPopup); popupQueue.push(popup); showNextPopup(); btnDestroyed(); } return false; } else if (Opponent.hull <= 0) { gameState.AutoAttack = false; gameState.AutoFlee = false; if (gameState.ENCOUNTERPIRATE(gameState.EncounterType) && Opponent.type != GameState.MANTISTYPE && gameState.PoliceRecordScore >= GameState.DUBIOUSSCORE) { popup = new Popup(this, "Bounty received", String.format("You earned a bounty of %d cr.", GetBounty(Opponent)), "", "OK", cbShowNextPopup); popupQueue.push(popup); showNextPopup(); } else { popup = new Popup(this, "You win", "You have destroyed your opponent.", "", "OK", cbShowNextPopup); popupQueue.push(popup); showNextPopup(); } if (gameState.ENCOUNTERPOLICE(gameState.EncounterType)) { ++gameState.PoliceKills; gameState.PoliceRecordScore += GameState.KILLPOLICESCORE; } else if (gameState.ENCOUNTERFAMOUS(gameState.EncounterType)) { if (gameState.ReputationScore < GameState.DANGEROUSREP) { gameState.ReputationScore = GameState.DANGEROUSREP; } else { gameState.ReputationScore += 100; } // bump news flag from attacked to ship destroyed gameState.replaceNewsEvent(gameState.latestNewsEvent(), gameState.latestNewsEvent() + 10); } else if (gameState.ENCOUNTERPIRATE(gameState.EncounterType)) { if (Opponent.type != GameState.MANTISTYPE) { gameState.Credits += GetBounty(Opponent); gameState.PoliceRecordScore += GameState.KILLPIRATESCORE; Scoop(); } ++gameState.PirateKills; } else if (gameState.ENCOUNTERTRADER(gameState.EncounterType)) { ++gameState.TraderKills; gameState.PoliceRecordScore += GameState.KILLTRADERSCORE; Scoop(); } else if (gameState.ENCOUNTERMONSTER(gameState.EncounterType)) { ++gameState.PirateKills; gameState.PoliceRecordScore += GameState.KILLPIRATESCORE; gameState.MonsterStatus = 2; } else if (gameState.ENCOUNTERDRAGONFLY(gameState.EncounterType)) { ++gameState.PirateKills; gameState.PoliceRecordScore += GameState.KILLPIRATESCORE; gameState.DragonflyStatus = 5; } else if (gameState.ENCOUNTERSCARAB(gameState.EncounterType)) { ++gameState.PirateKills; gameState.PoliceRecordScore += GameState.KILLPIRATESCORE; gameState.ScarabStatus = 2; } gameState.ReputationScore += 1 + (Opponent.type >> 1); return (false); } else if (Ship.hull <= 0) { gameState.AutoAttack = false; gameState.AutoFlee = false; if (gameState.EscapePod) { EscapeWithPod(); } else { popup = new Popup(this, "You Lose", "Your ship has been destroyed by your opponent.", "", "OK", cbShowNextPopup); popupQueue.push(popup); showNextPopup(); btnDestroyed(); } return (false); } // Determine whether someone gets away. if (CommanderFlees) { if (GameState.getDifficulty() == GameState.BEGINNER) { gameState.AutoAttack = false; gameState.AutoFlee = false; popup = new Popup(this, "Escaped", "You have managed to escape your opponent.", "Just because this is Beginner level.", "OK", cbShowNextPopup); popupQueue.push(popup); showNextPopup(); if (gameState.ENCOUNTERMONSTER(gameState.EncounterType)) { gameState.MonsterHull = Opponent.hull; } return (false); } else if ((gameState.GetRandom(7) + (Ship.PilotSkill() / 3)) * 2 >= gameState.GetRandom(Opponent.PilotSkill()) * (2 + GameState.getDifficulty())) { gameState.AutoAttack = false; gameState.AutoFlee = false; if (CommanderGotHit) { popup = new Popup(this, "You Escaped", "You got hit, but still managed to escape.", "", "OK", cbShowNextPopup); popupQueue.push(popup); showNextPopup(); } else { popup = new Popup(this, "Escaped", "You have managed to escape your opponent.", "", "OK", cbShowNextPopup); popupQueue.push(popup); showNextPopup(); } if (gameState.ENCOUNTERMONSTER(gameState.EncounterType)) { gameState.MonsterHull = Opponent.hull; } return (false); } } else if (gameState.EncounterType == GameState.POLICEFLEE || gameState.EncounterType == GameState.TRADERFLEE || gameState.EncounterType == GameState.PIRATEFLEE || gameState.EncounterType == GameState.TRADERSURRENDER || gameState.EncounterType == GameState.PIRATESURRENDER) { if (gameState.GetRandom(Ship.PilotSkill()) * 4 <= gameState.GetRandom((7 + (Opponent.PilotSkill() / 3))) * 2) { gameState.AutoAttack = false; gameState.AutoFlee = false; popup = new Popup(this, "Opponent Escaped", "Your opponent has managed to escape.", "", "OK", cbShowNextPopup); popupQueue.push(popup); showNextPopup(); return (false); } } // Determine whether the opponent's actions must be changed PrevEncounterType = gameState.EncounterType; if (Opponent.hull < OpponentHull) { if (gameState.ENCOUNTERPOLICE(gameState.EncounterType)) { if (Opponent.hull < OpponentHull >> 1) { if (Ship.hull < ShipHull >> 1) { if (gameState.GetRandom(10) > 5) { gameState.EncounterType = GameState.POLICEFLEE; } } else { gameState.EncounterType = GameState.POLICEFLEE; } } } else if (gameState.EncounterType == GameState.POSTMARIEPOLICEENCOUNTER) { gameState.EncounterType = GameState.POLICEATTACK; } else if (gameState.ENCOUNTERPIRATE(gameState.EncounterType)) { if (Opponent.hull < (OpponentHull * 2) / 3) { if (Ship.hull < (ShipHull * 2) / 3) { if (gameState.GetRandom(10) > 3) { gameState.EncounterType = GameState.PIRATEFLEE; } } else { gameState.EncounterType = GameState.PIRATEFLEE; if (gameState.GetRandom(10) > 8 && Opponent.type < GameState.MAXSHIPTYPE) { gameState.EncounterType = GameState.PIRATESURRENDER; } } } } else if (gameState.ENCOUNTERTRADER(gameState.EncounterType)) { if (Opponent.hull < (OpponentHull * 2) / 3) { if (gameState.GetRandom(10) > 3) { gameState.EncounterType = GameState.TRADERSURRENDER; } else { gameState.EncounterType = GameState.TRADERFLEE; } } else if (Opponent.hull < (OpponentHull * 9) / 10) { if (Ship.hull < (ShipHull * 2) / 3) { // If you get damaged a lot, the trader tends to keep shooting if (gameState.GetRandom(10) > 7) { gameState.EncounterType = GameState.TRADERFLEE; } } else if (Ship.hull < (ShipHull * 9) / 10) { if (gameState.GetRandom(10) > 3) { gameState.EncounterType = GameState.TRADERFLEE; } } else { gameState.EncounterType = GameState.TRADERFLEE; } } } } if (PrevEncounterType != gameState.EncounterType) { if (!(gameState.AutoAttack && (gameState.EncounterType == GameState.TRADERFLEE || gameState.EncounterType == GameState.PIRATEFLEE || gameState.EncounterType == GameState.POLICEFLEE))) { gameState.AutoAttack = false; } gameState.AutoFlee = false; } ((FragmentEncounter) currentFragment).playerShipNeedsUpdate = true; ((FragmentEncounter) currentFragment).opponentShipNeedsUpdate = true; ((FragmentEncounter) currentFragment).EncounterDisplayShips(); ((FragmentEncounter) currentFragment).EncounterButtons(); String buf = "The "; String buf2 = ""; if (gameState.ENCOUNTERPOLICE(PrevEncounterType)) { buf2 = "police ship"; } else if (gameState.ENCOUNTERPIRATE(PrevEncounterType)) { if (Opponent.type == GameState.MANTISTYPE) { buf2 = "alien ship"; } else { buf2 = "pirate ship"; } } else if (gameState.ENCOUNTERTRADER(PrevEncounterType)) { buf2 = "trader ship"; } else if (gameState.ENCOUNTERMONSTER(PrevEncounterType)) { buf2 = "monster"; } else if (gameState.ENCOUNTERDRAGONFLY(PrevEncounterType)) { buf2 = "Dragonfly"; } else if (gameState.ENCOUNTERSCARAB(PrevEncounterType)) { buf2 = "Scarab"; } else if (gameState.ENCOUNTERFAMOUS(PrevEncounterType)) { buf2 = "Captain"; } buf += buf2; if (CommanderGotHit) { buf += " hits you."; } else if (!(PrevEncounterType == GameState.POLICEFLEE || PrevEncounterType == GameState.TRADERFLEE || PrevEncounterType == GameState.PIRATEFLEE)) { buf += " missed you."; } else { buf = ""; } if (OpponentGotHit) { buf += "\nYou hit the " + buf2 + "."; } if (!CommanderFlees && !OpponentGotHit) { buf += "\n" + "You missed the " + buf2 + "."; } if (PrevEncounterType == GameState.POLICEFLEE || PrevEncounterType == GameState.TRADERFLEE || PrevEncounterType == GameState.PIRATEFLEE) { buf += "\nThe " + buf2 + " didn't get away."; } if (CommanderFlees) { buf += "\nThe " + buf2 + " is still following you."; } ((FragmentEncounter) currentFragment).EncounterDisplayNextAction(false); //noinspection ConstantConditions buf = ((FragmentEncounter) currentFragment).EncounterText.getText().toString() + "\n" + buf; ((FragmentEncounter) currentFragment).EncounterText.setText(buf); if (gameState.Continuous && (gameState.AutoAttack || gameState.AutoFlee)) { // Make sure there's always just one delayRunnable queued. // Otherwise several are queued if player keeps tapping Attack/Flee buttons. delayHandler.removeCallbacksAndMessages(null); gameState.CommanderFlees = CommanderFlees; delayHandler.postDelayed(delayRunnable, 1000); } return true; }
From source file:com.android.vending.billing.InAppBillingService.LACK.listAppsFragment.java
public void contextselpatch() { ArrayList localArrayList = new ArrayList(); localArrayList.add(new Patterns(Utils.getText(2131165325), false)); localArrayList.add(new Patterns(Utils.getText(2131165327), false)); localArrayList.add(new Patterns(Utils.getText(2131165329), false)); localArrayList.add(new Patterns(Utils.getText(2131165331), false)); localArrayList.add(new Patterns(Utils.getText(2131165333), false)); localArrayList.add(new Patterns(Utils.getText(2131165335), false)); localArrayList.add(new Patterns(Utils.getText(2131165358), false)); localArrayList.add(new Patterns(Utils.getText(2131165360), false)); localArrayList.add(new Patterns(Utils.getText(2131165362), false)); if ((all_d != null) && (all_d.adapter != null)) { all_d.adapter.notifyDataSetChanged(); }//from ww w.j av a 2s . co m removeDialogAll(13); removeDialogLP(7); showDialogAll(13, new ArrayAdapter(getContext(), 2130968605, localArrayList) { TextView txtStatus; TextView txtTitle; public View getView(int paramAnonymousInt, View paramAnonymousView, ViewGroup paramAnonymousViewGroup) { paramAnonymousView = (Patterns) getItem(paramAnonymousInt); paramAnonymousViewGroup = ((LayoutInflater) listAppsFragment.getInstance() .getSystemService("layout_inflater")).inflate(2130968633, paramAnonymousViewGroup, false); this.txtTitle = ((TextView) paramAnonymousViewGroup.findViewById(2131558483)); this.txtStatus = ((TextView) paramAnonymousViewGroup.findViewById(2131558484)); this.txtTitle.setTextAppearance(getContext(), listAppsFragment.getSizeText()); this.txtStatus.setTextAppearance(getContext(), listAppsFragment.getSizeText()); CheckBox localCheckBox = (CheckBox) paramAnonymousViewGroup.findViewById(2131558535); localCheckBox.setChecked(paramAnonymousView.Status); localCheckBox.setClickable(false); this.txtStatus.setTextAppearance(getContext(), 16973894); this.txtStatus.setTextColor(-7829368); this.txtTitle.setTextColor(-1); this.txtTitle.setText(((Patterns) getItem(paramAnonymousInt)).Name); this.txtTitle.setTypeface(null, 1); paramAnonymousView = ((Patterns) getItem(paramAnonymousInt)).Name; if ((paramAnonymousInt == 6) || (paramAnonymousInt == 7)) { this.txtTitle.setText(Utils.getColoredText(paramAnonymousView, "#ffffff00", "bold")); } for (;;) { if (paramAnonymousInt == 0) { paramAnonymousView = Utils.getText(2131165326); } if (paramAnonymousInt == 1) { paramAnonymousView = Utils.getText(2131165328); } if (paramAnonymousInt == 2) { paramAnonymousView = Utils.getText(2131165330); } if (paramAnonymousInt == 3) { paramAnonymousView = Utils.getText(2131165332); } if (paramAnonymousInt == 4) { paramAnonymousView = Utils.getText(2131165334); } if (paramAnonymousInt == 5) { paramAnonymousView = Utils.getText(2131165336); } if ((paramAnonymousInt == 6) || (paramAnonymousInt == 7) || (paramAnonymousInt == 8)) { paramAnonymousView = ""; } this.txtStatus.append(Utils.getColoredText(paramAnonymousView, "#ff888888", "italic")); return paramAnonymousViewGroup; if (paramAnonymousInt == 8) { this.txtTitle.setText(Utils.getColoredText(paramAnonymousView, "#ffff0000", "bold")); } else { this.txtTitle.setText(Utils.getColoredText(paramAnonymousView, "#ff00ff00", "bold")); } } } }); }
From source file:com.android.vending.billing.InAppBillingService.LACK.listAppsFragment.java
public View onCreateView(LayoutInflater paramLayoutInflater, ViewGroup paramViewGroup, Bundle paramBundle) { System.out.println("View created"); if (su) {/*from w ww .j a v a2s. c o m*/ } for (paramLayoutInflater = paramLayoutInflater.inflate(2130968629, paramViewGroup);; paramLayoutInflater = paramLayoutInflater.inflate(2130968630, paramViewGroup)) { lv = (ExpandableListView) paramLayoutInflater.findViewById(2131558620); menu_lv = (ExpandableListView) paramLayoutInflater.findViewById(2131558613); paramViewGroup = (HorizontalScrollView) paramLayoutInflater.findViewById(2131558621); paramBundle = (Button) paramViewGroup.findViewById(2131558622); if (paramBundle != null) { paramBundle.setTextAppearance(getContext(), getSizeText()); paramBundle.setTextColor(Color.parseColor("#999999")); } paramBundle = (Button) paramViewGroup.findViewById(2131558623); if (paramBundle != null) { paramBundle.setTextAppearance(getContext(), getSizeText()); paramBundle.setTextColor(Color.parseColor("#999999")); } paramBundle = (Button) paramViewGroup.findViewById(2131558479); if (paramBundle != null) { paramBundle.setTextAppearance(getContext(), getSizeText()); paramBundle.setTextColor(Color.parseColor("#999999")); } paramBundle = (Button) paramViewGroup.findViewById(2131558624); if (paramBundle != null) { paramBundle.setTextAppearance(getContext(), getSizeText()); paramBundle.setTextColor(Color.parseColor("#999999")); } paramBundle = (Button) paramViewGroup.findViewById(2131558625); if (paramBundle != null) { paramBundle.setTextAppearance(getContext(), getSizeText()); paramBundle.setTextColor(Color.parseColor("#999999")); } paramViewGroup = (Button) paramViewGroup.findViewById(2131558626); if (paramViewGroup != null) { paramViewGroup.setTextAppearance(getContext(), getSizeText()); paramViewGroup.setTextColor(Color.parseColor("#999999")); } if (getOldPackageName() == null) { if (data != null) { break; } sqlScan = true; paramViewGroup = new Thread(new AppScanning()); paramViewGroup.setPriority(10); paramViewGroup.start(); } return paramLayoutInflater; } populateAdapter(data, getSortPref()); return paramLayoutInflater; }
From source file:com.android.vending.billing.InAppBillingService.LACK.listAppsFragment.java
public void contextCorePatch() { runWithWait(new Runnable() { public void run() { listAppsFragment.xposedNotify = true; if (((!Utils.checkCoreJarPatch11()) || (!Utils.checkCoreJarPatch12())) && ((Utils.exists("/system/framework/core.jar.jex")) || (Utils.exists("/system/framework/core-libart.jar.jex")) || (Utils.exists("/system/framework/services.jar.jex")))) { listAppsFragment.this.showMessage(Utils.getText(2131165748), Utils.getText(2131165819)); return; }/*from w w w . j a va2 s.com*/ try { listAppsFragment.fileNotSpace = Utils.exists("/system/framework/not.space"); listAppsFragment.filePatch3 = Utils.exists("/system/framework/patch3.done"); listAppsFragment.this.runToMain(new Runnable() { public void run() { ArrayList localArrayList = new ArrayList(); localArrayList.add(new CoreItem(Utils.getText(2131165300), false)); localArrayList.add(new CoreItem(Utils.getText(2131165302), false)); localArrayList.add(new CoreItem(Utils.getText(2131165304), false)); localArrayList.add(new CoreItem(Utils.getText(2131165307), false)); localArrayList.add(new CoreItem(Utils.getText(2131165311), false)); localArrayList.add(new CoreItem(Utils.getText(2131165312), false)); if ((listAppsFragment.all_d != null) && (listAppsFragment.all_d.adapter != null)) { listAppsFragment.all_d.adapter.notifyDataSetChanged(); } listAppsFragment.removeDialogAll(24); listAppsFragment.showDialogAll(24, new ArrayAdapter(listAppsFragment.this.getContext(), 2130968605, localArrayList) { TextView txtStatus; TextView txtStatusPatch; TextView txtTitle; public View getView(int paramAnonymous3Int, View paramAnonymous3View, ViewGroup paramAnonymous3ViewGroup) { if (listAppsFragment.xposedNotify) { paramAnonymous3View = listAppsFragment.frag; listAppsFragment.patchAct.runOnUiThread(new Runnable() { public void run() { if (Utils.hasXposed()) { listAppsFragment.frag.showMessage(Utils.getText(2131165748), Utils.getText(2131165751)); } } }); listAppsFragment.xposedNotify = false; } Object localObject = (CoreItem) getItem(paramAnonymous3Int); paramAnonymous3ViewGroup = ((LayoutInflater) listAppsFragment.getInstance() .getSystemService("layout_inflater")).inflate(2130968607, paramAnonymous3ViewGroup, false); this.txtTitle = ((TextView) paramAnonymous3ViewGroup.findViewById(2131558483)); this.txtStatus = ((TextView) paramAnonymous3ViewGroup.findViewById(2131558484)); this.txtStatusPatch = ((TextView) paramAnonymous3ViewGroup .findViewById(2131558536)); this.txtTitle.setTextAppearance(getContext(), listAppsFragment.getSizeText()); this.txtStatus.setTextAppearance(getContext(), listAppsFragment.getSizeText()); this.txtStatusPatch.setTextAppearance(getContext(), listAppsFragment.getSizeText()); paramAnonymous3View = (CheckBox) paramAnonymous3ViewGroup .findViewById(2131558535); paramAnonymous3View.setChecked(((CoreItem) localObject).Status); if (paramAnonymous3Int == 3) { paramAnonymous3View.setVisibility(8); paramAnonymous3View.setChecked(false); } if (paramAnonymous3Int == 0) { if (!Utils.checkCoreJarPatch11()) { break label716; } int i = 0; if (Utils.checkCoreJarPatch11()) { i = 0 + 1; } int j = i; if (Utils.checkCoreJarPatch12()) { j = i + 1; } if (j == 2) { paramAnonymous3View.setEnabled(false); ((CoreItem) localObject).disabled = true; this.txtStatusPatch.setText("2/2 " + Utils.getText(2131165372)); } if (j == 1) { this.txtStatusPatch.setText("1/2 " + Utils.getText(2131165372)); } } if (paramAnonymous3Int == 1) { if (Utils.checkCoreJarPatch20()) { paramAnonymous3View.setEnabled(false); ((CoreItem) localObject).disabled = true; this.txtStatusPatch.setText(Utils.getText(2131165372)); } } else { label330: if (paramAnonymous3Int == 2) { if ((!listAppsFragment.filePatch3) && (!Utils.checkCoreJarPatch30(listAppsFragment.getPkgMng()))) { break label788; } paramAnonymous3View.setEnabled(false); ((CoreItem) localObject).disabled = true; this.txtStatusPatch.setText(Utils.getText(2131165372)); } label373: if (paramAnonymous3Int == 3) { paramAnonymous3View.setEnabled(false); if ((!listAppsFragment.filePatch3) && (!Utils.checkCoreJarPatch40())) { break label824; } paramAnonymous3View.setEnabled(false); paramAnonymous3ViewGroup.setEnabled(false); ((CoreItem) localObject).disabled = true; this.txtStatusPatch.setText(Utils.getText(2131165372)); label423: this.txtStatusPatch.append(Utils.getColoredText( "\n" + Utils.getText(2131165310), "#FF0000", "normal")); } if (paramAnonymous3Int == 4) { localObject = Utils.getText(2131165314); this.txtStatusPatch.setText(Utils.getColoredText((String) localObject, "#ff888888", "italic")); } if (paramAnonymous3Int == 5) { localObject = Utils.getText(2131165313); this.txtStatusPatch.setText(Utils.getColoredText((String) localObject, "#ff888888", "italic")); } paramAnonymous3View.setClickable(false); this.txtStatus.setTextAppearance(getContext(), 16973894); this.txtStatus.setTextColor(-7829368); this.txtTitle.setTextColor(-1); this.txtTitle.setText(((CoreItem) getItem(paramAnonymous3Int)).Name); this.txtTitle.setTypeface(null, 1); paramAnonymous3View = ((CoreItem) getItem(paramAnonymous3Int)).Name; if ((paramAnonymous3Int != 0) && (paramAnonymous3Int != 1)) { break label860; } this.txtTitle.setText( Utils.getColoredText(paramAnonymous3View, "#ff00ff00", "bold")); } for (;;) { if (paramAnonymous3Int == 0) { paramAnonymous3View = Utils.getText(2131165301); } if (paramAnonymous3Int == 1) { paramAnonymous3View = Utils.getText(2131165303); } if (paramAnonymous3Int == 2) { paramAnonymous3View = Utils.getText(2131165305) + "\n" + Utils.getText(2131165306); } if (paramAnonymous3Int == 3) { paramAnonymous3View = Utils.getText(2131165308); } if (paramAnonymous3Int == 4) { paramAnonymous3View = ""; } if (paramAnonymous3Int == 5) { paramAnonymous3View = ""; } this.txtStatus.append( Utils.getColoredText(paramAnonymous3View, "#ff888888", "italic")); return paramAnonymous3ViewGroup; label716: if (listAppsFragment.fileNotSpace) { this.txtStatusPatch.setText(Utils.getText(2131165374)); break; } this.txtStatusPatch.setText(Utils.getText(2131165373)); break; if (listAppsFragment.fileNotSpace) { this.txtStatusPatch.setText(Utils.getText(2131165374)); break label330; } this.txtStatusPatch.setText(Utils.getText(2131165373)); break label330; label788: if (listAppsFragment.fileNotSpace) { this.txtStatusPatch.setText(Utils.getText(2131165374)); break label373; } this.txtStatusPatch.setText(Utils.getText(2131165373)); break label373; label824: if (listAppsFragment.fileNotSpace) { this.txtStatusPatch.setText(Utils.getText(2131165374)); break label423; } this.txtStatusPatch.setText(Utils.getText(2131165373)); break label423; label860: if ((paramAnonymous3Int == 4) || (paramAnonymous3Int == 5)) { this.txtTitle.setText( Utils.getColoredText(paramAnonymous3View, "#ffff0000", "bold")); } else { this.txtTitle.setText( Utils.getColoredText(paramAnonymous3View, "#ff00ff00", "bold")); } } } }); listAppsFragment.removeDialogLP(11); } }); return; } catch (Exception localException) { System.out.println("LuckyPatcher: handler Null."); } } }); System.out.println("LuckyPatcher: Start core.jar test!"); }