Esempio n. 1
0
 private void initData(
     List<Map<String, Object>> list,
     List<Map<String, Object>> cache_list,
     final List<Map<String, Object>> cache_top,
     int index,
     ListView mListView,
     Gallery mGallery) {
   if (ConnectionUtil.isConnet(mContext)) {
     if (cache_list.size() > 0) {
       adapter =
           new NewsListAdapter(mContext, R.layout.activity_item, viewId, cache_list, dataName);
       mListView.setAdapter(adapter);
     } else {
       new CarNewsListTask(this).execute((String) list.get(index).get("link"));
     }
     if (cache_top.size() > 0) {
       mGallery.setAdapter(new TopAdapter(mContext, activity, cache_top));
     } else {
       new TopListTask(this).execute((String) list.get(index).get("typeid"));
     }
   } else {
     adapter = new NewsListAdapter(mContext, R.layout.activity_item, viewId, cache_list, dataName);
     mListView.setAdapter(adapter);
     mGallery.setAdapter(new TopAdapter(mContext, activity, cache_top));
   }
 }
Esempio n. 2
0
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_image_gallery, container, false);
    final TParkInfo_LocEntity tParkInfo_LocEntity =
        (TParkInfo_LocEntity) getActivity().getIntent().getSerializableExtra("parkinfo");
    ; // 从当前Activity中获得
    imageUrls = new String[tParkInfo_LocEntity.parkInfo.imgUrlArray.size()];

    options =
        new DisplayImageOptions.Builder()
            .showImageOnLoading(R.drawable.ic_stub)
            .showImageForEmptyUri(R.drawable.ic_empty)
            .showImageOnFail(R.drawable.ic_empty)
            .cacheInMemory(true)
            .cacheOnDisc(true)
            .considerExifParams(true)
            .bitmapConfig(Bitmap.Config.RGB_565)
            .build();

    Gallery gallery = (Gallery) view.findViewById(R.id.gallery);

    gallery.setAdapter(new ImageGalleryAdapter());
    gallery.setOnItemClickListener(
        new OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            startImagePagerActivity(position);
          }
        });
    return view;
  }
  /** Called when the activity is first created. */
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_3, this, mLoaderCallback);
    currentView = 0;

    mGestureSensor = new CameraGestureSensor(this);
    mGestureSensor.addGestureListener(this);
    mGestureSensor.enableClickByColor(true);
    mGestureSensor.addClickListener(this);

    mOpenCVInitiated = false;

    imageView = (ImageView) findViewById(R.id.ImageView01);
    imageView.setImageResource(pics[currentView]);

    ga = (Gallery) findViewById(R.id.Gallery01);
    ga.setAdapter(new ImageAdapter(this));
    ga.setOnItemClickListener(
        new OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> adapter, View givenView, int index, long arg3) {
            Toast.makeText(getBaseContext(), "A click was recieved!", Toast.LENGTH_SHORT).show();
            imageView.setImageResource(pics[index]);
            currentView = index;
          }
        });
  }
