Java Code Examples for android.widget.RelativeLayout#setOnClickListener()

The following examples show how to use android.widget.RelativeLayout#setOnClickListener() . 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: WeaponSelectionListFragment.java    From MonsterHunter4UDatabase with MIT License 6 votes vote down vote up
@Override
public View getView(int position, View convertView, ViewGroup parent) {
	if (convertView == null) {
		convertView = getActivity().getLayoutInflater().inflate(
				R.layout.fragment_list_item_basic, parent, false);
	}

	Drawable item = getItem(position);

	TextView textView = (TextView) convertView.findViewById(R.id.item_label);
	ImageView imageView = (ImageView) convertView
			.findViewById(R.id.item_image);

          RelativeLayout itemLayout = (RelativeLayout) convertView.findViewById(R.id.listitem);

	textView.setText(weapons[position]);
	imageView.setImageDrawable(item);

	itemLayout.setOnClickListener(new WeaponListClickListener(convertView.getContext(), position));

	return convertView;
}
 
Example 2
Source File: DeveloperInfoActivity.java    From NewFastFrame with Apache License 2.0 6 votes vote down vote up
@Override
protected void initView() {
    headerBg = findViewById(R.id.rl_activity_developer_info_header_bg);
    RelativeLayout headerContainer = findViewById(R.id.rl_activity_developer_info_container);
    findViewById(R.id.iv_activity_developer_info_back).setOnClickListener(this);
    name = findViewById(R.id.tv_activity_developer_info_name);
    signature = findViewById(R.id.tv_activity_developer_info_signature);
    sex = findViewById(R.id.iv_activity_developer_info_sex);
    avatar = findViewById(R.id.riv_activity_developer_info_avatar);
    github = findViewById(R.id.tv_activity_developer_info_github);
    github.setOnClickListener(this);
    qq = findViewById(R.id.tv_activity_developer_info_qq);
    wx = findViewById(R.id.tv_activity_developer_info_wx);
    findViewById(R.id.tv_activity_developer_info_qq).setOnClickListener(this);
    findViewById(R.id.tv_activity_developer_info_wx).setOnClickListener(this);
    headerContainer.setOnClickListener(this);

}
 
Example 3
Source File: JCVideoPlayer.java    From JieCaoVideoPlayer-develop with MIT License 6 votes vote down vote up
protected void init(Context context) {
    View.inflate(context, getLayoutId(), this);
    startButton = (ImageView) findViewById(R.id.start);
    fullscreenButton = (ImageView) findViewById(R.id.fullscreen);
    progressBar = (SeekBar) findViewById(R.id.progress);
    currentTimeTextView = (TextView) findViewById(R.id.current);
    totalTimeTextView = (TextView) findViewById(R.id.total);
    bottomContainer = (ViewGroup) findViewById(R.id.layout_bottom);
    textureViewContainer = (RelativeLayout) findViewById(R.id.surface_container);
    topContainer = (ViewGroup) findViewById(R.id.layout_top);

    startButton.setOnClickListener(this);
    fullscreenButton.setOnClickListener(this);
    progressBar.setOnSeekBarChangeListener(this);
    bottomContainer.setOnClickListener(this);
    textureViewContainer.setOnClickListener(this);
    progressBar.setOnTouchListener(this);

    textureViewContainer.setOnTouchListener(this);
    mScreenWidth = getContext().getResources().getDisplayMetrics().widthPixels;
    mScreenHeight = getContext().getResources().getDisplayMetrics().heightPixels;
    mAudioManager = (AudioManager) getContext().getSystemService(Context.AUDIO_SERVICE);
}
 
Example 4
Source File: EditUserInfoDetailActivity.java    From TestChat with Apache License 2.0 6 votes vote down vote up
private void initBirthView() {
        RelativeLayout birthLayout = (RelativeLayout) findViewById(R.id.rl_edit_user_info_detail_birth);
        birth = (TextView) findViewById(R.id.tv_edit_user_info_detail_birth);
        birthLayout.setOnClickListener(this);
        if (content != null) {
                birth.setText(content);
                Date date = TimeUtil.getDateFormalFromString(content);
                if (date != null) {
                        Calendar calendar = Calendar.getInstance();
                        calendar.setTime(date);
                        currentDay = calendar.get(Calendar.DATE);
                        currentMonth = calendar.get(Calendar.MONTH);
                        currentYear = calendar.get(Calendar.YEAR);
                }
        }

}
 
