Java Code Examples for android.widget.ListView#setDividerHeight()

The following examples show how to use android.widget.ListView#setDividerHeight() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
private void init() {
        iLanguage();
        sendMessage("talk", getIPAddress() + strJoinToChatroom);
        app = (ApplicationUtil) this.getApplication();
        tvShow = (TextView) findViewById(R.id.tv_show);
        tvShow.setText(strShow);
        btnBack = (Button) findViewById(R.id.btn_back);
        btnBack.setOnClickListener(this);
        btnSend = (Button) findViewById(R.id.btn_send);
        btnSend.setText(strSend);
        btnSend.setOnClickListener(this);
        etContent = (EditText) findViewById(R.id.et_content);
        lvTalk = (ListView) findViewById(R.id.lv_talk);
        lvTalk.setDividerHeight(0);
        adapter = new TalkAdapter(this, list);
        lvTalk.setAdapter(adapter);
        lvTalk.smoothScrollToPosition(adapter.getCount() - 1);
//        tHandler.post(tRunnable);
        mThreadClient = new Thread(tRunnable);
        mThreadClient.start();
    }
 
Example 2
public StarkSpinner(@NonNull Context context, @Nullable AttributeSet attrs, @AttrRes int defStyleAttr, @StyleRes int defStyleRes) {
    super(context, attrs, defStyleAttr, defStyleRes);
    mContext = context;
    getAttributeSet(attrs, defStyleAttr, defStyleRes);

    final LayoutInflater factory = LayoutInflater.from(context);
    factory.inflate(R.layout.view_stark_spinner, this, true);

    mSpinnerListContainer = (LinearLayout) factory.inflate(R.layout.view_list, this, false);
    mSpinnerListView = (ListView) mSpinnerListContainer.findViewById(R.id.LstVw_SpinnerListView);
    if (mListItemDivider != null) {
        mSpinnerListView.setDivider(mListItemDivider);
        mSpinnerListView.setDividerHeight(mListDividerSize);
    }
    mEmptyTextView = (TextView) mSpinnerListContainer.findViewById(R.id.TxtVw_EmptyText);
    mSpinnerListView.setEmptyView(mEmptyTextView);
}
 
Example 3
public SearchableSpinner(@NonNull Context context, @Nullable AttributeSet attrs, @AttrRes int defStyleAttr, @StyleRes int defStyleRes) {
    super(context, attrs, defStyleAttr, defStyleRes);
    mContext = context;
    getAttributeSet(attrs, defStyleAttr, defStyleRes);

    final LayoutInflater factory = LayoutInflater.from(context);
    factory.inflate(R.layout.view_searchable_spinner, this, true);

    mSpinnerListContainer = (LinearLayout) factory.inflate(R.layout.view_list, this, false);
    mSpinnerListView = (ListView) mSpinnerListContainer.findViewById(R.id.LstVw_SpinnerListView);
    if (mListItemDivider != null) {
        mSpinnerListView.setDivider(mListItemDivider);
        mSpinnerListView.setDividerHeight(mListDividerSize);
    }
    mEmptyTextView = (TextView) mSpinnerListContainer.findViewById(R.id.TxtVw_EmptyText);
    mSpinnerListView.setEmptyView(mEmptyTextView);
}
 
Example 4
public static void setupDivider(Context context, ListView view, boolean useNewDivider) {
    if (useNewDivider) {
        int viewWidth = view.getWidth();
        // sometimes viewWidth is 0, and in this case we default to a reasonable value taken from dimens.xml
        int dividerWidth;
        if (viewWidth == 0) {
            dividerWidth = (int)context.getResources().getDimension(R.dimen.entity_select_divider_left_inset);
        } else {
            dividerWidth = (int)(viewWidth / 6.0);
        }
        dividerWidth += (int)context.getResources().getDimension(R.dimen.row_padding_horizontal);

        LayerDrawable dividerDrawable = (LayerDrawable)context.getResources().getDrawable(R.drawable.divider_case_list_modern);
        dividerDrawable.setLayerInset(0, dividerWidth, 0, 0, 0);

        view.setDivider(dividerDrawable);
        view.setDividerHeight((int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 1,
                context.getResources().getDisplayMetrics()));
    } else {
        view.setDivider(null);
    }
}
 
