|
@@ -11,6 +11,7 @@ import android.widget.ListView;
|
|
|
|
|
|
import com.xplora.xpsettings.Adapter.BaseListAdapter;
|
|
|
import com.xplora.xpsettings.Adapter.ListAdapter;
|
|
|
+import com.xplora.xpsettings.Model.ApnModel;
|
|
|
import com.xplora.xpsettings.Model.BaseModel;
|
|
|
import com.xplora.xpsettings.R;
|
|
|
import com.xplora.xpsettings.DataManager;
|
|
@@ -21,7 +22,7 @@ import java.util.List;
|
|
|
|
|
|
|
|
|
public class ApnListActivity extends BaseActivity {
|
|
|
-
|
|
|
+ List<ApnModel> mApnList = new ArrayList<>();
|
|
|
@Override
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
super.onCreate(savedInstanceState);
|
|
@@ -31,15 +32,16 @@ public class ApnListActivity extends BaseActivity {
|
|
|
}
|
|
|
|
|
|
private void initData() {
|
|
|
- String photo_resolution = DataManager.getPhotoResolution();
|
|
|
- String video_resolution = DataManager.getVideoResolution();
|
|
|
- String[] stringList = getResources().getStringArray(R.array.camero_titls_array);
|
|
|
- String[] valueList = {photo_resolution, video_resolution};
|
|
|
+ mApnList = DataManager.getApnList();
|
|
|
+ String[] stringList = getResources().getStringArray(R.array.apn_titls_array);
|
|
|
|
|
|
- for (int i = 0; i < stringList.length; i++) {
|
|
|
+ for (int i = 0; i < mApnList.size(); i++) {
|
|
|
+ String apnName = mApnList.get(i).apn_name.trim();
|
|
|
+ String mcc = stringList[3] + mApnList.get(i).mcc;
|
|
|
+ String mnc = stringList[4] + mApnList.get(i).mnc;
|
|
|
BaseModel model = new BaseModel();
|
|
|
- model.title = stringList[i].trim();
|
|
|
- model.subTitle = valueList[i];
|
|
|
+ model.title = apnName;
|
|
|
+ model.subTitle = mcc + " " + mnc;
|
|
|
model.isShowArrow = true;
|
|
|
model.cellType = Constant.CellType.TITLE_SUBTITLE;
|
|
|
mDataList.add(model);
|
|
@@ -47,17 +49,23 @@ public class ApnListActivity extends BaseActivity {
|
|
|
}
|
|
|
|
|
|
private void initView() {
|
|
|
- mAdapter = new BaseListAdapter(this, 0, mDataList);
|
|
|
ListView listView = findViewById(R.id.activity_listview);
|
|
|
- listView.setAdapter(mAdapter);
|
|
|
- listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
|
|
- @Override
|
|
|
- public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
|
|
- Intent intent = new Intent(ApnListActivity.this, CameraResolutionActivity.class);
|
|
|
- intent.putExtra(Constant.INENT_VIEW_TYPE, position);
|
|
|
- startActivityForResult(intent, 0);
|
|
|
- }
|
|
|
- });
|
|
|
+ View emptyView = findViewById(R.id.empty_view);
|
|
|
+ if (mApnList.size() == 0) {
|
|
|
+ listView.setVisibility(View.GONE);
|
|
|
+ emptyView.setVisibility(View.VISIBLE);
|
|
|
+ } else {
|
|
|
+ mAdapter = new BaseListAdapter(this, 0, mDataList);
|
|
|
+ listView.setAdapter(mAdapter);
|
|
|
+ listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
|
|
+ Intent intent = new Intent(ApnListActivity.this, CameraResolutionActivity.class);
|
|
|
+ intent.putExtra(Constant.INENT_VIEW_TYPE, position);
|
|
|
+ startActivityForResult(intent, 0);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@Override
|