Example #1
0
 /**
  * 初始化中奖排行界面
  *
  * @param listview listView
  * @param listviewid listView的ID
  * @param list 中奖排行的数据
  */
 protected void initPrizeList(
     ListView listview, int listviewid, List<Map<String, Object>> list) {
   listview = (ListView) view.findViewById(listviewid);
   switch (HEIGHT) {
     case 320:
       listview.setPadding(0, 0, 0, 130);
       break;
     case 480:
       listview.setPadding(0, 0, 0, 110);
       break;
     case 800:
       listview.setPadding(0, 0, 0, 54);
       break;
     default:
       listview.setPadding(0, 0, 0, 0);
       break;
   }
   listview.setSelector(R.color.transparent);
   listview.setOnTouchListener(
       new GalleryOnTouch(mGallery) {
         @Override
         public void actionUp(View v) {}
       });
   BuyActivityAdapter adapter = new BuyActivityAdapter(BuyActivity.this, list);
   listview.setSelected(false);
   listview.setAdapter(adapter);
   if (listview.isFocused()) {
     listview.setItemsCanFocus(false);
   } else {
     listview.setItemsCanFocus(true);
   }
 }
Example #2
0
 private View getPopupWindowLayout() {
   if (contentView == null) {
     if (lAdapter != null) {
       contentView = new ListView(context);
       contentView.setLayoutParams(
           new ViewGroup.LayoutParams(
               ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
       contentView.setCacheColorHint(Color.argb(0, 0, 0, 0));
       if (backgroundId != 0) {
         contentView.setBackgroundResource(backgroundId);
       } else {
         contentView.setBackgroundColor(Color.argb(0, 0, 0, 0));
       }
       contentView.setPadding(
           contentPadding[0], contentPadding[1], contentPadding[2], contentPadding[3]);
       contentView.setFadingEdgeLength(0);
       if (divider == null) {
         contentView.setDivider(null);
         contentView.setDividerHeight(0);
       } else {
         contentView.setDivider(divider);
         contentView.setDividerHeight(dividerHeight);
       }
       contentView.setAdapter(lAdapter);
     }
   }
   return contentView;
 }
  /** 图片截图框 */
  protected void showDialogPicSelect() {
    final ArrayAdapter<String> arrayAdapter = new ArrayAdapter<String>(this, R.layout.item_text);
    arrayAdapter.add("分享图片");
    arrayAdapter.add("保存图片至图册");
    arrayAdapter.add("保存图片至文件夹");
    ListView listView = new ListView(this);
    float scale = getResources().getDisplayMetrics().density;
    int dpAsPixels = (int) (8 * scale + 0.5f);
    listView.setPadding(0, dpAsPixels, 0, dpAsPixels);
    listView.setDividerHeight(0);
    listView.setAdapter(arrayAdapter);

    final MaterialDialog alert = new MaterialDialog(this).setContentView(listView);

    listView.setOnItemClickListener(
        new OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            alert.dismiss();
            switch (position) {
              case 0:
                sharePic();
                break;
              case 1:
                savePicInGarrery();
                break;
              case 2:
                savePicInSdCard();
                break;
            }
          }
        });
    alert.show();
  }
  /**
   * method to populate one menu list
   *
   * @param menuList
   * @param listTitle
   * @param menuNames
   * @param menuIcons
   */
  private ListView setupList(String listTitle, String[] menuNames, int[] menuIcons) {
    SimpleAdapter menuAdapter = new SimpleAdapter(getActivity());
    for (int i = 0; i < menuNames.length; i++) {
      listObject menuObject = new listObject();
      menuObject.setText(menuNames[i]);
      menuObject.setResID(menuIcons[i]);
      menuAdapter.add(menuObject);
    }

    LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);

    View headerview = layoutInflater.inflate(R.layout.sliding_menu_list_header, null);
    TextView listHeaderName = (TextView) headerview.findViewById(R.id.sliding_menu_list_name);
    listHeaderName.setTypeface(font);
    listHeaderName.setText(listTitle);
    ListView menuList = new ListView(parentActivity);
    menuList.setLayoutParams(params);

    int sizeInPx = 10;
    float scale = getResources().getDisplayMetrics().density;
    int sizeInDp = (int) (sizeInPx * scale + 0.5f);
    menuList.setPadding(sizeInDp, 0, sizeInDp, 0);
    // menuList.setPadding(R.dimen.list_padding, 0, R.dimen.list_padding, 0);

    menuList.addHeaderView(headerview);
    menuList.setAdapter(menuAdapter);
    listRoot.addView(menuList, params);
    return menuList;
  }