Example 5
Source File: AddRouteActivity.java    From kute with Apache License 2.0 6 votes vote down vote up
/********** Overrides ***********/
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.add_route);
    days=null;
    //Initialise the views
    name=(AppCompatEditText)findViewById(R.id.routeName);
    source=(AppCompatTextView) findViewById(R.id.startPlace);
    destination=(AppCompatTextView) findViewById(R.id.destination);
    destination.setOnClickListener(this);
    source.setOnClickListener(this);
    time=(TextView)findViewById(R.id.startTime);
    seats=(AppCompatEditText)findViewById(R.id.seatsAvailable);
    backnav=(ImageButton)findViewById(R.id.backNav);
    backnav.setOnClickListener(this);
    add_button=(ImageButton)findViewById(R.id.addButton);
    add_button.setOnClickListener(this);
    set_days=(ImageButton)findViewById(R.id.setDaysButton);
    set_days.setOnClickListener(this);
    time_layout=(RelativeLayout)findViewById(R.id.timeLayout);
    time_layout.setOnClickListener(this);

}
 
Example 6
Source File: PoiAroundSearchActivity.java    From TraceByAmap with MIT License 6 votes vote down vote up
private void setup() {
		mPoiDetail = (RelativeLayout) findViewById(R.id.poi_detail);
		mPoiDetail.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
//				Intent intent = new Intent(PoiSearchActivity.this,
//						SearchDetailActivity.class);
//				intent.putExtra("poiitem", mPoi);
//				startActivity(intent);
				
			}
		});
		mPoiName = (TextView) findViewById(R.id.poi_name);
		mPoiAddress = (TextView) findViewById(R.id.poi_address);
		mSearchText = (EditText)findViewById(R.id.input_edittext);
	}
 
Example 7
Source File: SettingsActivity.java    From NewFastFrame with Apache License 2.0 6 votes vote down vote up
@Override
public void initView() {
    RelativeLayout headerLayout = findViewById(R.id.rl_setting_header);
    account = findViewById(R.id.tv_setting_account);
    nick = findViewById(R.id.tv_tv_setting_nick);
    avatar = findViewById(R.id.riv_setting_avatar);
    SwitchCompat notification = findViewById(R.id.sc_activity_settings_notify);
    RelativeLayout clear = findViewById(R.id.rl_activity_settings_clear);
    RelativeLayout accountManage = findViewById(R.id.rl_activity_settings_account_manage);
    Button logout = findViewById(R.id.btn_setting_logout);
    headerLayout.setOnClickListener(this);
    clear.setOnClickListener(this);
    accountManage.setOnClickListener(this);
    logout.setOnClickListener(this);
    notification.setOnCheckedChangeListener(this);

}
 
Example 8
Source File: PuzzleSelectorActivity.java    From EasyPhotos with Apache License 2.0 5 votes vote down vote up
private void initAlbumItems() {
    rootViewAlbumItems = (RelativeLayout) findViewById(R.id.root_view_album_items);
    rootViewAlbumItems.setOnClickListener(this);
    setClick(R.id.iv_album_items);
    rvAlbumItems = (RecyclerView) findViewById(R.id.rv_album_items);
    LinearLayoutManager lm = new LinearLayoutManager(this);
    ArrayList<Object> list = new ArrayList<Object>(albumModel.getAlbumItems());
    albumItemsAdapter = new AlbumItemsAdapter(this, list, 0, this);
    rvAlbumItems.setLayoutManager(lm);
    rvAlbumItems.setAdapter(albumItemsAdapter);
}
 
Example 9
Source File: AccountSetting.java    From school_shop with MIT License 5 votes vote down vote up
private void initView() {
	passwordSetting = (RelativeLayout)findViewById(R.id.acount_setting_passwordSetting);
	phoneTextView = (TextView)findViewById(R.id.account_setting_phone);
	
	userInfo = AccountInfoUtils.getUserInfo(this);
	phoneTextView.setText(userInfo[3]);
	
	passwordSetting.setOnClickListener(new View.OnClickListener() {
		
		@Override
		public void onClick(View v) {
			startActivity(new Intent(AccountSetting.this,SetPasswordActivity.class));
		}
	});
}
 
Example 10
Source File: WaterFallView.java    From bmob-android-demo-paging with GNU General Public License v3.0 5 votes vote down vote up
private View createItemView(int position, View view) {

		RelativeLayout parent = new RelativeLayout(getContext());
		parent.setTag(position);
		parent.setOnClickListener(this);

		RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
		parent.addView(view, params);

		return parent;
	}
 
Example 11
Source File: NiftyDialogBuilder.java    From quickmark with MIT License 5 votes vote down vote up
private void init(Context context) {


        mDialogView = View.inflate(context, R.layout.dialog_layout, null);

        mLinearLayoutView=(LinearLayout)mDialogView.findViewById(R.id.parentPanel);
        mRelativeLayoutView=(RelativeLayout)mDialogView.findViewById(R.id.main);
        mLinearLayoutTopView=(LinearLayout)mDialogView.findViewById(R.id.topPanel);
        mLinearLayoutMsgView=(LinearLayout)mDialogView.findViewById(R.id.contentPanel);
        mFrameLayoutCustomView=(FrameLayout)mDialogView.findViewById(R.id.customPanel);

        mTitle = (TextView) mDialogView.findViewById(R.id.alertTitle);
        mMessage = (TextView) mDialogView.findViewById(R.id.message);
        mIcon = (ImageView) mDialogView.findViewById(R.id.icon);
        mDivider = mDialogView.findViewById(R.id.titleDivider);
        mButton1=(Button)mDialogView.findViewById(R.id.button1);
        mButton2=(Button)mDialogView.findViewById(R.id.button2);

        setContentView(mDialogView);

        this.setOnShowListener(new OnShowListener() {
            @Override
            public void onShow(DialogInterface dialogInterface) {

                mLinearLayoutView.setVisibility(View.VISIBLE);
                if(type==null){
                    type=Effectstype.Slidetop;
                }
                start(type);


            }
        });
        mRelativeLayoutView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (isCancelable)dismiss();
            }
        });
    }
 
Example 12
Source File: AccountManageActivity.java    From NewFastFrame with Apache License 2.0 5 votes vote down vote up
@Override
protected void initView() {
    RelativeLayout accountProtect = (RelativeLayout) findViewById(R.id.rl_activity_account_manage_protect);
    RelativeLayout changePw = (RelativeLayout) findViewById(R.id.rl_activity_account_manage_pw_change);
    accountProtect.setOnClickListener(this);
    changePw.setOnClickListener(this);
}
 
Example 13
Source File: ExpandTextView.java    From youqu_master with Apache License 2.0 5 votes vote down vote up
/**
 * 初始化
 */
private void init() {
    View.inflate(mContext, R.layout.expand_text_view, this);
    mTitleView = (TextView) findViewById(R.id.tv_title);
    mContentView = (TextView) findViewById(R.id.tv_content);
    mHintView = (TextView) findViewById(R.id.tv_more_hint);
    mIndicateImage = (ImageView) findViewById(R.id.iv_arrow_more);
    mShowMore = (RelativeLayout) findViewById(R.id.rl_show_more);

    mTitleView.setText(title);
    mTitleView.setTextSize(TypedValue.COMPLEX_UNIT_PX, titleTextSize);
    mTitleView.setTextColor(titleTextColor);

    mContentView.setText(content);
    mContentView.setTextSize(TypedValue.COMPLEX_UNIT_PX, contentTextSize);
    mContentView.setTextColor(contentTextColor);

    mHintView.setText(expandHint);
    mHintView.setTextSize(TypedValue.COMPLEX_UNIT_PX, hintTextSize);
    mHintView.setTextColor(hintTextColor);

    if (indicateImage == null) {
        indicateImage = getResources().getDrawable(R.drawable.ic_arrow_down_light_round);
    }
    mIndicateImage.setImageDrawable(indicateImage);
    mShowMore.setOnClickListener(this);
    ViewGroup.LayoutParams layoutParams = mContentView.getLayoutParams();
    layoutParams.height = getMinMeasureHeight();
    mContentView.setLayoutParams(layoutParams);
}
 
Example 14
Source File: WatchFaceCompanionConfigActivity.java    From american-sunsets-watch-face with Apache License 2.0 5 votes vote down vote up
public ViewHolder(RelativeLayout v) {
    super(v);
    v.setOnClickListener(this);
    itemContainer = v;
    nameText = (TextView)v.findViewById(R.id.name);
    gradientView = (CustomCircledImageView)v.findViewById(R.id.gradient);
}
 
