-
Notifications
You must be signed in to change notification settings - Fork 858
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
953f317
commit 9468be5
Showing
9 changed files
with
81 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
app/src/main/java/com/bin/david/smarttable/bean/Course.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.bin.david.smarttable.bean; | ||
|
||
/** | ||
* Created by huang on 2018/3/21. | ||
*/ | ||
|
||
public class Course { | ||
|
||
private String name; | ||
private int period; | ||
|
||
public Course(String name, int period) { | ||
this.name = name; | ||
this.period = period; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
|
||
public int getPeriod() { | ||
return period; | ||
} | ||
|
||
public void setPeriod(int period) { | ||
this.period = period; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
form/src/main/java/com/bin/david/form/data/format/sequence/BaseSequenceFormat.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.bin.david.form.data.format.sequence; | ||
|
||
import android.graphics.Canvas; | ||
import android.graphics.Paint; | ||
import android.graphics.Rect; | ||
|
||
import com.bin.david.form.core.TableConfig; | ||
import com.bin.david.form.utils.DrawUtils; | ||
|
||
/** | ||
* Created by huang on 2018/3/21. | ||
*/ | ||
|
||
public abstract class BaseSequenceFormat implements ISequenceFormat{ | ||
@Override | ||
public void draw(Canvas canvas, int sequence, Rect rect, TableConfig config) { | ||
//字体缩放 | ||
Paint paint = config.getPaint(); | ||
paint.setTextSize(paint.getTextSize()*(config.getZoom()>1?1:config.getZoom())); | ||
paint.setTextAlign(Paint.Align.CENTER); | ||
canvas.drawText(format(sequence+1),rect.centerX(), DrawUtils.getTextCenterY(rect.centerY(),paint) ,paint); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 4 additions & 1 deletion
5
form/src/main/java/com/bin/david/form/data/format/sequence/NumberSequenceFormat.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,17 @@ | ||
package com.bin.david.form.data.format.sequence; | ||
|
||
|
||
|
||
/** | ||
* Created by huang on 2017/11/7. | ||
*/ | ||
|
||
public class NumberSequenceFormat implements ISequenceFormat{ | ||
public class NumberSequenceFormat extends BaseSequenceFormat{ | ||
|
||
@Override | ||
public String format(Integer position) { | ||
return String.valueOf(position); | ||
} | ||
|
||
|
||
} |