android.widget.Button Java Examples

The following examples show how to use android.widget.Button. 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: SingleTaskTestActivity.java    From FileDownloader with 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 File: TMAdapter.java    From Kernel-Tuner with 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 #3
Source File: FileChooserCore.java    From java-unified-sdk with 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 #4
Source File: MainActivity.java    From Android-9-Development-Cookbook with 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 #5
Source File: CardUnmaskPrompt.java    From 365browser with 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 #6
Source File: LoginActivity.java    From android-mvp-basic-sample with 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 #7
Source File: MainActivity.java    From android-open-project-demo with 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 #8
Source File: SplashPinFragment.java    From minx with 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 #9
Source File: ThemePickDialog.java    From HeroVideo-master with 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 #10
Source File: SearchForAddFriendActivity.java    From o2oa with 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 #11
Source File: NotificationToastActivity.java    From coursera-android with 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 #12
Source File: SignIn.java    From Walk-In-Clinic-Android-App with 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 #13
Source File: ColorPickerActivity.java    From ColorPicker with 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 #14
Source File: Focus2AndroidTest.java    From codeexamples-android with 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 #15
Source File: PlanTaskListFragment.java    From friendly-plans with 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 #16
Source File: MainActivity.java    From views-widgets-samples with 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 #17
Source File: StandupTimer.java    From UltimateAndroid with 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 #18
Source File: ManageCourses.java    From android-apps with 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 #19
Source File: PlayFeatureActivity.java    From MediaSDK with 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 #20
Source File: PopToScene.java    From scene with 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 #21
Source File: PublicTimelineActivity.java    From YiBo with Apache License 2.0 5 votes vote down vote up
private void bindEvent() {
	MicroBlogItemClickListener itemClickListener = new MicroBlogItemClickListener(this);
	lvMicroBlog.setOnItemClickListener(itemClickListener);

	MicroBlogContextMenuListener contextMenuListener =
		new MicroBlogContextMenuListener(lvMicroBlog);
	lvMicroBlog.setOnCreateContextMenuListener(contextMenuListener);

	Button btnBack = (Button) this.findViewById(R.id.btnBack);
	btnBack.setOnClickListener(new GoBackClickListener());

}
 
Example #22
Source File: SubmissionRequestActivity.java    From JianshuApp with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Button button = new Button(this);
    button.setText("SubmissionRequestActivity");
    setContentView(button);
}
 
Example #23
Source File: BrightActivity.java    From AirFree-Client with GNU General Public License v3.0 5 votes vote down vote up
private void init() {
    app = (ApplicationUtil) BrightActivity.this.getApplication();
    btnBack = (Button) findViewById(R.id.btn_back);
    btnBack.setOnClickListener(this);
    sbBright = (SeekBar) findViewById(R.id.sb_bright);
    sbBright.setProgress(50);
    sbBright.setOnSeekBarChangeListener(this);
}
 
Example #24
Source File: DownloadBaseListActivity.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
private void initViews() {
    mDownloadListView = (ListView) findViewById(R.id.download_listview);
    mFilePath = (TextView) findViewById(R.id.file_path);
    mClearBtn = (Button) findViewById(R.id.clear_cache_btn);
    mPauseBtn = (Button) findViewById(R.id.pause_task_btn);
    mFilePath.setText(VideoDownloadManager.getInstance().getCacheFilePath());
}
 
Example #25
Source File: FileListView.java    From qplayer-sdk with MIT License 5 votes vote down vote up
private void initListView () {
    m_lvListener = new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            SimpleAdapter adapter = (SimpleAdapter)m_lstFiles.getAdapter();
            Map<String, Object> map = (Map<String, Object>)adapter.getItem(position);
            String  strFile = (String) map.get("path");
            String	strDir = (String) map.get("dir");

            if (strDir.equals("1")) {
                updateFileList (strFile);
            } else {
                String strExt = strFile.substring(strFile.length() - 4);
                if (strExt.equalsIgnoreCase(".url")) {
                    updateURLList (strFile);
                } else {
                    Intent intent = new Intent(FileListView.this, PlayerView.class);
                    intent.setData(Uri.parse(strFile));
                    startActivity(intent);
                }
            }
        }
    };
    m_lstFiles = (ListView)findViewById (R.id.listViewFile);
    m_lstFiles.setOnItemClickListener(m_lvListener);
    m_txtURL = (EditText)findViewById (R.id.editTextURL);
    m_btnPlay = (Button)findViewById (R.id.buttonPlay);

    m_btnPlay.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
        String strURL = m_txtURL.getText ().toString();
        Intent intent = new Intent(FileListView.this, PlayerView.class);
        intent.setData(Uri.parse(strURL));
        startActivity(intent);
        }
    });
}
 
