|
@@ -27,14 +27,20 @@ public class ApnManager {
|
|
|
public static List<ApnModel> getAPNList(Context context, List<ApnModel> modelList){
|
|
|
Log.d(TAG, "getAPNList: " + modelList.size());
|
|
|
List<ApnModel> list = new ArrayList<ApnModel>();
|
|
|
- ContentResolver resolver = context.getContentResolver();
|
|
|
-
|
|
|
- String[] dbList = new String[modelList.size()];
|
|
|
- for (int i = 0; i < modelList.size(); i++) {
|
|
|
- dbList[i] = modelList.get(i)._id;
|
|
|
+ for (ApnModel model: modelList) {
|
|
|
+ ApnModel apnModel = getAPNListOne(context, model._id, model.apn_id);
|
|
|
+ if (apnModel != null) {
|
|
|
+ list.add(apnModel);
|
|
|
+ }
|
|
|
}
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
+ public static ApnModel getAPNListOne(Context context, String _id, String apn_id){
|
|
|
+ List<ApnModel> list = new ArrayList<ApnModel>();
|
|
|
+ ContentResolver resolver = context.getContentResolver();
|
|
|
|
|
|
- Cursor cr = resolver.query(APN_URI, new String[]{"_id"}, "_id" + "=?", dbList, null);
|
|
|
+ Cursor cr = resolver.query(APN_URI, null, "_id =?", new String[]{ _id } , null);
|
|
|
while(cr!=null && cr.moveToNext()){
|
|
|
ApnModel a = new ApnModel();
|
|
|
a._id = getCursorColumnValue(cr,"_id");
|
|
@@ -57,17 +63,13 @@ public class ApnManager {
|
|
|
a.bearer = getCursorColumnValue(cr,"bearer");
|
|
|
a.mvno_type = getCursorColumnValue(cr,"mvno_type");
|
|
|
a.mvno_match_data = getCursorColumnValue(cr,"mvno_match_data");
|
|
|
- for (ApnModel model: modelList) {
|
|
|
- if (model._id.equals(a._id)) {
|
|
|
- a.apn_id = model.apn_id;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- list.add(a);
|
|
|
+ a.apn_id = apn_id;
|
|
|
+ cr.close();
|
|
|
+ return a;
|
|
|
}
|
|
|
if(cr!=null)
|
|
|
cr.close();
|
|
|
- return list;
|
|
|
+ return null;
|
|
|
}
|
|
|
|
|
|
public static int insertAPN(Context context, ApnModel apnModel) {
|