Java Code Examples for android.widget.Button

The following are top voted examples for showing how to use android.widget.Button. 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: firebase-testlab-instr-lib   File: TitleEditor.java   Source Code and License 9 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.title_editor);

    // Get the uri of the note whose title we want to edit
    mUri = getIntent().getData();

    // Get a cursor to access the note
    mCursor = managedQuery(mUri, PROJECTION, null, null, null);

    // Set up click handlers for the text field and button
    mText = (EditText) this.findViewById(R.id.title);
    mText.setOnClickListener(this);
    
    Button b = (Button) findViewById(R.id.ok);
    b.setOnClickListener(this);
}
 
Example 2
Project: GongXianSheng   File: RunwiseDialog.java   Source Code and License 7 votes vote down vote up
@Inject
public RunwiseDialog(@ActivityContext Context context) {
	super(context, R.style.CustomProgressDialog);
	setContentView(R.layout.dialog_layout);
	Window window = getWindow();
	window.getAttributes().gravity = Gravity.CENTER;
		window.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
	this.setCancelable(true);
	this.setCanceledOnTouchOutside(false);
	this.context = (TextView) this.findViewById(R.id.context);
       cancle = (Button) this.findViewById(R.id.cancle);
	okBtn = (Button) this.findViewById(R.id.ok);
	vLine = this.findViewById(R.id.vline);
	hLine = this.findViewById(R.id.hline);
	title = (TextView) this.findViewById(R.id.title);
	btnLayout = (LinearLayout) this.findViewById(R.id.dialog_btn_layout);
	setLeftBtnListener("取消",null);
}
 
Example 3
Project: GitHub   File: HWAdatper.java   Source Code and License 7 votes vote down vote up
@Override
protected void convert(BaseViewHolder viewHolder, final Wares wares) {
    SimpleDraweeView draweeView = (SimpleDraweeView) viewHolder.getView(R.id.drawee_view);
    draweeView.setImageURI(Uri.parse(wares.getImgUrl()));

    viewHolder.getTextView(R.id.text_title).setText(wares.getName());
    viewHolder.getTextView(R.id.text_price).setText("¥ "+wares.getPrice());

    Button button =viewHolder.getButton(R.id.btn_add);
    if(button !=null) {
        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                provider.put(wares);

                ToastUtils.show(context, "已添加到购物车");
            }
        });
    }

}
 
Example 4
Project: scab   File: InfoFromFacebookActivity.java   Source Code and License 7 votes vote down vote up
@Override
        public void onSuccess(com.facebook.login.LoginResult loginResult) {
            Profile facebookProfile = Profile.getCurrentProfile();
            if (facebookProfile == null) {
                String errorMsg = InfoFromFacebookActivity.this.getResources().getString(R.string.facebook_error);
                errorMsg = errorMsg + ".";
                Snackbar.make(textViewFacebookName, errorMsg, Snackbar.LENGTH_LONG).show();
                textViewFacebookName.setText(errorMsg);
            } else {
                facebookProfilePhoto.setProfileId(facebookProfile.getId());
                textViewFacebookName.setText(facebookProfile.getName());

                buttonAck.setEnabled(true);
                buttonSwitch.setVisibility(Button.VISIBLE);
            }

            // TODO: Do not store access token - it is a security issue storing this
            // TODO and appears to be of no benefit.
//                AccessToken token = loginResult.getAccessToken();
//                DataHolder data = DataHolder.getInstance(InfoFromFacebookActivity.this.getApplicationContext());
//                data.setFacebookToken(token.getToken());
//                data.persist();
        }
 
Example 5
Project: ulogger-android   File: MainActivity.java   Source Code and License 6 votes vote down vote up
/**
 * Display About dialog
 */
private void showAbout() {
    final AlertDialog dialog = showAlert(MainActivity.this,
            getString(R.string.app_name),
            R.layout.about,
            R.drawable.ic_ulogger_logo_24dp);
    final TextView versionLabel = (TextView) dialog.findViewById(R.id.about_version);
    versionLabel.setText(getString(R.string.about_version, BuildConfig.VERSION_NAME));
    final TextView descriptionLabel = (TextView) dialog.findViewById(R.id.about_description);
    final TextView description2Label = (TextView) dialog.findViewById(R.id.about_description2);
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) {
        descriptionLabel.setText(fromHtmlDepreciated(getString(R.string.about_description)));
        description2Label.setText(fromHtmlDepreciated(getString(R.string.about_description2)));
    } else {
        descriptionLabel.setText(Html.fromHtml(getString(R.string.about_description), android.text.Html.FROM_HTML_MODE_LEGACY));
        description2Label.setText(Html.fromHtml(getString(R.string.about_description2), android.text.Html.FROM_HTML_MODE_LEGACY));
    }
    final Button okButton = (Button) dialog.findViewById(R.id.about_button_ok);
    okButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            dialog.dismiss();
        }
    });
}
 
Example 6
Project: Android-Gank-Share   File: EmptyView.java   Source Code and License 6 votes vote down vote up
public EmptyView build(){
    if(parent == null)
        throw new IllegalArgumentException("No parent viewGroup");

    emptyView.view = LayoutInflater.from(parent.getContext())
            .inflate(R.layout.empty_view, parent, false);
    TextView textView = ButterKnife.findById(emptyView.view, R.id.text_empty_hint);
    textView.setText(emptyHint);
    Button button = ButterKnife.findById(emptyView.view, R.id.btn_empty_view);
    button.setText(buttonText);
    button.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if(mOnClickListener != null)
                mOnClickListener.onClick(v);
        }
    });
    parent.addView(emptyView.view);
    return emptyView;
}
 
Example 7
Project: Java-9-Programming-Blueprints   File: InstagramPreferencesFragment.java   Source Code and License 6 votes vote down vote up
private void updateUI() {
    getActivity().runOnUiThread(new Runnable() {
        @Override
        public void run() {
            final Button button = (Button) getView().findViewById(R.id.connectButton);
            if (!InstagramClient.instance().isAuthenticated()) {
                button.setText(getString(R.string.login));
                button.setOnClickListener(new LoginClickListener());
            } else {
                button.setText(getString(R.string.logout));
                button.setOnClickListener(new LogoutClickListener(button));
            }

        }
    });
}
 