Example 5
Source Project: Ruisi   File: MySpinner.java    License: Apache License 2.0 6 votes vote down vote up
private void init() {
    listView = new ListView(mContext);
    listView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.WRAP_CONTENT));
    listView.setDivider(null);
    listView.setDividerHeight(0);
    listView.setOnItemClickListener(this);

    setWidth(ViewGroup.LayoutParams.MATCH_PARENT);
    setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);

    setBackgroundDrawable(ContextCompat.getDrawable(mContext, R.drawable.my_spinner_bg));
    setElevation(DimenUtils.dip2px(mContext, 4));

    setFocusable(true);
    setContentView(listView);
}
 
Example 6
@SuppressWarnings("deprecation")
protected void showPreferences() {
	ListView lv = getListView();
	if (lv != null) {
		lv.setBackgroundColor(this.getResources().getColor(R.color.bc_bg_color));
		lv.setCacheColorHint(this.getResources().getColor(R.color.bc_bg_color));
		lv.setSelector(R.drawable.setting_pref_item_background_selector);
		
		ColorDrawable dividerDrawable = new ColorDrawable(this.getResources().getColor(R.color.bc_green_blue_color));
		lv.setDivider(dividerDrawable);
		lv.setDividerHeight(1);
	}
	
	if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
		addPreferencesFromResource(R.xml.preferences);
	} else {
		loadSettingsFragment();
	}
}
 
Example 7
@Override
public void doContentSection() {
    ListView list = (ListView) contentView.findViewById(R.id.settings_list);

    // Don't render divider lines between elements
    list.setDivider(null);
    list.setDividerHeight(0);

    // Populate the list with data
    adapter = new EnumeratedListAdapter(getActivity(), getArguments().getStringArrayList(CHOICES_LIST), getArguments().getStringArrayList(DESCRIPTIONS_LIST), getArguments().getInt(INITIAL_SELECTION));
    list.setAdapter(adapter);
}
 
Example 8
Source Project: CrawlerForReader   File: ListDialog.java    License: Apache License 2.0 5 votes vote down vote up
public ListDialog.Builder setList(final String[] titles, final OnItemClickListener onItemClickListener) {
    if (titles == null || titles.length <= 0)
        return this;
    final ArrayAdapter<String> arrayAdapter = new ArrayAdapter<>(this.context, android.R.layout.simple_list_item_1);
    for (String title : titles) {
        arrayAdapter.add(title + "");
    }

    ListView listView = new ListView(context);
    listView.setLayoutParams(new ViewGroup.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));
    float scale = context.getApplicationContext().getResources().getDisplayMetrics().density;
    int dpAsPixels = (int) (8 * scale + 0.5f);
    listView.setPadding(0, dpAsPixels, 0, dpAsPixels);
    listView.setDividerHeight(0);
    listView.setAdapter(arrayAdapter);

    listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            if (onItemClickListener != null) {
                onItemClickListener.onItemClick(realBuilder, position, titles[position]);
            }
            realBuilder.dismiss();
        }
    });

    realBuilder.setContentView(listView);
    realBuilder.setCanceledOnTouchOutside(true);
    return this;
}
 
Example 9
/**
 * help to build ClassTableListView
 * @param ctx
 * @return
 */
public static ListView buildClassListView(Context ctx){
    ListView classListView = new ListView(ctx);
    classListView.setBackgroundColor(0);
    classListView.setCacheColorHint(0);
    classListView.setDividerHeight(0);
    return classListView;
}
 
Example 10
Source Project: DialogUtil   File: IosActionSheetHolder.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected void findViews() {
    lv = (ListView) rootView.findViewById(R.id.lv);
    textView = rootView.findViewById(R.id.tv_title);
    line = rootView.findViewById(R.id.v_line);

    lv.setDivider(new ColorDrawable(lv.getResources().getColor(R.color.dialogutil_line_dd)));
    lv.setDividerHeight(1);
    btnBottom = (Button) rootView.findViewById(R.id.btn_bottom);
}
 
Example 11
Source Project: MyWeather   File: MainActivity.java    License: Apache License 2.0 5 votes vote down vote up
private void showPreview() {
    final ArrayAdapter<String> arrayAdapter
            = new ArrayAdapter<String>(this,
            android.R.layout.simple_list_item_1);
    arrayAdapter.add("晴");
    arrayAdapter.add("多云");
    arrayAdapter.add("阴");
    arrayAdapter.add("雾");
    arrayAdapter.add("雨");
    arrayAdapter.add("雨夹雪");
    arrayAdapter.add("雪");
    arrayAdapter.add("霾");

    ListView listView = new ListView(this);
    listView.setLayoutParams(new ViewGroup.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));
    listView.setDividerHeight(1);
    listView.setAdapter(arrayAdapter);

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

    listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            mSkyView.setWeather(parent.getAdapter().getItem(position).toString());
            alert.dismiss();
        }
    });
    alert.setCanceledOnTouchOutside(true);
    alert.show();
}
 