Example #5
0
  void initList() {
    App app = (App) getApplication();
    List<Semester> semesters = app.getDBHelper().getSemesters(app.getUserDB());
    mData.clear();
    for (int i = 0; i < semesters.size(); i++) {
      HashMap<String, Object> map = new HashMap<String, Object>();
      String name = semesters.get(i).name;
      name = (name == null || name.length() == 0) ? "2012年秋季学期" : name;
      map.put("name", name);
      map.put("semester", semesters.get(i));
      mData.add(map);
    }
    SimpleAdapter adapter =
        new MySimpleAdapter(
            this, mData, R.layout.simple_list_item, new String[] {"name"}, new int[] {R.id.title});
    //		SimpleAdapter adapter = new SimpleAdapter(this, array, R.layout.simple_list_item, new
    // String[]{"name"}, new int[]{R.id.title});
    ListView listView = (ListView) findViewById(R.id.user_list);
    listView.setAdapter(adapter);
    listView.setOnItemClickListener(new MyOnItemClickListener());
    listView.setDivider(null);

    int dimension = (int) getResources().getDimension(R.dimen.home_menu_left_padding);
    listView.setPadding(0, dimension, 0, dimension);
  }
  @Override
  protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.list_view);

    ListView listView = (ListView) findViewById(R.id.list_view);

    mGoogleCardsAdapter = new GoogleCardsSocialAdapter(this, DummyContent.getDummyModelList());
    SwingBottomInAnimationAdapter swingBottomInAnimationAdapter =
        new SwingBottomInAnimationAdapter(new SwipeDismissAdapter(mGoogleCardsAdapter, this));
    swingBottomInAnimationAdapter.setAbsListView(listView);

    assert swingBottomInAnimationAdapter.getViewAnimator() != null;
    swingBottomInAnimationAdapter.getViewAnimator().setInitialDelayMillis(INITIAL_DELAY_MILLIS);

    listView.setClipToPadding(false);
    listView.setDivider(null);
    Resources r = getResources();
    int px = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8, r.getDisplayMetrics());
    listView.setDividerHeight(px);
    listView.setFadingEdgeLength(0);
    listView.setFitsSystemWindows(true);
    px = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 12, r.getDisplayMetrics());
    listView.setPadding(px, px, px, px);
    listView.setScrollBarStyle(ListView.SCROLLBARS_OUTSIDE_OVERLAY);
    listView.setAdapter(swingBottomInAnimationAdapter);

    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setTitle("Google cards social");
  }
 @Override
 protected void fitSystemWindows(Rect insets) {
   mListView.setPadding(insets.left, insets.top, insets.right, insets.bottom);
   mErrorContainer.setPadding(insets.left, insets.top, insets.right, insets.bottom);
   mProgressContainer.setPadding(insets.left, insets.top, insets.right, insets.bottom);
   mSystemWindowsInsets.set(insets);
   updateRefreshProgressOffset();
 }
 public void onClick(View paramView)
 {
   switch (paramView.getId())
   {
   default:
     super.onClick(paramView);
     return;
   case 2131361873:
   case 2131362054:
     this.mProfileHeaderAdapter.onProfileHeaderClick(paramView, this);
     return;
   case 2131362056:
   case 2131362058:
     this.mProfileHeaderAdapter.onProfileHeaderClick(paramView, this);
     changeTab((Button)paramView);
     return;
   case 2131362051:
     onFollowersClicked();
     return;
   case 2131362053:
     onFollowingClicked();
     return;
   case 2131361949:
     this.mAppController.acceptFollowRequest(this.mAppController.getActiveSession(), this.mUserId);
     return;
   case 2131361946:
     this.mAppController.acceptRejectRequest(this.mAppController.getActiveSession(), this.mUserId);
     return;
   case 2131362057:
   }
   if (this.mHideProfileReposts);
   for (int i = 2131624352; ; i = 2131624148)
   {
     String str = getString(i);
     ArrayAdapter localArrayAdapter = new ArrayAdapter(getActivity(), 2130903120, 2131361987, new String[] { str });
     ListView localListView = new ListView(getActivity());
     FrameLayout.LayoutParams localLayoutParams = new FrameLayout.LayoutParams(-1, -2);
     localLayoutParams.topMargin = getResources().getDimensionPixelSize(2131427412);
     localListView.setPadding(0, getResources().getDimensionPixelSize(2131427412), 0, 0);
     localListView.setLayoutParams(localLayoutParams);
     localListView.setAdapter(localArrayAdapter);
     localListView.setSelector(new ColorDrawable(getResources().getColor(17170445)));
     localListView.setOnItemClickListener(this);
     localListView.setDividerHeight(0);
     if (getView() == null)
       break;
     TabButton localTabButton = (TabButton)getView().findViewById(2131362056);
     if ((this.mPopupWindow == null) || (this.mPopupWindow.isShowing()) || (localTabButton == null))
       break;
     this.mPopupWindow.setFocusable(true);
     this.mPopupWindow.setContentView(localListView);
     this.mPopupWindow.setWidth(localTabButton.getMeasuredWidth());
     this.mPopupWindow.setHeight(-2);
     this.mPopupWindow.setBackgroundDrawable(new ColorDrawable(getResources().getColor(2131296358)));
     this.mPopupWindow.showAsDropDown(localTabButton, 0, 0);
     return;
   }
 }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v = super.onCreateView(inflater, container, savedInstanceState);
    assert v != null;
    ListView lv = (ListView) v.findViewById(android.R.id.list);
    lv.setPadding(0, 0, 0, 0);

    return v;
  }
 @Override
 public View onCreateView(
     LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
   final View view = super.onCreateView(inflater, container, savedInstanceState);
   final ListView list = (ListView) view.findViewById(android.R.id.list);
   // our container already takes care of the padding
   int paddingTop = list.getPaddingTop();
   int paddingBottom = list.getPaddingBottom();
   list.setPadding(0, paddingTop, 0, paddingBottom);
   return view;
 }
 @Override
 public View onCreateView(
     final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) {
   final View view = super.onCreateView(inflater, container, savedInstanceState);
   assert view != null;
   final ListView listView = (ListView) view.findViewById(R.id.list_view);
   final Resources res = getResources();
   final float density = res.getDisplayMetrics().density;
   final int padding = (int) density * 16;
   listView.setPadding(padding, 0, padding, 0);
   return view;
 }
 private void init(Context context, AttributeSet attrs) {
   mListView = new ListView(context, attrs);
   mListView.setPadding(0, 0, 0, 0);
   FrameLayout.LayoutParams params =
       new FrameLayout.LayoutParams(
           ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
   params.bottomMargin = 0;
   params.topMargin = 0;
   params.leftMargin = 0;
   params.rightMargin = 0;
   mListView.setLayoutParams(params);
   mListView.setId(android.R.id.list);
   mListView.setOnScrollListener(mOnScrollListener);
   addView(mListView);
 }
  private void configureVerticalScrollbar() {
    boolean hasScrollbar = isVisibleScrollbarEnabled() && isSectionHeaderDisplayEnabled();

    if (mListView != null) {
      mListView.setFastScrollEnabled(hasScrollbar);
      mListView.setFastScrollAlwaysVisible(hasScrollbar);
      mListView.setVerticalScrollbarPosition(mVerticalScrollbarPosition);
      mListView.setScrollBarStyle(ListView.SCROLLBARS_OUTSIDE_OVERLAY);
      int leftPadding = 0;
      int rightPadding = 0;
      if (mVerticalScrollbarPosition == View.SCROLLBAR_POSITION_LEFT) {
        leftPadding =
            mContext.getResources().getDimensionPixelOffset(R.dimen.list_visible_scrollbar_padding);
      } else {
        rightPadding =
            mContext.getResources().getDimensionPixelOffset(R.dimen.list_visible_scrollbar_padding);
      }
      mListView.setPadding(
          leftPadding, mListView.getPaddingTop(), rightPadding, mListView.getPaddingBottom());
    }
  }
  /** Applies KitKat specific translucency. */
  private void applyKitKatTranslucency() {
    if (Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT) {

      // Calculate ActionBar and navigation bar height.
      TypedValue tv = new TypedValue();
      int actionBarHeight = 0;
      if (getActivity().getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true)) {
        actionBarHeight =
            TypedValue.complexToDimensionPixelSize(tv.data, getResources().getDisplayMetrics());
      }

      mListView.setBackgroundColor(0xFFEEEEEE);
      mRootView.setPadding(0, actionBarHeight + mApp.getStatusBarHeight(mContext), 0, 0);
      mListView.setPadding(10, 0, 10, mApp.getNavigationBarHeight(mContext));
      mListView.setClipToPadding(false);

      // Set the window color.
      getActivity()
          .getWindow()
          .setBackgroundDrawable(UIElementsHelper.getGeneralActionBarBackground(mContext));
    }
  }
 /** {@inheritDoc} */
 @Override
 public View onCreateView(
     final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) {
   // The View for the fragment's UI
   mRootView = (ViewGroup) inflater.inflate(R.layout.list_base, null);
   // Initialize the list
   mListView = (ListView) mRootView.findViewById(R.id.list_base);
   // Set the data behind the list
   mListView.setAdapter(mAdapter);
   // Release any references to the recycled Views
   mListView.setRecyclerListener(new RecycleHolder());
   // Listen for ContextMenus to be created
   mListView.setOnCreateContextMenuListener(this);
   // Play the selected song
   mListView.setOnItemClickListener(this);
   // To help make scrolling smooth
   mListView.setOnScrollListener(new VerticalScrollListener(null, mProfileTabCarousel, 0));
   // Remove the scrollbars and padding for the fast scroll
   mListView.setVerticalScrollBarEnabled(false);
   mListView.setFastScrollEnabled(false);
   mListView.setPadding(0, 0, 0, 0);
   return mRootView;
 }
