// Path: SimpleWeatherForecast/src/main/java/fr/tvbarthel/apps/simpleweatherforcast/model/App.java
// public class App {
// 
//     private Integer mNameResourceId;
//     private Integer mLogoResourceId;
//     private Integer mPackageNameResourceId;
// 
//     public Integer getNameResourceId() {
//         return mNameResourceId;
//     }
// 
//     public void setNameResourceId(Integer nameResourceId) {
//         mNameResourceId = nameResourceId;
//     }
// 
//     public Integer getLogoResourceId() {
//         return mLogoResourceId;
//     }
// 
//     public void setLogoResourceId(Integer logoResourceId) {
//         mLogoResourceId = logoResourceId;
//     }
// 
//     public Integer getPackageNameResourceId() {
//         return mPackageNameResourceId;
//     }
// 
//     public void setPackageNameResourceId(Integer packageNameResourceId) {
//         mPackageNameResourceId = packageNameResourceId;
//     }
// }
// 
// Path: SimpleWeatherForecast/src/main/java/fr/tvbarthel/apps/simpleweatherforcast/ui/MoreAppsAdapter.java
// public class MoreAppsAdapter extends ArrayAdapter<App> {
// 
// 
//     public MoreAppsAdapter(Context context, List<App> apps) {
//         super(context, R.layout.row_more_apps, apps);
//     }
// 
//     @Override
//     public View getView(int position, View convertView, ViewGroup parent) {
//         RelativeLayout appView = (RelativeLayout) convertView;
//         App app = getItem(position);
// 
//         if (appView == null) {
//             LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
//             appView = (RelativeLayout) inflater.inflate(R.layout.row_more_apps, parent, false);
//             ViewHolder holder = new ViewHolder();
//             holder.appName = (TextView) appView.findViewById(R.id.row_more_apps_name);
//             holder.appLogo = (ImageView) appView.findViewById(R.id.row_more_apps_logo);
//             appView.setTag(holder);
//         }
// 
//         ViewHolder holder = (ViewHolder) appView.getTag();
//         holder.appName.setText(app.getNameResourceId());
//         holder.appLogo.setImageResource(app.getLogoResourceId());
// 
//         return appView;
//     }
// 
//     private static class ViewHolder {
//         TextView appName;
//         ImageView appLogo;
//     }
// }


import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import java.util.ArrayList;
import fr.tvbarthel.apps.simpleweatherforcast.R;
import fr.tvbarthel.apps.simpleweatherforcast.model.App;
import fr.tvbarthel.apps.simpleweatherforcast.ui.MoreAppsAdapter;
        App googlyZoo = new App();
        googlyZoo.setLogoResourceId(R.drawable.ic_googly_zoo);
        googlyZoo.setNameResourceId(R.string.dialog_more_apps_googly_zoo_app_name);
        googlyZoo.setPackageNameResourceId(R.string.dialog_more_apps_googly_zoo_package_name);

        App simpleThermometer = new App();
        simpleThermometer.setLogoResourceId(R.drawable.ic_simple_thermometer);
        simpleThermometer.setNameResourceId(R.string.dialog_more_apps_simplethermometer_app_name);
        simpleThermometer.setPackageNameResourceId(R.string.dialog_more_apps_simplethermometer_package_name);

        final ArrayList<App> apps = new ArrayList<App>();
        apps.add(chaseWhisply);
        apps.add(googlyZoo);
        apps.add(simpleThermometer);

        listView.setAdapter(new MoreAppsAdapter(getActivity(), apps));
        listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                App appClicked = apps.get(position);
                launchPlayStoreDetails(getResources().getString(appClicked.getPackageNameResourceId()));
            }
        });

        return dialogBuilder.create();
    }

    private void launchPlayStoreDetails(String appPackageName) {
        try {
            startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(URI_ROOT_MARKET + appPackageName)));