Esempio n. 4
0
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.vietchu);
   toolbar = (Toolbar) findViewById(R.id.toolbar);
   toolbar.setNavigationIcon(getResources().getDrawable(R.drawable.ic_left_arrow));
   toolbar.setNavigationOnClickListener(
       new View.OnClickListener() {
         @Override
         public void onClick(View v) {
           Intent i = new Intent(vietchu.this, GameS.class);
           startActivity(i);
           finish();
         }
       });
   toolbar.setTitle("Bé tập viết chữ");
   Gallery gallery = (Gallery) findViewById(R.id.gallery1);
   gallery.setAdapter(new ImageAdapter(getApplicationContext()));
   //	gallery.setAdapter(new ImageAdapter(getApplicationContext();
   gesture = (GestureOverlayView) findViewById(R.id.gestureOverlayView1);
   vietlai = (Button) findViewById(R.id.btn_vietlai);
   vietlai.setOnClickListener(
       new OnClickListener() {
         public void onClick(View v) {
           gesture.cancelClearAnimation();
           gesture.clear(true);
         }
       });
 }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_goods_info);

    // 取得传过来的map对象
    map = App.map;
    init();

    getDetail(); // 获取数据

    DetailAdapter adapter = new DetailAdapter(list, this);
    g.setAdapter(adapter);
    g.setSelection(0);
    g.setOnItemClickListener(
        new OnItemClickListener() {

          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            /*
             * 自定义dailog CustomDialog dia = new
             * CustomDialog(GoodsInfoActivity.this, list,
             * R.style.custom_dialog); dia.setPosition(position);
             * dia.show();
             */

            Intent i = new Intent(GoodsInfoActivity.this, ShowActivity.class);
            i.putExtra("position", position);
            i.putExtra("Arr", pathArr);
            i.putExtra("id", 1);
            startActivity(i);
            overridePendingTransition(R.anim.alpha_before, R.anim.alpha_ago);
          }
        });
  }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    if (LauncherLog.DEBUG) {
      LauncherLog.d(TAG, "onCreateView: mEmbedded = " + mEmbedded + ", container = " + container);
    }
    findWallpapers();

    /* If this fragment is embedded in the layout of this activity, then we should
     * generate a view to display. Otherwise, a dialog will be created in
     * onCreateDialog()
     */
    if (mEmbedded) {
      View view = inflater.inflate(R.layout.wallpaper_chooser, container, false);
      view.setBackground(mWallpaperDrawable);

      final Gallery gallery = (Gallery) view.findViewById(R.id.gallery);
      gallery.setCallbackDuringFling(false);
      gallery.setOnItemSelectedListener(this);
      gallery.setAdapter(new ImageAdapter(getActivity()));

      View setButton = view.findViewById(R.id.set);
      setButton.setOnClickListener(
          new OnClickListener() {
            @Override
            public void onClick(View v) {
              selectWallpaper(gallery.getSelectedItemPosition());
            }
          });
      return view;
    }
    return null;
  }
Esempio n. 7
0
    private void ini() {
      setWidth(LayoutParams.MATCH_PARENT);
      setHeight(LayoutParams.MATCH_PARENT);
      setAnimationStyle(R.style.popupwindow_anim);
      gallery = (Gallery) resource.findViewById(R.id.img_show_gallery);
      postionTV = (TextView) resource.findViewById(R.id.img_show_pos);
      galleryAdapter = new GalleryAdapter();
      gallery.setAdapter(galleryAdapter);
      gallery.setSelection(pos, true);
      postionTV.setText(pos + 1 + "/" + imgList.size());
      gallery.setOnItemClickListener(
          new OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
              ImgShow.this.dismiss();
              IsImgShow = false;
            }
          });
      gallery.setOnItemSelectedListener(
          new OnItemSelectedListener() {
            @Override
            public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
              postionTV.setText(position + 1 + "/" + imgList.size());
            }

            @Override
            public void onNothingSelected(AdapterView<?> parent) {}
          });
    }
Esempio n. 8
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_principal);

    Gallery minhaGaleria = (Gallery) findViewById(R.id.galeriaImagem);
    minhaGaleria.setAdapter(new AdaptadorImagens(this));
  }
Esempio n. 9
0
 public void BackgroundColor(int color) {
   if (resourceId != -1) {
     ((Gallery) container.$form().findViewById(resourceId)).setBackgroundColor(color);
     ((Gallery) container.$form().findViewById(resourceId)).invalidate();
   } else {
     view.setBackgroundColor(color);
     view.invalidate();
   }
 }
Esempio n. 10
0
 public ImageGallery(ComponentContainer container, String[] picnames, int[] basestyle) {
   super(container);
   view = new Gallery(container.$context());
   adapter = new ImageAdapter(container.$context(), basestyle);
   adapter.setFiles(picnames);
   view.setAdapter(adapter);
   view.setOnItemClickListener(this);
   container.$add(this);
   view.requestLayout();
 }
