Java Code Examples for com.ingenic.iwds.slpt.view.core.SlptLinearLayout#setTextAttrForAll()

The following examples show how to use com.ingenic.iwds.slpt.view.core.SlptLinearLayout#setTextAttrForAll() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HeartRateWidget.java    From AmazfitAPKs with Apache License 2.0 6 votes vote down vote up
@Override
public List<SlptViewComponent> buildSlptViewComponent(Service service) {
    SlptLinearLayout heart = new SlptLinearLayout();
    SlptPictureView bpm = new SlptPictureView();
    bpm.setStringPicture(" bpm");
    heart.add(new SlptLastHeartRateView());
    heart.add(bpm);
    heart.setTextAttrForAll(
            service.getResources().getDimension(R.dimen.circles_font_size_slpt),
            -16777216,
            ResourceManager.getTypeFace(service.getResources(), ResourceManager.Font.PROTOTYPE_SOURCE)
    );
    heart.setStart(
            (int) service.getResources().getDimension(R.dimen.heart_rate_text_left_slpt),
            (int) service.getResources().getDimension(R.dimen.heart_rate_text_top_slpt));
    heart.alignX= 2;
    heart.alignY= 0;
    heart.setRect(100, 30);
    return Collections.<SlptViewComponent>singletonList(heart);
}
 
Example 2
Source File: CaloriesWidget.java    From AmazfitAPKs with Apache License 2.0 6 votes vote down vote up
@Override
public List<SlptViewComponent> buildSlptViewComponent(Service service) {
    SlptLinearLayout caloriesLayout = new SlptLinearLayout();
    SlptPictureView caloriesUnit = new SlptPictureView();
    caloriesUnit.setStringPicture(" kcal");
    caloriesLayout.add(new SlptTodayCaloriesView());
    caloriesLayout.add(caloriesUnit);
    caloriesLayout.setStart(
            (int) service.getResources().getDimension(R.dimen.calories_text_left_slpt),
            (int) service.getResources().getDimension(R.dimen.calories_text_top_slpt)
    );
    Typeface caloriesFont = ResourceManager.getTypeFace(service.getResources(), ResourceManager.Font.PROTOTYPE_SOURCE);
    caloriesLayout.setTextAttrForAll(
            service.getResources().getDimension(R.dimen.circles_font_size_slpt),
            -16777216 ,
            caloriesFont
    );
    caloriesLayout.alignX = 2;
    caloriesLayout.alignY = 0;
    caloriesLayout.setRect(80,23);

    return Collections.<SlptViewComponent>singletonList(caloriesLayout);
}
 
Example 3
Source File: HeartRateWidget.java    From AmazfitAPKs with Apache License 2.0 6 votes vote down vote up
@Override
public List<SlptViewComponent> buildSlptViewComponent(Service service) {
    SlptLinearLayout heart = new SlptLinearLayout();
    heart.add(new SlptLastHeartRateView());
    heart.setTextAttrForAll(
            service.getResources().getDimension(R.dimen.circles_font_size_slpt),
            -16777216,
            ResourceManager.getTypeFace(service.getResources(), ResourceManager.Font.BEBAS_NEUE)
    );
    heart.setStart(
            (int) service.getResources().getDimension(R.dimen.widget_text_left_slpt),
            (int) service.getResources().getDimension(R.dimen.widget_text_top_slpt));
    heart.alignX=2;
    heart.alignY=0;
    heart.setRect(60,60);
    return Collections.<SlptViewComponent>singletonList(heart);
}
 
Example 4
Source File: CaloriesWidget.java    From AmazfitAPKs with Apache License 2.0 6 votes vote down vote up
@Override
public List<SlptViewComponent> buildSlptViewComponent(Service service) {
    SlptLinearLayout caloriesLayout = new SlptLinearLayout();
    SlptPictureView caloriesUnit = new SlptPictureView();
    caloriesUnit.setStringPicture(" kcal");
    caloriesLayout.add(new SlptTodayCaloriesView());
    caloriesLayout.add(caloriesUnit);
    caloriesLayout.setStart(
            (int) service.getResources().getDimension(R.dimen.widget_text_left_slpt),
            (int) service.getResources().getDimension(R.dimen.widget_text_top_slpt)
    );
    Typeface caloriesFont = ResourceManager.getTypeFace(service.getResources(), ResourceManager.Font.BEBAS_NEUE);
    caloriesLayout.setTextAttrForAll(
            service.getResources().getDimension(R.dimen.circles_font_size_slpt),
            -16777216 ,
            caloriesFont
    );
    caloriesLayout.alignX = 2;
    caloriesLayout.alignY = 0;
    caloriesLayout.setRect(60,60);

    return Collections.<SlptViewComponent>singletonList(caloriesLayout);
}
 
