public void setAlpha(float f) {
   if (AnimatorProxy.NEEDS_PROXY) {
     this.mProxy.setAlpha(f);
   } else {
     super.setAlpha(f);
   }
 }
  /** Setup the tab host and create all necessary tabs. */
  @Override
  protected void onFinishInflate() {
    // Setup the tab host
    setup();

    final ViewGroup tabsContainer = (ViewGroup) findViewById(R.id.tabs_container);
    final TabWidget tabs = getTabWidget();
    final AppsCustomizePagedView appsCustomizePane =
        (AppsCustomizePagedView) findViewById(R.id.apps_customize_pane_content);
    mTabs = tabs;
    mTabsContainer = tabsContainer;
    mAppsCustomizePane = appsCustomizePane;
    mAnimationBuffer = (FrameLayout) findViewById(R.id.animation_buffer);
    mContent = (LinearLayout) findViewById(R.id.apps_customize_content);
    LayoutParams params = (LayoutParams) mContent.getLayoutParams();
    params.topMargin += Utils.getStatusBarSize(getResources());
    mContent.setLayoutParams(params);
    if (tabs == null || mAppsCustomizePane == null) throw new Resources.NotFoundException();

    // Configure the tabs content factory to return the same paged view (that we change the
    // content filter on)
    TabContentFactory contentFactory =
        new TabContentFactory() {
          public View createTabContent(String tag) {
            return appsCustomizePane;
          }
        };

    // Create the tabs
    TextView tabView;
    String label;
    label = getContext().getString(R.string.all_apps_button_label);
    tabView = (TextView) mLayoutInflater.inflate(R.layout.tab_widget_indicator, tabs, false);
    tabView.setText(label);
    tabView.setContentDescription(label);
    addTab(newTabSpec(APPS_TAB_TAG).setIndicator(tabView).setContent(contentFactory));
    label = getContext().getString(R.string.widgets_tab_label);
    tabView = (TextView) mLayoutInflater.inflate(R.layout.tab_widget_indicator, tabs, false);
    tabView.setText(label);
    tabView.setContentDescription(label);
    addTab(newTabSpec(WIDGETS_TAB_TAG).setIndicator(tabView).setContent(contentFactory));
    setOnTabChangedListener(this);

    // Setup the key listener to jump between the last tab view and the market icon
    AppsCustomizeTabKeyEventListener keyListener = new AppsCustomizeTabKeyEventListener();
    View lastTab = tabs.getChildTabViewAt(tabs.getTabCount() - 1);
    lastTab.setOnKeyListener(keyListener);
    View shopButton = findViewById(R.id.market_button);
    shopButton.setOnKeyListener(keyListener);

    // Hide the tab bar until we measure
    mTabsContainer.setAlpha(0f);
  }
  public boolean showNotification(NotificationData.Entry headsUp) {
    if (mHeadsUp != null && headsUp != null && !mHeadsUp.key.equals(headsUp.key)) {
      // bump any previous heads up back to the shade
      release();
    }

    mHeadsUp = headsUp;
    if (mContentHolder != null) {
      mContentHolder.removeAllViews();
    }

    if (mHeadsUp != null) {
      mMostRecentPackageName = mHeadsUp.notification.getPackageName();
      mHeadsUp.row.setSystemExpanded(true);
      mHeadsUp.row.setSensitive(false);
      mHeadsUp.row.setHeadsUp(true);
      mHeadsUp.row.setHideSensitive(false, false /* animated */, 0 /* delay */, 0 /* duration */);
      if (mContentHolder == null) {
        // too soon!
        return false;
      }
      mContentHolder.setX(0);
      mContentHolder.setVisibility(View.VISIBLE);
      mContentHolder.setAlpha(mMaxAlpha);
      mContentHolder.addView(mHeadsUp.row);
      sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED);

      mSwipeHelper.snapChild(mContentHolder, 1f);
      mStartTouchTime = SystemClock.elapsedRealtime() + mTouchSensitivityDelay;

      mHeadsUp.setInterruption();

      // 2. Animate mHeadsUpNotificationView in
      mBar.scheduleHeadsUpOpen(
          TextUtils.equals(
              mHeadsUp.notification.getNotification().category, Notification.CATEGORY_CALL));

      // 3. Set alarm to age the notification off
      mBar.resetHeadsUpDecayTimer();
    }
    return true;
  }