Example 8
Project: Material-Calendar-View   File: RangePickerActivity.java   Source Code and License 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.range_picker_activity);

    CalendarView calendarView = (CalendarView) findViewById(R.id.calendarView);

    Button getDateButton = (Button) findViewById(R.id.getDateButton);
    getDateButton.setOnClickListener(v -> {
        for (Calendar calendar : calendarView.getSelectedDates()) {
            System.out.println(calendar.getTime().toString());

            Toast.makeText(getApplicationContext(),
                    calendar.getTime().toString(),
                    Toast.LENGTH_SHORT).show();
        }
    });
}
 
Example 9
Project: treetracker-android   File: ExitFragment.java   Source Code and License 6 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
        Bundle savedInstanceState) {
	
    View v = inflater.inflate(R.layout.fragment_exit, container, false);
    
    mSharedPreferences = getActivity().getSharedPreferences(
      	      "org.greenstand.android", Context.MODE_PRIVATE);

    Button yesBtn = (Button) v.findViewById(R.id.fragment_exit_yes);
    yesBtn.setOnClickListener(ExitFragment.this);

    Button noBtn = (Button) v.findViewById(R.id.fragment_exit_no);
    noBtn.setOnClickListener(ExitFragment.this);
    
    return v;
}
 
Example 10
Project: Nird2   File: ChangePasswordActivityTest.java   Source Code and License 6 votes vote down vote up
@Before
public void setUp() {
	MockitoAnnotations.initMocks(this);
	changePasswordActivity =
			Robolectric.setupActivity(TestChangePasswordActivity.class);
	passwordConfirmationWrapper = (TextInputLayout) changePasswordActivity
			.findViewById(R.id.new_password_confirm_wrapper);
	currentPassword = (EditText) changePasswordActivity
			.findViewById(R.id.current_password_entry);
	newPassword = (EditText) changePasswordActivity
			.findViewById(R.id.new_password_entry);
	newPasswordConfirmation = (EditText) changePasswordActivity
			.findViewById(R.id.new_password_confirm);
	strengthMeter = (StrengthMeter) changePasswordActivity
			.findViewById(R.id.strength_meter);
	changePasswordButton = (Button) changePasswordActivity
			.findViewById(R.id.change_password);
}
 
Example 11
Project: boohee_v5.6   File: BaseTimelineAdapter.java   Source Code and License 6 votes vote down vote up
protected void initDeleteButton(Button button, final Post post) {
    if (post.own) {
        button.setVisibility(0);
        button.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
                if (AccountUtils.isVisitorAccount(BaseTimelineAdapter.this.activity)) {
                    CheckAccountPopwindow.showVisitorPopWindow(BaseTimelineAdapter.this
                            .activity);
                } else {
                    BaseTimelineAdapter.this.showDeleteDialog(post);
                }
            }
        });
        return;
    }
    button.setVisibility(8);
}
 
Example 12
Project: ThunderMusic   File: OnlineSearchClearHistory.java   Source Code and License 6 votes vote down vote up
@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    setVolumeControlStream(AudioManager.STREAM_MUSIC);

    setContentView(R.layout.confirm_delete);
    getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT,
            WindowManager.LayoutParams.WRAP_CONTENT);
    activity = this;
    mPrompt = (TextView) findViewById(R.id.prompt);
    mButton = (Button) findViewById(R.id.delete);
    mButton.setOnClickListener(mButtonClicked);

    (findViewById(R.id.cancel)).setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            finish();
        }
    });

    mPrompt.setText(getString(R.string.clear_online_dialog));
}
 
Example 13
Project: LucaHome-AndroidApplication   File: DownloadYoutubeVideoTask.java   Source Code and License 6 votes vote down vote up
private void displayYoutubeIdDialog(@NonNull ArrayList<YoutubeVideoData> youtubeVideoDataList) {
    final Dialog dialog = new Dialog(_context);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.setContentView(R.layout.dialog_listview);

    TextView title = dialog.findViewById(R.id.dialog_title_text_view);
    title.setText(_context.getResources().getString(R.string.select_youtube_video));

    final YoutubeVideoListAdapter listAdapter = new YoutubeVideoListAdapter(_context, youtubeVideoDataList, dialog::dismiss);
    ListView listView = dialog.findViewById(R.id.dialog_list_view);
    listView.setAdapter(listAdapter);
    listView.setVisibility(View.VISIBLE);

    Button closeButton = dialog.findViewById(R.id.dialog_button_close);
    closeButton.setOnClickListener(view -> dialog.dismiss());

    dialog.setCancelable(true);
    dialog.show();

    Window window = dialog.getWindow();
    if (window != null) {
        window.setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.WRAP_CONTENT);
    } else {
        Logger.getInstance().Warning(TAG, "Window is null!");
    }
}
 
Example 14
Project: CIA   File: FollowersRequestAdapter.java   Source Code and License 6 votes vote down vote up
public ViewHolder(final View itemView) {
    super(itemView);

    followRequestee = (TextView) itemView.findViewById(R.id.followRequesteeName);
    approveButton = (Button) itemView.findViewById(R.id.approveButton);
    declineButton = (Button) itemView.findViewById(R.id.declineButton);

    // listens when an item is clicked
    itemView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (listener != null) {
                int position = getAdapterPosition();
                if (position != RecyclerView.NO_POSITION) {
                    listener.onItemClick(itemView, position);
                }
            }
        }
    });
}
 
Example 15
Project: GitHub   File: MockLocationsActivity.java   Source Code and License 6 votes vote down vote up
private void initViews() {
    latitudeInput = (EditText) findViewById(R.id.latitude_input);
    longitudeInput = (EditText) findViewById(R.id.longitude_input);
    mockLocationView = (TextView) findViewById(R.id.mock_location_view);
    updatedLocationView = (TextView) findViewById(R.id.updated_location_view);
    mockModeToggleButton = (ToggleButton) findViewById(R.id.toggle_button);
    setLocationButton = (Button) findViewById(R.id.set_location_button);

    mockModeToggleButton.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            setMockMode(isChecked);
            setLocationButton.setEnabled(isChecked);
        }
    });
    setLocationButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            addMockLocation();
        }
    });
}
 