Example 5
Source File: ThreeLinesStepsWidget.java    From AmazfitAPKs with Apache License 2.0 6 votes vote down vote up
@Override
public List<SlptViewComponent> buildSlptViewComponent(Service service) {
    init(service);

    final float totalHeight = fontHeight * nLines - verticalOffset;
    final float x = 160;
    float y = 160 - totalHeight/2 ;

    SlptLinearLayout steps = new SlptLinearLayout();
    steps.add(new SlptTodayStepNumView());
    steps.setTextAttrForAll(
            service.getResources().getDimension(R.dimen.threelines_font_size),
            service.getResources().getColor(R.color.threelines_steps_color),
            ResourceManager.getTypeFace(service.getResources(), ResourceManager.Font.OPEN24)
    );
    steps.centerHorizontal = 1;

    y += fontHeight*2;

    steps.setStart((int)x,(int)y);

    return Collections.<SlptViewComponent>singletonList(steps);
}
 
Example 6
Source File: HeartRateWidget.java    From malvarez-watchface with Apache License 2.0 5 votes vote down vote up
@Override
public List<SlptViewComponent> buildSlptViewComponent(Service service) {
    SlptLinearLayout heart = new SlptLinearLayout();
    heart.add(new SlptLastHeartRateView());
    heart.setTextAttrForAll(
            service.getResources().getDimension(R.dimen.malvarez_circles_font_size_slpt),
            -1,
            ResourceManager.getTypeFace(service.getResources(), ResourceManager.Font.BEBAS_NEUE)
    );
    heart.setStart(
            (int) service.getResources().getDimension(R.dimen.malvarez_heart_rate_text_left_slpt),
            (int) service.getResources().getDimension(R.dimen.malvarez_heart_rate_text_top_slpt));
    return Collections.<SlptViewComponent>singletonList(heart);
}
 
Example 7
Source File: HeartRateWidget.java    From xDrip-Watchface with Apache License 2.0 5 votes vote down vote up
@Override
public List<SlptViewComponent> buildSlptViewComponent(Service service) {
    SlptLinearLayout heart = new SlptLinearLayout();
    heart.add(new SlptLastHeartRateView());
    // Show or Not Units
    if(service.getResources().getBoolean(R.bool.heart_rate_units)) {
        SlptPictureView bpm = new SlptPictureView();
        bpm.setStringPicture(" bpm");
        heart.add(bpm);
    }
    heart.setTextAttrForAll(
            service.getResources().getDimension(R.dimen.heart_rate_font_size),
            service.getResources().getColor(R.color.heart_colour_slpt),
            ResourceManager.getTypeFace(service.getResources(), ResourceManager.Font.MONO_SPACE)
    );
    // Position based on screen on
    heart.alignX = 2;
    heart.alignY = 0;
    int tmp_left = (int) service.getResources().getDimension(R.dimen.heart_rate_text_left);
    if(!service.getResources().getBoolean(R.bool.heart_rate_left_align)) {
        // If text is centered, set rectangle
        heart.setRect(
                (int) (2 * tmp_left + 640),
                (int) (service.getResources().getDimension(R.dimen.heart_rate_font_size))
        );
        tmp_left = -320;
    }
    heart.setStart(
            tmp_left,
            (int) (service.getResources().getDimension(R.dimen.heart_rate_text_top)-((float)service.getResources().getInteger(R.integer.font_ratio)/100)*service.getResources().getDimension(R.dimen.heart_rate_font_size))
    );
    // Hide if disabled
    if(!service.getResources().getBoolean(R.bool.heart_rate)){heart.show=false;}

    return Collections.<SlptViewComponent>singletonList(heart);
}
 
