android.widget.ImageButton Java Examples

The following examples show how to use android.widget.ImageButton. 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: LocalPlayerActivity.java    From cast-videos-android with Apache License 2.0 6 votes vote down vote up
private void loadViews() {
    mVideoView = (VideoView) findViewById(R.id.videoView1);
    mTitleView = (TextView) findViewById(R.id.textView1);
    mDescriptionView = (TextView) findViewById(R.id.textView2);
    mDescriptionView.setMovementMethod(new ScrollingMovementMethod());
    mAuthorView = (TextView) findViewById(R.id.textView3);
    mStartText = (TextView) findViewById(R.id.startText);
    mStartText.setText(Utils.formatMillis(0));
    mEndText = (TextView) findViewById(R.id.endText);
    mSeekbar = (SeekBar) findViewById(R.id.seekBar1);
    mPlayPause = (ImageView) findViewById(R.id.imageView2);
    mLoading = (ProgressBar) findViewById(R.id.progressBar1);
    mControllers = findViewById(R.id.controllers);
    mContainer = findViewById(R.id.container);
    mCoverArt = (ImageView) findViewById(R.id.coverArtView);
    ViewCompat.setTransitionName(mCoverArt, getString(R.string.transition_image));
    mPlayCircle = (ImageButton) findViewById(R.id.play_circle);
    mPlayCircle.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            togglePlayback();
        }
    });
}
 
Example #2
Source File: AlbumView.java    From Popeens-DSub with GNU General Public License v3.0 6 votes vote down vote up
public AlbumView(Context context, boolean cell) {
	super(context);

	if(cell) {
		LayoutInflater.from(context).inflate(R.layout.album_cell_item, this, true);
	} else {
		LayoutInflater.from(context).inflate(R.layout.album_list_item, this, true);
	}

	coverArtView = findViewById(R.id.album_coverart);
	listenedView = (ImageView) findViewById(R.id.album_listened);
	titleView = (TextView) findViewById(R.id.album_title);
	artistView = (TextView) findViewById(R.id.album_artist);

	ratingBar = (RatingBar) findViewById(R.id.album_rating);
	ratingBar.setFocusable(false);
	starButton = (ImageButton) findViewById(R.id.album_star);
	starButton.setFocusable(false);
	moreButton = (ImageView) findViewById(R.id.item_more);

	sqlh  = new SQLiteHandler(context);

	checkable = true;
}
 
Example #3
Source File: CustomVideoView.java    From FimiX8-RE with MIT License 6 votes vote down vote up
private void initView() {
    this.mPlayerView = (RelativeLayout) LayoutInflater.from(getContext()).inflate(R.layout.album_custom_video_view, this);
    this.mPlayerView.setOnClickListener(this);
    this.mLoadingBar = (ProgressBar) this.mPlayerView.findViewById(R.id.load_iv);
    this.mVideoView = (TextureView) this.mPlayerView.findViewById(R.id.play_video_textureview);
    this.mVideoView.setOnClickListener(this);
    this.mVideoView.setKeepScreenOn(true);
    this.mVideoView.setSurfaceTextureListener(this);
    this.mTopBarLl = (LinearLayout) this.mPlayerView.findViewById(R.id.shoto_top_tab_ll);
    this.mBottomPlayRl = (RelativeLayout) this.mPlayerView.findViewById(R.id.bottom_play_rl);
    this.mMiniPlayBtn = (ImageButton) this.mBottomPlayRl.findViewById(R.id.play_btn);
    this.mPlaySb = (SeekBar) this.mBottomPlayRl.findViewById(R.id.play_sb);
    this.mPlaySb.setOnSeekBarChangeListener(this);
    this.mMiniPlayBtn.setOnClickListener(this);
    this.mCurrentTimeTv = (TextView) this.mBottomPlayRl.findViewById(R.id.time_current_tv);
    this.mTotalTimeTv = (TextView) this.mBottomPlayRl.findViewById(R.id.total_time_tv);
    showBar(false);
    this.nameTv = (TextView) findViewById(R.id.photo_name_tv);
    this.mPlayBackIBtn = (ImageButton) findViewById(R.id.media_back_btn);
    this.mPlayBackIBtn.setOnClickListener(this);
    this.mPlayerView.setOnClickListener(this);
    LayoutParams params = new LayoutParams(this.mScreenWidth, this.mDestationHeight);
    params.addRule(13);
    this.mPlayerView.setLayoutParams(params);
}
 
