Java Code Examples for android.widget.ImageButton

The following are top voted examples for showing how to use android.widget.ImageButton. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: ChromeLikeTabSwitcher   File: MainActivity.java   View source code 6 votes vote down vote up
/**
 * Returns the menu item, which shows the navigation icon of the tab switcher's toolbar.
 *
 * @return The menu item, which shows the navigation icon of the tab switcher's toolbar, as an
 * instance of the class {@link View} or null, if no navigation icon is shown
 */
@Nullable
private View getNavigationMenuItem() {
    Toolbar[] toolbars = tabSwitcher.getToolbars();

    if (toolbars != null) {
        Toolbar toolbar = toolbars.length > 1 ? toolbars[1] : toolbars[0];
        int size = toolbar.getChildCount();

        for (int i = 0; i < size; i++) {
            View child = toolbar.getChildAt(i);

            if (child instanceof ImageButton) {
                return child;
            }
        }
    }

    return null;
}
 
Example 2
Project: PWEditText-SafeKeyboard   File: SafetyKeyboard.java   View source code 6 votes vote down vote up
private void setNumberKey(ImageButton buttonView, int key) {
    Drawable tempDrawable = null;
    if (null != mNumForeSelectorArray[key]) {
        tempDrawable = mNumForeSelectorArray[key].getConstantState()
                .newDrawable();
        buttonView.setImageDrawable(tempDrawable);
    }
    if (null != mNumBgSelectorArray
            && null != mNumBgSelectorArray[key]) {
        tempDrawable = mNumBgSelectorArray[key].getConstantState()
                .newDrawable();
        buttonView.setBackgroundDrawable(tempDrawable);
    } else if (null != mNumBgDrawSelector) {
        tempDrawable = mNumBgDrawSelector.getConstantState()
                .newDrawable();
        buttonView.setBackgroundDrawable(tempDrawable);
    }
}
 
Example 3
Project: BlackList   File: AddOrEditContactFragment.java   View source code 6 votes vote down vote up
private boolean addRowToNumbersList(@NonNull String number, int type) {
    // create and add the new row
    LayoutInflater inflater = getActivity().getLayoutInflater();
    View row = inflater.inflate(R.layout.row_contact_number, numbersViewList, false);
    numbersViewList.addView(row);

    // init row with number data
    setNumberType(row, type);
    setNumber(row, number);

    // init 'row remove' button
    ImageButton buttonRemove = (ImageButton) row.findViewById(R.id.button_remove);
    buttonRemove.setTag(row);
    buttonRemove.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            numbersViewList.removeView((View) v.getTag());
        }
    });

    // scroll list down
    moveScroll();

    return true;
}
 
Example 4
Project: live_master   File: PushLiveActivity.java   View source code 6 votes vote down vote up
private void initViews() {
    btnPublish = (ImageButton) findViewById(R.id.publish);
    btnSwitch = (ImageButton) findViewById(R.id.swCam);
    btnBack = (ImageButton) findViewById(R.id.back);
    txtState = (TextView) findViewById(R.id.state);
    mCameraView = (SurfaceView) findViewById(R.id.preview);
    mMessagesView = (RecyclerView) findViewById(R.id.push_messages_receive_layout);
    linearLayoutManager = new LinearLayoutManager(this);
    linearLayoutManager.setStackFromEnd(true);
    mMessagesView.setLayoutManager(linearLayoutManager);
    mMessagesView.setAdapter(mAdapter);
    mCameraView.getHolder().addCallback(this);
    btnPublish.setOnClickListener(this);
    btnSwitch.setOnClickListener(this);
    btnBack.setOnClickListener(this);
}
 
Example 5
Project: dolores-android   File: TitleUtils.java   View source code 6 votes vote down vote up
public static void setOkButton(final BaseActivity activity, int resource) {
    TextView tvOk = (TextView) activity.findViewById(R.id.tv_right);
    ImageButton btnOk = (ImageButton) activity.findViewById(R.id.btn_right);
    if (btnOk != null) {
        tvOk.setVisibility(View.GONE);
        if (resource != 0) {
            btnOk.setImageDrawable(activity.getResources().getDrawable(resource));
        }
        btnOk.setVisibility(View.VISIBLE);
        btnOk.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                activity.onOkButtonClick();
            }
        });
    }
}
 
Example 6
Project: youkes_browser   File: BrowserActivity.java   View source code 6 votes vote down vote up
private void showSearchInterfaceBar(String text) {

		LightningView wv=getCurrentWebView();
		if(wv==null){
			return;
		}


		mSearchBar = (RelativeLayout) findViewById(R.id.search_bar);
		mSearchBar.setVisibility(View.VISIBLE);

		TextView tw = (TextView) findViewById(R.id.search_query);
		tw.setText("'" + text + "'");

		ImageButton up = (ImageButton) findViewById(R.id.button_next);
		up.setOnClickListener(this);

		ImageButton down = (ImageButton) findViewById(R.id.button_back);
		down.setOnClickListener(this);

		ImageButton quit = (ImageButton) findViewById(R.id.button_quit);
		quit.setOnClickListener(this);
	}
 
