Some improvements suggested by Codacy
This commit is contained in:
parent
422c7ac803
commit
6540df4fc9
@ -160,6 +160,7 @@ public class AddressDetailFragment extends Fragment {
|
|||||||
shareIntent.setType("text/plain");
|
shareIntent.setType("text/plain");
|
||||||
shareIntent.putExtra(Intent.EXTRA_TEXT, item.getAddress());
|
shareIntent.putExtra(Intent.EXTRA_TEXT, item.getAddress());
|
||||||
startActivity(Intent.createChooser(shareIntent, null));
|
startActivity(Intent.createChooser(shareIntent, null));
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
|
@ -29,7 +29,6 @@ import android.widget.Toast;
|
|||||||
import com.mikepenz.aboutlibraries.Libs;
|
import com.mikepenz.aboutlibraries.Libs;
|
||||||
import com.mikepenz.aboutlibraries.LibsBuilder;
|
import com.mikepenz.aboutlibraries.LibsBuilder;
|
||||||
|
|
||||||
import ch.dissem.apps.abit.repository.AndroidNodeRegistry;
|
|
||||||
import ch.dissem.apps.abit.service.Singleton;
|
import ch.dissem.apps.abit.service.Singleton;
|
||||||
import ch.dissem.apps.abit.synchronization.SyncAdapter;
|
import ch.dissem.apps.abit.synchronization.SyncAdapter;
|
||||||
import ch.dissem.bitmessage.BitmessageContext;
|
import ch.dissem.bitmessage.BitmessageContext;
|
||||||
|
@ -337,7 +337,7 @@ public class AndroidMessageRepository extends AbstractMessageRepository {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void insert(SQLiteDatabase db, Plaintext message) {
|
private ContentValues getValues(Plaintext message) {
|
||||||
ContentValues values = new ContentValues();
|
ContentValues values = new ContentValues();
|
||||||
values.put(COLUMN_IV, message.getInventoryVector() == null ? null : message
|
values.put(COLUMN_IV, message.getInventoryVector() == null ? null : message
|
||||||
.getInventoryVector().getHash());
|
.getInventoryVector().getHash());
|
||||||
@ -354,28 +354,16 @@ public class AndroidMessageRepository extends AbstractMessageRepository {
|
|||||||
values.put(COLUMN_RETRIES, message.getRetries());
|
values.put(COLUMN_RETRIES, message.getRetries());
|
||||||
values.put(COLUMN_NEXT_TRY, message.getNextTry());
|
values.put(COLUMN_NEXT_TRY, message.getNextTry());
|
||||||
values.put(COLUMN_CONVERSATION, UuidUtils.asBytes(message.getConversationId()));
|
values.put(COLUMN_CONVERSATION, UuidUtils.asBytes(message.getConversationId()));
|
||||||
long id = db.insertOrThrow(TABLE_NAME, null, values);
|
return values;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void insert(SQLiteDatabase db, Plaintext message) {
|
||||||
|
long id = db.insertOrThrow(TABLE_NAME, null, getValues(message));
|
||||||
message.setId(id);
|
message.setId(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void update(SQLiteDatabase db, Plaintext message) {
|
private void update(SQLiteDatabase db, Plaintext message) {
|
||||||
ContentValues values = new ContentValues();
|
db.update(TABLE_NAME, getValues(message), "id = " + message.getId(), null);
|
||||||
values.put(COLUMN_IV, message.getInventoryVector() == null ? null : message
|
|
||||||
.getInventoryVector().getHash());
|
|
||||||
values.put(COLUMN_TYPE, message.getType().name());
|
|
||||||
values.put(COLUMN_SENDER, message.getFrom().getAddress());
|
|
||||||
values.put(COLUMN_RECIPIENT, message.getTo() == null ? null : message.getTo().getAddress());
|
|
||||||
values.put(COLUMN_DATA, Encode.bytes(message));
|
|
||||||
values.put(COLUMN_ACK_DATA, message.getAckData());
|
|
||||||
values.put(COLUMN_SENT, message.getSent());
|
|
||||||
values.put(COLUMN_RECEIVED, message.getReceived());
|
|
||||||
values.put(COLUMN_STATUS, message.getStatus() == null ? null : message.getStatus().name());
|
|
||||||
values.put(COLUMN_INITIAL_HASH, message.getInitialHash());
|
|
||||||
values.put(COLUMN_TTL, message.getTTL());
|
|
||||||
values.put(COLUMN_RETRIES, message.getRetries());
|
|
||||||
values.put(COLUMN_NEXT_TRY, message.getNextTry());
|
|
||||||
values.put(COLUMN_CONVERSATION, UuidUtils.asBytes(message.getConversationId()));
|
|
||||||
db.update(TABLE_NAME, values, "id = " + message.getId(), null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -10,7 +10,6 @@ import android.database.sqlite.SQLiteStatement;
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
Loading…
Reference in New Issue
Block a user