refactor
This commit is contained in:
parent
0fd59bc78d
commit
e8a5099518
|
@ -32,19 +32,6 @@ public class HiddenServicesActivity extends AppCompatActivity {
|
||||||
HSContentProvider.HiddenService.PORT,
|
HSContentProvider.HiddenService.PORT,
|
||||||
HSContentProvider.HiddenService.DOMAIN};
|
HSContentProvider.HiddenService.DOMAIN};
|
||||||
|
|
||||||
class HSObserver extends ContentObserver {
|
|
||||||
HSObserver(Handler handler) {
|
|
||||||
super(handler);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onChange(boolean selfChange) {
|
|
||||||
mAdapter.changeCursor(mCR.query(
|
|
||||||
HSContentProvider.CONTENT_URI, mProjection, null, null, null
|
|
||||||
));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
@ -106,4 +93,17 @@ public class HiddenServicesActivity extends AppCompatActivity {
|
||||||
private boolean hasPermission() {
|
private boolean hasPermission() {
|
||||||
return (checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED);
|
return (checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class HSObserver extends ContentObserver {
|
||||||
|
HSObserver(Handler handler) {
|
||||||
|
super(handler);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onChange(boolean selfChange) {
|
||||||
|
mAdapter.changeCursor(mCR.query(
|
||||||
|
HSContentProvider.CONTENT_URI, mProjection, null, null, null
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,8 +42,8 @@ public class HSDataDialog extends DialogFragment {
|
||||||
((EditText) dialog_view.findViewById(R.id.hsOnionPort)).getText().toString()
|
((EditText) dialog_view.findViewById(R.id.hsOnionPort)).getText().toString()
|
||||||
);
|
);
|
||||||
|
|
||||||
if (checkInput(localPort,onionPort)) {
|
if (checkInput(localPort, onionPort)) {
|
||||||
saveData(serverName, localPort,onionPort);
|
saveData(serverName, localPort, onionPort);
|
||||||
serviceDataDialog.dismiss();
|
serviceDataDialog.dismiss();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ public class HSDataDialog extends DialogFragment {
|
||||||
return serviceDataDialog;
|
return serviceDataDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean checkInput(Integer local, Integer remote){
|
private boolean checkInput(Integer local, Integer remote) {
|
||||||
boolean is_ok = true;
|
boolean is_ok = true;
|
||||||
Integer error_msg = 0;
|
Integer error_msg = 0;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue