Java 类android.view.ViewManager 实例源码

项目:ProgressManager    文件:a.java   
void makeVisible() {
    if (!mWindowAdded) {
        ViewManager wm = getWindowManager();
        wm.addView(mDecor, getWindow().getAttributes());
        mWindowAdded = true;
    }
    mDecor.setVisibility(View.VISIBLE);
}
项目:ProgressManager    文件:a.java   
void makeVisible() {
    if (!mWindowAdded) {
        ViewManager wm = getWindowManager();
        wm.addView(mDecor, getWindow().getAttributes());
        mWindowAdded = true;
    }
    mDecor.setVisibility(View.VISIBLE);
}
项目:ProgressManager    文件:a.java   
void makeVisible() {
    if (!mWindowAdded) {
        ViewManager wm = getWindowManager();
        wm.addView(mDecor, getWindow().getAttributes());
        mWindowAdded = true;
    }
    mDecor.setVisibility(View.VISIBLE);
}
项目:ProgressManager    文件:a.java   
void makeVisible() {
    if (!mWindowAdded) {
        ViewManager wm = getWindowManager();
        wm.addView(mDecor, getWindow().getAttributes());
        mWindowAdded = true;
    }
    mDecor.setVisibility(View.VISIBLE);
}
项目:ProgressManager    文件:a.java   
void makeVisible() {
    if (!mWindowAdded) {
        ViewManager wm = getWindowManager();
        wm.addView(mDecor, getWindow().getAttributes());
        mWindowAdded = true;
    }
    mDecor.setVisibility(View.VISIBLE);
}
项目:ProgressManager    文件:a.java   
void makeVisible() {
    if (!mWindowAdded) {
        ViewManager wm = getWindowManager();
        wm.addView(mDecor, getWindow().getAttributes());
        mWindowAdded = true;
    }
    mDecor.setVisibility(View.VISIBLE);
}
项目:ProgressManager    文件:a.java   
void makeVisible() {
    if (!mWindowAdded) {
        ViewManager wm = getWindowManager();
        wm.addView(mDecor, getWindow().getAttributes());
        mWindowAdded = true;
    }
    mDecor.setVisibility(View.VISIBLE);
}
项目:ProgressManager    文件:a.java   
void makeVisible() {
    if (!mWindowAdded) {
        ViewManager wm = getWindowManager();
        wm.addView(mDecor, getWindow().getAttributes());
        mWindowAdded = true;
    }
    mDecor.setVisibility(View.VISIBLE);
}
项目:ProgressManager    文件:a.java   
void makeVisible() {
    if (!mWindowAdded) {
        ViewManager wm = getWindowManager();
        wm.addView(mDecor, getWindow().getAttributes());
        mWindowAdded = true;
    }
    mDecor.setVisibility(View.VISIBLE);
}
项目:ProgressManager    文件:a.java   
void makeVisible() {
    if (!mWindowAdded) {
        ViewManager wm = getWindowManager();
        wm.addView(mDecor, getWindow().getAttributes());
        mWindowAdded = true;
    }
    mDecor.setVisibility(View.VISIBLE);
}
项目:ProgressManager    文件:a.java   
void makeVisible() {
    if (!mWindowAdded) {
        ViewManager wm = getWindowManager();
        wm.addView(mDecor, getWindow().getAttributes());
        mWindowAdded = true;
    }
    mDecor.setVisibility(View.VISIBLE);
}
项目:ProgressManager    文件:a.java   
void makeVisible() {
    if (!mWindowAdded) {
        ViewManager wm = getWindowManager();
        wm.addView(mDecor, getWindow().getAttributes());
        mWindowAdded = true;
    }
    mDecor.setVisibility(View.VISIBLE);
}
项目:ProgressManager    文件:a.java   
void makeVisible() {
    if (!mWindowAdded) {
        ViewManager wm = getWindowManager();
        wm.addView(mDecor, getWindow().getAttributes());
        mWindowAdded = true;
    }
    mDecor.setVisibility(View.VISIBLE);
}
项目:ProgressManager    文件:a.java   
void makeVisible() {
    if (!mWindowAdded) {
        ViewManager wm = getWindowManager();
        wm.addView(mDecor, getWindow().getAttributes());
        mWindowAdded = true;
    }
    mDecor.setVisibility(View.VISIBLE);
}
项目:xowa_android    文件:ViewUtil.java   
public static boolean detach(@Nullable View view) {
    if (view != null && view.getParent() instanceof ViewManager) {
        ((ViewManager) view.getParent()).removeView(view);
        return true;
    }
    return false;
}
项目:react-native-navigation    文件:SharedElementTransition.java   
public void attachChildToSelf() {
    ((ViewManager) child.getParent()).removeView(child);
    child.setLeft(childLeft);
    child.setTop(childTop);
    restoreTextViewSpannedText();
    addView(child, new LayoutParams(childLayoutParams));
}
项目:react-native-navigation    文件:ContextualMenu.java   
public void dismiss() {
    hide(new Runnable() {
        @Override
        public void run() {
            ((ViewManager) getParent()).removeView(ContextualMenu.this);
        }
    });
    NavigationApplication.instance.getEventEmitter().sendNavigatorEvent("contextualMenuDismissed", navigatorEventId);
}
项目:TapTargetView    文件:ViewUtil.java   
static void removeView(ViewManager parent, View child) {
  if (parent == null || child == null) {
    return;
  }

  try {
    parent.removeView(child);
  } catch (Exception ignored) {
    // This catch exists for modified versions of Android that have a buggy ViewGroup
    // implementation. See b.android.com/77639, #121 and #49
  }
}
项目:TheSceneryAlong    文件:ToolTipView.java   
public void remove() {
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
        RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) getLayoutParams();
        setX(params.leftMargin);
        setY(params.topMargin);
        params.leftMargin = 0;
        params.topMargin = 0;
        setLayoutParams(params);
    }

    if (mToolTip.getAnimationType() == ToolTip.AnimationType.NONE) {
        if (getParent() != null) {
            ((ViewManager) getParent()).removeView(this);
        }
    } else {
        Collection<Animator> animators = new ArrayList<Animator>(5);
        if (mToolTip.getAnimationType() == ToolTip.AnimationType.FROM_MASTER_VIEW) {
            animators.add(ObjectAnimator.ofInt(this, TRANSLATION_Y_COMPAT, (int) getY(), mRelativeMasterViewY + mView.getHeight() / 2 - getHeight() / 2));
            animators.add(ObjectAnimator.ofInt(this, TRANSLATION_X_COMPAT, (int) getX(), mRelativeMasterViewX + mView.getWidth() / 2 - mWidth / 2));
        } else {
            animators.add(ObjectAnimator.ofFloat(this, TRANSLATION_Y_COMPAT, getY(), 0));
        }

        animators.add(ObjectAnimator.ofFloat(this, SCALE_X_COMPAT, 1, 0));
        animators.add(ObjectAnimator.ofFloat(this, SCALE_Y_COMPAT, 1, 0));

        animators.add(ObjectAnimator.ofFloat(this, ALPHA_COMPAT, 1, 0));

        AnimatorSet animatorSet = new AnimatorSet();
        animatorSet.playTogether(animators);
        animatorSet.addListener(new DisappearanceAnimatorListener());
        animatorSet.start();
    }
}
项目:android-wheels    文件:CommonUtils.java   
/**
 * Remove parent of specified {@link View}
 *
 * @return {@code true} if parent was removed, {@code false} otherwise
 */
