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

The following are Jave code examples for showing how to use setOnClickListener() of the android.widget.RelativeLayout class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: TYT   File: T_MyInvoice_InvoiceInformationFragment.java   Source Code and License Vote up 6 votes
public ViewHolder(final View itemView) {
    super(itemView);
    tv_invoice_code = (AlwaysMarqueeTextView) itemView.findViewById(R.id.tv_invoice_code);
    tv_type = (AppCompatTextView) itemView.findViewById(R.id.tv_type);
    tv_invoice_amount = (AppCompatTextView) itemView.findViewById(R.id.tv_invoice_amount);
    tv_createDate = (AppCompatTextView) itemView.findViewById(R.id.tv_createDate);
    tv_confirmDate = (AppCompatTextView) itemView.findViewById(R.id.tv_confirmDate);
    tv_saleOrder = (AppCompatTextView) itemView.findViewById(R.id.tv_saleOrder);
    tv_orderCode = (AppCompatTextView) itemView.findViewById(R.id.tv_orderCode);
    tv_invoice_status = (AppCompatTextView) itemView.findViewById(R.id.tv_invoice_status);
    tv_accountName = (AppCompatTextView) itemView.findViewById(R.id.tv_accountName);
    tv_draweerName = (AppCompatTextView) itemView.findViewById(R.id.tv_draweerName);
    rl_content = (RelativeLayout) itemView.findViewById(R.id.rl_content);
    rl_content.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            T_InvoiceInformationEntity.RowsEntity rowsEntity = list.get(getLayoutPosition());
            T_InvoiceInformationProductsActivity_.intent(getActivity()).extra("rowsEntity", rowsEntity).start();
        }
    });
}
 
Example 2
Project: Beach-Android   File: GroupDetailsAdapter.java   Source Code and License Vote up 6 votes
public ViewHolder(View itemView, Context c) {
    super(itemView);

    rlContactRow = (RelativeLayout) itemView.findViewById(R.id.rlContactRow);
    ivContactImage = (ImageView) itemView.findViewById(R.id.ivContactImage);
    tvContactName = (TextView) itemView.findViewById(R.id.tvContactName);
    tvAffiliation = (TextView) itemView.findViewById(R.id.tvAffiliation);

    rlContactRow.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if(!StringUtils.isNullOrEmpty(member.getAffiliation().val()) && StringUtils.safeEquals(member.getAffiliation().val(), ChatRoom.Affiliation.ADMIN.val()) ||
                    StringUtils.safeEquals(member.getAffiliation().val(), ChatRoom.Affiliation.OWNER.val())){
                ChatRoom.ChatRoomMember m = memberList.get(getAdapterPosition());
                if(!StringUtils.safeEquals(member.getUserJID().getBareJID(), m.getUserJID().getBareJID())){
                    showRemoveParticipantAlert(member.getUserJID(), getAdapterPosition());
                }
            }
        }
    });
}
 
Example 3
Project: TYT   File: T_WarningCenter_InvoiceWarning.java   Source Code and License Vote up 6 votes
public ViewHolder(final View itemView) {
    super(itemView);
    tv_warning_export_invoice_number = (AlwaysMarqueeTextView) itemView.findViewById(R.id.tv_warning_export_invoice_number);
    tv_warning_foreign_businessman = (AlwaysMarqueeTextView) itemView.findViewById(R.id.tv_warning_foreign_businessman);
    tv_warning_invoice_unit = (AppCompatTextView) itemView.findViewById(R.id.tv_warning_invoice_unit);
    tv_warning_amount = (AppCompatTextView) itemView.findViewById(R.id.tv_warning_amount);
    tv_warning_invoice_date = (AppCompatTextView) itemView.findViewById(R.id.tv_warning_invoice_date);
    tv_warning_declare_date = (AppCompatTextView) itemView.findViewById(R.id.tv_warning_declare_date);
    tv_warning_approve_expiration_date = (AppCompatTextView) itemView.findViewById(R.id.tv_warning_approve_expiration_date);
    tv_warning_order_serial_number = (AppCompatTextView) itemView.findViewById(R.id.tv_warning_order_serial_number);
    tv_warning_po_number = (AppCompatTextView) itemView.findViewById(R.id.tv_warning_po_number);
    tv_warning_create_date = (AppCompatTextView) itemView.findViewById(R.id.tv_warning_create_date);
    rl_content = (RelativeLayout) itemView.findViewById(R.id.rl_content);
    rl_content.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {

        }
    });
}
 
