Fabrice Di Meglio | 9f82b58 | 2011-03-08 12:02:59 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2011 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package com.android.bidi; |
| 18 | |
| 19 | import android.app.Activity; |
| 20 | import android.os.Bundle; |
| 21 | import android.util.Log; |
| 22 | import android.view.View; |
Fabrice Di Meglio | eee49c6 | 2011-03-24 17:21:23 -0700 | [diff] [blame] | 23 | import android.widget.SeekBar; |
| 24 | |
| 25 | import static com.android.bidi.BiDiTestConstants.FONT_MIN_SIZE; |
| 26 | import static com.android.bidi.BiDiTestConstants.FONT_MAX_SIZE; |
Fabrice Di Meglio | 9f82b58 | 2011-03-08 12:02:59 -0800 | [diff] [blame] | 27 | |
| 28 | public class BiDiTestActivity extends Activity { |
| 29 | |
| 30 | static final String TAG = "BiDiTestActivity"; |
| 31 | |
Fabrice Di Meglio | eee49c6 | 2011-03-24 17:21:23 -0700 | [diff] [blame] | 32 | static final int INIT_TEXT_SIZE = (FONT_MAX_SIZE - FONT_MIN_SIZE) / 2; |
| 33 | |
| 34 | private BiDiTestView textView; |
| 35 | private SeekBar textSizeSeekBar; |
| 36 | |
Fabrice Di Meglio | 9f82b58 | 2011-03-08 12:02:59 -0800 | [diff] [blame] | 37 | @Override |
| 38 | protected void onCreate(Bundle savedInstanceState) { |
| 39 | super.onCreate(savedInstanceState); |
| 40 | |
| 41 | setContentView(R.layout.biditest_main); |
Fabrice Di Meglio | eee49c6 | 2011-03-24 17:21:23 -0700 | [diff] [blame] | 42 | |
| 43 | textView = (BiDiTestView) findViewById(R.id.main); |
| 44 | textView.setCurrentTextSize(INIT_TEXT_SIZE); |
| 45 | |
| 46 | textSizeSeekBar = (SeekBar) findViewById(R.id.seekbar); |
| 47 | textSizeSeekBar.setProgress(INIT_TEXT_SIZE); |
| 48 | textSizeSeekBar.setMax(FONT_MAX_SIZE - FONT_MIN_SIZE); |
| 49 | |
| 50 | textSizeSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { |
| 51 | public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { |
| 52 | textView.setCurrentTextSize(FONT_MIN_SIZE + progress); |
| 53 | } |
| 54 | |
| 55 | public void onStartTrackingTouch(SeekBar seekBar) { |
| 56 | } |
| 57 | |
| 58 | public void onStopTrackingTouch(SeekBar seekBar) { |
| 59 | } |
| 60 | }); |
Fabrice Di Meglio | 9f82b58 | 2011-03-08 12:02:59 -0800 | [diff] [blame] | 61 | } |
| 62 | |
| 63 | @Override |
| 64 | protected void onResume() { |
| 65 | super.onResume(); |
| 66 | } |
| 67 | |
| 68 | public void onButtonClick(View v) { |
| 69 | Log.v(TAG, "onButtonClick"); |
| 70 | } |
| 71 | } |