com.ingenic.iwds.slpt.view.core.SlptViewComponent Java Examples

The following examples show how to use com.ingenic.iwds.slpt.view.core.SlptViewComponent. 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: 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 #2
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 #3
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 #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.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 #5
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 #6
Source File: MoonPhaseWidget.java    From GreatFit with MIT License 5 votes vote down vote up
public List<SlptViewComponent> buildSlptViewComponent(Service service, boolean better_resolution) {
    better_resolution = better_resolution && settings.better_resolution_when_raising_hand;

    List<SlptViewComponent> slpt_objects = new ArrayList<>();

    // Do not show in SLPT (but show on raise of hand)
    boolean show_all = (!settings.clock_only_slpt || better_resolution);
    if (!show_all)
        return slpt_objects;

    this.mService = service;

    try  {
        // Get moon data
        int i = mf.getPhaseIndex();
        String filename = (better_resolution) ? String.format("26wc_moon/moon%d.png", i) : String.format("slpt_moon/" + settings.is_white_bg + "moon%d.png", i);

        SlptPictureView moonphaseIcon = new SlptPictureView();
        moonphaseIcon.setImagePicture(SimpleFile.readFileFromAssets(service, filename));
        moonphaseIcon.setStart(
                (int) settings.moonphaseIconLeft,
                (int) settings.moonphaseIconTop
        );
        slpt_objects.add(moonphaseIcon);

    } catch (Exception ex) {
        //Log.e(TAG,ex.toString());
    }

    return slpt_objects;
}
 
Example #7
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 #8
Source File: FloorWidget.java    From AmazfitAPKs with Apache License 2.0 5 votes vote down vote up
@Override
public List<SlptViewComponent> buildSlptViewComponent(Service service) {
    byte[] num0 = Util.assetToBytes(service.getApplicationContext(), "num0.png");
    byte[] num1 = Util.assetToBytes(service.getApplicationContext(), "num1.png");
    byte[] num2 = Util.assetToBytes(service.getApplicationContext(), "num2.png");
    byte[] num3 = Util.assetToBytes(service.getApplicationContext(), "num3.png");
    byte[] num4 = Util.assetToBytes(service.getApplicationContext(), "num4.png");
    byte[] num5 = Util.assetToBytes(service.getApplicationContext(), "num5.png");
    byte[] num6 = Util.assetToBytes(service.getApplicationContext(), "num6.png");
    byte[] num7 = Util.assetToBytes(service.getApplicationContext(), "num7.png");
    byte[] num8 = Util.assetToBytes(service.getApplicationContext(), "num8.png");
    byte[] num9 = Util.assetToBytes(service.getApplicationContext(), "num9.png");
    byte[][] SlptNumArray = new byte[][]{num0, num1, num2, num3, num4, num5, num6, num7, num8, num9};
    SlptLinearLayout floors = new SlptLinearLayout();
    SlptTodayFloorNumView floorsnum = new SlptTodayFloorNumView();

    SlptPictureView floorsunit = new SlptPictureView();
    floors.add(new SlptTodayFloorNumView());
    floors.setImagePictureArrayForAll(SlptNumArray);

    floors.setStart(
            (int) service.getResources().getDimension(R.dimen.floors_text_left_slpt),
            (int) service.getResources().getDimension(R.dimen.floors_text_top_slpt));
    floors.alignX = 2;
    floors.alignY=0;
    floors.setRect(28,21);
    return Arrays.asList(new SlptViewComponent[]{floors});
}
 
Example #9
Source File: BigWeather.java    From AmazfitAPKs with Apache License 2.0 5 votes vote down vote up
@Override
public List<SlptViewComponent> buildSlptViewComponent(Service service) {
    /*
    int x=0,y=0,width=84,height=84,model=0;
    SlptWeatherWidget weather = new SlptWeatherWidget(service.getApplicationContext(), x, y, width, height, model);
    */
    return null;
}
 
