Java Code Examples for android.widget.Button

The following examples show how to use android.widget.Button. These examples are extracted from open source projects. 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 Project: FileDownloader   Author: lingochamp   File: SingleTaskTestActivity.java    License: Apache License 2.0 7 votes vote down vote up
private void assignViews() {
    startBtn1 = (Button) findViewById(R.id.start_btn_1);
    pauseBtn1 = (Button) findViewById(R.id.pause_btn_1);
    deleteBtn1 = (Button) findViewById(R.id.delete_btn_1);
    filenameTv1 = (TextView) findViewById(R.id.filename_tv_1);
    speedTv1 = (TextView) findViewById(R.id.speed_tv_1);
    progressBar1 = (ProgressBar) findViewById(R.id.progressBar_1);
    startBtn2 = (Button) findViewById(R.id.start_btn_2);
    pauseBtn2 = (Button) findViewById(R.id.pause_btn_2);
    deleteBtn2 = (Button) findViewById(R.id.delete_btn_2);
    filenameTv2 = (TextView) findViewById(R.id.filename_tv_2);
    speedTv2 = (TextView) findViewById(R.id.speed_tv_2);
    progressBar2 = (ProgressBar) findViewById(R.id.progressBar_2);
    startBtn3 = (Button) findViewById(R.id.start_btn_3);
    pauseBtn3 = (Button) findViewById(R.id.pause_btn_3);
    deleteBtn3 = (Button) findViewById(R.id.delete_btn_3);
    speedTv3 = (TextView) findViewById(R.id.speed_tv_3);
    progressBar3 = (ProgressBar) findViewById(R.id.progressBar_3);
    startBtn4 = (Button) findViewById(R.id.start_btn_4);
    pauseBtn4 = (Button) findViewById(R.id.pause_btn_4);
    deleteBtn4 = (Button) findViewById(R.id.delete_btn_4);
    detailTv4 = (TextView) findViewById(R.id.detail_tv_4);
    speedTv4 = (TextView) findViewById(R.id.speed_tv_4);
    progressBar4 = (ProgressBar) findViewById(R.id.progressBar_4);
}
 
Example #2
Source Project: android-mvp-basic-sample   Author: MindorksOpenSource   File: LoginActivity.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_login);

    DataManager dataManager = ((MvpApp) getApplication()).getDataManager();
    loginPresenter = new LoginPresenter(dataManager);

    loginPresenter.onAttach(this);
    editTextEmail = (EditText) findViewById(R.id.editTextEmail);
    editTextPassword = (EditText) findViewById(R.id.editTextPassword);

    button = (Button) findViewById(R.id.button);

    button.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            onLoginButtonClick();
        }
    });

}
 
Example #3
Source Project: o2oa   Author: o2oa   File: SearchForAddFriendActivity.java    License: GNU Affero General Public License v3.0 6 votes vote down vote up
private void initView() {
    mEt_searchUser = (EditText) findViewById(R.id.et_searchUser);
    mBtn_search = (Button) findViewById(R.id.btn_search);
    mSearch_result = (LinearLayout) findViewById(R.id.search_result);
    mSearch_header = (SelectableRoundedImageView) findViewById(R.id.search_header);
    mSearch_name = (TextView) findViewById(R.id.search_name);
    mSearch_addBtn = (Button) findViewById(R.id.search_addBtn);
    mIv_clear = (ImageView) findViewById(R.id.iv_clear);
    mBtn_search.setEnabled(false);
    Intent intent = getIntent();
    if (intent.getFlags() == 2) {
        initTitle(true, true, "发起单聊", "", false, "");
        mSearch_addBtn.setVisibility(View.GONE);
    } else {
        initTitle(true, true, "添加好友", "", false, "");
    }
}
 