Example 16
Project: IPCCommunication   File: MainActivity.java   Source Code and License 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    mTextView = (TextView) findViewById(R.id.tv_service);
    tv_state = (TextView) findViewById(R.id.tv_state);
    btnGet = (Button) findViewById(R.id.btn_getService);
    btn_bind = (Button) findViewById(R.id.btn_bind);
    btn_unbind = (Button) findViewById(R.id.btn_unbind);
    btnGet.setEnabled(false);
    tv_state.setText("  服务未绑定 ");
    mClientUtils = new ClientUtils(this);
    mClientUtils.setConnectListener(mConnectListener);
    btn_bind.setEnabled(true);
    btn_unbind.setEnabled(false);
}
 
Example 17
Project: 2017.2-codigo   File: AdicionarEstadoActivity.java   Source Code and License 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.alterar_estado);
    db = SQLEstadosHelper.getInstance(this);

    UF = (EditText) findViewById(R.id.txtUF);
    nomeEstado = (EditText) findViewById(R.id.txtNome);

    Button b = (Button) findViewById(R.id.btnInserirEstado);
    b.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            new InsereTask().execute(UF.getText().toString(), nomeEstado.getText().toString());
        }
    });
}
 
Example 18
Project: CSkin   File: MainActivity.java   Source Code and License 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_main);

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

    button.setOnClickListener(v -> {
        probar.setVisibility(View.VISIBLE);
        update();
        probar.setVisibility(View.GONE);
    });


}
 
Example 19
Project: InstaLikeView   File: MainActivity.java   Source Code and License 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    mInstaLikeView = (InstaLikeView) findViewById(R.id.insta_like_view);
    mButton = (Button) findViewById(R.id.button);

    mInstaLikeView.setLikeColor(ContextCompat.getColor(this, R.color.colorAccent));

    mButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            mInstaLikeView.start();
        }
    });
}
 
Example 20
Project: SystemUITuner2   File: SetupActivity.java   Source Code and License 6 votes vote down vote up
@Nullable
        @Override
        public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
            View view = super.onCreateView(inflater, container, savedInstanceState);
//            TextView adb_instructions = (TextView) (view != null ? view.findViewById(R.id.adb_instructions) : null);
//            if (adb_instructions != null) adb_instructions.setMovementMethod(LinkMovementMethod.getInstance());

            Button instructions = (Button) (view != null ? view.findViewById(R.id.adb_instructions_button) : null);
            if (instructions != null) instructions.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Uri uri = Uri.parse("https://developer.android.com/studio/command-line/adb.html");
                    Intent intent = new Intent(Intent.ACTION_VIEW, uri);
                    startActivity(intent);
                }
            });

            return view;
        }
 
Example 21
Project: pius1   File: MaterialDialog.java   Source Code and License 6 votes vote down vote up
/**
        * set negative button
        *
        * @param text the name of button
        */
       public void setNegativeButton(String text, final View.OnClickListener listener)
{
           Button button = new Button(mContext);
           LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
	LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
           button.setLayoutParams(params);
           button.setBackgroundResource(R.drawable.material_card);
           button.setText(text);
           button.setTextColor(Color.argb(222, 0, 0, 0));
           button.setTextSize(14);
           button.setGravity(Gravity.CENTER);
           button.setPadding(0, 0, 0, dip2px(8));
           button.setOnClickListener(listener);
           if (mButtonLayout.getChildCount() > 0)
    {
               params.setMargins(20, 0, 10, dip2px(BUTTON_BOTTOM));
               button.setLayoutParams(params);
               mButtonLayout.addView(button, 1);
           }
    else
    {
               button.setLayoutParams(params);
               mButtonLayout.addView(button);
           }
       }
 
Example 22
Project: chromium-for-android-56-debug-video   File: SadTabViewFactory.java   Source Code and License 6 votes vote down vote up
/**
 * @param context Context of the resulting Sad Tab view.
 * @param suggestionAction Action to be executed when user clicks "try these suggestions".
 * @param reloadButtonAction Action to be executed when Reload button is pressed.
 *                           (e.g., refreshing the page)
 * @return A "Sad Tab" view instance which is used in place of a crashed renderer.
 */
public static View createSadTabView(
        Context context, final OnClickListener suggestionAction,
        OnClickListener reloadButtonAction) {
    // Inflate Sad tab and initialize.
    LayoutInflater inflater = (LayoutInflater) context.getSystemService(
            Context.LAYOUT_INFLATER_SERVICE);
    View sadTabView = inflater.inflate(R.layout.sad_tab, null);

    TextView messageText = (TextView) sadTabView.findViewById(R.id.sad_tab_message);
    messageText.setText(getHelpMessage(context, suggestionAction));
    messageText.setMovementMethod(LinkMovementMethod.getInstance());

    Button reloadButton = (Button) sadTabView.findViewById(R.id.sad_tab_reload_button);
    reloadButton.setOnClickListener(reloadButtonAction);

    return sadTabView;
}
 
Example 23
Project: spinify_android   File: DialogUtils.java   Source Code and License 6 votes vote down vote up
private static void setTypeface(TypefaceHelper helper, AlertDialog alertDialog, String typefaceName, int style) {
	Button positive = alertDialog.getButton(DialogInterface.BUTTON_POSITIVE);
	Button negative = alertDialog.getButton(DialogInterface.BUTTON_NEGATIVE);
	Button neutral = alertDialog.getButton(DialogInterface.BUTTON_NEUTRAL);
	TextView message = (TextView) alertDialog.findViewById(android.R.id.message);
	if (positive != null) {
		helper.setTypeface(positive, typefaceName, style);
	}
	if (negative != null) {
		helper.setTypeface(negative, typefaceName, style);
	}
	if (neutral != null) {
		helper.setTypeface(neutral, typefaceName, style);
	}
	if (message != null) {
		helper.setTypeface(message, typefaceName, style);
	}
}
 
Example 24
Project: browser   File: ECAlertDialog.java   Source Code and License 6 votes vote down vote up
/**
 *
 */