Example #10
Source File: BatteryWidget.java    From AmazfitAPKs with Apache License 2.0 5 votes vote down vote up
public List<SlptViewComponent> buildSlptViewComponent(Service service) {
    byte[] SlptBlank = Util.assetToBytes(service.getApplicationContext(), "blank.png");
    byte[] SlptZero = Util.assetToBytes(service.getApplicationContext(), "zero.png");
    byte[] SlptBatteryIcon100 = Util.assetToBytes(service.getApplicationContext(), "battery100.png");
    byte[] SlptBatteryIcon90 = Util.assetToBytes(service.getApplicationContext(), "battery90.png");
    byte[] SlptBatteryIcon80 = Util.assetToBytes(service.getApplicationContext(), "battery80.png");
    byte[] SlptBatteryIcon70 = Util.assetToBytes(service.getApplicationContext(), "battery70.png");
    byte[] SlptBatteryIcon60 = Util.assetToBytes(service.getApplicationContext(), "battery60.png");
    byte[] SlptBatteryIcon50 = Util.assetToBytes(service.getApplicationContext(), "battery50.png");
    byte[] SlptBatteryIcon40 = Util.assetToBytes(service.getApplicationContext(), "battery40.png");
    byte[] SlptBatteryIcon30 = Util.assetToBytes(service.getApplicationContext(), "battery30.png");
    byte[] SlptBatteryIcon20 = Util.assetToBytes(service.getApplicationContext(), "battery20.png");
    byte[] SlptBatteryIcon10 = Util.assetToBytes(service.getApplicationContext(), "battery10.png");
    byte[] SlptBatteryIcon0 = Util.assetToBytes(service.getApplicationContext(), "battery0.png");
    byte[][] SlptBatteryArray = new byte[][]{SlptBatteryIcon0, SlptBatteryIcon10, SlptBatteryIcon20, SlptBatteryIcon30, SlptBatteryIcon40, SlptBatteryIcon50, SlptBatteryIcon60, SlptBatteryIcon70, SlptBatteryIcon80, SlptBatteryIcon90};
    byte[][] SlptBatteryArray100 = new byte[][]{SlptZero, SlptBatteryIcon100, SlptBlank, SlptBlank, SlptBlank, SlptBlank, SlptBlank, SlptBlank, SlptBlank, SlptBlank};

    SlptLinearLayout BatteryIcon10 = new SlptLinearLayout();
    BatteryIcon10.add(new SlptPowerNumView());
    BatteryIcon10.setImagePictureArrayForAll(SlptBatteryArray);
    BatteryIcon10.setStart(-17, 17);

    SlptLinearLayout BatteryIcon100 = new SlptLinearLayout();
    BatteryIcon100.add(new SlptPowerNumView());
    BatteryIcon100.setImagePictureArrayForAll(SlptBatteryArray100);
    BatteryIcon100.setStart(-17, 17);
    BatteryIcon100.alignX = (byte) 1;
    BatteryIcon100.alignY = (byte) 0;
    BatteryIcon100.setRect(960, 320);

    return Arrays.asList(new SlptViewComponent[]{BatteryIcon100, BatteryIcon10});
}
 
Example #11
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 #12
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 #13
Source File: HugeDigitClock.java    From AmazfitAPKs with Apache License 2.0 5 votes vote down vote up
@Override
public List<SlptViewComponent> buildSlptViewComponent(Service service) {
    init(service);

    List<SlptViewComponent> retVal = new LinkedList<>();

    SlptPictureView bg = new SlptPictureView();
    bg.setImagePicture(SimpleFile.readFileFromAssets(service.getApplicationContext(), "black.png"));
    retVal.add(bg);

    List<byte[]> bitmapBytes = new LinkedList<>();
    for (Drawable d : digits){
        bitmapBytes.add(drawableToBytes(d));
    }
    final byte [][] imagesBytes = bitmapBytes.toArray(new byte[0][]);

    SlptHourHView hh = new SlptHourHView();
    SlptHourLView hl = new SlptHourLView();
    SlptMinuteHView mh = new SlptMinuteHView();
    SlptMinuteLView ml = new SlptMinuteLView();

    for (SlptTimeView c : Arrays.asList(hh, hl, mh, ml)){
        c.setImagePictureArray(imagesBytes);
        retVal.add(c);
    }

    int halfWidth = 320 / 2;
    int halfHeight = 320 / 2;
    int ioffset = (int)offset;
    hh.setStart(ioffset+img_offset,ioffset+img_offset);
    hl.setStart(halfWidth-ioffset,ioffset+img_offset);
    mh.setStart(ioffset+img_offset,halfHeight-ioffset);
    ml.setStart(halfWidth-ioffset,halfHeight-ioffset);

    return retVal;
}
 