Example 12
private void initView(Context context){

        mContentView = new FrameLayout(context);

        mListView = new ListView(context);
        mListView.setDividerHeight(ScreenUtils.dp2px(1.5f));
        mListView.setDivider(new ColorDrawable(Color.TRANSPARENT));
        mListView.setSelector(R.drawable.list_item_bg);
        mListView.setBackgroundColor(Color.TRANSPARENT);
        mAdapter = new MyAdapter();

        mContentView.addView(mListView);

        mEmptyView = new TextView(context);
        mEmptyView.setTextSize(TypedValue.COMPLEX_UNIT_PX, ResTools.getDimen(R.dimen.textsize2));
        mEmptyView.setTextColor(ResTools.getColor(R.color.text));
        mEmptyView.setGravity(Gravity.CENTER);
        mEmptyView.setText("empty");
        FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        lp.gravity = Gravity.CENTER_HORIZONTAL;
        lp.topMargin = (int)(ScreenUtils.getScreenSize().y*0.38f);
        mContentView.addView(mEmptyView, lp);

        mLoading = new TextView(context);
        mLoading.setTextSize(TypedValue.COMPLEX_UNIT_PX, ResTools.getDimen(R.dimen.textsize2));
        mLoading.setTextColor(ResTools.getColor(R.color.text));
        mLoading.setText("loading...");
        lp = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        lp.gravity = Gravity.CENTER_HORIZONTAL;
        lp.topMargin = ScreenUtils.getScreenSize().y/3;
        mContentView.addView(mLoading, lp);
    }
 
Example 13
Source Project: SuperDialog   File: SuperDialog.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 列表显示,显示列表屏蔽按钮
 */
private void initListView(ViewGroup viewRoot) {
    listView = new ListView(context);
    LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
    layoutParams.setMargins(dp2px(15), dp2px(5), dp2px(15), dp2px(5));
    listView.setLayoutParams(layoutParams);
    listView.setCacheColorHint(Color.TRANSPARENT);
    listView.setFadingEdgeLength(0);
    listView.setVerticalScrollBarEnabled(false);
    listView.setSelector(new ColorDrawable(Color.TRANSPARENT));
    listView.setDivider(new ColorDrawable(Color.LTGRAY));
    listView.setDividerHeight(dp2px(0.8f));
    if (dialogAdapter == null) {
        dialogAdapter = new ListDialogAdapter();
    }
    listView.setAdapter(dialogAdapter);
    listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            dismiss();
            if (listener != null) {
                listener.click(false, position);
            }
        }
    });

    listView.setLayoutAnimation(getLayoutAnimation());
    viewRoot.addView(listView);
}
 
Example 14
Source Project: scanvine-android   File: StoryListFragment.java    License: MIT License 5 votes vote down vote up
@Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
      ListView lv = (ListView) inflater.inflate(R.layout.fragment_story_list, container, false);
      lv.setDivider(null);
      lv.setDividerHeight(0);
return lv;

  }
 
Example 15
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    LayoutInflater inflater = getActivity().getLayoutInflater();
    View v = inflater.inflate(R.layout.sync_passphrase_types, null);

    // Configure the passphrase type list
    ListView list = (ListView) v.findViewById(R.id.passphrase_types);
    Adapter adapter = createAdapter(getCurrentTypeFromArguments());
    list.setAdapter(adapter);
    list.setId(R.id.passphrase_type_list);
    list.setOnItemClickListener(this);
    list.setDividerHeight(0);
    PassphraseType currentType = getCurrentTypeFromArguments();
    list.setSelection(adapter.getPositionForType(currentType));

    // Configure the hint to reset the passphrase settings
    // Only show this hint if encryption has been set to use sync passphrase
    if (currentType == PassphraseType.CUSTOM_PASSPHRASE) {
        TextView instructionsView = (TextView) v.findViewById(R.id.reset_sync_text);
        instructionsView.setVisibility(View.VISIBLE);
        instructionsView.setMovementMethod(LinkMovementMethod.getInstance());
        instructionsView.setText(getResetText());
    }

    // Create and return the dialog
    return new AlertDialog.Builder(getActivity(), R.style.AlertDialogTheme)
            .setNegativeButton(R.string.cancel, this)
            .setTitle(R.string.sync_passphrase_type_title)
            .setView(v)
            .create();
}
 