private void initView() {
    WindowManager.LayoutParams layoutParams = getWindow().getAttributes();
    layoutParams.width = WindowManager.LayoutParams.MATCH_PARENT;
    layoutParams.height = WindowManager.LayoutParams.MATCH_PARENT;
    getWindow().setAttributes(layoutParams);
    mButtons = new ArrayList<Button>();
    Button leftBtn = (Button) findViewById(R.id.dilaog_button1);
    leftBtn.setOnClickListener(this);
    mButtons.add(leftBtn);
    Button middleBtn = (Button) findViewById(R.id.dilaog_button2);
    middleBtn.setOnClickListener(this);
    mButtons.add(middleBtn);
    Button rightBtn = (Button) findViewById(R.id.dilaog_button3);
    rightBtn.setOnClickListener(this);
    mButtons.add(rightBtn);
    mLayoutTitle = findViewById(R.id.dialog_layout_title);
    mLayoutContent = ((ViewGroup) findViewById(R.id.dialog_layout_content));
    mLayoutButton = findViewById(R.id.dialog_layout_button);
    setCancelable(true);
    setCanceledOnTouchOutside(true);
    setTitle(R.string.dialog_title_alert);
}
 
Example 25
Project: GSB-2017-Android   File: ClientsAdapter.java   Source Code and License 6 votes vote down vote up
ClientVieHolder(View itemView) {
    super(itemView);
    textView_clientName = (TextView) itemView.findViewById(R.id.textView_nomClient);
    textView_clientName_title = (TextView) itemView.findViewById(R.id.textView_nomClient_titre);
    textView_clientTelephone = (TextView) itemView.findViewById(R.id.textView_telClient);
    textView_clientTelephone_title = (TextView) itemView.findViewById(R.id.textView_telClient_titre);
    textView_clientAddresse = (TextView) itemView.findViewById(R.id.textView_adrClient);
    textView_clientAddresse_title = (TextView) itemView.findViewById(R.id.textView_adrClient_titre);
    textView_clientTitle = (TextView) itemView.findViewById(R.id.textView_titreClient);
    textView_clientTitle_title = (TextView) itemView.findViewById(R.id.textView_titreClient_titre);
    textView_clientMobile = (TextView) itemView.findViewById(R.id.textView_mobileClient);
    textView_clientMobile_title = (TextView) itemView.findViewById(R.id.textView_mobileClient_titre);
    textView_clientEmail = (TextView) itemView.findViewById(R.id.textView_emailClient);
    textView_clientEmail_title = (TextView) itemView.findViewById(R.id.textView_email_titre);
    buttonUndo = (Button) itemView.findViewById(R.id.undo_button);
    cardView_client = (CardView) itemView.findViewById(R.id.cardView_client);
    linearLayout_iconBackground = (LinearLayout) itemView.findViewById(R.id.linearLayout_iconBackground);
}
 
Example 26
Project: LocationTracking   File: CustomDialog.java   Source Code and License 6 votes vote down vote up
public static void buildSingleButtonDialog(Activity activity, String title, String message) {
    final Dialog dialog = buildDialog(activity, title, message);

    Button cancelButton = ButterKnife.findById(dialog, R.id.btn_cancel);
    cancelButton.setVisibility(View.INVISIBLE);

    Button okButton = ButterKnife.findById(dialog, R.id.btn_yes);
    okButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            dialog.dismiss();
        }
    });

    dialog.show();
}
 
Example 27
Project: HeadlineNews   File: MineMineFragment.java   Source Code and License 6 votes vote down vote up
@Override
protected void initViews() {

    /** 1、头像区域 */

    /** 2、动态粉丝区域*/

    /** 3、收藏、历史、夜间 区域*/
    Button collectBtn = (Button) findViewById(R.id.id_my_collect_btn);
    Button historyBtn = (Button) findViewById(R.id.id_my_history_btn);
    Button nightModeBtn = (Button) findViewById(R.id.id_night_mode_btn);

    CompoundDrawableUtil.changeCompoundDrawableSize(collectBtn, 1, 20);
    CompoundDrawableUtil.changeCompoundDrawableSize(historyBtn, 1, 20);
    CompoundDrawableUtil.changeCompoundDrawableSize(nightModeBtn, 1, 20);

    collectBtn.setOnClickListener(this);
    historyBtn.setOnClickListener(this);
    nightModeBtn.setOnClickListener(this);

    /** 4、cells */

}
 
Example 28
Project: NetworkStateView   File: MainActivity.java   Source Code and License 6 votes vote down vote up
private void initView() {

        networkStateView = (NetworkStateView) findViewById(R.id.nsv_state_view);

        Button bt_loading = (Button) findViewById(R.id.bt_loading);
        Button bt_error = (Button) findViewById(R.id.bt_error);
        Button bt_noNetwork = (Button) findViewById(R.id.bt_no_network);
        Button bt_empty = (Button) findViewById(R.id.bt_empty);

        bt_loading.setOnClickListener(this);
        bt_error.setOnClickListener(this);
        bt_noNetwork.setOnClickListener(this);
        bt_empty.setOnClickListener(this);

        networkStateView.setOnRefreshListener(this);
        networkStateView.showLoading();
        showSuccess();
    }
 
Example 29
Project: BBSSDK-for-Android   File: TestActivity.java   Source Code and License 6 votes vote down vote up
@Override
	protected void onCreate(@Nullable Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		MobSDK.init(this);
		setContentView(ResHelper.getLayoutRes(this, "layout_test"));
		cleverImageView = (CleverImageView) findViewById(ResHelper.getIdRes(this, "cleverImageView"));
		btnTest = (Button) findViewById(ResHelper.getIdRes(this, "btnTest"));
		btnTest.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View view) {
//                cleverImageView.setOval(false);
				cleverImageView.setBorderColor(Color.BLUE);
				cleverImageView.setBorderWidthDP(2);
				cleverImageView.setCornerRadiiDP(10, 5, 20, 30);
				cleverImageView.setImageUrl(IMAGE_URL);
			}
		});
	}
 
Example 30
Project: oma-riista-android   File: HomeViewFragment.java   Source Code and License 6 votes vote down vote up
private void updateObservationQuickButtons(final View view) {
    ObservationDatabase.getInstance().loadLatestObservationSpecimens(2, new ObservationsListener() {
        @Override
        public void onObservations(List<GameObservation> observations) {
            if (isAdded()) {
                List<Integer> latest = new ArrayList<>();
                for (GameObservation observation : observations) {
                    latest.add(observation.gameSpeciesCode);
                }

                setupQuickButtons(view.findViewById(R.id.layout_quick_observation), latest, R.string.logobservation_template, new OnQuickButtonInitListener() {
                    @Override
                    public void onInit(Button button, final Species species) {
                        button.setOnClickListener(new OnClickListener() {
                            @Override
                            public void onClick(View v) {
                                startObservationEditActivity(species);
                            }
                        });
                    }
                });
            }
        }
    });
}
 