Example #4
Source Project: HeroVideo-master   Author: WeDevelopTeam   File: ThemePickDialog.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    mCancel = (Button) view.findViewById(android.R.id.button2);
    mConfirm = (Button) view.findViewById(android.R.id.button1);
    mCards[0] = (ImageView) view.findViewById(R.id.theme_pink);
    mCards[1] = (ImageView) view.findViewById(R.id.theme_purple);
    mCards[2] = (ImageView) view.findViewById(R.id.theme_blue);
    mCards[3] = (ImageView) view.findViewById(R.id.theme_green);
    mCards[4] = (ImageView) view.findViewById(R.id.theme_green_light);
    mCards[5] = (ImageView) view.findViewById(R.id.theme_yellow);
    mCards[6] = (ImageView) view.findViewById(R.id.theme_orange);
    mCards[7] = (ImageView) view.findViewById(R.id.theme_red);
    setImageButtons(mCurrentTheme);
    for (ImageView card : mCards) {
        card.setOnClickListener(this);
    }
    mCancel.setOnClickListener(this);
    mConfirm.setOnClickListener(this);
}
 
Example #5
Source Project: coursera-android   Author: aporter   File: NotificationToastActivity.java    License: MIT License 6 votes vote down vote up
@Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.main);
      
Button button = (Button) findViewById(R.id.toast_button);
button.setOnClickListener(new OnClickListener() {
	
	@Override
	public void onClick(View v) {
        
        Toast toast = new Toast(getApplicationContext());

        toast.setGravity(Gravity.CENTER_VERTICAL, 0, 0);
        toast.setDuration(Toast.LENGTH_LONG);
        
        toast.setView(getLayoutInflater().inflate(R.layout.custom_toast,null));
 
        toast.show();
	}
});

  }
 
Example #6
Source Project: Walk-In-Clinic-Android-App   Author: techwithtim   File: SignIn.java    License: MIT License 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_sign_in);

    Button button1 = findViewById(R.id.signInButton);
    Button button3 = findViewById(R.id.BackButton);

    button1.setOnClickListener(this);
    button3.setOnClickListener(this);

    username = (EditText)findViewById(R.id.usernameField2);
    password = (EditText)findViewById(R.id.passwordField2);

    users = new ArrayList<>();
    services = new ArrayList<>();
    updateUsers();
    updateServices();
}
 
Example #7
Source Project: codeexamples-android   Author: vogellacompany   File: Focus2AndroidTest.java    License: Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected void setUp() throws Exception {
    super.setUp();

    mFocusFinder = FocusFinder.getInstance();

    // inflate the layout
    final Context context = getContext();
    final LayoutInflater inflater = LayoutInflater.from(context);
    mRoot = (ViewGroup) inflater.inflate(R.layout.focus_2, null);

    // manually measure it, and lay it out
    mRoot.measure(500, 500);
    mRoot.layout(0, 0, 500, 500);

    mLeftButton = (Button) mRoot.findViewById(R.id.leftButton);
    mCenterButton = (Button) mRoot.findViewById(R.id.centerButton);
    mRightButton = (Button) mRoot.findViewById(R.id.rightButton);
}
 
Example #8
Source Project: views-widgets-samples   Author: android   File: MainActivity.java    License: Apache License 2.0 6 votes vote down vote up
public void onClick(View view) {
    switch (((Button) view).getText().toString()) {
        case "Top Left":
            alignButtons(true, true);
            break;

        case "Top Right":
            alignButtons(false, true);
            break;

        case "Bottom Left":
            alignButtons(true, false);
            break;

        case "Bottom Right":
            alignButtons(false, false);
            break;
    }
}
 
Example #9
Source Project: MediaSDK   Author: JeffMony   File: PlayFeatureActivity.java    License: Apache License 2.0 6 votes vote down vote up
private void initViews() {
    mVideoUrlView = (EditText) findViewById(R.id.video_url_view);
    mPlayBtn = (Button) findViewById(R.id.play_btn);
    mVideoListView = (ListView) findViewById(R.id.video_list);
    mPlayerBtnGroup = (RadioGroup) findViewById(R.id.play_btn_group);
    mIjkPlayerBtn = (RadioButton) findViewById(R.id.ijkplayer_btn);
    mExoPlayerBtn = (RadioButton) findViewById(R.id.exoplayer_btn);
    mVideoCacheBox = (CheckBox) findViewById(R.id.local_proxy_box);
    mCachedLocationView = (TextView) findViewById(R.id.cached_location_view);
    mCacheSizeView = (TextView) findViewById(R.id.cache_size_view);
    mClearCacheView = (TextView) findViewById(R.id.clear_cache_view);

    mExoPlayerBtn.setChecked(true);

    mPlayBtn.setOnClickListener(this);
    mClearCacheView.setOnClickListener(this);

    mPlayerBtnGroup.setOnCheckedChangeListener(this);

    mCachedLocationView.setText(CacheManager.getCachePath());
}
 
