public void onClick(View v, int position, int countitem) {
    ImageView selectedShip = ((MapBuilder) context).getSelectedShip();
    if (selectedShip != null) {
      ShipOnMap som = new ShipOnMap();
      RelativeLayout fl = (RelativeLayout) v;
      RelativeLayout.LayoutParams params =
          new RelativeLayout.LayoutParams(selectedShip.getWidth(), selectedShip.getHeight());
      som.start.x = x;
      som.start.y = y - v.getTop();
      som.time = (countitem - 1 - position) * 3 + 1;
      String[] shipinfo = ((String) selectedShip.getTag()).split(":");
      som.type = shipinfo[0];
      som.weapon = shipinfo[1];
      params.leftMargin = x - (selectedShip.getWidth() / 2);
      params.topMargin = y - v.getTop() - (selectedShip.getHeight() / 2);
      ImageView iv = new ImageView(context);
      iv.setImageDrawable(selectedShip.getDrawable());
      int h = fl.getHeight();
      int w = fl.getWidth();
      if (!ship.containsKey(position)) {
        ship.put(position, new LinkedList<ShipOnMap>());
      }

      som.ship = iv.getDrawable();
      som.param = params;
      List<ShipOnMap> lship = ship.get(position);
      lship.add(som);
      iv.setTag(position + "/" + (lship.size() - 1));
      ((MapBuilder) context).registerForContextMenu(iv);
      fl.addView(iv, params);
      fl.getLayoutParams().height = h;
      fl.getLayoutParams().width = w;
    }
  }
 public View newView(Context paramContext, Cursor paramCursor, ViewGroup paramViewGroup)
 {
   View localView = LayoutInflater.from(paramContext).inflate(2130903114, null);
   RelativeLayout localRelativeLayout1 = (RelativeLayout)localView.findViewById(2131361876);
   ViewGroup.LayoutParams localLayoutParams1 = localRelativeLayout1.getLayoutParams();
   localLayoutParams1.height = this.mDimen;
   localLayoutParams1.width = this.mDimen;
   localRelativeLayout1.setLayoutParams(localLayoutParams1);
   RelativeLayout localRelativeLayout2 = (RelativeLayout)localView.findViewById(2131361982);
   ViewGroup.LayoutParams localLayoutParams2 = localRelativeLayout2.getLayoutParams();
   localLayoutParams2.width = this.mDimen;
   localRelativeLayout2.setLayoutParams(localLayoutParams2);
   ImageView localImageView = (ImageView)localView.findViewById(2131361974);
   ViewGroup.LayoutParams localLayoutParams3 = localImageView.getLayoutParams();
   localLayoutParams3.width = this.mDimen;
   localLayoutParams3.height = this.mDimen;
   localImageView.setLayoutParams(localLayoutParams3);
   FeedViewHolder localFeedViewHolder = new FeedViewHolder(localView);
   localFeedViewHolder.videoView = ((SdkVideoView)localView.findViewById(2131361878));
   localFeedViewHolder.listener = new OnListVideoClickListener(this);
   localFeedViewHolder.likers.setMovementMethod(LinkMovementMethod.getInstance());
   localView.findViewById(2131361876).setOnClickListener(localFeedViewHolder.listener);
   localView.setTag(localFeedViewHolder);
   this.mViewHolders.add(new WeakReference(localFeedViewHolder));
   SLog.d("Get view: {}", Integer.valueOf(localFeedViewHolder.videoView.hashCode() % 100));
   return localView;
 }
  @Override
  public void onWindowFocusChanged(boolean b) {

    RelativeLayout relativeLayout = (RelativeLayout) findViewById(R.id.RelativeContainer);

    int height = relativeLayout.getHeight();
    int width = relativeLayout.getWidth();

    Log.i("Width is:", Integer.toString(width));
    Log.i("Height is:", Integer.toString(height));

    if (width < height) {
      Log.i("WIDTH <    ", "    HEIGHT");

      LinearLayout.LayoutParams layout_description = new LinearLayout.LayoutParams(width, width);
      relativeLayout.setLayoutParams(layout_description);
    } else {
      Log.i("HEIGHT <    ", "    WIDTH");

      LinearLayout.LayoutParams layout_description = new LinearLayout.LayoutParams(height, height);
      relativeLayout.setGravity(Gravity.CENTER);
      relativeLayout.setLayoutParams(layout_description);
    }

    height = relativeLayout.getLayoutParams().height;
    width = relativeLayout.getLayoutParams().width;
  }
  @Override
  public void onStateChange(View view, HideablePartBehavior.State state) {
    switch (state) {
      case COLLAPSED:
        if (collapsed) return;
        if (getView() == null) return;
        collapsed = true;
        ((RelativeLayout.LayoutParams) send.getLayoutParams())
                .getRules()[RelativeLayout.ALIGN_BOTTOM] =
            R.id.text;
        ((RelativeLayout.LayoutParams) target.getLayoutParams())
                .getRules()[RelativeLayout.ALIGN_BOTTOM] =
            0;
        ((RelativeLayout.LayoutParams) text.getLayoutParams()).getRules()[RelativeLayout.LEFT_OF] =
            R.id.send;

        ((CoordinatorLayout.LayoutParams) commentFrame.getLayoutParams()).rightMargin =
            (int) (getView().getResources().getDisplayMetrics().density * 59);

        root.invalidate();
        text.clearFocus();
        text.setSingleLine(true);
        text.setVerticalScrollBarEnabled(false);

      case HIDDEN:
        hideKeyboard();
        break;

      case EXPANDED:
        if (!collapsed) return;
        if (getView() == null) return;
        collapsed = false;
        ((RelativeLayout.LayoutParams) send.getLayoutParams())
                .getRules()[RelativeLayout.ALIGN_BOTTOM] =
            0;
        ((RelativeLayout.LayoutParams) target.getLayoutParams())
                .getRules()[RelativeLayout.ALIGN_BOTTOM] =
            R.id.send;
        ((RelativeLayout.LayoutParams) text.getLayoutParams()).getRules()[RelativeLayout.LEFT_OF] =
            0;

        ((CoordinatorLayout.LayoutParams) commentFrame.getLayoutParams()).rightMargin = 0;
        root.invalidate();
        text.setVerticalScrollBarEnabled(true);
        text.setSingleLine(false);
        text.setMaxLines(9);

        showKeyboard();
        break;
    }
  }
  private void setHeaderPadding(int padding) {
    headerPadding = padding;

    MarginLayoutParams mlp = (ViewGroup.MarginLayoutParams) header.getLayoutParams();
    mlp.setMargins(0, Math.round(padding), 0, 0);
    header.setLayoutParams(mlp);
  }
  /** Sets the KitKat translucent status/nav bar and adjusts the views' boundaries. */
  private void setKitKatTranslucentBars() {
    // KitKat translucent status bar.
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
      int statusBarHeight = Common.getStatusBarHeight(mContext);
      int navigationBarHeight = Common.getNavigationBarHeight(mContext);

      if (mDrawerParentLayout != null) {
        mDrawerParentLayout.setClipToPadding(false);
        mDrawerParentLayout.setPadding(0, 0, 0, 0);
      }

      if (mControlsLayoutHeaderParent != null) {
        int bottomPadding = mControlsLayoutHeaderParent.getPaddingBottom();
        mControlsLayoutHeaderParent.setClipToPadding(false);
        RelativeLayout.LayoutParams params =
            (RelativeLayout.LayoutParams) mControlsLayoutHeaderParent.getLayoutParams();

        if (navigationBarHeight > 0) {
          /* The nav bar already has padding, so remove the extra 15dp
           * margin that was applied in the layout file.
           */
          params.bottomMargin = 0;
        }

        params.bottomMargin += navigationBarHeight;
        mControlsLayoutHeaderParent.setLayoutParams(params);
      }
    }
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.public_video_xml);
    initView();
    // 跳转到录制页面
    Init_View();

    DisplayMetrics displaymetrics = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
    surfaceView = (TextureView) findViewById(R.id.preview_video);

    RelativeLayout preview_video_parent = (RelativeLayout) findViewById(R.id.preview_video_parent);
    LinearLayout.LayoutParams layoutParams =
        (LinearLayout.LayoutParams) preview_video_parent.getLayoutParams();
    layoutParams.width = displaymetrics.widthPixels;
    layoutParams.height = displaymetrics.widthPixels;
    preview_video_parent.setLayoutParams(layoutParams);

    surfaceView.setSurfaceTextureListener(this);
    surfaceView.setOnClickListener(this);

    path = getIntent().getStringExtra("path");

    imagePlay = (ImageView) findViewById(R.id.previre_play);
    imagePlay.setOnClickListener(this);
    mediaPlayer = new MediaPlayer();
    mediaPlayer.setOnCompletionListener(this);
  }
  /** @param constantLayoutHeight */
  private void configMySC(int constantLayoutHeight) {
    /*
     * My SoundCloud
     */
    RelativeLayout mySoundCloudLayout =
        (RelativeLayout) rootView.findViewById(R.id.acc_soundcloud_field);
    mySoundCloudLayout.getLayoutParams().height = constantLayoutHeight;

    mySoundCloudLayout.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            // TODO Auto-generated method stub
            MusicPlayerMainActivity.type = MusicPlayerMainActivity.MY_SOUNDCLOUD;
            Intent i = new Intent(getActivity(), MusicPlayerMainActivity.class);
            SCUserController soundCloudUserController = SCUserController.getInstance();

            Bundle bundle;
            try {
              bundle =
                  soundCloudUserController.getBundle(soundCloudUserController.getCurrentUser());
              i.putExtra(USER, bundle);
            } catch (Exception e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
            }

            // i.putExtra(ME_FAVORITES,stringResponse);
            MusicPlayerMainActivity.getActivity().finish();
            startActivity(i);
          }
        });
  }
  /**
   * 显示窗口,重新加载url,重新定义窗口大小,设置背景透明度
   *
   * @param position 点击列表位置
   */
  private void showPopWindow(int position) {
    try {
      Bitmap screenBitmap = ScreenShortCutUtil.getShortScreen(getActivity());
      if (screenBitmap != null) {
        FastBlur.blur(getActivity(), screenBitmap, popView);
        screenBitmap.recycle();
      }

    } catch (Exception ex) {

    }

    int baseHight = 0;
    baseHight = Math.round(baseWidth / screenWByH);
    if (mList.get(position).getIsDianZan() == 0) {
      popHotPoint.setBackgroundResource(R.mipmap.love);
    } else {
      popHotPoint.setBackgroundResource(R.mipmap.loved);
    }
    ViewGroup.LayoutParams params = popContainer.getLayoutParams();
    params.width = Math.round(baseWidth);
    params.height = baseHight;
    popContainer.setLayoutParams(params);
    ViewGroup.LayoutParams layoutParams = mWebView.getLayoutParams();
    layoutParams.width = Math.round(baseWidth);
    layoutParams.height = baseHight;
    mWebView.setLayoutParams(layoutParams);
    //        mWebView.setVisibility(View.GONE);

    mWebView.loadUrl(mList.get(position).getShowPath());

    popTitle.setText(mList.get(position).getTitle());
    popAuthor.setText(mList.get(position).getAuthor().getNickname());
    popupWindow.showAtLocation(layView, Gravity.CENTER, 0, 0);
  }
  /** @param constantLayoutHeight */
  private void configLoginLogout(int constantLayoutHeight) {
    /*
     * Login/Logut
     */
    RelativeLayout logOut = (RelativeLayout) rootView.findViewById(R.id.log_out_field);
    logOut.getLayoutParams().height = constantLayoutHeight;
    SCUserController userController = SCUserController.getInstance();

    if (!userController.isLogin()) {
      ((TextView) rootView.findViewById(R.id.logout_id)).setText("Log in");
    }
    logOut.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            // TODO Auto-generated method stub
            SCUserController soundCloudUserController = SCUserController.getInstance();
            soundCloudUserController.logout();
            SCLoginDatabaseTable databaseHandler = SCLoginDatabaseTable.getInstance(getActivity());
            databaseHandler.clearTable();
            Intent loginAct = new Intent(getActivity(), UserLoginActivity.class);
            startActivity(loginAct);
          }
        });
  }
  /**
   * @param background.rootView
   * @param avatarUrl
   * @param fullNameString
   * @param numFollowers
   */
  private void configUserLayout(String avatarUrl, String fullNameString, int numFollowers) {

    /*
     * Config FrameLayout
     */
    RelativeLayout frame = (RelativeLayout) rootView.findViewById(R.id.frame_avatar);
    // Get the width and length of the screen

    frame.getLayoutParams().width = layoutWidth;
    frame.getLayoutParams().height = (int) (layoutHeight * 0.2);

    /*
     * load avatar
     */
    CircularImageView avatar = (CircularImageView) rootView.findViewById(R.id.avatar_image_id);

    if (avatarUrl == null) avatar.setVisibility(View.INVISIBLE);
    // avatar.setPadding(10, frame.getLayoutParams().height * 0.2,null,null);

    // BasicFunctions.ResizeImageView(layoutWidth, height, imageView);
    avatar.getLayoutParams().height = (int) (frame.getLayoutParams().height * 0.5);
    avatar.getLayoutParams().width = avatar.getLayoutParams().height;

    ImageLoader imgLoader = new ImageLoader(getActivity().getApplicationContext());

    // Loader image - will be shown before loading image
    int loader = R.drawable.image_not_found;

    imgLoader.DisplayImage(avatarUrl, loader, avatar);

    /*
     * load fullname
     *
     */
    TextView fullName = (TextView) rootView.findViewById(R.id.fullname);
    fullName.setText(fullNameString);

    /*
     * load follower
     */
    TextView follower = (TextView) rootView.findViewById(R.id.follower);
    if (numFollowers < 0) follower.setVisibility(View.INVISIBLE);

    follower.setText(String.valueOf(numFollowers) + " followers");
  }
