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