Example 8
Source File: HeartRateWidget.java    From AmazfitAPKs with Apache License 2.0 5 votes vote down vote up
@Override
public List<SlptViewComponent> buildSlptViewComponent(Service service) {
    SlptLinearLayout heart = new SlptLinearLayout();
    heart.add(new SlptLastHeartRateView());
    heart.setTextAttrForAll(
            service.getResources().getDimension(R.dimen.malvarez_circles_font_size_slpt),
            -1,
            ResourceManager.getTypeFace(service.getResources(), ResourceManager.Font.BEBAS_NEUE)
    );
    heart.setStart(
            (int) service.getResources().getDimension(R.dimen.malvarez_heart_rate_text_left_slpt),
            (int) service.getResources().getDimension(R.dimen.malvarez_heart_rate_text_top_slpt));
    return Collections.<SlptViewComponent>singletonList(heart);
}
 
Example 9
Source File: ThreeLines.java    From AmazfitAPKs with Apache License 2.0 5 votes vote down vote up
private SlptViewComponent buildTimeView(Service service, int x, int y) {
    SlptLinearLayout var21 = new SlptLinearLayout();
    SlptHourHView var32 = new SlptHourHView();
    SlptHourLView var33 = new SlptHourLView();
    SlptPictureView var27 =  new SlptPictureView();
    SlptMinuteHView var34 = new SlptMinuteHView();
    SlptMinuteLView var35 = new SlptMinuteLView();

    var27.setImagePicture(SimpleFile.readFileFromAssets(service.getApplicationContext(), "dots-62.png"));

    // linear: hh:mm
    var21.add(var32);
    var21.add(var33);
    var21.add(var27);
    var21.add(var34);
    var21.add(var35);

    var21.setTextAttrForAll(
            service.getResources().getDimension(R.dimen.threelines_font_size),
            service.getResources().getColor(R.color.threelines_time_color),
            ResourceManager.getTypeFace(service.getResources(), ResourceManager.Font.OPEN24)
    );
    Utility.setStringPictureArrayForAll(var21, this.digitalNums);
    var21.setStart(x, y);
    var21.centerHorizontal = 1;
    var21.alignX = 2;
    var21.alignY = 1;

    return var21;
}
 
Example 10
Source File: ThreeLines.java    From AmazfitAPKs with Apache License 2.0 5 votes vote down vote up
private SlptViewComponent buildDateView(Service service, int x, int y) {
    SlptLinearLayout var21 = new SlptLinearLayout();
    SlptMonthHView var34 = new SlptMonthHView();
    SlptMonthLView var35 = new SlptMonthLView();
    SlptDayHView var32 = new SlptDayHView();
    SlptDayLView var33 = new SlptDayLView();
    SlptPictureView var27 =  new SlptPictureView();

    var27.setImagePicture(SimpleFile.readFileFromAssets(service.getApplicationContext(), "slash-62-red.png"));


    // linear: hh:mm
    var21.add(var32);
    var21.add(var33);
    var21.add(var27);
    var21.add(var34);
    var21.add(var35);

    var21.setTextAttrForAll(
            service.getResources().getDimension(R.dimen.threelines_font_size),
            service.getResources().getColor(R.color.threelines_date_color),
            ResourceManager.getTypeFace(service.getResources(), ResourceManager.Font.OPEN24)
    );
    Utility.setStringPictureArrayForAll(var21, this.digitalNums);
    var21.setStart(x, y);
    var21.centerHorizontal = 1;
    var21.alignX = 2;
    var21.alignY = 1;

    return var21;
}
 
