示例#1
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.personal);

    //////////////////
    Bitmap bm = BitmapFactory.decodeResource(this.getResources(), R.drawable.background_personal);
    BitmapDrawable bd = new BitmapDrawable(this.getResources(), bm);
    allLayout = (RelativeLayout) findViewById(R.id.layout_personal);
    allLayout.setBackgroundDrawable(bd);
    //////////////////

    btnPersonal = (Button) findViewById(R.id.btnPersonal);
    btnExpert = (Button) findViewById(R.id.btnExpert);
    btnMessage = (Button) findViewById(R.id.btnMessage);

    btnPersonal.setOnClickListener(new MyButtonOnClickListener());
    btnExpert.setOnClickListener(new MyButtonOnClickListener());
    btnMessage.setOnClickListener(new MyButtonOnClickListener());

    //////////////////
    final SlidingMenu menu = new SlidingMenu(this);
    btnDetails = (Button) findViewById(R.id.btnDetails);
    btnDetails.setOnClickListener(
        new OnClickListener() {
          public void onClick(View v) {
            menu.toggle();
          }
        });
    menu.setMode(SlidingMenu.LEFT);
    menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
    menu.setShadowWidthRes(R.dimen.shadow_width);
    menu.setShadowDrawable(R.drawable.shadow);
    menu.setBehindOffsetRes(R.dimen.slidingmenu_offset);
    menu.setBehindWidth(500);
    menu.setFadeDegree(0.35f);
    menu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);
    menu.setMenu(R.layout.sliding_detalis);
    //////////////////

    btnPersonalData = (Button) findViewById(R.id.btnPersonalData);
    btnEveryDay = (Button) findViewById(R.id.btnEveryDay);
    btnMyPlan = (Button) findViewById(R.id.btnMyPlan);
    btnMyTeacher = (Button) findViewById(R.id.btnMyTeacher);
    btnMyCollection = (Button) findViewById(R.id.btnMyCollection);
    btnMyCard = (Button) findViewById(R.id.btnMyCard);

    btnPersonalData.setOnClickListener(new MyButtonOnClickListener());
    btnEveryDay.setOnClickListener(new MyButtonOnClickListener());
    btnMyPlan.setOnClickListener(new MyButtonOnClickListener());
    btnMyTeacher.setOnClickListener(new MyButtonOnClickListener());
    btnMyCollection.setOnClickListener(new MyButtonOnClickListener());
    btnMyCard.setOnClickListener(new MyButtonOnClickListener());
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setTheme(R.style.DrawerTheme);
    // setTitle(mTitleRes);
    // set the Behind View
    setBehindContentView(R.layout.menu_scrollview);

    final ActionBar actionbar = getActionBar();
    actionbar.setDisplayShowTitleEnabled(false);
    actionbar.setDisplayHomeAsUpEnabled(true);
    getActionBar().setDisplayHomeAsUpEnabled(true);

    // customize the SlidingMenu
    sm = getSlidingMenu();
    sm.setTouchModeAbove(SlidingMenu.TOUCHMODE_MARGIN);
    sm.setMode(SlidingMenu.LEFT);
    sm.setBehindOffsetRes(R.dimen.slidingmenu_offset);
    sm.setShadowDrawable(R.drawable.shadow);
    sm.setShadowWidthRes(R.dimen.shadow_width);
    sm.setShadowWidthRes(R.dimen.shadow_width);
    sm.setFadeEnabled(true);
    sm.setFadeEnabled(true);
    sm.setFadeDegree(0.95f);
    // sm.setSecondaryMenu(R.layout.sidemenumap);
    // sm.setSecondaryShadowDrawable(R.drawable.shadowright);
    sm.setBackgroundColor(0x000000000);
    getActionBar().setDisplayHomeAsUpEnabled(true);
    getSlidingMenu()
        .setOnOpenedListener(
            new OnOpenedListener() {
              public void onOpened() {
                getSlidingMenu().invalidate();
                // mMap.setMyLocationEnabled(true);
              }
            });

    findViewById(R.id.item1).setOnClickListener(this);
    findViewById(R.id.item2).setOnClickListener(this);
    findViewById(R.id.item3).setOnClickListener(this);
    findViewById(R.id.item4).setOnClickListener(this);
    findViewById(R.id.item5).setOnClickListener(this);
    findViewById(R.id.item9).setOnClickListener(this);
    findViewById(R.id.item10).setOnClickListener(this);
    findViewById(R.id.item11).setOnClickListener(this);
    findViewById(R.id.item12).setOnClickListener(this);
    findViewById(R.id.item13).setOnClickListener(this);
  }
 @Override
 public void onCreate(Bundle savedInstanceState) {
   requestWindowFeature(Window.FEATURE_NO_TITLE);
   if (Build.VERSION.SDK_INT > 10) {
     getWindow().setFlags(0x01000000, 0x01000000);
   }
   super.onCreate(savedInstanceState);
   Bundle bundle = new Bundle();
   if (getIntent() != null) {
     Serializable serializable = getIntent().getSerializableExtra("SUBLIST");
     bundle.putSerializable("SUBLIST", serializable);
   }
   if (savedInstanceState != null) {
     weatherCitySelectFragment =
         (WeatherCitySelectFragment)
             getSupportFragmentManager()
                 .getFragment(savedInstanceState, "WeatherCitySelectFragment");
     weatherSettingFragment =
         (WeatherSettingFragment)
             getSupportFragmentManager().getFragment(savedInstanceState, "WeatherSettingFragment");
   }
   if (weatherCitySelectFragment == null) {
     weatherCitySelectFragment = WeatherCitySelectFragment.newInstance(bundle);
   }
   if (weatherSettingFragment == null) {
     weatherSettingFragment = new WeatherSettingFragment();
   }
   // set the Behind View
   setBehindContentView(R.layout.menu_frame);
   FragmentTransaction t = this.getSupportFragmentManager().beginTransaction();
   t.replace(R.id.menu_frame, weatherCitySelectFragment);
   t.commit();
   // customize the SlidingMenu
   SlidingMenu sm = getSlidingMenu();
   sm.setMode(SlidingMenu.LEFT_RIGHT);
   sm.setShadowWidthRes(R.dimen.shadow_width);
   sm.setShadowDrawable(R.drawable.shadow);
   sm.setBehindOffsetRes(R.dimen.slidingmenu_offset);
   sm.setFadeDegree(0.35f);
   sm.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
   sm.setSecondaryMenu(R.layout.menu_frame_two);
   sm.setSecondaryShadowDrawable(R.drawable.shadowright);
   getSupportFragmentManager()
       .beginTransaction()
       .replace(R.id.menu_frame_two, weatherSettingFragment)
       .commit();
 }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // set the Behind View
    setBehindContentView(R.layout.act_sliding_menu_frame);
    FragmentTransaction t = this.getSupportFragmentManager().beginTransaction();
    mFrag = new SampleListFragment();
    t.replace(R.id.sliding_menu_frame, mFrag);
    t.commit();

    // customize the SlidingMenu
    SlidingMenu sm = getSlidingMenu();
    sm.setShadowWidthRes(R.dimen.shadow_width);
    sm.setShadowDrawable(R.drawable.shadow);
    sm.setBehindOffsetRes(R.dimen.slidingmenu_offset);
    sm.setFadeDegree(0.35f);
    sm.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
  }