public static boolean removeViewParent(@NonNull View view) {
    ViewParent parent = view.getParent();
    if (parent instanceof ViewManager) {
        ((ViewManager) parent).removeView(view);
        return true;
    } else {
        return false;
    }
}
项目:fleet    文件:ViewGroups.java   
public static void detach(final View view) {
    final ViewManager parent = (ViewManager) view.getParent();
    if (parent == null) {
        return;
    }

    parent.removeView(view);
    Views.resetLayoutParamsType(view, new ViewGroup.LayoutParams(0, 0));
}
项目:fleet    文件:ViewGroups.java   
public static void detach(final View view, final ViewGroup.LayoutParams layoutParams) {
    final ViewManager parent = (ViewManager) view.getParent();
    if (parent == null) {
        return;
    }

    parent.removeView(view);
    Views.resetLayoutParamsType(view, layoutParams);
}
项目:rpgpack-android    文件:ToolTipView.java   
public void remove() {
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
        RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) getLayoutParams();
        setX(params.leftMargin);
        setY(params.topMargin);
        params.leftMargin = 0;
        params.topMargin = 0;
        setLayoutParams(params);
    }

    if (mToolTip.getAnimationType() == ToolTip.AnimationType.NONE) {
        if (getParent() != null) {
            ((ViewManager) getParent()).removeView(this);
        }
    } else {
        Collection<Animator> animators = new ArrayList<>(5);
        if (mToolTip.getAnimationType() == ToolTip.AnimationType.FROM_MASTER_VIEW) {
            animators.add(ObjectAnimator.ofInt(this, TRANSLATION_Y_COMPAT, (int) getY(), mRelativeMasterViewY + mView.getHeight() / 2 - getHeight() / 2));
            animators.add(ObjectAnimator.ofInt(this, TRANSLATION_X_COMPAT, (int) getX(), mRelativeMasterViewX + mView.getWidth() / 2 - mWidth / 2));
        } else {
            animators.add(ObjectAnimator.ofFloat(this, TRANSLATION_Y_COMPAT, getY(), 0));
        }

        animators.add(ObjectAnimator.ofFloat(this, SCALE_X_COMPAT, 1, 0));
        animators.add(ObjectAnimator.ofFloat(this, SCALE_Y_COMPAT, 1, 0));

        animators.add(ObjectAnimator.ofFloat(this, ALPHA_COMPAT, 1, 0));

        AnimatorSet animatorSet = new AnimatorSet();
        animatorSet.playTogether(animators);
        animatorSet.addListener(new DisappearanceAnimatorListener());
        animatorSet.start();
    }
}
项目:Augendiagnose    文件:AdMarvelActivity.java   
/**
 * Delete the ad view.
 */