Example 11
Source File: CirclesWidget.java    From AmazfitAPKs with Apache License 2.0 5 votes vote down vote up
@Override
public List<SlptViewComponent> buildSlptViewComponent(Service service) {
    Typeface timeTypeFace = ResourceManager.getTypeFace(service.getResources(), ResourceManager.Font.BEBAS_NEUE);

    SlptLinearLayout steps = new SlptLinearLayout();
    steps.alignX = 2;
    steps.alignY = 2;
    steps.add(new SlptTodayStepNumView());
    steps.setTextAttrForAll(
            service.getResources().getDimension(R.dimen.circles_font_size_slpt),
            -16777216 ,
            timeTypeFace
    );



    SlptPowerArcAnglePicView powerArcView = new SlptPowerArcAnglePicView();
    powerArcView.setImagePicture(Util.assetToBytes(service, "battery_splt.png"));
    powerArcView.start_angle = (int) startAngleBattery + 180 - 3;
    powerArcView.full_angle = (int) arcSizeBattery + 6;

    SlptTodayStepArcAnglePicView stepArcPicView = new SlptTodayStepArcAnglePicView();
    stepArcPicView.setImagePicture(Util.assetToBytes(service, "steps_splt.png"));
    stepArcPicView.start_angle = (int) startAngleSteps + 180 - 3;
    stepArcPicView.full_angle = (int) arcSizeSteps + 6;

    return Arrays.asList(steps, stepArcPicView, powerArcView);
}
 
Example 12
Source File: CirclesWidget.java    From AmazfitAPKs with Apache License 2.0 4 votes vote down vote up
@Override
public List<SlptViewComponent> buildSlptViewComponent(Service service) {
    Typeface timeTypeFace = ResourceManager.getTypeFace(service.getResources(), ResourceManager.Font.BEBAS_NEUE);

    SlptLinearLayout power = new SlptLinearLayout();
    power.alignX = 2;
    power.alignY = 2;
    power.add(new SlptPowerNumView());
    power.setTextAttrForAll(
            service.getResources().getDimension(R.dimen.malvarez_circles_font_size_slpt),
            -1,
            timeTypeFace
    );
    power.setStart(
            (int) service.getResources().getDimension(R.dimen.malvarez_battery_text_left_slpt),
            (int) service.getResources().getDimension(R.dimen.malvarez_battery_text_top_slpt));

    SlptLinearLayout steps = new SlptLinearLayout();
    steps.alignX = 2;
    steps.alignY = 2;
    steps.add(new SlptTodayStepNumView());
    steps.setTextAttrForAll(
            service.getResources().getDimension(R.dimen.malvarez_circles_font_size_slpt),
            -1,
            timeTypeFace
    );

    steps.setStart(
            (int) service.getResources().getDimension(R.dimen.malvarez_steps_text_left_slpt),
            (int) service.getResources().getDimension(R.dimen.malvarez_steps_text_top_slpt));

    SlptLinearLayout sport = new SlptLinearLayout();
    sport.add(new SlptTodaySportDistanceLView());
    sport.setTextAttrForAll(
            service.getResources().getDimension(R.dimen.malvarez_circles_font_size_slpt),
            -1,
            timeTypeFace
    );
    sport.setStart(
            (int) service.getResources().getDimension(R.dimen.malvarez_sport_text_left_slpt),
            (int) service.getResources().getDimension(R.dimen.malvarez_sport_text_top_slpt));

    SlptPowerArcAnglePicView powerArcView = new SlptPowerArcAnglePicView();
    powerArcView.setImagePicture(SimpleFile.readFileFromAssets(service.getApplicationContext(), "battery_splt.png"));
    powerArcView.start_angle = (int) startAngleBattery + 180 - 3;
    powerArcView.full_angle = (int) arcSizeBattery + 6;

    SlptTodayStepArcAnglePicView stepArcPicView = new SlptTodayStepArcAnglePicView();
    stepArcPicView.setImagePicture(SimpleFile.readFileFromAssets(service.getApplicationContext(), "steps_splt.png"));
    stepArcPicView.start_angle = (int) startAngleSteps + 180 - 3;
    stepArcPicView.full_angle = (int) arcSizeSteps + 6;


    SlptTodayDistanceArcAnglePicView distanceArcPicView = new SlptTodayDistanceArcAnglePicView();
    distanceArcPicView.setImagePicture(SimpleFile.readFileFromAssets(service.getApplicationContext(), "sports_splt.png"));
    distanceArcPicView.start_angle = (int) startAngleSport + 180 - 3;
    distanceArcPicView.full_angle = (int) arcSizeSport + 6;

    return Arrays.asList(power, steps, sport, powerArcView, stepArcPicView, distanceArcPicView);
}
 
