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);
}
});
}
Aggregations