Example 7
Project: Open-Quran-Radio   File: PlayerActivityFragment.java   View source code 6 votes vote down vote up
private void findViewsAndAssign() {
    // find views for station name and image and playback indicator
    mStationNameView = (TextView) mRootView.findViewById(R.id.player_textview_stationname);
    mtxtDescriptionView = (TextView) mRootView.findViewById(R.id.txtDescription);
    mtxtMarkdownDescriptionView = (TextView) mRootView.findViewById(R.id.txtMarkdownDescription);
    mRatingBarView = (RatingBar) mRootView.findViewById(R.id.ratingBar);

    mStationMetadataView = (TextView) mRootView.findViewById(R.id.player_textview_station_metadata);
    mPlaybackIndicator = (ImageView) mRootView.findViewById(R.id.player_playback_indicator);
    mPlaybackButton = (ImageButton) mRootView.findViewById(R.id.player_playback_button);
    mPlayerFavoritButton = (ImageButton) mRootView.findViewById(R.id.player_item_favorit_button);

    mStationImageView = (SimpleDraweeView) mRootView.findViewById(R.id.player_imageview_station_icon);
    mStationMenuView = (ImageButton) mRootView.findViewById(R.id.player_item_more_button);
    mCrdMarkdownDescriptionView = (CardView) mRootView.findViewById(R.id.crdMarkdownDescription);
    mRelLayLargeButtonPlayView = (RelativeLayout) mRootView.findViewById(R.id.relLayLargeButtonPlay);
}
 
Example 8
Project: Musicoco   File: SongOption.java   View source code 6 votes vote down vote up
void initViews() {

        container = (ViewGroup) activity.findViewById(R.id.play_list_hide_bar);
        hidePlayListBar = (ImageButton) activity.findViewById(R.id.play_list_hide);
        playMode = (ImageButton) activity.findViewById(R.id.play_mode);
        playFavorite = (ImageButton) activity.findViewById(R.id.play_favorite);
        playShowList = (ImageButton) activity.findViewById(R.id.play_show_list);
        playShowMore = (ImageButton) activity.findViewById(R.id.play_show_more);

        hidePlayListBar.setOnClickListener(this);
        playMode.setOnClickListener(this);
        container.setOnClickListener(this);
        playFavorite.setOnClickListener(this);
        playShowList.setOnClickListener(this);
        playShowMore.setOnClickListener(this);

        mDialog.setOnItemClickListener(this);
    }
 
Example 9
Project: Snach-Android   File: AppsActiveFragment.java   View source code 6 votes vote down vote up
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
    ViewHolder holder;
    if(convertView == null){
        holder = new ViewHolder();

        convertView = getActivity().getLayoutInflater().inflate(R.layout.listitem_active_app, parent, false);
        holder.tv_appName = (TextView) convertView.findViewById(R.id.tv_appName);
        holder.ib_removeApp = (ImageButton) convertView.findViewById(R.id.ib_removeApp);

        convertView.setTag(holder);
    } else {
        holder = (ViewHolder) convertView.getTag();
    }


    holder.tv_appName.setText(appList.get(position).getAppName());
    holder.ib_removeApp.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            devicesHandler.removeApp(devicesHandler.getCurrentDeviceProfileID(), appList.get(position).getID());
        }
    });

    return convertView;
}
 
Example 10
Project: FireFiles   File: MoveFragment.java   View source code 6 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
	//final Context context = inflater.getContext();

	final View view = inflater.inflate(R.layout.fragment_move, container, false);
	view.findViewById(R.id.background).setBackgroundColor(SettingsActivity.getPrimaryColor(getActivity()));

	mCancel = (ImageButton) view.findViewById(android.R.id.button2);
	mCancel.setOnClickListener(this);

	mMoveInfo = (TextView) view.findViewById(android.R.id.title);
	mMoveInfo.setText("Paste " + FileUtils.formatFileCount(docs.size()) + " in ");
	mMoveInfo.setEnabled(false);
	
	mRootInfo = (TextView) view.findViewById(android.R.id.text1);

	mSave = (ImageButton) view.findViewById(android.R.id.button1);
	mSave.setOnClickListener(this);
	mSave.setEnabled(false);

	mProgress = (MaterialProgressBar) view.findViewById(android.R.id.progress);
	mProgress.setColor(SettingsActivity.getAccentColor());

	return view;
}
 