Example 4
Project: TestChat   File: EditUserInfoDetailActivity.java   Source Code and License Vote up 6 votes
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
Project: TYT   File: T_MyFund_AccountGeneralFragment.java   Source Code and License Vote up 6 votes
public ViewHolder(final View itemView) {
    super(itemView);
    tv_relatedCompanyName = (AlwaysMarqueeTextView) itemView.findViewById(R.id.tv_relatedCompanyName);
    tv_fundName = (AppCompatTextView) itemView.findViewById(R.id.tv_fundName);
    tv_amountRmb = (AppCompatTextView) itemView.findViewById(R.id.tv_amountRmb);
    tv_createDate = (AppCompatTextView) itemView.findViewById(R.id.tv_createDate);
    rl_content = (RelativeLayout) itemView.findViewById(R.id.rl_content);
    rl_content.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            T_AccountFundDetailsEntity.RowsEntity rowsEntity = list.get(getLayoutPosition());

            T_AccountFundDetailsActivity_.intent(getActivity()).extra("rowsEntity", rowsEntity).start();
        }
    });
}
 
Example 6
Project: MultipleViewMap   File: NewMainActivity.java   Source Code and License Vote up 5 votes
private void init() {
    rlr_locate = (RelativeLayout) findViewById(R.id.rlr_locate);
    rlr_locate.setOnClickListener(this);
    rlt_sign = (RelativeLayout) findViewById(R.id.rlt_sign);
    rlt_sign.setOnClickListener(this);
    rlt_use = (RelativeLayout) findViewById(R.id.rlt_use);
    rlt_use.setOnClickListener(this);
    ins = this;
}
 
Example 7
Project: TestChat   File: GroupInfoActivity.java   Source Code and License Vote up 5 votes
@Override
        public void initView() {
                headerLayout = (RelativeLayout) findViewById(R.id.rl_group_info_header);
                groupAvatar = (RoundAngleImageView) findViewById(R.id.riv_group_info_avatar);
                groupName = (TextView) findViewById(R.id.tv_group_info_name);
                createTime = (TextView) findViewById(R.id.tv_group_info_create_time);
                numberName = (LinearLayout) findViewById(R.id.ll_group_info_number_name);
                numberCount = (LinearLayout) findViewById(R.id.ll_group_info_number_count);
                numberAvatar = (RecyclerView) findViewById(R.id.rcv_group_info_number_avatar);
                groupNameLayout = (LinearLayout) findViewById(R.id.ll_group_info_group_name);
                groupDescription = (LinearLayout) findViewById(R.id.ll_group_info_group_description);
                groupNotification = (LinearLayout) findViewById(R.id.ll_group_info_group_notification);
                groupRemind = (LinearLayout) findViewById(R.id.ll_group_info_remind);
                exit = (Button) findViewById(R.id.btn_group_info_exit_group);
                ((TextView) numberName.findViewById(R.id.tv_group_info_item_layout_title)).setText("群名片");
                numberNick = (TextView) numberName.findViewById(R.id.tv_group_info_item_layout_value);
                ((TextView) numberCount.findViewById(R.id.tv_group_info_item_layout_title)).setText("群总人数");
                ((TextView) groupNameLayout.findViewById(R.id.tv_group_info_item_layout_title)).setText("群名");
                ((TextView) groupDescription.findViewById(R.id.tv_group_info_item_layout_title)).setText("群介绍");
                ((TextView) groupNotification.findViewById(R.id.tv_group_info_item_layout_title)).setText("群通知");
                ((TextView) groupRemind.findViewById(R.id.tv_group_info_item_layout_title)).setText("群消息提醒");
                groupNumberCount = (TextView) numberCount.findViewById(R.id.tv_group_info_item_layout_value);
                notification = (TextView) groupNotification.findViewById(R.id.tv_group_info_item_layout_value);
                description = (TextView) groupDescription.findViewById(R.id.tv_group_info_item_layout_value);
                remind = (TextView) groupRemind.findViewById(R.id.tv_group_info_item_layout_value);
                groupName1 = (TextView) groupNameLayout.findViewById(R.id.tv_group_info_item_layout_value);
                headerLayout.setOnClickListener(this);
                numberName.setOnClickListener(this);
                numberCount.setOnClickListener(this);
//                numberAvatar.setOnItemClickListener(this);
                groupNameLayout.setOnClickListener(this);
                groupNotification.setOnClickListener(this);
                groupDescription.setOnClickListener(this);
                groupRemind.setOnClickListener(this);
                exit.setOnClickListener(this);
        }
 