Example #10
Source Project: android-apps   Author: iamsarker   File: ManageCourses.java    License: MIT License 6 votes vote down vote up
private void initialControls() {
	departCode = (TextView) findViewById(R.id.viewCodeD);
	departName = (TextView) findViewById(R.id.viewNameD);

	txtCourseTitle = (EditText) findViewById(R.id.txtCodeC);
	txtCourseName = (EditText) findViewById(R.id.txtNameC);

	btnAddC = (Button) findViewById(R.id.addCourse);
	btnUpdateC = (Button) findViewById(R.id.updateCourse);

	Bundle extras = getIntent().getExtras();
	if (extras != null) {
		departmentCode = extras.getString("depCode");
		departmentName = extras.getString("depName");
	}
	departCode.setText(departmentCode);
	departName.setText(departmentName);

}
 
Example #11
Source Project: UltimateAndroid   Author: cymcsg   File: StandupTimer.java    License: Apache License 2.0 6 votes vote down vote up
protected synchronized void disableIndividualTimer() {
    Logger.d("Disabling the individual timer");

    remainingIndividualSeconds = 0;

    TextView participantNumber = (TextView) findViewById(R.id.participant_number);
    participantNumber.setText("individual_status_complete");

    TextView individualTimeRemaining = (TextView) findViewById(R.id.individual_time_remaining);
    individualTimeRemaining.setText(TimeFormatHelper.formatTime(remainingIndividualSeconds));
    individualTimeRemaining.setTextColor(Color.GRAY);

    Button nextButton = (Button) findViewById(R.id.next_button);
    nextButton.setClickable(false);
    nextButton.setTextColor(Color.GRAY);
}
 
Example #12
Source Project: ColorPicker   Author: jaredrummler   File: ColorPickerActivity.java    License: Apache License 2.0 6 votes vote down vote up
@Override protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  getWindow().setFormat(PixelFormat.RGBA_8888);

  setContentView(R.layout.activity_color_picker);

  SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
  int initialColor = prefs.getInt("color_3", 0xFF000000);

  colorPickerView = (ColorPickerView) findViewById(R.id.cpv_color_picker_view);
  ColorPanelView colorPanelView = (ColorPanelView) findViewById(R.id.cpv_color_panel_old);
  newColorPanelView = (ColorPanelView) findViewById(R.id.cpv_color_panel_new);

  Button btnOK = (Button) findViewById(R.id.okButton);
  Button btnCancel = (Button) findViewById(R.id.cancelButton);

  ((LinearLayout) colorPanelView.getParent()).setPadding(colorPickerView.getPaddingLeft(), 0,
      colorPickerView.getPaddingRight(), 0);

  colorPickerView.setOnColorChangedListener(this);
  colorPickerView.setColor(initialColor, true);
  colorPanelView.setColor(initialColor);

  btnOK.setOnClickListener(this);
  btnCancel.setOnClickListener(this);
}
 
Example #13
Source Project: java-unified-sdk   Author: leancloud   File: FileChooserCore.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Creates an instance of this class.
 * 
 * @param fileChooser The graphical file chooser.
 */
public FileChooserCore(FileChooser fileChooser) {
	// Initialize attributes.
	this.chooser = fileChooser;	
	this.listeners = new LinkedList<OnFileSelectedListener>();
	this.filter = null;
	this.showOnlySelectable = false;
	this.setCanCreateFiles(false);
	this.setFolderMode(false);
	this.currentFolder = null;
	this.labels = null;
	this.showConfirmationOnCreate = false;
	this.showConfirmationOnSelect = false;
	this.showFullPathInTitle = false;
	
	// Add listener for the  buttons.
	LinearLayout root = this.chooser.getRootLayout();
       Button addButton = (Button) root.findViewById(R.id.buttonAdd);
	addButton.setOnClickListener(addButtonClickListener);
	Button okButton = (Button) root.findViewById(R.id.buttonOk);
	okButton.setOnClickListener(okButtonClickListener);
}
 
