1 /* 2 * Copyright (C) 2010 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 android.graphics; 18 19 import com.android.layoutlib.bridge.impl.DelegateManager; 20 import com.android.tools.layoutlib.annotations.LayoutlibDelegate; 21 22 import java.awt.Stroke; 23 24 /** 25 * Delegate implementing the native methods of android.graphics.SumPathEffect 26 * 27 * Through the layoutlib_create tool, the original native methods of SumPathEffect have been 28 * replaced by calls to methods of the same name in this delegate class. 29 * 30 * This class behaves like the original native implementation, but in Java, keeping previously 31 * native data into its own objects and mapping them to int that are sent back and forth between 32 * it and the original SumPathEffect class. 33 * 34 * Because this extends {@link PathEffect_Delegate}, there's no need to use a {@link DelegateManager}, 35 * as all the Shader classes will be added to the manager owned by {@link PathEffect_Delegate}. 36 * 37 * @see PathEffect_Delegate 38 * 39 */ 40 public class SumPathEffect_Delegate extends PathEffect_Delegate { 41 42 // ---- delegate data ---- 43 44 // ---- Public Helper methods ---- 45 46 @Override 47 public Stroke getStroke(Paint_Delegate paint) { 48 // FIXME 49 return null; 50 } 51 52 @Override 53 public boolean isSupported() { 54 return false; 55 } 56 57 @Override 58 public String getSupportMessage() { 59 return "Sum Path Effects are not supported in Layout Preview mode."; 60 } 61 62 // ---- native methods ---- 63 64 @LayoutlibDelegate 65 /*package*/ static long nativeCreate(long first, long second) { 66 SumPathEffect_Delegate newDelegate = new SumPathEffect_Delegate(); 67 return sManager.addNewDelegate(newDelegate); 68 } 69 70 // ---- Private delegate/helper methods ---- 71 } 72