Example 8
Project: Artist   File: CanvasActivity.java   Source Code and License Vote up 5 votes
private void addColorButton(){
    for(int i=0;i<12;i++){
        FloatingActionButton floatingActionButton = new FloatingActionButton(CanvasActivity.this);
        floatingActionButton.setBackgroundTintList(ColorStateList.valueOf(Color.parseColor(colorArr[i])));
        floatingActionButton.setCompatElevation(0);
        floatingActionButton.setTag("button");

        LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(108,108);
        params.setMargins(32,0,32,0);
        final RelativeLayout relativeLayout = new RelativeLayout(CanvasActivity.this);
        relativeLayout.addView(floatingActionButton, params);
        relativeLayout.setOnClickListener(this);
        if(i == 11){
            relativeLayout.setOnLongClickListener(new View.OnLongClickListener() {
                @Override
                public boolean onLongClick(View view) {
                    setDialog((FloatingActionButton) view.findViewWithTag("button"));
                    relativeLayout.callOnClick();
                    return true;
                }
            });
        }

        if(i > 5){
            colorSelectLayout2.addView(relativeLayout, new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT,RelativeLayout.LayoutParams.WRAP_CONTENT));
        }else{
            colorSelectLayout1.addView(relativeLayout, new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT,RelativeLayout.LayoutParams.WRAP_CONTENT));
        }
    }
}
 
Example 9
Project: NanCanOlympic   File: ShareDialog.java   Source Code and License Vote up 5 votes
@Override
public void bindView(View v) {
    mShareCircleLayout = (RelativeLayout) v.findViewById(R.id.shareCircleLayout);
    mShareFriendLayout = (RelativeLayout) v.findViewById(R.id.shareFriendLayout);
    mCopyBoardLayout = (RelativeLayout) v.findViewById(R.id.copyLayout);

    mShareCircleLayout.setOnClickListener(this);
    mShareFriendLayout.setOnClickListener(this);
    mCopyBoardLayout.setOnClickListener(this);
}
 
Example 10
Project: sealtalk-android-master   File: GroupDetailActivity.java   Source Code and License Vote up 5 votes
private void initViews() {
    messageTop = (SwitchButton) findViewById(R.id.sw_group_top);
    messageNotification = (SwitchButton) findViewById(R.id.sw_group_notfaction);
    messageTop.setOnCheckedChangeListener(this);
    messageNotification.setOnCheckedChangeListener(this);
    LinearLayout groupClean = (LinearLayout) findViewById(R.id.group_clean);
    mGridView = (DemoGridView) findViewById(R.id.gridview);
    mTextViewMemberSize = (TextView) findViewById(R.id.group_member_size);
    mGroupHeader = (SelectableRoundedImageView) findViewById(R.id.group_header);
    LinearLayout mGroupDisplayName = (LinearLayout) findViewById(R.id.group_displayname);
    mGroupDisplayNameText = (TextView) findViewById(R.id.group_displayname_text);
    mGroupName = (TextView) findViewById(R.id.group_name);
    mQuitBtn = (Button) findViewById(R.id.group_quit);
    mDismissBtn = (Button) findViewById(R.id.group_dismiss);
    RelativeLayout totalGroupMember = (RelativeLayout) findViewById(R.id.group_member_size_item);
    LinearLayout mGroupPortL = (LinearLayout) findViewById(R.id.ll_group_port);
    LinearLayout mGroupNameL = (LinearLayout) findViewById(R.id.ll_group_name);
    mGroupAnnouncementDividerLinearLayout = (LinearLayout) findViewById(R.id.ac_ll_group_announcement_divider);
    mGroupNotice = (LinearLayout) findViewById(R.id.group_announcement);
    mSearchMessagesLinearLayout = (LinearLayout) findViewById(R.id.ac_ll_search_chatting_records);
    mGroupPortL.setOnClickListener(this);
    mGroupNameL.setOnClickListener(this);
    totalGroupMember.setOnClickListener(this);
    mGroupDisplayName.setOnClickListener(this);
    mQuitBtn.setOnClickListener(this);
    mDismissBtn.setOnClickListener(this);
    groupClean.setOnClickListener(this);
    mGroupNotice.setOnClickListener(this);
    mSearchMessagesLinearLayout.setOnClickListener(this);
}
 