Exemple #12
0
 @Override
 public View getView(int position, View convertView, ViewGroup parent) {
   View layout = activity.getLayoutInflater().inflate(R.layout.item_hint, null);
   RelativeLayout rl_hint_height = (RelativeLayout) layout.findViewById(R.id.rl_hint_height);
   ViewGroup.LayoutParams params = rl_hint_height.getLayoutParams();
   params.height = ScreenUtil.getScreenHeight(activity) - h - 100;
   rl_hint_height.setLayoutParams(params);
   return layout;
 }
  private void setRelativeLayoutSize(RelativeLayout relativeLayout) {
    ViewGroup.LayoutParams layoutParams = null;
    try {
      layoutParams = relativeLayout.getLayoutParams();
    } catch (Exception e) {
      e.printStackTrace();
    }

    layoutParams.width = width;
    layoutParams.height = width;
    relativeLayout.setLayoutParams(layoutParams);
  }
 private void initView() {
   if (!dialogMode) {
     RelativeLayout mainRelLayout = (RelativeLayout) findViewByResName("mainRelLayout");
     RelativeLayout.LayoutParams lp =
         (RelativeLayout.LayoutParams) mainRelLayout.getLayoutParams();
     lp.setMargins(0, 0, 0, 0);
     lp.height = RelativeLayout.LayoutParams.MATCH_PARENT;
     mainRelLayout.setLayoutParams(lp);
   }
   initTitleView();
   initBodyView();
   initImageListView();
 }