Example 31
Project: Nird2   File: InvitationViewHolder.java   Source Code and License 5 votes vote down vote up
public InvitationViewHolder(View v) {
	super(v);

	avatar = (TextAvatarView) v.findViewById(R.id.avatarView);
	name = (TextView) v.findViewById(R.id.forumNameView);
	sharedBy = (TextView) v.findViewById(R.id.sharedByView);
	subscribed = (TextView) v.findViewById(R.id.forumSubscribedView);
	accept = (Button) v.findViewById(R.id.acceptButton);
	decline = (Button) v.findViewById(R.id.declineButton);
}
 
Example 32
Project: boohee_v5.6   File: AlertController.java   Source Code and License 5 votes vote down vote up
private void setupButtons(ViewGroup buttonPanel) {
    boolean hasButtons = false;
    int whichButtons = 0;
    this.mButtonPositive = (Button) buttonPanel.findViewById(16908313);
    this.mButtonPositive.setOnClickListener(this.mButtonHandler);
    if (TextUtils.isEmpty(this.mButtonPositiveText)) {
        this.mButtonPositive.setVisibility(8);
    } else {
        this.mButtonPositive.setText(this.mButtonPositiveText);
        this.mButtonPositive.setVisibility(0);
        whichButtons = 0 | 1;
    }
    this.mButtonNegative = (Button) buttonPanel.findViewById(16908314);
    this.mButtonNegative.setOnClickListener(this.mButtonHandler);
    if (TextUtils.isEmpty(this.mButtonNegativeText)) {
        this.mButtonNegative.setVisibility(8);
    } else {
        this.mButtonNegative.setText(this.mButtonNegativeText);
        this.mButtonNegative.setVisibility(0);
        whichButtons |= 2;
    }
    this.mButtonNeutral = (Button) buttonPanel.findViewById(16908315);
    this.mButtonNeutral.setOnClickListener(this.mButtonHandler);
    if (TextUtils.isEmpty(this.mButtonNeutralText)) {
        this.mButtonNeutral.setVisibility(8);
    } else {
        this.mButtonNeutral.setText(this.mButtonNeutralText);
        this.mButtonNeutral.setVisibility(0);
        whichButtons |= 4;
    }
    if (whichButtons != 0) {
        hasButtons = true;
    }
    if (!hasButtons) {
        buttonPanel.setVisibility(8);
    }
}
 
Example 33
Project: Android_watch_magpie   File: AddValueFragment.java   Source Code and License 5 votes vote down vote up
private void setAcceptAction(Button acceptButton, final EditText dateEditText,
                             final EditText timeEditText, final TextInputLayout... textInputLayouts) {
    acceptButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            // Validate the values
            if (!areValuesValid(dateEditText, timeEditText, textInputLayouts)) {
                return;
            }

            switch (type) {
                case GLUCOSE:
                case WEIGHT:
                    SingleValue newSingleValue = newSingleValueInstance(textInputLayouts[0], dateEditText, timeEditText);
                    // Store the new glucose measurement in the database
                    valueDAO.createValue(newSingleValue);
                    // Send it to the ListValuesFragment
                    callback.addSingleValue(newSingleValue);
                    break;
                case BLOOD_PRESSURE:
                    DoubleValue newDoubleValue = newDoubleValueInstance(dateEditText, timeEditText, textInputLayouts);
                    valueDAO.createValue(newDoubleValue);
                    callback.addDoubleValue(newDoubleValue);
                    break;
            }

            // Remove the values from the UI elements
            for (TextInputLayout textInputLayout : textInputLayouts) {
                textInputLayout.getEditText().setText("");
                textInputLayout.clearFocus();
                InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
                imm.hideSoftInputFromWindow(textInputLayout.getWindowToken(), 0);
            }
            dateEditText.setText("");
            timeEditText.setText("");
        }
    });
}
 
Example 34
Project: Sistema-de-Comercializacion-Negocios-Jhordan   File: ChangePasswordDialog.java   Source Code and License 5 votes vote down vote up
private void initViews(View v) {

        mEtOldPassword = (EditText) v.findViewById(R.id.et_old_password);
        mEtNewPassword = (EditText) v.findViewById(R.id.et_new_password);
        mTiOldPassword = (TextInputLayout) v.findViewById(R.id.ti_old_password);
        mTiNewPassword = (TextInputLayout) v.findViewById(R.id.ti_new_password);
        mTvMessage = (TextView) v.findViewById(R.id.tv_message);
        mBtChangePassword = (Button) v.findViewById(R.id.btn_change_password);
        mBtCancel = (Button) v.findViewById(R.id.btn_cancel);
        mProgressBar = (ProgressBar) v.findViewById(R.id.progress);

        mBtChangePassword.setOnClickListener(view -> changePassword());
        mBtCancel.setOnClickListener(view -> dismiss());
    }
 
Example 35
Project: XFrame   File: XLogDemoActivity.java   Source Code and License 5 votes vote down vote up
@Override
public void initView() {
    button = (Button) findViewById(R.id.button);
    button2 = (Button) findViewById(R.id.button2);
    button3 = (Button) findViewById(R.id.button3);
    button5 = (Button) findViewById(R.id.button5);
    button4 = (Button) findViewById(R.id.button4);
    textView = (TextView) findViewById(R.id.textView);
    button.setOnClickListener(this);
    button2.setOnClickListener(this);
    button3.setOnClickListener(this);
    button4.setOnClickListener(this);
    button5.setOnClickListener(this);
}
 
Example 36
Project: RxJava2-Android-Sample   File: BehaviorSubjectExampleActivity.java   Source Code and License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_example);
    btn = (Button) findViewById(R.id.btn);
    textView = (TextView) findViewById(R.id.textView);

    btn.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            doSomeWork();
        }
    });
}
 
Example 37
Project: pracler   File: FindUserActivity.java   Source Code and License 5 votes vote down vote up
private void viewInitialize()
{
    editText = (EditText) findViewById(R.id.findText);
    listView = (ListView) findViewById(R.id.listview);
    button = (Button) findViewById(R.id.commit);
    loadingbar = (AVLoadingIndicatorView) findViewById(R.id.loadingBar);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    getSupportActionBar().setTitle(getString(R.string.search_user));

}
 
