~xdavidwu/saf-sftp

c9f20cecaec283c02ffd47ec69f8381bc833c89d — xdavidwu 5 years ago 547c4c9
notify root change when config changes
1 files changed, 8 insertions(+), 1 deletions(-)

M src/main/java/org/safsftp/MainActivity.java
M src/main/java/org/safsftp/MainActivity.java => src/main/java/org/safsftp/MainActivity.java +8 -1
@@ 2,14 2,20 @@ package org.safsftp;

import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.net.Uri;
import android.preference.EditTextPreference;
import android.preference.PreferenceActivity;
import android.provider.DocumentsContract;
import android.os.Bundle;

public class MainActivity extends PreferenceActivity
	implements OnSharedPreferenceChangeListener {

	private EditTextPreference hostText, portText, usernameText, passwdText;

	private void notifyRootChanges(){
		Uri uri=DocumentsContract.buildRootsUri("org.safsftp");
		getContentResolver().notifyChange(uri,null);
	}
	
	@Override
	public void onCreate(Bundle savedInstanceState) {


@@ 28,6 34,7 @@ public class MainActivity extends PreferenceActivity
	@Override
	public void onSharedPreferenceChanged(SharedPreferences settings,
			String key) {
		notifyRootChanges();
		switch(key){
		case "host":
			if (settings.getString("host", "").equals(""))