Example 13
Source File: MalvarezClock.java    From AmazfitAPKs with Apache License 2.0 4 votes vote down vote up
@Override
public List<SlptViewComponent> buildSlptViewComponent(Service service) {
    SlptPictureView background = new SlptPictureView();
    background.setImagePicture(SimpleFile.readFileFromAssets(service.getApplicationContext(), "background_splt.png"));

    SlptLinearLayout hourLayout = new SlptLinearLayout();
    hourLayout.add(new SlptHourHView());
    hourLayout.add(new SlptHourLView());
    Utility.setStringPictureArrayForAll(hourLayout, this.digitalNums);

    SlptLinearLayout minuteLayout = new SlptLinearLayout();
    minuteLayout.add(new SlptMinuteHView());
    minuteLayout.add(new SlptMinuteLView());
    Utility.setStringPictureArrayForAll(minuteLayout, this.digitalNums);

    Typeface timeTypeFace = ResourceManager.getTypeFace(service.getResources(), ResourceManager.Font.BEBAS_NEUE);

    hourLayout.setTextAttrForAll(
            service.getResources().getDimension(R.dimen.malvarez_time_font_size),
            -1,
            timeTypeFace);
    minuteLayout.setTextAttrForAll(
            service.getResources().getDimension(R.dimen.malvarez_time_font_size),
            -65536,
            timeTypeFace);
    hourLayout.setStart(
            (int) service.getResources().getDimension(R.dimen.malvarez_time_hour_left_slpt),
            (int) service.getResources().getDimension(R.dimen.malvarez_time_hour_top_slpt));
    minuteLayout.setStart(
            (int) service.getResources().getDimension(R.dimen.malvarez_time_minute_left_slpt),
            (int) service.getResources().getDimension(R.dimen.malvarez_time_minute_top_slpt));


    SlptLinearLayout dayLayout = new SlptLinearLayout();
    dayLayout.add(new SlptDayHView());
    dayLayout.add(new SlptDayLView());

    SlptLinearLayout monthLayout = new SlptLinearLayout();
    monthLayout.add(new SlptMonthHView());
    monthLayout.add(new SlptMonthLView());

    SlptWeekView weekView = new SlptWeekView();

    for (SlptLayout component : Arrays.asList(monthLayout, dayLayout)) {
        component.setTextAttrForAll(
                service.getResources().getDimension(R.dimen.malvarez_date_font_size),
                -1,
                timeTypeFace
        );
    }
    weekView.setTextAttr(
            service.getResources().getDimension(R.dimen.malvarez_date_font_size),
            -1,
            timeTypeFace
    );

    dayLayout.setStart(
            (int) service.getResources().getDimension(R.dimen.malvarez_date_left_slpt),
            (int) service.getResources().getDimension(R.dimen.malvarez_date_top_slpt));
    monthLayout.setStart(
            (int) service.getResources().getDimension(R.dimen.malvarez_month_left_slpt),
            (int) service.getResources().getDimension(R.dimen.malvarez_month_top_slpt));
    weekView.setStart(
            (int) service.getResources().getDimension(R.dimen.malvarez_week_left_slpt),
            (int) service.getResources().getDimension(R.dimen.malvarez_week_top_slpt));

    return Arrays.asList(background, hourLayout, minuteLayout, dayLayout, monthLayout, weekView);
}
 
