Android Open Source - dttv-android Setting Activity






From Project

Back to project page dttv-android.

License

The source code is released under:

GNU General Public License

If you think the Android project dttv-android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package dttv.app;
/*from   w  ww.  j a v  a2 s .  co m*/
import dttv.app.utils.Constant;
import android.annotation.SuppressLint;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceChangeListener;
import android.preference.Preference.OnPreferenceClickListener;
import android.preference.PreferenceActivity;
import android.preference.PreferenceFragment;
import android.preference.PreferenceManager;
import android.widget.Toast;

@SuppressLint("NewApi")
public class SettingActivity extends PreferenceActivity {
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    //addPreferencesFromResource(R.xml.setting_preference);
    getFragmentManager().beginTransaction().replace(android.R.id.content,
        new MyPreferenceFragment()).commit();
  }
  
  public static class MyPreferenceFragment extends PreferenceFragment implements OnPreferenceChangeListener,OnPreferenceClickListener{
    ListPreference decode_list;
    @Override
    public void onCreate(Bundle savedInstanceState) {
      // TODO Auto-generated method stub
      super.onCreate(savedInstanceState);
      addPreferencesFromResource(R.xml.setting_preference);
      decode_list = (ListPreference)findPreference("dt_setting_decode_list");
      decode_list.setOnPreferenceChangeListener(this);
      decode_list.setOnPreferenceClickListener(this);
    }

    @Override
    public boolean onPreferenceChange(Preference preference, Object newValue) {
      // TODO Auto-generated method stub
      if(Constant.DECODE_STYLE_KEY.equals(preference.getKey())){
        
        decode_list.setSummary(newValue.toString());
        decode_list.setValue(newValue.toString());
        
        //??????????????SharedPreferences  
              SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(getActivity());
              SharedPreferences.Editor editor = settings.edit();
              editor.putString(Constant.DECODE_STYLE_KEY, newValue.toString());
              editor.commit();
      }
      return false;
    }

    @Override
    public boolean onPreferenceClick(Preference preference) {
      // TODO Auto-generated method stub
      if(Constant.DECODE_STYLE_KEY.equals(preference.getKey())){
        /*SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(getActivity());
        String result = settings.getString(Constant.DECODE_STYLE_KEY, "11");*/
        String nowValue = decode_list.getSummary().toString();
        //decode_list.setDefaultValue(nowValue);
        //Toast.makeText(getActivity(), nowValue, 1).show();
        decode_list.setValue(nowValue);
      }
      return false;
    }
  }
}




Java Source Code List

dttv.app.DtPlayer.java
dttv.app.FileBrowserActivity.java
dttv.app.FileShowActivity.java
dttv.app.IndexActivity.java
dttv.app.MainActivity.java
dttv.app.SettingActivity.java
dttv.app.VideoPlayerActivity.java
dttv.app.adapter.FileAdapter.java
dttv.app.compnent.Compnent.java
dttv.app.compnent.MethodPlayerCompnent.java
dttv.app.compnent.PopWindowCompnent.java
dttv.app.impl.ICallBack.java
dttv.app.impl.I_Async.java
dttv.app.impl.I_KeyIntercept.java
dttv.app.impl.I_OnMyKey.java
dttv.app.impl.I_PopWindow.java
dttv.app.model.Item.java
dttv.app.multithread.DataAsyncTask.java
dttv.app.utils.Constant.java
dttv.app.utils.ControlLightness.java
dttv.app.utils.FileUtil.java
dttv.app.utils.Log.java
dttv.app.utils.MultiMediaTypeUtil.java
dttv.app.utils.MusicUtils.java
dttv.app.utils.PlayerUtil.java
dttv.app.utils.SettingUtil.java
dttv.app.utils.TimesUtil.java
dttv.app.utils.VolumeUtil.java
dttv.app.view.SimpleDialog.java
dttv.app.widget.AudioUIFragment.java
dttv.app.widget.EffectWindow.java
dttv.app.widget.FilesUIFragment.java
dttv.app.widget.GlVideoView.java
dttv.app.widget.OnTouchMoveListener.java
dttv.app.widget.SlideTabsFragment.java
dttv.app.widget.VideoUIFragment.java