Exemple #15
0
  /** 初始化Header */
  public void initHeader(int width, int height) {
    // 计算头部高度
    mDefaultHeight = height / 10;
    LinearLayout.LayoutParams lpHeader = (LayoutParams) header.getLayoutParams();
    lpHeader.height = mDefaultHeight;
    header.setLayoutParams(lpHeader);

    // 初始化Logo相对坐标
    iv_logo = (ImageView) findViewById(R.id.iv_logo);
    int marginLeft = width / 6;
    RelativeLayout.LayoutParams lpLogo = (RelativeLayout.LayoutParams) iv_logo.getLayoutParams();
    lpLogo.setMargins(marginLeft, 0, 0, 0);
    iv_logo.setLayoutParams(lpLogo);
  }
  @Override
  public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    ButterKnife.bind(this, view);

    final CoordinatorLayout.LayoutParams layoutParams =
        (CoordinatorLayout.LayoutParams) commentFrame.getLayoutParams();

    commentFrame.setOnTouchListener(
        new View.OnTouchListener() {
          @Override
          public boolean onTouch(View v, MotionEvent event) {
            return true;
          }
        });

    behavior = (HideablePartBehavior) layoutParams.getBehavior();
    behavior.setChangeCallback(this);

    root.setResizeCallback(
        new IgnorantCoordinatorLayout.ResizeCallback() {
          @Override
          public void onSizeChanged(int w, int h, int oldw, int oldh) {
            commentFrame.post(
                new Runnable() {
                  @Override
                  public void run() {
                    behavior.sync(commentFrame);
                  }
                });
          }
        });

    instrumentsLayout.removeAllViews();

    LayoutInflater inflater = getLayoutInflater(savedInstanceState);
    for (final TextChanger changer : instruments) {
      View button = inflater.inflate(R.layout.include_instrument_button, instrumentsLayout, false);
      ((ImageView) button.findViewById(R.id.icon)).setImageResource(changer.getImageResource());
      button.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              changer.onSelect(CommentEditFragment.this, text);
              selectedInstrument = instruments.indexOf(changer);
            }
          });
      instrumentsLayout.addView(button);
    }
  }
 private void animateLastRequests(int from, int to) {
   suggestionsVisible = to > 0 ? true : false;
   final RelativeLayout last = (RelativeLayout) findViewById(R.id.last);
   final ViewGroup.LayoutParams lp = last.getLayoutParams();
   ValueAnimator animator = ValueAnimator.ofInt(from, to);
   animator.setDuration(200);
   animator.addUpdateListener(
       new ValueAnimator.AnimatorUpdateListener() {
         @Override
         public void onAnimationUpdate(ValueAnimator animation) {
           lp.height = (int) animation.getAnimatedValue();
           last.setLayoutParams(lp);
         }
       });
   if (adapter.getItemCount() > 0) animator.start();
 }
  /** @param constantLayoutHeight */
  private void configSCExplore(int constantLayoutHeight) {
    /*
     * Soundcloud explore
     */
    RelativeLayout soundCloudExplore =
        (RelativeLayout) rootView.findViewById(R.id.soundcloud_explore_field);
    soundCloudExplore.getLayoutParams().height = constantLayoutHeight;
    soundCloudExplore.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            // TODO Auto-generated method stub

            new loadSongBackground().execute();
          }
        });
  }
  private void Initialization(String title) {

    mRlSideBarHolder = (RelativeLayout) findViewById(R.id.rlSideBarHolder);
    mRlTitle = (RelativeLayout) findViewById(R.id.rlTitle);
    mBtnOpenSideBar = (ImageButton) findViewById(R.id.btnOpenSideBar);
    mTvTitle = (TextView) findViewById(R.id.tvTitle);

    mRlUsers = (RelativeLayout) findViewById(R.id.rlUsers);
    mRlUsers.setOnClickListener(new SideMenuButtonListener(getComponentName(), BUTTON_USERS));

    mRlGroups = (RelativeLayout) findViewById(R.id.rlGroups);
    mRlGroups.setOnClickListener(new SideMenuButtonListener(getComponentName(), BUTTON_GROUPS));

    mRlProfile = (RelativeLayout) findViewById(R.id.rlProfile);
    mRlProfile.setOnClickListener(new SideMenuButtonListener(getComponentName(), BUTTON_PROFILE));

    mRlInformation = (RelativeLayout) findViewById(R.id.rlInformation);
    mRlInformation.setOnClickListener(
        new SideMenuButtonListener(getComponentName(), BUTTON_INFORMATION));

    mRlSettings = (RelativeLayout) findViewById(R.id.rlSettings);
    mRlSettings.setOnClickListener(new SideMenuButtonListener(getComponentName(), BUTTON_SETTINGS));

    mRlLogout = (RelativeLayout) findViewById(R.id.rlLogout);
    mRlLogout.setOnClickListener(new SideMenuButtonListener(getComponentName(), BUTTON_LOGOUT));

    mRlPrivateWall = (RelativeLayout) findViewById(R.id.rlPrivateWall);
    mRlPrivateWall.setOnClickListener(
        new SideMenuButtonListener(getComponentName(), BUTTON_PRIVATE_WALL));

    mRlNotificationsTitle = (RelativeLayout) findViewById(R.id.rlNotifications);
    mRlNotificationsTitle.setOnClickListener(
        new SideMenuButtonListener(getComponentName(), NOTIFICATIONS));

    mIvNotificationsBalloon = (ImageView) findViewById(R.id.ivNotificationsBalloon);
    mTvNotificationsNumber = (TextView) findViewById(R.id.tvNotificationsNumber);

    mRlSideBarHolder.getLayoutParams().width = SpikaApp.getTransport();

    mRlBody = (RelativeLayout) findViewById(R.id.rlBody);

    mSideBarOpened = false;
  }
  private void setLayoutFunction() {

    Typeface FONT = Typeface.createFromAsset(getAssets(), "fonts/KIT45.TTF");

    // SET LAYOUT
    android.view.ViewGroup.LayoutParams L_headLayout = headLayout.getLayoutParams();
    android.view.ViewGroup.LayoutParams L_imgWave = imgWave.getLayoutParams();
    android.view.ViewGroup.LayoutParams L_BackBT = BackBT.getLayoutParams();
    android.view.ViewGroup.LayoutParams L_typeButton = typeButton.getLayoutParams();
    android.view.ViewGroup.LayoutParams L_Title = Linear_Title.getLayoutParams();
    android.view.ViewGroup.LayoutParams L_Checkin = checkinBT.getLayoutParams();
    android.view.ViewGroup.LayoutParams L_scDesc = scDesc.getLayoutParams();

    L_headLayout.height = dx(15);
    L_imgWave.height = dx(10);
    L_BackBT.height = dx(10);
    L_typeButton.height = dx(10);
    L_typeButton.width = dx(24);
    L_Checkin.height = dx(20);
    // L_Checkin			.width  = dx(20);
    L_scDesc.height = dx(30);
    L_Title.height = dx(17);

    if (dx(20) > 100) {
      L_Checkin.height = 100;
    }

    BackBT.setPadding(dx(3), 0, 0, 0);
    typeButton.setPadding(0, 0, dx(3), 0);
    Linear_Title.setPadding(0, dx(2), 0, dx(2));

    headLayout.setLayoutParams(L_headLayout);
    imgWave.setLayoutParams(L_imgWave);
    BackBT.setLayoutParams(L_BackBT);
    typeButton.setLayoutParams(L_typeButton);
    scDesc.setLayoutParams(L_scDesc);

    // FONT
    //		txtTitle			.setTextSize(dx(4));
    //		txtDesc				.setTextSize(dx(3));

  }
  private void layout() {
    Rect frame = camera.getFrame(viewfinder.getWidth(), viewfinder.getHeight());
    if (frame == null) {
      return;
    }

    Log.i(TAG, "Frame = " + frame + ", " + viewfinder.getWidth());
    ViewGroup.LayoutParams p = bottomView.getLayoutParams();
    SurfaceView surfaceView = (SurfaceView) findViewById(R.id.preview);
    p.height = surfaceView.getHeight() - frame.bottom;
    p.width = frame.width();
    bottomView.setLayoutParams(p);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT && hasNavBar(this)) {
      // Don't draw over nav bar
      bottomView.setPadding(0, 0, 0, getNavBarHeight());
    }

    bottomView.requestLayout();
    viewfinder.invalidate();
  }