Example 15
Source File: MainActivity.java    From Android-AlarmManagerClock with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    allLayout = (LinearLayout) findViewById(R.id.all_layout);
    set_btn = (Button) findViewById(R.id.set_btn);
    set_btn.setOnClickListener(this);
    date_tv = (TextView) findViewById(R.id.date_tv);
    repeat_rl = (RelativeLayout) findViewById(R.id.repeat_rl);
    repeat_rl.setOnClickListener(this);
    ring_rl = (RelativeLayout) findViewById(R.id.ring_rl);
    ring_rl.setOnClickListener(this);
    tv_repeat_value = (TextView) findViewById(R.id.tv_repeat_value);
    tv_ring_value = (TextView) findViewById(R.id.tv_ring_value);
    pvTime = new TimePickerView(this, TimePickerView.Type.HOURS_MINS);
    pvTime.setTime(new Date());
    pvTime.setCyclic(false);
    pvTime.setCancelable(true);
    //时间选择后回调
    pvTime.setOnTimeSelectListener(new TimePickerView.OnTimeSelectListener() {

        @Override
        public void onTimeSelect(Date date) {
            time = getTime(date);
            date_tv.setText(time);
        }
    });

    date_tv.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            pvTime.show();
        }
    });

}
 
Example 16
Source File: CountryCodePicker.java    From CountryCodePickerProject with Apache License 2.0 5 votes vote down vote up
private void init(AttributeSet attrs) {
    mInflater = LayoutInflater.from(context);

    if (attrs != null) {
        xmlWidth = attrs.getAttributeValue(ANDROID_NAME_SPACE, "layout_width");
    }
    removeAllViewsInLayout();
    //at run time, match parent value returns LayoutParams.MATCH_PARENT ("-1"), for some android xml preview it returns "fill_parent"
    if (attrs != null && xmlWidth != null && (xmlWidth.equals(LayoutParams.MATCH_PARENT + "") || xmlWidth.equals(LayoutParams.FILL_PARENT + "") || xmlWidth.equals("fill_parent") || xmlWidth.equals("match_parent"))) {
        holderView = mInflater.inflate(R.layout.layout_full_width_code_picker, this, true);
    } else {
        holderView = mInflater.inflate(R.layout.layout_code_picker, this, true);
    }

    textView_selectedCountry = (TextView) holderView.findViewById(R.id.textView_selectedCountry);
    holder = (RelativeLayout) holderView.findViewById(R.id.countryCodeHolder);
    imageViewArrow = (ImageView) holderView.findViewById(R.id.imageView_arrow);
    imageViewFlag = (ImageView) holderView.findViewById(R.id.image_flag);
    linearFlagHolder = (LinearLayout) holderView.findViewById(R.id.linear_flag_holder);
    linearFlagBorder = (LinearLayout) holderView.findViewById(R.id.linear_flag_border);
    relativeClickConsumer = (RelativeLayout) holderView.findViewById(R.id.rlClickConsumer);
    codePicker = this;
    if (attrs != null) {
        applyCustomProperty(attrs);
    }
    relativeClickConsumer.setOnClickListener(countryCodeHolderClickListener);
}
 
