com.ingenic.iwds.slpt.view.digital.SlptHourHView Java Examples

The following examples show how to use com.ingenic.iwds.slpt.view.digital.SlptHourHView. 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: 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 #2
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 #3
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 #4
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 #5
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);
}