Java Code Examples for android.view.ViewManager

The following are top voted examples for showing how to use android.view.ViewManager. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: ProgressManager   File: a.java   View source code 5 votes vote down vote up
void makeVisible() {
    if (!mWindowAdded) {
        ViewManager wm = getWindowManager();
        wm.addView(mDecor, getWindow().getAttributes());
        mWindowAdded = true;
    }
    mDecor.setVisibility(View.VISIBLE);
}
 
Example 2
Project: ProgressManager   File: a.java   View source code 5 votes vote down vote up
void makeVisible() {
    if (!mWindowAdded) {
        ViewManager wm = getWindowManager();
        wm.addView(mDecor, getWindow().getAttributes());
        mWindowAdded = true;
    }
    mDecor.setVisibility(View.VISIBLE);
}
 
Example 3
Project: ProgressManager   File: a.java   View source code 5 votes vote down vote up
void makeVisible() {
    if (!mWindowAdded) {
        ViewManager wm = getWindowManager();
        wm.addView(mDecor, getWindow().getAttributes());
        mWindowAdded = true;
    }
    mDecor.setVisibility(View.VISIBLE);
}
 
Example 4
Project: ProgressManager   File: a.java   View source code 5 votes vote down vote up
void makeVisible() {
    if (!mWindowAdded) {
        ViewManager wm = getWindowManager();
        wm.addView(mDecor, getWindow().getAttributes());
        mWindowAdded = true;
    }
    mDecor.setVisibility(View.VISIBLE);
}
 
Example 5
Project: ProgressManager   File: a.java   View source code 5 votes vote down vote up
void makeVisible() {
    if (!mWindowAdded) {
        ViewManager wm = getWindowManager();
        wm.addView(mDecor, getWindow().getAttributes());
        mWindowAdded = true;
    }
    mDecor.setVisibility(View.VISIBLE);
}
 
Example 6
Project: ProgressManager   File: a.java   View source code 5 votes vote down vote up
void makeVisible() {
    if (!mWindowAdded) {
        ViewManager wm = getWindowManager();
        wm.addView(mDecor, getWindow().getAttributes());
        mWindowAdded = true;
    }
    mDecor.setVisibility(View.VISIBLE);
}
 
Example 7
Project: ProgressManager   File: a.java   View source code 5 votes vote down vote up
void makeVisible() {
    if (!mWindowAdded) {
        ViewManager wm = getWindowManager();
        wm.addView(mDecor, getWindow().getAttributes());
        mWindowAdded = true;
    }
    mDecor.setVisibility(View.VISIBLE);
}
 
Example 8
Project: ProgressManager   File: a.java   View source code 5 votes vote down vote up
void makeVisible() {
    if (!mWindowAdded) {
        ViewManager wm = getWindowManager();
        wm.addView(mDecor, getWindow().getAttributes());
        mWindowAdded = true;
    }
    mDecor.setVisibility(View.VISIBLE);
}
 
Example 9
Project: ProgressManager   File: a.java   View source code 5 votes vote down vote up
void makeVisible() {
    if (!mWindowAdded) {
        ViewManager wm = getWindowManager();
        wm.addView(mDecor, getWindow().getAttributes());
        mWindowAdded = true;
    }
    mDecor.setVisibility(View.VISIBLE);
}
 
Example 10
Project: ProgressManager   File: a.java   View source code 5 votes vote down vote up
void makeVisible() {
    if (!mWindowAdded) {
        ViewManager wm = getWindowManager();
        wm.addView(mDecor, getWindow().getAttributes());
        mWindowAdded = true;
    }
    mDecor.setVisibility(View.VISIBLE);
}
 
Example 11
Project: ProgressManager   File: a.java   View source code 5 votes vote down vote up
void makeVisible() {
    if (!mWindowAdded) {
        ViewManager wm = getWindowManager();
        wm.addView(mDecor, getWindow().getAttributes());
        mWindowAdded = true;
    }
    mDecor.setVisibility(View.VISIBLE);
}
 
Example 12
Project: ProgressManager   File: a.java   View source code 5 votes vote down vote up
void makeVisible() {
    if (!mWindowAdded) {
        ViewManager wm = getWindowManager();
        wm.addView(mDecor, getWindow().getAttributes());
        mWindowAdded = true;
    }
    mDecor.setVisibility(View.VISIBLE);
}
 
Example 13
Project: ProgressManager   File: a.java   View source code 5 votes vote down vote up
void makeVisible() {
    if (!mWindowAdded) {
        ViewManager wm = getWindowManager();
        wm.addView(mDecor, getWindow().getAttributes());
        mWindowAdded = true;
    }
    mDecor.setVisibility(View.VISIBLE);
}
 
Example 14
Project: ProgressManager   File: a.java   View source code 5 votes vote down vote up
void makeVisible() {
    if (!mWindowAdded) {
        ViewManager wm = getWindowManager();
        wm.addView(mDecor, getWindow().getAttributes());
        mWindowAdded = true;
    }
    mDecor.setVisibility(View.VISIBLE);
}
 