示例#5
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    setTitle(getString(R.string.notification));
    // 使actionbar上的logo可以点击
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
      getSupportActionBar().setHomeButtonEnabled(true);
      getSupportActionBar()
          .setBackgroundDrawable(getResources().getDrawable(R.drawable.actionbar_bg));
    }

    // set the Above View
    if (savedInstanceState != null)
      mContent = getSupportFragmentManager().getFragment(savedInstanceState, "mContent");
    if (mContent == null) {
      mContent = new NotificationFragment();
    }

    // set the Above View
    setContentView(R.layout.content_frame);
    getSupportFragmentManager().beginTransaction().replace(R.id.content_frame, mContent).commit();

    // set the Behind View
    setBehindContentView(R.layout.menu_frame);
    getSupportFragmentManager()
        .beginTransaction()
        .replace(R.id.menu_frame, new MenuFragment())
        .commit();

    // customize the SlidingMenu
    SlidingMenu sm = getSlidingMenu();
    sm.setShadowWidthRes(R.dimen.shadow_width);
    sm.setShadowDrawable(R.drawable.shadow);
    sm.setBehindOffsetRes(R.dimen.slidingmenu_offset);
    sm.setFadeDegree(0.35f);
    sm.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
    // 设置menu动画
    //		setSlidingActionBarEnabled(true);
    //		sm.setBehindScrollScale(0.0f);
    //		sm.setBehindCanvasTransformer(mTransformer);
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.create_layout);
    // ActionBar gets initiated
    actionBar = getSupportActionBar();
    actionBar = getSupportActionBar();
    actionBar.setDisplayShowHomeEnabled(true);
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setTitle("Compose");
    myDataBase = new TaskDataBaseSQL(this);

    drawer = new SlidingMenu(this);
    drawer.setMode(SlidingMenu.LEFT);
    drawer.setShadowDrawable(R.drawable.shadow);
    drawer.setShadowWidthRes(R.dimen.shadow_width);
    drawer.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
    drawer.setFadeDegree(0.35f);
    drawer.setBehindOffsetRes(R.dimen.slidingmenu_offset);
    drawer.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);
    drawer.offsetTopAndBottom(25);
    drawer.setMenu(R.layout.alarmslidingmenu);
    drawer.setSlidingEnabled(false);
    positionOftaskToEdit = -1;
    initilizeViewVariables();
    coder = new Geocoder(this);
    myGPSManager = new TaskGPSManager(this);
    myalarmmanager = new MyAlarmManager(this);
    timepicker.setCurrentHour(myalarmmanager.getHourOfDay());

    if (getIntent().hasExtra("ob")) {
      positionOftaskToEdit = getIntent().getIntExtra("ob", 0);
      taskBeforeEdit = TaskList.getTasksList().get(positionOftaskToEdit);
      initilizeViewForExistingTask();
      actionBar.setTitle("Edit");
      Log.d(getClass().getSimpleName(), "Editing A Task" + "id: " + taskBeforeEdit.getTaskId());
    } else {
      initilizeForNewTask();
      Log.d(getClass().getSimpleName(), "Creating New Task");
    }
  }
