blob: 6c71574c4611741dbbd716a655f6edf1a84b07aa [file] [log] [blame]
Fabrice Di Meglio9f82b582011-03-08 12:02:59 -08001/*
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
17package com.android.bidi;
18
19import android.app.Activity;
20import android.os.Bundle;
21import android.util.Log;
22import android.view.View;
Fabrice Di Meglioeee49c62011-03-24 17:21:23 -070023import android.widget.SeekBar;
24
25import static com.android.bidi.BiDiTestConstants.FONT_MIN_SIZE;
26import static com.android.bidi.BiDiTestConstants.FONT_MAX_SIZE;
Fabrice Di Meglio9f82b582011-03-08 12:02:59 -080027
28public class BiDiTestActivity extends Activity {
29
30 static final String TAG = "BiDiTestActivity";
31
Fabrice Di Meglioeee49c62011-03-24 17:21:23 -070032 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 Meglio9f82b582011-03-08 12:02:59 -080037 @Override
38 protected void onCreate(Bundle savedInstanceState) {
39 super.onCreate(savedInstanceState);
40
41 setContentView(R.layout.biditest_main);
Fabrice Di Meglioeee49c62011-03-24 17:21:23 -070042
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 Meglio9f82b582011-03-08 12:02:59 -080061 }
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}