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.PathDashPathEffect 26 * 27 * Through the layoutlib_create tool, the original native methods of PathDashPathEffect 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 PathDashPathEffect 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 PathDashPathEffect_Delegate extends PathEffect_Delegate { 41 42 // ---- delegate data ---- 43 44 // ---- Public Helper methods ---- 45 46 @Override getStroke(Paint_Delegate paint)47 public Stroke getStroke(Paint_Delegate paint) { 48 // FIXME 49 return null; 50 } 51 52 @Override isSupported()53 public boolean isSupported() { 54 return false; 55 } 56 57 @Override getSupportMessage()58 public String getSupportMessage() { 59 return "Path Dash Path Effects are not supported in Layout Preview mode."; 60 } 61 62 // ---- native methods ---- 63 64 @LayoutlibDelegate nativeCreate(long native_path, float advance, float phase, int native_style)65 /*package*/ static long nativeCreate(long native_path, float advance, float phase, 66 int native_style) { 67 PathDashPathEffect_Delegate newDelegate = new PathDashPathEffect_Delegate(); 68 return sManager.addNewDelegate(newDelegate); 69 } 70 71 // ---- Private delegate/helper methods ---- 72 } 73