resolves merge conflict
This commit is contained in:
commit
74549f4de7
|
@ -59,6 +59,5 @@ dependencies {
|
||||||
//room
|
//room
|
||||||
compile "android.arch.persistence.room:runtime:1.0.0-alpha3"
|
compile "android.arch.persistence.room:runtime:1.0.0-alpha3"
|
||||||
annotationProcessor "android.arch.persistence.room:compiler:1.0.0-alpha3"
|
annotationProcessor "android.arch.persistence.room:compiler:1.0.0-alpha3"
|
||||||
compile "android.arch.persistence.room:rxjava2:1.0.0-alpha2"
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -153,7 +153,7 @@ public class ComposeActivity extends BaseActivity implements ComposeOptionsFragm
|
||||||
private InputContentInfoCompat currentInputContentInfo;
|
private InputContentInfoCompat currentInputContentInfo;
|
||||||
private int currentFlags;
|
private int currentFlags;
|
||||||
private Uri photoUploadUri;
|
private Uri photoUploadUri;
|
||||||
|
private int savedTootUid = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Target object must be stored as a member field or method and cannot be an anonymous class otherwise this won't work as expected. The reason is that Picasso accepts this parameter as a weak memory reference. Because anonymous classes are eligible for garbage collection when there are no more references, the network request to fetch the image may finish after this anonymous class has already been reclaimed. See this Stack Overflow discussion for more details.
|
* The Target object must be stored as a member field or method and cannot be an anonymous class otherwise this won't work as expected. The reason is that Picasso accepts this parameter as a weak memory reference. Because anonymous classes are eligible for garbage collection when there are no more references, the network request to fetch the image may finish after this anonymous class has already been reclaimed. See this Stack Overflow discussion for more details.
|
||||||
|
@ -308,8 +308,12 @@ public class ComposeActivity extends BaseActivity implements ComposeOptionsFragm
|
||||||
// try to redo a list of media
|
// try to redo a list of media
|
||||||
ArrayList<String> playersList = new Gson().fromJson(savedJsonUrls,
|
ArrayList<String> playersList = new Gson().fromJson(savedJsonUrls,
|
||||||
new TypeToken<ArrayList<String>>() {
|
new TypeToken<ArrayList<String>>() {
|
||||||
}.getType());
|
}.getType());
|
||||||
|
}
|
||||||
|
|
||||||
|
int savedTootUid = intent.getIntExtra("saved_toot_uid", 0);
|
||||||
|
if (savedTootUid != 0) {
|
||||||
|
this.savedTootUid = savedTootUid;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -545,7 +549,12 @@ public class ComposeActivity extends BaseActivity implements ComposeOptionsFragm
|
||||||
new AsyncTask<Void, Void, Void>() {
|
new AsyncTask<Void, Void, Void>() {
|
||||||
@Override
|
@Override
|
||||||
protected Void doInBackground(Void... params) {
|
protected Void doInBackground(Void... params) {
|
||||||
tootDao.insert(toot);
|
if (savedTootUid != 0) {
|
||||||
|
toot.setUid(savedTootUid);
|
||||||
|
tootDao.updateToot(toot);
|
||||||
|
} else {
|
||||||
|
tootDao.insert(toot);
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}.execute();
|
}.execute();
|
||||||
|
|
|
@ -72,6 +72,12 @@ public class SavedTootActivity extends BaseActivity implements SavedTootAdapter.
|
||||||
adapter = new SavedTootAdapter(this);
|
adapter = new SavedTootAdapter(this);
|
||||||
recyclerView.setAdapter(adapter);
|
recyclerView.setAdapter(adapter);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
|
||||||
// req
|
// req
|
||||||
getAllToot();
|
getAllToot();
|
||||||
}
|
}
|
||||||
|
@ -99,7 +105,10 @@ public class SavedTootActivity extends BaseActivity implements SavedTootAdapter.
|
||||||
super.onPostExecute(tootEntities);
|
super.onPostExecute(tootEntities);
|
||||||
// set ui
|
// set ui
|
||||||
setNoContent(tootEntities.size());
|
setNoContent(tootEntities.size());
|
||||||
adapter.addItems(tootEntities);
|
if (adapter != null) {
|
||||||
|
adapter.setItems(tootEntities);
|
||||||
|
adapter.notifyDataSetChanged();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}.execute();
|
}.execute();
|
||||||
}
|
}
|
||||||
|
@ -126,6 +135,7 @@ public class SavedTootActivity extends BaseActivity implements SavedTootAdapter.
|
||||||
@Override
|
@Override
|
||||||
public void click(int position, TootEntity item) {
|
public void click(int position, TootEntity item) {
|
||||||
Intent intent = new Intent(this, ComposeActivity.class);
|
Intent intent = new Intent(this, ComposeActivity.class);
|
||||||
|
intent.putExtra("saved_toot_uid", item.getUid());
|
||||||
intent.putExtra("saved_toot_text", item.getText());
|
intent.putExtra("saved_toot_text", item.getText());
|
||||||
intent.putExtra("saved_json_urls", item.getUrls());
|
intent.putExtra("saved_json_urls", item.getUrls());
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
|
|
|
@ -59,6 +59,11 @@ public class SavedTootAdapter extends RecyclerView.Adapter {
|
||||||
return list.size();
|
return list.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setItems(List<TootEntity> newToot) {
|
||||||
|
list = new ArrayList<>();
|
||||||
|
list.addAll(newToot);
|
||||||
|
}
|
||||||
|
|
||||||
public void addItems(List<TootEntity> newToot) {
|
public void addItems(List<TootEntity> newToot) {
|
||||||
int end = list.size();
|
int end = list.size();
|
||||||
list.addAll(newToot);
|
list.addAll(newToot);
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.keylesspalace.tusky.db;
|
||||||
import android.arch.persistence.room.Dao;
|
import android.arch.persistence.room.Dao;
|
||||||
import android.arch.persistence.room.Delete;
|
import android.arch.persistence.room.Delete;
|
||||||
import android.arch.persistence.room.Insert;
|
import android.arch.persistence.room.Insert;
|
||||||
|
import android.arch.persistence.room.OnConflictStrategy;
|
||||||
import android.arch.persistence.room.Query;
|
import android.arch.persistence.room.Query;
|
||||||
import android.arch.persistence.room.Update;
|
import android.arch.persistence.room.Update;
|
||||||
|
|
||||||
|
@ -23,12 +24,9 @@ public interface TootDao {
|
||||||
@Query("SELECT * FROM TootEntity")
|
@Query("SELECT * FROM TootEntity")
|
||||||
List<TootEntity> loadAll();
|
List<TootEntity> loadAll();
|
||||||
|
|
||||||
@Query("SELECT * FROM TootEntity WHERE uid IN (:uid)")
|
|
||||||
List<TootEntity> loadAllByTootId(int... uid);
|
|
||||||
|
|
||||||
// u
|
// u
|
||||||
@Update
|
@Update
|
||||||
void updateToot(TootEntity... toot);
|
void updateToot(TootEntity toot);
|
||||||
|
|
||||||
// d
|
// d
|
||||||
@Delete
|
@Delete
|
||||||
|
|
Loading…
Reference in New Issue