|
@@ -24,6 +24,7 @@ import com.xplora.xpsettings.Model.BaseModel;
|
|
|
import com.xplora.xpsettings.Model.IconProgressModel;
|
|
|
import com.xplora.xpsettings.R;
|
|
|
import com.xplora.xpsettings.Utils.Constant;
|
|
|
+import com.xplora.xpsettings.Utils.KeyUtils;
|
|
|
import com.xplora.xpsettings.Utils.ResUtils;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
@@ -32,6 +33,7 @@ import java.util.List;
|
|
|
public class BaseListAdapter extends ArrayAdapter<BaseModel> {
|
|
|
private Handler mHandler = null;
|
|
|
List<BaseModel> mBaseObjects = new ArrayList<>();
|
|
|
+ private KeyUtils mKeyUtils = null;
|
|
|
|
|
|
public BaseListAdapter(Context context, int textViewResourceId, List objects) {
|
|
|
super(context, textViewResourceId, objects);
|
|
@@ -80,6 +82,8 @@ public class BaseListAdapter extends ArrayAdapter<BaseModel> {
|
|
|
view = LayoutInflater.from(getContext()).inflate(R.layout.view_sure, null);
|
|
|
} else if (model.cellType == Constant.CellType.MESSAGE) {
|
|
|
view = LayoutInflater.from(getContext()).inflate(R.layout.view_message_text, null);
|
|
|
+ } else if (model.cellType == Constant.CellType.EMPTY) {
|
|
|
+ view = LayoutInflater.from(getContext()).inflate(R.layout.view_empty, null);
|
|
|
}
|
|
|
|
|
|
assert view != null;
|
|
@@ -169,15 +173,18 @@ public class BaseListAdapter extends ArrayAdapter<BaseModel> {
|
|
|
}
|
|
|
|
|
|
if (itemEdit != null) {
|
|
|
- TextWatcher watcher = new TextWatcher() {
|
|
|
+ itemEdit.setText(model.value);
|
|
|
+ itemEdit.addTextChangedListener(new TextWatcher() {
|
|
|
@Override
|
|
|
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
|
|
|
|
|
}
|
|
|
+
|
|
|
@Override
|
|
|
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
|
|
|
|
|
}
|
|
|
+
|
|
|
@Override
|
|
|
public void afterTextChanged(Editable s) {
|
|
|
if (mHandler == null)
|
|
@@ -188,8 +195,14 @@ public class BaseListAdapter extends ArrayAdapter<BaseModel> {
|
|
|
message.obj = s.toString();
|
|
|
mHandler.sendMessage(message);
|
|
|
}
|
|
|
- };
|
|
|
- itemEdit.addTextChangedListener(watcher);
|
|
|
+ });
|
|
|
+
|
|
|
+ view.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ mKeyUtils = new KeyUtils(getContext(), itemEdit);
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
return view;
|
|
@@ -198,4 +211,17 @@ public class BaseListAdapter extends ArrayAdapter<BaseModel> {
|
|
|
public void setBaseObjects(List<BaseModel> objects) {
|
|
|
mBaseObjects = objects;
|
|
|
}
|
|
|
+
|
|
|
+ public void closeKeyboard() {
|
|
|
+ if (mKeyUtils != null) {
|
|
|
+ mKeyUtils.closeKeyboard();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public boolean isKeyboardVisible() {
|
|
|
+ if (mKeyUtils != null) {
|
|
|
+ return mKeyUtils.isKeyboardVisible();
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
}
|