OSDN Git Service

一部のワーニングを修正。
[gokigen/MeMoMa.git] / app / src / main / java / jp / sourceforge / gokigen / memoma / operations / ObjectDataInputDialog.java
1 package jp.sourceforge.gokigen.memoma.operations;
2
3 import android.app.AlertDialog;
4 import android.app.Dialog;
5 import android.content.Context;
6 import android.content.DialogInterface;
7 import android.content.SharedPreferences;
8 import android.graphics.Color;
9 import android.graphics.Paint;
10 import android.graphics.PorterDuff.Mode;
11 import android.graphics.drawable.BitmapDrawable;
12 import android.graphics.drawable.GradientDrawable;
13 import android.preference.PreferenceManager;
14 import android.util.Log;
15 import android.util.TypedValue;
16 import android.view.LayoutInflater;
17 import android.view.View;
18 import android.widget.CheckBox;
19 import android.widget.EditText;
20 import android.widget.ImageButton;
21 import android.widget.SeekBar;
22 import android.widget.TextView;
23 import android.widget.CompoundButton;
24
25 import jp.sourceforge.gokigen.memoma.Main;
26 import jp.sourceforge.gokigen.memoma.R;
27 import jp.sourceforge.gokigen.memoma.drawers.MeMoMaCanvasDrawer;
28 import jp.sourceforge.gokigen.memoma.holders.MeMoMaObjectHolder;
29
30 /**
31  *   オブジェクトのデータを入力するダイアログを表示する
32  * 
33  * @author MRSa
34  *
35  */
36 public class ObjectDataInputDialog implements SeekBar.OnSeekBarChangeListener, CompoundButton.OnCheckedChangeListener, ImageButton.OnClickListener
37 {
38         private final float FONTSIZE_SMALL = 4.0f;
39         private final float FONTSIZE_MIDDLE = 6.0f;
40         private final float FONTSIZE_LARGE = 10.0f;
41         
42         private Context context = null; 
43         private IResultReceiver resultReceiver = null;
44         private MeMoMaObjectHolder objectHolder = null;
45         private Integer key = 0;
46         
47         private View dialogLayout = null;
48         private TextView  colorBorderAreaView = null;
49         private SeekBar borderColorView = null;
50     private CheckBox  fillObjectView = null;
51     private GradientDrawable backgroundShape = null;
52     private int backgroundColor = MeMoMaCanvasDrawer.BACKGROUND_COLOR_DEFAULT;
53     private int currentObjectDrawStyle = MeMoMaObjectHolder.DRAWSTYLE_RECTANGLE;
54     private float textFontSize = 6.0f;
55         
56         public ObjectDataInputDialog(Context arg, MeMoMaObjectHolder holder)
57         {
58                 context = arg;
59                 objectHolder = holder;
60         }
61
62         public void setResultReceiver(IResultReceiver receiver)
63         {
64                 resultReceiver = receiver;
65         }
66         
67     /**
68      *   確認ダイアログを応答する
69      * @return
70      */
71     public Dialog getDialog()
72     {
73         LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
74         final View layout = inflater.inflate(R.layout.objectinput, null);
75         dialogLayout = layout;
76
77         AlertDialog.Builder builder = new AlertDialog.Builder(context);
78
79         //  ダイアログで表示するデータを設定する場所
80         
81         // 背景色を設定する
82         try
83         {
84                 SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
85             String colorString = preferences.getString("backgroundColor", "0xff004000");
86             backgroundColor = Color.parseColor(colorString);
87         }
88         catch (Exception e)
89         {
90             backgroundColor = MeMoMaCanvasDrawer.BACKGROUND_COLOR_DEFAULT;
91         }
92
93         final TextView colorLabel = (TextView) layout.findViewById(R.id.setBorderColorLabel);
94         backgroundShape = (GradientDrawable)colorLabel.getBackground();
95
96         // 入力文字列の色を設定する
97         final EditText label = (EditText) layout.findViewById(R.id.labelInputArea);
98        // label.setTextColor(Color.LTGRAY);
99
100         final EditText detail = (EditText) layout.findViewById(R.id.descriptionInputArea);
101         //detail.setTextColor(Color.LTGRAY);
102
103         borderColorView = (SeekBar) layout.findViewById(R.id.borderColorSelectionBar);
104         borderColorView.setOnSeekBarChangeListener(this);        
105         
106         final CheckBox userCheckbox = (CheckBox) layout.findViewById(R.id.checkUserCheckbox);
107         final CheckBox boldText = (CheckBox) layout.findViewById(R.id.checkBoldText);
108         fillObjectView = (CheckBox) layout.findViewById(R.id.checkFillObject);
109         fillObjectView.setOnCheckedChangeListener(this);
110
111         colorBorderAreaView = (TextView) layout.findViewById(R.id.borderColorArea);
112         colorBorderAreaView.setOnClickListener(this);
113         
114         final ImageButton rect = (ImageButton) layout.findViewById(R.id.btnObjectRectangle);
115         rect.setOnClickListener(this);
116         final ImageButton roundRect = (ImageButton) layout.findViewById(R.id.btnObjectRoundRect);
117         roundRect.setOnClickListener(this);
118         final ImageButton oval = (ImageButton) layout.findViewById(R.id.btnObjectOval);
119         oval.setOnClickListener(this);
120         final ImageButton diamond = (ImageButton) layout.findViewById(R.id.btnObjectDiamond);
121         diamond.setOnClickListener(this);
122         final ImageButton hexagonal = (ImageButton) layout.findViewById(R.id.btnObjectHexagonal);
123         hexagonal.setOnClickListener(this);
124         final ImageButton parallelogram = (ImageButton) layout.findViewById(R.id.btnObjectParallelogram);
125         parallelogram.setOnClickListener(this);
126         final ImageButton keyboard = (ImageButton) layout.findViewById(R.id.btnObjectKeyboard);
127         keyboard.setOnClickListener(this);
128         final ImageButton paper = (ImageButton) layout.findViewById(R.id.btnObjectPaper);
129         paper.setOnClickListener(this);
130         final ImageButton drum = (ImageButton) layout.findViewById(R.id.btnObjectDrum);
131         drum.setOnClickListener(this);
132         final ImageButton circle = (ImageButton) layout.findViewById(R.id.btnObjectCircle);
133         circle.setOnClickListener(this);
134         final ImageButton noregion = (ImageButton) layout.findViewById(R.id.btnObjectNoRegion);
135         noregion.setOnClickListener(this);
136
137         final ImageButton loopStart = (ImageButton) layout.findViewById(R.id.btnObjectLoopStart);
138         loopStart.setOnClickListener(this);
139         final ImageButton loopEnd = (ImageButton) layout.findViewById(R.id.btnObjectLoopEnd);
140         loopEnd.setOnClickListener(this);
141         final ImageButton leftArrow = (ImageButton) layout.findViewById(R.id.btnObjectLeftArrow);
142         leftArrow.setOnClickListener(this);
143         final ImageButton downArrow = (ImageButton) layout.findViewById(R.id.btnObjectDownArrow);
144         downArrow.setOnClickListener(this);
145         final ImageButton upArrow = (ImageButton) layout.findViewById(R.id.btnObjectUpArrow);
146         upArrow.setOnClickListener(this);
147         final ImageButton rightArrow = (ImageButton) layout.findViewById(R.id.btnObjectRightArrow);
148         rightArrow.setOnClickListener(this);
149
150         // 背景の色を調整(塗りつぶしの時はオブジェクトの色とする。)
151         int color = convertColor(borderColorView.getProgress());
152                 colorBorderAreaView.setBackgroundColor((fillObjectView.isChecked() == true) ? color : backgroundColor);
153                 //backgroundShape.setStroke(2, color);
154
155                 if (fillObjectView.isChecked() == true)
156                 {
157                         // 塗りつぶし時は文字の色を変える。
158             color = (color ^ 0x00ffffff);
159                 }
160                 colorBorderAreaView.setTextColor(color);
161                 colorBorderAreaView.setText(context.getString(R.string.labelTextColorSample));
162                 
163         builder.setView(layout);
164         builder.setCancelable(false);
165         builder.setPositiveButton(context.getString(R.string.confirmYes), new DialogInterface.OnClickListener()
166               {
167                    public void onClick(DialogInterface dialog, int id)
168                    {
169                            boolean ret = false;
170                            boolean isUserCheck = false;
171                            if (userCheckbox != null)
172                            {
173                                    isUserCheck = userCheckbox.isChecked();
174                            }
175                            setObjectData(label.getText().toString(), detail.getText().toString(), borderColorView.getProgress(), boldText.isChecked(), fillObjectView.isChecked(), isUserCheck, currentObjectDrawStyle);
176                            if (resultReceiver != null)
177                            {
178                                resultReceiver.finishObjectInput();
179                            }
180                        if (ret == true)
181                        {
182                            dialog.dismiss();
183                        }
184                        else
185                        {
186                            dialog.cancel();
187                        }
188                        System.gc();
189                    }
190                });
191         builder.setNegativeButton(context.getString(R.string.confirmNo), new DialogInterface.OnClickListener()
192                {
193                    public void onClick(DialogInterface dialog, int id)
194                    {
195                            boolean ret = false;
196                            if (resultReceiver != null)
197                            {
198                                resultReceiver.cancelObjectInput();
199                            }
200                        if (ret == true)
201                        {
202                            dialog.dismiss();
203                        }
204                        else
205                        {
206                            dialog.cancel();
207                        }
208                        System.gc();
209                    }
210                });
211         return (builder.create());      
212     }
213
214     /**
215      *    オブジェクト入力用ダイアログの表示を準備する
216      * 
217      */
218     public void prepareObjectInputDialog(Dialog dialog, Integer objectKey)
219     {
220         MeMoMaObjectHolder.PositionObject position = objectHolder.getPosition(objectKey);
221         key = objectKey;
222         if (position != null)
223         {
224                 // 色を設定する
225             final SeekBar borderColorProgess = (SeekBar) dialog.findViewById(R.id.borderColorSelectionBar);
226             borderColorProgess.setProgress(convertProgress(position.objectColor));
227
228             final CheckBox  boldTextCheck = (CheckBox) dialog.findViewById(R.id.checkBoldText);
229             boldTextCheck.setChecked(position.strokeWidth == MeMoMaObjectHolder.STOROKE_BOLD_WIDTH);
230
231             final CheckBox  fillObjectCheck = (CheckBox) dialog.findViewById(R.id.checkFillObject);
232             fillObjectCheck.setChecked(Paint.Style.valueOf(position.paintStyle) != Paint.Style.STROKE);
233
234             // フォントサイズを設定する
235             textFontSize = position.fontSize / 2.0f;
236             
237                 // 入力文字列を設定する
238             final EditText targetLabel = (EditText) dialog.findViewById(R.id.labelInputArea);
239             targetLabel.setText(position.label);
240
241             final EditText targetDetail = (EditText) dialog.findViewById(R.id.descriptionInputArea);
242             targetDetail.setText(position.detail);
243             
244                 //  設定に記録されているデータを画面に反映させる
245                 SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
246             String userCheckboxTitle = preferences.getString("userCheckboxString", "");
247
248             // 描画スタイルを設定する
249             currentObjectDrawStyle = position.drawStyle;
250                 updateObjectDrawStyleImageButton(currentObjectDrawStyle);
251             
252             // 背景色を設定する
253             try
254             {
255                 String colorString = preferences.getString("backgroundColor", "0xff004000");
256                 backgroundColor = Color.parseColor(colorString);
257             }
258             catch (Exception e)
259             {
260                 backgroundColor = MeMoMaCanvasDrawer.BACKGROUND_COLOR_DEFAULT;
261             }
262             setTextColorSample(borderColorProgess.getProgress(), textFontSize, fillObjectView.isChecked());
263
264             final CheckBox  userCheckbox = (CheckBox) dialog.findViewById(R.id.checkUserCheckbox);
265             userCheckbox.setEnabled(true);
266             userCheckbox.setText(userCheckboxTitle);
267             userCheckbox.setChecked(position.userChecked);
268         }
269     }
270     
271     /**
272      *    オブジェクトにデータを設定する
273      *
274      */
275     public void setObjectData(String label, String detail, int progress, boolean boldText, boolean fillObject, boolean userCheck, int drawStyle)
276     {
277         MeMoMaObjectHolder.PositionObject positionObject = objectHolder.getPosition(key);
278         if (positionObject != null)
279         {
280             positionObject.label = label;
281             positionObject.detail = detail;
282                 int color = convertColor(progress);
283             positionObject.objectColor = color;
284                 color = (color ^ 0x00ffffff);
285                 positionObject.fontSize = textFontSize * 2.0f;
286             positionObject.labelColor = color;
287                 positionObject.strokeWidth = (boldText == true) ? MeMoMaObjectHolder.STOROKE_BOLD_WIDTH : MeMoMaObjectHolder.STOROKE_NORMAL_WIDTH;
288                 positionObject.paintStyle = ((fillObject == true) ? Paint.Style.FILL : Paint.Style.STROKE).toString();
289                 positionObject.userChecked = userCheck;
290                 
291                 if (positionObject.drawStyle != drawStyle)
292                 {
293                     if ((drawStyle == MeMoMaObjectHolder.DRAWSTYLE_CIRCLE)||
294                         (drawStyle == MeMoMaObjectHolder.       DRAWSTYLE_LEFT_ARROW)||
295                         (drawStyle == MeMoMaObjectHolder.       DRAWSTYLE_DOWN_ARROW)||
296                         (drawStyle == MeMoMaObjectHolder.       DRAWSTYLE_UP_ARROW)||
297                         (drawStyle == MeMoMaObjectHolder.       DRAWSTYLE_RIGHT_ARROW))
298                     {
299                         // (長方形の形状から)正方形の形状にする場合...
300                         setRectToSquare(positionObject);                        
301                     }
302                     else if ((positionObject.drawStyle == MeMoMaObjectHolder.DRAWSTYLE_CIRCLE)||
303                             (positionObject.drawStyle == MeMoMaObjectHolder.    DRAWSTYLE_LEFT_ARROW)||
304                             (positionObject.drawStyle == MeMoMaObjectHolder.    DRAWSTYLE_DOWN_ARROW)||
305                             (positionObject.drawStyle == MeMoMaObjectHolder.    DRAWSTYLE_UP_ARROW)||
306                             (positionObject.drawStyle == MeMoMaObjectHolder.    DRAWSTYLE_RIGHT_ARROW))
307                     {
308                         // 正方形の形状から、長方形の形状にする場合...
309                         setRectFromSquare(positionObject);
310                     }   
311                     positionObject.drawStyle = drawStyle;
312                 }
313         }
314         positionObject = null;
315     }
316
317     /**
318      *   オブジェクトの領域を長方形から正方形にする
319      */
320     private void setRectToSquare(MeMoMaObjectHolder.PositionObject positionObject)
321     {
322            float bandWidth = ((positionObject.rect.right -  positionObject.rect.left)) / 2.0f;
323            float center = positionObject.rect.centerY();
324            
325            positionObject.rect.top = center - bandWidth;
326            positionObject.rect.bottom = center + bandWidth;
327     }
328
329     /**
330      *   オブジェクトの領域を正方形から長方形にする
331      */
332     private void setRectFromSquare(MeMoMaObjectHolder.PositionObject positionObject)
333     {
334         float bandWidth = ((positionObject.rect.right -  positionObject.rect.left) / 16.0f * 9.0f) / 2.0f;
335         float center = positionObject.rect.centerY();
336         
337         positionObject.rect.top = center - bandWidth;
338         positionObject.rect.bottom = center + bandWidth;
339     }
340
341     private void setButtonBorder(int id, boolean isHighlight)
342     {
343         try
344         {
345             ImageButton button = (ImageButton) dialogLayout.findViewById(id);
346             //GradientDrawable btnBackgroundShape = (GradientDrawable)button.getBackground();
347             BitmapDrawable btnBackgroundShape = (BitmapDrawable)button.getBackground();
348             if (isHighlight == true)
349             {
350 //                      btnBackgroundShape.setColorFilter(Color.rgb(51, 181, 229), Mode.LIGHTEN);
351                 btnBackgroundShape.setColorFilter(Color.BLUE, Mode.LIGHTEN);
352             }
353             else
354             {
355                 btnBackgroundShape.setColorFilter(Color.BLACK, Mode.LIGHTEN);
356             } 
357         }
358         catch (Exception ex)
359         {
360                 // 
361                 Log.v(Main.APP_IDENTIFIER, "setButtonBorder(): " + ex.toString());
362         }
363         
364     }
365     
366     /**
367      *    イメージボタンの選択状態を更新する
368      * 
369      * @param drawStyle
370      */
371     private void updateObjectDrawStyleImageButton(int drawStyle)
372     {
373         setButtonBorder(R.id.btnObjectRectangle, (drawStyle == MeMoMaObjectHolder.DRAWSTYLE_RECTANGLE));
374         setButtonBorder(R.id.btnObjectRoundRect, (drawStyle == MeMoMaObjectHolder.DRAWSTYLE_ROUNDRECT));
375         setButtonBorder(R.id.btnObjectOval, (drawStyle == MeMoMaObjectHolder.DRAWSTYLE_OVAL));
376         setButtonBorder(R.id.btnObjectDiamond, (drawStyle == MeMoMaObjectHolder.DRAWSTYLE_DIAMOND));
377         setButtonBorder(R.id.btnObjectHexagonal, (drawStyle == MeMoMaObjectHolder.DRAWSTYLE_HEXAGONAL));
378         setButtonBorder(R.id.btnObjectParallelogram, (drawStyle == MeMoMaObjectHolder.DRAWSTYLE_PARALLELOGRAM));
379         setButtonBorder(R.id.btnObjectKeyboard, (drawStyle == MeMoMaObjectHolder.DRAWSTYLE_KEYBOARD));
380         setButtonBorder(R.id.btnObjectPaper, (drawStyle == MeMoMaObjectHolder.DRAWSTYLE_PAPER));
381         setButtonBorder(R.id.btnObjectDrum, (drawStyle == MeMoMaObjectHolder.DRAWSTYLE_DRUM));
382         setButtonBorder(R.id.btnObjectCircle, (drawStyle == MeMoMaObjectHolder.DRAWSTYLE_CIRCLE));
383         setButtonBorder(R.id.btnObjectNoRegion, (drawStyle == MeMoMaObjectHolder.DRAWSTYLE_NO_REGION));
384         setButtonBorder(R.id.btnObjectLoopStart, (drawStyle == MeMoMaObjectHolder.DRAWSTYLE_LOOP_START));
385         setButtonBorder(R.id.btnObjectLoopEnd, (drawStyle == MeMoMaObjectHolder.DRAWSTYLE_LOOP_END));
386         setButtonBorder(R.id.btnObjectLeftArrow, (drawStyle == MeMoMaObjectHolder.DRAWSTYLE_LEFT_ARROW));
387         setButtonBorder(R.id.btnObjectDownArrow, (drawStyle == MeMoMaObjectHolder.DRAWSTYLE_DOWN_ARROW));
388         setButtonBorder(R.id.btnObjectUpArrow, (drawStyle == MeMoMaObjectHolder.DRAWSTYLE_UP_ARROW));
389         setButtonBorder(R.id.btnObjectRightArrow, (drawStyle == MeMoMaObjectHolder.DRAWSTYLE_RIGHT_ARROW));
390      }
391     
392     /**
393      *    ボタンが押された時の処理...
394      * 
395      */
396     public void onClick(View v)
397     {
398         int id = v.getId();
399         if (id == R.id.borderColorArea)
400         {
401                 // フォントサイズを変更する...
402                 if (textFontSize == FONTSIZE_MIDDLE)
403                 {
404                         textFontSize = FONTSIZE_LARGE;
405                 }
406                 else if (textFontSize == FONTSIZE_LARGE)
407                 {
408                         textFontSize = FONTSIZE_SMALL;
409                 }
410                 else // if (textFontSize == FONTSIZE_SMALL)
411                 {
412                         textFontSize = FONTSIZE_MIDDLE;
413                 }
414             setTextColorSample(borderColorView.getProgress(), textFontSize, fillObjectView.isChecked());
415                 return;
416         }
417         
418         switch (id)
419         {
420           case R.id.btnObjectRoundRect:
421                   currentObjectDrawStyle = MeMoMaObjectHolder.DRAWSTYLE_ROUNDRECT;
422                   break;
423           case R.id.btnObjectOval:
424                   currentObjectDrawStyle = MeMoMaObjectHolder.DRAWSTYLE_OVAL;
425                   break;
426           case R.id.btnObjectDiamond:
427                   currentObjectDrawStyle = MeMoMaObjectHolder.DRAWSTYLE_DIAMOND;
428                   break;
429           case R.id.btnObjectHexagonal:
430                   currentObjectDrawStyle = MeMoMaObjectHolder.DRAWSTYLE_HEXAGONAL;
431                   break;
432           case R.id.btnObjectParallelogram:
433                   currentObjectDrawStyle = MeMoMaObjectHolder.DRAWSTYLE_PARALLELOGRAM;
434                   break;
435           case R.id.btnObjectKeyboard:
436                   currentObjectDrawStyle = MeMoMaObjectHolder.DRAWSTYLE_KEYBOARD;
437                   break;
438           case R.id.btnObjectPaper:
439                   currentObjectDrawStyle = MeMoMaObjectHolder.DRAWSTYLE_PAPER;
440                   break;
441           case R.id.btnObjectDrum:
442                   currentObjectDrawStyle = MeMoMaObjectHolder.DRAWSTYLE_DRUM;
443                   break;
444           case R.id.btnObjectNoRegion:
445                   currentObjectDrawStyle = MeMoMaObjectHolder.DRAWSTYLE_NO_REGION;
446                   break;
447           case R.id.btnObjectCircle:
448                   currentObjectDrawStyle = MeMoMaObjectHolder.DRAWSTYLE_CIRCLE;
449                   break;
450           case R.id.btnObjectLoopStart:
451                   currentObjectDrawStyle = MeMoMaObjectHolder.DRAWSTYLE_LOOP_START;
452                   break;
453           case R.id.btnObjectLoopEnd:
454                   currentObjectDrawStyle = MeMoMaObjectHolder.DRAWSTYLE_LOOP_END;
455                   break;
456           case R.id.btnObjectLeftArrow:
457                   currentObjectDrawStyle = MeMoMaObjectHolder.DRAWSTYLE_LEFT_ARROW;
458                   break;
459           case R.id.btnObjectDownArrow:
460                   currentObjectDrawStyle = MeMoMaObjectHolder.DRAWSTYLE_DOWN_ARROW;
461                   break;
462           case R.id.btnObjectUpArrow:
463                   currentObjectDrawStyle = MeMoMaObjectHolder.DRAWSTYLE_UP_ARROW;
464                   break;
465           case R.id.btnObjectRightArrow:
466                   currentObjectDrawStyle = MeMoMaObjectHolder.DRAWSTYLE_RIGHT_ARROW;
467                   break;
468           case R.id.btnObjectRectangle: 
469           default:
470                   currentObjectDrawStyle = MeMoMaObjectHolder.DRAWSTYLE_RECTANGLE;
471                   break;
472         }
473         updateObjectDrawStyleImageButton(currentObjectDrawStyle);
474     }
475
476     /**
477      *   0x00~0x3fの値(R, G, B, それぞれ2ビット)で色を変える
478      * 
479      * @param value
480      * @return
481      */
482     private int convertColor(int value)
483     {
484         int color = 0;  
485         int r = ((value >> 4 ) & 0x03) * 85;
486         int g = ((value >> 2) & 0x03) * 85;
487         int b = (value & 0x03)  * 85;
488         color = Color.rgb(r, g, b);
489         //Log.v(Main.APP_IDENTIFIER, "convertColor()  R : " + r + ", G : " + g + ", B : " + b + "color : " + color);
490         return (color);
491     }
492
493     /**
494      *    色をプログレスバーの値に変換する
495      *    
496      * @param color
497      * @return
498      */
499     private int convertProgress(int color)
500     {
501         int r = Color.red(color) / 85;
502         int g = Color.green(color) / 85;
503         int b = Color.blue(color) / 85;
504         
505         return ((r << 4) + (g << 2) + b);       
506     }
507     
508     /**
509      *   背景色を設定する処理
510      *   
511      * @param progress
512      * @param fontSize
513      * @param value
514      */
515     private void setTextColorSample(int progress, float fontSize, boolean value)
516     {
517         if (colorBorderAreaView != null)
518         {
519                 int color = convertColor(progress);
520                 int backColor = (value == true) ? color : backgroundColor;
521                 colorBorderAreaView.setBackgroundColor(backColor);
522                 
523                 backgroundShape.setStroke(2, color);
524                 
525                 if (value == true)
526                 {
527                         // 塗りつぶし時には色を変える
528                     color = (color ^ 0x00ffffff);
529                 }
530                 colorBorderAreaView.setTextSize(TypedValue.COMPLEX_UNIT_PT, fontSize);
531                 colorBorderAreaView.setTextColor(color);
532                 colorBorderAreaView.setText(context.getString(R.string.labelTextColorSample));
533         }
534     }
535     
536     /**
537      *   チェックボックスの値が変更された時の処理
538      * 
539      */
540     public void onCheckedChanged(CompoundButton view, boolean value)
541     {
542         int id = view.getId();
543         if ((id == R.id.checkFillObject)&&(borderColorView != null))
544         {
545                 setTextColorSample(borderColorView.getProgress(), textFontSize, value);
546         }       
547     }
548     /**
549      *    プログレスバーで値を変更された時の処理
550      * 
551      */
552     public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser)
553     {
554         int id = seekBar.getId();
555         //Log.v(Main.APP_IDENTIFIER, "onProgressChanged() : " + progress + " id : " + id);
556         
557         if ((id == R.id.borderColorSelectionBar)&&(fillObjectView != null))
558         {
559                 setTextColorSample(progress, textFontSize, fillObjectView.isChecked());
560         }
561     }
562     
563     public void onStartTrackingTouch(SeekBar seekBar)
564     {
565         //      
566     }
567
568     public void onStopTrackingTouch(SeekBar seekBar)
569     {
570         //
571     }    
572     
573     public interface IResultReceiver
574     {
575         public abstract void finishObjectInput();
576         public abstract void cancelObjectInput();
577     }
578 }