Example 11
Project: LnkShortener   File: DisplayShortenedUrlActivity.java   View source code 6 votes vote down vote up
private void showShortenedUrl(){

        // Setting up Variables for Layout
        final TextView viewShortenedUrl = (TextView) findViewById(R.id.textViewShortenedLink);
        final ImageButton shareButton = (ImageButton) findViewById(R.id.shareButton);
        final ImageButton openLinkButton = (ImageButton) findViewById(R.id.openLinkButton);
        final ImageButton copyLinkButton = (ImageButton) findViewById(R.id.copyLinkButton);
        final ProgressBar progressBar = (ProgressBar) findViewById(R.id.progressBar);
        final ImageButton qrCodeButton = (ImageButton) findViewById(R.id.qrCodeButton);

        // We set the shortened URL as Label
        viewShortenedUrl.setText(shortUrl);

        // Now we hide the loading-spinner and set the Buttons and Texts as vissible
        progressBar.setVisibility(View.GONE);
        viewShortenedUrl.setVisibility(View.VISIBLE);
        shareButton.setVisibility(View.VISIBLE);
        openLinkButton.setVisibility(View.VISIBLE);
        copyLinkButton.setVisibility(View.VISIBLE);
        qrCodeButton.setVisibility(View.VISIBLE);

    }
 
Example 12
Project: Android_watch_magpie   File: DialogFragmentSetGlucose.java   View source code 6 votes vote down vote up
@Override
protected void createListenerSubmitButton(ImageButton submit) {
    submit.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            try
            {
                double value=Double.parseDouble(txtValue.getText().toString());
                //check if the entry is valide (range)
                if (!Validator.isEntryValueValide(Const.CATEGORY_GLUCOSE,value))
                {
                    CustomToast.getInstance().errorTOast(getString(R.string.incorrect_value),getActivity());
                    return;
                }
                homeActivity.sendValue(Const.CATEGORY_GLUCOSE,value+"");
                dismiss();
            }
            catch (Exception ex)
            {
                CustomToast.getInstance().errorTOast(getString(R.string.incorrect_value),getActivity());
            }
        }
    });
}
 
Example 13
Project: financisto1-holo   File: PlannerActivity.java   View source code 6 votes vote down vote up
@Override
protected void internalOnCreate(Bundle savedInstanceState) {
    totalText = (TextView)findViewById(R.id.total);
    filterText = (TextView)findViewById(R.id.period);
    ImageButton bFilter = (ImageButton) findViewById(R.id.bFilter);
    bFilter.setImageResource(R.drawable.ic_menu_filter_on);
    bFilter.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            showFilter();
        }
    });

    loadFilter();
    setupFilter();
}
 
Example 14
Project: leoapp-sources   File: ChatActivity.java   View source code 6 votes vote down vote up
private void initSendMessage() {
    etMessage = findViewById(R.id.inputMessage);

    ImageButton sendButton = findViewById(R.id.sendButton);
    sendButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            sendMessage();
        }
    });

    if (ctype == Chat.ChatType.GROUP && !Utils.getController().getMessengerDatabase().userInChat(Utils.getUserID(), cid)) {
        etMessage.setEnabled(false);
        etMessage.setHint("Du bist nicht in diesem Chat!");
        sendButton.setEnabled(false);
    }
}
 
Example 15
Project: StudyBuddy   File: StudyAdapter.java   View source code 6 votes vote down vote up
@Override
    public void onBindViewHolder(final StudyAdapter.Holder holder, final int position) {
        TaskItem item = mFeedItemList.get(position);
        TextView textView = holder.textView;
        textView.setText(item.getTaskName());
        ImageButton imgBtn = holder.markDoneBtn;
        TooltipCompat.setTooltipText(imgBtn, "Mark as done");
//        imgBtn.setTooltipText() = TooltipCompat.setTooltipText();
//        imgBtn.setTooltipText(test);
        imgBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                notifyItemRemoved(position);
                mFeedItemList.remove(position);
                Snackbar.make(view, "Task marked as done.", 6000).show();
            }
        });
    }
 
Example 16
Project: QuranAndroid   File: QuranPageReadActivity.java   View source code 6 votes vote down vote up
/**
     * Function do some thing in press back button
     */
    @Override
    public void onBackPressed() {
        ((ImageButton) findViewById(R.id.pause_play)).setImageResource(R.drawable.ic_pause);
        playerFooter.setVisibility(View.GONE);
        normalFooter.setVisibility(View.VISIBLE);
//        sendBroadcast(stop);

        //clear saved selected aya
        AppPreference.setSelectionVerse(null);

        if (QuranPageFragment.SELECTION) {
            closeSelectionMode();
        } else {
            super.onBackPressed();
            AppPreference.setLastPageRead(mViewPager.getCurrentItem());
            if (bookmarkID != -1)
                new DatabaseAccess().updateBookmark(bookmarkID, (604 - mViewPager.getCurrentItem()));
            SectionsPagerAdapter = null;
            System.gc();
            finish();

        }


    }
 
Example 17
Project: chromium-for-android-56-debug-video   File: AccessibilityTabModelListItem.java   View source code 6 votes vote down vote up
@Override
public void onFinishInflate() {
    super.onFinishInflate();
    mTabContents = (LinearLayout) findViewById(R.id.tab_contents);
    mTitleView = (TextView) findViewById(R.id.tab_title);
    mFaviconView = (ImageView) findViewById(R.id.tab_favicon);
    mCloseButton = (ImageButton) findViewById(R.id.close_btn);

    mUndoContents = (LinearLayout) findViewById(R.id.undo_contents);
    mUndoButton = (Button) findViewById(R.id.undo_button);

    setClickable(true);
    setFocusable(true);

    mCloseButton.setOnClickListener(this);
    mUndoButton.setOnClickListener(this);
    setOnClickListener(this);
}
 
