@Override public int getSectionForPosition(int position) { SectionAndItem<T> sectionAndItem = getSectionAndItem(position); if (sectionAndItem != null && sectionAndItem.getType() != SectionAndItem.Type.ACTIVITY_CIRCLE) { return Math.max( 0, Math.min(sectionKeys.indexOf(sectionAndItem.sectionKey), sectionKeys.size() - 1)); } return 0; }
@Override public void onCreate(Bundle savedInstanceState) { c = this; preferences = PreferenceManager.getDefaultSharedPreferences(c); super.onCreate(savedInstanceState); setContentView(R.layout.gpu_sgx540); gpuCurrent = readFile(Constants.GPU_SGX540); seekGpu = (SeekBar) findViewById(R.id.seek_gpu); gpu = Arrays.asList(153, 307, 384); seekBar(gpu.size() - 1, gpu.indexOf(gpuCurrent)); /*else{ seekGpu.setEnabled(false); seekIva.setEnabled(false); TextView ns = (TextView)findViewById(R.id.not_supported); ns.setVisibility(View.VISIBLE); }*/ preferences = PreferenceManager.getDefaultSharedPreferences(getBaseContext()); curGpuTxt = (TextView) findViewById(R.id.current_gpu); maxGpuTxt = (TextView) findViewById(R.id.max_gpu); minGpuTxt = (TextView) findViewById(R.id.min_gpu); mhz = getResources().getString(R.string.mhz); current = getResources().getString(R.string.current); max = getResources().getString(R.string._max); min = getResources().getString(R.string._min); curGpuTxt.setText(current + ": " + (gpuCurrent) + mhz); maxGpuTxt.setText(max + ": " + gpu.get(2) + mhz); minGpuTxt.setText(min + ": " + gpu.get(0) + mhz); Button cancel = (Button) findViewById(R.id.cancel); cancel.setOnClickListener( new OnClickListener() { @Override public void onClick(View arg0) { finish(); } }); }