Example 17
Source File: SettingActivity.java    From FanXin-based-HuanXin with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_setting);
  
    if(savedInstanceState != null && savedInstanceState.getBoolean("isConflict", false))
        return;
    rl_switch_notification = (RelativeLayout) this.findViewById(R.id.rl_switch_notification);
    rl_switch_sound = (RelativeLayout) this.findViewById(R.id.rl_switch_sound);
    rl_switch_vibrate = (RelativeLayout) this.findViewById(R.id.rl_switch_vibrate);
    rl_switch_speaker = (RelativeLayout) this.findViewById(R.id.rl_switch_speaker);

    iv_switch_open_notification = (ImageView) this.findViewById(R.id.iv_switch_open_notification);
    iv_switch_close_notification = (ImageView) this.findViewById(R.id.iv_switch_close_notification);
    iv_switch_open_sound = (ImageView) this.findViewById(R.id.iv_switch_open_sound);
    iv_switch_close_sound = (ImageView) this.findViewById(R.id.iv_switch_close_sound);
    iv_switch_open_vibrate = (ImageView) this.findViewById(R.id.iv_switch_open_vibrate);
    iv_switch_close_vibrate = (ImageView) this.findViewById(R.id.iv_switch_close_vibrate);
    iv_switch_open_speaker = (ImageView) this.findViewById(R.id.iv_switch_open_speaker);
    iv_switch_close_speaker = (ImageView) this.findViewById(R.id.iv_switch_close_speaker);
    logoutBtn = (Button) this.findViewById(R.id.btn_logout);     
    rl_switch_notification.setOnClickListener(this);
    rl_switch_sound.setOnClickListener(this);
    rl_switch_vibrate.setOnClickListener(this);
    rl_switch_speaker.setOnClickListener(this);
    logoutBtn.setOnClickListener(this);
  
    chatOptions = EMChatManager.getInstance().getChatOptions();
    if (chatOptions.getNotificationEnable()) {
        iv_switch_open_notification.setVisibility(View.VISIBLE);
        iv_switch_close_notification.setVisibility(View.INVISIBLE);
    } else {
        iv_switch_open_notification.setVisibility(View.INVISIBLE);
        iv_switch_close_notification.setVisibility(View.VISIBLE);
    }
    if (chatOptions.getNoticedBySound()) {
        iv_switch_open_sound.setVisibility(View.VISIBLE);
        iv_switch_close_sound.setVisibility(View.INVISIBLE);
    } else {
        iv_switch_open_sound.setVisibility(View.INVISIBLE);
        iv_switch_close_sound.setVisibility(View.VISIBLE);
    }
    if (chatOptions.getNoticedByVibrate()) {
        iv_switch_open_vibrate.setVisibility(View.VISIBLE);
        iv_switch_close_vibrate.setVisibility(View.INVISIBLE);
    } else {
        iv_switch_open_vibrate.setVisibility(View.INVISIBLE);
        iv_switch_close_vibrate.setVisibility(View.VISIBLE);
    }

    if (chatOptions.getUseSpeaker()) {
        iv_switch_open_speaker.setVisibility(View.VISIBLE);
        iv_switch_close_speaker.setVisibility(View.INVISIBLE);
    } else {
        iv_switch_open_speaker.setVisibility(View.INVISIBLE);
        iv_switch_close_speaker.setVisibility(View.VISIBLE);
    }

}
 
