Conversation
Image db
sproshev
left a comment
There was a problem hiding this comment.
Посмотрел все, кроме Message, ImageStorage, SendMM. Часть Activity пропустил, т.к. еще недописано (создание наборов карт и т.п.)
| android:text="Повторите новый пароль:" | ||
| android:layout_width="match_parent" | ||
| android:layout_height="wrap_content" | ||
| android:id="@+id/changePasswordNew1" |
There was a problem hiding this comment.
@+id/changePasswordNew1 в этом файле определен два раза, и идея (андроид студия) это подсвечивает
| //TODO: get rid of BroadcastReceivers | ||
| public class MainActivity extends AppCompatActivity implements Message.LoginMessageListener, | ||
| Message.RatingMessageListener { | ||
| private static final String RATING_PREFIX = "Рейтинг: "; |
There was a problem hiding this comment.
все отображаемые сообщения должны быть в ресурсах
| nicknameText = (TextView)findViewById(R.id.mainNickname); | ||
| ratingText = (TextView)findViewById(R.id.mainRatingText); | ||
|
|
||
| ImageStorage.createImageStorage(this); |
There was a problem hiding this comment.
можно попробовать сделать так, чтобы хранилище картинок создавалось при первом обращении к нему, т.к. приложение может так поменяться, что запуск необязательно будет с MainActivity. В общем типичный синглтон
| //TODO: get rid of BroadcastReceivers | ||
| public class MainActivity extends AppCompatActivity implements Message.LoginMessageListener, | ||
| Message.RatingMessageListener { | ||
| private static final String RATING_PREFIX = "Рейтинг: "; |
There was a problem hiding this comment.
все отображаемые пользователю строки должны быть в ресурсах
There was a problem hiding this comment.
включая те, что участвуют в layout-xml-файлах
| if (code != LoginActivity.SUCCESSFUL_LOGIN) { | ||
| Intent login = new Intent(this, LoginActivity.class); | ||
| startActivity(login); | ||
| } |
There was a problem hiding this comment.
при этом пользователю лучше что-то сказать
| @@ -0,0 +1,51 @@ | |||
| package ru.spbau.resemblance; | |||
| @@ -0,0 +1,21 @@ | |||
| package ru.spbau.resemblance; | |||
| @@ -0,0 +1,37 @@ | |||
| package ru.spbau.resemblance; | |||
There was a problem hiding this comment.
немного не понял, он и принимает и получает сообщения? какое предназначение у этого класса?
| public void onItemClick(AdapterView<?> parent, View view, int position, long id) { | ||
| DeletePlayerDialog dialog = new DeletePlayerDialog(); | ||
| dialog.setPlayer(position); | ||
| dialog.setActivity(this); |
There was a problem hiding this comment.
Она ругается, говорит что у такого фрагмента не может быть конструкторов с параметрами, а поля надо задавать через сеттеры.
| LocalBroadcastManager.getInstance(this).sendBroadcast(new Intent(PLAYERS_LIST_UPDATE_MESSAGE)); | ||
| } | ||
|
|
||
| public static class DeletePlayerDialog extends DialogFragment { |
There was a problem hiding this comment.
На private тоже ругается.
|
|
||
| private static void addTestSet(Context context, String nameSet, String prefCardName, int sizeSet) { | ||
| SetCardsWrapped setCards = new SetCardsWrapped(); | ||
| setCards.setNameSetCards(nameSet); |
| private static void addTestSet(Context context, String nameSet, String prefCardName, int sizeSet) { | ||
| SetCardsWrapped setCards = new SetCardsWrapped(); | ||
| setCards.setNameSetCards(nameSet); | ||
| setCards.addSetCards(); |
There was a problem hiding this comment.
из названия непонятно, что делает метод, может putToDb?
There was a problem hiding this comment.
addTestSet или addSetCards?
| for (int i = 1; i <= sizeSet; i++) { | ||
| int curId = context.getResources().getIdentifier(prefCardName + i, "drawable", context.getPackageName()); | ||
| Resources resources = context.getResources(); | ||
| ImageWrapped curImage = addImageByUri(ContentResolver.SCHEME_ANDROID_RESOURCE + "://" + resources.getResourcePackageName(curId) + '/' + resources.getResourceTypeName(curId) + '/' + resources.getResourceEntryName(curId), context); |
There was a problem hiding this comment.
этот метод никуда ничего не добавляет
There was a problem hiding this comment.
Это про addImageByUri?
| private static void printToLogCur(Cursor c) { | ||
| StringBuilder newLog = new StringBuilder(); | ||
| for (String columnName : c.getColumnNames()) { | ||
| newLog.append(columnName + " = " + c.getString(c.getColumnIndex(columnName)) + " ; "); |
| long hashImage = 0; | ||
| try { | ||
| Uri uri = Uri.parse(uriImage); | ||
| InputStream stream = new BufferedInputStream(context.getContentResolver().openInputStream(uri)); |
| Log.d(LOG_TAG, "Wrong image"); | ||
| } | ||
| imageDB.close(); | ||
| } |
There was a problem hiding this comment.
в каких случаях используется? почему может потребоваться обновить объект и как получить ситуацию, что обновленные данные будут отличаться от текущих?
There was a problem hiding this comment.
Это к setImageInfo?
| setIdImage(imageDB.getWritableDatabase().insert(IMAGE_TABLE, null, cv)); | ||
| imageDB.close(); | ||
| return true; | ||
| } |
| hashSetCards = newHash; | ||
| } | ||
|
|
||
| private SetCardsWrapped(Cursor c) { |
| return true; | ||
| } | ||
|
|
||
| public static void sendMessage(final byte[] message) { |
There was a problem hiding this comment.
на каждую запись стартует новый поток?(
| @@ -0,0 +1,154 @@ | |||
| package ru.spbau.resemblance; | |||
There was a problem hiding this comment.
почему бы не забить на этот модуль и начать использовать AsyncTask? надо что-то спросить у сервера, запустил таску, она выполнилась, результат отдала
There was a problem hiding this comment.
Не вся коммуникация состоит из запросов к серверу. Во время игры сервер присылает нам данные о раунде; сообщения, с запросом на выбор карты. Что делать с ними?
Я недавно узнал про runInInterfaceThread и собираюсь убрать BroadcastReceiver.