Example #16
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.reply);
    HashMap<String, String> commentParams = new HashMap<String, String>();

    lv = (ListView) findViewById(R.id.list);
    lv.setPadding(0, 0, 0, 0);
    View v = View.inflate(ReplyActivity.this, R.layout.reply_header, null);
    content_tv = (TextView) v.findViewById(R.id.content);
    time_tv = (TextView) v.findViewById(R.id.time);
    private_cus = (LinearLayout) v.findViewById(R.id.private_cus);
    username = (TextView) v.findViewById(R.id.userName);
    reply = (LinearLayout) v.findViewById(R.id.reply);
    replyContent = (EditText) findViewById(R.id.add_reply);
    replySubmit = (TextView) findViewById(R.id.reply_submit);
    TextView v_return = (TextView) findViewById(R.id.tv_return);
    v_return.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View arg0) {
            finish();
          }
        });

    username.setText(getIntent().getExtras().get("user").toString());
    time_tv.setText(getIntent().getExtras().get("time").toString());
    content_tv.setText(getIntent().getExtras().get("comment").toString());
    commentId = getIntent().getExtras().get("commentId").toString();
    count = Integer.valueOf(getIntent().getExtras().get("count").toString());
    replySubmit.setOnClickListener(
        new OnClickListener() {

          @SuppressLint("NewApi")
          @Override
          public void onClick(View arg0) {
            // TODO Auto-generated method stub
            HashMap<String, String> commentParams = new HashMap<String, String>();
            content = ReplyActivity.this.replyContent.getText().toString();
            String sign = app.getSign();
            String user = app.getUser();
            SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); // 璁剧疆鏃ユ湡鏍煎紡
            time = df.format(new Date()); // new Date()涓鸿幏鍙栧綋鍓嶇郴缁熸椂闂�
            commentParams.put("commentId", commentId);
            commentParams.put("content", content);
            // if(sign.isEmpty()) {
            name = user;
            commentParams.put("name", user);
            /*} else {
            	name = sign;
            	commentParams.put("name", sign);
            }*/
            doTaskAsync(C.task.replyCreate, C.api.replyCreate, commentParams);
          }
        });

    private_cus.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View arg0) {
            // TODO Auto-generated method stub
            Intent user = new Intent();
            String user_name = getIntent().getExtras().get("user").toString();
            if (user_name == null) {
              user_name = "";
            }
            user.putExtra("user", user_name);
            user.setClass(ReplyActivity.this, ProfileActivity.class);
            ReplyActivity.this.startActivity(user);
          }
        });

    lv.addHeaderView(v);
    listItem = new ArrayList<Map<String, Object>>();
    /*adapter = new SimpleAdapter(this,listItem,R.layout.comment,
    new String[]{"user","time","comment"},
    new int[]{R.id.userName,R.id.time,R.id.content});*/
    adapter = new ReplyAdapter(ReplyActivity.this, listItem);
    lv.setAdapter(adapter);
    commentParams.put("commentId", commentId);
    doTaskAsync(C.task.replyList, C.api.replyList, commentParams);
  }
  @SuppressWarnings("unchecked")
  @Override
  public View createView(Context context) {
    actionBar.setBackgroundColor(0xff333333);
    actionBar.setItemsBackground(R.drawable.bar_selector_picker);
    actionBar.setBackButtonImage(R.drawable.ic_ab_back);
    actionBar.setActionBarMenuOnItemClick(
        new ActionBar.ActionBarMenuOnItemClick() {
          @Override
          public void onItemClick(int id) {
            if (id == -1) {
              if (Build.VERSION.SDK_INT < 11) {
                listView.setAdapter(null);
                listView = null;
                listAdapter = null;
              }
              finishFragment();
            } else if (id == 1) {
              if (delegate != null) {
                finishFragment(false);
                delegate.startPhotoSelectActivity();
              }
            } else if (id == item_photos) {
              if (selectedMode == 0) {
                return;
              }
              selectedMode = 0;
              dropDown.setText(LocaleController.getString("PickerPhotos", R.string.PickerPhotos));
              emptyView.setText(LocaleController.getString("NoPhotos", R.string.NoPhotos));
              listAdapter.notifyDataSetChanged();
            } else if (id == item_video) {
              if (selectedMode == 1) {
                return;
              }
              selectedMode = 1;
              dropDown.setText(LocaleController.getString("PickerVideo", R.string.PickerVideo));
              emptyView.setText(LocaleController.getString("NoVideo", R.string.NoVideo));
              listAdapter.notifyDataSetChanged();
            }
          }
        });

    ActionBarMenu menu = actionBar.createMenu();
    menu.addItem(1, R.drawable.ic_ab_other);

    fragmentView = new FrameLayout(context);

    FrameLayout frameLayout = (FrameLayout) fragmentView;
    frameLayout.setBackgroundColor(0xff000000);

    if (!singlePhoto) {
      selectedMode = 0;

      dropDownContainer = new ActionBarMenuItem(context, menu, R.drawable.bar_selector_picker);
      dropDownContainer.setSubMenuOpenSide(1);
      dropDownContainer.addSubItem(
          item_photos, LocaleController.getString("PickerPhotos", R.string.PickerPhotos), 0);
      dropDownContainer.addSubItem(
          item_video, LocaleController.getString("PickerVideo", R.string.PickerVideo), 0);
      actionBar.addView(dropDownContainer);
      FrameLayout.LayoutParams layoutParams =
          (FrameLayout.LayoutParams) dropDownContainer.getLayoutParams();
      layoutParams.height = LayoutHelper.MATCH_PARENT;
      layoutParams.width = LayoutHelper.WRAP_CONTENT;
      layoutParams.rightMargin = AndroidUtilities.dp(40);
      layoutParams.leftMargin =
          AndroidUtilities.isTablet() ? AndroidUtilities.dp(64) : AndroidUtilities.dp(56);
      layoutParams.gravity = Gravity.TOP | Gravity.LEFT;
      dropDownContainer.setLayoutParams(layoutParams);
      dropDownContainer.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View view) {
              dropDownContainer.toggleSubMenu();
            }
          });

      dropDown = new TextView(context);
      dropDown.setGravity(Gravity.LEFT);
      dropDown.setSingleLine(true);
      dropDown.setLines(1);
      dropDown.setMaxLines(1);
      dropDown.setEllipsize(TextUtils.TruncateAt.END);
      dropDown.setTextColor(0xffffffff);
      dropDown.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
      dropDown.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.ic_arrow_drop_down, 0);
      dropDown.setCompoundDrawablePadding(AndroidUtilities.dp(4));
      dropDown.setPadding(0, 0, AndroidUtilities.dp(10), 0);
      dropDown.setText(LocaleController.getString("PickerPhotos", R.string.PickerPhotos));
      dropDownContainer.addView(dropDown);
      layoutParams = (FrameLayout.LayoutParams) dropDown.getLayoutParams();
      layoutParams.width = LayoutHelper.WRAP_CONTENT;
      layoutParams.height = LayoutHelper.WRAP_CONTENT;
      layoutParams.leftMargin = AndroidUtilities.dp(16);
      layoutParams.gravity = Gravity.CENTER_VERTICAL;
      dropDown.setLayoutParams(layoutParams);
    } else {
      actionBar.setTitle(LocaleController.getString("Gallery", R.string.Gallery));
    }

    listView = new ListView(context);
    listView.setPadding(AndroidUtilities.dp(4), 0, AndroidUtilities.dp(4), AndroidUtilities.dp(4));
    listView.setClipToPadding(false);
    listView.setHorizontalScrollBarEnabled(false);
    listView.setVerticalScrollBarEnabled(false);
    listView.setSelector(new ColorDrawable(0));
    listView.setDividerHeight(0);
    listView.setDivider(null);
    listView.setDrawingCacheEnabled(false);
    listView.setScrollingCacheEnabled(false);
    frameLayout.addView(listView);
    FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) listView.getLayoutParams();
    layoutParams.width = LayoutHelper.MATCH_PARENT;
    layoutParams.height = LayoutHelper.MATCH_PARENT;
    layoutParams.bottomMargin = AndroidUtilities.dp(48);
    listView.setLayoutParams(layoutParams);
    listView.setAdapter(listAdapter = new ListAdapter(context));
    AndroidUtilities.setListViewEdgeEffectColor(listView, 0xff333333);

    emptyView = new TextView(context);
    emptyView.setTextColor(0xff808080);
    emptyView.setTextSize(20);
    emptyView.setGravity(Gravity.CENTER);
    emptyView.setVisibility(View.GONE);
    emptyView.setText(LocaleController.getString("NoPhotos", R.string.NoPhotos));
    frameLayout.addView(emptyView);
    layoutParams = (FrameLayout.LayoutParams) emptyView.getLayoutParams();
    layoutParams.width = LayoutHelper.MATCH_PARENT;
    layoutParams.height = LayoutHelper.MATCH_PARENT;
    layoutParams.bottomMargin = AndroidUtilities.dp(48);
    emptyView.setLayoutParams(layoutParams);
    emptyView.setOnTouchListener(
        new View.OnTouchListener() {
          @Override
          public boolean onTouch(View v, MotionEvent event) {
            return true;
          }
        });

    progressView = new FrameLayout(context);
    progressView.setVisibility(View.GONE);
    frameLayout.addView(progressView);
    layoutParams = (FrameLayout.LayoutParams) progressView.getLayoutParams();
    layoutParams.width = LayoutHelper.MATCH_PARENT;
    layoutParams.height = LayoutHelper.MATCH_PARENT;
    layoutParams.bottomMargin = AndroidUtilities.dp(48);
    progressView.setLayoutParams(layoutParams);

    ProgressBar progressBar = new ProgressBar(context);
    progressView.addView(progressBar);
    layoutParams = (FrameLayout.LayoutParams) progressView.getLayoutParams();
    layoutParams.width = LayoutHelper.WRAP_CONTENT;
    layoutParams.height = LayoutHelper.WRAP_CONTENT;
    layoutParams.gravity = Gravity.CENTER;
    progressView.setLayoutParams(layoutParams);

    pickerBottomLayout = new PickerBottomLayout(context);
    frameLayout.addView(pickerBottomLayout);
    layoutParams = (FrameLayout.LayoutParams) pickerBottomLayout.getLayoutParams();
    layoutParams.width = LayoutHelper.MATCH_PARENT;
    layoutParams.height = AndroidUtilities.dp(48);
    layoutParams.gravity = Gravity.BOTTOM;
    pickerBottomLayout.setLayoutParams(layoutParams);
    pickerBottomLayout.cancelButton.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            finishFragment();
          }
        });
    pickerBottomLayout.doneButton.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            sendSelectedPhotos();
            finishFragment();
          }
        });

    if (loading && (albumsSorted == null || albumsSorted != null && albumsSorted.isEmpty())) {
      progressView.setVisibility(View.VISIBLE);
      listView.setEmptyView(null);
    } else {
      progressView.setVisibility(View.GONE);
      listView.setEmptyView(emptyView);
    }
    pickerBottomLayout.updateSelectedCount(selectedPhotos.size() + selectedWebPhotos.size(), true);

    return fragmentView;
  }
 private void hideScanMediaMessage() {
   messageContainer.setVisibility(View.GONE);
   courseList.setPadding(0, initialCourseListPadding, 0, 0);
 }
Example #19
0
  public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    getActivity().getActionBar().setTitle("Green Route");
    destinations = getResources().getStringArray(R.array.green_destinations);
    headerColor = new ColorDrawable(Color.parseColor("#ffca28"));
    getActivity().getActionBar().setBackgroundDrawable(headerColor);
    greenDestinationLayout = (RelativeLayout) getView().findViewById(R.id.fragment_green);
    mRouteList = (ListView) getView().findViewById(R.id.green_cards);
    if (savedInstanceState != null) {
      mRouteList.setLayoutAnimation(null);
      justRotated = savedInstanceState.getBoolean("justRotated");
    }
    greenDestinationItems = new ArrayList<RouteItem>();
    greenDestinationItems.add(new RouteItem(destinations[1], R.drawable.tep, true));
    greenDestinationItems.add(new RouteItem(destinations[2], R.drawable.hub, true));
    greenDestinationItems.add(new RouteItem(destinations[3], R.drawable.fourteenthstreet, true));
    adapter =
        new DestinationAdapter(getActivity().getApplicationContext(), greenDestinationItems, false);
    mRouteList.setAdapter(adapter);
    mRouteList.setOnItemClickListener(new StopClickListener());
    mRouteList.setOnScrollListener(
        new AbsListView.OnScrollListener() {

          int mLastFirstVisibleItem = 0;

          @Override
          public void onScrollStateChanged(AbsListView absListView, int i) {}

          @Override
          public void onScroll(AbsListView absListView, int i, int i2, int i3) {
            final int currentFirstVisibleItem = mRouteList.getFirstVisiblePosition();
            if (currentFirstVisibleItem > mLastFirstVisibleItem) {
              if (justRotated) {
                getActivity().getActionBar().show();
                justRotated = false;
              } else {
                getActivity().getActionBar().hide();
              }
            } else if (currentFirstVisibleItem < mLastFirstVisibleItem) {
              if (!getActivity().getActionBar().isShowing() || headerColor.getAlpha() != 255) {
                final float ratio = (float) Math.min(Math.max(i, 0), i3) / i3;
                final float finalRatio = (float) (1 - ratio);
                int alphaVal = (int) (finalRatio * 255);
                Log.v("alphaVal", Float.toString(ratio));
                headerColor.setAlpha(alphaVal);
                getActivity().getActionBar().show();
              }
            }

            mLastFirstVisibleItem = currentFirstVisibleItem;
          }
        });
    SharedPreferences sharedPreferences =
        PreferenceManager.getDefaultSharedPreferences(getActivity().getApplicationContext());
    if (sharedPreferences.getBoolean("transparentNav", true)) {
      Window window = getActivity().getWindow();
      if (android.os.Build.VERSION.SDK_INT >= 19) {
        if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
          window.setFlags(
              WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION,
              WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
          int topPadding =
              getActivity()
                  .getApplicationContext()
                  .getResources()
                  .getDimensionPixelSize(R.dimen.padding_top_translucent);
          int bottomPadding =
              getActivity()
                  .getApplicationContext()
                  .getResources()
                  .getDimensionPixelSize(R.dimen.padding_bottom_translucent);
          mRouteList.setPadding(0, topPadding, 0, bottomPadding);
        } else {
          window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
          int topPadding =
              getActivity()
                  .getApplicationContext()
                  .getResources()
                  .getDimensionPixelSize(R.dimen.padding_top);
          int bottomPadding =
              getActivity()
                  .getApplicationContext()
                  .getResources()
                  .getDimensionPixelSize(R.dimen.padding_bottom);
          mRouteList.setPadding(0, topPadding, 0, bottomPadding);
        }
      }
    } else {
      Window window = getActivity().getWindow();
      window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
      int topPadding =
          getActivity()
              .getApplicationContext()
              .getResources()
              .getDimensionPixelSize(R.dimen.padding_top);
      int bottomPadding =
          getActivity()
              .getApplicationContext()
              .getResources()
              .getDimensionPixelSize(R.dimen.padding_bottom);
      mRouteList.setPadding(0, topPadding, 0, bottomPadding);
    }
  }