Example #14
Source Project: Android-9-Development-Cookbook   Author: PacktPublishing   File: MainActivity.java    License: MIT License 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    Button button = (Button)findViewById(R.id.button);
    button.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            ((TextView)findViewById(
                    R.id.textView)).setText("Changed at runtime!");
            LinearLayout.LayoutParams params = (LinearLayout.
                    LayoutParams)view.getLayoutParams();
            params.leftMargin += 5;
        }
    });
}
 
Example #15
Source Project: 365browser   Author: mogoweb   File: CardUnmaskPrompt.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Validates the values of the input fields to determine whether the submit button should be
 * enabled. Also displays a detailed error message and highlights the fields for which the value
 * is wrong. Finally checks whether the focuse should move to the next field.
 */
private void validate() {
    Button positiveButton = mDialog.getButton(AlertDialog.BUTTON_POSITIVE);

    @ErrorType int errorType = getExpirationAndCvcErrorType();
    positiveButton.setEnabled(errorType == ERROR_TYPE_NONE);
    showDetailedErrorMessage(errorType);
    moveFocus(errorType);

    if (sObserverForTest != null) {
        sObserverForTest.onCardUnmaskPromptValidationDone(this);

        if (positiveButton.isEnabled()) {
            sObserverForTest.onCardUnmaskPromptReadyToUnmask(this);
        }
    }
}
 
Example #16
Source Project: android-open-project-demo   Author: android-cn   File: MainActivity.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
		Bundle savedInstanceState) {
	View rootView = inflater.inflate(R.layout.fragment_main, container,
			false);
	btn=(Button)rootView.findViewById(R.id.startbtn);
	uris=(TextView)rootView.findViewById(R.id.uris);
	btn.setOnClickListener(new OnClickListener() {
		
		@Override
		public void onClick(View v) {
			Intent intent=new Intent();
			intent.setClass(getActivity(), DisplyImageActivity.class);
			startActivityForResult(intent,REQUEST_CODE);
		}
	});
	return rootView;
}
 
Example #17
Source Project: Kernel-Tuner   Author: pedja1   File: TMAdapter.java    License: GNU General Public License v3.0 6 votes vote down vote up
private ViewHolder getViewHolder(final View workingView)
{
    final Object tag = workingView.getTag();
    ViewHolder viewHolder = null;


    if (null == tag || !(tag instanceof ViewHolder))
    {
        viewHolder = new ViewHolder();

        viewHolder.nameView = (TextView) workingView.findViewById(R.id.name);
        viewHolder.mbView = (TextView) workingView.findViewById(R.id.mb);
        viewHolder.imageView = (ImageView) workingView.findViewById(R.id.icon);
        viewHolder.killView = (Button) workingView.findViewById(R.id.kill);
        viewHolder.pidView = (TextView) workingView.findViewById(R.id.pid);

        workingView.setTag(viewHolder);

    }
    else
    {
        viewHolder = (ViewHolder) tag;
    }

    return viewHolder;
}
 
Example #18
Source Project: scene   Author: bytedance   File: PopToScene.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    getView().setBackgroundColor(ColorUtil.getMaterialColor(getResources(), 0));

    TextView name = getView().findViewById(R.id.name);
    name.setText(getNavigationScene().getStackHistory());

    Button btn = getView().findViewById(R.id.btn);
    btn.setText(getString(R.string.nav_pop_to_btn_0));
    btn.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            getNavigationScene().push(PopToScene_0.class);
        }
    });
}
 