示例#7
0
  @Override
  protected void onCreate(Bundle arg0) {
    // TODO Auto-generated method stub
    super.onCreate(arg0);
    setContentView(R.layout.calendar_activity);
    mGlobalData = (GlobalData) getApplicationContext();

    this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
    intiliazeTop();
    intiliaze();
    view = Calender.this.getLayoutInflater().inflate(R.layout.left_slide, null);
    menu = new SlidingMenu(this);
    menu.setMode(SlidingMenu.LEFT);
    menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
    menu.setBehindOffsetRes(R.dimen.sliding_limit);
    // menu.setFadeDegree(0.35f);
    menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
    menu.setMenu(view);

    menu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);
    intilazeleft(view);
  }
示例#8
0
  private void configSlidingMenu(boolean phone) {
    SlidingMenu slidingMenu = getSlidingMenu();
    slidingMenu.setShadowWidthRes(R.dimen.shadow_width);
    slidingMenu.setShadowDrawable(R.drawable.shadow_slidingmenu);
    if (phone) {
      slidingMenu.setBehindOffsetRes(R.dimen.slidingmenu_offset);
    } else {
      slidingMenu.setBehindOffset(Utility.getScreenWidth());
    }

    slidingMenu.setFadeDegree(0.35f);
    slidingMenu.setOnPageScrollListener(
        new SlidingMenu.OnPageScrollListener() {
          @Override
          public void onPageScroll() {
            LongClickableLinkMovementMethod.getInstance().setLongClickable(false);
            (getFriendsTimeLineFragment()).clearActionMode();
            (getFavFragment()).clearActionMode();
            (getCommentsTimeLineFragment()).clearActionMode();
            (getMentionsTimeLineFragment()).clearActionMode();
            (getMyProfileFragment()).clearActionMode();

            if (GlobalContext.getInstance().getAccountBean().isBlack_magic()) {
              (getSearchFragment()).clearActionMode();
              (getDMFragment()).clearActionMode();
            }
          }
        });

    slidingMenu.setOnClosedListener(
        new SlidingMenu.OnClosedListener() {
          @Override
          public void onClosed() {
            LongClickableLinkMovementMethod.getInstance().setLongClickable(true);
            LocalBroadcastManager.getInstance(MainTimeLineActivity.this)
                .sendBroadcast(new Intent(AppEventAction.SLIDING_MENU_CLOSED_BROADCAST));
          }
        });
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    init = false;

    ActionBar actionBar = getSupportActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);

    setBehindContentView(R.layout.menu_frame);
    getSupportFragmentManager()
        .beginTransaction()
        .replace(R.id.menu_frame, new MenuFragment())
        .commit();

    // customize the SlidingMenu
    SlidingMenu sm = getSlidingMenu();
    sm.setShadowWidthRes(R.dimen.shadow_width);
    sm.setShadowDrawable(R.drawable.shadow);
    sm.setBehindOffsetRes(R.dimen.slidingmenu_offset);
    sm.setFadeDegree(0.35f);
    sm.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);

    setContentView(R.layout.activity_main);

    downloadView = findViewById(R.id.DownloadView);
    progressBar = (ProgressBar) findViewById(R.id.ProgressBar);
    progressMessageTextView = (TextView) findViewById(R.id.ProgressTextView);

    SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
    boolean alwaysTurnOnScreen =
        preferences.getBoolean(getString(R.string.preference_always_turn_on_key), true);
    if (alwaysTurnOnScreen) {
      getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    } else {
      getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    }
  }