Example 18
Project: MangoBloggerAndroidApp   File: FirebaseDataAdapter.java   View source code 6 votes vote down vote up
private ViewHolder(View itemView) {
            super(itemView);
            title = (TextView) itemView.findViewById(R.id.title);
            description = (ExpandableTextView) itemView.findViewById(R.id.expand_text_view);
            firebase_image = (ImageView) itemView.findViewById(R.id.banner);
//            likeButton = (ButtonAnimationView) itemView.findViewById(R.id.btnLike);
//            bookmarkButton = (ImageButton) itemView.findViewById(R.id.btnBookmark);
            shareButton = (ImageButton) itemView.findViewById(R.id.btnShare);
//            likeButton.setOnClickListener(this);
//            bookmarkButton.setOnClickListener(this);
            shareButton.setOnClickListener(this);


        }
 
Example 19
Project: humaniq-android   File: BottomMenuView.java   View source code 6 votes vote down vote up
public BottomMenuView(View bottomMenu, ViewPager viewPager) {
    this.viewPager = viewPager;

    tabs = new ImageButton[4];
    tabs[0] = (ImageButton) bottomMenu.findViewById(R.id.tab1);
    tabs[1] = (ImageButton) bottomMenu.findViewById(R.id.tab2);
    tabs[2] = (ImageButton) bottomMenu.findViewById(R.id.tab3);
    tabs[3] = (ImageButton) bottomMenu.findViewById(R.id.tab4);

    currentTab = tabs[0];

    tabs[0].setOnClickListener(this);
    tabs[1].setOnClickListener(this);
    tabs[2].setOnClickListener(this);
    tabs[3].setOnClickListener(this);
}
 
Example 20
Project: TimeTrix   File: FragmentStarredNotes.java   View source code 6 votes vote down vote up
/**
     * Called immediately after {@link #onCreateView(LayoutInflater, ViewGroup, Bundle)}
     * has returned, but before any saved state has been restored in to the view.
     * This gives subclasses a chance to initialize themselves once
     * they know their view hierarchy has been completely created.  The fragment's
     * view hierarchy is not however attached to its parent at this point.
     *
     * @param view               The View returned by {@link #onCreateView(LayoutInflater, ViewGroup, Bundle)}.
     * @param savedInstanceState If non-null, this fragment is being re-constructed
     */
    @Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated (view, savedInstanceState);
        ImageButton btnAddNotes = (ImageButton) view.findViewById (R.id.buttonAddNotesStar);
        btnAddNotes.setVisibility (View.INVISIBLE);
        //btnAddNotes.setOnClickListener(this);
//        mListViewStar = (ListView) getActivity().findViewById(R.id.listNotesStarred);
        mRecyclerViewStar = (RecyclerView) view.findViewById (R.id.recyclerNotesStarred);

        mArrayListStarredNotes = new ArrayList<> ();
//        mCustomAdapterStarredNotes = new CustomAdapter(mArrayListStarredNotes, getActivity(), tempString);
//        mListViewStar.setTag(R.string.filename, mSectionIndex);
//        mListViewStar.setTag(R.string.list_object, mArrayListStarredNotes);
//        mListViewStar.setAdapter(mCustomAdapterStarredNotes);
//        mListViewStar.setItemsCanFocus(true);
//        registerForContextMenu(mListViewStar);

        mRecyclerViewStar.setHasFixedSize (true);
        mRecyclerViewAdapter = new RecyclerViewAdapter (mArrayListStarredNotes, getActivity (),
                this, tempString);
        mRecyclerViewStar.setAdapter (mRecyclerViewAdapter);
        LinearLayoutManager llm = new LinearLayoutManager (getActivity ());
        llm.setOrientation (LinearLayoutManager.VERTICAL);
        mRecyclerViewStar.setLayoutManager (llm);
    }
 
Example 21
Project: TheNounProject   File: SearchIconFragment.java   View source code 6 votes vote down vote up
@Override
protected void setupSearchOptions(SearchView searchView) {
    final ImageButton searchOptionsButton =
            (ImageButton) getActivity().getLayoutInflater().inflate(R.layout.search_view_options_button, null);
    LinearLayout searchViewSearchPlate = (LinearLayout) searchView.findViewById(R.id.search_plate);
    searchViewSearchPlate.addView(searchOptionsButton);
    searchOptionsButton.setLayoutParams(
            new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
                    ViewGroup.LayoutParams.MATCH_PARENT));
    searchOptionsButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            onSearchOptionsButtonClicked();
        }
    });
}
 