private void deleteAdMarvelView() {
    runOnUiThread(new Runnable() {
        @Override
        public void run() {
            try {
                ((ViewManager) mAdMarvelView.getParent()).removeView(mAdMarvelView);
            }
            catch (Exception e) {
                // do nothing.
            }
        }
    });
}
项目:overplayed    文件:MenuActivity.java   
@SuppressWarnings("deprecation")
protected void onAttachedToWindow() {
    super.onAttachedToWindow();
    if (controller.active) controller.detach();
    controller.attach((ViewManager) drawview, MenuActivity.this);
    MenuActivity.this.showDialog(0, new Bundle());
}
项目:overplayed    文件:Controller.java   
public void attach(ViewManager wm, Context context) {
    this.wm = wm;
    // Add the buttons so when we activate the controller we don't
    // get an exception
    /*
     * if (!customize) { wm.addView(hideButton, hideButton.params);
     * wm.addView(alphaButton, alphaButton.params); wm.addView(stopButton,
     * stopButton.params); }
     */
    setActive(context);
}
项目:apps-android-wikipedia    文件:ViewUtil.java   
public static boolean detach(@Nullable View view) {
    if (view != null && view.getParent() instanceof ViewManager) {
        ((ViewManager) view.getParent()).removeView(view);
        return true;
    }
    return false;
}
项目:StreamRadio    文件:SettingsDialog.java   
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
  View view;
  if (settingsType == SettingsType.EditChannel)
  {
    getDialog().setTitle(R.string.channels);
    view = inflater.inflate(R.layout.fragment_edit, container);
    Button saveButton = (Button) view.findViewById(R.id.saveButton);
    saveButton.setOnClickListener(this);
    this.channelName = (EditText) view.findViewById(R.id.channelName);
    this.channelUrl = (EditText) view.findViewById(R.id.channelUrl);
    this.channelIcon = (Spinner) view.findViewById(R.id.channelIconSpinner);
    SimpleArrayAdapter channelAdapter = new SimpleArrayAdapter(inflater.getContext());
    channelIcon.setAdapter(channelAdapter);
    channelAdapter.add(new WebRadioChannel("[e] Electro",""));
    channelAdapter.add(new WebRadioChannel("[r] Rock",""));
    channelAdapter.add(new WebRadioChannel("[o] Oldies",""));
    channelAdapter.add(new WebRadioChannel("[c] Classic",""));
    channelAdapter.add(new WebRadioChannel("[j] Jazz",""));
    channelAdapter.add(new WebRadioChannel("[u] Undef",""));

    WebRadioChannel selChannel = ChannelList.getInstance().getSelectedChannel();
    if (selChannel != null)
    {
      channelName.setText(selChannel.getName());
      channelUrl.setText(selChannel.getUrl());
    }
  }
  else
  {
    getDialog().setTitle(R.string.settings);
    view = inflater.inflate(R.layout.fragment_settings, container);
    Button addButton = (Button) view.findViewById(R.id.addChannel);
    if (settingsType==SettingsType.Main) { ((ViewManager)view).removeView(addButton); }
    Button editButton = (Button) view.findViewById(R.id.editChannel);
    if (settingsType!=SettingsType.CustomChannel) { ((ViewManager)view).removeView(editButton); }
    Button editCsButton = (Button) view.findViewById(R.id.editChannels);
    if (settingsType!=SettingsType.Main) { ((ViewManager)view).removeView(editCsButton); }
    Button rmButton = (Button) view.findViewById(R.id.rmChannel);
    if (settingsType!=SettingsType.CustomChannel) { ((ViewManager)view).removeView(rmButton); }
    Button aboutButton = (Button) view.findViewById(R.id.about);
    if (settingsType!=SettingsType.Main) { ((ViewManager)view).removeView(aboutButton); }
    else { aboutButton.setText(R.string.about); }
    addButton.setOnClickListener(this);
    editButton.setOnClickListener(this);
    editCsButton.setOnClickListener(this);
    rmButton.setOnClickListener(this);
    aboutButton.setOnClickListener(this);
    view.forceLayout();
  }
  return view;
}
项目:TheSceneryAlong    文件:ToolTipView.java   
@Override
public void onAnimationEnd(final Animator animation) {
    if (getParent() != null) {
        ((ViewManager) getParent()).removeView(ToolTipView.this);
    }
}
项目:knightsofalentejo    文件:GameViewGLES2.java   
public ViewManager getParentViewManager() {
    return (ViewManager) getParent();
}
项目:Triad    文件:TriadDelegate.java   
@Override
public void forward(@NonNull final Screen<ApplicationComponent> newScreen, @Nullable final TransitionAnimator animator, @NonNull final Triad.Callback callback) {
    checkState(rootView != null, "Root view is null. Make sure to call TriadDelegate.onCreate().");

    final View oldView = rootView.getChildAt(0);
    final Screen<ApplicationComponent> oldScreen = currentScreen;
    if (oldView != null && oldScreen != null) {
        oldScreen.saveState(oldView);
    }

    currentScreen = newScreen;
    final View newView = newScreen.createView(rootView);

    boolean handled = false;
    if (animator != null) {
        handled = animator.forward(oldView, newView, rootView, new Callback() {
            @Override
            public void onComplete() {
                newScreen.onAttach(activity);

                if (oldView != null && oldView.getParent() != null) {
                    ((ViewManager) oldView.getParent()).removeView(oldView);
                }

                if (oldScreen != null) {
                    oldScreen.onDetach(activity);
                }

                callback.onComplete();
            }
        });
    }

    if (!handled) {
        defaultTransitionAnimator.forward(oldView, newView, rootView, new Callback() {
            @Override
            public void onComplete() {
                newScreen.onAttach(activity);

                if (oldScreen != null) {
                    oldScreen.onDetach(activity);
                }

                callback.onComplete();
            }
        });
    }

    onScreenChanged(newScreen);
}
项目:Triad    文件:TriadDelegate.java   
@Override
public void backward(@NonNull final Screen<ApplicationComponent> newScreen, @Nullable final TransitionAnimator animator, @NonNull final Triad.Callback callback) {
    checkState(rootView != null, "Root view is null. Make sure to call TriadDelegate.onCreate().");

    final Screen<ApplicationComponent> oldScreen = currentScreen;
    currentScreen = newScreen;

    final View oldView = rootView.getChildAt(0);
    final View newView = newScreen.createView(rootView);
    newScreen.restoreState(newView);


    boolean handled = false;
    if (animator != null) {
        handled = animator.backward(oldView, newView, rootView, new Callback() {
            @Override
            public void onComplete() {
                newScreen.onAttach(activity);

                if (oldView != null && oldView.getParent() != null) {
                    ((ViewManager) oldView.getParent()).removeView(oldView);
                }

                if (oldScreen != null) {
                    oldScreen.onDetach(activity);
                }

                callback.onComplete();
            }
        });
    }

    if (!handled) {
        defaultTransitionAnimator.backward(oldView, newView, rootView, new Callback() {
            @Override
            public void onComplete() {
                newScreen.onAttach(activity);

                if (oldScreen != null) {
                    oldScreen.onDetach(activity);
                }

                callback.onComplete();
            }
        });
    }

    onScreenChanged(newScreen);
}
项目:Triad    文件:TriadDelegate.java   
@Override
public void replace(@NonNull final Screen<ApplicationComponent> newScreen, @Nullable final TransitionAnimator animator, @NonNull final Triad.Callback callback) {
    checkState(rootView != null, "Root view is null. Make sure to call TriadDelegate.onCreate().");

    final Screen<ApplicationComponent> oldScreen = currentScreen;
    currentScreen = newScreen;

    final View oldView = rootView.getChildAt(0);
    final View newView = newScreen.createView(rootView);

    boolean handled = false;
    if (animator != null) {
        handled = animator.forward(oldView, newView, rootView, new Callback() {
            @Override
            public void onComplete() {
                newScreen.onAttach(activity);

                if (oldView != null && oldView.getParent() != null) {
                    ((ViewManager) oldView.getParent()).removeView(oldView);
                }

                if (oldScreen != null) {
                    oldScreen.onDetach(activity);
                }

                callback.onComplete();
            }
        });
    }

    if (!handled) {
        defaultTransitionAnimator.forward(oldView, newView, rootView, new Callback() {
            @Override
            public void onComplete() {
                newScreen.onAttach(activity);

                if (oldScreen != null) {
                    oldScreen.onDetach(activity);
                }

                callback.onComplete();
            }
        });
    }

    onScreenChanged(newScreen);
}
项目:droid-stealth    文件:Utils.java   
/**
 * Remove a view from a layout
 *
 * @param v the view to remove
 */