Example #26
Source File: ModifyPwdActivity.java    From letv with Apache License 2.0 5 votes vote down vote up
private void init() {
    setTitle(2131100617);
    this.mEditPwdOld = (EditText) findViewById(R.id.edit_pwd_old);
    this.mEditPwdNew = (EditText) findViewById(R.id.edit_pwd_new);
    this.mEditPwdConfirm = (EditText) findViewById(R.id.edit_pwd_confirm);
    this.mSaveBtn = (Button) findViewById(R.id.btn_save);
    this.mSaveBtn.setOnClickListener(this);
}
 
Example #27
Source File: ConnectionActivity.java    From Android-GSDemo-GoogleMap with MIT License 5 votes vote down vote up
private void initUI() {

        mTextConnectionStatus = (TextView) findViewById(R.id.text_connection_status);
        mTextProduct = (TextView) findViewById(R.id.text_product_info);
        mBtnOpen = (Button) findViewById(R.id.btn_open);
        mBtnOpen.setOnClickListener(this);
        mBtnOpen.setEnabled(false);

        mVersionTv = (TextView) findViewById(R.id.textView2);
        mVersionTv.setText(getResources().getString(R.string.sdk_version, DJISDKManager.getInstance().getSDKVersion()));
    }
 
Example #28
Source File: MainActivity.java    From arcgis-runtime-samples-android with Apache License 2.0 5 votes vote down vote up
/**
 * Inflates the save map dialog allowing the user to enter title, tags and description for their map.
 */
private void showSaveMapDialog() {
  // inflate save map dialog layout
  LayoutInflater inflater = LayoutInflater.from(this);
  View saveMapDialogView = inflater.inflate(R.layout.save_map_dialog, null, false);

  // get references to edit text views
  EditText titleEditText = saveMapDialogView.findViewById(R.id.titleEditText);
  EditText tagsEditText = saveMapDialogView.findViewById(R.id.tagsEditText);
  EditText descriptionEditText = saveMapDialogView.findViewById(R.id.descriptionEditText);

  // build the dialog
  AlertDialog saveMapDialog = new AlertDialog.Builder(this)
      .setView(saveMapDialogView)
      .setPositiveButton(R.string.save_map, null)
      .setNegativeButton(R.string.cancel, null)
      .show();

  // click handling for the save map button
  Button saveMapButton = saveMapDialog.getButton(DialogInterface.BUTTON_POSITIVE);
  saveMapButton.setOnClickListener(v -> {
    Iterable<String> tags = Arrays.asList(tagsEditText.getText().toString().split(","));
    // make sure the title edit text view has text
    if (titleEditText.getText().length() > 0) {
      // call save map passing in title, tags and description
      saveMap(titleEditText.getText().toString(), tags, descriptionEditText.getText().toString());
      saveMapDialog.dismiss();
    } else {
      Toast.makeText(this, "A title is required to save your map.", Toast.LENGTH_LONG).show();
    }
  });

  // click handling for the cancel button
  Button cancelButton = saveMapDialog.getButton(DialogInterface.BUTTON_NEGATIVE);
  cancelButton.setOnClickListener(v -> saveMapDialog.dismiss());
}
 
Example #29
Source File: MainActivity.java    From AppLocker with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    btOnOff = (Button) findViewById(R.id.bt_on_off);
    btOnOff.setOnClickListener(this);

    btChange = (Button) findViewById(R.id.bt_change);
    btChange.setText(R.string.change_passcode);
    btChange.setOnClickListener(this);

    updateUI();
}
 
Example #30
Source File: LandActivity.java    From kute with Apache License 2.0 5 votes vote down vote up
private void setupFabMenuButtons()
{
    for (int i = 0; i < buttons.length; i++) {

        buttons[i] = new Button(LandActivity.this);
        buttons[i].setLayoutParams(new RelativeLayout.LayoutParams(5, 5));
        buttons[i].setX(0);
        buttons[i].setY(0);
        buttons[i].setTag(i);
        buttons[i].setOnClickListener(this);
        buttons[i].setVisibility(View.INVISIBLE);
        buttons[i].setBackgroundResource(R.drawable.circular_background);
        buttons[i].setBackground(ResourcesCompat.getDrawable(getResources(),buttonicon[i], null));
        /*buttons[i].setTextColor(Color.WHITE);
        buttons[i].setText(String.valueOf(i + 1));
        buttons[i].setTextSize(20);*/
        ((RelativeLayout) findViewById(R.id.content_land)).addView(buttons[i]);
        buttonlabels[i]=new TextView(this);
        buttonlabels[i].setLayoutParams(new RelativeLayout.LayoutParams(5, 5));
        buttonlabels[i].setX(0);
        buttonlabels[i].setY(0);
        buttonlabels[i].setText(buttonlabel[i]);
        buttonlabels[i].setVisibility(View.INVISIBLE);
        ((RelativeLayout) findViewById(R.id.content_land)).addView(buttonlabels[i]);




    }
}