-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Made PagesActivity a NotebookListener (finally!)
Added Compacter Page-search is now performed on a separate thread.
- Loading branch information
1 parent
818665c
commit ef93659
Showing
6 changed files
with
232 additions
and
61 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
41 changes: 41 additions & 0 deletions
41
app/src/main/java/com/luxlunaris/noadpadlight/model/classes/Compacter.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,41 @@ | ||
package com.luxlunaris.noadpadlight.model.classes; | ||
|
||
import com.luxlunaris.noadpadlight.model.interfaces.Page; | ||
|
||
import java.util.Date; | ||
import java.util.List; | ||
|
||
/** | ||
* Combines old pages into a single new one. | ||
*/ | ||
public class Compacter { | ||
|
||
|
||
/** | ||
* Takes a blank Page and a list of pages, | ||
* writes the "aggregate" content of the list of Pages | ||
* onto the blank page. | ||
* @param pages | ||
* @param blankPage | ||
*/ | ||
public void compact(List<Page> pages, Page blankPage){ | ||
|
||
String textBlob = ""; | ||
String head = ""; | ||
String tail ="--------\n"; | ||
|
||
for(Page page : pages){ | ||
|
||
head = new Date(page.getLastModifiedTime()).toString()+"\n"; | ||
textBlob+=head; | ||
textBlob+=page.getText(); | ||
textBlob+=tail; | ||
} | ||
|
||
blankPage.setText(textBlob); | ||
} | ||
|
||
|
||
|
||
|
||
} |
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
Oops, something went wrong.