public static void remove(View v) {
    if (v.getParent() != null) {
        ((ViewManager) v.getParent()).removeView(v);
    }
}
项目:rpgpack-android    文件:ToolTipView.java   
@Override
public void onAnimationEnd(final Animator animation) {
    if (getParent() != null) {
        ((ViewManager) getParent()).removeView(ToolTipView.this);
    }
}
项目:BAGO_TS    文件:UserLogin.java   
@Override
public void onClick(View btn_each) {
    switch(btn_each.getId()){
    case R.id.btn_find:
        Intent find = new Intent(UserLogin.this, TS_Find_Web.class);
        startActivity(find);
        break;
    case R.id.btn_login:
        LayoutInflater inflater=getLayoutInflater();
        View layout=(View)inflater.inflate(R.layout.ts_show_load_dlg, null);
        WindowManager wm = (WindowManager)getSystemService(Context.WINDOW_SERVICE);
        Display display = wm.getDefaultDisplay();
        addContentView(layout,new LinearLayout.LayoutParams(display.getWidth(),display.getHeight()));

        //Login ����
        String cs_email = email.getText().toString();
        String cs_pwd = pwd.getText().toString();
        if(cs_email.equals("") || cs_pwd.equals("")){
            Toast.makeText(this, "�Էµ��� ���� �κ��� �ֽ��ϴ�.", Toast.LENGTH_SHORT).show();
            ((ViewManager) layout.getParent()).removeView(layout);              
        }
        else
        {
            if(SignIn()==300){
                Intent login = new Intent(UserLogin.this, BAGO_Instruction.class);
                startActivity(login);
                finish();
            }
            else
            {
                Toast.makeText(this, "�Է� ������ �ùٸ��� �ʽ��ϴ�.", Toast.LENGTH_SHORT).show();
                ((ViewManager) layout.getParent()).removeView(layout);
            }
        }
        break;
    case R.id.btn_signup:
        Intent signup = new Intent(UserLogin.this, TS_SignUp.class);
        startActivity(signup);
        break;
    }
}
项目:pickncrop    文件:MainActivity.java   
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Display display = getWindowManager().getDefaultDisplay();
    int width = display.getWidth();
    int height = display.getHeight();
    size = width < height ? width : height;
    size -= 50;

    imageView = (ImageView) findViewById(R.id.imageViewCrop);
    imageView.getLayoutParams().width = size;
    imageView.getLayoutParams().height = size;
    viewManager = (ViewManager) imageView.getParent();

    if (getPackageManager().hasSystemFeature(
            PackageManager.FEATURE_TOUCHSCREEN_MULTITOUCH)) {
        createZoomControls();
    }

    imageView.setOnTouchListener(new OnTouchListener() {
        float initX;
        float initY;
        float midX;
        float midY;
        float scale;
        float initDistance;
        float currentDistance;
        boolean isMultitouch = false;

        public boolean onTouch(View v, MotionEvent event) {
            switch (event.getAction() & MotionEvent.ACTION_MASK) {
            case MotionEvent.ACTION_DOWN:
                initX = event.getX();
                initY = event.getY();
                break;
            case MotionEvent.ACTION_POINTER_DOWN:
                isMultitouch = true;
                initDistance = (float) Math.sqrt(Math.pow(
                        initX - event.getX(1), 2)
                        + Math.pow(initY - event.getY(1), 2));
                break;
            case MotionEvent.ACTION_MOVE:
                if (isMultitouch) {
                    matrix = imageView.getImageMatrix();
                    currentDistance = (float) Math.sqrt(Math.pow(initX
                            - event.getX(1), 2)
                            + Math.pow(initY - event.getY(1), 2));
                    scale = 1 + 0.001f * (currentDistance - initDistance);
                    midX = 0.5f * (initX + event.getX(1));
                    midY = 0.5f * (initY + event.getY(1));
                    matrix.postScale(scale, scale, midX, midY);
                    imageView.setImageMatrix(matrix);
                    imageView.invalidate();
                } else {
                    imageView.scrollBy((int) (initX - event.getX()),
                            (int) (initY - event.getY()));
                    initX = event.getX();
                    initY = event.getY();
                }
                break;
            case MotionEvent.ACTION_UP:
                isMultitouch = false;
                break;
            case MotionEvent.ACTION_POINTER_UP:
                isMultitouch = false;
                break;
            }
            return true;
        }
    });
}
项目:ChariotGauge    文件:BoostActivity.java   
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.gauge_layout);
    getWindow().addFlags(LayoutParams.FLAG_KEEP_SCREEN_ON);
    context = this;
    prefsInit(); //Load up the preferences.

    //Instantiate the gaugeBuilder.
    analogGauge     = (GaugeBuilder) findViewById(R.id.analogGauge);
    txtViewDigital  = (TextView) findViewById(R.id.txtViewDigital); 
    txtViewVolts    = (TextView) findViewById(R.id.txtViewVolts);
    txtViewVoltsText= (TextView) findViewById(R.id.txtViewVoltsText);
    multiGauge      = new MultiGauges(context);
    multiGaugeVolts = new MultiGauges(context);
    btnOne          = (ImageButton) findViewById(R.id.btnOne);
    btnTwo          = (ImageButton) findViewById(R.id.btnTwo);
    typeFaceDigital = Typeface.createFromAsset(getAssets(), "fonts/LetsGoDigital.ttf");

    //Set the font of the title text
    txtViewDigital.setTypeface(typeFaceDigital);
    txtViewVolts.setTypeface(typeFaceDigital);
    txtViewVoltsText.setTypeface(typeFaceDigital);

    //Setup gauge
    multiGauge.setAnalogGauge(analogGauge);
    multiGauge.buildGauge(CURRENT_TOKEN);
    multiGaugeVolts.buildGauge(VOLT_TOKEN);

    //Check if the gauge uses negative numbers or not.
    if(analogGauge.getAbsoluteNumbers()){ 
        txtViewDigital.setText(Float.toString(Math.abs(multiGauge.getMinValue())));
    }else{
        txtViewDigital.setText(Float.toString(multiGauge.getMinValue()));
    }

    //Get the mSerialService object from the UI activity.
    Object obj = PassObject.getObject();
    //Assign it to global mSerialService variable in this activity.
    mSerialService = (BluetoothSerialService) obj;

    //Check if the serial service object is null - assign the handler.
    if(mSerialService != null){
        //Update the BluetoothSerialService instance's handler to this activities.
        mSerialService.setHandler(mHandler);
    }

    thread = new Thread(BoostActivity.this);
    thread.start();

    if(!showAnalog){
        ((ViewManager)analogGauge.getParent()).removeView(analogGauge); //Remove analog gauge
    }
    if(!showDigital){
        ((ViewManager)txtViewDigital.getParent()).removeView(txtViewDigital); //Remove digital gauge
    }
    if(showNightMode){
        root = btnOne.getRootView(); //Get root layer view.
        root.setBackgroundColor(getResources().getColor(R.color.black)); //Set background color to black.
        //((ViewManager)txtViewDigital.getParent()).removeView(txtViewDigital); //Remove digital gauge due to fading for now.
    }
    if(!showVoltMeter){
        root = btnOne.getRootView(); //Get root layer view.
        ((ViewManager)txtViewVolts.getParent()).removeView(txtViewVolts);
        ((ViewManager)txtViewVoltsText.getParent()).removeView(txtViewVoltsText);
    }

}
项目:ChariotGauge    文件:TwoGaugeActivity.java   
@Override
public void onCreate(Bundle savedInstanceState) {
    setContentView(R.layout.gauge_layout_2_landscape);
    super.onCreate(savedInstanceState);
    getWindow().addFlags(LayoutParams.FLAG_KEEP_SCREEN_ON);
    prefsInit(); //Load up the preferences.
    context = this;

    //Instantiate the GaugeBuilder.
    analogGauge1    = (GaugeBuilder) findViewById(R.id.analogGauge);
    analogGauge2    = (GaugeBuilder) findViewById(R.id.analogGauge2);
    multiGauge1     = new MultiGauges(context);
    multiGauge2     = new MultiGauges(context);
    txtViewDigital  = (TextView) findViewById(R.id.txtViewDigital);
    txtViewDigital2 = (TextView) findViewById(R.id.txtViewDigital2);
    btnOne          = (ImageButton) findViewById(R.id.btnOne);
    btnTwo          = (ImageButton) findViewById(R.id.btnTwo);  
    typeFaceDigital = Typeface.createFromAsset(getAssets(), "fonts/LetsGoDigital.ttf");

    //Set the font of the digital.
    txtViewDigital.setTypeface(typeFaceDigital);
    txtViewDigital2.setTypeface(typeFaceDigital);
    txtViewDigital.setText("0.00");
    txtViewDigital2.setText("0.00");

    //Setup gauge 1
    multiGauge1.setAnalogGauge(analogGauge1);
    multiGauge1.buildGauge(currentTokenOne);

    //Check if the gauge uses negative numbers or not.
    if(analogGauge1.getAbsoluteNumbers()){ 
        txtViewDigital.setText(Float.toString(Math.abs(multiGauge1.getMinValue())));
    }else{
        txtViewDigital.setText(Float.toString(multiGauge1.getMinValue()));
    }

    //Setup gauge 2
    multiGauge2.setAnalogGauge(analogGauge2);
    multiGauge2.buildGauge(currentTokenTwo);

    //Check if the gauge uses negative numbers or not.
    if(analogGauge2.getAbsoluteNumbers()){
        txtViewDigital2.setText(Float.toString(Math.abs(multiGauge2.getMinValue())));
    }else{
        txtViewDigital2.setText(Float.toString(multiGauge2.getMinValue()));
    }


    //Get the mSerialService object from the UI activity.
    Object obj = PassObject.getObject();
    //Assign it to global mSerialService variable in this activity.
    mSerialService = (BluetoothSerialService) obj;

    //Check if the serial service object is null - assign the handler.
    if(mSerialService != null){
        //Update the BluetoothSerialService instance's handler to this activities.
        mSerialService.setHandler(mHandler);
    }

    Thread thread = new Thread(TwoGaugeActivity.this);
    thread.start();

    if(!showAnalog){
        ((ViewManager)analogGauge1.getParent()).removeView(analogGauge1); //Remove analog gauge
        ((ViewManager)analogGauge2.getParent()).removeView(analogGauge2); //Remove analog gauge
    }
    if(!showDigital){
        ((ViewManager)txtViewDigital.getParent()).removeView(txtViewDigital); //Remove digital gauge
        ((ViewManager)txtViewDigital2.getParent()).removeView(txtViewDigital2); //Remove digital gauge
    }
    if(showNightMode){
        root = btnOne.getRootView();  //Get root layer view.
        root.setBackgroundColor(getResources().getColor(R.color.black)); //Set background color to black.
    }

}
项目:ChariotGauge    文件:TemperatureActivity.java   
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.gauge_layout);
    getWindow().addFlags(LayoutParams.FLAG_KEEP_SCREEN_ON);
    context = this;
    prefsInit(); //Load up the preferences.

    //Instantiate the gaugeBuilder.
    analogGauge     = (GaugeBuilder) findViewById(R.id.analogGauge);
    txtViewDigital  = (TextView) findViewById(R.id.txtViewDigital); 
    txtViewVolts    = (TextView) findViewById(R.id.txtViewVolts);
    txtViewVoltsText= (TextView) findViewById(R.id.txtViewVoltsText);
    multiGauge      = new MultiGauges(context);
    multiGaugeVolts = new MultiGauges(context);
    btnOne          = (ImageButton) findViewById(R.id.btnOne);
    btnTwo          = (ImageButton) findViewById(R.id.btnTwo);
    typeFaceDigital = Typeface.createFromAsset(getAssets(), "fonts/LetsGoDigital.ttf");

    //Set the font of the title text
    txtViewDigital.setTypeface(typeFaceDigital);
    txtViewVolts.setTypeface(typeFaceDigital);
    txtViewVoltsText.setTypeface(typeFaceDigital);

    //Setup gauge
    multiGauge.setAnalogGauge(analogGauge);
    multiGauge.buildGauge(CURRENT_TOKEN);
    multiGaugeVolts.buildGauge(VOLT_TOKEN);
    txtViewDigital.setText(Float.toString(multiGauge.getMinValue()));

    //Get the mSerialService object from the UI activity.
    Object obj = PassObject.getObject();
    //Assign it to global mSerialService variable in this activity.
    mSerialService = (BluetoothSerialService) obj;

    //Check if the serial service object is null - assign the handler.
    if(mSerialService != null){
        //Update the BluetoothSerialService instance's handler to this activities.
        mSerialService.setHandler(mHandler);
    }

    Thread thread = new Thread(TemperatureActivity.this);
    thread.start();

    if(!showAnalog){
        ((ViewManager)analogGauge.getParent()).removeView(analogGauge); //Remove analog gauge
    }
    if(!showDigital){
        ((ViewManager)txtViewDigital.getParent()).removeView(txtViewDigital); //Remove digital gauge
    }
    if(showNightMode){
        root = btnOne.getRootView(); //Get root layer view.
        root.setBackgroundColor(getResources().getColor(R.color.black)); //Set background color to black.
        //((ViewManager)txtViewDigital.getParent()).removeView(txtViewDigital); //Remove digital gauge due to fading for now.
    }
    if(!showVoltMeter){
        root = btnOne.getRootView(); //Get root layer view.
        ((ViewManager)txtViewVolts.getParent()).removeView(txtViewVolts);
        ((ViewManager)txtViewVoltsText.getParent()).removeView(txtViewVoltsText);
    }

}