Ejemplo n.º 1
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);
    }
  }
Ejemplo n.º 2
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    final View v = inflater.inflate(R.layout.fragment_passcode, container, false);

    tvActionBarTitle = (TextView) v.findViewById(R.id.tvActionBarTitle);
    tvActionBarTitle.setText(getString(R.string.passcode_title));
    rlActionBarItems = (RelativeLayout) v.findViewById(R.id.rlActionBarItems);
    ibHome = (ImageButton) v.findViewById(R.id.ibHome);
    rlActionBarItems.setVisibility(View.GONE);
    ibHome.setVisibility(View.GONE);

    mPreferences = getActivity().getSharedPreferences(Constant.PREFS_NAME, 0);
    btnTurnPassCode = (RelativeLayout) v.findViewById(R.id.rlTurnPassCode);
    btnTurnPassCode.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            Intent intent = new Intent(getActivity(), EnterPassCodeActivity.class);

            if (Utils.getPassCodeTurned(getActivity())) {
              intent.putExtra(Constant.ENTER_PASS_CODE_MODE, Constant.MODE_TURN_PASSCODE_OFF);
            } else {
              intent.putExtra(Constant.ENTER_PASS_CODE_MODE, Constant.MODE_SET_NEW_PASSCODE);
            }

            startActivity(intent);
          }
        });

    tvTurnPassCode = (TextView) v.findViewById(R.id.tvTurnPassCode);

    btnChangePassCode = (RelativeLayout) v.findViewById(R.id.rlChangePasscode);

    btnChangePassCode.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            Intent intent = new Intent(getActivity(), EnterPassCodeActivity.class);
            intent.putExtra(Constant.ENTER_PASS_CODE_MODE, Constant.MODE_CHANGE_PASSCODE);
            startActivity(intent);
          }
        });

    switchEraseData = (Switch) v.findViewById(R.id.switchEraseData);
    switchEraseData.setChecked(Utils.getEraseDataTurned(getActivity()));

    switchEraseData.setOnCheckedChangeListener(
        new OnCheckedChangeListener() {

          @Override
          public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            Utils.saveEraseDataTurned(getActivity(), isChecked);
          }
        });

    Utils.overrideFonts(getActivity(), v);
    Typeface typefaceRobotoBold = Utils.getTypeface(getActivity(), "fonts/roboto_bold.ttf");
    tvTurnPassCode.setTypeface(typefaceRobotoBold);
    ((TextView) v.findViewById(R.id.tvEraseData)).setTypeface(typefaceRobotoBold);
    ((TextView) v.findViewById(R.id.tvChangePasscode)).setTypeface(typefaceRobotoBold);

    return v;
  }