Android Open Source - MinerStatus Options Activity






From Project

Back to project page MinerStatus.

License

The source code is released under:

Apache License

If you think the Android project MinerStatus 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 me.davidgreene.minerstatus;
/* w  w w . ja v a  2 s .  c om*/
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.RadioButton;
import android.widget.ScrollView;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.ToggleButton;

public class OptionsActivity extends AbstractMinerStatusActivity{
    
  @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.options);
        int bgColor = themeService.getTheme().getBackgroundColor();
        int color = themeService.getTheme().getTextColor();
        
        ScrollView scrollView = (ScrollView) findViewById(R.id.optionsScrollView);
        scrollView.setBackgroundColor(bgColor);
        
        TextView mtGoxToggleLabel = (TextView) findViewById(R.id.mtGoxButtonLabel);
        mtGoxToggleLabel.setTextColor(color);
        TextView themeSpinnerLabel = (TextView) findViewById(R.id.themeSpinnerLabel);
        themeSpinnerLabel.setTextColor(color);
        final ToggleButton mtGoxToggle = (ToggleButton) findViewById(R.id.mtGoxToggle);
        mtGoxToggle.setChecked(Boolean.valueOf(configService.getConfigValue("show.mtgox")));
        mtGoxToggle.setOnClickListener(new OnClickListener() {
      @Override
      public void onClick(View v) {
            if (mtGoxToggle.isChecked()) {
              configService.setConfigValue("show.mtgox", "true");
            } else {
              configService.setConfigValue("show.mtgox", "false");
            }
            Toast.makeText(OptionsActivity.this, (mtGoxToggle.isChecked()) ? "Mt. Gox Visible" : "Mt. Gox Hidden", Toast.LENGTH_SHORT).show();
      }
    });
        
      final RadioButton darkTheme = (RadioButton) findViewById(R.id.radio_dark);
      final RadioButton lightTheme = (RadioButton) findViewById(R.id.radio_light);

      String themeString = configService.getConfigValue("theme");
      
      if(themeString.equals("light")){
        lightTheme.setChecked(Boolean.TRUE);
      } else if (themeString.equals("dark")){
        darkTheme.setChecked(Boolean.TRUE);
      }
      
      darkTheme.setOnClickListener(radioListener);
      darkTheme.setTextColor(color);
      
      lightTheme.setOnClickListener(radioListener);
      lightTheme.setTextColor(color);
        
  }  
  
  private OnClickListener radioListener = new OnClickListener() {
      public void onClick(View v) {
          RadioButton rb = (RadioButton) v;
          if(rb.getText().equals("Dark Theme")){
            configService.setConfigValue("theme", "dark");
          } else if (rb.getText().equals("Light Theme")){
            configService.setConfigValue("theme", "light");
          }
      }
  };
  
}




Java Source Code List

me.davidgreene.minerstatus.AbstractMinerStatusActivity.java
me.davidgreene.minerstatus.AddMinerActivity.java
me.davidgreene.minerstatus.MainMinerActivity.java
me.davidgreene.minerstatus.MinerStatusApp.java
me.davidgreene.minerstatus.OptionsActivity.java
me.davidgreene.minerstatus.ViewMinerActivity.java
me.davidgreene.minerstatus.beans.BitpoolPool.java
me.davidgreene.minerstatus.beans.BitpoolStatus.java
me.davidgreene.minerstatus.beans.BitpoolUser.java
me.davidgreene.minerstatus.beans.BtcMine.java
me.davidgreene.minerstatus.beans.BtcguildPool.java
me.davidgreene.minerstatus.beans.BtcguildStatus.java
me.davidgreene.minerstatus.beans.BtcguildUser.java
me.davidgreene.minerstatus.beans.BtcguildWorker.java
me.davidgreene.minerstatus.beans.DeepbitStatus.java
me.davidgreene.minerstatus.beans.MtGox.java
me.davidgreene.minerstatus.beans.Result.java
me.davidgreene.minerstatus.beans.SlushStatus.java
me.davidgreene.minerstatus.beans.Status.java
me.davidgreene.minerstatus.beans.Ticker.java
me.davidgreene.minerstatus.beans.WorkerStatus.java
me.davidgreene.minerstatus.beans.Worker.java
me.davidgreene.minerstatus.service.ConfigServiceImpl.java
me.davidgreene.minerstatus.service.ConfigService.java
me.davidgreene.minerstatus.service.MinerServiceImpl.java
me.davidgreene.minerstatus.service.MinerService.java
me.davidgreene.minerstatus.service.ThemeServiceImpl.java
me.davidgreene.minerstatus.service.ThemeService.java
me.davidgreene.minerstatus.theme.DarkTheme.java
me.davidgreene.minerstatus.theme.LightTheme.java
me.davidgreene.minerstatus.theme.ThemeFactory.java
me.davidgreene.minerstatus.theme.Theme.java
me.davidgreene.minerstatus.util.AsynchMinerUpdateThread.java
me.davidgreene.minerstatus.util.DbOpenHelper.java
me.davidgreene.minerstatus.util.MinerStatusConstants.java
me.davidgreene.minerstatus.util.StatusObjectFactory.java