Esempio n. 11
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.to_do_gallery);

    Gallery tagViews = (Gallery) findViewById(R.id.to_do_tag_list);

    tagViews.setAdapter(new ImageAdapter());
  }
Esempio n. 12
0
 public void setImages(String[] pics) {
   adapter.setFiles(pics);
   if (resourceId != -1) {
     ((Gallery) container.$form().findViewById(resourceId)).setAdapter(adapter);
     ((Gallery) container.$form().findViewById(resourceId)).requestLayout();
   } else {
     view.setAdapter(adapter);
     view.requestLayout();
   }
 }
Esempio n. 13
0
 public void setPicSize(int width, int height) {
   adapter.setWidth(width);
   adapter.setHeight(height);
   if (resourceId != -1) {
     ((Gallery) container.$form().findViewById(resourceId)).setAdapter(adapter);
     ((Gallery) container.$form().findViewById(resourceId)).requestLayout();
   } else {
     view.setAdapter(adapter);
     view.requestLayout();
   }
 }
Esempio n. 14
0
 public ImageGallery(
     ComponentContainer container, String[] picnames, int[] basestyle, int resourceId) {
   super(container, resourceId);
   view = null;
   Gallery view = (Gallery) container.$form().findViewById(resourceId);
   adapter = new ImageAdapter(container.$context(), basestyle);
   adapter.setFiles(picnames);
   view.setAdapter(adapter);
   view.setOnItemClickListener(this);
   view.requestLayout();
 }
Esempio n. 15
0
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    // Getting gallery from XML
    Gallery mGallery = (Gallery) findViewById(R.id.my_gallery);

    // Creating a custom adapter to set the gallery items
    MyAdapter adapter = new MyAdapter(getBaseContext());
    mGallery.setAdapter(adapter);
  }
Esempio n. 16
0
 @Override
 public void onActivityCreated(Bundle savedInstanceState) {
   mPreferences = getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
   super.onActivityCreated(savedInstanceState);
   mAdapter = new ImagesAdapter(getApplication());
   mGallery.setAdapter(mAdapter);
   mGallery.setOnItemClickListener(this);
   mLoadImagesIndicator.setOnClickListener(this);
   if (mData.size() > 0
       && mPreferences.getBoolean(PREFERENCE_KEY_LOAD_MORE_AUTOMATICALLY, false)) {
     show();
   }
 }
Esempio n. 17
0
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.image);
		title=(TextView) findViewById(R.id.logo);
		
		
		GameSave = getSharedPreferences("cn.Arthur.Game.ClothesHeartCG", 0);
		ReadTimes = GameSave.getInt("ReadTimes", 0);
		if (ReadTimes>1000) isUnlock=true;
		ImageList = getImagesFromSD();
		
		/**
		 * xml获取Switcher 
		 */
		mSwitcher = (ImageSwitcher) findViewById(R.id.switcher);
		mSwitcher.setFactory(this);

		mSwitcher.setInAnimation(AnimationUtils.loadAnimation(this,
				android.R.anim.slide_in_left));

		mSwitcher.setOutAnimation(AnimationUtils.loadAnimation(this,
				android.R.anim.slide_out_right));

		/**
		 * xml获取Gallery
		 */
		Gallery g = (Gallery) findViewById(R.id.mygallery);

		
		if(ImageList == null || ImageList.size() == 0)
			return;
		
		/**
		 * 创建适配器,注册适配器
		 */
		g.setAdapter(new ImageAdapter(this, ImageList));

		g.setOnItemSelectedListener(this);

		/**
		 * 点击事件监听器
		 */
		g.setOnItemClickListener(new OnItemClickListener() {
			public void onItemClick(AdapterView<?> parent, View v,
					int position, long id) {
				
			}
		});
		SpotManager.getInstance(this).showSpotAds(this);
	}