Example #4
Source File: OfflineMapActivity.java    From Maps with GNU General Public License v2.0 6 votes vote down vote up
protected void onCreate(Bundle savedInstanceState) {
     super.onCreate(savedInstanceState);
     /*
      * 设置离线地图存储目录,在下载离线地图或初始化地图设置; 使用过程中可自行设置, 若自行设置了离线地图存储的路径,
* 则需要在离线地图下载和使用地图页面都进行路径设置
*/
     // Demo中为了其他界面可以使用下载的离线地图,使用默认位置存储,屏蔽了自定义设置
     MapsInitializer.sdcardDir = OffLineMapUtils.getSdCacheDir(this);
     setContentView(R.layout.offlinemap_activity);
     init();

     ImageButton mOffLineMapsBack = (ImageButton) findViewById(R.id.offline_back);

     mOffLineMapsBack.setOnClickListener(new View.OnClickListener() {
         @Override
         public void onClick(View view) {
             finish();
         }
     });
 }
 
Example #5
Source File: PagerSlidingTabStripEmoji.java    From Yahala-Messenger with MIT License 6 votes vote down vote up
private void addIconTab(final int position, int resId) {

        ImageButton tab = new ImageButton(getContext());
        tab.setFocusable(true);
        tab.setImageResource(resId);

        tab.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                pager.setCurrentItem(position);
            }
        });

        tabsContainer.addView(tab);
        tab.setSelected(position == currentPosition);
    }
 
Example #6
Source File: ScheduledTasksAddActivity.java    From FreezeYou with Apache License 2.0 6 votes vote down vote up
private void prepareSaveButton(final int id) {
    final ImageButton saveButton = findViewById(R.id.staa_saveButton);
    saveButton.setBackgroundResource(Build.VERSION.SDK_INT < 21 ? getThemeFabDotBackground(ScheduledTasksAddActivity.this) : R.drawable.oval_ripple);
    saveButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            SharedPreferences defaultSharedPreferences = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
            if (isTimeTask) {
                if (saveTimeTaskData(defaultSharedPreferences, id)) {
                    finish();
                }
            } else {
                if (saveTriggerTaskData(defaultSharedPreferences, id)) {
                    finish();
                }
            }
        }
    });
}
 
Example #7
Source File: TaskCreateFragment.java    From friendly-plans with GNU General Public License v3.0 6 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
        Bundle savedInstanceState) {
    FragmentTaskCreateBinding binding = DataBindingUtil.inflate(
            inflater, R.layout.fragment_task_create, container, false);
    binding.setEvents(this);

    View view = binding.getRoot();
    ImageButton playSoundIcon = (ImageButton) view.findViewById(R.id.id_btn_play_sound);

    AppComponent appComponent = ((App) getActivity().getApplication()).getAppComponent();
    soundComponent = SoundComponent.getSoundComponent(
            soundId, playSoundIcon, getActivity().getApplicationContext(), appComponent);
    appComponent.inject(this);

    binding.setSoundComponent(soundComponent);
    return view;
}
 
Example #8
Source File: NumberGraphemeActivity.java    From ml-authentication with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    Log.i(getClass().getName(), "onCreate");
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_number_grapheme);

    getWindow().setStatusBarColor(Color.parseColor("#1C80CF"));

    graphemeImageView = (ImageView) findViewById(R.id.graphemeImageView);

    graphemeNextButton = (ImageButton) findViewById(R.id.loadingNextButton);

    LiteracyApplication literacyApplication = (LiteracyApplication) getApplicationContext();
    numberDao = literacyApplication.getDaoSession().getNumberDao();
    audioDao = literacyApplication.getDaoSession().getAudioDao();
}
 