Example 11
Project: MoodSwings   File: MoodPopupActivity.java   Source Code and License Vote up 5 votes
/**
 *
 * @param savedInstanceState
 *
 */
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.popup);

    usernameText = (TextView) findViewById(R.id.username_text_popup);
    moodText = (TextView) findViewById(R.id.mood_text_popup);
    dateText = (TextView) findViewById(R.id.date_text_popup);
    timeText = (TextView) findViewById(R.id.time_text_popup);
    reasonText = (TextView) findViewById(R.id.description_text_popup);

    popupBox = findViewById(R.id.popup_box);
    popupIcon = (ImageView) findViewById(R.id.popup_icon);
    popupMargin = (RelativeLayout) findViewById(R.id.popup);
    photo = (ImageView) findViewById(R.id.user_image_popup);
    social = (TextView) findViewById(R.id.socialDescription);

    //OnClick for outside the popup to close that activity
    popupMargin.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            MoodPopupActivity.this.finish();
        }
    });

}
 
Example 12
Project: rongyunDemo   File: MyAccountActivity.java   Source Code and License Vote up 5 votes
private void initView() {
    TextView mPhone = (TextView) findViewById(R.id.tv_my_phone);
    RelativeLayout portraitItem = (RelativeLayout) findViewById(R.id.rl_my_portrait);
    RelativeLayout nameItem = (RelativeLayout) findViewById(R.id.rl_my_username);
    mImageView = (SelectableRoundedImageView) findViewById(R.id.img_my_portrait);
    mName = (TextView) findViewById(R.id.tv_my_username);
    portraitItem.setOnClickListener(this);
    nameItem.setOnClickListener(this);
    String cacheName = sp.getString(SealConst.SEALTALK_LOGIN_NAME, "");
    String cachePortrait = sp.getString(SealConst.SEALTALK_LOGING_PORTRAIT, "");
    String cachePhone = sp.getString(SealConst.SEALTALK_LOGING_PHONE, "");
    if (!TextUtils.isEmpty(cachePhone)) {
        mPhone.setText("+86 " + cachePhone);
    }
    if (!TextUtils.isEmpty(cacheName)) {
        mName.setText(cacheName);
        String cacheId = sp.getString(SealConst.SEALTALK_LOGIN_ID, "a");
        String portraitUri = SealUserInfoManager.getInstance().getPortraitUri(new UserInfo(
                                 cacheId, cacheName, Uri.parse(cachePortrait)));
        ImageLoader.getInstance().displayImage(portraitUri, mImageView, App.getOptions());
    }
    setPortraitChangeListener();
    BroadcastManager.getInstance(mContext).addAction(SealConst.CHANGEINFO, new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            mName.setText(sp.getString(SealConst.SEALTALK_LOGIN_NAME, ""));
        }
    });
}
 