Exemple #22
0
    @Override
    public View getView(int pos, View convertView, ViewGroup parent) {

      if (convertView == null) {
        convertView = LayoutInflater.from(mContext).inflate(R.layout.mgr_menu_listview, null);
      }

      RelativeLayout l = (RelativeLayout) convertView.findViewById(R.id.mgr_item_lay);
      LayoutParams lp = (LayoutParams) l.getLayoutParams();

      if (pos == 3) {
        lp.height = (int) getResources().getDimension(R.dimen.mgr_menu_specific_height);
        l.setLayoutParams(lp);
      } else {
        lp.height = (int) getResources().getDimension(R.dimen.mgr_menu_list_height);
        l.setLayoutParams(lp);
      }
      TextView text = (TextView) convertView.findViewById(R.id.mgr_menu_item);
      text.setText(mMenuArr[pos]);

      return convertView;
    }
  /** @param constantLayoutHeight */
  private void configMySong(int constantLayoutHeight) {
    /*
     * My Music
     */
    RelativeLayout myMusic = (RelativeLayout) rootView.findViewById(R.id.my_music_field);
    myMusic.getLayoutParams().height = constantLayoutHeight;
    myMusic.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            // TODO Auto-generated method stub
            // MainActivity.isExplore = false;
            Intent i = new Intent(getActivity(), MusicPlayerMainActivity.class);
            i.putExtra(DEFAULT_ID, SONGS);
            SCUserController soundCloudUserController = SCUserController.getInstance();
            soundCloudUserController.clearUserData();
            soundCloudUserController.setGuest(null);
            Bundle bundle;
            try {
              bundle = soundCloudUserController.getBundle(soundCloudUserController.getUser());
              i.putExtra(USER, bundle);
            } catch (Exception e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
            }
            SongController songController = SongController.getInstance();
            songController.isLoadFavoriteSong = true;
            songController.isLoadStream = true;

            // songController.loadFavoriteSong();

            MusicPlayerMainActivity.getActivity().finish();

            startActivity(i);
          }
        });
  }
  /** Smart item expansion. */
  private void expandItem(int position) {
    final int first = getFirstVisiblePosition();
    RelativeLayout v = (RelativeLayout) getChildAt(position - first);
    if (v != null && mFloatView != null) {
      // Log.d("mobeta", "  expanding item "+position);
      ViewGroup.LayoutParams lp = v.getLayoutParams();

      int oldHeight = lp.height;
      if (lp.height == mItemHeightCollapsed && position == mSrcDragPos) {
        // expanding collapsed src item
        lp.height = ViewGroup.LayoutParams.WRAP_CONTENT;
      } else if (lp.height == ViewGroup.LayoutParams.WRAP_CONTENT && position != mExpDragPos) {
        // expanding normal item
        lp.height = v.getHeight() + mFloatViewHeight;

        // must set gravity in this case
        if (position > mSrcDragPos) {
          v.setGravity(Gravity.TOP);
        } else {
          v.setGravity(Gravity.BOTTOM);
        }

        // what if expanding first position?
        // if (position == first && mDragState == SRC_ABOVE) {
        // setSelectionFromTop(first, getChildAt(0).getTop() -
        // mFloatViewHeight + getPaddingTop());
        // }

      } else {
        Log.d("mobeta", "expand item skipped");
      }

      if (lp.height != oldHeight) {
        v.requestLayout();
      }
    }
  }
 public int getBottomMargin() {
   LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) mContentView.getLayoutParams();
   return lp.bottomMargin;
 }
 /** show footer */
 public void show() {
   LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) mContentView.getLayoutParams();
   lp.height = android.view.ViewGroup.LayoutParams.WRAP_CONTENT;
   mContentView.setLayoutParams(lp);
 }
 public void setBottomMargin(int height) {
   if (height < 0) return;
   LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) mContentView.getLayoutParams();
   lp.bottomMargin = height;
   mContentView.setLayoutParams(lp);
 }
  private void initView() {
    drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    RelativeLayout menu = (RelativeLayout) findViewById(R.id.menu);
    int width =
        getResources().getDisplayMetrics().widthPixels - DensityUtil.dip2px(mContext, 56 - 8);
    DrawerLayout.LayoutParams params =
        (android.support.v4.widget.DrawerLayout.LayoutParams) menu.getLayoutParams();
    params.width = width;
    menu.setLayoutParams(params);
    drawerLayout.setDrawerListener(
        new DrawerLayout.DrawerListener() {
          @Override
          public void onDrawerSlide(View view, float v) {}

          @Override
          public void onDrawerOpened(View view) {
            closePopView();
            updateLockStatus();
          }

          @Override
          public void onDrawerClosed(View view) {}

          @Override
          public void onDrawerStateChanged(int i) {}
        });

    tv_lock_status = (TextView) findViewById(R.id.tv_lock_status);
    drawer_logo = (ImageView) findViewById(R.id.drawer_logo);

    actionView = (ActionView) findViewById(R.id.btn_more);
    tv_tab_box = (TextView) findViewById(R.id.tab_box);
    tv_tab_lock = (TextView) findViewById(R.id.tab_lock);

    // tab_thumb
    tab_thumb = findViewById(R.id.tab_thumb);
    RelativeLayout.LayoutParams thumbLp = (RelativeLayout.LayoutParams) tab_thumb.getLayoutParams();
    thumbLp.width = 0;
    tab_thumb.requestLayout();

    // vp_main
    vp_main = (ViewPager) findViewById(R.id.vp_main);
    mainAdapter = new MainPagerAdapter(mContext);
    vp_main.setAdapter(mainAdapter);
    vp_main.setOnPageChangeListener(new PagerListener());

    // pop
    popView = findViewById(R.id.layout_pop);
    pop_background = findViewById(R.id.pop_background);
    pop_background.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            closePopView();
          }
        });
    pop_background.setVisibility(View.INVISIBLE);

    // image info
    btn_menu = (ImageView) findViewById(R.id.btn_menu);

    // txt
    txt_drawer_version_num = (TextView) findViewById(R.id.txt_drawer_version_num);
    txt_drawer_info_reply = (TextView) findViewById(R.id.txt_drawer_info_reply);
  }
 /** hide footer when disable pull load more */
 public void hide() {
   LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) mContentView.getLayoutParams();
   lp.height = 0;
   mContentView.setLayoutParams(lp);
 }
 public void setVisiableHeight(int height) {
   if (height < 0) height = 0;
   LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) mContainer.getLayoutParams();
   lp.height = height;
   mContainer.setLayoutParams(lp);
 }