Example 18
Source File: PbChatActivity.java    From imsdk-android with MIT License 4 votes vote down vote up
/**
     * 绑定View
     */
    protected void bindViews() {
        edit_region = (LinearLayout) findViewById(R.id.edit_region);
        left_btn = (IconView) findViewById(R.id.left_btn);
        voice_switch_btn = (IconView) findViewById(R.id.voice_switch_btn);
        voice_prompt = (TextView) findViewById(R.id.voice_prompt);
        input_container = (LinearLayout) findViewById(R.id.input_container);
        total_bottom_layout = (LinearLayout) findViewById(R.id.total_bottom_layout);
        atom_bottom_frame = (RelativeLayout) findViewById(R.id.atom_bottom_frame);
        edit_msg = (EmojiconEditText) findViewById(R.id.edit_msg);
        tv_options_btn = (IconView) findViewById(R.id.tv_options_btn);
        send_btn = (TextView) findViewById(R.id.send_btn);

        chating_view = (RelativeLayout) findViewById(R.id.chating_view);
        chat_region = (com.handmark.pulltorefresh.library.PullToRefreshListView) findViewById(R.id.chat_region);
        new_msg_prompt = (TextView) findViewById(R.id.new_msg_prompt);//更新消息条目数有关
        emotion_btn = (IconView) findViewById(R.id.tv_emojicon);
        outter_msg_prompt = (LinearLayout) findViewById(R.id.outter_msg_prompt);
        outter_msg = (TextView) findViewById(R.id.outter_msg);

        emoticonRainView = (EmoticonRainView) findViewById(R.id.emoticonRainView);


        no_prompt = (TextView) findViewById(R.id.no_prompt);
        close_prompt = (TextView) findViewById(R.id.close_prompt);
        relativeLayout = (KPSwitchRootLinearLayout) findViewById(R.id.resizelayout);
//        line = findViewById(line);
        new_msg_prompt.setOnClickListener(this);

        tv_options_btn.setOnClickListener(this);
        left_btn.setOnClickListener(this);
        voice_switch_btn.setOnClickListener(this);
        send_btn.setOnClickListener(this);
        emotion_btn.setOnClickListener(this);
        edit_msg.setOnFocusChangeListener(this);
        no_prompt.setOnClickListener(this);
        close_prompt.setOnClickListener(this);
        outter_msg.setOnClickListener(this);
        chating_view.setOnClickListener(this);
        qtNewActionBar = (QtNewActionBar) this.findViewById(R.id.my_action_bar);
        setNewActionBar(qtNewActionBar);

        mPanelRoot = (KPSwitchPanelLinearLayout) findViewById(R.id.panel_root);
        linearlayout_tab = (OperationView) findViewById(R.id.linearlayout_tab);
        record = (RecordView) findViewById(R.id.record);
        linearlayout_tab2 = (LinearLayout) findViewById(R.id.linearlayout_tab2);
        atom_bottom_more = (LinearLayout) findViewById(R.id.atom_bottom_more);
        faceView = (EmotionLayout) findViewById(R.id.faceView);
        quickreply_tab = (LinearLayout) findViewById(R.id.quickreply_tab);
        quickReplyLayout = (QuickReplyLayout) findViewById(R.id.quickreplyView);

        shareMessgeBtn = (ImageView) findViewById(R.id.txt_share_message);
        deleteMessageBtn = (ImageView) findViewById(R.id.txt_del_msgs);
        collectMsgBtn = (ImageView) findViewById(R.id.txt_collect_msg);
        emailMsgBtn = (ImageView) findViewById(R.id.txt_email_msg);

        atom_ui_refence_layout = (LinearLayout) findViewById(R.id.atom_ui_refence_layout);
        atom_ui_refence_text = (TextView) findViewById(R.id.atom_ui_refence_text);
        atom_ui_refence_close = (ImageView) findViewById(R.id.atom_ui_refence_close);
        atom_ui_refence_close.setOnClickListener((view)-> {
            refrenceString = "";
            atom_ui_refence_text.setText("");
            atom_ui_refence_layout.setVisibility(View.GONE);
        });

        shareMessgeBtn.setOnClickListener(this);
        deleteMessageBtn.setOnClickListener(this);
        emailMsgBtn.setOnClickListener(this);
        collectMsgBtn.setOnClickListener(this);

        //+号图标下更多更能设置为不可见
        linearlayout_tab.setVisibility(View.GONE);
        //+号下疑似视频功能设置为不可见
        linearlayout_tab2.setVisibility(View.GONE);

        addEvents();


    }
 
Example 19
Source File: MorePopWindow.java    From FanXin-based-HuanXin with GNU General Public License v2.0 4 votes vote down vote up
@SuppressLint("InflateParams")
public MorePopWindow(final Activity context) {
    LayoutInflater inflater = (LayoutInflater) context
            .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    conentView = inflater.inflate(R.layout.popupwindow_more, null);
 
    // 设置SelectPicPopupWindow的View
    this.setContentView(conentView);
    // 设置SelectPicPopupWindow弹出窗体的宽
    this.setWidth(LayoutParams.WRAP_CONTENT);
    // 设置SelectPicPopupWindow弹出窗体的高
    this.setHeight(LayoutParams.WRAP_CONTENT);
    // 设置SelectPicPopupWindow弹出窗体可点击
    this.setFocusable(true);
    this.setOutsideTouchable(true);
    // 刷新状态
    this.update();
    // 实例化一个ColorDrawable颜色为半透明
    ColorDrawable dw = new ColorDrawable(0000000000);
    // 点back键和其他地方使其消失,设置了这个才能触发OnDismisslistener ,设置其他控件变化等操作
    this.setBackgroundDrawable(dw);
    
    // 设置SelectPicPopupWindow弹出窗体动画效果
    this.setAnimationStyle(R.style.AnimationPreview);
    
    
    RelativeLayout   re_record =(RelativeLayout) conentView.findViewById(R.id.re_record);
     
    re_record.setOnClickListener(new OnClickListener(){

        @Override
        public void onClick(View v) {
            context.startActivity(new Intent(context,RecordsActivity.class));  
            MorePopWindow.this.dismiss();
      
        }
        
    } );
    
    
 
}
 