Example #9
Source File: MainActivity.java    From MalwareBuster with Apache License 2.0 6 votes vote down vote up
private void refreshGlobalHookControls() {
    boolean currentStatus = prefs.getBoolean(Common.GLOBALHOOK, false);

    ImageButton glbHookbtn = (ImageButton)findViewById(R.id.btnGlobalHook);
    ListView list = (ListView) findViewById(R.id.lstApps);
    TextView globalWarningTextView = (TextView) findViewById(R.id.globalWarningTextView);
    SearchView searchApp = (SearchView) findViewById(R.id.searchApp);

    if (currentStatus) {
        glbHookbtn.setBackgroundColor(0xff34bcf1);
        list.setVisibility(View.GONE);
        globalWarningTextView.setVisibility(View.VISIBLE);
        searchApp.setEnabled(false);
    }
    else {
        glbHookbtn.setBackgroundColor(Color.DKGRAY);
        list.setVisibility(View.VISIBLE);
        globalWarningTextView.setVisibility(View.GONE);
        searchApp.setEnabled(true);
    }
}
 
Example #10
Source File: PassphrasePromptActivity.java    From Silence with GNU General Public License v3.0 6 votes vote down vote up
private void initializeResources() {
  getSupportActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
  getSupportActionBar().setCustomView(R.layout.centered_app_title);

  ImageButton okButton = (ImageButton) findViewById(R.id.ok_button);
  passphraseText       = (EditText)    findViewById(R.id.passphrase_edit);
  SpannableString hint = new SpannableString("  " + getString(R.string.PassphrasePromptActivity_enter_passphrase));
  hint.setSpan(new RelativeSizeSpan(0.9f), 0, hint.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
  hint.setSpan(new TypefaceSpan("sans-serif"), 0, hint.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);

  passphraseText.setHint(hint);
  okButton.setOnClickListener(new OkButtonClickListener());
  passphraseText.setOnEditorActionListener(new PassphraseActionListener());
  passphraseText.setImeActionLabel(getString(R.string.prompt_passphrase_activity__unlock),
                                   EditorInfo.IME_ACTION_DONE);
}
 
Example #11
Source File: AudioPlayer.java    From Conversations with GNU General Public License v3.0 6 votes vote down vote up
private void startStop(ImageButton playPause) {
    if (ContextCompat.checkSelfPermission(messageAdapter.getActivity(), Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
        pendingOnClickView.push(new WeakReference<>(playPause));
        ActivityCompat.requestPermissions(messageAdapter.getActivity(), new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, ConversationsActivity.REQUEST_PLAY_PAUSE);
        return;
    }
    initializeProximityWakeLock(playPause.getContext());
    final RelativeLayout audioPlayer = (RelativeLayout) playPause.getParent();
    final ViewHolder viewHolder = ViewHolder.get(audioPlayer);
    final Message message = (Message) audioPlayer.getTag();
    if (startStop(viewHolder, message)) {
        this.audioPlayerLayouts.clear();
        this.audioPlayerLayouts.addWeakReferenceTo(audioPlayer);
        stopRefresher(true);
    }
}
 
Example #12
Source File: CuratorFragment.java    From 4pdaClient-plus with Apache License 2.0 6 votes vote down vote up
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    view = inflater.inflate(R.layout.curator_fragment, container, false);
    webView = (AdvWebView) findViewById(R.id.wvBody);
    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    if (App.getInstance().getPreferences().getBoolean("pancilInActionBar", false)) {
        fab.hide();
    } else {
        setHideFab(fab);
        setFabColors(fab);
        fab.setOnClickListener(view -> webView.evalJs("getIds();"));
    }
    ImageButton up = (ImageButton) findViewById(R.id.btnUp);
    ImageButton down = (ImageButton) findViewById(R.id.btnDown);
    up.setOnClickListener(v -> webView.pageUp(true));
    down.setOnClickListener(v -> webView.pageDown(true));
    initSwipeRefreshLayout();
    webView.addJavascriptInterface(this, "HTMLOUT");
    topicId = getArguments().getString("TOPIC_ID");
    url = getArguments().getString("URL");
    load(url, topicId);
    return view;
}
 
Example #13
Source File: MainActivity.java    From QuickerAndroid with GNU General Public License v3.0 6 votes vote down vote up
private void recreateView() {
    // 依据屏幕方向加载
    int orientation = getResources().getConfiguration().orientation;
    if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
        setContentView(R.layout.activity_main);
    } else if (orientation == Configuration.ORIENTATION_PORTRAIT) {
        setContentView(R.layout.activity_main_portrait);
    }

    // 组件引用
    txtProfileName = (TextView) findViewById(R.id.txtProfileName);
    seekbarVolume = (SeekBar) findViewById(R.id.seekbarVolume);
    btnMute = (ImageButton) findViewById(R.id.btnMute);

    // 创建action按钮
    createActionButtons();

    setupUiListeners();
}
 
