cache names
This commit is contained in:
parent
4a98f6e031
commit
0b5fa43f47
4 changed files with 13 additions and 3 deletions
|
@ -22,7 +22,8 @@ android {
|
|||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled true
|
||||
minifyEnabled = true
|
||||
shrinkResources = true
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ public class TagImpl implements Tag {
|
|||
|
||||
private final SQLiteDatabase db;
|
||||
private final int id;
|
||||
private String _cached_name;
|
||||
|
||||
protected TagImpl(SQLiteDatabase db, int id) {
|
||||
this.db = db;
|
||||
|
@ -43,6 +44,9 @@ public class TagImpl implements Tag {
|
|||
@Override
|
||||
public String getName() {
|
||||
synchronized (this.db) {
|
||||
if (this._cached_name != null)
|
||||
return this._cached_name;
|
||||
|
||||
Cursor cursor = db.query(
|
||||
"tag",
|
||||
new String[] { "name" },
|
||||
|
@ -54,7 +58,7 @@ public class TagImpl implements Tag {
|
|||
);
|
||||
|
||||
if (Utils.findResult(cursor)) {
|
||||
return cursor.getString(0);
|
||||
return this._cached_name = cursor.getString(0);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
|
@ -112,7 +112,12 @@ class QueueRecyclerViewAdapter extends RecyclerView.Adapter<QueueRecyclerViewAda
|
|||
viewHolder.getBinding().queueListItemStats.setText(Integer.toString(queues[position].getEventCount()));
|
||||
|
||||
viewHolder.getBinding().queueListItemPlus.setOnClickListener((View view) -> {
|
||||
Bundle extra = new Bundle();
|
||||
extra.putInt("queue_id", this.queues[position].getId());
|
||||
|
||||
Intent intent = new Intent(view.getContext(), EventEditActivity.class);
|
||||
intent.putExtras(extra);
|
||||
|
||||
view.getContext().startActivity(intent);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
android:padding="@dimen/queue_list_item_main_padding">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
|
Loading…
Reference in a new issue