Java Code Examples for android.widget.FrameLayout#setVisibility()

The following examples show how to use android.widget.FrameLayout#setVisibility() . 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 check out the related API usage on the sidebar.
Example 1
Source File: TaskbarController.java    From Taskbar with Apache License 2.0 6 votes vote down vote up
@VisibleForTesting
void scrollTaskbar(FrameLayout scrollView,
                   LinearLayout taskbar,
                   String taskbarPosition,
                   String sortOrder,
                   boolean shouldRefreshRecents) {
    if (TaskbarPosition.isVertical(taskbarPosition)) {
        if (sortOrder.contains("false")) {
            scrollView.scrollTo(taskbar.getWidth(), taskbar.getHeight());
        } else if (sortOrder.contains("true")) {
            scrollView.scrollTo(0, 0);
        }
    } else {
        if (sortOrder.contains("false")) {
            scrollView.scrollTo(0, 0);
        } else if (sortOrder.contains("true")) {
            scrollView.scrollTo(taskbar.getWidth(), taskbar.getHeight());
        }
    }

    if (shouldRefreshRecents) {
        scrollView.setVisibility(View.VISIBLE);
    }
}
 
Example 2
Source File: NeighborsFragment.java    From android-wallet-app with GNU General Public License v3.0 6 votes vote down vote up
private void hideReavelEditText(final FrameLayout view) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        int cx = view.getRight() - 30;
        int cy = view.getBottom() - 60;
        int initialRadius = view.getWidth();

        Animator anim = ViewAnimationUtils.createCircularReveal(view, cx, cy, initialRadius, 0);
        anim.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                super.onAnimationEnd(animation);
                view.setVisibility(View.INVISIBLE);
            }
        });
        isEditTextVisible = false;
        anim.start();
    } else {
        view.setVisibility(View.INVISIBLE);
        isEditTextVisible = false;
    }
}
 
Example 3
Source File: InfoBarContainer.java    From android-chromium with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public InfoBarContainer(Activity activity, AutoLoginProcessor autoLoginProcessor,
        int tabId, ViewGroup parentView, int nativeWebContents) {
    super(activity);
    setOrientation(LinearLayout.VERTICAL);
    mAnimationListener = null;
    mInfoBarTransitions = new ArrayDeque<InfoBarTransitionInfo>();

    mAutoLoginDelegate = new AutoLoginDelegate(autoLoginProcessor, activity);
    mActivity = activity;
    mTabId = tabId;
    mParentView = parentView;

    mAnimationSizer = new FrameLayout(activity);
    mAnimationSizer.setVisibility(INVISIBLE);

    // The tablet has the infobars below the location bar. On the phone they are at the bottom.
    mInfoBarsOnTop = DeviceUtils.isTablet(activity);
    setGravity(determineGravity());

    // Chromium's InfoBarContainer may add an InfoBar immediately during this initialization
    // call, so make sure everything in the InfoBarContainer is completely ready beforehand.
    mNativeInfoBarContainer = nativeInit(nativeWebContents, mAutoLoginDelegate);
}
 
Example 4
Source File: MultiVideoCallActivity.java    From sealtalk-android with MIT License 6 votes vote down vote up
void addRemoteVideo(View singleRemoteView, SurfaceView video, String userId) {
        if (singleRemoteView == null)
            return;
        FrameLayout remoteVideoView = (FrameLayout) singleRemoteView.findViewById(R.id.viewlet_remote_video_user);
        remoteVideoView.removeAllViews();
        if (video.getParent() != null) {
            ((ViewGroup) video.getParent()).removeView(video);
        }
        remoteVideoView.addView(video, new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT));