Example #14
Source File: FindGankAty.java    From myapplication with Apache License 2.0 6 votes vote down vote up
private void initView() {
    isConnect = SystemUtils.checkNetworkConnection(FindGankAty.this);
    mTitleBackIBtn = (ImageButton) findViewById(R.id.title_gank_back_ibtn);
    mGankClassBtn = (Button) findViewById(R.id.title_gank_class_tv);
    mRecyclerView = (RecyclerView) findViewById(R.id.find_gank_recyclerview);
    mMaterialDialog = new MaterialDialog.Builder(FindGankAty.this)
            .content("Please waiting...")
            .contentGravity(GravityEnum.CENTER)
            .progress(true, 0)
            .progressIndeterminateStyle(true)
            .show();
    mMaterialDialog.setCancelable(false);

    if (isConnect) {
        switchSelectedDatas("all");
    } else {
        mMaterialDialog.dismiss();
        SystemUtils.noNetworkAlert(FindGankAty.this);
    }
}
 
Example #15
Source File: AccessibilityTabModelListItem.java    From 365browser with Apache License 2.0 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 #16
Source File: GridAdapter.java    From visual-goodies with Apache License 2.0 6 votes vote down vote up
public View getDetailsView(LayoutInflater inflater, ViewGroup parent,
                           AwesomeViewHolder result) {
    //TODO FORCE DARK MODE
    View view = null;
    switch (mDetailsViewType) {
        case SINGLE_LINE:
            view = inflater.inflate(R.layout.griddetails_single_line, null);
            break;
        case TWO_LINES:
            view = inflater.inflate(R.layout.griddetails_two_lines, null);
            break;
        default:
        case NONE:
            return null;
    }
    view.setTag(DETAILS_VIEW_TAG);
    result.setDetailsView(view);
    result.setText1((TextView) view.findViewById(android.R.id.text1));
    result.setText2((TextView) view.findViewById(android.R.id.text2));
    result.setButton((ImageButton) view.findViewById(R.id.imageButton));
    return view;
}
 
Example #17
Source File: CaptureActivity.java    From FoodOrdering with Apache License 2.0 6 votes vote down vote up
/**
 * OnCreate中初始化一些辅助类,如InactivityTimer(休眠)、Beep(声音)以及AmbientLight(闪光灯)
 */
@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    // 保持Activity处于唤醒状态
    Window window = getWindow();
    window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    setContentView(R.layout.capture);

    hasSurface = false;

    inactivityTimer = new InactivityTimer(this);
    beepManager = new BeepManager(this);

    imageButton_back = (ImageButton) findViewById(R.id.capture_imageview_back);
    imageButton_back.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            finish();
        }
    });
}
 