Example 22
Project: boohee_v5.6   File: MQConversationActivity.java   View source code 6 votes vote down vote up
private void findViews() {
    this.mTitleRl = (RelativeLayout) findViewById(R.id.title_rl);
    this.backRl = (RelativeLayout) findViewById(R.id.back_rl);
    this.mBackTv = (TextView) findViewById(R.id.back_tv);
    this.mBackIv = (ImageView) findViewById(R.id.back_iv);
    this.mChatBodyRl = (RelativeLayout) findViewById(R.id.chat_body_rl);
    this.mConversationListView = (ListView) findViewById(R.id.messages_lv);
    this.mInputEt = (EditText) findViewById(R.id.input_et);
    this.mEmojiSelectBtn = findViewById(R.id.emoji_select_btn);
    this.mCustomKeyboardLayout = (MQCustomKeyboardLayout) findViewById(R.id
            .customKeyboardLayout);
    this.mSendTextBtn = (ImageButton) findViewById(R.id.send_text_btn);
    this.mPhotoSelectBtn = findViewById(R.id.photo_select_btn);
    this.mCameraSelectBtn = findViewById(R.id.camera_select_btn);
    this.mVoiceBtn = findViewById(R.id.mic_select_btn);
    this.mEvaluateBtn = findViewById(R.id.evaluate_select_btn);
    this.mLoadProgressBar = (ProgressBar) findViewById(R.id.progressbar);
    this.mTitleTv = (TextView) findViewById(R.id.title_tv);
    this.mSwipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipe_refresh_layout);
    this.mEmojiSelectIndicator = findViewById(R.id.emoji_select_indicator);
    this.mEmojiSelectImg = (ImageView) findViewById(R.id.emoji_select_img);
    this.mVoiceSelectIndicator = findViewById(R.id.conversation_voice_indicator);
    this.mVoiceSelectImg = (ImageView) findViewById(R.id.conversation_voice_img);
}
 
Example 23
Project: Zmap_test   File: AccountProfile.java   View source code 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_account_profile_layout);
    getSupportActionBar().hide();

    url=getString(R.string.URl); //服务器接口地址

    user_head_icon_btn = (ImageButton)findViewById(R.id.Account_profile_head_icon_btn);
    top_view = findViewById(R.id.Account_profile_head_icon_choose_view);
    bottom_view = findViewById(R.id.Account_profile_view);
    TextView username_view = findViewById(R.id.Account_profile_nick_name_text);

    current_user = DataSupport.findLast(Users.class);  //从数据库读出当前登陆的用户
    username_view.setText( current_user.getUsername());
    user_head_icon_btn.setImageResource(getHeadIconResourceFromId(current_user.getId_head()));



    addListener(R.id.Account_profile_head_icon_setting);//头像设置界面
    addListener(R.id.Account_profile_logout); //logout
    addListener(R.id.Account_profile_user_name_setting);//设置用户名
    addListener(R.id.Account_profile_head_icon_choose_view);//头像选择界面
    addListenerForChooseButton();
}
 
Example 24
Project: AssistantBySDK   File: NaviConfirmPointActivity.java   View source code 6 votes vote down vote up
/**
 * 更新Viewpager小圆点下标样式
 **/
private void updatePoiDetialDotList(int total, int selectNum) {
    int l = mAncpPoiDetialDotList.getChildCount();
    for (int i = 0; i < l; i++) {
        if (i == selectNum) {
            ((ImageButton) mAncpPoiDetialDotList.getChildAt(i)).setImageResource(R.drawable.bnav_poi_detail_ic_tag_select);
        } else {
            ((ImageButton) mAncpPoiDetialDotList.getChildAt(i)).setImageResource(R.drawable.bnav_poi_detail_ic_tag_normal);
        }
        if (i >= total) {
            mAncpPoiDetialDotList.getChildAt(i).setVisibility(View.GONE);
        } else {
            mAncpPoiDetialDotList.getChildAt(i).setVisibility(View.VISIBLE);
        }
    }
}
 
Example 25
Project: LiuAGeAndroid   File: MainActivity.java   View source code 6 votes vote down vote up
/**
 * 准备UI
 */
private void prepareUI() {

    mMenuButton = (ImageButton) findViewById(R.id.nav_main_left_menu);
    mSearchButton = (ImageButton) findViewById(R.id.nav_main_right_search);
    mNewsTabLayout = (TabLayout) findViewById(R.id.tl_news_tabLayout);
    mNewsViewPager = (ViewPager) findViewById(R.id.vp_news_viewPager);
    mNewsClassAdd = (ImageButton) findViewById(R.id.ib_news_class_add);

    mMenuButton.setOnClickListener(this);
    mSearchButton.setOnClickListener(this);
    mNewsClassAdd.setOnClickListener(this);

    // 配置viewPager
    setupViewPager();
}
 