Example 16
public void selectPageDialog() {
    if (context == null)
        context = App.getActivity();
    final int[] pages = new int[pagination.getAll()];

    for (int i = 0; i < pagination.getAll(); i++)
        pages[i] = i + 1;

    final ListView listView = new ListView(context);
    listView.setDivider(null);
    listView.setDividerHeight(0);
    listView.setFastScrollEnabled(true);

    listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
    listView.setAdapter(new PaginationAdapter(context, pages));
    listView.setItemChecked(pagination.getCurrent() - 1, true);
    listView.setSelection(pagination.getCurrent() - 1);

    AlertDialog dialog = new AlertDialog.Builder(context)
            .setView(listView)
            .show();

    if (dialog.getWindow() != null)
        dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);

    listView.setOnItemClickListener((adapterView, view1, i2, l) -> {
        if (listView.getTag() != null && !((Boolean) listView.getTag())) {
            return;
        }
        selectPage(i2 * pagination.getPerPage());
        dialog.cancel();
    });
}
 
Example 17
Source Project: MemoryCleaner   File: SettingFragment.java    License: Apache License 2.0 5 votes vote down vote up
@Override public void initPreferenceListView(View view) {
    ListView listView = (ListView) view.findViewById(android.R.id.list);
    listView.setHorizontalScrollBarEnabled(false);
    listView.setVerticalScrollBarEnabled(false);
    listView.setDivider(
            new ColorDrawable(getResources().getColor(R.color.grey)));
    listView.setDividerHeight((int) getResources().getDimension(
            R.dimen.preference_divider_height));
    listView.setFooterDividersEnabled(false);
    listView.setHeaderDividersEnabled(false);
}
 
Example 18
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    LayoutInflater inflater = getActivity().getLayoutInflater();
    View v = inflater.inflate(R.layout.sync_passphrase_types, null);

    // Configure the passphrase type list
    ListView list = (ListView) v.findViewById(R.id.passphrase_types);
    Adapter adapter = createAdapter(getCurrentTypeFromArguments());
    list.setAdapter(adapter);
    list.setId(R.id.passphrase_type_list);
    list.setOnItemClickListener(this);
    list.setDividerHeight(0);
    PassphraseType currentType = getCurrentTypeFromArguments();
    list.setSelection(adapter.getPositionForType(currentType));

    // Configure the hint to reset the passphrase settings
    // Only show this hint if encryption has been set to use sync passphrase
    if (currentType == PassphraseType.CUSTOM_PASSPHRASE) {
        TextView instructionsView = (TextView) v.findViewById(R.id.reset_sync_text);
        instructionsView.setVisibility(View.VISIBLE);
        instructionsView.setMovementMethod(LinkMovementMethod.getInstance());
        instructionsView.setText(getResetText());
    }

    // Create and return the dialog
    return new AlertDialog.Builder(getActivity(), R.style.AlertDialogTheme)
            .setNegativeButton(R.string.cancel, this)
            .setTitle(R.string.sync_passphrase_type_title)
            .setView(v)
            .create();
}
 