Example #18
Source File: CameraApi1Activity.java    From pixelvisualcorecamera with Apache License 2.0 5 votes vote down vote up
private void setCameraIconForCurrentCamera() {
  ImageButton button = findViewById(R.id.control_camera_selection);
  switch (cameraId) {
    case CameraInfo.CAMERA_FACING_BACK:
      button.setImageResource(R.drawable.ic_camera_rear_white_24);
      break;
    case CameraInfo.CAMERA_FACING_FRONT:
      button.setImageResource(R.drawable.ic_camera_front_white_24);
      break;
    default:
      break;
  }
}
 
Example #19
Source File: HomeActivity.java    From MangoBloggerAndroidApp with Mozilla Public License 2.0 5 votes vote down vote up
/**
 * Get toolbar's navigation icon view reference.
 *
 * @param toolbar the main {@link Toolbar}.
 * @return a {@link ImageButton} reference.
 */
@Nullable
private ImageButton getNavButtonView(Toolbar toolbar) {
    for (int i = 0; i < toolbar.getChildCount(); i++)
        if(toolbar.getChildAt(i) instanceof ImageButton)
            return (ImageButton) toolbar.getChildAt(i);

    return null;
}
 
Example #20
Source File: MasterItemView.java    From Android-Application-ZJB with Apache License 2.0 5 votes vote down vote up
@Override
protected void onFinishInflate() {
    super.onFinishInflate();
    mTextView = (TextView) findViewById(R.id.master_item_text_view);
    mRightArrow = (ImageButton) findViewById(R.id.master_item_right_arrow_view);
    mRightTextView = (TextView) findViewById(R.id.master_item_right_text_view_with_arrow);
    mLine = findViewById(R.id.master_item_line);
    mRedPointView = (RedPointView) findViewById(R.id.new_msg);
    mDynamicRedPointView = (RedPointView) findViewById(R.id.dynamic_red_point);
    mRightTextLayout = findViewById(R.id.master_item_right_text_layout);
    mNewDynamicLayout = findViewById(R.id.new_dynamic_layout);
    mAvatarIv = (ImageView) findViewById(R.id.avatar);
    mRightIv = (ImageView) findViewById(R.id.right_image_view);
    mDynamicRightTv = (TextView) findViewById(R.id.dynamic_right_tv);
    mDynamicLeftIv = (ImageView) findViewById(R.id.dynamic_left_icon);
    setOnClickListener(this);
    mTextView.setOnClickListener(this);
    mRightArrow.setOnClickListener(this);
    mRightTextView.setOnClickListener(this);
    mRightIv.setOnClickListener(v -> {
        Object tag = v.getTag();
        if (null != tag) {
            if (null != mRightImageViewClickListener) {
                mRightImageViewClickListener.onRightImageViewClick((String) tag);
            }
        } else {
            MasterItemView.this.performClick();
        }
    });
}
 
Example #21
Source File: CallLogDetailsFragment.java    From CSipSimple with GNU General Public License v3.0 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.call_detail, container, false);
    mResources = getResources();
    mInflater = inflater;

    mPhoneCallDetailsHelper = new PhoneCallDetailsHelper(mResources);
    mHeaderTextView = (TextView) v.findViewById(R.id.header_text);
    mHeaderOverlayView = v.findViewById(R.id.photo_text_bar);
    mMainActionView = (ImageView) v.findViewById(R.id.main_action);
    mMainActionPushLayerView = (ImageButton) v.findViewById(R.id.main_action_push_layer);
    mContactBackgroundView = (ImageView) v.findViewById(R.id.contact_background);
    mAccountChooserButton = (AccountChooserButton) v.findViewById(R.id.call_choose_account);
    return v;
}
 
Example #22
Source File: FindPhotoDetailAty.java    From myapplication with Apache License 2.0 5 votes vote down vote up
private void initView() {
    mImageView = (ImageView) findViewById(R.id.find_photo_imv);
    ImageButton titlteImv = (ImageButton) findViewById(R.id.title_imv);
    titlteImv.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            FindPhotoDetailAty.this.finish();
        }
    });
}
 
Example #23
Source File: ThirdFragment.java    From myapplication with Apache License 2.0 5 votes vote down vote up
/**
 * 初始化界面控件
 */
