1235d2179374bec14040f20af91dc753e38ea3639John Hoford/* 2235d2179374bec14040f20af91dc753e38ea3639John Hoford * Copyright (C) 2013 The Android Open Source Project 3235d2179374bec14040f20af91dc753e38ea3639John Hoford * 4235d2179374bec14040f20af91dc753e38ea3639John Hoford * Licensed under the Apache License, Version 2.0 (the "License"); 5235d2179374bec14040f20af91dc753e38ea3639John Hoford * you may not use this file except in compliance with the License. 6235d2179374bec14040f20af91dc753e38ea3639John Hoford * You may obtain a copy of the License at 7235d2179374bec14040f20af91dc753e38ea3639John Hoford * 8235d2179374bec14040f20af91dc753e38ea3639John Hoford * http://www.apache.org/licenses/LICENSE-2.0 9235d2179374bec14040f20af91dc753e38ea3639John Hoford * 10235d2179374bec14040f20af91dc753e38ea3639John Hoford * Unless required by applicable law or agreed to in writing, software 11235d2179374bec14040f20af91dc753e38ea3639John Hoford * distributed under the License is distributed on an "AS IS" BASIS, 12235d2179374bec14040f20af91dc753e38ea3639John Hoford * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13235d2179374bec14040f20af91dc753e38ea3639John Hoford * See the License for the specific language governing permissions and 14235d2179374bec14040f20af91dc753e38ea3639John Hoford * limitations under the License. 15235d2179374bec14040f20af91dc753e38ea3639John Hoford */ 16235d2179374bec14040f20af91dc753e38ea3639John Hoford 17235d2179374bec14040f20af91dc753e38ea3639John Hofordpackage com.android.gallery3d.filtershow.controller; 18235d2179374bec14040f20af91dc753e38ea3639John Hoford 19235d2179374bec14040f20af91dc753e38ea3639John Hofordimport android.util.Log; 20235d2179374bec14040f20af91dc753e38ea3639John Hofordimport android.view.View; 21235d2179374bec14040f20af91dc753e38ea3639John Hofordimport android.view.View.OnClickListener; 22235d2179374bec14040f20af91dc753e38ea3639John Hofordimport android.view.ViewGroup; 23235d2179374bec14040f20af91dc753e38ea3639John Hofordimport android.widget.ImageButton; 24235d2179374bec14040f20af91dc753e38ea3639John Hoford 25235d2179374bec14040f20af91dc753e38ea3639John Hofordimport com.android.gallery3d.R; 26235d2179374bec14040f20af91dc753e38ea3639John Hofordimport com.android.gallery3d.filtershow.editors.Editor; 27235d2179374bec14040f20af91dc753e38ea3639John Hoford 28235d2179374bec14040f20af91dc753e38ea3639John Hofordpublic class ActionSlider extends TitledSlider { 29235d2179374bec14040f20af91dc753e38ea3639John Hoford private static final String LOGTAG = "ActionSlider"; 307112720bc6100049d24845cfbf3de69cdbd4fdebJohn Hoford ImageButton mLeftButton; 317112720bc6100049d24845cfbf3de69cdbd4fdebJohn Hoford ImageButton mRightButton; 32235d2179374bec14040f20af91dc753e38ea3639John Hoford public ActionSlider() { 33235d2179374bec14040f20af91dc753e38ea3639John Hoford mLayoutID = R.layout.filtershow_control_action_slider; 34235d2179374bec14040f20af91dc753e38ea3639John Hoford } 35235d2179374bec14040f20af91dc753e38ea3639John Hoford 36235d2179374bec14040f20af91dc753e38ea3639John Hoford @Override 37235d2179374bec14040f20af91dc753e38ea3639John Hoford public void setUp(ViewGroup container, Parameter parameter, Editor editor) { 38235d2179374bec14040f20af91dc753e38ea3639John Hoford super.setUp(container, parameter, editor); 397112720bc6100049d24845cfbf3de69cdbd4fdebJohn Hoford mLeftButton = (ImageButton) mTopView.findViewById(R.id.leftActionButton); 407112720bc6100049d24845cfbf3de69cdbd4fdebJohn Hoford mLeftButton.setOnClickListener(new OnClickListener() { 41235d2179374bec14040f20af91dc753e38ea3639John Hoford 42235d2179374bec14040f20af91dc753e38ea3639John Hoford @Override 43235d2179374bec14040f20af91dc753e38ea3639John Hoford public void onClick(View v) { 447112720bc6100049d24845cfbf3de69cdbd4fdebJohn Hoford ((ParameterActionAndInt) mParameter).fireLeftAction(); 45235d2179374bec14040f20af91dc753e38ea3639John Hoford } 46235d2179374bec14040f20af91dc753e38ea3639John Hoford }); 477112720bc6100049d24845cfbf3de69cdbd4fdebJohn Hoford 487112720bc6100049d24845cfbf3de69cdbd4fdebJohn Hoford mRightButton = (ImageButton) mTopView.findViewById(R.id.rightActionButton); 497112720bc6100049d24845cfbf3de69cdbd4fdebJohn Hoford mRightButton.setOnClickListener(new OnClickListener() { 507112720bc6100049d24845cfbf3de69cdbd4fdebJohn Hoford 517112720bc6100049d24845cfbf3de69cdbd4fdebJohn Hoford @Override 527112720bc6100049d24845cfbf3de69cdbd4fdebJohn Hoford public void onClick(View v) { 537112720bc6100049d24845cfbf3de69cdbd4fdebJohn Hoford ((ParameterActionAndInt) mParameter).fireRightAction(); 547112720bc6100049d24845cfbf3de69cdbd4fdebJohn Hoford } 557112720bc6100049d24845cfbf3de69cdbd4fdebJohn Hoford }); 567112720bc6100049d24845cfbf3de69cdbd4fdebJohn Hoford updateUI(); 57235d2179374bec14040f20af91dc753e38ea3639John Hoford } 58235d2179374bec14040f20af91dc753e38ea3639John Hoford 59235d2179374bec14040f20af91dc753e38ea3639John Hoford @Override 60235d2179374bec14040f20af91dc753e38ea3639John Hoford public void updateUI() { 61235d2179374bec14040f20af91dc753e38ea3639John Hoford super.updateUI(); 627112720bc6100049d24845cfbf3de69cdbd4fdebJohn Hoford if (mLeftButton != null) { 637112720bc6100049d24845cfbf3de69cdbd4fdebJohn Hoford int iconId = ((ParameterActionAndInt) mParameter).getLeftIcon(); 647112720bc6100049d24845cfbf3de69cdbd4fdebJohn Hoford mLeftButton.setImageResource(iconId); 657112720bc6100049d24845cfbf3de69cdbd4fdebJohn Hoford } 667112720bc6100049d24845cfbf3de69cdbd4fdebJohn Hoford if (mRightButton != null) { 677112720bc6100049d24845cfbf3de69cdbd4fdebJohn Hoford int iconId = ((ParameterActionAndInt) mParameter).getRightIcon(); 687112720bc6100049d24845cfbf3de69cdbd4fdebJohn Hoford mRightButton.setImageResource(iconId); 69235d2179374bec14040f20af91dc753e38ea3639John Hoford } 70235d2179374bec14040f20af91dc753e38ea3639John Hoford } 71235d2179374bec14040f20af91dc753e38ea3639John Hoford} 72