Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usability fixes and code cleanup #29

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
2 changes: 1 addition & 1 deletion ImapNote2/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
android:resource="@xml/searchable" />
</activity>

<activity android:name=".AccontConfigurationActivity"
<activity android:name=".AccountConfigurationActivity"
android:exported="true"
android:parentActivityName="com.Pau.ImapNotes2.Listactivity">
<meta-data android:name="android.support.PARENT_ACTIVITY"
Expand Down

This file was deleted.

Large diffs are not rendered by default.

106 changes: 53 additions & 53 deletions ImapNote2/src/main/java/com/Pau/ImapNotes2/Data/ConfigurationFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class ConfigurationFile {

private Context applicationContext;
private static final String TAG = "IN_ConfigurationFile";

private String accountname;
private String username;
private String password;
Expand All @@ -27,14 +27,14 @@ public class ConfigurationFile {
private String security;
private String usesticky;
private String imapfolder;
public ConfigurationFile(Context myContext){


public ConfigurationFile(Context myContext) {
this.applicationContext = myContext;

try {
Document fileToLoad = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(
new File(this.applicationContext.getFilesDir()+"/ImapNotes2.conf"));
new File(this.applicationContext.getFilesDir() + "/ImapNotes2.conf"));
this.username = this.LoadItemFromXML(fileToLoad, "username").item(0).getChildNodes().item(0).getNodeValue();
this.password = this.LoadItemFromXML(fileToLoad, "password").item(0).getChildNodes().item(0).getNodeValue();
this.server = this.LoadItemFromXML(fileToLoad, "server").item(0).getChildNodes().item(0).getNodeValue();
Expand All @@ -56,9 +56,9 @@ public ConfigurationFile(Context myContext){
else
this.usesticky = this.LoadItemFromXML(fileToLoad, "usesticky").item(0).getChildNodes().item(0).getNodeValue();

//Log.d(TAG, "conf file present, we read data");
//Log.d(TAG, "conf file present, we read data");
} catch (Exception e) {
//Log.d(TAG, "Conf file absent, go to the exception that initializes variables");
//Log.d(TAG, "Conf file absent, go to the exception that initializes variables");
this.accountname = "";
this.username = "";
this.password = "";
Expand All @@ -69,80 +69,80 @@ public ConfigurationFile(Context myContext){
this.imapfolder = "";
}
}
public String GetAccountname(){

public String GetAccountname() {
return this.accountname;
}
public String GetUsername(){

public String GetUsername() {
return this.username;
}
public void SetUsername(String Username){

public void SetUsername(String Username) {
this.username = Username;
}
public String GetPassword(){

public String GetPassword() {
return this.password;
}
public void SetPassword(String Password){

public void SetPassword(String Password) {
this.password = Password;
}
public String GetServer(){

public String GetServer() {
return this.server;
}
public void SetServer(String Server){

public void SetServer(String Server) {
this.server = Server;
}
public String GetPortnum(){

public String GetPortnum() {
return this.portnum;
}
public void SetPortnum(String Portnum){

public void SetPortnum(String Portnum) {
this.portnum = Portnum;
}
public String GetSecurity(){

public String GetSecurity() {
return this.security;
}
public void SetSecurity(String Security){

public void SetSecurity(String Security) {
this.security = Security;
}
public String GetUsesticky(){

public String GetUsesticky() {
return this.usesticky;
}
public void SetUsesticky(String Usesticky){

public void SetUsesticky(String Usesticky) {
this.usesticky = Usesticky;
}

public String GetFoldername(){
public String GetFoldername() {
return this.imapfolder;
}
public void Clear(){
new File(this.applicationContext.getFilesDir()+"/ImapNotes2.conf").delete();
this.username=null;
this.password=null;
this.server=null;
this.portnum=null;
this.security=null;
this.usesticky=null;

public void Clear() {
new File(this.applicationContext.getFilesDir() + "/ImapNotes2.conf").delete();
this.username = null;
this.password = null;
this.server = null;
this.portnum = null;
this.security = null;
this.usesticky = null;
this.imapfolder = null;
}
public void SaveConfigurationToXML() throws IllegalArgumentException, IllegalStateException, IOException{

public void SaveConfigurationToXML() throws IllegalArgumentException, IllegalStateException, IOException {
FileOutputStream configurationFile = this.applicationContext.openFileOutput("ImapNotes2.conf", Context.MODE_PRIVATE);
XmlSerializer serializer = Xml.newSerializer();
serializer.setOutput(configurationFile, "UTF-8");
serializer.startDocument(null, Boolean.valueOf(true));
serializer.startTag(null, "Configuration");
serializer.startDocument(null, Boolean.valueOf(true));
serializer.startTag(null, "Configuration");
serializer.startTag(null, "username");
serializer.text(this.username);
serializer.endTag(null, "username");
Expand All @@ -158,20 +158,20 @@ public void SaveConfigurationToXML() throws IllegalArgumentException, IllegalSta
serializer.startTag(null, "security");
serializer.text(this.security);
serializer.endTag(null, "security");
serializer.startTag(null,"imapfolder");
serializer.startTag(null, "imapfolder");
serializer.text(this.imapfolder);
serializer.endTag(null, "imapfolder");
serializer.startTag(null, "usesticky");
serializer.text(this.usesticky);
serializer.endTag(null, "usesticky");
serializer.endTag(null, "Configuration");
serializer.endTag(null, "Configuration");
serializer.endDocument();
serializer.flush();
configurationFile.close();
}
private NodeList LoadItemFromXML(Document fileLoaded, String tag){

private NodeList LoadItemFromXML(Document fileLoaded, String tag) {
return fileLoaded.getElementsByTagName(tag);

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,118 +15,118 @@ public class ImapNotes2Account {
private String imapfolder = "";
private Boolean accountHasChanged = false;
private Account account = null;


public ImapNotes2Account() {
}

public String toString() {
return this.accountname + ":" + this.username + ":" + this.password + ":"
+ this.server + ":" + this.portnum + ":" + this.security + ":"
+ this.usesticky + ":" + this.imapfolder + ":" + this.accountHasChanged.toString();
}
+ this.server + ":" + this.portnum + ":" + this.security + ":"
+ this.usesticky + ":" + this.imapfolder + ":" + this.accountHasChanged.toString();
}

public String GetAccountname() {
return this.accountname;
}

public void SetAccount(Account account) {
this.account = account;
}

public Account GetAccount() {
return this.account;
}

public void SetAccountname(String Accountname) {
if (this.accountname.equals(Accountname)) this.accountHasChanged = true;
this.accountname = Accountname;
}

public String GetUsername() {
return this.username;
}

public void SetUsername(String Username) {
this.username = Username;
}

public String GetPassword() {
return this.password;
}

public void SetPassword(String Password) {
this.password = Password;
}

public String GetServer() {
return this.server;
}

public void SetServer(String Server) {
this.server = Server;
}

public String GetPortnum() {
return this.portnum;
}

public void SetPortnum(String Portnum) {
this.portnum = Portnum;
}

public String GetSecurity() {
return this.security;
}

public void SetSecurity(String Security) {
this.security = Security;
}

public String GetUsesticky() {
return this.usesticky;
}

public void SetUsesticky(String Usesticky) {
this.usesticky = Usesticky;
}

public String GetSyncinterval() {
return this.syncinterval;
}

public void SetSyncinterval(String Syncinterval) {
this.syncinterval = Syncinterval;
}

public void SetaccountHasChanged() {
this.accountHasChanged = true;
}

public void SetaccountHasNotChanged() {
this.accountHasChanged = false;
}

public Boolean GetaccountHasChanged() {
return this.accountHasChanged;
}

public String GetFoldername(){
public String GetFoldername() {
return this.imapfolder;
}

public void SetFoldername(String folder) {
this.imapfolder = folder;
}

public void Clear() {
this.username=null;
this.password=null;
this.server=null;
this.portnum=null;
this.security=null;
this.usesticky=null;
this.imapfolder=null;
this.accountHasChanged=false;
this.username = null;
this.password = null;
this.server = null;
this.portnum = null;
this.security = null;
this.usesticky = null;
this.imapfolder = null;
this.accountHasChanged = false;
}
}
Loading