Example 26
Project: BrewBook   File: MapsActivity.java   View source code 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_maps);


    go = (Button) findViewById(R.id.button2);
    go.setOnClickListener(btGo);
    location = (EditText) findViewById(R.id.editLocation);
    progressBarSubject = (ProgressBar) findViewById(R.id.progressBar);
    SubjectListView = (ListView) findViewById(R.id.listview1);
    trendingBtm = (ImageButton) findViewById(R.id.imageBtmtrending);
    userBtm = (ImageButton) findViewById(R.id.imageBtmuser);
    locationBtm = (ImageButton) findViewById(R.id.imageBtmlocation);
    settingsBtm = (ImageButton) findViewById(R.id.imageBtmSettings);
    addReviewBtm = (FloatingActionButton) findViewById(R.id.addReview);
    trendingBtm.setOnClickListener(btTrending);
    userBtm.setOnClickListener(btUser);
    locationBtm.setOnClickListener(btlocation);
    settingsBtm.setOnClickListener(btSettings);
    addReviewBtm.setOnClickListener(btAdd);


}
 
Example 27
Project: grow-tracker-android   File: AddPlantActivity.java   View source code 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    db = new DBHelper(this);

    addImageButton = (ImageButton) findViewById(R.id.add_image_button);
    addImageWrapper = (LinearLayout) findViewById(R.id.add_image_wrapper);
    addImageWrapper.setVisibility(View.VISIBLE);
    plantName = (EditText) findViewById(R.id.plantName);
    dateCalendar = (CalendarView) findViewById(R.id.calendar_view);
    setDate = new Date();
    dateCalendar.setOnDateClickListener(new io.blackbox_vision.materialcalendarview.view.CalendarView.OnDateClickListener() {
        @Override
        public void onDateClick(Date date) {
            setDate = date;
        }
    });

    result.getActionBarDrawerToggle().setDrawerIndicatorEnabled(false);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    setToolbarClickBackButton(PlantListActivity.class, null);

    setTitle("Add Plant");
}
 
Example 28
Project: VoiceAndMQTT   File: MainActivity.java   View source code 5 votes vote down vote up
@Override
protected void onCreate( Bundle savedInstanceState ) {
    super.onCreate( savedInstanceState );

    setContentView( R.layout.activity_main );
    txtHablado = (TextView) findViewById( R.id.txtHablado );
    txtServer = (EditText) findViewById( R.id.txtServer );
    txtTopico = (EditText) findViewById( R.id.txtTopico );
    btnSpeak = (ImageButton) findViewById( R.id.btnSpeak );

    SharedPreferences sharedPref = getPreferences( Context.MODE_PRIVATE );
    String savedServer = sharedPref.getString( getString( R.string.SavedServerKey ), getString( R.string.DefaultServer ) );
    String savedTopic = sharedPref.getString( getString( R.string.SavedTopicKey ), getString( R.string.DefaultTopic ) );
    txtServer.setText( savedServer );
    txtTopico.setText( savedTopic );

    btnSpeak.setOnClickListener( new View.OnClickListener() {
        @Override
        public void onClick( View v ) {
            btnSpeak.setEnabled( false );
            txtHablado.setText( null );
            CheckBox modoOffline = (CheckBox) findViewById( R.id.modoOffline );

            Intent intent = new Intent( RecognizerIntent.ACTION_RECOGNIZE_SPEECH );
            intent.putExtra( RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM );
            if( modoOffline.isChecked())
                intent.putExtra( RecognizerIntent.EXTRA_PREFER_OFFLINE, true );
            try {
                startActivityForResult( intent, REQUEST_CODE );
            } catch ( ActivityNotFoundException a ) {
                Toast.makeText(getApplicationContext(), "Speech Recognizer no soportado", Toast.LENGTH_SHORT).show();
                btnSpeak.setEnabled( true );
            }
        }
    });
}
 
Example 29
Project: OSchina_resources_android   File: RichBar.java   View source code 5 votes vote down vote up
public RichBar(Context context, @Nullable AttributeSet attrs) {
    super(context, attrs);
    LayoutInflater.from(getContext()).inflate(R.layout.view_rich_bar, this, true);
    mBtnKeyboard = (ImageButton) findViewById(R.id.btn_keyboard);
    mBtnFont = (ImageButton) findViewById(R.id.btn_font);
    mBtnAlign = (ImageButton) findViewById(R.id.btn_align);
    mBtnCategory = (ImageButton) findViewById(R.id.btn_category);
    mBtnTitle = (ImageButton)findViewById(R.id.btn_h);
}
 
Example 30
Project: Blockly   File: ProcedureDefinitionMutatorFragment.java   View source code 5 votes vote down vote up
public ViewHolder(View view, int viewType) {
    super(view);

    if (viewType == VH_TYPE_ADD) {
        mAddButton = (Button) view.findViewById(R.id.procedure_argument_add);
    } else
    if (viewType == VH_TYPE_ARGUMENT) {
        mArgName = (EditText) view.findViewById(R.id.procedure_argument_name);
        mDeleteButton = (ImageButton) view.findViewById(R.id.procedure_argument_delete);
    }
}
 