Example 13
Project: CoolClock   File: MainActivity.java   Source Code and License Vote up 5 votes
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    tv_time = (TextView) findViewById(R.id.tv_time);
    tv_date = (TextView) findViewById(R.id.tv_date);
    tv_day = (TextView) findViewById(R.id.tv_day);
    Typeface typeFace = Typeface.createFromAsset(getAssets(), "fonts/ds_digi.ttf");
    tv_time.setTypeface(typeFace);
    tv_date.setTypeface(typeFace);
    tv_weather = (TextView) findViewById(R.id.tv_weather);
    tv_descript = (TextView) findViewById(R.id.tv_descript);


    handler = new Handler(this);
    tv_setting = (TextView) findViewById(R.id.tv_setting);
    tv_setting.setOnClickListener(this);
    tv_time.setOnClickListener(this);
    RelativeLayout rel_main = (RelativeLayout) findViewById(R.id.rel_main);
    rel_main.setOnClickListener(this);
    init();
    PowerManager powerManager = (PowerManager) this.getSystemService(POWER_SERVICE);
    wakeLock = powerManager.newWakeLock(PowerManager.FULL_WAKE_LOCK, "Clock");
    localWakeLock = powerManager.newWakeLock(32, "MyPower");

    ClockApplication.getInstance().setMainActivity(this);
    ClockApplication.getInstance().getBusinessService().getWeather(model.getCity());

    timer = new Timer();
    TimerTask timerTask = new TimerTask() {
        @Override
        public void run() {
            handler.sendEmptyMessage(UPDATE_TIME);
        }
    };
    timer.schedule(timerTask, 1000, 1000);
    ClockApplication.getInstance().getBusinessService().checkUpdate();
}
 
Example 14
Project: AppTycoon   File: EmployeesFragment.java   Source Code and License Vote up 5 votes
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {

    View view = inflater.inflate(R.layout.fragment_employees, container, false);

    RelativeLayout titleLayout = (RelativeLayout) view.findViewById(R.id.layoutFragmentTitle);
    titleLayout.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            ActionSelectDialogBuilder builder = new ActionSelectDialogBuilder(getActivity());
            builder.addNavigationEntry("Browse open applications", MainActivity.FRAGMENT_PROJECTS);
            builder.addNavigationEntry("Browse employees", -1);
            builder.getDialog().show();
        }
    });

    mRecyclerView = (RecyclerView) view.findViewById(R.id.recyclerViewEmployees);

    // Show all employee types here (both that company already has and the ones that it doesn't).
    mRecyclerViewAdapter = new EmployeeRecyclerViewAdapter(EmployeeType.getAllTypes());

    mRecyclerView.setHasFixedSize(true); // performance boost when content does not change the size of RecyclerView
    mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
    mRecyclerView.setAdapter(mRecyclerViewAdapter);

    return view;
}
 
Example 15
Project: Bigbang   File: MonitorSettingCard.java   Source Code and License Vote up 5 votes
private void initView(Context context) {
    mContext = context;


    LayoutInflater.from(context).inflate(R.layout.card_monitor_setting, this);

    onlyTextRL = (RelativeLayout) findViewById(R.id.text_only_rl);
    onlyTextSwitch = (SwitchCompat) findViewById(R.id.text_only_switch);

    whiteList = (TextView) findViewById(R.id.white_list);

    doubleClickIntervalRl = (RelativeLayout) findViewById(R.id.double_click_interval_rl);
    mDoubleClick = (TextView) findViewById(R.id.double_click_setting);
    doubleClickEditText = (EditText) findViewById(R.id.double_click_interval_edit);
    doubleClickInputLayout = (TextInputLayout) findViewById(R.id.double_click_interval);
    doubleClickConfirm = (Button) findViewById(R.id.double_click_confirm);

    onlyTextSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton aSwitch, boolean isChecked) {
            //这里由于文案从“只监控文本”改成了“增强型监控”,所以意思完全相反了,为了防止改动太多,就在这里做一个反置
            onlyText = !isChecked;
            UrlCountUtil.onEvent(UrlCountUtil.STATUS_ONLY_TEXT_MONITOR, !isChecked);
            SPHelper.save(ConstantUtil.TEXT_ONLY, onlyText);
            mContext.sendBroadcast(new Intent(BROADCAST_BIGBANG_MONITOR_SERVICE_MODIFIED));
        }
    });

    onlyTextRL.setOnClickListener(myOnClickListerner);
    whiteList.setOnClickListener(myOnClickListerner);
    mDoubleClick.setOnClickListener(myOnClickListerner);
    doubleClickConfirm.setOnClickListener(myOnClickListerner);

    refresh();
}
 
