CopyPastor

Detecting plagiarism made easy.

Score: 0.8839325363447925; Reported for: String similarity Open both answers

Possible Plagiarism

Reposted on 2020-06-09
by CanDroid

Original Post

Original - Posted on 2020-06-09
by CanDroid



            
Present in both answers; Present only in the new answer; Present only in the old answer;

Please check this answer, if you are still looking for a complete solution about TextInputLayout Password Toggle Listener:
public class SampleActivity extends AppCompatActivity { TextInputLayout password_input_layout; TextInputEditText password_edit_text; //textInputLayoutEndIconPressed will be tracked, EndIcon is pressed and toggled or not private boolean textInputLayoutEndIconPressed; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); textInputLayoutEndIconPressed = false; password_input_layout = (TextInputLayout) findViewById(R.id.password_input_layout); password_edit_text = (TextInputEditText) findViewById(R.id.password_edit_text); password_input_layout.setEndIconOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if(!textInputLayoutEndIconPressed) textInputLayoutEndIconPressed = true; else textInputLayoutEndIconPressed = false; if(textInputLayoutEndIconPressed){ runOnUiThread(new Runnable() { @Override public void run() { //Changing Drawable file password_input_layout.setEndIconDrawable(getResources().getDrawable(R.drawable.ic_visibility_on)); //Changing TextInputEditText password text to open password_edit_text.setTransformationMethod(null); } }); }else{ runOnUiThread(new Runnable() { @Override public void run() { //Changing Drawable file password_input_layout.setEndIconDrawable(getResources().getDrawable(R.drawable.ic_visibility_off)); //Changing TextInputEditText password text to hide password_edit_text.setTransformationMethod(new PasswordTransformationMethod()); } }); } } }); } }
When you set a EndIconOnClickListener, then you need to check both TextInputEditText text status and TextInputLayout EndIcon Drawable file. So you can manage this scenario like this.
Please check this answer, if you are still looking for a complete solution about TextInputLayout Password Toggle Listener:
public class SampleActivity extends AppCompatActivity { TextInputLayout password_input_layout; TextInputEditText password_edit_text; //textInputLayoutEndIconPressed will be tracked, EndIcon is pressed and toggled or not private boolean textInputLayoutEndIconPressed; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); textInputLayoutEndIconPressed = false; password_input_layout = (TextInputLayout) findViewById(R.id.password_input_layout); password_edit_text = (TextInputEditText) findViewById(R.id.password_edit_text); password_input_layout.setEndIconOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if(!textInputLayoutEndIconPressed) textInputLayoutEndIconPressed = true; else textInputLayoutEndIconPressed = false; if(textInputLayoutEndIconPressed){ runOnUiThread(new Runnable() { @Override public void run() { //Changing Drawable file password_input_layout.setEndIconDrawable(getResources().getDrawable(R.drawable.ic_visibility_on)); //Changing TextInputEditText password text to open password_edit_text.setTransformationMethod(null); } }); }else{ runOnUiThread(new Runnable() { @Override public void run() { //Changing Drawable file password_input_layout.setEndIconDrawable(getResources().getDrawable(R.drawable.ic_visibility_off)); //Changing TextInputEditText password text to hide password_edit_text.setTransformationMethod(new PasswordTransformationMethod()); } }); } } }); } }
When you set a EndIconOnClickListener, then you need to check both TextInputEditText text status and TextInputLayout EndIcon Drawable file. So you can manage this scenario like this.

        
Present in both answers; Present only in the new answer; Present only in the old answer;