Beispiel #1
0
 public static void imageLLViewReset(ImageView imageView, int bitmapW, int bitmapH) {
   LinearLayout.LayoutParams layoutParams =
       (LinearLayout.LayoutParams) imageView.getLayoutParams();
   HashMap<String, Integer> data = Handler_System.getDisplayMetrics();
   int width = data.get(Handler_System.systemWidth);
   int height = data.get(Handler_System.systemHeight);
   if (width > height) {
     layoutParams.width = (int) (bitmapW * 1.00f / bitmapH * height);
     layoutParams.height = height;
   } else {
     layoutParams.width = width;
     layoutParams.height = (int) (bitmapH * 1.00f / bitmapW * width);
   }
   imageView.setLayoutParams(layoutParams);
 }
 @Override
 public void onClick(View v) {
   switch (v.getId()) {
     case R.id.button_reply_send:
       if (!ChhApplication.getInstance().isLogin()) {
         ToastUtil.show(getActivity(), R.string.need_login);
         startActivity(LoginActivity.getStartIntent(getActivity()));
         return;
       }
       if (mQuoteReply != null) {
         quoteReply();
       } else {
         reply();
       }
     case R.id.button_smile:
       if (layoutSmile.getVisibility() == View.VISIBLE) {
         SmileyPickerUtility.showKeyBoard(editTextFastReply);
         layoutSmile.setVisibility(View.GONE);
       } else {
         int height = SmileyPickerUtility.getKeyboardHeight(getActivity());
         LinearLayout.LayoutParams params =
             (LinearLayout.LayoutParams) layoutSmile.getLayoutParams();
         params.height = height;
         layoutSmile.setVisibility(View.VISIBLE);
         SmileyPickerUtility.hideSoftInput(editTextFastReply);
       }
       break;
     default:
       break;
   }
 }
    @Override
    public View getView(int arg0, View arg1, ViewGroup arg2) {
      HolerView holerView = null;
      if (arg1 == null) {
        holerView = new HolerView();
        arg1 =
            LayoutInflater.from(ChoiceCollActivity.this)
                .inflate(R.layout.classification_item, arg2, false);
        holerView.table = (TextView) arg1.findViewById(R.id.table);
        holerView.img = (ImageView) arg1.findViewById(R.id.img);
        arg1.setTag(holerView);
      } else {
        holerView = (HolerView) arg1.getTag();
      }
      holerView.table.setText(mCommodityListData.get(arg0));
      LinearLayout.LayoutParams param = (LinearLayout.LayoutParams) holerView.img.getLayoutParams();
      param.width =
          (mClassificationGridView.getWidth() - DensityUtils.dp2px(ChoiceCollActivity.this, 16))
              / 3;
      param.height =
          (mClassificationGridView.getWidth() - DensityUtils.dp2px(ChoiceCollActivity.this, 16))
              / 3;
      holerView.img.setLayoutParams(param);

      return arg1;
    }
  /** 设置显示的图片 */
  public void setImage(int[] res) {
    imgIds = res;

    linearLayout = (LinearLayout) findViewById(R.id.viewGroup);

    tips = new ImageView[imgIds.length];
    for (int i = 0; i < imgIds.length; i++) {
      ImageView mImageView = new ImageView(mContext);
      tips[i] = mImageView;
      LinearLayout.LayoutParams layoutParams =
          new LinearLayout.LayoutParams(
              new ViewGroup.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
      layoutParams.rightMargin = AppUtil.dip2px(mContext, 4);
      layoutParams.leftMargin = AppUtil.dip2px(mContext, 4);
      layoutParams.width = AppUtil.dip2px(mContext, 7);
      layoutParams.height = AppUtil.dip2px(mContext, 7);

      mImageView.setBackgroundResource(R.drawable.page_indicator_unfocused);
      linearLayout.addView(mImageView, layoutParams);
    }

    // 这个我是从上一个界面传过来的,上一个界面是一个GridView
    mImageSwitcher.setImageResource(imgIds[currentPosition]);

    setImageBackground(currentPosition);
  }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_select_weight, container, false);

    view.setOnClickListener(this);

    m_0To35WeightBtn = (TextView) view.findViewById(R.id.btn_weight_section_0_35);
    m_35To50WeightBtn = (TextView) view.findViewById(R.id.btn_age_section_35_50);
    m_50To80WeightBtn = (TextView) view.findViewById(R.id.btn_age_section_50_80);
    m_80To120WeightBtn = (TextView) view.findViewById(R.id.btn_age_section_80_120);
    m_above120WeightBtn = (TextView) view.findViewById(R.id.btn_age_section_above_120);

    m_0To35WeightBtn.setOnClickListener(this);
    m_35To50WeightBtn.setOnClickListener(this);
    m_50To80WeightBtn.setOnClickListener(this);
    m_80To120WeightBtn.setOnClickListener(this);
    m_above120WeightBtn.setOnClickListener(this);

    m_titleLL = (LinearLayout) view.findViewById(R.id.weight_titleLL);

    // 设置顶部LL控件高度
    if (m_weightTitleHight != 0) {
      LinearLayout.LayoutParams Lp = (LinearLayout.LayoutParams) m_titleLL.getLayoutParams();
      Lp.height = m_weightTitleHight;
      m_titleLL.setLayoutParams(Lp);
    }

    return view;
  }
  @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);
  }
  boolean resizeCameras() {
    try {
      int screen_width = readScreenWidth(this);
      camerasPerRow = recalculateCameraPerRow();

      io.evercam.androidapp.custom.FlowLayout camsLineView =
          (io.evercam.androidapp.custom.FlowLayout) this.findViewById(R.id.cameras_flow_layout);
      for (int i = 0; i < camsLineView.getChildCount(); i++) {
        LinearLayout pview = (LinearLayout) camsLineView.getChildAt(i);
        CameraLayout cameraLayout = (CameraLayout) pview.getChildAt(0);

        LinearLayout.LayoutParams params =
            new LinearLayout.LayoutParams(
                android.view.ViewGroup.LayoutParams.WRAP_CONTENT,
                android.view.ViewGroup.LayoutParams.WRAP_CONTENT);
        params.width =
            ((i + 1 % camerasPerRow == 0)
                ? (screen_width - (i % camerasPerRow) * (screen_width / camerasPerRow))
                : screen_width / camerasPerRow);
        params.width = params.width - 1; // 1 pixels spacing between cameras
        params.height = (int) (params.width / (1.25));
        params.setMargins(1, 1, 0, 0); // 1 pixels spacing between cameras
        cameraLayout.setLayoutParams(params);
      }
      return true;
    } catch (Exception e) {
      Log.e(TAG, e.toString() + "::" + Log.getStackTraceString(e));

      sendToMint(e);

      EvercamPlayApplication.sendCaughtException(this, e);
      CustomedDialog.showUnexpectedErrorDialog(CamerasActivity.this);
    }
    return false;
  }