Example #19
Source Project: friendly-plans   Author: autyzm-pg   File: PlanTaskListFragment.java    License: GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {

    Bundle arguments = getArguments();
    if (arePlanArgumentProvided(arguments)) {
        planId = (Long) arguments.get(ActivityProperties.PLAN_ID);
        typeId = (Integer) arguments.get(ActivityProperties.TYPE_ID);
    }

    TaskType taskType = TaskType.getTaskType(typeId);
    Button addButton = (Button) view.findViewById(R.id.id_btn_create_plan_add_tasks);
    TextView labelInfo = (TextView) view.findViewById(R.id.id_tv_plan_tasks_list_info);
    addButton.setText(taskType.getAddLabel());
    labelInfo.setText(taskType.getTaskListInfoLabel());

    RecyclerView recyclerView = (RecyclerView) getActivity()
            .findViewById(R.id.rv_create_plan_task_list);
    recyclerView.setHasFixedSize(true);
    recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));

    taskListAdapter = new TaskRecyclerViewAdapter(taskItemClickListener);
    recyclerView.setAdapter(taskListAdapter);

    taskListAdapter
            .setTaskItems(planTemplateRepository.getTaskWithThisPlanByTypeId(planId, typeId));
}
 
Example #20
Source Project: minx   Author: crazyhitty   File: SplashPinFragment.java    License: MIT License 6 votes vote down vote up
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    txtPIN= (EditText) getView().findViewById(R.id.userPinTxt);
    btnSavePin= (Button) getView().findViewById(R.id.btnSavePin);
    btnSavePin.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            pinValue=txtPIN.getText().toString();
            if(pinValue.length()==4){
                new SettingsPreferences(getActivity()).setSettingsPreferences(Integer.parseInt(pinValue));
                Toast.makeText(getActivity(), "PIN Saved", Toast.LENGTH_SHORT).show();
            }else{
                Toast.makeText(getActivity(), "Invalid Pin", Toast.LENGTH_SHORT).show();
            }
        }
    });
}
 
Example #21
Source Project: adt-leanback-support   Author: kingargyle   File: ErrorFragment.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
        Bundle savedInstanceState) {
    View root = inflater.inflate(R.layout.lb_error_fragment, container, false);

    mErrorFrame = root.findViewById(R.id.error_frame);
    updateBackground();

    mImageView = (ImageView) root.findViewById(R.id.image);
    updateImageDrawable();

    mTextView = (TextView) root.findViewById(R.id.message);
    updateMessage();

    mButton = (Button) root.findViewById(R.id.button);
    updateButton();

    mTitleView = (TitleView) root.findViewById(R.id.browse_title_group);
    updateTitle();

    FontMetricsInt metrics = getFontMetricsInt(mTextView);
    int underImageBaselineMargin = container.getResources().getDimensionPixelSize(
            R.dimen.lb_error_under_image_baseline_margin);
    setTopMargin(mTextView, underImageBaselineMargin + metrics.ascent);

    int underMessageBaselineMargin = container.getResources().getDimensionPixelSize(
            R.dimen.lb_error_under_message_baseline_margin);
    setTopMargin(mButton, underMessageBaselineMargin - metrics.descent);

    return root;
}
 
Example #22
Source Project: WaitView   Author: imkarl   File: MainActivity.java    License: GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    mRootView = findViewById(R.id.layout_root);

    Button toogleButton = new Button(this);
    toogleButton.setText("切换");
    toogleButton.setOnClickListener(this);
    FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
            ViewGroup.LayoutParams.WRAP_CONTENT, Gravity.RIGHT);
    addContentView(toogleButton, params);
}
 
Example #23
Source Project: argus-android   Author: moldedbits   File: ForgotPasswordProvider.java    License: Apache License 2.0 5 votes vote down vote up
private void applyTheme(View view) {
    ArgusTheme theme = Argus.getInstance().getArgusTheme();

    if(theme.getButtonDrawable() != 0) {
        Button actionButton = (Button) view.findViewById(R.id.action_button);
        if(actionButton != null) {
            actionButton.setBackgroundResource(theme.getButtonDrawable());
        }
    }
}
 