Example 38
Project: Demos   File: FillBlankView.java   Source Code and License 5 votes vote down vote up
@Override
public void onClick(final View widget) {
    View view = LayoutInflater.from(context).inflate(R.layout.layout_input, null);
    final EditText etInput = (EditText) view.findViewById(R.id.et_answer);
    Button btnFillBlank = (Button) view.findViewById(R.id.btn_fill_blank);

    // 显示原有答案
    String oldAnswer = answerList.get(position);
    if (!TextUtils.isEmpty(oldAnswer)) {
        etInput.setText(oldAnswer);
        etInput.setSelection(oldAnswer.length());
    }

    final PopupWindow popupWindow = new PopupWindow(view, LayoutParams.MATCH_PARENT, dp2px(40));
    // 获取焦点
    popupWindow.setFocusable(true);
    // 为了防止弹出菜单获取焦点之后,点击Activity的其他组件没有响应
    popupWindow.setBackgroundDrawable(new PaintDrawable());
    // 设置PopupWindow在软键盘的上方
    popupWindow.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
    // 弹出PopupWindow
    popupWindow.showAtLocation(tvContent, Gravity.BOTTOM, 0, 0);

    btnFillBlank.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            // 填写答案
            String answer = etInput.getText().toString();
            fillAnswer(answer, position);
            popupWindow.dismiss();
        }
    });

    // 显示软键盘
    InputMethodManager inputMethodManager =
            (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
    inputMethodManager.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS);
}
 
Example 39
Project: polling-station-app   File: ManualInputActivity.java   Source Code and License 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 40
Project: thesis-project   File: AttendanceAddActivity.java   Source Code and License 5 votes vote down vote up
private void init() {
    linearLayoutAttendance = (LinearLayout) findViewById(add_add3);
    recyclerView = (RecyclerView) findViewById(R.id.add_recycler3);
    btnBackButton = (Button) findViewById(R.id.add_back3);

    linearLayoutAttendance.setOnClickListener(this);
    btnBackButton.setOnClickListener(this);

    progressBar = (ProgressBar) findViewById(R.id.progres_man_att);
    progressBar.setVisibility(View.VISIBLE);
}
 
Example 41
Project: DaiGo   File: OrderAdapter.java   Source Code and License 5 votes vote down vote up
public ViewHolder(View view) {
    super(view);
    btnDetail = (Button) view.findViewById(R.id.info_btn_details);
    btnAccept = (Button) view.findViewById(R.id.info_btn_accpet);
    senderHead = (CircleImageView) view.findViewById(R.id.info_ognz_head);
    senderNickName = (TextView) view.findViewById(R.id.info_ognz_nickname);
    infoTitle = (TextView) view.findViewById(R.id.info_content_title);
    infoContent = (TextView) view.findViewById(R.id.info_details);
    infoTime = (TextView) view.findViewById(R.id.info_time);
    reqeustTime = (TextView) view.findViewById(R.id.info_request_time);
    campusName = (TextView) view.findViewById(R.id.info_campus_name);
    itemBg = (ImageView) view.findViewById(R.id.info_itembg);
}
 
Example 42
Project: Mixtape   File: CoordinatedMixtapeContainerTestHarness.java   Source Code and License 5 votes vote down vote up
/**
 * Creates a button which can be clicked to clear the test view body.
 *
 * @return the button, not null
 */
private Button createUseNullBodyButton() {
	final Button b = new Button(this);
	b.setText("Clear body");
	b.setAllCaps(false);

	b.setOnClickListener(new View.OnClickListener() {
		@Override
		public void onClick(View v) {
			testView.setBody(null);
		}
	});

	return b;
}
 
Example 43
Project: buildAPKsApps   File: HomePage.java   Source Code and License 5 votes vote down vote up
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.page_home);

	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 44
Project: GroupingMessages   File: SmsListItemHolder.java   Source Code and License 5 votes vote down vote up
SmsListItemHolder(Context contextTemp, View itemView) {
    super(itemView);

    // 1. Set the context
    context = contextTemp;

    // 2. Set up the UI widgets of the holder
    smsBodyTextView = (TextView) itemView.findViewById(R.id.sms_body_textview);
    smsFromTextView = (TextView) itemView.findViewById(R.id.sms_from_textview);
    smsTimeTextView = (TextView) itemView.findViewById(R.id.sms_time_textview);
    smsCategoryButton = (Button) itemView.findViewById(R.id.bucket_button);
    listItemContent = (CardView) itemView.findViewById(R.id.sms_list_item_content);

    regularLayout = (RelativeLayout) itemView.findViewById(R.id.regularLayout);
    swipeLayout = (LinearLayout) itemView.findViewById(R.id.swipeLayout);
    undo = (TextView) itemView.findViewById(R.id.undo);

    // 3. Set the "onClick" listener of the holder
    itemView.setOnClickListener(this);
    listItemContent.setOnClickListener(this);
    smsBodyTextView.setOnClickListener(this);
}
 
Example 45
Project: androidCameraTest   File: CameraApiTest.java   Source Code and License 5 votes vote down vote up
void createSurface() {
    setContentView(R.layout.camera);
    final Button cheese = (Button) findViewById(R.id.cheese);
    surfaceView = new SurfaceView(this);
    FrameLayout preview = (FrameLayout) findViewById(R.id.camera_preview);
    preview.addView(surfaceView);
    cheese.setOnClickListener(this);
    surfaceHolder = surfaceView.getHolder();
    surfaceHolder.addCallback(this);
    surfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
}
 
