• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java PieSlice类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.echo.holographlibrary.PieSlice的典型用法代码示例。如果您正苦于以下问题:Java PieSlice类的具体用法?Java PieSlice怎么用?Java PieSlice使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



PieSlice类属于com.echo.holographlibrary包,在下文中一共展示了PieSlice类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: onProgressUpdate

import com.echo.holographlibrary.PieSlice; //导入依赖的package包/类
@Override
protected void onProgressUpdate(Void... values)
{
	pg.addSlice(slice);
	pg.addSlice(_slice);
	pg.setInnerCircleRatio(150);
    for (PieSlice s : pg.getSlices())
         s.setGoalValue(s.getValue());
    pg.setDuration(1000);
    pg.setInterpolator(new AccelerateDecelerateInterpolator());
    pg.animateToGoalValues();
    pg.setPadding(3);
	info.clear();
	RAMManagement.this.values.clear();
	info.add(getString(R.string.total_ram));
	RAMManagement.this.values.add(total+" MB");
	info.add(getString(R.string.available_ram));
	RAMManagement.this.values.add(free+" MB");
	info.add(getString(R.string.used_ram));
	RAMManagement.this.values.add((total-free)+" MB");
	((TextView)rootView.findViewById(R.id.textView3)).setText(rate + " %");
	initCard(info,RAMManagement.this.values);

}
 
开发者ID:Daniele-Comi,项目名称:System-Monitor,代码行数:25,代码来源:RAMManagement.java


示例2: createPieForGraph

import com.echo.holographlibrary.PieSlice; //导入依赖的package包/类
private PieSlice createPieForGraph(String colorCode, String title, int value) {
    PieSlice slice = new PieSlice();
    slice.setColor(Color.parseColor(colorCode));
    slice.setTitle(title);
    slice.setValue(value);
    return slice;
}
 
开发者ID:android-opensource-library-56,项目名称:android-opensource-library-56,代码行数:8,代码来源:HoloGraphLibrarySampleActivity.java


示例3: onStart

import com.echo.holographlibrary.PieSlice; //导入依赖的package包/类
@Override
public void onStart(Intent intent, int startId)
{
    broadcastReceiver=new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            if(remoteViews==null||context==null||appWidgetManager==null||!mPower.isScreenOn())
                return;
            int batteryPct=intent.getIntExtra("level",100);
            PieSlice slice=new PieSlice(),_slice=new PieSlice();
            slice.setColor(Color.parseColor("#99CC00"));
            slice.setValue(batteryPct);
            _slice.setColor(Color.parseColor("#0099CC00"));
            _slice.setValue(100 - batteryPct + 0.00001f);
            pieGraph=new PieGraph(context);
            pieGraph.measure(200, 200);
            pieGraph.layout(0, 0, 200, 200);
            pieGraph.setDrawingCacheEnabled(true);
            pieGraph.addSlice(slice);
            pieGraph.addSlice(_slice);
            pieGraph.setInnerCircleRatio(150);
            for (PieSlice s : pieGraph.getSlices())
                s.setGoalValue(s.getValue());
            pieGraph.setDuration(1000);
            pieGraph.setInterpolator(new AccelerateDecelerateInterpolator());
            pieGraph.animateToGoalValues();
            pieGraph.setPadding(3);
            Bitmap bitmap=pieGraph.getDrawingCache();
            Canvas canvas=new Canvas(bitmap);
            Paint paint=new Paint(Paint.ANTI_ALIAS_FLAG);
            paint.setColor(Color.BLACK);
            paint.setTextSize(18);
            paint.setShadowLayer(1f,0f,1f,Color.WHITE);
            Rect bounds=new Rect();
            paint.getTextBounds(batteryPct+" %",0,new String(batteryPct+" %").length(),bounds);
            int x=(bitmap.getWidth()-bounds.width())/2;
            int y=(bitmap.getHeight()+bounds.height())/2;
            canvas.drawText(batteryPct+" %",x,y,paint);
            if(remoteViews!=null&&appWidgetManager!=null&&context!=null) {
                remoteViews.setImageViewBitmap(R.id.widget_battery_graph, bitmap);
                remoteViews.setTextViewText(R.id.widget_battery_voltage, getString(R.string.voltage)+" : " + intent.getIntExtra(BatteryManager.EXTRA_VOLTAGE, 0) + " mV");
                remoteViews.setTextViewText(R.id.widget_battery_source, getString(R.string.ba_power_source)+" : " + (intent.getIntExtra(BatteryManager.EXTRA_PLUGGED, 0) == 0 ? "Battery" : "Charge"));
                remoteViews.setTextViewText(R.id.widget_battery_type, getString(R.string.ba_type)+" : "+ intent.getExtras().getString(BatteryManager.EXTRA_TECHNOLOGY));
                remoteViews.setTextViewText(R.id.widget_battery_temperature, getString(R.string.temperature)+" : " + ((float) intent.getIntExtra(BatteryManager.EXTRA_TEMPERATURE, 0) / 10) + " °C");
                remoteViews.setTextViewText(R.id.widget_battery_health, getString(R.string.health)+" : " + getBatteryHealth(intent.getIntExtra(BatteryManager.EXTRA_HEALTH, 0)));
                appWidgetManager.updateAppWidget(widget, remoteViews);
            }
            pieGraph.removeSlices();
        }
    };
    if(context!=null)
        context.getApplicationContext().registerReceiver(broadcastReceiver, new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
}
 