Example #14
Source File: BigImageWeather.java    From AmazfitAPKs with Apache License 2.0 5 votes vote down vote up
@Override
public List<SlptViewComponent> buildSlptViewComponent(Service service) {
    /*
    int x=0,y=0,width=84,height=84,model=0;
    SlptWeatherWidget weather = new SlptWeatherWidget(service.getApplicationContext(), x, y, width, height, model);
    */
    return null;
}
 
Example #15
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 #16
Source File: BatteryWidget.java    From xDrip-Watchface with Apache License 2.0 5 votes vote down vote up
public List<SlptViewComponent> buildSlptViewComponent(Service service) {
    int battery_steps = service.getResources().getInteger(R.integer.battery_steps);
    byte[][] arrayOfByte = new byte[battery_steps][];
    for (int i=0; i<arrayOfByte.length; i++){
        arrayOfByte[i] = SimpleFile.readFileFromAssets(service, String.format("slpt_battery/battery%d.png", i));
    }

    SlptBatteryView localSlptBatteryView = new SlptBatteryView(battery_steps);
    localSlptBatteryView.setImagePictureArray(arrayOfByte);
    localSlptBatteryView.setStart((int) service.getResources().getDimension(R.dimen.battery_icon_left), (int) service.getResources().getDimension(R.dimen.battery_icon_top));

    if(!service.getResources().getBoolean(R.bool.battery_icon)){localSlptBatteryView.show=false;}

    return Arrays.asList(new SlptViewComponent[]{localSlptBatteryView});
}
 
Example #17
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 #18
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 #19
Source File: ThreeLines.java    From AmazfitAPKs with Apache License 2.0 4 votes vote down vote up
public List<SlptViewComponent> buildSlptViewComponent(Service service) {
    init(service);

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

    List<SlptViewComponent> retVal = new LinkedList<>();// ArrayList<>();

    SlptPictureView bg = new SlptPictureView();
    bg.setImagePicture(SimpleFile.readFileFromAssets(service.getApplicationContext(), "black.png"));
    retVal.add(bg);

    retVal.add(buildDateView(service, (int) x, (int) y));

    y += fontHeight;

    retVal.add(buildTimeView(service, (int) x, (int) y));

    return retVal;
}
 
Example #20
Source File: MainClock.java    From GreatFit with MIT License 4 votes vote down vote up
@Override
public List<SlptViewComponent> buildSlptViewComponent(Service service) {
    return buildSlptViewComponent(service, false);
}
 