Beispiel #8
0
 public void changStatus(boolean unfold) {
   LinearLayout.LayoutParams linearParams =
       (LinearLayout.LayoutParams) this.getLayoutParams(); // 取控件textView当前的布局参数
   linearParams.height =
       unfold
           ? DisplayUtil.dip2px(getContext(), maxHeight)
           : DisplayUtil.dip2px(getContext(), minHeight);
   this.setLayoutParams(linearParams); // 使设置好的布局参数应用到控件
 }
 /**
  * 计算刷新View的大小
  *
  * @param width 当前容器的宽度
  * @param height 当前容器的宽度
  */
 protected void refreshRefreshableViewSize(int width, int height) {
   if (null != mRefreshableViewWrapper) {
     LinearLayout.LayoutParams lp =
         (LinearLayout.LayoutParams) mRefreshableViewWrapper.getLayoutParams();
     if (lp.height != height) {
       lp.height = height;
       mRefreshableViewWrapper.requestLayout();
     }
   }
 }
 /**
  * 根据分辨率设置透明按钮的大小
  *
  * @author [email protected] 2013-7-29 下午5:12:27
  * @param view
  * @return void
  */
 public static void resetLLBack(View... view) {
   float rote = Handler_System.getWidthRoate(ApplicationBean.getApplication().getMode_w());
   if (view == null || rote == 1) {
     return;
   }
   for (View view2 : view) {
     LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) view2.getLayoutParams();
     layoutParams.height = (int) (layoutParams.height * rote);
     layoutParams.width = (int) (layoutParams.width * rote);
     view2.setLayoutParams(layoutParams);
   }
 }