private void initView() {
    mImages.add(R.drawable.find_1);
    mImages.add(R.drawable.find_2);
    mImages.add(R.drawable.find_8);
    mImages.add(R.drawable.find_4);
    mImages.add(R.drawable.find_5);
    mImages.add(R.drawable.find_6);
    mImages.add(R.drawable.find_7);

    mTitles.add("既见公子,云胡不喜?");
    mTitles.add("我只想静静地,做个美男子。");
    mTitles.add("曾经的曾经,只剩期望...");
    mTitles.add("你那么美,爱我如何?");
    mTitles.add("夜,夜,夜...");
    mTitles.add("孩子,快点睡吧,明天还要抢票回家呢。");
    mTitles.add("天边美丽的火烧云啊,我的生活放荡,像条狗,像条流浪狗...");

    titleSearchIbtn = (ImageButton) view.findViewById(R.id.title_find_search_ibtn);
    titleSearchIbtn.setOnClickListener(ThirdFragment.this);

    nineGridView = (NineGridView) view.findViewById(R.id.find_nine_gridview);
    nineGridView.setAdapter(new NineGridViewAdapter(getActivity()));

    mBanner = (Banner) view.findViewById(R.id.banner);
    mBanner.setBannerStyle(BannerConfig.CIRCLE_INDICATOR_TITLE_INSIDE);
    mBanner.setBannerAnimation(Transformer.Default);
    mBanner.isAutoPlay(true);
    mBanner.setDelayTime(3000);
    mBanner.setIndicatorGravity(BannerConfig.CENTER);
    mBanner.setBannerTitles(mTitles);
    mBanner.setImageLoader(new GlideImageLoader());
    mBanner.setImages(mImages);
    mBanner.start();
    mBanner.setOnBannerClickListener(this);
}
 
Example #24
Source File: ZenMenuAdapter.java    From zen4android with MIT License 5 votes vote down vote up
@Override
public View getGroupView(int groupPosition, boolean isExpanded,
		View convertView, ViewGroup parent) {
	Map<String, String> map = (Map<String, String>)mHeaders.get(groupPosition);
	String text = (String)map.get("name");
	if(convertView == null) {
		convertView = mInflater.inflate(R.layout.zen_menu_group, null);			
	}
	ImageButton itemLeft = (ImageButton)convertView.findViewById(R.id.zen_menu_header_left);
	Button itemRight = (Button)convertView.findViewById(R.id.zen_menu_header_right);
	itemRight.setText(text);
	
	itemLeft.setImageResource(R.drawable.menu_right_arrow);
	if(isExpanded) {
		itemLeft.setImageResource(R.drawable.menu_down_arrow);
	}
	
	int background = menu_item_backgrounds[groupPosition%9];
	itemLeft.setBackgroundResource(background);
	itemRight.setBackgroundResource(background);
	itemLeft.setFocusable(false);
	itemRight.setFocusable(false);
	itemLeft.setClickable(false);
	itemRight.setClickable(false);
	
	
	
	return convertView;
}
 
Example #25
Source File: MediaControlView.java    From Cirrus_depricated with GNU General Public License v2.0 5 votes vote down vote up
private void initControllerView(View v) {
    mPauseButton = (ImageButton) v.findViewById(R.id.playBtn);
    if (mPauseButton != null) {
        mPauseButton.requestFocus();
        mPauseButton.setOnClickListener(this);
    }

    mFfwdButton = (ImageButton) v.findViewById(R.id.forwardBtn);
    if (mFfwdButton != null) {
        mFfwdButton.setOnClickListener(this);
    }

    mRewButton = (ImageButton) v.findViewById(R.id.rewindBtn);
    if (mRewButton != null) {
        mRewButton.setOnClickListener(this);
    }

    mProgress = (ProgressBar) v.findViewById(R.id.progressBar);
    if (mProgress != null) {
        if (mProgress instanceof SeekBar) {
            SeekBar seeker = (SeekBar) mProgress;
            DisplayUtils.colorPreLollipopHorizontalSeekBar(seeker);
            seeker.setOnSeekBarChangeListener(this);
        } else {
            DisplayUtils.colorPreLollipopHorizontalProgressBar(mProgress);
        }
        mProgress.setMax(1000);
    }

    mEndTime = (TextView) v.findViewById(R.id.totalTimeText);
    mCurrentTime = (TextView) v.findViewById(R.id.currentTimeText);
    mFormatBuilder = new StringBuilder();
    mFormatter = new Formatter(mFormatBuilder, Locale.getDefault());

}
 