示例#4
0
  private void updateRenderLocally(boolean renderLocally) {
    if (mRenderLocally == renderLocally) {
      return;
    }

    mRenderLocally = renderLocally;

    final View uiContainer = findViewById(R.id.container);
    final ViewGroup localRenderContainer = (ViewGroup) findViewById(R.id.local_render_container);

    FragmentManager fm = getSupportFragmentManager();
    Fragment localRenderFragment = fm.findFragmentById(R.id.local_render_container);
    if (mRenderLocally) {
      if (localRenderFragment == null) {
        fm.beginTransaction()
            .add(R.id.local_render_container, MuzeiRendererFragment.createInstance(false, false))
            .commit();
      }
      if (localRenderContainer.getAlpha() == 1) {
        localRenderContainer.setAlpha(0);
      }
      localRenderContainer.setVisibility(View.VISIBLE);
      localRenderContainer.animate().alpha(1).setDuration(2000).withEndAction(null);
      uiContainer.setBackgroundColor(0x00000000); // for ripple touch feedback
    } else {
      if (localRenderFragment != null) {
        fm.beginTransaction().remove(localRenderFragment).commit();
      }
      localRenderContainer
          .animate()
          .alpha(0)
          .setDuration(1000)
          .withEndAction(
              new Runnable() {
                @Override
                public void run() {
                  localRenderContainer.setVisibility(View.GONE);
                }
              });
      uiContainer.setBackground(null);
    }
  }
    /**
     * Shows this popup at the specified coordinates. The specified coordinates may be adjusted to
     * make sure the popup is entirely on-screen.
     */
    public void show(int x, int y) {
      if (isShowing()) {
        return;
      }

      mHidden = false;
      mDismissed = false;
      cancelDismissAndHideAnimations();
      cancelOverflowAnimations();
      // Make sure a panel is set as the content.
      if (mContentContainer.getChildCount() == 0) {
        setMainPanelAsContent();
        // If we're yet to show the popup, set the container visibility to zero.
        // The "show" animation will make this visible.
        mContentContainer.setAlpha(0);
      }
      preparePopupContent();
      mPopupWindow.showAtLocation(mParent, Gravity.NO_GRAVITY, x, y);
      setTouchableSurfaceInsetsComputer();
      runShowAnimation();
    }
 @Override
 public void onDragCancelled(View v) {
   mContentHolder.setAlpha(mMaxAlpha); // sometimes this isn't quite reset
 }
示例#7
0
  protected void showOperation(int positionY) {
    final MagazineLoaderActivity activity = (MagazineLoaderActivity) context;
    int height = activity.getWindowManager().getDefaultDisplay().getHeight();
    int width = activity.getWindowManager().getDefaultDisplay().getWidth();
    final ViewGroup floatLayer =
        (ViewGroup) activity.getLayoutInflater().inflate(R.layout.topmenu, null);
    floatLayer.setVisibility(View.VISIBLE);
    floatLayer.setBackgroundColor(Color.BLACK);
    floatLayer.setAlpha((float) 0.5);
    ImageButton backhomeBtn = (ImageButton) floatLayer.findViewById(R.id.backHomeBtn);
    backhomeBtn.setOnClickListener(
        new View.OnClickListener() {

          @Override
          public void onClick(View v) {
            activity.finish();
          }
        });
    ImageButton categoryBtn = (ImageButton) floatLayer.findViewById(R.id.catetoryBtn);
    categoryBtn.setOnClickListener(
        new View.OnClickListener() {

          private Gallery gallery;

          @Override
          public void onClick(View v) {
            //				gallery=(Gallery) floatLayer.findViewById(R.id.gallery1);
            //				gallery=new Gallery(activity);
            //				gallery.setAdapter(new MagazinePageAdapter(activity, activity.getMagazine()));
            //				gallery.setVisibility(View.VISIBLE);
            GalleryPageView pageView = new GalleryPageView(activity);
            floatLayer.addView(pageView);
          }
        });
    int position = (positionY / height) * height;
    LayoutParams params = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    params.setMargins(0, position, 0, 0);
    params.height = height;
    params.width = width;
    params.width = activity.getWindowManager().getDefaultDisplay().getWidth();
    floatLayer.setClickable(true);
    floatLayer.setOnTouchListener(
        new OnTouchListener() {

          @Override
          public boolean onTouch(View v, MotionEvent event) {
            v.getParent().requestDisallowInterceptTouchEvent(true);
            if (event.getAction() == MotionEvent.ACTION_UP) {
              int childCount = floatLayer.getChildCount();
              for (int i = 0; i < childCount; i++) {
                View child = floatLayer.getChildAt(i);
                if (child instanceof GalleryPageView) {
                  GalleryPageView pager = (GalleryPageView) child;
                  pager.recycle();
                }
              }
              floatLayer.setVisibility(View.GONE);
            }
            return false;
          }
        });
    getFrameLayout().addView(floatLayer, params);
  }