Skip to content

Commit

Permalink
[DEL] Eliminar dependencias projecto Tools
Browse files Browse the repository at this point in the history
  • Loading branch information
sergio-teruel committed Jan 27, 2015
1 parent d4088c7 commit 308672c
Show file tree
Hide file tree
Showing 11 changed files with 141 additions and 116 deletions.
1 change: 0 additions & 1 deletion .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions app/app.iml
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,10 @@
</content>
<orderEntry type="jdk" jdkName="Android API 21 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="appcompat-v7-21.0.3" level="project" />
<orderEntry type="library" exported="" name="support-v4-21.0.0" level="project" />
<orderEntry type="library" exported="" name="jtds-1.2.7" level="project" />
<orderEntry type="library" exported="" name="support-v4-21.0.3" level="project" />
<orderEntry type="library" exported="" name="support-annotations-21.0.3" level="project" />
<orderEntry type="module" module-name="tools" exported="" />
<orderEntry type="library" exported="" name="appcompat-v7-21.0.0" level="project" />
<orderEntry type="library" exported="" name="support-annotations-21.0.0" level="project" />
</component>
</module>

4 changes: 0 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,4 @@ dependencies {
compile fileTree(include: ['*.jar', '*.aar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:21.0.0'
compile 'com.android.support:support-v4:21.0.0'
//compile files('libs/jtds-1.2.7.jar')
//compile 'es.incaser.apps.tools:tools:1.0@aar'
//compile 'be.hcpl.android.appframework:appframework:0.1.0@aar'
compile project(':tools')
}
8 changes: 2 additions & 6 deletions app/src/main/java/es/incaser/apps/stockcontrol/DbAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@
import java.util.Map;
import java.util.UUID;

import es.incaser.apps.tools.Tools;

import static es.incaser.apps.tools.Tools.getToday;


public class DbAdapter extends SQLiteOpenHelper {
private static final String DATABASE_NAME = "StockControl";
Expand Down Expand Up @@ -364,13 +360,13 @@ public int updateMovimientoStock(String numeroSerie) {

public int updateMovimientoStock(String movPosicion) {
ContentValues cv = new ContentValues();
cv.put("FechaRegistro", getToday("yyyy-MM-dd HH:mm:ss.S"));
cv.put("FechaRegistro", Tools.getToday("yyyy-MM-dd HH:mm:ss.S"));
return db.update("MovimientoStock", cv, "MovPosicion = ?", new String[]{movPosicion});
}

public int updateMovimientoStock(String tipoMov, String serie, String documento, String campo, String valor) {
ContentValues cv = new ContentValues();
cv.put("FechaRegistro", getToday("yyyy-MM-dd HH:mm:ss.S"));
cv.put("FechaRegistro", Tools.getToday("yyyy-MM-dd HH:mm:ss.S"));
cv.put(campo, valor);
return db.update("MovimientoStock", cv, "TipoMovimiento=? AND Serie=? AND Documento=?", new String[]{tipoMov, serie, documento});
}
Expand Down
131 changes: 131 additions & 0 deletions app/src/main/java/es/incaser/apps/stockcontrol/Tools.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
package es.incaser.apps.stockcontrol;

import android.widget.EditText;

import java.text.DecimalFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

/**
* Created by sergio on 2/10/14.
*/
public class Tools {
public static String UUID_EMPTY = "00000000-0000-0000-0000-000000000000";

public static float getNumber(String text) {
if (text == null) {
return 0;
} else if (text.length() == 0) {
return 0;
} else if (text.matches(".*\\\\D+.*")) {
return 0;
} else {
//TODO Controlar separador de miles
return Float.valueOf(text.replace(",", "."));
}
}

public static float getNumber(EditText txt) {
return getNumber(txt.getText().toString());
}

public static String importeStr(Float importe) {
DecimalFormat nf = new DecimalFormat();
nf.applyPattern("#0.00");
return nf.format(importe);
}

public static String importeStr(String importe) {
return importeStr(getNumber(importe));
}


public static int getInt(String text) {
return Math.round(getNumber(text));
}

public static int getInt(EditText txtView) {
return getInt(txtView.getText().toString());
}

public static String enteroStr(Integer x) {
return x.toString();
}

public static String importeStr(EditText txt) {
return importeStr(txt.getText().toString());
}

public static String getToday() {
return getToday("yyyy-MM-dd 00:00:00.0");
}

public static String getToday(String format) {
Date date = Calendar.getInstance().getTime();
SimpleDateFormat sdf = new SimpleDateFormat(format);
return sdf.format(date);
}

public static String millis2String(Long miliseconds) {
Calendar date = Calendar.getInstance();
date.setTimeInMillis(miliseconds);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S");
return sdf.format(date.getTime());
}

// public static String getActualHour(){
// Date date = Calendar.getInstance().getTime();
// SimpleDateFormat sdf = new SimpleDateFormat("hh:mm:ss");
// return sdf.format(date);
// }

public static double getActualHour() {
Date date = Calendar.getInstance().getTime();
return getHourFractionDay(date.getTime());
}

public static double getHourFractionDay(long timelong) {
double milisecondsDay = 86400000.00;
return (timelong % (milisecondsDay)) / milisecondsDay;
}

public static String getTimeStamp() {
Date date = Calendar.getInstance().getTime();
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss.S");
return sdf.format(date);
}

public static Date str2date(String myTimestamp, String strFormat) {
SimpleDateFormat formato = new SimpleDateFormat(strFormat);
Date convertedDate = null;
try {
convertedDate = formato.parse(myTimestamp);
} catch (ParseException e) {
e.printStackTrace();
}
return convertedDate;
}

public static Date str2date(String myTimestamp) {
return str2date(myTimestamp, "yyyy-MM-dd HH:mm:ss.S");
}

public static String date2str(Date date, String strFormat) {
SimpleDateFormat formato = new SimpleDateFormat(strFormat);
return formato.format(date);
}

public static String date2str(Date date) {
return date2str(date, "dd-MM-yyyy 00:00:00.0");
}

public static String dateStr2str(String date) {
return date2str(str2date(date), "dd/MM/yyyy");
}

public static String date2Sql(String date){
return "CONVERT(DATETIME,'" + date + "', 102)";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -199,10 +199,9 @@
</LinearLayout>

</LinearLayout>



</LinearLayout>

</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
1 change: 0 additions & 1 deletion app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,5 @@
<style name="etiquetasCuadro">
<item name="android:gravity">left</item>
<item name="android:textStyle">italic</item>
<item name="android:textStyle">bold</item>
</style>
</resources>
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1 +1 @@
include ':app',':tools'
include ':app'
92 changes: 0 additions & 92 deletions tools/tools.iml

This file was deleted.

0 comments on commit 308672c

Please sign in to comment.