Example 14
Source File: MainClock.java    From AmazfitAPKs with Apache License 2.0 4 votes vote down vote up
@Override
public List<SlptViewComponent> buildSlptViewComponent(Service service) {
    SlptPictureView background = new SlptPictureView();
    background.setImagePicture(Util.assetToBytes(service, "background_heart_splt.png"));
    
    
    SlptLinearLayout hourLayout = new SlptLinearLayout();
    hourLayout.add(new SlptHourHView());
    hourLayout.add(new SlptHourLView());
    hourLayout.setStringPictureArrayForAll(this.digitalNums);

    SlptLinearLayout minuteLayout = new SlptLinearLayout();
    minuteLayout.add(new SlptMinuteHView());
    minuteLayout.add(new SlptMinuteLView());
    minuteLayout.setStringPictureArrayForAll(this.digitalNums);

    Typeface timeTypeFace = ResourceManager.getTypeFace(service.getResources(), ResourceManager.Font.BEBAS_NEUE);

    hourLayout.setTextAttrForAll(
            service.getResources().getDimension(R.dimen.time_font_size),
            -16777216,
            timeTypeFace);
    minuteLayout.setTextAttrForAll(
            service.getResources().getDimension(R.dimen.time_font_size),
            -65536,
            timeTypeFace);
    hourLayout.setStart(
            (int) service.getResources().getDimension(R.dimen.time_hour_left_slpt),
            (int) service.getResources().getDimension(R.dimen.time_hour_top_slpt));
    hourLayout.alignX = 2;
    hourLayout.alignY = 0;
    hourLayout.setRect(320,160);
    minuteLayout.setStart(
            (int) service.getResources().getDimension(R.dimen.time_minute_left_slpt),
            (int) service.getResources().getDimension(R.dimen.time_minute_top_slpt));
    minuteLayout.alignX=2;
    minuteLayout.alignY=0;
    minuteLayout.setRect(320,160);

    SlptPictureView dash = new SlptPictureView();
    dash.setStringPicture(" -");

    SlptLinearLayout dayLayout = new SlptLinearLayout();
    dayLayout.add(new SlptDayHView());
    dayLayout.add(new SlptDayLView());
    dayLayout.add(dash);

    SlptLinearLayout monthLayout = new SlptLinearLayout();
    monthLayout.add(new SlptMonthHView());
    monthLayout.add(new SlptMonthLView());



    for (SlptLayout component : Arrays.asList(monthLayout, dayLayout)) {
        component.setTextAttrForAll(
                service.getResources().getDimension(R.dimen.date_font_size),
                -16777216,
                timeTypeFace
        );
    }

    dayLayout.setStart(
            (int) service.getResources().getDimension(R.dimen.date_left_slpt),
            (int) service.getResources().getDimension(R.dimen.date_top_slpt));
    monthLayout.setStart(
            (int) service.getResources().getDimension(R.dimen.month_left_slpt),
            (int) service.getResources().getDimension(R.dimen.month_top_slpt));


    SlptLinearLayout WeekdayLayout = new SlptLinearLayout();
    WeekdayLayout.add(new SlptWeekView());
    WeekdayLayout.setStart(
            (int) service.getResources().getDimension(R.dimen.week_left_slpt),
            (int) service.getResources().getDimension(R.dimen.week_top_slpt));
    WeekdayLayout.setTextAttrForAll(service.getResources().getDimension(R.dimen.date_font_size),
            -16777216,
            timeTypeFace
    );
    WeekdayLayout.alignX = (byte) 2;
    WeekdayLayout.alignY = (byte) 0;
    WeekdayLayout.setRect(50, 40);
    return Arrays.asList(background, hourLayout, minuteLayout, dayLayout, monthLayout, WeekdayLayout);
}
 