开发者ID:Daniele-Comi,项目名称:System-Monitor,代码行数:54,代码来源:BatteryWidget.java


示例4: onCreateView

import com.echo.holographlibrary.PieSlice; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState)
{
	rootView=inflater.inflate(R.layout.fragment_battery,container,false);
	getActivity().setTitle(getString(R.string.battery));
	IntentFilter ifilter=new IntentFilter(Intent.ACTION_BATTERY_CHANGED);
   	batteryPct=-1;
   	pieGraph=(PieGraph)rootView.findViewById(R.id.graph);
   	batteryInfo=new BroadcastReceiver() {
   		   public void onReceive(Context context, Intent intent) {
   				   batteryPct=intent.getIntExtra("level",100);
   				   pieGraph.removeSlices();
   				   PieSlice slice=new PieSlice(),_slice=new PieSlice();
   			       slice.setColor(Color.parseColor("#99CC00"));
   			       slice.setValue(batteryPct);
   			       _slice.setColor(Color.parseColor("#0099CC00"));
   			       _slice.setValue(100-batteryPct+0.00001f);
   			       pieGraph.addSlice(slice);
   			       pieGraph.addSlice(_slice);
   			       pieGraph.setInnerCircleRatio(150);
   			   	   for(PieSlice s : pieGraph.getSlices())
   			   		   s.setGoalValue(s.getValue());
   			   	   pieGraph.setDuration(1000);
   			   	   pieGraph.setInterpolator(new AccelerateDecelerateInterpolator());
   			   	   pieGraph.animateToGoalValues();
   				   ((TextView)rootView.findViewById(R.id.textView1)).setText(batteryPct+" %");
   				   int health=intent.getIntExtra(BatteryManager.EXTRA_HEALTH,0);
   				   int plugged=intent.getIntExtra(BatteryManager.EXTRA_PLUGGED,0);
   				   String technology=intent.getExtras().getString(BatteryManager.EXTRA_TECHNOLOGY);
   				   float temperature=intent.getIntExtra(BatteryManager.EXTRA_TEMPERATURE,0);
   				   int voltage=intent.getIntExtra(BatteryManager.EXTRA_VOLTAGE,0);
   				   ArrayList<String> info=new ArrayList<String>(),value=new ArrayList<String>();
   				   info.add(getString(R.string.ba_power_source));
   				   value.add(plugged==0 ? getString(R.string.battery) : getString(R.string.charge));
   				   info.add(getString(R.string.ba_type));
   				   value.add(technology);
   				   info.add(getString(R.string.temperature));
   				   value.add((temperature/10)+" °C");
   				   info.add(getString(R.string.voltage));
   				   value.add(voltage+" mV");
   				   info.add(getString(R.string.health));
   				   value.add(getBatteryHealth(health));
   				   initCard(info,value);
   		     }
   	};
   	getActivity().registerReceiver(batteryInfo,new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
	return rootView;
}
 
开发者ID:Daniele-Comi,项目名称:System-Monitor,代码行数:49,代码来源:BatteryManagement.java



注:本文中的com.echo.holographlibrary.PieSlice类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java PropertyAccessor类代码示例发布时间:1970-01-01
下一篇:
Java Union类代码示例发布时间:1970-01-01
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap