// Path: src/com/xiaomi/mitv/soundbarapp/provider/DataProvider.java
// public class DataProvider {
//     private GalaxyProvider mProvider = new GalaxyProvider();
//     public List<FirmwareVersion> listVersion(){
//         return mProvider.listVersion();
//     }
// 
//     public FirmwareVersion queryNewVersion(int localVersion){
//         return mProvider.queryNewVersion(localVersion);
//     }
// 
//     public FaqData queryFaqList(){
//         return mProvider.queryFaqList();
//     }
// 
// 
//     //check if the app run in dev mode via the config file on SDCARD
//     private boolean isInDevMode(){
//         return mProvider.isInDevMode();
//     }
// }


import android.content.Context;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.*;
import com.xiaomi.mitv.content.FirmwareVersion;
import com.xiaomi.mitv.soundbar.provider.SoundBarORM;
import com.xiaomi.mitv.soundbarapp.R;
import com.xiaomi.mitv.soundbarapp.provider.DataProvider;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
                final ViewGroup item = (ViewGroup)inflater.inflate(R.layout.upgrade_version_item, parent, false);
                ViewHolder holder = new ViewHolder();
                holder.mVersionName = (TextView)item.findViewById(R.id.version_name);
                holder.mVersionRelease = (TextView)item.findViewById(R.id.release_flag);
                holder.mVersionDesc = (TextView)mMainView.findViewById(R.id.version_desc);
                item.setTag(holder);
                convertView = item;
            }

            ViewHolder holder = (ViewHolder)convertView.getTag();
            FirmwareVersion version = mVersions.get(position);
            holder.mVersionName.setText("版本:"+version.codeName + "(" + version.code + ")");
            holder.mVersionRelease.setText(version.strFlag());
            holder.mVersion = version;
            return convertView;
        }
    }

    private class VersionLoader extends AsyncTask<Void,Void,List<FirmwareVersion>>{
        @Override
        protected void onPreExecute() {
            mMainView.findViewById(R.id.progress).setVisibility(View.VISIBLE);
            mMainView.findViewById(R.id.upgrade_execute).setVisibility(View.GONE);
            mMainView.findViewById(R.id.upgrade_version_list).setVisibility(View.GONE);
            mMainView.findViewById(R.id.version_desc).setVisibility(View.GONE);
        }

        @Override
        protected List<FirmwareVersion> doInBackground(Void... params) {
            List<FirmwareVersion> targets = new ArrayList<FirmwareVersion>();
// Path: src/com/xiaomi/mitv/soundbarapp/provider/DataProvider.java
// public class DataProvider {
//     private GalaxyProvider mProvider = new GalaxyProvider();
//     public List<FirmwareVersion> listVersion(){
//         return mProvider.listVersion();
//     }
// 
//     public FirmwareVersion queryNewVersion(int localVersion){
//         return mProvider.queryNewVersion(localVersion);
//     }
// 
//     public FaqData queryFaqList(){
//         return mProvider.queryFaqList();
//     }
// 
// 
//     //check if the app run in dev mode via the config file on SDCARD
//     private boolean isInDevMode(){
//         return mProvider.isInDevMode();
//     }
// }


// Path: src/com/xiaomi/mitv/soundbarapp/upgrade/VersionSelectFragment.java
import android.content.Context;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.*;
import com.xiaomi.mitv.content.FirmwareVersion;
import com.xiaomi.mitv.soundbar.provider.SoundBarORM;
import com.xiaomi.mitv.soundbarapp.R;
import com.xiaomi.mitv.soundbarapp.provider.DataProvider;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

                final ViewGroup item = (ViewGroup)inflater.inflate(R.layout.upgrade_version_item, parent, false);
                ViewHolder holder = new ViewHolder();
                holder.mVersionName = (TextView)item.findViewById(R.id.version_name);
                holder.mVersionRelease = (TextView)item.findViewById(R.id.release_flag);
                holder.mVersionDesc = (TextView)mMainView.findViewById(R.id.version_desc);
                item.setTag(holder);
                convertView = item;
            }

            ViewHolder holder = (ViewHolder)convertView.getTag();
            FirmwareVersion version = mVersions.get(position);
            holder.mVersionName.setText("版本:"+version.codeName + "(" + version.code + ")");
            holder.mVersionRelease.setText(version.strFlag());
            holder.mVersion = version;
            return convertView;
        }
    }

    private class VersionLoader extends AsyncTask<Void,Void,List<FirmwareVersion>>{
        @Override
        protected void onPreExecute() {
            mMainView.findViewById(R.id.progress).setVisibility(View.VISIBLE);
            mMainView.findViewById(R.id.upgrade_execute).setVisibility(View.GONE);
            mMainView.findViewById(R.id.upgrade_version_list).setVisibility(View.GONE);
            mMainView.findViewById(R.id.version_desc).setVisibility(View.GONE);
        }

        @Override
        protected List<FirmwareVersion> doInBackground(Void... params) {
            List<FirmwareVersion> targets = new ArrayList<FirmwareVersion>();
            List<FirmwareVersion> versions = new DataProvider().listVersion();