Example 19
@SuppressWarnings("UnusedAssignment")
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
	Activity activity = getActivity();
	holder = getAttachmentHolder(EXTRA_ATTACHMENT_INDEX);
	FileHolder fileHolder = holder != null ? DraftsStorage.getInstance()
			.getAttachmentDraftFileHolder(holder.hash) : null;
	if (holder == null || fileHolder == null) {
		dismiss();
		return new Dialog(activity);
	}
	ChanConfiguration.Posting postingConfiguration = getPostingConfiguration();
	int index = 0;
	optionItems.clear();
	optionIndexes.clear();
	optionItems.add(new OptionItem(getString(R.string.text_unique_hash), OPTION_TYPE_UNIQUE_HASH,
			holder.optionUniqueHash));
	optionIndexes.append(OPTION_TYPE_UNIQUE_HASH, index++);
	if (GraphicsUtils.canRemoveMetadata(fileHolder)) {
		optionItems.add(new OptionItem(getString(R.string.text_remove_metadata), OPTION_TYPE_REMOVE_METADATA,
				holder.optionRemoveMetadata));
		optionIndexes.append(OPTION_TYPE_REMOVE_METADATA, index++);
	}
	if (fileHolder.isImage()) {
		optionItems.add(new OptionItem(getString(R.string.text_reencode_image), OPTION_TYPE_REENCODE_IMAGE,
				holder.reencoding != null));
		optionIndexes.append(OPTION_TYPE_REENCODE_IMAGE, index++);
	}
	optionItems.add(new OptionItem(getString(R.string.text_remove_file_name), OPTION_TYPE_REMOVE_FILE_NAME,
			holder.optionRemoveFileName));
	optionIndexes.append(OPTION_TYPE_REMOVE_FILE_NAME, index++);
	if (postingConfiguration.attachmentSpoiler) {
		optionItems.add(new OptionItem(getString(R.string.text_spoiler), OPTION_TYPE_SPOILER,
				holder.optionSpoiler));
		optionIndexes.append(OPTION_TYPE_SPOILER, index++);
	}
	ArrayList<String> items = new ArrayList<>();
	for (OptionItem optionItem : optionItems) {
		items.add(optionItem.title);
	}
	LinearLayout linearLayout = new LinearLayout(activity);
	linearLayout.setOrientation(LinearLayout.VERTICAL);
	ImageView imageView = new ImageView(activity);
	imageView.setBackground(new TransparentTileDrawable(activity, true));
	imageView.setImageDrawable(holder.imageView.getDrawable());
	imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
	linearLayout.addView(imageView, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, 0, 1));
	listView = new ListView(activity);
	linearLayout.addView(listView, LinearLayout.LayoutParams.MATCH_PARENT,
			LinearLayout.LayoutParams.WRAP_CONTENT);
	listView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
	int resId = ResourceUtils.obtainAlertDialogLayoutResId(activity, ResourceUtils.DIALOG_LAYOUT_MULTI_CHOICE);
	if (C.API_LOLLIPOP) {
		listView.setDividerHeight(0);
	}
	ItemsAdapter adapter = new ItemsAdapter(activity, resId, items);
	listView.setAdapter(adapter);
	for (int i = 0; i < optionItems.size(); i++) {
		listView.setItemChecked(i, optionItems.get(i).checked);
	}
	listView.setOnItemClickListener(this);
	updateItemsEnabled(adapter, holder);
	AlertDialog dialog = new AlertDialog.Builder(activity).setView(linearLayout).create();
	dialog.setCanceledOnTouchOutside(true);
	return dialog;
}
 
Example 20
@SuppressWarnings("unchecked")
@Override
public View createView(Context context) {
    actionBar.setBackgroundColor(Theme.ACTION_BAR_MEDIA_PICKER_COLOR);
    actionBar.setItemsBackgroundColor(Theme.ACTION_BAR_PICKER_SELECTOR_COLOR);
    // actionBar.setBackButtonImage(R.drawable.ic_ab_back);
    actionBar.setBackText(context.getString(R.string.Cancel));
    actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
        @Override
        public void onItemClick(int id) {
            if (id == -1) {
                finishFragment();
            } else if (id == 1) {
                if (delegate != null) {
                    finishFragment(false);
                    delegate.startPhotoSelectActivity();
                }
            } else if (id == item_photos) {
                refreshShowPic();//刷新照片目录
            } else if (id == item_video) {
                refreshShowVedio();//刷新录像目录
            }
        }
    });


    fragmentView = new FrameLayout(context);

    FrameLayout frameLayout = (FrameLayout) fragmentView;
    frameLayout.setBackgroundColor(DarkTheme ? 0xff000000 : 0xffffffff);
    //==============videos pick====================
    int res = !singlePhoto && filterMimeTypes.length > 0 ? R.string.PickerVideo : R.string.Album;
    actionBar.setTitle(context.getString(res));
    selectedMode = filterMimeTypes.length > 0 ? 1 : selectedMode;
    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(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);


    if (loading && (albumsSorted == null || albumsSorted != null && albumsSorted.isEmpty())) {
        progressView.setVisibility(View.VISIBLE);
        listView.setEmptyView(null);
    } else {
        progressView.setVisibility(View.GONE);
        listView.setEmptyView(emptyView);
    }
    return fragmentView;
}