Example #21
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 #22
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 #23
Source File: WeatherWidget.java    From xDrip-Watchface with Apache License 2.0 4 votes vote down vote up
@Override
public List<SlptViewComponent> buildSlptViewComponent(Service service) {
    // Variables
    this.mService = service;
    Typeface font = ResourceManager.getTypeFace(service.getResources(), ResourceManager.Font.MONO_SPACE);

    // Get weather data
    this.weather = getSlptWeather();

    // Just to be safe :P
    if(this.weather.weatherType<0 || this.weather.weatherType>22){
        this.weather.weatherType = 22;
    }

    // Load weather icons
    List<String> weatherImageStrList = new ArrayList<String>();
    weatherImageStrList.add("sunny"); //0
    weatherImageStrList.add("cloudy"); //1
    weatherImageStrList.add("overcast"); //2
    weatherImageStrList.add("fog"); //3
    weatherImageStrList.add("fog"); //4
    weatherImageStrList.add("showers"); //5
    weatherImageStrList.add("t_storm"); //6
    weatherImageStrList.add("rain"); //7
    weatherImageStrList.add("rain"); //8
    weatherImageStrList.add("rainstorm"); //9
    weatherImageStrList.add("rainstorm"); //10
    weatherImageStrList.add("showers"); //11
    weatherImageStrList.add("rainsnow"); //12
    weatherImageStrList.add("rainsnow"); //13
    weatherImageStrList.add("rainsnow"); //14
    weatherImageStrList.add("snow"); //15
    weatherImageStrList.add("snow"); //16
    weatherImageStrList.add("snow"); //17
    weatherImageStrList.add("snow"); //18
    weatherImageStrList.add("fog"); //19
    weatherImageStrList.add("fog"); //20
    weatherImageStrList.add("fog"); //21
    weatherImageStrList.add("unknow"); //22

    // Draw temperature
    SlptLinearLayout temperatureLayout = new SlptLinearLayout();
    // Show or Not icon
    if(service.getResources().getBoolean(R.bool.temperature_icon)) {
        SlptPictureView temperatureIcon = new SlptPictureView();
        temperatureIcon.setStringPicture( (char)Integer.parseInt("F2CB", 16) );
        temperatureIcon.setTextAttr(
                service.getResources().getDimension(R.dimen.temperature_font_size),
                service.getResources().getColor(R.color.temperature_colour_slpt),
                ResourceManager.getTypeFace(service.getResources(), ResourceManager.Font.ICONS_FONT)
        );
        temperatureLayout.add(temperatureIcon);
    }
    // Show temperature with units or not
    SlptPictureView temperatureNum = new SlptPictureView();
    temperatureNum.setStringPicture( this.weather.tempString + ((service.getResources().getBoolean(R.bool.temperature_units))?this.weather.getUnits():"") );
    temperatureNum.setTextAttr(
            service.getResources().getDimension(R.dimen.temperature_font_size),
            service.getResources().getColor(R.color.temperature_colour_slpt),
            font
    );
    temperatureLayout.add(temperatureNum);

    // Position based on screen on
    temperatureLayout.alignX = 2;
    temperatureLayout.alignY = 0;
    int tmp_left = (int) service.getResources().getDimension(R.dimen.temperature_left);
    if(!service.getResources().getBoolean(R.bool.temperature_left_align)) {
        // If text is centered, set rectangle
        temperatureLayout.setRect(
                (int) (2 * tmp_left + 640),
                (int) (service.getResources().getDimension(R.dimen.temperature_font_size))
        );
        tmp_left = -320;
    }
    temperatureLayout.setStart(
            tmp_left,
            (int) (service.getResources().getDimension(R.dimen.temperature_top)-((float)service.getResources().getInteger(R.integer.font_ratio)/100)*service.getResources().getDimension(R.dimen.temperature_font_size))
    );
    if(!service.getResources().getBoolean(R.bool.temperature)){temperatureLayout.show=false;}

    // Draw weather icon
    SlptPictureView weatherLayout = new SlptPictureView();
    weatherLayout.setImagePicture( SimpleFile.readFileFromAssets(service, String.format("slpt_weather/clock_skin_weather_%s.png", weatherImageStrList.get(this.weather.weatherType))) );
    weatherLayout.setStart(
            (int) service.getResources().getDimension(R.dimen.weather_img_left)-5,
            (int) service.getResources().getDimension(R.dimen.weather_img_top)-4
    );
    if(!service.getResources().getBoolean(R.bool.weather_image)){weatherLayout.show=false;}



    return Arrays.asList(new SlptViewComponent[]{temperatureLayout, weatherLayout});
}
 
Example #24
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 #25
Source File: FuzzyTextClock.java    From AmazfitAPKs with Apache License 2.0 4 votes vote down vote up
@Override
public List<SlptViewComponent> buildSlptViewComponent(Service service) {
    return null;
}
 
Example #26
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 #27
Source File: SportTodayDistanceWidget.java    From GreatFit with MIT License 4 votes vote down vote up
public List<SlptViewComponent> buildSlptViewComponent(Service service) {
    return buildSlptViewComponent(service, false);
}
 
Example #28
Source File: CirclesWidget.java    From GreatFit with MIT License 4 votes vote down vote up
@Override
public List<SlptViewComponent> buildSlptViewComponent(Service service) {
    return buildSlptViewComponent(service, false);
}
 
Example #29
Source File: BatteryWidget.java    From GreatFit with MIT License 4 votes vote down vote up
public List<SlptViewComponent> buildSlptViewComponent(Service service) {
    return buildSlptViewComponent(service, false);
}
 
Example #30
Source File: StepsWidget.java    From GreatFit with MIT License 4 votes vote down vote up
public List<SlptViewComponent> buildSlptViewComponent(Service service) {
    return buildSlptViewComponent(service, false);
}