Example 46
Project: buildAPKsSamples   File: SecureNoteActivity.java   Source Code and License 5 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    this.devicePolicyManager = (DevicePolicyManager) getSystemService(Context.DEVICE_POLICY_SERVICE);
    this.deviceAdminComponentName = new ComponentName(this, SecureNoteDeviceAdminReceiver.class);
    super.setContentView(R.layout.secure_note);
    this.noteText = (EditText) super.findViewById(R.id.note_text);
    this.loadButton = (Button) super.findViewById(R.id.load_button);
    this.saveButton = (Button) super.findViewById(R.id.save_button);
    this.closeButton = (Button) super.findViewById(R.id.close_button);
    this.loadButton.setOnClickListener(this);
    this.saveButton.setOnClickListener(this);
    this.closeButton.setOnClickListener(this);
    this.noteText.addTextChangedListener(this);
    this.password = savedInstanceState == null ? null : savedInstanceState
            .getString(PASSWORD_KEY);
    if (this.isDeviceAdminEnabled()) {
        if (this.noteText.length() == 0) {
            if (this.isSecureNoteFilePresent()) {
                this.saveButton.setVisibility(View.GONE);
                this.noteText.setEnabled(false);
                this.getPassword(GET_PASSWORD_FOR_LOAD, false);
            } else {
                this.loadButton.setVisibility(View.GONE);
                this.saveButton.setEnabled(false);
            }
        } else {
            this.loadButton.setVisibility(View.GONE);
        }
    }
}
 
Example 47
Project: OracionesCatolicas   File: FinFragment.java   Source Code and License 5 votes vote down vote up
@Override
public void assignments(View view) {
    btn_end = (Button) view.findViewById(R.id.btn_end);
    btn_end.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            accionBotonSiguiente();
        }
    });
}
 
Example 48
Project: device-messaging   File: MainActivity.java   Source Code and License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    mAutoText = (TextView) findViewById(R.id.help_text);
    mTextView = (TextView) findViewById(R.id.context_text);
    Button mStartButton = (Button) findViewById(R.id.start_conversation);
    mStartButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            startCountDownTimer();
        }
    });
}
 
Example 49
Project: FantaF1   File: MainActivity.java   Source Code and License 5 votes vote down vote up
public static void selectDrivers(){
    LayoutInflater inflater = a.getLayoutInflater();
    View dialoglayout = inflater.inflate(R.layout.al_select_drivers, null);
    @SuppressLint("RestrictedApi") final AlertDialog.Builder builder = new AlertDialog.Builder(new ContextThemeWrapper(context, R.style.myDialog));
    builder.setView(dialoglayout);

    setDriversIDs(dialoglayout);

    for(RelativeLayout cd: rl_dm)
        cd.setOnClickListener(new ClickListener());

    rl_dm[21].setBackgroundResource(R.drawable.ic_select_on);
    d1=Constant.driver_names[0];
    d2=Constant.driver_names[6];
    d3=Constant.driver_names[7];
    d4=Constant.driver_names[16];


    Button ok = (Button) dialoglayout.findViewById(R.id.btn_ok);
    ok.setOnClickListener(view -> confirmDrivers(d1+d2+d3+d4));

    Button canc = (Button) dialoglayout.findViewById(R.id.btn_cance);
    canc.setOnClickListener(view -> alertDialog.cancel());
    alertDialog = builder.create();
    alertDialog.setCancelable(false);
    alertDialog.show();
}
 
Example 50
Project: Android-Programming-BigNerd   File: CheatActivity.java   Source Code and License 5 votes vote down vote up
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_cheat);
    
    mAnswerIsTrue = getIntent().getBooleanExtra(EXTRA_ANSWER_IS_TRUE, false);
    mAnswerTextView = (TextView)findViewById(R.id.answer_text_view);
    mShowAnswerButton = (Button)findViewById(R.id.show_answer_button);
    
    
    mShowAnswerButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (mAnswerIsTrue) {
                mAnswerTextView.setText(R.string.true_button);
            } else {
                mAnswerTextView.setText(R.string.false_button);
            }
            setAnswerShownResult(true);

            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
                int cx = v.getWidth() / 2;
                int cy = v.getWidth() / 2;
                float radius = v.getWidth();
                Animator animator = ViewAnimationUtils.createCircularReveal(v,
                        cx, cy, radius, 0);
                animator.addListener(new AnimatorListenerAdapter() {
                    @Override
                    public void onAnimationEnd(Animator animation) {
                        super.onAnimationEnd(animation);
                        mShowAnswerButton.setVisibility(View.INVISIBLE);
                    }
                });
                animator.start();
            } else {
                v.setVisibility(View.INVISIBLE);
            }
        }
    });
}
 
Example 51
Project: CoolCloud-Weather   File: AboutApplicationActivity.java   Source Code and License 5 votes vote down vote up
@Override
public void initView() {

    setContentView(R.layout.activity_about_application);

    Toolbar toolbar = (Toolbar)findViewById(R.id.tool_bar);
    setSupportActionBar(toolbar);
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null){
        actionBar.setTitle("关于酷云");
        actionBar.setDisplayHomeAsUpEnabled(true);
    }
    github = (Button)findViewById(R.id.github);
    blog = (Button)findViewById(R.id.blog);
}
 
Example 52
Project: VR-One   File: SignInActivity.java   Source Code and License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_sign_in);

    mContentView = (RelativeLayout) findViewById(R.id.activity_sign_in);

    //getActionBar().hide();
    Window window = getWindow();
    window.setStatusBarColor(BLACK);

    mSignInButton = (SignInButton) findViewById(R.id.GoogleSignInButton);
    mSignInButton.setOnClickListener(this);

    mSkipButton = (Button) findViewById(R.id.skipSignInButton);
    mSkipButton.setOnClickListener(this);

    mSignInButton.setSize(SignInButton.SIZE_WIDE);
    mSignInButton.setColorScheme(SignInButton.COLOR_DARK);

    mGoogleApiClient = new GoogleApiClient.Builder(this)
            .enableAutoManage(this, this)
            .addApi(Auth.GOOGLE_SIGN_IN_API, mGso)
            .build();


    if(mGoogleApiClient.isConnected()) {
        Intent intent = new Intent(this, MainActivity.class);
        startActivity(intent);
    }

}
 
