private void initView() { type = (RadioGroup) findViewById(R.id.rg_questiontype); topic = (TextInputLayout) findViewById(R.id.questiontopic); option_a = (TextInputLayout) findViewById(R.id.option_a); option_b = (TextInputLayout) findViewById(R.id.option_b); option_c = (TextInputLayout) findViewById(R.id.option_c); option_d = (TextInputLayout) findViewById(R.id.option_d); submit = (AppCompatButton) findViewById(R.id.submit); // choice = (AppCompatRadioButton) findViewById(R.id.type_choice); // judge = (AppCompatRadioButton) findViewById(R.id.type_judgment); hint = (AppCompatTextView) findViewById(R.id.questionimage_hint); progressBar = (CircularProgressBar) findViewById(R.id.cpb); upload = (AppCompatTextView) findViewById(R.id.upload); image = (ImageButton) findViewById(R.id.questionimage); type.setOnCheckedChangeListener(this); image.setOnClickListener(this); image.setOnLongClickListener(this); submit.setOnClickListener(this); topic.getEditText().setOnFocusChangeListener(this); option_a.getEditText().setOnFocusChangeListener(this); option_b.getEditText().setOnFocusChangeListener(this); option_c.getEditText().setOnFocusChangeListener(this); option_d.getEditText().setOnFocusChangeListener(this); topic.setHint(getString(R.string.question_titlehint)); option_a.setHint(getString(R.string.result_right)); option_b.setHint(getString(R.string.result_false)); option_c.setHint(getString(R.string.result_false)); option_d.setHint(getString(R.string.result_false)); }
@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.password_dialog_fragment, container, false); this.presenter = new EditPasswordPresenterImpl(this); this.currentPass = (EditText) v.findViewById(R.id.current_password); this.newPass = (EditText) v.findViewById(R.id.password); this.rePass = (EditText) v.findViewById(R.id.re_password); this.errorMessage = (TextView) v.findViewById(R.id.error); AppCompatButton submit = (AppCompatButton) v.findViewById(R.id.submit); ColorStateList csl = ColorStateList.valueOf(ContextCompat.getColor(getActivity(), R.color.teal)); submit.setSupportBackgroundTintList(csl); submit.setOnClickListener(this); return v; }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); yacuenta = (TextView) findViewById(R.id.link_signup); manager = new SessionManager(); yacuenta.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { Intent m = new Intent(MainActivity.this, SignUp.class); startActivity(m); } }); email = (EditText) findViewById(R.id.input_email); pass = (EditText) findViewById(R.id.input_password); ingresar = (AppCompatButton) findViewById(R.id.btn_login); // edittext input_email input_pass ingresar.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { if (!pass.getText().equals("") & !email.getText().equals("") & isValidEmail(email.getText())) { mail = email.getText().toString(); passw = pass.getText().toString(); actualizar(); } else { Toast.makeText( getApplicationContext(), "No deje ningún campo vacío\nIngrese una cuenta de correo válida", Toast.LENGTH_LONG) .show(); } } }); }
private void initUI() { firebaseAuth = FirebaseAuth.getInstance(); if (firebaseAuth.getCurrentUser() != null) { startActivity(new Intent(this, MainActivity.class)); finish(); } tilEmail = (TextInputLayout) findViewById(R.id.tilEmail); clGeneral = (CoordinatorLayout) findViewById(R.id.clGeneral); tilPassword = (TextInputLayout) findViewById(R.id.tilPassword); tieEmail = (TextInputEditText) findViewById(R.id.tieEmail); tiePassword = (TextInputEditText) findViewById(R.id.tiePassword); btnLogin = (AppCompatButton) findViewById(R.id.btnLogin); lblRecoveryPassword = (AppCompatTextView) findViewById(R.id.lblRecoveryPassword); lblCreateAccount = (AppCompatTextView) findViewById(R.id.lblCreateAccount); btnLogin.setOnClickListener(this); lblRecoveryPassword.setOnClickListener(this); lblCreateAccount.setOnClickListener(this); tieEmail.addTextChangedListener(new CustomTextWatcher(tieEmail)); tiePassword.addTextChangedListener(new CustomTextWatcher(tiePassword)); tiePassword.setOnEditorActionListener( new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_GO) { btnLogin.performClick(); return true; } return false; } }); }
@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootview = inflater.inflate(R.layout.fragment_reach_kitchen, container, false); pref = getActivity() .getSharedPreferences(getString(R.string.preference_file_key), Context.MODE_PRIVATE); editor = pref.edit(); editor.putString("state", "ReachKitchen"); editor.apply(); header = (TextView) rootview.findViewById(R.id.kitchenAddHeader); textView = (TextView) rootview.findViewById(R.id.kitchenAddText); noNetText = (TextView) rootview.findViewById(R.id.noNetText); buttonReached = (AppCompatButton) rootview.findViewById(R.id.kitchenReachedButton); progressBar = (ProgressBar) rootview.findViewById(R.id.fetchingProgressBar); Typeface font = Typeface.createFromAsset(getActivity().getAssets(), "fontawesome-webfont.ttf"); buttonReached.setTypeface(font); ColorStateList csl = new ColorStateList( new int[][] {new int[0]}, new int[] {ContextCompat.getColor(getContext(), R.color.colorAccent)}); buttonReached.setSupportBackgroundTintList(csl); noNetText.setVisibility(View.GONE); if (pref.getString(this.getString(R.string.kitchenName), null) == null) { Log.d( "shreyDebug", "empty pref " + pref.getString(this.getString(R.string.kitchenName), null)); progressBar.setVisibility(View.VISIBLE); buttonReached.setVisibility(View.GONE); header.setVisibility(View.GONE); textView.setVisibility(View.GONE); fetchKitchenAddress(); } else { kitchenName = pref.getString(this.getString(R.string.kitchenName), null); kitchenAddress = pref.getString(this.getString(R.string.kitchenAddress), null); header.setText(kitchenName); textView.setText(kitchenAddress); header.setVisibility(View.VISIBLE); textView.setVisibility(View.VISIBLE); progressBar.setVisibility(View.GONE); buttonReached.setVisibility(View.VISIBLE); } buttonReached.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { if (retry) { header.setVisibility(View.GONE); textView.setVisibility(View.GONE); buttonReached.setVisibility(View.GONE); noNetText.setVisibility(View.GONE); progressBar.setVisibility(View.VISIBLE); Runnable runnable = new Runnable() { @Override public void run() { fetchKitchenAddress(); } }; handler.postDelayed(runnable, 3000); } else { Intent intent = new Intent(getActivity(), LeaveKitchen.class); intent.putExtra("kitchenName", kitchenName); intent.putExtra("kitchenAddress", kitchenAddress); startActivity(intent); } } }); return rootview; }
@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mRootView = inflater.inflate(R.layout.fragment_script_manager, container, false); mFileNameAdapter = new ArrayAdapter<>(mContext, R.layout.custom_list_item); mFileList = new ArrayList<>(); mQueue = (ListView) mRootView.findViewById(R.id.lvQueue); mQueue.setAdapter(mFileNameAdapter); mQueue.setOnItemClickListener( new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { mFileList.remove(position); mFileNameAdapter.clear(); for (File i : mFileList) { mFileNameAdapter.add(i.getName()); } } }); if (mStartFile != null) { if (mStartFile.exists()) { if (Common.stringEndsWithArray(mStartFile.getName(), mAllowedEXT)) { addFileToQueue(mStartFile); } else { Toast.makeText(mContext, R.string.wrong_format, Toast.LENGTH_SHORT).show(); } } } AppCompatButton AddZip = (AppCompatButton) mRootView.findViewById(R.id.addZip); AddZip.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View view) { mFileChooser = new FileChooserDialog(mContext); File startFolder = new File("/"); if (mFileList.size() > 0) { startFolder = mFileList.get(mFileList.size() - 1); if (startFolder.isFile()) { startFolder = startFolder.getParentFile(); } } mFileChooser.setStartFolder(startFolder); mFileChooser.setOnFileChooseListener( new FileChooserDialog.OnFileChooseListener() { @Override public void OnFileChoose(File file) { addFileToQueue(file); } }); mFileChooser.setAllowedEXT(mAllowedEXT); mFileChooser.setBrowseUpAllowed(true); mFileChooser.setWarn(false); mFileChooser.show(); } }); AppCompatButton FlashZip = (AppCompatButton) mRootView.findViewById(R.id.bFlashZip); FlashZip.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View view) { AppCompatCheckBox cbBakSystem = (AppCompatCheckBox) mRootView.findViewById(R.id.cbBackupSystem); AppCompatCheckBox cbBakData = (AppCompatCheckBox) mRootView.findViewById(R.id.cbBackupData); AppCompatCheckBox cbBakCache = (AppCompatCheckBox) mRootView.findViewById(R.id.cbBackupCache); AppCompatCheckBox cbBakRecovery = (AppCompatCheckBox) mRootView.findViewById(R.id.cbBackupRecovery); AppCompatCheckBox cbBakBoot = (AppCompatCheckBox) mRootView.findViewById(R.id.cbBackupBoot); AppCompatCheckBox cbSkipMD5 = (AppCompatCheckBox) mRootView.findViewById(R.id.cbSkipMD5); AppCompatEditText etBakName = (AppCompatEditText) mRootView.findViewById(R.id.etBackupName); AppCompatCheckBox cbWipeCache = (AppCompatCheckBox) mRootView.findViewById(R.id.cbWipeCache); AppCompatCheckBox cbWipeDalvik = (AppCompatCheckBox) mRootView.findViewById(R.id.cbWipeDalvik); AppCompatCheckBox cbWipeData = (AppCompatCheckBox) mRootView.findViewById(R.id.cbWipeData); final StringBuilder command = new StringBuilder(); command.append("echo #####Script created by Rashr#####;"); if (cbBakBoot.isChecked() || cbBakCache.isChecked() || cbBakData.isChecked() || cbBakRecovery.isChecked() || cbBakSystem.isChecked()) { command.append("backup "); if (cbBakBoot.isChecked()) command.append("B"); if (cbBakCache.isChecked()) command.append("C"); if (cbBakData.isChecked()) command.append("D"); if (cbBakRecovery.isChecked()) command.append("R"); if (cbBakSystem.isChecked()) command.append("S"); if (cbSkipMD5.isChecked()) command.append("M"); CharSequence BackupName = etBakName.getText(); if (BackupName != null && !BackupName.equals("")) { command.append(" "); command.append(BackupName); } command.append(CMD_END); } if (cbWipeCache.isChecked()) command.append("wipe cache;"); if (cbWipeDalvik.isChecked()) command.append("wipe dalvik;"); if (cbWipeData.isChecked()) command.append("wipe data;"); for (File i : mFileList) { command.append("install "); command.append(i.getAbsolutePath()); command.append(CMD_END); } if (!command.toString().equals("")) { String commands = ""; int index = 0; for (String i : command.toString().split(CMD_END)) { if (!i.equals("")) { if (index > 0) { commands += index++ + ". " + i + "\n"; } else { index++; } } } final AlertDialog.Builder CommandsPreview = new AlertDialog.Builder(mContext); CommandsPreview.setTitle(R.string.recovery_script_review); CommandsPreview.setPositiveButton( R.string.run, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { try { for (String split : command.toString().split(";")) { if (!split.equals("")) { RashrApp.SHELL.execCommand( "echo " + split + " >> /cache/recovery/openrecoveryscript"); } } RashrApp.TOOLBOX.reboot(Toolbox.REBOOT_RECOVERY); } catch (Exception e) { e.printStackTrace(); } } }); CommandsPreview.setNegativeButton( R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) {} }); CommandsPreview.setMessage(commands); CommandsPreview.show(); } else { Toast.makeText(mContext, "No job to do :)", Toast.LENGTH_LONG).show(); } } }); return mRootView; }