Search in sources :

Example 1 with AppDetailsFragment

use of edu.berkeley.cs.amplab.carat.android.subscreens.AppDetailsFragment in project carat by amplab.

the class BugsOrHogsFragment method initEnergyDetails.

private void initEnergyDetails(View root, ViewGroup container) {
    LayoutInflater inflater = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    detailPage = inflater.inflate(R.layout.graph, container);
    w = new DrawView(getActivity());
    OnClickListener detailViewer = new OnClickListener() {

        @Override
        public void onClick(View arg0) {
            SharedPreferences p = PreferenceManager.getDefaultSharedPreferences(getActivity());
            if (p != null) {
                String uuId = p.getString(CaratApplication.getRegisteredUuid(), "UNKNOWN");
                HashMap<String, String> options = new HashMap<String, String>();
                options.put("status", getActivity().getTitle().toString());
                options.put("type", isBugs ? "Bugs" : "Hogs");
                options.put("app", ((TextView) detailPage.findViewById(R.id.name)).getText() + "");
                options.put("benefit", ((TextView) detailPage.findViewById(R.id.benefit)).getText().toString().replace('±', '+'));
                ClickTracking.track(uuId, "whatnumbers", options, getActivity());
            }
        }
    };
    View moreinfo = detailPage.findViewById(R.id.jscore_info);
    moreinfo.setOnClickListener(detailViewer);
    View item = detailPage.findViewById(R.id.benefit);
    item.setClickable(true);
    item.setOnClickListener(detailViewer);
    item = detailPage.findViewById(R.id.benefit);
    item.setClickable(true);
    item.setOnClickListener(detailViewer);
    item = detailPage.findViewById(R.id.name);
    item.setClickable(true);
    item.setOnClickListener(detailViewer);
    item = detailPage.findViewById(R.id.appIcon);
    item.setClickable(true);
    item.setOnClickListener(detailViewer);
    final ListView lv = (ListView) root.findViewById(android.R.id.list);
    lv.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> a, View v, int position, long id) {
            Object o = lv.getItemAtPosition(position);
            SimpleHogBug fullObject = (SimpleHogBug) o;
            AppDetailsFragment fragment = AppDetailsFragment.getInstance(Constants.Type.BUG, fullObject, isBugs);
            CaratApplication.getMainActivity().replaceFragment(fragment, fullObject.getAppName(), false);
        }
    });
}
Also used : OnItemClickListener(android.widget.AdapterView.OnItemClickListener) SharedPreferences(android.content.SharedPreferences) HashMap(java.util.HashMap) LocalizedWebView(edu.berkeley.cs.amplab.carat.android.ui.LocalizedWebView) ImageView(android.widget.ImageView) DrawView(edu.berkeley.cs.amplab.carat.android.ui.DrawView) TextView(android.widget.TextView) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView) ListView(android.widget.ListView) LayoutInflater(android.view.LayoutInflater) DrawView(edu.berkeley.cs.amplab.carat.android.ui.DrawView) OnClickListener(android.view.View.OnClickListener) AppDetailsFragment(edu.berkeley.cs.amplab.carat.android.subscreens.AppDetailsFragment) TextView(android.widget.TextView) SimpleHogBug(edu.berkeley.cs.amplab.carat.android.storage.SimpleHogBug)

Aggregations

SharedPreferences (android.content.SharedPreferences)1 LayoutInflater (android.view.LayoutInflater)1 View (android.view.View)1 OnClickListener (android.view.View.OnClickListener)1 AdapterView (android.widget.AdapterView)1 OnItemClickListener (android.widget.AdapterView.OnItemClickListener)1 ImageView (android.widget.ImageView)1 ListView (android.widget.ListView)1 TextView (android.widget.TextView)1 SimpleHogBug (edu.berkeley.cs.amplab.carat.android.storage.SimpleHogBug)1 AppDetailsFragment (edu.berkeley.cs.amplab.carat.android.subscreens.AppDetailsFragment)1 DrawView (edu.berkeley.cs.amplab.carat.android.ui.DrawView)1 LocalizedWebView (edu.berkeley.cs.amplab.carat.android.ui.LocalizedWebView)1 HashMap (java.util.HashMap)1