Example 16
Project: MNProgressHUD   File: MProgressDialog.java   Source Code and License Vote up 5 votes
private void initDialog() {

        LayoutInflater inflater = LayoutInflater.from(mContext);
        View mProgressDialogView = inflater.inflate(R.layout.mn_progress_dialog_layout, null);// 得到加载view
        mDialog = new Dialog(mContext, R.style.MNCustomDialog);// 创建自定义样式dialog
        mDialog.setCancelable(false);// 不可以用“返回键”取消
        mDialog.setCanceledOnTouchOutside(false);
        mDialog.setContentView(mProgressDialogView);// 设置布局

        //设置整个Dialog的宽高
        DisplayMetrics dm = new DisplayMetrics();
        WindowManager windowManager = ((Activity) mContext).getWindowManager();
        windowManager.getDefaultDisplay().getMetrics(dm);
        int screenW = dm.widthPixels;
        int screenH = dm.heightPixels;

        WindowManager.LayoutParams layoutParams = mDialog.getWindow().getAttributes();
        layoutParams.width = screenW;
        layoutParams.height = screenH;
        mDialog.getWindow().setAttributes(layoutParams);


        //布局相关
        dialog_window_background = (RelativeLayout) mProgressDialogView.findViewById(R.id.dialog_window_background);
        dialog_view_bg = (RelativeLayout) mProgressDialogView.findViewById(R.id.dialog_view_bg);
        progress_wheel = (MProgressWheel) mProgressDialogView.findViewById(R.id.progress_wheel);
        tv_show = (TextView) mProgressDialogView.findViewById(R.id.tv_show);

        //点击事件
        dialog_window_background.setOnClickListener(this);

        //默认相关
        progress_wheel.stopSpinning();
        tv_show.setText(defaultTextShow);

        //设置默认配置
        configView();

    }
 
Example 17
Project: MainCalendar   File: GlobalSettingActivity.java   Source Code and License Vote up 4 votes
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_global_setting);
        setTitle(getResources().getString(R.string.action_settings));

        mParams = GlobalSettingMng.getSetting().depthClone();
        mShiftsWorks = ShiftsWorkRecordMng.getAllKeyValue();
        mShiftsWorks.add(0, new KeyValue(0, getString(R.string.not_display)));

        mThemeView = (TextView) findViewById(R.id.theme_color);
        mThemeView.setBackgroundColor(mParams.getPrimaryColor());
//        mThemeView.setOnClickListener(this);
        RelativeLayout colorLayout = (RelativeLayout) findViewById(R.id.color_layout);
        if (colorLayout != null){
            colorLayout.setOnClickListener(this);
        }

        mWorkView = (TextView) findViewById(R.id.display_work);
        Long workIndex = mParams.getShiftsWorkIndex();
        if (workIndex > 0){
            String tmpTitle = getWorkTitle(workIndex);
            if (!Helper.isNullOrEmpty(tmpTitle)){
                mWorkView.setText(tmpTitle);
            }
        }
//        mWorkView.setOnClickListener(this);
        RelativeLayout workLayout = (RelativeLayout) findViewById(R.id.work_layout);
        if (workLayout != null){
            workLayout.setOnClickListener(this);
        }

        mRingView = (TextView) findViewById(R.id.ring_file);
        if (!Helper.isNullOrEmpty(mParams.getRingPath())){
            mRingView.setText(Helper.getFileName(mParams.getRingPath()));
        }
//        mRingView.setOnClickListener(this);
        RelativeLayout ringLayout = (RelativeLayout) findViewById(R.id.ring_layout);
        if (ringLayout != null){
            ringLayout.setOnClickListener(this);
        }

        mRingTimeView = (TextView) findViewById(R.id.ring_time);
        mRingTimeView.setText(String.valueOf(mParams.getRingSeconds()));
//        mRingTimeView.setOnClickListener(this);
        RelativeLayout timeLayout = (RelativeLayout) findViewById(R.id.time_layout);
        if (timeLayout != null){
            timeLayout.setOnClickListener(this);
        }

        mNotificationButton = (SwitchButton) findViewById(R.id.notification_switch_button);
        mNotificationButton.setChecked(mParams.getIsNotification());
        RelativeLayout notiLayout = (RelativeLayout) findViewById(R.id.notification_layout);
        if (notiLayout != null){
            notiLayout.setOnClickListener(this);
        }

        mDebugButton = (SwitchButton) findViewById(R.id.debug_switch_button);
        mDebugButton.setChecked(mParams.getIsRecordLog());
        RelativeLayout debugLayout = (RelativeLayout) findViewById(R.id.debug_layout);
        if (debugLayout != null){
            debugLayout.setOnClickListener(this);
        }
    }
 