Example 53
Project: GCSApp   File: AddCaseActivity.java   Source Code and License 5 votes vote down vote up
public void showDialogRound(){
    AlertDialog.Builder builder = new AlertDialog.Builder(context, R.style.DialogTransBackGround);
    final AlertDialog dialog_date = builder.create();
    dialog_date.show();
    View view_dialog = LayoutInflater.from(context).inflate(R.layout.item_dialog_addcase_round, null);
    dialog_date.setContentView(view_dialog);
    LoopView loopView = (LoopView) view_dialog.findViewById(R.id.loopView);
    Button bt_yes = (Button) view_dialog.findViewById(R.id.bt_yes);
    Button bt_no = (Button) view_dialog.findViewById(R.id.bt_no);

    final ArrayList<String> list = new ArrayList<>();
    list.add("种子轮");
    list.add("天使轮");
    list.add("A轮");
    list.add("B轮");
    list.add("C轮");
    loopView.setTextSize(17);
    loopView.setInitPosition(0);
    loopView.setCenterTextColor(getResources().getColor(R.color.colorAppRed));
    loopView.setItemsVisibleCount(5);
    loopView.setItems(list);
    loopView.setListener(new OnItemSelectedListener() {
        @Override
        public void onItemSelected(int index) {
            et_add_rounds.setText(list.get(index));
        }
    });
    bt_yes.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            dialog_date.dismiss();
        }
    });
    bt_no.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            dialog_date.dismiss();
        }
    });
}
 
Example 54
Project: Linphone4Android   File: LinphoneUtils.java   Source Code and License 5 votes vote down vote up
public static void setCountry(DialPlan c, EditText dialCode, Button selectCountry, int countryCode) {
	if( c != null && dialCode != null && selectCountry != null) {
		dialCode.setText(c.getCountryCode());
		selectCountry.setText(c.getCountryName());
	} else {
		if(countryCode != -1){
			dialCode.setText("+" + countryCode);
		} else {
			dialCode.setText("+");
		}
	}
}
 
Example 55
Project: AppLock   File: UnlockActivity.java   Source Code and License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_unlock);
    final DataBase data=DataBase.getInstance(UnlockActivity.this);
    final TextInputEditText pass=(TextInputEditText) findViewById(R.id.enter_password);
    final String password=pass.getText().toString();
    Button sub=(Button) findViewById(R.id.submitbutton);
    while(count<=4) {
        sub.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (data.findPass(password) == 1) {
                    finish();
                } else {
                    Toast.makeText(UnlockActivity.this, "Wrong Password Try Again", Toast.LENGTH_LONG).show();
                    pass.setText("");
                    count++;
                    if (count == 5) {
                        Intent startMain = new Intent(Intent.ACTION_MAIN);
                        startMain.addCategory(Intent.CATEGORY_HOME);
                        startMain.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                        startActivity(startMain);
                    }
                }
            }
        });
    }
}
 
Example 56
Project: PNightMode   File: SecondAppCompatActivity.java   Source Code and License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_second_layout);

    mBtnToggleGlobalNightMode = (Button) findViewById(R.id.btn_toggle_global_night_mode);
    mBtnToggleGlobalNightMode.setOnClickListener(this);

    mBtnToggleLocalNightMode = (Button) findViewById(R.id.btn_toggle_local_night_mode);
    mBtnToggleLocalNightMode.setOnClickListener(this);
}
 
Example 57
Project: badgedtablayout   File: PlaceHolderFragment.java   Source Code and License 5 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);
    Button add = (Button) rootView.findViewById(R.id.button_add);
    Button remove = (Button) rootView.findViewById(R.id.button_remove);
    add.setOnClickListener((MainActivity) getActivity());
    remove.setOnClickListener((MainActivity) getActivity());
    return rootView;
}
 
Example 58
Project: Seconds   File: LevelOneActivity.java   Source Code and License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.level_one_activity);
    _this = this;
    btnBegin = (Button) findViewById(R.id.btn_begin);

    et1 = (EditText) findViewById(R.id.et1);
    et2 = (EditText) findViewById(R.id.et2);
    et3 = (EditText) findViewById(R.id.et3);
    et4 = (EditText) findViewById(R.id.et4);


    btnBegin.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {

            String top1= et1.getText().toString();
            String top2= et2.getText().toString();
            String top3= et3.getText().toString();
            String top4= et4.getText().toString();


            Intent intent = new Intent(_this,RecordActivity.class);
            intent.putExtra("tp1",top1);
            intent.putExtra("tp2",top2);
            intent.putExtra("tp3",top3);
            intent.putExtra("tp4",top4);
            startActivity(intent);
        }
    });
}
 
Example 59
Project: MyEyepetizer   File: SubjectActivity.java   Source Code and License 5 votes vote down vote up
private void initToolbar() {
    Button mToolbarButton = (Button) findViewById(R.id.tool_bar_button);
    mToolbarButton.setVisibility(View.GONE);
    ImageButton mSearchButton = (ImageButton) findViewById(R.id.search_button);
    mSearchButton.setVisibility(View.GONE);

    mTitleText = (TextView) findViewById(R.id.title_text);
    mTitleText.setText("");
    mTitleText.setTextSize(16);
    mTitleText.setTypeface(Typeface.createFromAsset(getAssets(), getString(R.string.DB1FontPath)));

    mToolbar = (Toolbar) findViewById(R.id.tool_bar);
    mExitButton = new ImageButton(this);
    mExitButton.setBackgroundResource(R.drawable.ic_action_back_black);
    FrameLayout frameLayout = (FrameLayout) findViewById(R.id.tool_bar_layout);
    FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(100, 120);
    params.gravity = Gravity.CENTER_VERTICAL;
    params.leftMargin = 10;
    frameLayout.addView(mExitButton, params);

    setSupportActionBar(mToolbar);
    mExitButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            finish();
        }
    });
}
 
Example 60
Project: ui-atoms-android   File: AtomCommand.java   Source Code and License 5 votes vote down vote up
@BindingAdapter(value = {"clickCommand", "commandParameter"}, requireAll = false)
public static void setAdapter(View button, AtomCommand command, Object parameter){

    Observable.OnPropertyChangedCallback pc;
    AtomCommand oldCommand = (AtomCommand)button.getTag(R.id.atomCommand);
    if(oldCommand != command) {
        if(button instanceof Button) {
            if(oldCommand!=null) {
                pc = (Observable.OnPropertyChangedCallback)
                    button.getTag(R.id.atomCommandEnabled);
                if (pc != null) {
                    oldCommand.enabled.removeOnPropertyChangedCallback(pc);
                }
            }

            pc = new Observable.OnPropertyChangedCallback() {
                @Override
                public void onPropertyChanged(Observable sender, int propertyId) {
                    ((Button)button).setEnabled(command.enabled.get());
                }
            };
            command.enabled.addOnPropertyChangedCallback(pc);
        }

        button.setTag(R.id.atomCommand, command);

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

    command.parameter.set(parameter);
}