Example #24
Source Project: DeviceConnect-Android   Author: DeviceConnect   File: FaBoPinListActivity.java    License: MIT License 5 votes vote down vote up
@Override
protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_fabo_pin_list);

    ActionBar actionBar = getActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
    }

    setTitle(R.string.activity_fabo_virtual_service_pin_title);

    ProfileData p = getIntent().getParcelableExtra("profile");
    if (ProfileDataUtil.isMultiChoicePin(p)) {
        showPinFragment(new FaBoPinCheckBoxFragment());
    } else {
        showPinFragment(new FaBoPinRadioGroupFragment());
    }

    Button saveBtn = findViewById(R.id.activity_fabo_pin_save_btn);
    saveBtn.setOnClickListener((view) -> {
        savePinList();
    });

    // バックキーを押下された時を考慮してキャンセルを設定しておく
    setResult(RESULT_CANCELED, new Intent());
}
 
Example #25
Source Project: android-nodemcu-connection   Author: guzelcihad   File: MainActivity.java    License: MIT License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    ipAddress = (EditText) findViewById(R.id.edt_ip);
    ledOn = (Button) findViewById(R.id.btn_ledOn);
    ledOff = (Button) findViewById(R.id.btn_ledOff);

}
 
Example #26
Source Project: android   Author: codeandcoke   File: NuevoContacto.java    License: GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_nuevo_contacto);
    
    Button btAceptar = (Button) findViewById(R.id.btAceptar);
    btAceptar.setOnClickListener(this);
    Button btCancelar = (Button) findViewById(R.id.btCancelar);
    btCancelar.setOnClickListener(this);
    Button btImagen = (Button) findViewById(R.id.btImagen);
    btImagen.setOnClickListener(this);
}
 
Example #27
Source Project: droidddle   Author: goodev   File: ShotFragment.java    License: Apache License 2.0 5 votes vote down vote up
private void addTagButton(ViewGroup shotTagLayout, final String s) {
    Button button = (Button) LayoutInflater.from(getActivity()).inflate(R.layout.shot_tag, shotTagLayout, false);
    button.setText(s);
    button.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            UiUtils.openTagShotActivity(getActivity(), s);
        }
    });
    shotTagLayout.addView(button);
}
 
Example #28
Source Project: youqu_master   Author: wangfeng19930909   File: ImgSelFragment.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_img_sel, container, false);
    rvImageList = (RecyclerView) view.findViewById(R.id.rvImageList);
    btnAlbumSelected = (Button) view.findViewById(R.id.btnAlbumSelected);
    btnAlbumSelected.setOnClickListener(this);
    rlBottom = view.findViewById(R.id.rlBottom);
    return view;
}
 
Example #29
Source Project: polling-station-app   Author: digital-voting-pass   File: ManualInputActivity.java    License: GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_manual_input);
    Toolbar appBar = (Toolbar) findViewById(R.id.app_bar);
    setSupportActionBar(appBar);
    Util.setupAppBar(appBar, this);
    Typeface typeFace= Typeface.createFromAsset(getAssets(), "fonts/ro.ttf");

    docNumber = (EditText) findViewById(R.id.doc_num);
    docNumber.setTypeface(typeFace);
    TextView docNumTitle = (TextView) findViewById(R.id.doc_num_title);
    TextView dobTitle = (TextView) findViewById(R.id.dob_title);
    TextView expDateTitle = (TextView) findViewById(R.id.exp_date_title);
    docNumTitle.setTypeface(typeFace);
    dobTitle.setTypeface(typeFace);
    expDateTitle.setTypeface(typeFace);

    Button submitBut = (Button) findViewById(R.id.submit_button);
    submitBut.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if(verifyInput()) {
                Intent returnIntent = new Intent();
                returnIntent.putExtra(DocumentData.identifier, getData());
                setResult(Activity.RESULT_OK, returnIntent);
                finish();
            }
        }
    });
    setupDOBSpinners();
    setupExpirySpinners();

    // When docData was previously filled in, update text fields
    if(getIntent().hasExtra(DocumentData.identifier)) {
        putData(getIntent().getExtras());
    }
}
 
Example #30
Source Project: dragqueen   Author: fedepaol   File: OuterLayout.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected void onFinishInflate() {
    mQueenButton  = (Button) findViewById(R.id.queen_button);
    mDragHelper = ViewDragHelper.create(this, 1.0f, new DragHelperCallback());
    mIsOpen = false;
    super.onFinishInflate();
}