@Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main_activity);

    ComboSeekBar seekBar = (ComboSeekBar) this.findViewById(R.id.ComboSeekBar);

    ArrayList<String> list = new ArrayList<String>();
    list.add("first");
    list.add("second");
    list.add("third");
    list.add("fourth");
    seekBar.setAdapter(list);
    seekBar.setVerticalTextOffset(-50);
  }
Example #2
0
  public void init() {
    account_avatar = (ImageView) findViewById(R.id.account_avatar);
    user_nickname = (TextView) findViewById(R.id.user_nickname);
    user_nickname.setText(userInfo_map.get("userName"));
    account_coin = (MyTextView) findViewById(R.id.account_coin);
    account_coin.setMaxNum(0);
    account_coin.setStart();
    account_coin_recharge = (Button) findViewById(R.id.account_coin_recharge);
    account_coin_recharge.setOnClickListener(
        new Button.OnClickListener() {

          @Override
          public void onClick(View v) {
            // TODO Auto-generated method stub
            Intent intent = new Intent(AccountActivity.this, WebInfoActivity.class);
            startActivity(intent);
          }
        });
    account_tt = (TextView) findViewById(R.id.account_tt);
    account_tt.setOnClickListener(
        new TextView.OnClickListener() {

          @Override
          public void onClick(View v) {
            // TODO Auto-generated method stub
            Intent intent = new Intent(AccountActivity.this, AccountMusicActivity.class);
            startActivity(intent);
          }
        });
    account_kk = (TextView) findViewById(R.id.account_kk);
    account_kk.setOnClickListener(
        new TextView.OnClickListener() {

          @Override
          public void onClick(View v) {
            // TODO Auto-generated method stub
            Intent intent = new Intent(AccountActivity.this, AccountVideoActivity.class);
            startActivity(intent);
          }
        });
    account_dd = (TextView) findViewById(R.id.account_dd);
    account_dd.setOnClickListener(
        new TextView.OnClickListener() {

          @Override
          public void onClick(View v) {
            // TODO Auto-generated method stub
            Intent intent = new Intent(AccountActivity.this, AccountAppActivity.class);
            Bundle bundle = new Bundle();
            bundle.putInt("resourceType", 9);
            intent.putExtras(bundle);
            startActivity(intent);
          }
        });
    account_xx = (TextView) findViewById(R.id.account_xx);
    account_xx.setOnClickListener(
        new TextView.OnClickListener() {

          @Override
          public void onClick(View v) {
            // TODO Auto-generated method stub
            Intent intent = new Intent(AccountActivity.this, AccountAppActivity.class);
            Bundle bundle = new Bundle();
            bundle.putInt("resourceType", 8);
            intent.putExtras(bundle);
            startActivity(intent);
          }
        });
    account_ww = (TextView) findViewById(R.id.account_ww);
    account_ww.setOnClickListener(
        new TextView.OnClickListener() {

          @Override
          public void onClick(View v) {
            // TODO Auto-generated method stub
            Intent intent = new Intent(AccountActivity.this, AccountAppActivity.class);
            Bundle bundle = new Bundle();
            bundle.putInt("resourceType", 10);
            intent.putExtras(bundle);
            startActivity(intent);
          }
        });
    account_back = (TextView) findViewById(R.id.account_back);
    account_back.setOnClickListener(
        new TextView.OnClickListener() {

          @Override
          public void onClick(View v) {
            // TODO Auto-generated method stub
            CommonUtils.clearHome(AccountActivity.this);
            TabMainActivity.getInstance().finish();
            finish();
          }
        });
    account_add = (TextView) findViewById(R.id.account_add);
    account_add.setOnClickListener(
        new TextView.OnClickListener() {

          @Override
          public void onClick(View v) {
            // TODO Auto-generated method stub
            CommonUtils.addHome(AccountActivity.this);
          }
        });
    account_timenum = (ComboSeekBar) findViewById(R.id.account_timenum);
    ArrayList<String> timeNums = new ArrayList<String>();
    timeNums.add("15m");
    timeNums.add("30m");
    timeNums.add("45m");
    timeNums.add("60m");
    timeNums.add("75m");
    timeNums.add("90m");
    account_timenum.setAdapter(timeNums);
    account_timenum.setColor(Color.RED);
    account_timenum.setOnSelectionListener(
        new OnSelectionListener() {

          @Override
          public void getSelection(int pos) {
            // TODO Auto-generated method stub
            pos_choice = pos;
          }
        });
    account_timenum_layout = (LinearLayout) findViewById(R.id.account_timenum_layout);
    account_timenum_commit = (Button) findViewById(R.id.account_timenum_commit);
    account_timenum_commit.setOnClickListener(
        new Button.OnClickListener() {

          @Override
          public void onClick(View v) {
            // TODO Auto-generated method stub
            account_timenum_allow_layout.setVisibility(View.VISIBLE);
            account_timenum_layout.setVisibility(View.GONE);
            CommonUtils.setTimeLimitMinute(AccountActivity.this, (pos_choice + 1) * 1);
            account_timenum_allow.setText(
                (CommonUtils.getTimeLimit(AccountActivity.this) == -1
                    ? "无限制"
                    : CommonUtils.getTimeLimit(AccountActivity.this) * 15 + "分钟"));
          }
        });
    account_timenum_allow_layout = (LinearLayout) findViewById(R.id.account_timenum_allow_layout);
    account_timenum_allow_switch = (Switch) findViewById(R.id.account_timenum_allow_switch);
    account_timenum_allow_switch.setTextOn("开启");
    account_timenum_allow_switch.setTextOff("关闭");
    account_timenum_allow_switch.setOnCheckedChangeListener(
        new OnCheckedChangeListener() {

          @Override
          public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            // TODO Auto-generated method stub
            if (isLoadOk) {
              if (isChecked) {
                CommonUtils.setTimeLimitState(AccountActivity.this, true);
              } else {
                CommonUtils.setTimeLimitState(AccountActivity.this, false);
              }
              account_timenum_allow.setText(
                  (CommonUtils.getTimeLimit(AccountActivity.this) == -1
                      ? "无限制"
                      : CommonUtils.getTimeLimit(AccountActivity.this) * 15 + "分钟"));
            }
          }
        });
    account_timenum_allow = (TextView) findViewById(R.id.account_timenum_allow);
    account_timenum_allow.setText(
        (CommonUtils.getTimeLimit(AccountActivity.this) == -1
            ? "无限制"
            : CommonUtils.getTimeLimit(AccountActivity.this) * 15 + "分钟"));
    account_timenum_allow_layout.setOnClickListener(
        new LinearLayout.OnClickListener() {

          @Override
          public void onClick(View v) {
            // TODO Auto-generated method stub
            account_timenum_allow_layout.setVisibility(View.GONE);
            account_timenum_layout.setVisibility(View.VISIBLE);
          }
        });
    account_timenum_reset = (TextView) findViewById(R.id.account_timenum_reset);
    account_timenum_reset.setOnClickListener(
        new TextView.OnClickListener() {

          @Override
          public void onClick(View v) {
            // TODO Auto-generated method stub
            new AlertDialog.Builder(AccountActivity.this)
                .setTitle("提示")
                .setMessage("您确定要重置娱乐时间上限吗?")
                .setPositiveButton(
                    "确定",
                    new DialogInterface.OnClickListener() {

                      @Override
                      public void onClick(DialogInterface dialog, int which) {
                        // TODO Auto-generated method stub
                        CommonUtils.resetLimitState(AccountActivity.this);
                      }
                    })
                .setNegativeButton(
                    "取消",
                    new DialogInterface.OnClickListener() {

                      @Override
                      public void onClick(DialogInterface dialog, int which) {
                        // TODO Auto-generated method stub

                      }
                    })
                .show();
          }
        });

    if (CommonUtils.getTimeLimit(AccountActivity.this) > 0) {
      account_timenum_allow_switch.setChecked(true);
    } else {
      account_timenum_allow_switch.setChecked(false);
    }
    if (CommonUtils.getTimeLimit(AccountActivity.this) == -1) {
      account_timenum.setSelection(0);
    } else {
      account_timenum.setSelection((CommonUtils.getTimeLimit(AccountActivity.this) - 1) / 1);
    }
  }