Example 31
Project: leoapp-sources   File: CardAddDialog.java   View source code 5 votes vote down vote up
@Override
public void onCreate(Bundle b) {
    super.onCreate(b);
    setContentView(R.layout.dialog_add_card);
    buttons = new ImageButton[]{
            findViewById(R.id.imageButton1),
            findViewById(R.id.imageButton2),
            findViewById(R.id.imageButton3),
            findViewById(R.id.imageButton4),
            findViewById(R.id.imageButton5),
            findViewById(R.id.imageButton6),
            findViewById(R.id.imageButton7),
            findViewById(R.id.imageButton8)
    };

    backgrounds = new View[]{
            findViewById(R.id.highlight1),
            findViewById(R.id.highlight2),
            findViewById(R.id.highlight3),
            findViewById(R.id.highlight4),
            findViewById(R.id.highlight5),
            findViewById(R.id.highlight6),
            findViewById(R.id.highlight7),
            findViewById(R.id.highlight8)
    };

    initOptions();
    initSendButton();
}
 
Example 32
Project: touchtestweb-android   File: SimpleWebViewClient.java   View source code 5 votes vote down vote up
public SimpleWebViewClient(MainActivity activity)
{
  super();
  m_toolbarBackButton = (ImageButton)activity.findViewById(R.id.toolbar_back_button);
  m_toolbarForwardButton = (ImageButton)activity.findViewById(R.id.toolbar_forward_button);
  uri = activity.getIntent().getData();
}
 
Example 33
Project: RealityCheck   File: VrActivity.java   View source code 5 votes vote down vote up
public void initializeGvrView() {
	setContentView(R.layout.activity_vr);

	seekBar = (SeekBar) findViewById(R.id.seek_bar);
	seekBar.setOnSeekBarChangeListener(new SeekBarListener());
	statusText = (TextView) findViewById(R.id.status_text);

	// Make the source link clickable.
	TextView sourceText = (TextView) findViewById(R.id.source);
	sourceText.setText(Html.fromHtml(getString(R.string.source)));
	sourceText.setMovementMethod(LinkMovementMethod.getInstance());

	// Bind input and output objects for the view.
	videoWidgetView = (VrVideoView) findViewById(R.id.video_view);
	videoWidgetView.setEventListener(new ActivityEventListener());

	volumeToggle = (ImageButton) findViewById(R.id.volume_toggle);
	volumeToggle.setOnClickListener(new View.OnClickListener() {
		@Override
		public void onClick(View v) {
			setIsMuted(!isMuted);
		}
	});

	loadVideoStatus = LOAD_VIDEO_STATUS_UNKNOWN;

	// Initial launch of the app or an Activity recreation due to rotation.
	handleIntent(getIntent());
}
 
Example 34
Project: mobile-dashboard   File: StatsFragment.java   View source code 5 votes vote down vote up
@Override
public View onCreateView (LayoutInflater inflater, ViewGroup container,
                          Bundle savedInstanceState){
    View rootView = inflater.inflate(R.layout.fragment_stats, container, false);
    ImageButton refresh = (ImageButton) rootView.findViewById(R.id.refresh_stats_button);
    Log.i("Dashboard", "onCreateView TOP");
    refresh.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            updateCharts();
        }
    });

    return rootView;
}
 
Example 35
Project: EasyEmoji   File: BottomStyleManager.java   View source code 5 votes vote down vote up
View onCreateViewHolder(ViewGroup parent, int viewType){
    if(viewType == ITEM_EMOJ){
        ImageButton imageView = new ImageButton(context);
        imageView.setLayoutParams(new ViewGroup.LayoutParams(EmojiUtil.dip2px(context,40),
                ViewGroup.LayoutParams.MATCH_PARENT));
        imageView.setBackgroundColor(Color.WHITE);
        return imageView;
    }else {
        View view = (View) styleWrapperManager.bottomTypeViews.get(viewType-ITEM_VIEW);
        view.setLayoutParams(new ViewGroup.LayoutParams(EmojiUtil.dip2px(context,40),
                ViewGroup.LayoutParams.MATCH_PARENT));
        view.setBackgroundColor(Color.WHITE);
        return view;
    }
}
 
Example 36
Project: PrivacyShield   File: RegisterSetNameActivity.java   View source code 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_registername);

    tbName = (EditText)findViewById(R.id.tbName);
    tbEmail = (EditText)findViewById(R.id.tbEmail);
    btnNext = (ImageButton)findViewById(R.id.btnNext);
    imgSelected = (ImageView)findViewById(R.id.imgSelected);

    SharedPreferences srpef = getSharedPreferences("UserInfo",Context.MODE_PRIVATE);
    SharedPreferences.Editor edit = srpef.edit();
    String pic = srpef.getString("pic","");
    if(pic.equals("male"))
        imgSelected.setImageResource(R.drawable.male);
    else if(pic.equals("female"))
        imgSelected.setImageResource(R.drawable.female);


    btnNext.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {

            SharedPreferences sharedPreferences = getSharedPreferences("UserInfo", Context.MODE_PRIVATE);
            SharedPreferences.Editor editor = sharedPreferences.edit();

            editor.putString("name", tbName.getText().toString());
            editor.putString("email",tbEmail.getText().toString());
            editor.commit();

            Toast.makeText(getApplicationContext(),"Name & Email Set", Toast.LENGTH_LONG).show();
            Intent intent = new Intent(getApplicationContext(),RegisterGenPassActivity.class);
            startActivity(intent);
        }
    });



}
 