Beispiel #11
0
  /*
   * Adjusting imageview height
   * */
  private void adjustImageAspect(int bWidth, int bHeight) {
    LinearLayout.LayoutParams params = (LayoutParams) getLayoutParams();

    if (bWidth == 0 || bHeight == 0) return;

    int swidth = getWidth();
    int new_height = 0;
    new_height = swidth * bHeight / bWidth;
    params.width = swidth;
    params.height = new_height;
    setLayoutParams(params);
  }
  private void initLettersRows(final View view) {
    int max = getScreenMaxHeight();

    DisplayMetrics displayMetrics = getActivity().getResources().getDisplayMetrics();
    int dpMax = (int) ((max / displayMetrics.density) + 0.5);

    if (dpMax > 480) {
      LinearLayout lastNumbersContainer =
          (LinearLayout) view.findViewById(R.id.housenumber_container);

      LinearLayout.LayoutParams params =
          (LinearLayout.LayoutParams) lastNumbersContainer.getLayoutParams();
      // Changes the height and width to the specified *pixels*
      params.height = params.height * 3 / 2;
      lastNumbersContainer.setLayoutParams(params);
      textlastHouseNumbers3.setVisibility(View.VISIBLE);
      FrameLayout.LayoutParams number2Params =
          (FrameLayout.LayoutParams) textlastHouseNumbers2.getLayoutParams();
      number2Params.gravity = Gravity.CENTER_VERTICAL;

    } else {
      textlastHouseNumbers3.setVisibility(View.GONE);
    }

    if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE
        || dpMax >= 580) {
      // do nothing
    } else if (dpMax > 480) {
      // remove one line
      // view.findViewById(R.id.keysRow3).setVisibility(View.GONE);
      ((Button) view.findViewById(R.id.buttonJ)).setText(localizer.getString("buttonSep1"));
      ((Button) view.findViewById(R.id.buttonK)).setText(localizer.getString("buttonSep2"));
      ((Button) view.findViewById(R.id.buttonL)).setText(localizer.getString("buttonSep3"));
    } else {
      // remove two lines
      view.findViewById(R.id.keysRow2).setVisibility(View.GONE);
      view.findViewById(R.id.keysRow3).setVisibility(View.GONE);
      ((Button) view.findViewById(R.id.buttonD)).setText(localizer.getString("buttonSep1"));
      ((Button) view.findViewById(R.id.buttonE)).setText(localizer.getString("buttonSep2"));
      ((Button) view.findViewById(R.id.buttonF)).setText(localizer.getString("buttonSep3"));
      if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
        View lfrRow = view.findViewById(R.id.lfrRow);
        LayoutParams params = (LayoutParams) lfrRow.getLayoutParams();
        if (KeypadMapperApplication.getInstance().getSettings().isLayoutOptimizationEnabled()) {
          params.weight = 1.55f;
        } else {
          params.weight = 1.4f;
        }
        lfrRow.setLayoutParams(params);
      }
    }
  }
 public void setVerticalEqually() {
   for (Pair<View, View> tab : tabs) {
     ViewGroup.LayoutParams params = tab.first.getLayoutParams();
     if (params instanceof LinearLayout.LayoutParams) {
       LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) params;
       lp.weight = 1;
       lp.height = 0;
       lp.width = -1;
       tab.first.setLayoutParams(lp);
     }
   }
   onGlobalLayout();
 }
  private void initDatas() {
    code = SearchFragment.positionsClassCode;
    value = SearchFragment.positionsClassValue;
    if (PositionClassifyController.positionClassifies != null
        && PositionClassifyController.positionClassifies.size() > 0) {
      int n = PositionClassifyController.positionClassifies.size();
      for (int i = 0; i < n; i++) {
        final PositionClassify positionClassify =
            PositionClassifyController.positionClassifies.get(i);
        final PositionClassItemView positionView = new PositionClassItemView(context);
        positionView.setPositionClassify(positionClassify);
        positionView.setOnItemClickListener(
            new View.OnClickListener() {

              @Override
              public void onClick(View v) {
                // TODO Auto-generated method stub
                if (positionClassify.isHasSub()) {
                  showSubAddressViews(positionClassify);
                } else {
                  boolean flag = positionView.getCheckedStatus();
                  positionView.setCheckedStatus(!flag);
                  if (!flag) {
                    code = positionClassify.getCode();
                    value = positionClassify.getValue();
                    startIntent();
                    finish();
                  } else {
                    code = "";
                    value = "";
                  }
                }
              }
            });
        linear_main.addView(positionView);
        if (i < n - 1) {
          View line = LayoutInflater.from(context).inflate(R.layout.layout_line, null);
          linear_main.addView(line, params);
        } else {
          params =
              new LinearLayout.LayoutParams(
                  LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
          params.height = 1;
          params.leftMargin = 1;
          params.bottomMargin = 10;
          View line = LayoutInflater.from(context).inflate(R.layout.layout_line, null);
          linear_main.addView(line, params);
        }
      }
    }
  }
Beispiel #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);
  }
  private void clickEvent(View view) {
    View child;
    int childCount = mSliding.getChildCount();
    LinearLayout.LayoutParams params;
    for (int i = 0; i < childCount; i++) {
      child = mSliding.getChildAt(i);
      if (preView == child) {
        params = (android.widget.LinearLayout.LayoutParams) child.getLayoutParams();

        if (preView != view) {
          params.weight = 1.0f;
          params.height = maxSize;
        }
        child.setLayoutParams(params);

      } else {
        params = (android.widget.LinearLayout.LayoutParams) child.getLayoutParams();
        params.weight = 0.0f;
        params.height = minSize;
        child.setLayoutParams(params);
      }
    }
    preView = view;
  }
  private void displayPosts(PostThread postThread) {
    // Resources res = getResources();

    LinearLayout ll = new LinearLayout(this);
    ll.setOrientation(LinearLayout.VERTICAL);
    List<Post> posts = postThread.getPosts();
    for (int i = 0; i < posts.size(); i++) {
      Post post = posts.get(i);
      PostView PView = new PostView(getApplicationContext(), post);
      LinearLayout.LayoutParams linearParam =
          new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT / 2, 40);
      linearParam.width = LinearLayout.LayoutParams.MATCH_PARENT;
      linearParam.height = LinearLayout.LayoutParams.WRAP_CONTENT;
      PView.setLayoutParams(linearParam);
      PView.setTag(i);
      ll.addView(PView);
      PView.setOnClickListener(postListener);
    }
    contextContainer.addView(ll);
  }
  protected final void refreshRefreshableViewSize(int width, int height) {
    // We need to set the Height of the Refreshable View to the same as
    // this layout
    LinearLayout.LayoutParams lp =
        (LinearLayout.LayoutParams) mRefreshableViewWrapper.getLayoutParams();

    switch (getPullToRefreshScrollDirection()) {
      case HORIZONTAL:
        if (lp.width != width) {
          lp.width = width;
          mRefreshableViewWrapper.requestLayout();
        }
        break;
      case VERTICAL:
        if (lp.height != height) {
          lp.height = height;
          mRefreshableViewWrapper.requestLayout();
        }
        break;
    }
  }
  private void initView() {
    goback = (ImageButton) findViewById(R.id.goback);
    btn_submit = (Button) findViewById(R.id.btn_submit);
    scroll_page_main = (ScrollView) findViewById(R.id.scroll_page_main);
    scroll_page_sub = (ScrollView) findViewById(R.id.scroll_page_sub);
    linear_main = (LinearLayout) findViewById(R.id.linear_main);
    linear_sub = (LinearLayout) findViewById(R.id.linear_sub);
    scroll_page_main.setVisibility(View.VISIBLE);
    scroll_page_sub.setVisibility(View.GONE);
    params =
        new LinearLayout.LayoutParams(
            LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
    params.height = 1;
    params.leftMargin = 40;
    goback.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            // TODO Auto-generated method stub
            finish();
          }
        });
    btn_submit.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            // TODO Auto-generated method stub
            code = "";
            value = "不限";
            Intent intent = new Intent();
            intent.putExtra(POSITION_CODES, code);
            intent.putExtra(POSITION_VALUES, value);
            ((Activity) context).setResult(SubscribeActivity.REQUESTCODE_POSITIONCLASS, intent);
            finish();
          }
        });
  }
  public BaseRcvAdapterHelper setHeightRatio(int viewId, float width, float ratio) {
    View view = retrieveView(viewId);
    if (view.getParent() instanceof FrameLayout) {

      FrameLayout.LayoutParams frameParams = (FrameLayout.LayoutParams) view.getLayoutParams();
      frameParams.height = (int) (width * ratio);
      view.setLayoutParams(frameParams);

    } else if (view.getParent() instanceof LinearLayout) {

      LinearLayout.LayoutParams linearParams = (LinearLayout.LayoutParams) view.getLayoutParams();
      linearParams.height = (int) (width * ratio);
      view.setLayoutParams(linearParams);

    } else if (view.getParent() instanceof RelativeLayout) {

      RelativeLayout.LayoutParams relativeParams =
          (RelativeLayout.LayoutParams) view.getLayoutParams();
      relativeParams.height = (int) (width * ratio);
      view.setLayoutParams(relativeParams);
    }
    return this;
  }
