mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-11-04 10:09:42 +00:00
code formatting
This commit is contained in:
1 parent
9a33bc91f2
commit
8295e89113
2 files changed
+38
-44
No files matched your search
-2
@@ -272,10 +272,8 @@ public class RegattaActivity extends BaseActivity {
|
||||
if (BuildConfig.DEBUG) {
|
||||
ExLog.i(this, TAG, "Sending imageFile to server: " + imageFile);
|
||||
}
|
||||
|
||||
final String uploadURLStr = event.server
|
||||
+ prefs.getServerUploadTeamImagePath().replace("{competitor_id}", competitor.id);
|
||||
|
||||
new UploadTeamImageTask(imageFile).execute(uploadURLStr);
|
||||
}
|
||||
|
||||
|
||||
+38
-42
@@ -28,7 +28,6 @@ public class DatabaseHelper {
|
||||
|
||||
protected static DatabaseHelper mInstance;
|
||||
|
||||
|
||||
public static synchronized DatabaseHelper getInstance() {
|
||||
if (mInstance == null) {
|
||||
mInstance = new DatabaseHelper();
|
||||
@@ -37,13 +36,12 @@ public class DatabaseHelper {
|
||||
return mInstance;
|
||||
}
|
||||
|
||||
|
||||
public long getEventRowIdForCheckinDigest(Context context, String checkinDigest)
|
||||
{
|
||||
public long getEventRowIdForCheckinDigest(Context context, String checkinDigest) {
|
||||
int result = 0;
|
||||
|
||||
ContentResolver cr = context.getContentResolver();
|
||||
Cursor cursor = cr.query(Event.CONTENT_URI, null, Event.EVENT_CHECKIN_DIGEST + " = \"" + checkinDigest + "\"", null, null);
|
||||
Cursor cursor = cr.query(Event.CONTENT_URI, null, Event.EVENT_CHECKIN_DIGEST + " = \"" + checkinDigest + "\"",
|
||||
null, null);
|
||||
cursor.moveToFirst();
|
||||
result = cursor.getInt(cursor.getColumnIndex(BaseColumns._ID));
|
||||
cursor.close();
|
||||
@@ -56,7 +54,8 @@ public class DatabaseHelper {
|
||||
// ContentResolver cr = context.getContentResolver();
|
||||
// String projectionStr = "events._id,leaderboards.leaderboard_name,events.event_name";
|
||||
// String[] projection = projectionStr.split(",");
|
||||
// Cursor cursor = cr.query(LeaderboardsEventsJoined.CONTENT_URI, projection, "events.event_id = \"" + eventId + "\"", null, null);
|
||||
// Cursor cursor = cr.query(LeaderboardsEventsJoined.CONTENT_URI, projection, "events.event_id = \"" + eventId +
|
||||
// "\"", null, null);
|
||||
// if (cursor.moveToFirst())
|
||||
// {
|
||||
// result.name = cursor.getString(cursor.getColumnIndex("event_name"));
|
||||
@@ -74,11 +73,9 @@ public class DatabaseHelper {
|
||||
String projectionStr = "events._id ,leaderboards.leaderboard_name, events.event_id,"
|
||||
+ " events.event_name, competitors.competitor_id";
|
||||
String[] projection = projectionStr.split(",");
|
||||
Cursor cursor = cr
|
||||
.query(EventLeaderboardCompetitorJoined.CONTENT_URI, projection, "events."
|
||||
Cursor cursor = cr.query(EventLeaderboardCompetitorJoined.CONTENT_URI, projection, "events."
|
||||
+ Event.EVENT_CHECKIN_DIGEST + " = \"" + checkinDigest + "\"", null, null);
|
||||
if (cursor.moveToFirst())
|
||||
{
|
||||
if (cursor.moveToFirst()) {
|
||||
result.name = cursor.getString(cursor.getColumnIndex("event_name"));
|
||||
result.leaderboardName = cursor.getString(cursor.getColumnIndex("leaderboard_name"));
|
||||
result.competitorId = cursor.getString(cursor.getColumnIndex("competitor_id"));
|
||||
@@ -95,7 +92,8 @@ public class DatabaseHelper {
|
||||
// ContentResolver cr = context.getContentResolver();
|
||||
// String projectionStr = "events._id,leaderboards.leaderboard_name,events.event_name, competitors.competitor_id";
|
||||
// String[] projection = projectionStr.split(",");
|
||||
// Cursor cursor = cr.query(EventLeaderboardCompetitorJoined.CONTENT_URI, projection, "events.event_id = \"" + eventId + "\"", null, null);
|
||||
// Cursor cursor = cr.query(EventLeaderboardCompetitorJoined.CONTENT_URI, projection, "events.event_id = \"" +
|
||||
// eventId + "\"", null, null);
|
||||
// if (cursor.moveToFirst())
|
||||
// {
|
||||
// result.name = cursor.getString(cursor.getColumnIndex("event_name"));
|
||||
@@ -112,8 +110,8 @@ public class DatabaseHelper {
|
||||
EventInfo event = new EventInfo();
|
||||
event.checkinDigest = checkinDigest;
|
||||
|
||||
Cursor cursor = context.getContentResolver().query(Event.CONTENT_URI,
|
||||
null, Event.EVENT_CHECKIN_DIGEST + " = \"" + checkinDigest + "\"", null, null);
|
||||
Cursor cursor = context.getContentResolver().query(Event.CONTENT_URI, null,
|
||||
Event.EVENT_CHECKIN_DIGEST + " = \"" + checkinDigest + "\"", null, null);
|
||||
|
||||
if (cursor.moveToFirst()) {
|
||||
event.name = cursor.getString(cursor.getColumnIndex(Event.EVENT_NAME));
|
||||
@@ -134,7 +132,8 @@ public class DatabaseHelper {
|
||||
// CompetitorInfo competitor = new CompetitorInfo();
|
||||
// competitor.id = competitorId;
|
||||
//
|
||||
// Cursor cursor = context.getContentResolver().query(Competitor.CONTENT_URI, null, "competitor_id = \"" + competitorId + "\"", null, null);
|
||||
// Cursor cursor = context.getContentResolver().query(Competitor.CONTENT_URI, null, "competitor_id = \"" +
|
||||
// competitorId + "\"", null, null);
|
||||
// if (cursor.moveToFirst()) {
|
||||
// competitor.name = cursor.getString(cursor.getColumnIndex(Competitor.COMPETITOR_DISPLAY_NAME));
|
||||
// competitor.countryCode = cursor.getString(cursor.getColumnIndex(Competitor.COMPETITOR_COUNTRY_CODE));
|
||||
@@ -146,12 +145,12 @@ public class DatabaseHelper {
|
||||
// return competitor;
|
||||
// }
|
||||
|
||||
public CompetitorInfo getCompetitor(Context context, String checkinDigest)
|
||||
{
|
||||
public CompetitorInfo getCompetitor(Context context, String checkinDigest) {
|
||||
CompetitorInfo competitor = new CompetitorInfo();
|
||||
competitor.checkinDigest = checkinDigest;
|
||||
|
||||
Cursor cursor = context.getContentResolver().query(Competitor.CONTENT_URI, null, Competitor.COMPETITOR_CHECKIN_DIGEST + " = \"" + checkinDigest + "\"", null, null);
|
||||
Cursor cursor = context.getContentResolver().query(Competitor.CONTENT_URI, null,
|
||||
Competitor.COMPETITOR_CHECKIN_DIGEST + " = \"" + checkinDigest + "\"", null, null);
|
||||
if (cursor.moveToFirst()) {
|
||||
competitor.name = cursor.getString(cursor.getColumnIndex(Competitor.COMPETITOR_DISPLAY_NAME));
|
||||
competitor.countryCode = cursor.getString(cursor.getColumnIndex(Competitor.COMPETITOR_COUNTRY_CODE));
|
||||
@@ -169,7 +168,8 @@ public class DatabaseHelper {
|
||||
// LeaderboardInfo leaderboard = new LeaderboardInfo();
|
||||
// leaderboard.name = leaderboardName;
|
||||
//
|
||||
// Cursor lc = context.getContentResolver().query(Leaderboard.CONTENT_URI, null, "leaderboard_name = \"" + leaderboardName + "\"", null, null);
|
||||
// Cursor lc = context.getContentResolver().query(Leaderboard.CONTENT_URI, null, "leaderboard_name = \"" +
|
||||
// leaderboardName + "\"", null, null);
|
||||
// if (lc.moveToFirst()) {
|
||||
// leaderboard.rowId = lc.getInt(lc.getColumnIndex(BaseColumns._ID));
|
||||
// leaderboard.checkinDigest = lc.getString(lc.getColumnIndex(Leaderboard.LEADERBOARD_CHECKIN_DIGEST));
|
||||
@@ -180,14 +180,11 @@ public class DatabaseHelper {
|
||||
// return leaderboard;
|
||||
// }
|
||||
|
||||
public LeaderboardInfo getLeaderboard(Context context, String checkinDigest)
|
||||
{
|
||||
public LeaderboardInfo getLeaderboard(Context context, String checkinDigest) {
|
||||
LeaderboardInfo leaderboard = new LeaderboardInfo();
|
||||
leaderboard.checkinDigest = checkinDigest;
|
||||
|
||||
Cursor lc = context.getContentResolver().query(
|
||||
Leaderboard.CONTENT_URI,
|
||||
null,
|
||||
Cursor lc = context.getContentResolver().query(Leaderboard.CONTENT_URI, null,
|
||||
Leaderboard.LEADERBOARD_CHECKIN_DIGEST + " = \"" + checkinDigest + "\"", null, null);
|
||||
if (lc.moveToFirst()) {
|
||||
leaderboard.rowId = lc.getInt(lc.getColumnIndex(BaseColumns._ID));
|
||||
@@ -199,13 +196,15 @@ public class DatabaseHelper {
|
||||
return leaderboard;
|
||||
}
|
||||
|
||||
// public void deleteRegattaFromDatabase(Context context, String eventId, String competitorId, String leaderboardName)
|
||||
// public void deleteRegattaFromDatabase(Context context, String eventId, String competitorId, String
|
||||
// leaderboardName)
|
||||
// {
|
||||
// ContentResolver cr = context.getContentResolver();
|
||||
//
|
||||
// int d1 = cr.delete(Event.CONTENT_URI, Event.EVENT_ID + " = \"" + eventId + "\"", null);
|
||||
// int d2 = cr.delete(Competitor.CONTENT_URI, Competitor.COMPETITOR_ID + " = \"" + competitorId + "\"", null);
|
||||
// int d3 = cr.delete(Leaderboard.CONTENT_URI, Leaderboard.LEADERBOARD_NAME + " = \"" + leaderboardName + "\"", null);
|
||||
// int d3 = cr.delete(Leaderboard.CONTENT_URI, Leaderboard.LEADERBOARD_NAME + " = \"" + leaderboardName + "\"",
|
||||
// null);
|
||||
//
|
||||
// if (BuildConfig.DEBUG)
|
||||
// {
|
||||
@@ -215,16 +214,16 @@ public class DatabaseHelper {
|
||||
// }
|
||||
// }
|
||||
|
||||
public void deleteRegattaFromDatabase(Context context, String checkinDigest)
|
||||
{
|
||||
public void deleteRegattaFromDatabase(Context context, String checkinDigest) {
|
||||
ContentResolver cr = context.getContentResolver();
|
||||
|
||||
int d1 = cr.delete(Event.CONTENT_URI, Event.EVENT_CHECKIN_DIGEST + " = \"" + checkinDigest + "\"", null);
|
||||
int d2 = cr.delete(Competitor.CONTENT_URI, Competitor.COMPETITOR_CHECKIN_DIGEST + " = \"" + checkinDigest + "\"", null);
|
||||
int d3 = cr.delete(Leaderboard.CONTENT_URI, Leaderboard.LEADERBOARD_CHECKIN_DIGEST + " = \"" + checkinDigest + "\"", null);
|
||||
int d2 = cr.delete(Competitor.CONTENT_URI, Competitor.COMPETITOR_CHECKIN_DIGEST + " = \"" + checkinDigest
|
||||
+ "\"", null);
|
||||
int d3 = cr.delete(Leaderboard.CONTENT_URI, Leaderboard.LEADERBOARD_CHECKIN_DIGEST + " = \"" + checkinDigest
|
||||
+ "\"", null);
|
||||
|
||||
if (BuildConfig.DEBUG)
|
||||
{
|
||||
if (BuildConfig.DEBUG) {
|
||||
ExLog.i(context, TAG, "Checkout, number of events deleted: " + d1);
|
||||
ExLog.i(context, TAG, "Checkout, number of competitors deleted: " + d2);
|
||||
ExLog.i(context, TAG, "Checkout, number of leaderbards deleted: " + d3);
|
||||
@@ -232,8 +231,7 @@ public class DatabaseHelper {
|
||||
}
|
||||
|
||||
/**
|
||||
* When checking in, store info on the event, the competitor and the leaderboard
|
||||
* in the database.
|
||||
* When checking in, store info on the event, the competitor and the leaderboard in the database.
|
||||
*
|
||||
* @param context
|
||||
* @param event
|
||||
@@ -244,8 +242,8 @@ public class DatabaseHelper {
|
||||
* @throws OperationApplicationException
|
||||
* @throws RemoteException
|
||||
*/
|
||||
public void storeCheckinRow(Context context, EventInfo event, CompetitorInfo competitor,
|
||||
LeaderboardInfo leaderboard) throws GeneralDatabaseHelperException {
|
||||
public void storeCheckinRow(Context context, EventInfo event, CompetitorInfo competitor, LeaderboardInfo leaderboard)
|
||||
throws GeneralDatabaseHelperException {
|
||||
|
||||
// inserting leaderboard first
|
||||
|
||||
@@ -294,11 +292,11 @@ public class DatabaseHelper {
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the combination of event, leaderboard and
|
||||
* competitor does not exist in the DB. (based on the digest of the checkin-
|
||||
* url obtained from the QR-code.)
|
||||
* Return true if the combination of event, leaderboard and competitor does not exist in the DB. (based on the
|
||||
* digest of the checkin- url obtained from the QR-code.)
|
||||
*
|
||||
* @param checkinDigest SHA-256 digest of QR-code string
|
||||
* @param checkinDigest
|
||||
* SHA-256 digest of QR-code string
|
||||
* @param leaderboardName
|
||||
* @param competitorId
|
||||
* @return
|
||||
@@ -310,9 +308,7 @@ public class DatabaseHelper {
|
||||
+ "\" AND competitors.competitor_checkin_digest = \"" + checkinDigest
|
||||
+ "\" AND events.event_checkin_digest = \"" + checkinDigest + "\"";
|
||||
|
||||
Cursor cursor = cr.query(
|
||||
AnalyticsContract.EventLeaderboardCompetitorJoined.CONTENT_URI,
|
||||
null, sel, null, null);
|
||||
Cursor cursor = cr.query(AnalyticsContract.EventLeaderboardCompetitorJoined.CONTENT_URI, null, sel, null, null);
|
||||
|
||||
int count = cursor.getCount();
|
||||
|
||||
|
||||
Reference in new issue
Block a user