Skip to content

Commit

Permalink
only show Trojan URL when got focus
Browse files Browse the repository at this point in the history
Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
  • Loading branch information
wongsyrone committed Feb 18, 2020
1 parent 57f7876 commit 8e19071
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
15 changes: 12 additions & 3 deletions app/src/main/java/io/github/trojan_gfw/igniter/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,14 @@
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.inputmethod.EditorInfo;
import android.widget.Button;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.Switch;
import android.widget.TextView;
import android.widget.Toast;

import org.json.JSONObject;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
Expand Down Expand Up @@ -195,7 +194,6 @@ protected void onTextChanged(String before, String old, String aNew, String afte
}
});


ipv6Switch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
Expand All @@ -220,6 +218,17 @@ public boolean onLongClick(View v) {
}
});

trojanURLText.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if (!hasFocus) {
trojanURLText.setInputType(EditorInfo.TYPE_CLASS_TEXT | EditorInfo.TYPE_TEXT_VARIATION_PASSWORD);
} else {
trojanURLText.setInputType(EditorInfo.TYPE_CLASS_TEXT);
}
}
});

trojanURLText.addTextChangedListener(new TextViewListener() {
@Override
protected void onTextChanged(String before, String old, String aNew, String after) {
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
android:layout_marginBottom="12dp"
android:ems="10"
android:hint="@string/trojan_url"
android:inputType="text"
android:inputType="textPassword"
android:textSize="20sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
Expand Down

0 comments on commit 8e19071

Please sign in to comment.