//        TextView remoteNameTextView = new TextView(this);
//        TextView tv = (TextView) singleRemoteView.findViewById(R.id.user_name);
//        ViewGroup.LayoutParams params = tv.getLayoutParams();
//        remoteNameTextView.setLayoutParams(params);
//        remoteNameTextView.setTextAppearance(this, R.style.rc_voip_text_style_style);
//        UserInfo userInfo = RongContext.getInstance().getUserInfoFromCache(userId);
//        if (userInfo != null) {
//            remoteNameTextView.setText(userInfo.getName());
//        } else {
//            remoteNameTextView.setText(userId);
//        }
//        remoteVideoView.addView(remoteNameTextView);
        remoteVideoView.setVisibility(View.VISIBLE);
        remoteVideoView.setTag(userId);
    }
 
Example 5
Source File: AdapterPlayer.java    From DMusic with Apache License 2.0 6 votes vote down vote up
protected void initView(View root) {
    flytThumbnail = (FrameLayout) root.findViewById(R.id.flyt_thumbnail);
    ivThumbnail = (ImageView) root.findViewById(R.id.iv_thumbnail);
    ivThumbnailPlay = (ImageView) root.findViewById(R.id.iv_thumbnail_play);
    flytThumbnail.setVisibility(VISIBLE);
    ivThumbnailPlay.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            if (player == null) {
                return;
            }
            player.pause();
            Util.peelInject(player, AdapterPlayer.this);
            flytThumbnail.setVisibility(GONE);
            player.play(url);
        }
    });
}
 
Example 6
Source File: PullRefreshReplyAdapter.java    From V2EX with GNU General Public License v3.0 6 votes vote down vote up
public PullRefreshReplyAdapter(Context context, RecyclerView.Adapter<RecyclerView.ViewHolder> adapter){
    this.mAdapter = adapter;
    this.mContext = context;

    FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 200);
    mFooterViewGroup = new FrameLayout(mContext);
    mFooterViewGroup.setLayoutParams(layoutParams);
    mPbLoading = new ProgressBar(mContext);
    mPbLoading.setLayoutParams(new FrameLayout.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT, 80));
    mFooterViewGroup.addView(mPbLoading);
    mFooterViewGroup.setVisibility(View.INVISIBLE);

    mTvStatus = new TextView(mContext);
    mTvStatus.setTextSize(15);
    mTvStatus.setLayoutParams(new FrameLayout.LayoutParams(
            FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT));
    mTvStatus.setGravity(Gravity.CENTER);
}
 
Example 7
Source File: BasicListComponent.java    From weex-uikit with MIT License 5 votes vote down vote up
private ListBaseViewHolder createVHForRefreshComponent(int viewType) {
  FrameLayout view = new FrameLayout(getContext());
  view.setBackgroundColor(Color.WHITE);
  view.setLayoutParams(new FrameLayout.LayoutParams(1, 1));
  view.setVisibility(View.GONE);
  return new ListBaseViewHolder(view, viewType);
}
 
Example 8
Source File: DropDownMenu.java    From DropDownMenu with Apache License 2.0 5 votes vote down vote up
public void setContentView(View contentView) {
    removeAllViews();

    /*
     * 1.顶部筛选条
     */
    fixedTabIndicator = new FixedTabIndicator(getContext());
    fixedTabIndicator.setId(R.id.fixedTabIndicator);
    addView(fixedTabIndicator, -1, UIUtil.dp(getContext(), 50));

    LayoutParams params = new LayoutParams(-1, -1);
    params.addRule(BELOW, R.id.fixedTabIndicator);

    /*
     * 2.添加contentView,内容界面
     */
    addView(contentView, params);

    /*
     * 3.添加展开页面,装载筛选器list
     */
    frameLayoutContainer = new FrameLayout(getContext());
    frameLayoutContainer.setBackgroundColor(getResources().getColor(R.color.black_p50));
    addView(frameLayoutContainer, params);

    frameLayoutContainer.setVisibility(GONE);

    initListener();
    initAnimation();
}
 