示例#10
0
  private void setUpViews() {

    setContentView(R.layout.activity_base_assembly);
    activityContentLayout = (LinearLayout) findViewById(R.id.activity_content);
    errorMessageView = (TextView) findViewById(R.id.error_not_logged_in);

    menu = new SlidingMenu(this);
    menu.setMode(SlidingMenu.LEFT);
    menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
    menu.setShadowWidthRes(R.dimen.shadow_width);
    menu.setShadowDrawable(R.drawable.shadow);
    menu.setBehindOffsetRes(R.dimen.slidingmenu_offset);
    menu.setFadeDegree(0.35f);
    menu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);
    menu.setMenu(R.layout.slidebar);

    mInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    mInflater.inflate(resLayout, activityContentLayout);

    menuAdapter = new MenuListAdapter(this);
    menuListView = (ListView) findViewById(R.id.sidebar_list);
    menuListView.setAdapter(menuAdapter);
    menuListView.setOnItemClickListener(
        new OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
            MenuListItem item = (MenuListItem) arg1;
            item.getItem().getAction().run();
          }
        });

    menuListView.setOnItemLongClickListener(
        new OnItemLongClickListener() {
          @Override
          public boolean onItemLongClick(AdapterView<?> arg0, View view, int arg2, long arg3) {
            MenuListItem item = (MenuListItem) view;
            OnLongClickListener longClickAction = item.getItem().getLongClickAction();
            if (longClickAction != null) {
              item.getItem().getLongClickAction().onLongClick(view);
            }
            return true;
          }
        });

    loginItem = menuAdapter.getLoginItem();
    loginItem.setAction(
        new Runnable() {
          @Override
          public void run() {
            if (loggedIn) {
              showUserProfile();
            } else {
              authorizeUser();
            }
          }
        });

    loginItem.setLongClickAction(
        new OnLongClickListener() {
          @SuppressLint("NewApi")
          @Override
          public boolean onLongClick(View view) {
            if (loggedIn) {
              if (app.isSupportsHoneyComb()) {
                showProfilePopup(view);
              } else {
                showProfileDialog();
              }
              return true;
            } else {
              return false;
            }
          }
        });
  }
示例#11
0
  @Override
  public void onClick(View v) {
    // TODO Auto-generated method stub
    switch (v.getId()) {
      case R.id.previous:
        if (month.get(Calendar.MONTH) == month.getActualMinimum(Calendar.MONTH)) {
          month.set((month.get(Calendar.YEAR) - 1), month.getActualMaximum(Calendar.MONTH), 1);
        } else {
          month.set(Calendar.MONTH, month.get(Calendar.MONTH) - 1);
        }
        refreshCalendar();
        break;

      case R.id.wall:
        if (menu != null) {
          menu.toggle();
        }

        Intent i = new Intent(Calender.this, Home.class);
        Calender.this.finish();
        startActivity(i);
        break;

      case R.id.servicelist:
        if (menu != null) {
          menu.toggle();
        }

        Intent service = new Intent(Calender.this, Servicelist.class);
        Calender.this.finish();
        startActivity(service);
        break;

      case R.id.next:
        if (month.get(Calendar.MONTH) == month.getActualMaximum(Calendar.MONTH)) {
          month.set((month.get(Calendar.YEAR) + 1), month.getActualMinimum(Calendar.MONTH), 1);
        } else {
          month.set(Calendar.MONTH, month.get(Calendar.MONTH) + 1);
        }
        refreshCalendar();
        break;

      case R.id.backButton:
        break;

      case R.id.rightButton:
        if (menu1 == null) {
          System.out.println("inside view null");
          view1 = Calender.this.getLayoutInflater().inflate(R.layout.addanappointment, null);
          menu1 = new SlidingMenu(this);
          menu1.setMode(SlidingMenu.RIGHT);
          menu1.setTouchModeAbove(SlidingMenu.TOUCHMODE_NONE);
          menu1.setBehindOffsetRes(R.dimen.sliding_limit);
          menu1.setMenu(view1);
          menu1.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);
          menu1.toggle();
          intiliazeright(view1);
        } else {

          System.out.println("inside view not null");
          menu1.toggle();
          try {
            fname.setText("");
          } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
          }
          try {
            lname.setText("");
          } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
          }
          try {
            adult_counter.setText("1");
            child_counter.setText("0");
          } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
          }
        }
        break;

      case R.id.scheduletime:
        Calendar calender = Calendar.getInstance();
        DatePickerDialog datePicker =
            new DatePickerDialog(
                Calender.this,
                new MyDateListener(),
                calender.get(Calendar.YEAR),
                calender.get(Calendar.MONTH),
                calender.get(Calendar.DAY_OF_MONTH));

        datePicker.show();
        break;

      case R.id.adult_plus:
        counter_adult = counter_adult + 1;
        Log.e("add counter", Integer.toString(counter_adult));
        adult_counter.setText(Integer.toString(counter_adult));

        break;
      case R.id.adult_minus:
        if (counter_adult == 0) {
          // adult_counter.setText(Integer.toString(counter_adult));
        } else {
          counter_adult = counter_adult - 1;
          Log.e("add counter", Integer.toString(counter_adult));
          adult_counter.setText(Integer.toString(counter_adult));
        }
        break;

      case R.id.child_plus:
        counter_child = counter_child + 1;
        child_counter.setText(Integer.toString(counter_child));
        break;

      case R.id.child_minus:
        if (counter_child == 0) {

        } else {
          counter_child = counter_child - 1;
          child_counter.setText(Integer.toString(counter_child));
        }
        break;

      case R.id.edit_save:
        if (menu1 != null) {
          menu1.toggle();
        }
        break;

      default:
        break;
    }
  }