// Path: SimpleWeatherForecast/src/main/java/fr/tvbarthel/apps/simpleweatherforcast/model/App.java
// public class App {
// 
//     private Integer mNameResourceId;
//     private Integer mLogoResourceId;
//     private Integer mPackageNameResourceId;
// 
//     public Integer getNameResourceId() {
//         return mNameResourceId;
//     }
// 
//     public void setNameResourceId(Integer nameResourceId) {
//         mNameResourceId = nameResourceId;
//     }
// 
//     public Integer getLogoResourceId() {
//         return mLogoResourceId;
//     }
// 
//     public void setLogoResourceId(Integer logoResourceId) {
//         mLogoResourceId = logoResourceId;
//     }
// 
//     public Integer getPackageNameResourceId() {
//         return mPackageNameResourceId;
//     }
// 
//     public void setPackageNameResourceId(Integer packageNameResourceId) {
//         mPackageNameResourceId = packageNameResourceId;
//     }
// }
// 
// Path: SimpleWeatherForecast/src/main/java/fr/tvbarthel/apps/simpleweatherforcast/ui/MoreAppsAdapter.java
// public class MoreAppsAdapter extends ArrayAdapter<App> {
// 
// 
//     public MoreAppsAdapter(Context context, List<App> apps) {
//         super(context, R.layout.row_more_apps, apps);
//     }
// 
//     @Override
//     public View getView(int position, View convertView, ViewGroup parent) {
//         RelativeLayout appView = (RelativeLayout) convertView;
//         App app = getItem(position);
// 
//         if (appView == null) {
//             LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
//             appView = (RelativeLayout) inflater.inflate(R.layout.row_more_apps, parent, false);
//             ViewHolder holder = new ViewHolder();
//             holder.appName = (TextView) appView.findViewById(R.id.row_more_apps_name);
//             holder.appLogo = (ImageView) appView.findViewById(R.id.row_more_apps_logo);
//             appView.setTag(holder);
//         }
// 
//         ViewHolder holder = (ViewHolder) appView.getTag();
//         holder.appName.setText(app.getNameResourceId());
//         holder.appLogo.setImageResource(app.getLogoResourceId());
// 
//         return appView;
//     }
// 
//     private static class ViewHolder {
//         TextView appName;
//         ImageView appLogo;
//     }
// }


// Path: SimpleWeatherForecast/src/main/java/fr/tvbarthel/apps/simpleweatherforcast/fragments/MoreAppsDialogFragment.java
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import java.util.ArrayList;
import fr.tvbarthel.apps.simpleweatherforcast.R;
import fr.tvbarthel.apps.simpleweatherforcast.model.App;
import fr.tvbarthel.apps.simpleweatherforcast.ui.MoreAppsAdapter;

        App googlyZoo = new App();
        googlyZoo.setLogoResourceId(R.drawable.ic_googly_zoo);
        googlyZoo.setNameResourceId(R.string.dialog_more_apps_googly_zoo_app_name);
        googlyZoo.setPackageNameResourceId(R.string.dialog_more_apps_googly_zoo_package_name);

        App simpleThermometer = new App();
        simpleThermometer.setLogoResourceId(R.drawable.ic_simple_thermometer);
        simpleThermometer.setNameResourceId(R.string.dialog_more_apps_simplethermometer_app_name);
        simpleThermometer.setPackageNameResourceId(R.string.dialog_more_apps_simplethermometer_package_name);

        final ArrayList<App> apps = new ArrayList<App>();
        apps.add(chaseWhisply);
        apps.add(googlyZoo);
        apps.add(simpleThermometer);

        listView.setAdapter(new MoreAppsAdapter(getActivity(), apps));
        listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                App appClicked = apps.get(position);
                launchPlayStoreDetails(getResources().getString(appClicked.getPackageNameResourceId()));
            }
        });

        return dialogBuilder.create();
    }

    private void launchPlayStoreDetails(String appPackageName) {
        try {
            startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(URI_ROOT_MARKET + appPackageName)));
        } catch (android.content.ActivityNotFoundException activityNotFoundException) {