Esempio n. 18
0
 @Override
 public void handleMessage(Message msg) {
   // TODO Auto-generated method stub
   super.handleMessage(msg);
   switch (msg.what) {
     case INIT_FINISH:
       mGallery.setVerticalFadingEdgeEnabled(false);
       mGallery.setHorizontalFadingEdgeEnabled(false);
       mGallery.setAdapter(new GalleryAdapter(mContext, imagesPath));
       mGallery.setSelection(index);
       break;
     default:
       break;
   }
 }
  private void init() {
    // 取得诸控件
    // initTopBarForLeft(good.getTitle());
    bar = (ActionBar) findViewById(R.id.headbar);
    bar.setTitleAndLeftButton(R.drawable.back, "详情");
    bar.setOnLeftButtonClickListener(
        new onLeftButtonClickListener() {

          @Override
          public void onClick() {
            finish();
          }
        });

    // btnchat = (Button) findViewById(R.id.chat);
    chat = (LinearLayout) findViewById(R.id.chat);
    comment = (LinearLayout) findViewById(R.id.ping);
    comment_text = (EditText) findViewById(R.id.good_pinglun);
    commentlist = (ListView) findViewById(R.id.pinglun);
    data = new ArrayList<Comment>();
    adapter = new GoodsCommentAdapter(getApplication(), data);
    commentlist.addHeaderView(createListHeadView());
    commentlist.setAdapter(adapter);
    nickname.setText(good.getUser().getNick()); // 昵称
    good_createtime.setText(good.getCreatedAt()); // 物品发表时间
    gallery.setAdapter(galleryAdpter = new GalleryAdpter(mApplication, good.getPicture()));
    user = good.getUser(); // 获得商品的发表用户
    goodTitle.setText(good.getTitle());
    goodPrice.setText("   ¥" + good.getPrice());
    goodContent.setText(good.getContent());
    head.setImageUrl(good.getUser().getAvatar());
    gridViewPic.setAdapter(new myAdapter(this, good.getPicture()));
    getComment();
  }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.fragment_tv_1, container, false);
    mListViewLayout = v.findViewById(R.id.list_layout);
    mGalleryLayout = v.findViewById(R.id.tv_gallery_layout);
    mListCover = v.findViewById(R.id.list_cover);
    mTvLeft = v.findViewById(R.id.tv_left);
    mTvRight = v.findViewById(R.id.tv_right);

    mListView = (ListView) v.findViewById(R.id.tv_list);
    mListViewAdapter = new ListViewAdapter(getActivity());
    mListView.setAdapter(mListViewAdapter);
    mListView.setOnItemSelectedListener(this);
    mListView.setOnItemClickListener(this);

    mGallery = (Gallery) v.findViewById(R.id.tv_gallery);
    mGalleryAdapter = new GalleryAdapter(getActivity());
    mGallery.setAdapter(mGalleryAdapter);

    mProgressBar = (ProgressBar) v.findViewById(R.id.loading);

    setViewsVisiable(View.GONE);

    init();

    return v;
  }
  @SuppressWarnings({"unchecked", "rawtypes"})
  public void onCreateReflectionCalls(Gallery aGallery, Activity activity) {
    try {
      // same as gallery.setSystemUiVisibility(View.STATUS_BAR_HIDDEN);
      Class GalleryClass = aGallery.getClass();
      Method setSystemMethod = GalleryClass.getMethod("setSystemUiVisibility", int.class);
      setSystemMethod.invoke(aGallery, 1);

      Class ActivityClass = activity.getClass();
      Method getActionBar = ActivityClass.getMethod("getActionBar");
      Object objectActionBar = getActionBar.invoke(activity);

      Class ActionBarClass = objectActionBar.getClass();
      Method setDisplayShowTitleEnabled =
          ActionBarClass.getMethod("setDisplayShowTitleEnabled", boolean.class);
      setDisplayShowTitleEnabled.invoke(objectActionBar, false);

    } catch (NoSuchMethodException e) {
      // ignore
      // TODO: handle exception
    } catch (IllegalArgumentException e) {
      // TODO Auto-generated catch block
      // e.printStackTrace();
    } catch (IllegalAccessException e) {
      // TODO Auto-generated catch block
      // e.printStackTrace();
    } catch (InvocationTargetException e) {
      // TODO Auto-generated catch block
      // e.printStackTrace();
    }
  }