示例#12
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    Leg.i(TAG, "onCreate()================================");
    super.onCreate(savedInstanceState);

    if (!isPortrait()) {
      // requestWindowFeature(Window.FEATURE_NO_TITLE);
      updateFullscreenStatus(true);
    }
    setContentView(R.layout.activity_player);

    mMediaRouter = (MediaRouter) getSystemService(Context.MEDIA_ROUTER_SERVICE);
    mDisplayManager = (DisplayManager) getSystemService(Context.DISPLAY_SERVICE);

    mContentView = getWindow().getDecorView().findViewById(android.R.id.content);
    mBackgroundImage = (ImageView) findViewById(R.id.background);

    //        mPauseImage = (ImageView) findViewById(R.id.play_pause);
    mVideoSurface = (SurfaceView) findViewById(R.id.video_surface);

    mPreviousButton_slider = (ImageButton) findViewById(R.id.prev);
    mPlay_pauseButton_slider = (ImageButton) findViewById(R.id.pause);
    mNextButton_slider = (ImageButton) findViewById(R.id.next);

    mVideoSurface.setZOrderOnTop(true);
    mVideoSurface.setAlpha((float) 0.18);
    mVideoSurface.getHolder().setFormat(PixelFormat.TRANSLUCENT);

    //        mPauseImage.setOnClickListener(this);
    mVideoSurface.setOnClickListener(this);
    mVideoSurface.setOnTouchListener(this);

    mPreviousButton_slider.setOnClickListener(this);
    mPlay_pauseButton_slider.setOnClickListener(this);
    mNextButton_slider.setOnClickListener(this);

    //
    mPredict = 0;
    getSurfaceHolder();

    //
    mDefaultDM = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(mDefaultDM);

    this.registerReceiver(
        new BroadcastReceiver() {

          @Override
          public void onReceive(Context context, Intent intent) {
            // TODO Auto-generated method stub
            dismissSlidingController();
          }
        },
        mIntentfl);

    mediaControllerLayout = findViewById(R.id.mediaControllerLayout);
    mSeekBar = (SeekBar) findViewById(R.id.videoSeekBar);

    mSeekBar.setOnSeekBarChangeListener(
        new OnSeekBarChangeListener() {
          @Override
          public void onStopTrackingTouch(SeekBar seekBar) {}

          @Override
          public void onStartTrackingTouch(SeekBar seekBar) {}

          @Override
          public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            if (fromUser) {
              mPlaybackService.seekTo(
                  (int) (progress * 1.0 / seekBar.getMax() * (mPlaybackService.getDuration())));
              seekBar.setProgress(progress);
            }
          }
        });

    scheduledExecutorService = Executors.newScheduledThreadPool(1);
    handler = new Handler();

    scheduledExecutorService.scheduleAtFixedRate(
        new Runnable() {

          @Override
          public void run() {
            handler.post(
                new Runnable() {
                  @Override
                  public void run() {
                    Log.d(TAG, "test-----");
                    if (mPlaybackService.isPlaying()) {
                      Log.d(TAG, "test++++");
                      int position = mPlaybackService.getCurrentPosition();
                      int duration = mPlaybackService.getDuration();
                      Log.d(
                          TAG,
                          "test++++" + Integer.toString(duration) + Integer.toString(position));
                      mSeekBar.setProgress(
                          (int) ((float) position / (float) duration * mSeekBar.getMax()));

                      mediaControllerLayout.setVisibility(View.VISIBLE);
                      playButton.setImageResource(R.drawable.ic_media_pause);

                      Log.d(TAG, "test++++" + (int) (position / duration * mSeekBar.getMax()));
                    }
                  }
                });
          }
        },
        1000,
        1000,
        TimeUnit.MILLISECONDS);

    playButton = (ImageButton) findViewById(R.id.playButton);
    playButton.setOnClickListener(this);

    // icon show sliding menu
    ActionBar actionBar = getActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);

    // sliding menu
    setBehindContentView(R.layout.slidingmenu_left);

    // customize the SlidingMenu
    SlidingMenu sm = getSlidingMenu();
    sm.setMode(SlidingMenu.LEFT);
    sm.setBehindOffsetRes(R.dimen.slidingmenu_offset);
    sm.setFadeDegree(0.0f);
    sm.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
    sm.setBehindScrollScale(0.0f);
    // animation
    sm.setBehindCanvasTransformer(
        new CanvasTransformer() {
          @Override
          public void transformCanvas(Canvas canvas, float percentOpen) {
            // TODO Auto-generated method stub
            Log.d(TAG, "testAni---------------");
            canvas.translate(0, 0);
          }
        });

    slidingMenu_open = (LinearLayout) findViewById(R.id.sliding_open);
    slidingMenu_open_image = (ImageView) findViewById(R.id.sliding_open_image);
    slidingMenu_open_text = (TextView) findViewById(R.id.sliding_open_text);

    slidingMenu_repeat = (LinearLayout) findViewById(R.id.sliding_loop);
    slidingMenu_repeat_image = (ImageView) findViewById(R.id.sliding_loop_image);
    slidingMenu_repeat_text = (TextView) findViewById(R.id.sliding_loop_text);

    slidingMenu_about = (LinearLayout) findViewById(R.id.sliding_about);
    slidingMenu_about_image = (ImageView) findViewById(R.id.sliding_about_image);
    slidingMenu_about_text = (TextView) findViewById(R.id.sliding_about_text);

    sliding_floatwindow = (LinearLayout) findViewById(R.id.sliding_floatwindow);
    sliding_checkbox_floatwindow = (CheckBox) findViewById(R.id.sliding_checkbox_floatwindow);
    sliding_floatwindow_text = (TextView) findViewById(R.id.sliding_floatwindow_text);

    slidingMenu_open.setOnClickListener(this);
    slidingMenu_open.setOnClickListener(this);
    slidingMenu_open_text.setOnClickListener(this);

    slidingMenu_repeat.setOnClickListener(this);
    slidingMenu_repeat_image.setOnClickListener(this);
    slidingMenu_repeat_text.setOnClickListener(this);

    slidingMenu_about.setOnClickListener(this);
    slidingMenu_about_image.setOnClickListener(this);
    slidingMenu_about_text.setOnClickListener(this);

    sliding_floatwindow.setOnClickListener(this);
    sliding_floatwindow_text.setOnClickListener(this);

    sliding_checkbox_floatwindow.setOnCheckedChangeListener(
        new OnCheckedChangeListener() {

          @Override
          public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            // TODO Auto-generated method stub
            boolean float_window_value = sliding_checkbox_floatwindow.isChecked();
            editor.putBoolean("sliding_checkbox_floatwindow", float_window_value);
            editor.commit();
            Log.d(
                TAG,
                "<><><><><><><> if float windows set to: " + Boolean.toString(float_window_value));
          }
        });

    settings = getSharedPreferences("floatWindow", 0);
    editor = settings.edit();

    boolean ifPlayInFloatWindow = settings.getBoolean("sliding_checkbox_floatwindow", false);
    Log.d(TAG, "<><><><><><><> play in float window: " + Boolean.toString(ifPlayInFloatWindow));
    sliding_checkbox_floatwindow.setChecked(ifPlayInFloatWindow);
  }