Example 18
Project: sealtalk-android-master   File: MessageDisturbActivity.java   Source Code and License Vote up 4 votes
private void initView() {
        SwitchButton mSwitchButton = (SwitchButton) findViewById(R.id.disturb_switch);
        mIsShowSetting = (LinearLayout) findViewById(R.id.is_show_notification);
        RelativeLayout mStartNotification = (RelativeLayout) findViewById(R.id.start_notification);
        RelativeLayout mEndStartNotification = (RelativeLayout) findViewById(R.id.end_notification);
        mStartTimeNotification = (TextView) findViewById(R.id.start_time_notification);
        mEndTimeNotification = (TextView) findViewById(R.id.end_time_notification);
        mStartNotification.setOnClickListener(this);
        mEndStartNotification.setOnClickListener(this);
        mSwitchButton.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                if (isChecked) {
                    selectedCheckBox();
                    // 开启消息免打扰
                    mIsShowSetting.setVisibility(View.VISIBLE);
                    String startTime = getSharedPreferences("config", MODE_PRIVATE).getString("startTime", "");
                    String endTime = getSharedPreferences("config", MODE_PRIVATE).getString("endTime", "");

                    if (!TextUtils.isEmpty(startTime) && !TextUtils.isEmpty(endTime)) {
                        Date dataStart = DateUtils.stringToDate(startTime, mTimeFormat);
                        Date dataEnd = DateUtils.stringToDate(endTime, mTimeFormat);
                        long spansTime = DateUtils.compareMin(dataStart, dataEnd);
                        mStartTimeNotification.setText(startTime);
                        mEndTimeNotification.setText(endTime);
                        setConversationTime(startTime, (int) spansTime);
                    } else {
                        mStartTimeNotification.setText("23:00:00");
                        mEndTimeNotification.setText("07:00:00");
                        SharedPreferences.Editor editor = getSharedPreferences("config", MODE_PRIVATE).edit();
                        editor.putString("startTime", "23:00:00");
                        editor.putString("endTime", "07:00:00");
                        editor.apply();
                        setConversationTime("23:00:00", 480);
                    }

                } else {
                    unSelectCheckBox();
                    //关闭消息免打扰
                    mIsShowSetting.setVisibility(View.GONE);
                    RongIM.getInstance().removeNotificationQuietHours(new RongIMClient.OperationCallback() {
                        @Override
                        public void onSuccess() {
//                            getWindow().getDecorView().post(new Runnable() {
//                                @Override
//                                public void run() {
//                                    NToast.shortToast(mContext, "关闭成功");
//                                }
//                            });
                        }

                        @Override
                        public void onError(RongIMClient.ErrorCode errorCode) {

                        }
                    });
                }
            }
        });

        mSwitchButton.setChecked(getSharedPreferences("config", MODE_PRIVATE).getBoolean("isDisturb", false));
    }
 