Example 9
Source File: BasicListComponent.java    From ucar-weex-core with Apache License 2.0 5 votes vote down vote up
private ListBaseViewHolder createVHForRefreshComponent(int viewType) {
  FrameLayout view = new FrameLayout(getContext());
  view.setBackgroundColor(Color.WHITE);
  view.setLayoutParams(new FrameLayout.LayoutParams(1, 1));
  view.setVisibility(View.GONE);
  return new ListBaseViewHolder(view, viewType);
}
 
Example 10
Source File: PreviewMorphAnimator.java    From PreviewSeekBar with Apache License 2.0 5 votes vote down vote up
/**
 * Starts the circular reveal of the preview with an overlay above that fades out
 */
private void startCircularReveal(final FrameLayout previewView,
                                 final View overlayView,
                                 final View morphView) {
    isMorphingToShow = true;

    float startRadius = previewView.getHeight() / 2f;
    float endRadius = getRadius(previewView);
    long duration = morphShowDuration;

    morphAnimator = ViewAnimationUtils.createCircularReveal(previewView,
            getCenterX(previewView),
            getCenterY(previewView),
            startRadius,
            endRadius);
    morphAnimator.setTarget(previewView);
    morphAnimator.setInterpolator(new AccelerateInterpolator());
    morphAnimator.setDuration(duration);
    morphAnimator.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            isMorphingToShow = false;
            isShowing = false;
            overlayView.setAlpha(0.0f);
            overlayView.setVisibility(View.INVISIBLE);
        }
    });
    morphAnimator.start();
    previewView.setVisibility(View.VISIBLE);
    overlayView.setVisibility(View.VISIBLE);
    morphView.setVisibility(View.INVISIBLE);
    overlayView.animate()
            .alpha(0f)
            .setDuration(morphShowDuration / 2);

}
 
Example 11
Source File: ChallengeTwoFragment.java    From android-crackme-challenge with MIT License 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_challenge_two, container, false);

    // Handle authentication attempts
    final Button btnCheck = (Button) view.findViewById(R.id.challenge_two_button_check);
    btnCheck.setOnClickListener(new ChallengeTwoFragmentOnClickListener());

    // Hide the form error message until the user actually has an error
    final FrameLayout formError = (FrameLayout) view.findViewById(R.id.corpnet_form_error);
    formError.setVisibility(View.GONE);

    return view;
}
 
Example 12
Source File: QuestionWidget.java    From commcare-android with Apache License 2.0 5 votes vote down vote up
private void addHelpPlaceholder() {
    if (!mPrompt.hasHelp()) {
        return;
    }

    helpPlaceholder = new FrameLayout(this.getContext());
    helpPlaceholder.setLayoutParams(new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT,
            FrameLayout.LayoutParams.WRAP_CONTENT));

    final ImageButton trigger = new ImageButton(getContext());
    trigger.setScaleType(ScaleType.FIT_CENTER);
    trigger.setImageResource(R.drawable.icon_info_outline_lightcool);
    trigger.setBackgroundDrawable(null);
    trigger.setOnClickListener(v -> {
        trigger.setImageResource(R.drawable.icon_info_fill_lightcool);
        fireHelpText(() -> {
            // back to the old icon
            trigger.setImageResource(R.drawable.icon_info_outline_lightcool);
        });
    });
    trigger.setId(847294011);
    LinearLayout triggerLayout = new LinearLayout(getContext());
    triggerLayout.setOrientation(LinearLayout.HORIZONTAL);
    triggerLayout.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT));
    triggerLayout.setGravity(Gravity.RIGHT);
    triggerLayout.addView(trigger);

    MediaLayout helpLayout = createHelpLayout();
    helpLayout.setBackgroundResource(R.color.very_light_blue);
    helpPlaceholder.addView(helpLayout);

    this.addView(triggerLayout);
    this.addView(helpPlaceholder);
    helpPlaceholder.setVisibility(View.GONE);
}
 
Example 13
Source File: ActionBarActivity.java    From Yahala-Messenger with MIT License 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);

    try {
        openAnimation = AnimationUtils.loadAnimation(this, R.anim.scale_in);
        closeAnimation = AnimationUtils.loadAnimation(this, R.anim.scale_out);
    } catch (Exception e) {
        FileLog.e("tmessages", e);
    }

    setTheme(R.style.Theme_TMessages);
    getWindow().setBackgroundDrawableResource(R.drawable.transparent);

    contentView = new FrameLayoutTouch(this);
    setContentView(contentView, new ViewGroup.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT));

    containerViewBack = new FrameLayout(this);
    contentView.addView(containerViewBack);

    containerView = new FrameLayout(this);
    contentView.addView(containerView);

    shadowView = new FrameLayout(this);
    contentView.addView(shadowView);
    shadowView.setBackgroundResource(R.drawable.shadow);
    ViewGroup.LayoutParams layoutParams = shadowView.getLayoutParams();
    layoutParams.width = OSUtilities.dp(2);
    layoutParams.height = FrameLayout.LayoutParams.MATCH_PARENT;
    shadowView.setLayoutParams(layoutParams);
    shadowView.setVisibility(View.INVISIBLE);

    actionBar = new ActionBar(this);
    contentView.addView(actionBar);
    layoutParams = actionBar.getLayoutParams();
    layoutParams.width = FrameLayout.LayoutParams.MATCH_PARENT;
    actionBar.setLayoutParams(layoutParams);

    for (BaseFragment fragment : fragmentsStack) {
        fragment.setParentActivity(this);
    }

    needLayout();
}
 
Example 14
Source File: PhotoAlbumPickerActivity.java    From KrGallery with GNU General Public License v2.0 4 votes vote down vote up
@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;
}
 
Example 15
Source File: MainActivity.java    From AndroidApp with Mozilla Public License 2.0 4 votes vote down vote up
public void showLoadingScreen() {
    FrameLayout loaderContainer = findViewById(R.id.loaderContainer);
    loaderContainer.setVisibility(View.VISIBLE);
    hideNavigation();
}
 
Example 16
Source File: MainLayout.java    From emerald with GNU General Public License v3.0 4 votes vote down vote up
public static RelativeLayout get(Context context, SharedPreferences options) {
	RelativeLayout mainLayout = new RelativeLayout(context);
	LayoutInflater layoutInflater = (LayoutInflater) 
		context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

	addDockBar(mainLayout, layoutInflater, options);

	boolean kitkatNoImmersiveMode = (Build.VERSION.SDK_INT == 19 && !options.getBoolean(Keys.FULLSCREEN, false));
	FrameLayout mainBar = (FrameLayout) layoutInflater.inflate(R.layout.main_bar, mainLayout, false);
	RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(mainBar.getLayoutParams());
	
	GridView grid = (GridView) layoutInflater.inflate(R.layout.apps_grid, mainLayout, false);
	initAppsGrid(grid, options);
	
	if (options.getBoolean(Keys.BOTTOM_MAIN_BAR, true)) {
		layoutParams.addRule(RelativeLayout.ABOVE, R.id.dock_bar);
		mainBar.setLayoutParams(layoutParams);
		mainLayout.addView(mainBar);
		
		if (kitkatNoImmersiveMode) {
			mainLayout.addView(getFakeStatusBar(mainLayout, layoutInflater, options));
		}
		layoutParams = new RelativeLayout.LayoutParams(grid.getLayoutParams());
		if (kitkatNoImmersiveMode) {
			layoutParams.addRule(RelativeLayout.BELOW, R.id.kitkat_status_bar);
		} else {
			layoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP);
		}
		layoutParams.addRule(RelativeLayout.ABOVE, R.id.main_bar);
		grid.setLayoutParams(layoutParams);
		mainLayout.addView(grid);
	} else {
		if (!kitkatNoImmersiveMode) {
			layoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP);
		} else {
			mainLayout.addView(getFakeStatusBar(mainLayout, layoutInflater, options));
			layoutParams.addRule(RelativeLayout.BELOW, R.id.kitkat_status_bar);
		}
		
		mainBar.setLayoutParams(layoutParams);
		mainLayout.addView(mainBar);
		
		layoutParams = new RelativeLayout.LayoutParams(grid.getLayoutParams());
		layoutParams.addRule(RelativeLayout.ABOVE, R.id.dock_bar);
		layoutParams.addRule(RelativeLayout.BELOW, R.id.main_bar);
		grid.setLayoutParams(layoutParams);
		mainLayout.addView(grid);
	}
	if (options.getBoolean(Keys.HIDE_MAIN_BAR, false)) {
		mainBar.setVisibility(View.GONE);
	}
	mainBar.setBackgroundColor(options.getInt(Keys.BAR_BACKGROUND, 0x22000000));
	
	return mainLayout;
}
 
Example 17
Source File: DropDownMenu.java    From AcgClub with MIT License 4 votes vote down vote up
/**
 * 初始化DropDownMenu
 */
public void setDropDownMenu(@NonNull List<String> tabTexts, @NonNull List<View> popupViews,
    @NonNull View contentView) {
  if (tabTexts.size() != popupViews.size()) {
    throw new IllegalArgumentException(
        "params not match, tabTexts.size() should be equal popupViews.size()");
  }

  for (int i = 0; i < tabTexts.size(); i++) {
    addTab(tabTexts, i);
  }
  containerView.addView(contentView, 0);

  maskView = new View(getContext());
  maskView.setLayoutParams(new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT,
      FrameLayout.LayoutParams.MATCH_PARENT));
  maskView.setBackgroundColor(maskColor);
  maskView.setOnClickListener(new OnClickListener() {
    @Override
    public void onClick(View v) {
      closeMenu();
    }
  });
  containerView.addView(maskView, 1);
  maskView.setVisibility(GONE);
  if (containerView.getChildAt(2) != null) {
    containerView.removeViewAt(2);
  }

  popupMenuViews = new FrameLayout(getContext());
  popupMenuViews
      .setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, (int) (
          DimenUtils.getScreenSize(getContext()).y * menuHeighPercent)));
  popupMenuViews.setVisibility(GONE);
  containerView.addView(popupMenuViews, 2);

  for (int i = 0; i < popupViews.size(); i++) {
    popupViews.get(i).setLayoutParams(
        new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.WRAP_CONTENT));
    popupMenuViews.addView(popupViews.get(i), i);
  }

}
 
