Search in sources :

Example 11 with SimpleHogBug

use of edu.berkeley.cs.amplab.carat.android.storage.SimpleHogBug in project carat by amplab.

the class SettingsSuggestionAdapter method acceptSetScreenTimeout.

private void acceptSetScreenTimeout(ArrayList<SimpleHogBug> result) {
    try {
        if (Settings.System.getInt(a.getApplicationContext().getContentResolver(), Settings.System.SCREEN_OFF_TIMEOUT) > 30000) {
            SimpleHogBug item = new SimpleHogBug(a.getString(R.string.shortenscreentimeout), Constants.Type.OS);
            // TODO Get expected benefit
            result.add(item);
        }
    } catch (SettingNotFoundException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}
Also used : SettingNotFoundException(android.provider.Settings.SettingNotFoundException) SimpleHogBug(edu.berkeley.cs.amplab.carat.android.storage.SimpleHogBug)

Example 12 with SimpleHogBug

use of edu.berkeley.cs.amplab.carat.android.storage.SimpleHogBug in project carat by amplab.

the class SettingsSuggestionAdapter method acceptDisableVibration.

private void acceptDisableVibration(ArrayList<SimpleHogBug> result) {
    AudioManager myAudioManager = (AudioManager) a.getApplicationContext().getSystemService(Context.AUDIO_SERVICE);
    if (myAudioManager.getVibrateSetting(1) == 1 || myAudioManager.getVibrateSetting(0) == 1) {
        SimpleHogBug item = new SimpleHogBug(a.getString(R.string.disablevibration), Constants.Type.OS);
        // TODO Get expected benefit
        result.add(item);
    }
}
Also used : AudioManager(android.media.AudioManager) SimpleHogBug(edu.berkeley.cs.amplab.carat.android.storage.SimpleHogBug)

Example 13 with SimpleHogBug

use of edu.berkeley.cs.amplab.carat.android.storage.SimpleHogBug in project carat by amplab.

the class SettingsSuggestionAdapter method acceptDisableBluetooth.

private void acceptDisableBluetooth(ArrayList<SimpleHogBug> result) {
    BluetoothAdapter myBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
    if (myBluetoothAdapter.isEnabled() == true) {
        SimpleHogBug item = new SimpleHogBug(a.getString(R.string.disablebluetooth), Constants.Type.OS);
        result.add(item);
    }
}
Also used : BluetoothAdapter(android.bluetooth.BluetoothAdapter) SimpleHogBug(edu.berkeley.cs.amplab.carat.android.storage.SimpleHogBug)

Example 14 with SimpleHogBug

use of edu.berkeley.cs.amplab.carat.android.storage.SimpleHogBug in project carat by amplab.

the class SettingsSuggestionAdapter method acceptDisableNetwork.

private void acceptDisableNetwork(ArrayList<SimpleHogBug> result) {
    if (SamplingLibrary.networkAvailable(a.getApplicationContext()) == true) {
        SimpleHogBug item = new SimpleHogBug(a.getString(R.string.disablenetwork), Constants.Type.OS);
        // TODO Get expected benefit
        result.add(item);
    }
}
Also used : SimpleHogBug(edu.berkeley.cs.amplab.carat.android.storage.SimpleHogBug)

Example 15 with SimpleHogBug

use of edu.berkeley.cs.amplab.carat.android.storage.SimpleHogBug in project carat by amplab.

the class SettingsSuggestionAdapter method acceptDimScreen.

private void acceptDimScreen(ArrayList<SimpleHogBug> result) {
    // set the screen threshold to be 50
    if (!SamplingLibrary.isAutoBrightness(a.getApplicationContext()) && SamplingLibrary.getScreenBrightness(a.getApplicationContext()) > 50) {
        SimpleHogBug item = new SimpleHogBug(a.getString(R.string.dimscreen), Constants.Type.OS);
        result.add(item);
    }
}
Also used : SimpleHogBug(edu.berkeley.cs.amplab.carat.android.storage.SimpleHogBug)

Aggregations

SimpleHogBug (edu.berkeley.cs.amplab.carat.android.storage.SimpleHogBug)23 ListView (android.widget.ListView)4 Drawable (android.graphics.drawable.Drawable)3 View (android.view.View)3 AdapterView (android.widget.AdapterView)3 OnItemClickListener (android.widget.AdapterView.OnItemClickListener)3 TextView (android.widget.TextView)3 LocalizedWebView (edu.berkeley.cs.amplab.carat.android.ui.LocalizedWebView)3 SettingNotFoundException (android.provider.Settings.SettingNotFoundException)2 Constants (edu.berkeley.cs.amplab.carat.android.Constants)2 BluetoothAdapter (android.bluetooth.BluetoothAdapter)1 SharedPreferences (android.content.SharedPreferences)1 PackageInfo (android.content.pm.PackageInfo)1 AudioManager (android.media.AudioManager)1 Bundle (android.os.Bundle)1 Fragment (android.support.v4.app.Fragment)1 LayoutInflater (android.view.LayoutInflater)1 OnClickListener (android.view.View.OnClickListener)1 ImageView (android.widget.ImageView)1 CaratApplication (edu.berkeley.cs.amplab.carat.android.CaratApplication)1