Example #26
Source File: ActionMenuItemView.java    From zen4android with MIT License 5 votes vote down vote up
@Override
public void onFinishInflate() {

    mImageButton = (ImageButton) findViewById(R.id.abs__imageButton);
    mTextButton = (CapitalizingButton) findViewById(R.id.abs__textButton);
    mImageButton.setOnClickListener(this);
    mTextButton.setOnClickListener(this);
    mImageButton.setOnLongClickListener(this);
    setOnClickListener(this);
    setOnLongClickListener(this);
}
 
Example #27
Source File: QuestionWidget.java    From commcare-android with Apache License 2.0 5 votes vote down vote up
private void addHelpPlaceholder() {
    if (!mPrompt.hasHelp()) {
        return;
    }

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

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

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

    this.addView(triggerLayout);
    this.addView(helpPlaceholder);
    helpPlaceholder.setVisibility(View.GONE);
}
 
Example #28
Source File: GrantedPhonesEditableListAdapter.java    From SimpleSmsRemote with MIT License 5 votes vote down vote up
@NonNull
@Override
public View getView(final int position, View convertView, @NonNull ViewGroup parent) {
    if (convertView == null) {
        LayoutInflater inflater = (LayoutInflater) getContext().
                getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        convertView = inflater.inflate(LAYOUT_RES, parent, false);
    }

    String phone = phones.get(position);

    final AutoCompleteTextView phoneEditText = (AutoCompleteTextView)
            convertView.findViewById(R.id.edittext_phonenumber);
    ImageButton deleteButton = (ImageButton) convertView.findViewById(R.id.imageButton_delete);

    phoneEditText.setText(phone);
    if (phoneListAdapter != null)
        phoneEditText.setAdapter(phoneListAdapter);

    deleteButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            removePhone(position);
        }
    });

    return convertView;
}
 
Example #29
Source File: CommonFunctions.java    From Expert-Android-Programming with MIT License 5 votes vote down vote up
public static void colorizeToolbar(Toolbar toolbarView, int toolbarIconsColor) {
    final PorterDuffColorFilter colorFilter
            = new PorterDuffColorFilter(toolbarIconsColor, PorterDuff.Mode.MULTIPLY);

    for (int i = 0; i < toolbarView.getChildCount(); i++) {
        final View v = toolbarView.getChildAt(i);

        //Step 1 : Changing the color of back button (or open drawer button).
        if (v instanceof ImageButton) {
            //Action Bar back button
            ((ImageButton) v).getDrawable().setColorFilter(colorFilter);
        }
    }
}
 
Example #30
Source File: FindGankDetailAty.java    From myapplication with Apache License 2.0 5 votes vote down vote up
private void initView() {
    titlBackIbtn = (ImageButton) findViewById(R.id.title_gank_detail_back_ibtn);
    mMarqueeTextView = (MarqueeTextView) findViewById(R.id.title_detail_gank_class_tv);
    mMarqueeTextView.setEllipsize(TextUtils.TruncateAt.MARQUEE);
    mMarqueeTextView.setSingleLine(true);
    mShareIbtn = (ImageButton) findViewById(R.id.title_detail_gank_share_ibtn);
    mNumberProgressBar = (NumberProgressBar) findViewById(R.id.find_gank_detail_numpbar);
    mWebView = (WebView) findViewById(R.id.find_gank_detail_wv);
}