Example 18
Source File: MainActivity.java    From BmapLite with Apache License 2.0 4 votes vote down vote up
@Override
protected void initView(int layoutID) {
    super.initView(layoutID);

    final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    toolbar.setTitle("");
    setSupportActionBar(toolbar);

    textSearch = getView(R.id.text_search);
    mTextPoiName = getView(R.id.text_poi_name);
    mTextPoiDistance = getView(R.id.text_poi_distance);
    mTextCollection = getView(R.id.text_collection);
    mTextStreet = getView(R.id.text_street);
    mTextNearby = getView(R.id.text_nearby);
    mTextDetails = getView(R.id.text_details);
    mTextShare = getView(R.id.text_share);
    mRecycleResult = getView(R.id.recycler_result);

    mLayPoi = getView(R.id.lay_poi);
    mLaySearchResult = getView(R.id.lay_search_result);

    btnLine = getView(R.id.fab_line);
    //mBtnRoute = getView(R.id.fab_route);
    //btnLine.setOnClickListener(this);
    textSearch.setOnClickListener(this);

    LinearLayoutManager layoutManager = new LinearLayoutManager(this);
    layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
    mRecycleResult.setLayoutManager(layoutManager);
    mRecycleResult.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL));

    mDrawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    final ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, mDrawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
    mDrawer.addDrawerListener(toggle);
    toggle.syncState();

    NavigationView navigationView = getView(R.id.nav_view);
    navigationView.setNavigationItemSelectedListener(this);
    mMenuRanging = navigationView.getMenu().findItem(R.id.nav_ranging);
    if (BApp.TYPE_MAP == TypeMap.TYPE_AMAP) {
        navigationView.getMenu().findItem(R.id.nav_change_map).setTitle("切换百度地图");
    } else if (BApp.TYPE_MAP == TypeMap.TYPE_BAIDU) {
        navigationView.getMenu().findItem(R.id.nav_change_map).setTitle("切换高德地图");
    }


    int statusHeight = StatusBarUtils.getStatusBarHeight(this);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        StatusBarUtils.setStatusBarColor(this, Color.TRANSPARENT);

        CardView cardView = getView(R.id.card_view);
        CoordinatorLayout.LayoutParams layoutParams2 = new CoordinatorLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, AppUtils.dip2Px(this, 45));
        layoutParams2.topMargin = statusHeight + AppUtils.dip2Px(this, 10);
        layoutParams2.rightMargin = AppUtils.dip2Px(this, 10);
        layoutParams2.leftMargin = AppUtils.dip2Px(this, 10);
        layoutParams2.bottomMargin = AppUtils.dip2Px(this, 10);
        cardView.setLayoutParams(layoutParams2);

        FrameLayout layStatus = getView(R.id.lay_status);
        layStatus.setLayoutParams(new CoordinatorLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, statusHeight));
        layStatus.setVisibility(View.VISIBLE);

    }

    initMap();

    showPoiLay(null, -1);

}
 
Example 19
Source File: TrendAdapter.java    From JianshuApp with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected void convert(BaseViewHolder holder, TrendArticle entity) {
    holder.setText(R.id.last_compiled_time, formatTime(entity.getPublishTime()));
    holder.setText(R.id.collection_tag, getSubjectTitle(entity));

    String avatarUrl = getAvatar(entity);
    if (!TextUtils.isEmpty(avatarUrl)) {
        UniversalDraweeView draweeViewAuthorAvatar = holder.getView(R.id.author_avatar);
        draweeViewAuthorAvatar.setImageURI(avatarUrl);
    }

    TextView tvAuthorName = holder.getView(R.id.author_name);
    TextView tvTitle = holder.getView(R.id.title);
    TextView tvExtraInfo = holder.getView(R.id.extra_info);
    UniversalDraweeView draweeViewImage = holder.getView(R.id.image);
    RelativeLayout rlAvatarName = holder.getView(R.id.avatar_name);
    FrameLayout flCollectionTagContainer = holder.getView(R.id.collection_tag_container);

    boolean shouldSetSelected = ArticleDetailDao.isRead(entity.getId());
    String userNickname = getNickname(entity);
    if (!TextUtils.isEmpty(userNickname)) {
        tvAuthorName.setText(userNickname);
        tvAuthorName.setSelected(shouldSetSelected);
    }
    tvTitle.setText(entity.getTitle());
    tvTitle.setSelected(shouldSetSelected);
    tvExtraInfo.setText(getExtraInfo(entity));
    tvExtraInfo.setCompoundDrawablesWithIntrinsicBounds(entity.isHasVideo() ? mDefaultVideoIcon : null, null, null, null);
    if (TextUtils.isEmpty(entity.getImage())) {
        draweeViewImage.setVisibility(View.GONE);
    } else {
        draweeViewImage.setVisibility(View.VISIBLE);
        String thumbUrl = ImageUtils.format(entity.getImage(), DisplayInfo.dp2px(80));
        draweeViewImage.setImageURI(thumbUrl);
    }

    rlAvatarName.setTag(holder.getLayoutPosition());
    rlAvatarName.setOnClickListener(this);

    flCollectionTagContainer.setTag(holder.getLayoutPosition());
    flCollectionTagContainer.setOnClickListener(this);
    if (TextUtils.isEmpty(getSubjectTitle(entity))) {
        flCollectionTagContainer.setVisibility(View.GONE);
    } else {
        flCollectionTagContainer.setVisibility(View.VISIBLE);
    }

    holder.setTag(R.id.root_view, holder.getLayoutPosition());
    holder.setOnClickListener(R.id.root_view, this);
}
 