Example 20
Source File: LeftMenuActivity.java    From LLApp with Apache License 2.0 4 votes vote down vote up
private void initDrawer() {
        ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
                this, drawer, toolbar, R.string.open_nav_drawer, R.string.close_nav_drawer);
        drawer.setDrawerListener(toggle);
        drawer.setFitsSystemWindows(true);
        drawer.setClipToPadding(false);
        toggle.syncState();

        if (navigationView != null) {
//            StatusBarUtil.setColorNoTranslucentForDrawerLayout(MainActivity.this,drawer,getColor(R.color.black));
//            navigationView.setNavigationItemSelectedListener(this);
//            navigationView.setItemIconTintList(ColorStateList.valueOf(StaticValue.color));
//            navigationView.setCheckedItem(R.id.nav_home);
//            navigationView.setItemTextColor(ColorStateList.valueOf(StaticValue.color));
        }

        //这里为了兼容4.4及以下版本
        navigationView.inflateHeaderView(R.layout.nav_header_main);
        View headerView = navigationView.getHeaderView(0);
        ImageView ivAvatar = (ImageView) headerView.findViewById(R.id.iv_avatar);
//        Glides.getInstance().loadCircle(this,R.mipmap.ai1,ivAvatar);
        ImageLoader imageLoader = new ImageLoader.Builder()
                .imgView(ivAvatar)
                .placeHolder(R.mipmap.ai1)
                .url("https://ss3.baidu.com/-fo3dSag_xI4khGko9WTAnF6hhy/image/h%3D360/sign=caa2d267cfef7609230b9f991edca301/6d81800a19d8bc3e7763d030868ba61ea9d345e5.jpg")
                .build();
        ImageLoaderUtil.getInstance().loadCircleImage(this,imageLoader);
        LinearLayout llNavHomepage = (LinearLayout) headerView.findViewById(R.id.ll_nav_homepage);
        LinearLayout llNavShare = (LinearLayout) headerView.findViewById(R.id.ll_nav_share);
        RelativeLayout llNavMode = (RelativeLayout) headerView.findViewById(R.id.ll_nav_mode);
        LinearLayout llNavSet = (LinearLayout) headerView.findViewById(R.id.ll_nav_set);
        ImageView nav_main_img = (ImageView) headerView.findViewById(R.id.nav_main_img);
        TextView nav_main_text = (TextView) headerView.findViewById(R.id.nav_main_text);
        ImageView nav_share_img = (ImageView) headerView.findViewById(R.id.nav_share_img);
        TextView nav_share_text = (TextView) headerView.findViewById(R.id.nav_share_text);
        ImageView nav_mode_img = (ImageView) headerView.findViewById(R.id.nav_mode_img);
        TextView nav_mode_text = (TextView) headerView.findViewById(R.id.nav_mode_text);
        ToggleButton toggleButton = (ToggleButton) headerView.findViewById(R.id.toggle_mode);
        ImageView nav_set_img = (ImageView) headerView.findViewById(R.id.nav_set_img);
        TextView nav_set_text = (TextView) headerView.findViewById(R.id.nav_set_text);

        toggleButton.setOnColor(StaticValue.color);
        if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){
            MDTintUtil.setTint(nav_main_img,StaticValue.color);
            nav_main_text.setTextColor(StaticValue.color);
            MDTintUtil.setTint(nav_share_img,StaticValue.color);
            nav_share_text.setTextColor(StaticValue.color);
            MDTintUtil.setTint(nav_mode_img,StaticValue.color);
            nav_mode_text.setTextColor(StaticValue.color);
            MDTintUtil.setTint(nav_set_img,StaticValue.color);
            nav_set_text.setTextColor(StaticValue.color);
        }
        llNavHomepage.setOnClickListener(this);
        llNavShare.setOnClickListener(this);
        llNavMode.setOnClickListener(this);
        llNavSet.setOnClickListener(this);
        toggleButton.setOnToggleChanged(on -> {
            if(on){
                showMessage("切换到夜间模式");
            }else {
                showMessage("切换到正常模式");
            }
        });

//        View header = navigationView.getHeaderView(0);
//        navBgView = (RelativeLayout) header.findViewById(R.id.nav_head_bg);
//        headImg = (ImageView) header.findViewById(R.id.nav_header);
//        navBgView.setBackgroundResource(R.mipmap.b_1);
//        Glides.getInstance().loadCircle(this,R.mipmap.ai1,headImg);
        ivAvatar.setOnClickListener(view -> {
            startActivity(PersonActivity.class);
            drawer.closeDrawer(GravityCompat.START);
        });


    }