Example 15
Source File: CirclesWidget.java    From malvarez-watchface with Apache License 2.0 4 votes vote down vote up
@Override
public List<SlptViewComponent> buildSlptViewComponent(Service service) {
    Typeface timeTypeFace = ResourceManager.getTypeFace(service.getResources(), ResourceManager.Font.BEBAS_NEUE);

    SlptLinearLayout power = new SlptLinearLayout();
    power.alignX = 2;
    power.alignY = 2;
    power.add(new SlptPowerNumView());
    power.setTextAttrForAll(
            service.getResources().getDimension(R.dimen.malvarez_circles_font_size_slpt),
            -1,
            timeTypeFace
    );
    power.setStart(
            (int) service.getResources().getDimension(R.dimen.malvarez_battery_text_left_slpt),
            (int) service.getResources().getDimension(R.dimen.malvarez_battery_text_top_slpt));

    SlptLinearLayout steps = new SlptLinearLayout();
    steps.alignX = 2;
    steps.alignY = 2;
    steps.add(new SlptTodayStepNumView());
    steps.setTextAttrForAll(
            service.getResources().getDimension(R.dimen.malvarez_circles_font_size_slpt),
            -1,
            timeTypeFace
    );

    steps.setStart(
            (int) service.getResources().getDimension(R.dimen.malvarez_steps_text_left_slpt),
            (int) service.getResources().getDimension(R.dimen.malvarez_steps_text_top_slpt));

    SlptLinearLayout sport = new SlptLinearLayout();
    sport.add(new SlptTodaySportDistanceLView());
    sport.setTextAttrForAll(
            service.getResources().getDimension(R.dimen.malvarez_circles_font_size_slpt),
            -1,
            timeTypeFace
    );
    sport.setStart(
            (int) service.getResources().getDimension(R.dimen.malvarez_sport_text_left_slpt),
            (int) service.getResources().getDimension(R.dimen.malvarez_sport_text_top_slpt));

    SlptPowerArcAnglePicView powerArcView = new SlptPowerArcAnglePicView();
    powerArcView.setImagePicture(Util.assetToBytes(service, "battery_splt.png"));
    powerArcView.start_angle = (int) startAngleBattery + 180 - 3;
    powerArcView.full_angle = (int) arcSizeBattery + 6;

    SlptTodayStepArcAnglePicView stepArcPicView = new SlptTodayStepArcAnglePicView();
    stepArcPicView.setImagePicture(Util.assetToBytes(service, "steps_splt.png"));
    stepArcPicView.start_angle = (int) startAngleSteps + 180 - 3;
    stepArcPicView.full_angle = (int) arcSizeSteps + 6;


    SlptTodayDistanceArcAnglePicView distanceArcPicView = new SlptTodayDistanceArcAnglePicView();
    distanceArcPicView.setImagePicture(Util.assetToBytes(service, "sports_splt.png"));
    distanceArcPicView.start_angle = (int) startAngleSport + 180 - 3;
    distanceArcPicView.full_angle = (int) arcSizeSport + 6;

    return Arrays.asList(power, steps, sport, powerArcView, stepArcPicView, distanceArcPicView);
}
 
Example 16
Source File: MalvarezClock.java    From malvarez-watchface with Apache License 2.0 4 votes vote down vote up
@Override
public List<SlptViewComponent> buildSlptViewComponent(Service service) {
    SlptPictureView background = new SlptPictureView();
    background.setImagePicture(Util.assetToBytes(service, "background_splt.png"));

    SlptLinearLayout hourLayout = new SlptLinearLayout();
    hourLayout.add(new SlptHourHView());
    hourLayout.add(new SlptHourLView());
    hourLayout.setStringPictureArrayForAll(this.digitalNums);

    SlptLinearLayout minuteLayout = new SlptLinearLayout();
    minuteLayout.add(new SlptMinuteHView());
    minuteLayout.add(new SlptMinuteLView());
    minuteLayout.setStringPictureArrayForAll(this.digitalNums);

    Typeface timeTypeFace = ResourceManager.getTypeFace(service.getResources(), ResourceManager.Font.BEBAS_NEUE);

    hourLayout.setTextAttrForAll(
            service.getResources().getDimension(R.dimen.malvarez_time_font_size),
            -1,
            timeTypeFace);
    minuteLayout.setTextAttrForAll(
            service.getResources().getDimension(R.dimen.malvarez_time_font_size),
            -65536,
            timeTypeFace);
    hourLayout.setStart(
            (int) service.getResources().getDimension(R.dimen.malvarez_time_hour_left_slpt),
            (int) service.getResources().getDimension(R.dimen.malvarez_time_hour_top_slpt));
    minuteLayout.setStart(
            (int) service.getResources().getDimension(R.dimen.malvarez_time_minute_left_slpt),
            (int) service.getResources().getDimension(R.dimen.malvarez_time_minute_top_slpt));


    SlptLinearLayout dayLayout = new SlptLinearLayout();
    dayLayout.add(new SlptDayHView());
    dayLayout.add(new SlptDayLView());

    SlptLinearLayout monthLayout = new SlptLinearLayout();
    monthLayout.add(new SlptMonthHView());
    monthLayout.add(new SlptMonthLView());

    SlptWeekView weekView = new SlptWeekView();

    for (SlptLayout component : Arrays.asList(monthLayout, dayLayout)) {
        component.setTextAttrForAll(
                service.getResources().getDimension(R.dimen.malvarez_date_font_size),
                -1,
                timeTypeFace
        );
    }
    weekView.setTextAttr(
            service.getResources().getDimension(R.dimen.malvarez_date_font_size),
            -1,
            timeTypeFace
    );

    dayLayout.setStart(
            (int) service.getResources().getDimension(R.dimen.malvarez_date_left_slpt),
            (int) service.getResources().getDimension(R.dimen.malvarez_date_top_slpt));
    monthLayout.setStart(
            (int) service.getResources().getDimension(R.dimen.malvarez_month_left_slpt),
            (int) service.getResources().getDimension(R.dimen.malvarez_month_top_slpt));
    weekView.setStart(
            (int) service.getResources().getDimension(R.dimen.malvarez_week_left_slpt),
            (int) service.getResources().getDimension(R.dimen.malvarez_week_top_slpt));

    return Arrays.asList(background, hourLayout, minuteLayout, dayLayout, monthLayout, weekView);
}
 