Example 15
Project: xowa_android   File: ViewUtil.java   View source code 5 votes vote down vote up
public static boolean detach(@Nullable View view) {
    if (view != null && view.getParent() instanceof ViewManager) {
        ((ViewManager) view.getParent()).removeView(view);
        return true;
    }
    return false;
}
 
Example 16
Project: react-native-navigation   File: SharedElementTransition.java   View source code 5 votes vote down vote up
public void attachChildToSelf() {
    ((ViewManager) child.getParent()).removeView(child);
    child.setLeft(childLeft);
    child.setTop(childTop);
    restoreTextViewSpannedText();
    addView(child, new LayoutParams(childLayoutParams));
}
 
Example 17
Project: react-native-navigation   File: ContextualMenu.java   View source code 5 votes vote down vote up
public void dismiss() {
    hide(new Runnable() {
        @Override
        public void run() {
            ((ViewManager) getParent()).removeView(ContextualMenu.this);
        }
    });
    NavigationApplication.instance.getEventEmitter().sendNavigatorEvent("contextualMenuDismissed", navigatorEventId);
}
 
Example 18
Project: TapTargetView   File: ViewUtil.java   View source code 5 votes vote down vote up
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
  }
}
 
Example 19
Project: TheSceneryAlong   File: ToolTipView.java   View source code 5 votes vote down vote up
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();
    }
}
 
Example 20
Project: android-wheels   File: CommonUtils.java   View source code 5 votes vote down vote up
/**
 * 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;
    }
}
 
Example 21
Project: fleet   File: ViewGroups.java   View source code 5 votes vote down vote up
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));
}
 
Example 22
Project: fleet   File: ViewGroups.java   View source code 5 votes vote down vote up
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);
}
 
Example 23
Project: rpgpack-android   File: ToolTipView.java   View source code 5 votes vote down vote up
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();
    }
}
 
Example 24
Project: Augendiagnose   File: AdMarvelActivity.java   View source code 5 votes vote down vote up
/**
 * 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.
			}
		}
	});
}
 
Example 25
Project: overplayed   File: MenuActivity.java   View source code 5 votes vote down vote up
@SuppressWarnings("deprecation")
protected void onAttachedToWindow() {
	super.onAttachedToWindow();
	if (controller.active) controller.detach();
	controller.attach((ViewManager) drawview, MenuActivity.this);
	MenuActivity.this.showDialog(0, new Bundle());
}
 
Example 26
Project: overplayed   File: Controller.java   View source code 5 votes vote down vote up
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);
}
 
Example 27
Project: apps-android-wikipedia   File: ViewUtil.java   View source code 5 votes vote down vote up
public static boolean detach(@Nullable View view) {
    if (view != null && view.getParent() instanceof ViewManager) {
        ((ViewManager) view.getParent()).removeView(view);
        return true;
    }
    return false;
}
 
Example 28
Project: StreamRadio   File: SettingsDialog.java   View source code 4 votes vote down vote up
@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;
}
 
Example 29
Project: TheSceneryAlong   File: ToolTipView.java   View source code 4 votes vote down vote up
@Override
public void onAnimationEnd(final Animator animation) {
    if (getParent() != null) {
        ((ViewManager) getParent()).removeView(ToolTipView.this);
    }
}
 
Example 30
Project: knightsofalentejo   File: GameViewGLES2.java   View source code 4 votes vote down vote up
public ViewManager getParentViewManager() {
	return (ViewManager) getParent();
}
 
Example 31
Project: Triad   File: TriadDelegate.java   View source code 4 votes vote down vote up
@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);
}
 
Example 32
Project: Triad   File: TriadDelegate.java   View source code 4 votes vote down vote up
@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);
}
 
Example 33
Project: Triad   File: TriadDelegate.java   View source code 4 votes vote down vote up
@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);
}
 
Example 34
Project: droid-stealth   File: Utils.java   View source code 4 votes vote down vote up
/**
 * 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);
	}
}
 
Example 35
Project: rpgpack-android   File: ToolTipView.java   View source code 4 votes vote down vote up
@Override
public void onAnimationEnd(final Animator animation) {
    if (getParent() != null) {
        ((ViewManager) getParent()).removeView(ToolTipView.this);
    }
}
 
Example 36
Project: BAGO_TS   File: UserLogin.java   View source code 4 votes vote down vote up
@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;
	}
}
 
Example 37
Project: pickncrop   File: MainActivity.java   View source code 4 votes vote down vote up
@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;
		}
	});
}
 
Example 38
Project: ChariotGauge   File: BoostActivity.java   View source code 4 votes vote down vote up
@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);
    }

}
 
Example 39
Project: ChariotGauge   File: TwoGaugeActivity.java   View source code 4 votes vote down vote up
@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.
    }

}
 
Example 40
Project: ChariotGauge   File: TemperatureActivity.java   View source code 4 votes vote down vote up
@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);
    }

}