Example 20
Source File: MLAlertController.java    From NewXmPluginSDK with Apache License 2.0 4 votes vote down vote up
private void setupView() {
        LinearLayout contentPanel = (LinearLayout) mWindow.findViewById(R.id.contentPanel);
        setupContent(contentPanel);
        boolean hasButtons = setupButtons();

        LinearLayout topPanel = (LinearLayout) mWindow.findViewById(R.id.topPanel);
        boolean hasTitle = setupTitle(topPanel);

        View buttonPanel = mWindow.findViewById(R.id.buttonPanel);
        if (!hasButtons) {
            buttonPanel.setVisibility(View.GONE);
        }

        FrameLayout customPanel = (FrameLayout) mWindow.findViewById(R.id.customPanel);
        if (mView != null) {
            // 自定义dialog透明背景
            // mWindow.findViewById(R.id.parentPanel).setBackgroundColor(mContext.getResources().getColor(android.R.color.transparent));
            FrameLayout custom = (FrameLayout) mWindow.findViewById(R.id.custom);
            custom.addView(mView);
            if (mViewSpacingSpecified) {
                custom.setPadding(mViewSpacingLeft, mViewSpacingTop, mViewSpacingRight,
                        mViewSpacingBottom);
                if (mCustomBgTransplant)
                    mTransplantBg = true;
            }
            if (mListView != null) {
                ((LinearLayout.LayoutParams) customPanel.getLayoutParams()).weight = 0;
            }
        } else {
            customPanel.setVisibility(View.GONE);
        }

        if (mTransplantBg) {
            mWindow.findViewById(R.id.parentPanel).setBackgroundColor(
                    mContext.getResources().getColor(android.R.color.transparent));
        } else {
//            mWindow.findViewById(R.id.parentPanel).setBackgroundColor(0xffffffff);
        }

        if (mListView != null) {
            // Listview有分割线divider,因此header和listview需要显示分割线
            mWindow.findViewById(R.id.title_divider_line).setVisibility(View.VISIBLE);
            mWindow.findViewById(R.id.title_divider_line_bottom).setVisibility(View.VISIBLE);
        } else {
            mWindow.findViewById(R.id.title_divider_line).setVisibility(View.GONE);
            mWindow.findViewById(R.id.title_divider_line_bottom).setVisibility(View.GONE);
        }
        /**
         * Add margin top for the button panel if we have not any panel
         */
        if (topPanel.getVisibility() == View.GONE && contentPanel.getVisibility() == View.GONE
                && customPanel.getVisibility() == View.GONE && hasButtons) {
            buttonPanel.setPadding(buttonPanel.getPaddingLeft(), buttonPanel.getPaddingBottom(),
                    buttonPanel.getPaddingRight(), buttonPanel.getPaddingBottom());
        }

        /*
         * Only display the divider if we have a title and a custom view or a
         * message.
         */
        if (hasTitle) {
            // View divider = null;
            // if (mMessage != null || mView != null || mListView != null) {
            // divider = mWindow.findViewById(R.id.titleDivider);
            // } else {
            // divider = mWindow.findViewById(R.id.titleDividerTop);
            // }
            //
            // if (divider != null) {
            // divider.setVisibility(View.VISIBLE);
            // }
        }
        setBackground(topPanel, contentPanel, customPanel, hasButtons, hasTitle, buttonPanel);
        if (TextUtils.isEmpty(mTitle) && TextUtils.isEmpty(mMessage)) {
            mWindow.findViewById(R.id.empty_view).setVisibility(View.GONE);
        }
    }