Esempio n. 22
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);

    setContentView(R.layout.image_switcher_1);

    mSwitcher = (ImageSwitcher) findViewById(R.id.switcher);
    mSwitcher.setFactory(this);
    mSwitcher.setInAnimation(AnimationUtils.loadAnimation(this, android.R.anim.fade_in));
    mSwitcher.setOutAnimation(AnimationUtils.loadAnimation(this, android.R.anim.fade_out));

    Gallery g = (Gallery) findViewById(R.id.gallery);
    g.setAdapter(new ImageAdapter(this));
    g.setOnItemSelectedListener(this);
  }
Esempio n. 23
0
 @Override
 protected void onLayout(boolean changed, int l, int t, int r, int b) {
   long now = SystemClock.uptimeMillis();
   if (Math.abs(now - mLastScrollEvent) > 200) {
     super.onLayout(changed, l, t, r, b);
   }
 }
  public void onEvent(GetTvEvent<AppreciatetvList> event) {
    aList = event.result;

    // 处理List返回内容
    if (aList == null) return;

    // init frequency
    List<Appreciatetv> list = aList.getLists();
    List<CategoryData> datas = list.get(list.size() - 1).getData();
    mFrequencys.clear();
    for (CategoryData data : datas) {
      mFrequencys.add(data.getCategoryurl());
    }

    setViewsVisiable(View.VISIBLE);

    mProgressBar.setVisibility(View.GONE);

    mListViewAdapter.updateData(aList.getLists());
    Appreciatetv tv = (Appreciatetv) mListViewAdapter.getItem(0);
    if (tv != null) {
      mGalleryAdapter.updateData(tv.getData());
      mGallery.setSelection(Integer.MAX_VALUE / 2 - 1);
    }

    mListView.requestFocus();
  }
 private void setViewsVisiable(int visibility) {
   mGallery.setVisibility(visibility);
   mListViewLayout.setVisibility(visibility);
   mGalleryLayout.setVisibility(visibility);
   mTvLeft.setVisibility(visibility);
   mTvRight.setVisibility(visibility);
   mListCover.setVisibility(visibility);
 }