Beispiel #21
0
 private void Init_Point() {
   layout_point = (LinearLayout) findViewById(R.id.iv_image);
   pointViews = new ArrayList<ImageView>();
   ImageView imageView;
   System.out.println(views.size() + "init_point");
   for (int i = 0; i < views.size(); i++) {
     imageView = new ImageView(this);
     imageView.setBackgroundResource(R.drawable.d1);
     LinearLayout.LayoutParams layoutParams =
         new LinearLayout.LayoutParams(
             new ViewGroup.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
     layoutParams.leftMargin = 10;
     layoutParams.rightMargin = 10;
     layoutParams.width = 8;
     layoutParams.height = 8;
     layout_point.addView(imageView, layoutParams);
     if (i == 0) {
       imageView.setBackgroundResource(R.drawable.d2);
     } else {
       imageView.setBackgroundResource(R.drawable.d1);
     }
     pointViews.add(imageView);
   }
 }
  @Override
  public View createView(Context context, LayoutInflater inflater) {
    searching = false;
    searchWas = false;

    actionBar.setBackButtonImage(R.drawable.ic_ab_back);
    actionBar.setAllowOverlayTitle(true);
    actionBar.setTitle(LocaleController.getString("Language", R.string.Language));

    actionBar.setActionBarMenuOnItemClick(
        new ActionBar.ActionBarMenuOnItemClick() {
          @Override
          public void onItemClick(int id) {
            if (id == -1) {
              finishFragment();
            }
          }
        });

    ActionBarMenu menu = actionBar.createMenu();
    ActionBarMenuItem item =
        menu.addItem(0, R.drawable.ic_ab_search)
            .setIsSearchField(true)
            .setActionBarMenuItemSearchListener(
                new ActionBarMenuItem.ActionBarMenuItemSearchListener() {
                  @Override
                  public void onSearchExpand() {
                    searching = true;
                  }

                  @Override
                  public void onSearchCollapse() {
                    search(null);
                    searching = false;
                    searchWas = false;
                    if (listView != null) {
                      emptyTextView.setVisibility(View.GONE);
                      listView.setAdapter(listAdapter);
                    }
                  }

                  @Override
                  public void onTextChanged(EditText editText) {
                    String text = editText.getText().toString();
                    search(text);
                    if (text.length() != 0) {
                      searchWas = true;
                      if (listView != null) {
                        listView.setAdapter(searchListViewAdapter);
                      }
                    }
                  }
                });
    item.getSearchField().setHint(LocaleController.getString("Search", R.string.Search));

    listAdapter = new ListAdapter(context);
    searchListViewAdapter = new SearchAdapter(context);

    fragmentView = new FrameLayout(context);

    LinearLayout emptyTextLayout = new LinearLayout(context);
    emptyTextLayout.setVisibility(View.INVISIBLE);
    emptyTextLayout.setOrientation(LinearLayout.VERTICAL);
    ((FrameLayout) fragmentView).addView(emptyTextLayout);
    FrameLayout.LayoutParams layoutParams =
        (FrameLayout.LayoutParams) emptyTextLayout.getLayoutParams();
    layoutParams.width = LayoutHelper.MATCH_PARENT;
    layoutParams.height = LayoutHelper.MATCH_PARENT;
    layoutParams.gravity = Gravity.TOP;
    emptyTextLayout.setLayoutParams(layoutParams);
    emptyTextLayout.setOnTouchListener(
        new View.OnTouchListener() {
          @Override
          public boolean onTouch(View v, MotionEvent event) {
            return true;
          }
        });

    emptyTextView = new TextView(context);
    emptyTextView.setTextColor(0xff808080);
    emptyTextView.setTextSize(20);
    emptyTextView.setGravity(Gravity.CENTER);
    emptyTextView.setText(LocaleController.getString("NoResult", R.string.NoResult));
    emptyTextLayout.addView(emptyTextView);
    LinearLayout.LayoutParams layoutParams1 =
        (LinearLayout.LayoutParams) emptyTextView.getLayoutParams();
    layoutParams1.width = LayoutHelper.MATCH_PARENT;
    layoutParams1.height = LayoutHelper.MATCH_PARENT;
    layoutParams1.weight = 0.5f;
    emptyTextView.setLayoutParams(layoutParams1);

    FrameLayout frameLayout = new FrameLayout(context);
    emptyTextLayout.addView(frameLayout);
    layoutParams1 = (LinearLayout.LayoutParams) frameLayout.getLayoutParams();
    layoutParams1.width = LayoutHelper.MATCH_PARENT;
    layoutParams1.height = LayoutHelper.MATCH_PARENT;
    layoutParams1.weight = 0.5f;
    frameLayout.setLayoutParams(layoutParams1);

    listView = new ListView(context);
    listView.setEmptyView(emptyTextLayout);
    listView.setVerticalScrollBarEnabled(false);
    listView.setDivider(null);
    listView.setDividerHeight(0);
    listView.setAdapter(listAdapter);
    ((FrameLayout) fragmentView).addView(listView);
    layoutParams = (FrameLayout.LayoutParams) listView.getLayoutParams();
    layoutParams.width = LayoutHelper.MATCH_PARENT;
    layoutParams.height = LayoutHelper.MATCH_PARENT;
    listView.setLayoutParams(layoutParams);

    listView.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
            LocaleController.LocaleInfo localeInfo = null;
            if (searching && searchWas) {
              if (i >= 0 && i < searchResult.size()) {
                localeInfo = searchResult.get(i);
              }
            } else {
              if (i >= 0 && i < LocaleController.getInstance().sortedLanguages.size()) {
                localeInfo = LocaleController.getInstance().sortedLanguages.get(i);
              }
            }
            if (localeInfo != null) {
              LocaleController.getInstance().applyLanguage(localeInfo, true);
              parentLayout.rebuildAllFragmentViews(false);
            }
            finishFragment();
          }
        });

    listView.setOnItemLongClickListener(
        new AdapterView.OnItemLongClickListener() {
          @Override
          public boolean onItemLongClick(AdapterView<?> adapterView, View view, int i, long l) {
            LocaleController.LocaleInfo localeInfo = null;
            if (searching && searchWas) {
              if (i >= 0 && i < searchResult.size()) {
                localeInfo = searchResult.get(i);
              }
            } else {
              if (i >= 0 && i < LocaleController.getInstance().sortedLanguages.size()) {
                localeInfo = LocaleController.getInstance().sortedLanguages.get(i);
              }
            }
            if (localeInfo == null
                || localeInfo.pathToFile == null
                || getParentActivity() == null) {
              return false;
            }
            final LocaleController.LocaleInfo finalLocaleInfo = localeInfo;
            AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
            builder.setMessage(
                LocaleController.getString("DeleteLocalization", R.string.DeleteLocalization));
            builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
            builder.setPositiveButton(
                LocaleController.getString("Delete", R.string.Delete),
                new DialogInterface.OnClickListener() {
                  @Override
                  public void onClick(DialogInterface dialogInterface, int i) {
                    if (LocaleController.getInstance().deleteLanguage(finalLocaleInfo)) {
                      if (searchResult != null) {
                        searchResult.remove(finalLocaleInfo);
                      }
                      if (listAdapter != null) {
                        listAdapter.notifyDataSetChanged();
                      }
                      if (searchListViewAdapter != null) {
                        searchListViewAdapter.notifyDataSetChanged();
                      }
                    }
                  }
                });
            builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
            showDialog(builder.create());
            return true;
          }
        });

    listView.setOnScrollListener(
        new AbsListView.OnScrollListener() {
          @Override
          public void onScrollStateChanged(AbsListView absListView, int i) {
            if (i == SCROLL_STATE_TOUCH_SCROLL && searching && searchWas) {
              AndroidUtilities.hideKeyboard(getParentActivity().getCurrentFocus());
            }
          }

          @Override
          public void onScroll(
              AbsListView absListView,
              int firstVisibleItem,
              int visibleItemCount,
              int totalItemCount) {}
        });

    return fragmentView;
  }
 public void setVisiableHeight(int height) {
   if (height < 0) height = 0;
   LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) mContainer.getLayoutParams();
   lp.height = height;
   mContainer.setLayoutParams(lp);
 }
 /** show footer */
 public void show() {
   LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) mContentView.getLayoutParams();
   lp.height = LayoutParams.WRAP_CONTENT;
   mContentView.setLayoutParams(lp);
 }
 /** hide footer when disable pull load more */
 public void hide() {
   LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) mContentView.getLayoutParams();
   lp.height = 0;
   mContentView.setLayoutParams(lp);
 }
  @Override
  public View createView(Context context) {
    if (!receiverRegistered) {
      receiverRegistered = true;
      IntentFilter filter = new IntentFilter();
      filter.addAction(Intent.ACTION_MEDIA_BAD_REMOVAL);
      filter.addAction(Intent.ACTION_MEDIA_CHECKING);
      filter.addAction(Intent.ACTION_MEDIA_EJECT);
      filter.addAction(Intent.ACTION_MEDIA_MOUNTED);
      filter.addAction(Intent.ACTION_MEDIA_NOFS);
      filter.addAction(Intent.ACTION_MEDIA_REMOVED);
      filter.addAction(Intent.ACTION_MEDIA_SHARED);
      filter.addAction(Intent.ACTION_MEDIA_UNMOUNTABLE);
      filter.addAction(Intent.ACTION_MEDIA_UNMOUNTED);
      filter.addDataScheme("file");
      ApplicationLoader.applicationContext.registerReceiver(receiver, filter);
    }

    actionBar.setBackButtonImage(R.drawable.ic_ab_back);
    actionBar.setAllowOverlayTitle(true);
    actionBar.setTitle(LocaleController.getString("SelectFile", R.string.SelectFile));
    actionBar.setActionBarMenuOnItemClick(
        new ActionBar.ActionBarMenuOnItemClick() {
          @Override
          public void onItemClick(int id) {
            if (id == -1) {
              finishFragment();
            } else if (id == -2) {
              selectedFiles.clear();
              actionBar.hideActionMode();
              listView.invalidateViews();
            } else if (id == done) {
              if (delegate != null) {
                ArrayList<String> files = new ArrayList<>();
                files.addAll(selectedFiles.keySet());
                delegate.didSelectFiles(DocumentSelectActivity.this, files);
              }
            }
          }
        });
    selectedFiles.clear();
    actionModeViews.clear();

    final ActionBarMenu actionMode = actionBar.createActionMode();
    actionModeViews.add(
        actionMode.addItem(
            -2,
            R.drawable.ic_ab_back_grey,
            R.drawable.bar_selector_mode,
            null,
            AndroidUtilities.dp(54)));

    selectedMessagesCountTextView = new TextView(actionMode.getContext());
    selectedMessagesCountTextView.setTextSize(18);
    selectedMessagesCountTextView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
    selectedMessagesCountTextView.setTextColor(0xff737373);
    selectedMessagesCountTextView.setSingleLine(true);
    selectedMessagesCountTextView.setLines(1);
    selectedMessagesCountTextView.setEllipsize(TextUtils.TruncateAt.END);
    selectedMessagesCountTextView.setPadding(AndroidUtilities.dp(11), 0, 0, AndroidUtilities.dp(2));
    selectedMessagesCountTextView.setGravity(Gravity.CENTER_VERTICAL);
    selectedMessagesCountTextView.setOnTouchListener(
        new View.OnTouchListener() {
          @Override
          public boolean onTouch(View v, MotionEvent event) {
            return true;
          }
        });
    actionMode.addView(selectedMessagesCountTextView);
    LinearLayout.LayoutParams layoutParams =
        (LinearLayout.LayoutParams) selectedMessagesCountTextView.getLayoutParams();
    layoutParams.weight = 1;
    layoutParams.width = 0;
    layoutParams.height = LayoutHelper.MATCH_PARENT;
    selectedMessagesCountTextView.setLayoutParams(layoutParams);

    actionModeViews.add(
        actionMode.addItem(
            done,
            R.drawable.ic_ab_done_gray,
            R.drawable.bar_selector_mode,
            null,
            AndroidUtilities.dp(54)));

    fragmentView =
        getParentActivity()
            .getLayoutInflater()
            .inflate(R.layout.document_select_layout, null, false);
    listAdapter = new ListAdapter(context);
    emptyView = (TextView) fragmentView.findViewById(R.id.searchEmptyView);
    emptyView.setOnTouchListener(
        new View.OnTouchListener() {
          @Override
          public boolean onTouch(View v, MotionEvent event) {
            return true;
          }
        });
    listView = (ListView) fragmentView.findViewById(R.id.listView);
    listView.setEmptyView(emptyView);
    listView.setAdapter(listAdapter);

    listView.setOnScrollListener(
        new AbsListView.OnScrollListener() {
          @Override
          public void onScrollStateChanged(AbsListView view, int scrollState) {
            scrolling = scrollState != SCROLL_STATE_IDLE;
          }

          @Override
          public void onScroll(
              AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {}
        });

    listView.setOnItemLongClickListener(
        new AdapterView.OnItemLongClickListener() {
          @Override
          public boolean onItemLongClick(AdapterView<?> parent, View view, int i, long id) {
            if (actionBar.isActionModeShowed() || i < 0 || i >= items.size()) {
              return false;
            }
            ListItem item = items.get(i);
            File file = item.file;
            if (file != null && !file.isDirectory()) {
              if (!file.canRead()) {
                showErrorBox(LocaleController.getString("AccessError", R.string.AccessError));
                return false;
              }
              if (sizeLimit != 0) {
                if (file.length() > sizeLimit) {
                  showErrorBox(
                      LocaleController.formatString(
                          "FileUploadLimit",
                          R.string.FileUploadLimit,
                          AndroidUtilities.formatFileSize(sizeLimit)));
                  return false;
                }
              }
              if (file.length() == 0) {
                return false;
              }
              selectedFiles.put(file.toString(), item);
              selectedMessagesCountTextView.setText(String.format("%d", selectedFiles.size()));
              if (Build.VERSION.SDK_INT >= 11) {
                AnimatorSetProxy animatorSet = new AnimatorSetProxy();
                ArrayList<Object> animators = new ArrayList<>();
                for (int a = 0; a < actionModeViews.size(); a++) {
                  View view2 = actionModeViews.get(a);
                  AndroidUtilities.clearDrawableAnimation(view2);
                  if (a < 1) {
                    animators.add(
                        ObjectAnimatorProxy.ofFloat(
                            view2, "translationX", -AndroidUtilities.dp(56), 0));
                  } else {
                    animators.add(ObjectAnimatorProxy.ofFloat(view2, "scaleY", 0.1f, 1.0f));
                  }
                }
                animatorSet.playTogether(animators);
                animatorSet.setDuration(250);
                animatorSet.start();
              }
              scrolling = false;
              if (view instanceof SharedDocumentCell) {
                ((SharedDocumentCell) view).setChecked(true, true);
              }
              actionBar.showActionMode();
            }
            return true;
          }
        });

    listView.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
            if (i < 0 || i >= items.size()) {
              return;
            }
            ListItem item = items.get(i);
            File file = item.file;
            if (file == null) {
              if (item.icon == R.drawable.ic_storage_gallery) {
                if (delegate != null) {
                  delegate.startDocumentSelectActivity();
                }
                finishFragment(false);
              } else {
                HistoryEntry he = history.remove(history.size() - 1);
                actionBar.setTitle(he.title);
                if (he.dir != null) {
                  listFiles(he.dir);
                } else {
                  listRoots();
                }
                listView.setSelectionFromTop(he.scrollItem, he.scrollOffset);
              }
            } else if (file.isDirectory()) {
              HistoryEntry he = new HistoryEntry();
              he.scrollItem = listView.getFirstVisiblePosition();
              he.scrollOffset = listView.getChildAt(0).getTop();
              he.dir = currentDir;
              he.title = actionBar.getTitle();
              history.add(he);
              if (!listFiles(file)) {
                history.remove(he);
                return;
              }
              actionBar.setTitle(item.title);
              listView.setSelection(0);
            } else {
              if (!file.canRead()) {
                showErrorBox(LocaleController.getString("AccessError", R.string.AccessError));
                file = new File("/mnt/sdcard");
              }
              if (sizeLimit != 0) {
                if (file.length() > sizeLimit) {
                  showErrorBox(
                      LocaleController.formatString(
                          "FileUploadLimit",
                          R.string.FileUploadLimit,
                          AndroidUtilities.formatFileSize(sizeLimit)));
                  return;
                }
              }
              if (file.length() == 0) {
                return;
              }
              if (actionBar.isActionModeShowed()) {
                if (selectedFiles.containsKey(file.toString())) {
                  selectedFiles.remove(file.toString());
                } else {
                  selectedFiles.put(file.toString(), item);
                }
                if (selectedFiles.isEmpty()) {
                  actionBar.hideActionMode();
                } else {
                  selectedMessagesCountTextView.setText(String.format("%d", selectedFiles.size()));
                }
                scrolling = false;
                if (view instanceof SharedDocumentCell) {
                  ((SharedDocumentCell) view)
                      .setChecked(selectedFiles.containsKey(item.file.toString()), true);
                }
              } else {
                if (delegate != null) {
                  ArrayList<String> files = new ArrayList<>();
                  files.add(file.getAbsolutePath());
                  delegate.didSelectFiles(DocumentSelectActivity.this, files);
                }
              }
            }
          }
        });

    listRoots();

    return fragmentView;
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_details_match);

    initialize();

    Intent i = getIntent();
    if (i.hasExtra("ONE_MATCH")) {
      MatchEntity oneMatch = (MatchEntity) i.getSerializableExtra("ONE_MATCH");

      queue = MySingleton.getInstance(this).getRequestQueue();
      request = new ApiRequest(queue, this);
      if (oneMatch.isWinner()) {
        rlInfosJoueur.setBackgroundColor(getResources().getColor(R.color.win_row_bg));
      } else {
        rlInfosJoueur.setBackgroundColor(getResources().getColor(R.color.lose_row_bg));
      }

      Picasso.with(this)
          .load(
              "http://ddragon.leagueoflegends.com/cdn/5.16.1/img/champion/"
                  + oneMatch.getChampName())
          .into(portrait);
      if (oneMatch.getSum1().equals("Default")) {
        Picasso.with(this).load(R.drawable.empty).into(sum1);
      } else {
        Picasso.with(this)
            .load("http://ddragon.leagueoflegends.com/cdn/5.16.1/img/spell/" + oneMatch.getSum1())
            .into(sum1);
      }
      if (oneMatch.getSum2().equals("Default")) {
        Picasso.with(this).load(R.drawable.empty).into(sum2);
      } else {
        Picasso.with(this)
            .load("http://ddragon.leagueoflegends.com/cdn/5.16.1/img/spell/" + oneMatch.getSum2())
            .into(sum2);
      }

      // Rajout des items

      Helper.setImageItems(this, oneMatch.getItems()[0], item1);
      Helper.setImageItems(this, oneMatch.getItems()[1], item2);
      Helper.setImageItems(this, oneMatch.getItems()[2], item3);
      Helper.setImageItems(this, oneMatch.getItems()[3], item4);
      Helper.setImageItems(this, oneMatch.getItems()[4], item5);
      Helper.setImageItems(this, oneMatch.getItems()[5], item6);
      Helper.setImageItems(this, oneMatch.getItems()[6], item7);

      // Rajout des infos
      typeMatch.setText(oneMatch.getTypeMatch());
      level.setText("Level " + String.valueOf(oneMatch.getChampLevel()));
      gold.setText(String.valueOf(Math.round(oneMatch.getGold() / 1000.0)) + "K");
      cs.setText(String.valueOf(oneMatch.getCs()));
      kda.setText(oneMatch.getKills() + "/" + oneMatch.getDeaths() + "/" + oneMatch.getAssists());
      duration.setText(Helper.convertDuration(oneMatch.getMatchDuration()));
      creation.setText(Helper.convertDate(oneMatch.getMatchCreation()));

      // Rajout des Vainqueurs
      float density = getResources().getDisplayMetrics().density;
      int size = (int) (70 * density);

      Helper.setImagePortraits(this, oneMatch.getTeamWinner().get(0), vainqueur1, request);
      Helper.setImagePortraits(this, oneMatch.getTeamWinner().get(1), vainqueur2, request);
      Helper.setImagePortraits(this, oneMatch.getTeamWinner().get(2), vainqueur3, request);
      Helper.setImagePortraits(this, oneMatch.getTeamWinner().get(3), vainqueur4, request);

      if (oneMatch.getChampId() == oneMatch.getTeamWinner().get(4) && oneMatch.isWinner() == true) {
        vainqueur5.getLayoutParams().height = size;
        vainqueur5.getLayoutParams().width = size;
      }
      Helper.setImagePortraits(this, oneMatch.getTeamWinner().get(4), vainqueur5, request);

      // Rajout des perdants

      if (oneMatch.getTeamLoser().size()
          > 0) { // Si c'est un match contre l'ordinateur cette liste sera vide. On fait donc une
                 // vérification
        Helper.setImagePortraits(this, oneMatch.getTeamLoser().get(0), perdant1, request);
        Helper.setImagePortraits(this, oneMatch.getTeamLoser().get(1), perdant2, request);
        Helper.setImagePortraits(this, oneMatch.getTeamLoser().get(2), perdant3, request);
        Helper.setImagePortraits(this, oneMatch.getTeamLoser().get(3), perdant4, request);

        if (oneMatch.getChampId() == oneMatch.getTeamLoser().get(4)
            && oneMatch.isWinner() == false) {
          perdant5.getLayoutParams().height = size;
          perdant5.getLayoutParams().width = size;
        }
        Helper.setImagePortraits(this, oneMatch.getTeamLoser().get(4), perdant5, request);
      }
      // Affichage des statistiques

      Iterator iterator = oneMatch.getStats().entrySet().iterator();
      while (iterator.hasNext()) {

        HashMap.Entry key = (HashMap.Entry) iterator.next();

        TableRow row = new TableRow(this);
        TextView tv_key = new TextView(this);
        tv_key.setTextSize(15);
        TextView tv_value = new TextView(this);
        tv_value.setTextSize(15);
        row.addView(tv_key);
        row.addView(tv_value);

        LinearLayout.LayoutParams key_params = (LinearLayout.LayoutParams) tv_key.getLayoutParams();
        key_params.width = 0;
        key_params.weight = 1;
        key_params.height = (int) (20 * density);
        tv_key.setLayoutParams(key_params);

        LinearLayout.LayoutParams value_params =
            (LinearLayout.LayoutParams) tv_value.getLayoutParams();
        value_params.gravity = Gravity.RIGHT;
        value_params.height = (int) (20 * density);
        tv_value.setLayoutParams(value_params);

        tv_key.setText(key.getKey().toString());
        tv_value.setText(key.getValue().toString());

        statistiques.addView(
            row,
            new TableLayout.LayoutParams(
                ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
      }
    }
  }
  @SuppressLint("DrawAllocation")
  @Override
  protected void onDraw(Canvas canvas) {
    super.onDraw(canvas);
    if (gridHeight == 0) {
      LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) this.getLayoutParams();
      int w = this.getWidth();
      gridHeight = w / 10;
      layoutParams.height = gridHeight * days;
      gridWidth = w / gridSize;
      textSize = dip2px(this.context, 15);
      this.getParent().requestLayout();
    }

    if (c != 0) this.setbg(c);
    if (resid != 0) this.setBackgroundResource(resid);

    Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);

    // 竖线
    for (int i = 0; i < gridSize; i++) {
      if (i == 0 || i == 3 || i == 4 || i == 7) {
        paint.setColor(gridColor3);
      } else {
        paint.setColor(gridColor1);
      }

      paint.setStyle(Style.FILL);
      canvas.drawRect(gridWidth * i, 0, gridWidth * (i + 1), getHeight(), paint);
      if (i > 0) {
        paint.setColor(bgColor);
        paint.setStrokeWidth(1);
        if (i == 5 || i == 6) {
          canvas.drawLine(gridWidth * i + 1, 0, gridWidth * i + 1, getHeight(), paint);
        } else {
          canvas.drawLine(gridWidth * i, 0, gridWidth * i, getHeight(), paint);
        }
      }
    }
    // 划横线
    for (int i = 1; i <= days; i++) {
      paint.setColor(bgColor);
      canvas.drawLine(0, gridHeight * i, getWidth(), gridHeight * i, paint);

      drawString("" + i, 0 + gridWidth / 2, gridHeight * (i - 1) + gridHeight / 2, canvas);
      // canvas.drawRect(gridWidth*i, 0, gridWidth*i+blwidh, getHeight(),
      // paint);
    }
    if (values != null) {
      for (int i = 0; i < values.length; i++) {
        for (int j = 0; j < values[i].length; j++) {
          if (values[i][j] > 0) {
            drawString(
                "" + values[i][j],
                gridWidth + gridWidth * j + gridWidth / 2,
                gridHeight * i + gridHeight / 2,
                canvas);
          }
        }
      }
    }
  }
  @Override
  public void onBindViewHolder(final ShoppingListHolder holder, final int position) {
    final ShoppingList shoppingList = shoppingLists.get(position);

    holder.mTextView_shopping_list_name.setText(shoppingList.getName());
    holder.mLayoutName.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            DataManager.toggleExpanded(shoppingList);
            notifyDataSetChanged();
          }
        });
    holder.mLayoutName.setOnLongClickListener(
        new View.OnLongClickListener() {
          @Override
          public boolean onLongClick(View v) {
            final ShoppingListRenameDialog myDialogFragment = new ShoppingListRenameDialog();
            myDialogFragment.mOldName = holder.mTextView_shopping_list_name.getText().toString();
            myDialogFragment.show(
                ((Activity) context).getFragmentManager(), "ShoppingListRenameDialog");
            myDialogFragment.mListener =
                new ShoppingListRenameDialog.ShoppingListRenameDialogListener() {
                  @Override
                  public void onDialogPositiveClick(DialogFragment dialog, String text) {
                    if (!text.equals("")) {
                      holder.mTextView_shopping_list_name.setText(text);
                      DataManager.setNameShoppingList(
                          shoppingList, holder.mTextView_shopping_list_name.getText().toString());
                    }
                  }
                };
            return false;
          }
        });
    // устанавливаем background
    if (shoppingList.isExpanded()) {
      holder.mItemLayout.setBackgroundResource(R.drawable.rectangle_rounded_some);
    } else {
      holder.mItemLayout.setBackgroundResource(R.drawable.rectangle_rounded_all);
    }
    RefreshTotalChecked(
        holder.mTotalChecked, holder.mTextView_shopping_list_name, holder.mItemLayout, position);

    if (shoppingList.isFavorite()) {
      holder.mButton_favorite.setBackgroundResource(R.drawable.ic_action_favorite);
    } else {
      holder.mButton_favorite.setBackgroundResource(R.drawable.ic_action_favorite_out);
    }

    holder.mButton_favorite.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            DataManager.toggleFavorite(shoppingList);
            notifyItemChanged(position);
          }
        });
    holder.mButton_edit.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            onShoppingListEdit.onShoppingListEdit(shoppingList.getId());
          }
        });
    final LinearLayoutManager linearLayoutManager = new LinearLayoutManager(context);
    linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
    holder.mRecyclerView.setLayoutManager(linearLayoutManager);
    List<ShoppingListItem> values =
        shoppingList.getItems().where().findAllSorted("position", Sort.DESCENDING);
    LinearLayout.LayoutParams params =
        new LinearLayout.LayoutParams(
            ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);

    Resources r = context.getResources();
    int height =
        (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 54, r.getDisplayMetrics());

    if (shoppingList.isExpanded()) {
      params.height = height * values.size();
    } else {
      params.height = 0;
    }
    holder.mRecyclerView.setLayoutParams(params);
    ShoppingListItemRecyclerAdapter adapter =
        new ShoppingListItemRecyclerAdapter(
            values,
            false,
            this,
            holder.mItemLayout,
            mShoppingListItemAdapterCallback,
            position,
            context,
            null);
    holder.mRecyclerView.setAdapter(adapter);
  }
  @Override
  public View onCreateView(
      LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {

    faceGridViewList = new ArrayList<View>();
    pointViews = new ArrayList<ImageView>();

    View rootView = inflater.inflate(R.layout.face_fragment, null);
    faceViewPager = (ViewPager) rootView.findViewById(R.id.faceViewPager);
    pagePointLayout = (LinearLayout) rootView.findViewById(R.id.pagePointLayout);

    for (int x = 0; x < (data.size() % 12 == 0 ? data.size() / 12 : (data.size() / 12) + 1); x++) {
      GridView view = new GridView(activity);
      final List<String> tempData =
          data.subList(x * 12, ((x + 1) * 12) > data.size() ? data.size() : ((x + 1) * 12));
      FaceAdapter faceAdapter = new FaceAdapter(activity, tempData);
      view.setAdapter(faceAdapter);

      view.setOnItemClickListener(
          new OnItemClickListener() {

            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
              if (onOperationListener != null) {
                onOperationListener.selectedFace(tempData.get(position));
              }
            }
          });
      view.setNumColumns(4);

      view.setBackgroundColor(Color.TRANSPARENT);
      view.setHorizontalSpacing(1);
      view.setVerticalSpacing(1);
      view.setStretchMode(GridView.STRETCH_COLUMN_WIDTH);
      view.setCacheColorHint(0);
      view.setPadding(5, 0, 5, 0);
      view.setSelector(new ColorDrawable(Color.TRANSPARENT));
      view.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
      view.setGravity(Gravity.CENTER);

      faceGridViewList.add(view);

      ImageView imageView = new ImageView(activity);
      imageView.setBackgroundResource(R.drawable.point_normal);
      LinearLayout.LayoutParams layoutParams =
          new LinearLayout.LayoutParams(
              new ViewGroup.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
      layoutParams.leftMargin = 10;
      layoutParams.rightMargin = 10;
      layoutParams.width = 8;
      layoutParams.height = 8;
      pagePointLayout.addView(imageView, layoutParams);
      if (x == 0) {
        imageView.setBackgroundResource(R.drawable.point_selected);
      }
      pointViews.add(imageView);
    }

    PagerAdapter facePagerAdapter = new FacePagerAdapter(faceGridViewList);
    faceViewPager.setAdapter(facePagerAdapter);
    faceViewPager.addOnPageChangeListener(
        new OnPageChangeListener() {

          @Override
          public void onPageSelected(int index) {

            for (int i = 0; i < pointViews.size(); i++) {
              if (index == i) {
                pointViews.get(i).setBackgroundResource(R.drawable.point_selected);
              } else {
                pointViews.get(i).setBackgroundResource(R.drawable.point_normal);
              }
            }
          }

          @Override
          public void onPageScrolled(int arg0, float arg1, int arg2) {}

          @Override
          public void onPageScrollStateChanged(int arg0) {}
        });

    return rootView;
  }