Example 17
Source File: CirclesWidget.java    From AmazfitAPKs with Apache License 2.0 4 votes vote down vote up
@Override
public List<SlptViewComponent> buildSlptViewComponent(Service service) {
    Typeface timeTypeFace = ResourceManager.getTypeFace(service.getResources(), ResourceManager.Font.PROTOTYPE_SOURCE);

    SlptPictureView point = new SlptPictureView();
    point.setStringPicture(".");

    SlptLinearLayout power = new SlptLinearLayout();
    SlptPictureView percentage = new SlptPictureView();
    percentage.setStringPicture("%");
    power.alignX = 2;
    power.alignY = 2;
    power.add(new SlptPowerNumView());
    power.add(percentage);
    power.setTextAttrForAll(
            service.getResources().getDimension(R.dimen.circles_font_size_slpt),
            -16777216,
            timeTypeFace
    );
    power.setStart(
            (int) service.getResources().getDimension(R.dimen.battery_text_left_slpt),
            (int) service.getResources().getDimension(R.dimen.battery_text_top_slpt));
    power.alignX= 2;
    power.alignY= 0;
    power.setRect(50, 30);

    SlptLinearLayout steps = new SlptLinearLayout();
    steps.alignX = (byte)1;
    steps.alignY = (byte)2;
   
    steps.add(new SlptTodayStepNumView());
    steps.setTextAttrForAll(
            service.getResources().getDimension(R.dimen.circles_font_size_slpt),
            -16777216,
            timeTypeFace
    );

    steps.setStart(
            (int) service.getResources().getDimension(R.dimen.steps_text_left_slpt),
            (int) service.getResources().getDimension(R.dimen.steps_text_top_slpt));
    steps.alignX= (byte) 2;
    steps.alignY= (byte) 2;
    steps.setRect(64,22);

    SlptLinearLayout sport = new SlptLinearLayout();
    sport.add(new SlptTodaySportDistanceFView());
    sport.add(point);
    sport.add(new SlptTodaySportDistanceLView());
    sport.setTextAttrForAll(
            service.getResources().getDimension(R.dimen.circles_font_size_slpt),
            -16777216,
            timeTypeFace
    );
    sport.setStart(
            (int) service.getResources().getDimension(R.dimen.sport_text_left_slpt),
            (int) service.getResources().getDimension(R.dimen.sport_text_top_slpt));


    SlptLinearLayout road = new SlptLinearLayout();
    SlptPictureView kilometer = new SlptPictureView();
    kilometer.setStringPicture(" km");
    road.add(new SlptTotalDistanceFView());
    road.add(point);
    road.add(new SlptTotalDistanceLView());
    road.add(kilometer);
    road.setTextAttrForAll(
            service.getResources().getDimension(R.dimen.circles_font_size_slpt),-16777216,timeTypeFace
    );
    road.setStart(
            (int) service.getResources().getDimension(R.dimen.road_text_left_slpt),
            (int) service.getResources().getDimension(R.dimen.road_text_top_slpt)
    );
    road.alignX = 1;
    road.alignY = 0;
    road.setRect(100, 30);

    return Arrays.asList(new SlptViewComponent[]{steps, sport, road, power});
}