Esempio n. 26
0
 /**
  * Actions launched after giveTo animation
  *
  * @param placePlayer Player position
  * @param vToMove CardView to move
  */
 public void endAnim(int placePlayer, CardView vToMove) {
   if (placePlayer != 0) {
     playerViews.get(placePlayer).getPlayer().addCard(vToMove.getCard());
     playerViews.get(placePlayer).setPlayer(playerViews.get(placePlayer).getPlayer(), false);
   } else {
     GA.user.addCard(vToMove.getCard());
     Gallery gallery =
         (Gallery)
             GameActivity.getActivity().findViewById(R.id.playerview_slider_board_cardgallery);
     SliderbarCardGallery adapter = (SliderbarCardGallery) gallery.getAdapter();
     adapter.notifyDataSetChanged();
     gallery.setSelection(GA.user.getNumberOfCards() - 1);
     HandView handView = (HandView) GameActivity.getActivity().findViewById(R.id.handview);
     handView.updateView(true);
   }
   this.removeView(vToMove);
 }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_LEFT_ICON);
    setContentView(R.layout.icon_change);
    getWindow().setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, R.drawable.icon);

    String[] projection = {MediaStore.Images.Thumbnails._ID};
    mCursor =
        managedQuery(
            MediaStore.Images.Thumbnails.EXTERNAL_CONTENT_URI,
            projection,
            null,
            null,
            MediaStore.Images.Thumbnails.IMAGE_ID);
    mIDFieldIndex = mCursor.getColumnIndexOrThrow(MediaStore.Images.Thumbnails._ID);

    imageSwitcher = (ImageSwitcher) findViewById(R.id.switcher);
    imageSwitcher.setFactory(this);
    imageSwitcher.setInAnimation(AnimationUtils.loadAnimation(this, android.R.anim.fade_in));
    imageSwitcher.setOutAnimation(AnimationUtils.loadAnimation(this, android.R.anim.fade_out));
    imageSwitcher.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            String[] projection = {MediaStore.Images.Media.DATA};
            Cursor cursor =
                managedQuery(
                    MediaStore.Images.Media.EXTERNAL_CONTENT_URI, projection, null, null, null);
            int columnIndex = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
            cursor.moveToPosition(mPosition);
            String path = cursor.getString(columnIndex);
            if (path != null) {
              Intent data = new Intent();
              data.putExtra("path", path);
              setResult(RESULT_OK, data);
            }
            cursor.close();
            finish();
          }
        });

    Gallery gallery = (Gallery) findViewById(R.id.gallery);
    gallery.setAdapter(new ExternalImagesAdapter());
    gallery.setOnItemSelectedListener(this);
  }
  public void onActivityCreated(Bundle savedInstanceState) {
    Log.i("onActivityCreated", "child");
    super.onCreate(savedInstanceState);
    PrepArrows();
    Gallery gallery = (Gallery) getView().findViewById(R.id.gallery);
    gallery.setAdapter(new ImageAdapter(this.getActivity().getBaseContext(), mImageIds));
    gallery.setHorizontalFadingEdgeEnabled(true);

    gallery.setOnItemSelectedListener(
        new OnItemSelectedListener() {
          @Override
          public void onItemSelected(AdapterView<?> parent, View v, int position, long id) {
            int i = parent.getCount();
            Log.i("OnItemSelected", Integer.toString(position) + " / " + Integer.toString(i));
            for (int x = 0; x < i; x++) {
              View vv = parent.getChildAt(x);
              if (vv != null) {
                vv.setAlpha(128);
                vv.setBackgroundResource(0);
              }
            }

            v.setAlpha(255);
            parent.invalidate();

            ToggleArrows(position);

            // Update the CSDL Summary
            UpdateGUI(position);
          }

          @Override
          public void onNothingSelected(AdapterView<?> parent) {
            Log.i("onNothingSelected", "Nothing selected?");
            int i = parent.getCount();
            for (int x = 0; x < i; x++) {
              parent.getChildAt(x).setAlpha(128);
              parent.getChildAt(x).setBackgroundResource(0);
            }
          }
        });

    // Set this after the listener to cheat on setting the alpha
    gallery.setSelection(4, true);
  }
  @Override
  public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    requestWindowFeature(Window.FEATURE_NO_TITLE);

    findWallpapers();

    setContentView(R.layout.wallpaper_chooser);

    mGallery = (Gallery) findViewById(R.id.gallery);
    mGallery.setAdapter(new ImageAdapter(this));
    mGallery.setOnItemSelectedListener(this);
    mGallery.setCallbackDuringFling(false);

    findViewById(R.id.set).setOnClickListener(this);

    mImageView = (ImageView) findViewById(R.id.wallpaper);
  }
Esempio n. 30
0
 protected void onSizeChanged(int w, int h, int oldw, int oldh) {
   Log.i(TAG, "onSizeChanged------- w = " + w + " h = " + h + "oldw = " + oldw + "oldh = " + oldh);
   if (!flag) {
     mWidth = w;
     getLayoutParams().width = mWidth;
     flag = true;
   }
   super.onSizeChanged(w, h, oldw, oldh);
 }