Example 19
Project: OddLauncher   File: HomeActivity.java   Source Code and License Vote up 4 votes
public void initUI() {
        db = new DatabaseHelper(this);
        rlHome = (RelativeLayout) findViewById(R.id.layout_home);
        rlHome.setOnClickListener(this);
        menu = findViewById(R.id.my_fragment);
        centralView = findViewById(R.id.center_view);
        menu.setVisibility(View.GONE);
        //search
        searchText = (EditText) findViewById(R.id.search_bar_text);
        flSearch = (FrameLayout) findViewById(R.id.frame_search);
        rvSearch = (RecyclerView) findViewById(R.id.rl_search);
        btnCancelSearch = (ImageButton) findViewById(R.id.btn_cancel_search);
        btnCancelSearch.setOnClickListener(this);
        btnDecSearch = (ImageButton) findViewById(R.id.btn_dec_search);
        btnSearch = (ImageButton) findViewById(R.id.btn_search);
        btnSearch.setOnClickListener(this);

        searchBar = (LinearLayout) findViewById(R.id.search_bar_home);
        rvRight = (RecyclerView) findViewById(R.id.list_view_right);
        rvLeft = (RecyclerView) findViewById(R.id.list_view_left);
        frameRight = (FrameLayout) findViewById(R.id.frame_right);
        frameLeft = (FrameLayout) findViewById(R.id.frame_left);
        btnTheme = (ImageButton) findViewById(R.id.btn_theme);
        btnTheme.setOnClickListener(this);
        btnSettings = (ImageButton) findViewById(R.id.btn_settings);
        btnSettings.setOnClickListener(this);
        btnAddLeft = (ImageButton) findViewById(R.id.btn_add_left);
        btnAddLeft.setOnClickListener(this);
        btnAddRight = (ImageButton) findViewById(R.id.btn_add_right);
        btnAddRight.setOnClickListener(this);
        btnLeftElem = (ImageButton) findViewById(R.id.left);
        btnLeftElem.setOnClickListener(this);
        btnRightElem = (ImageButton) findViewById(R.id.right);
        btnRightElem.setOnClickListener(this);
        LinearLayoutManager managerRight =
                new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false);
        LinearLayoutManager managerLeft =
                new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false);
        managerSearch =
                new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false);
        rvRight.setLayoutManager(managerRight);
        rvLeft.setLayoutManager(managerLeft);
        rvSearch.setLayoutManager(managerSearch);

        settingsHelper = new SettingsHelper(this);
        settingsHelperSearch = new SettingsHelper(this);

        //handling swipe action
        new RecyclerItemSwiper(0, LEFT | RIGHT, this,
                adapterLeft, arrayListLeft, db, "left", rvLeft);

        new RecyclerItemSwiper(0, LEFT | RIGHT, this,
                adapterRight, arrayListRight, db, "right", rvRight);

        setupSharedPreferences();
//        setupSharedPreferencesNew();
//        rlHome.setOnTouchListener(new RelativeLayoutTouchListener(this));
        mainElemsTouchListener = new MainElemsTouchListener(this, centralMenu, menu, rlHome);
        rlHome.setOnTouchListener(mainElemsTouchListener);
    }
 
Example 20
Project: boohee_v5.6   File: CopyRecordActivity.java   Source Code and License Vote up 4 votes
private void initSportCardView(final ArrayList<RecordSport> recordSportList, final
LinearLayout ll_card) {
    RelativeLayout rl_time_type = (RelativeLayout) ll_card.findViewById(R.id.rl_time_type);
    TextView tv_time_type = (TextView) ll_card.findViewById(R.id.tv_time_type);
    final ToggleButton tb_time_type = (ToggleButton) ll_card.findViewById(R.id.tb_time_type);
    LinearLayout ll_list = (LinearLayout) ll_card.findViewById(R.id.ll_list);
    if (recordSportList == null || recordSportList.size() == 0) {
        ll_card.setVisibility(8);
        this.sportCount = 0;
    } else {
        ll_card.setVisibility(0);
        ll_list.removeAllViews();
        tb_time_type.setChecked(isSportChecked(recordSportList));
        tv_time_type.setText("运动");
        int totalCount = 0;
        for (int i = 0; i < recordSportList.size(); i++) {
            if (((RecordSport) recordSportList.get(i)).isChecked) {
                totalCount++;
            }
            View view = getSportItemView(recordSportList, ll_card, i);
            if (view != null) {
                ll_list.addView(view);
            }
        }
        this.sportCount = totalCount;
    }
    refreshCount();
    rl_time_type.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            tb_time_type.setChecked(!tb_time_type.isChecked());
            CopyRecordActivity.this.setSportAllIsChecked(recordSportList, tb_time_type
                    .isChecked());
            CopyRecordActivity.this.initSportCardView(recordSportList, ll_card);
            if (tb_time_type.isChecked()) {
                CopyRecordActivity.this.tb_check_all.setChecked(CopyRecordActivity.this
                        .isAllChecked());
            } else {
                CopyRecordActivity.this.tb_check_all.setChecked(false);
            }
        }
    });
}