package com.vackosar.searchbasedlauncher;

import android.content.SharedPreferences;
import android.widget.RadioGroup;
import android.widget.TextView;

public class AppTypeSelector implements RadioGroup.OnCheckedChangeListener {
    public static final AppsType DEFAULT_SELECTED = AppsType.normal;
    final private MainActivity mainActivity;
    private AppsType selected = DEFAULT_SELECTED;
    private final RadioGroup radioGroup;
    private final SharedPreferences sharedPreferences;
    private final ColorService colorService = new ColorService();
    private final TextView wifiButton;
    private final TextView button3;
    private final TextView bluetoothButton;

    public AppTypeSelector(MainActivity mainActivity) {
        this.mainActivity = mainActivity;
        radioGroup = (RadioGroup) mainActivity.findViewById(R.id.appListRadioGroup);
        radioGroup.setOnCheckedChangeListener(this);
        sharedPreferences = mainActivity.getApplicationContext().getSharedPreferences("preferencename", 0);
        selected = AppsType.parseOrdinal(sharedPreferences.getInt("selected", 0));
        wifiButton = (TextView) mainActivity.findViewById(R.id.wifiButton);
        button3 = (TextView) mainActivity.findViewById(R.id.bluetoothButton);
        bluetoothButton = (TextView) mainActivity.findViewById(R.id.cameraButton);
    }

    @Override
    public void onCheckedChanged(RadioGroup group, int checkedId) {
        selected = AppsType.parseViewId(checkedId);
        mainActivity.getMenuButton().toggle();
    }

    public void setInvisible() {
        colorService.setInvisible(wifiButton);
        colorService.setInvisible(button3);
        colorService.setInvisible(bluetoothButton);
    }

    public AppsType getSelected() {
        return selected;
    }

    public void save() {
        SharedPreferences.Editor editor = sharedPreferences.edit();
        editor.putInt("selected", selected.ordinal());
        editor.commit();
    }

    public void requestFocus() {
        radioGroup.requestFocus();
    }
}

@@ -115,40 +115,8 @@
 oup;
-%0Aimport android.widget.TextView;
 %0A%0Apu
@@ -453,193 +453,8 @@
 ces;
-%0A    private final ColorService colorService = new ColorService();%0A    private final TextView wifiButton;%0A    private final TextView button3;%0A    private final TextView bluetoothButton;
 %0A%0A  
@@ -886,609 +886,189 @@
     
-    wifiButton = (TextView) mainActivity.findViewById(R.id.wifiButton);%0A        button3 = (TextView) mainActivity.findViewById(R.id.bluetoothButton);%0A        bluetoothButton = (TextView) mainActivity.findViewById(R.id.cameraButton);%0A    %7D%0A%0A    @Override%0A    public void onCheckedChanged(RadioGroup group, int checkedId) %7B%0A        selected = AppsType.parseViewId(checkedId);%0A        mainActivity.getMenuButton().toggle();%0A    %7D%0A%0A    public void setInvisible() %7B%0A        colorService.setInvisible(wifiButton);%0A        colorService.setInvisible(button3);%0A        colorService.setInvisible(bluetoothButton
+%7D%0A%0A    @Override%0A    public void onCheckedChanged(RadioGroup group, int checkedId) %7B%0A        selected = AppsType.parseViewId(checkedId);%0A        mainActivity.getMenuButton().toggle(
 );%0A 

Clean up.