Example 37
Project: Android_watch_magpie   File: FragmentSettings.java   View source code 5 votes vote down vote up
private void initView() {
    ImageButton button_displayPulse=(ImageButton)view.findViewById(R.id.button_display_rules_pulse);
    ImageButton button_display_glucose=(ImageButton)view.findViewById(R.id.button_display_rules_glucose);
    ImageButton button_display_weight=(ImageButton)view.findViewById(R.id.button_display_rules_weight);
    ImageButton button_display_steps=(ImageButton)view.findViewById(R.id.button_display_rules_step);
    ImageButton   button_display_pressure=(ImageButton)view.findViewById(R.id.button_display_rules_pressure);

    buttonsManager.addButtonByCategory(Const.CATEGORY_PULSE,button_displayPulse);
    buttonsManager.addButtonByCategory(Const.CATEGORY_GLUCOSE,button_display_glucose);
    buttonsManager.addButtonByCategory(Const.CATEGORY_WEIGHT,button_display_weight);
    buttonsManager.addButtonByCategory(Const.CATEGORY_STEP,button_display_steps);
    buttonsManager.addButtonByCategory(Const.CATEGORY_PRESSURE,button_display_pressure);

    txtConstraint1 =(TextView)view.findViewById(R.id.txtView_constraint1);
    txtConstraint2 =(TextView)view.findViewById(R.id.txtView_constraint2);
    txtConstraint3 =(TextView)view.findViewById(R.id.txtView_constraint3);

    edit_value1min =(EditText)view.findViewById(R.id.edittxt_value1min);
    edit_value1Max =(EditText)view.findViewById(R.id.edittxt_value1max);
    edit_value2Min =(EditText)view.findViewById(R.id.edittxt_value2min);
    edit_value2Max =(EditText)view.findViewById(R.id.edittxt_value2max);

    //init the imageButton
    //add the listener for the button save
    buttonSaveValues =(ImageButton)view.findViewById(R.id.button_update_rules);

}
 
Example 38
Project: MaterialColorPickerDialog   File: ColorChooserDialog.java   View source code 5 votes vote down vote up
private void animator(final ImageButton imageButton){
    Animation animation = AnimationUtils.loadAnimation(getContext(),R.anim.color_item);
    animation.setInterpolator(new AccelerateInterpolator());
    imageButton.setAnimation(animation);
    imageButton.setVisibility(View.VISIBLE);
    animation.start();
}
 
Example 39
Project: Hotspot-master-devp   File: LinkTvActivity.java   View source code 5 votes vote down vote up
@Override
public void getViews() {
    mMaskView = (ImageView) findViewById(R.id.iv_mask);
    link_status = (TextView) findViewById(R.id.link_status);
    relink = (TextView) findViewById(R.id.relink);
    relink_la = (RelativeLayout) findViewById(R.id.relink_la);
    t1 = (TextView) findViewById(R.id.t1);
    t2 = (TextView) findViewById(R.id.t2);
    t3 = (TextView) findViewById(R.id.t3);
    num_one = (TextView) findViewById(R.id.num_one);
    num_two = (TextView) findViewById(R.id.num_two);
    num_three = (TextView) findViewById(R.id.num_three);
    num_four = (TextView) findViewById(R.id.num_four);
    num_five = (TextView) findViewById(R.id.num_five);
    num_six = (TextView) findViewById(R.id.num_six);
    num_seven = (TextView) findViewById(R.id.num_seven);
    num_eight = (TextView) findViewById(R.id.num_eight);
    num_zero = (TextView) findViewById(R.id.num_zero);
    num_nine = (TextView) findViewById(R.id.num_nine);
    num_del = (ImageButton) findViewById(R.id.num_del);
    wifi = (TextView) findViewById(R.id.wifi);
    finish = (RelativeLayout) findViewById(R.id.finish);

    iv_1 = (ImageView) findViewById(R.id.iv_1);
    iv_2 = (ImageView) findViewById(R.id.iv_2);
    iv_3 = (ImageView) findViewById(R.id.iv_3);
}
 
Example 40
Project: androidadvanced   File: RecipeMainActivityTest.java   View source code 5 votes vote down vote up
@Test
public void testShowUIElements_buttonsShouldBeVisible() throws Exception {
    view.showUIElements();

    ImageButton imgKeep = (ImageButton) activity.findViewById(R.id.imgKeep);
    ImageButton imgDismiss = (ImageButton) activity.findViewById(R.id.imgDismiss);

    assertEquals(View.VISIBLE, imgKeep.getVisibility());
    assertEquals(View.VISIBLE, imgDismiss.getVisibility());
}