From 43b3370c31fbf77f5781978188b056b96a911669 Mon Sep 17 00:00:00 2001 From: tom79 Date: Sat, 7 Mar 2020 12:10:52 +0100 Subject: [PATCH] Layout changes --- app/build.gradle | 10 ++--- .../android/drawers/StatusListAdapter.java | 43 ++++++++++--------- .../fragments/DisplayStatusFragment.java | 3 ++ app/src/main/res/layout/drawer_status.xml | 22 +++++----- .../main/res/layout/drawer_status_compact.xml | 20 ++++----- 5 files changed, 52 insertions(+), 46 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 52bcaebc8..cfecf78f9 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -72,13 +72,13 @@ task gitPushReleaseNotes(type: Exec, dependsOn: 'copyAllReleaseNotes') { dependencies { - implementation 'androidx.appcompat:appcompat:1.1.0' - implementation 'com.google.android.material:material:1.1.0' + implementation 'androidx.appcompat:appcompat:1.2.0-alpha03' + implementation 'com.google.android.material:material:1.2.0-alpha05' implementation 'androidx.legacy:legacy-support-v4:1.0.0' - implementation 'androidx.recyclerview:recyclerview:1.1.0' + implementation 'androidx.recyclerview:recyclerview:1.2.0-alpha01' implementation 'androidx.browser:browser:1.2.0' implementation 'androidx.exifinterface:exifinterface:1.1.0' - implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta4' + implementation 'androidx.constraintlayout:constraintlayout:1.1.2' implementation "com.github.bumptech.glide:glide:4.11.0" implementation ("com.github.bumptech.glide:recyclerview-integration:4.11.0") { // Excludes the support library because it's already included by Glide. @@ -129,6 +129,6 @@ dependencies { implementation 'com.github.penfeizhou.android.animation:gif:1.1.0' implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0' implementation 'com.github.smarteist:autoimageslider:1.3.2' - //debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.0' + debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.2' implementation 'com.jaredrummler:cyanea:1.0.2' } diff --git a/app/src/main/java/app/fedilab/android/drawers/StatusListAdapter.java b/app/src/main/java/app/fedilab/android/drawers/StatusListAdapter.java index 5cf7154c6..8bb50d12c 100644 --- a/app/src/main/java/app/fedilab/android/drawers/StatusListAdapter.java +++ b/app/src/main/java/app/fedilab/android/drawers/StatusListAdapter.java @@ -1568,27 +1568,30 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct Toasty.error(context, context.getString(R.string.toast_error), Toast.LENGTH_LONG).show(); } }); - holder.fetch_more.setOnLongClickListener(v -> { - status.setFetchMore(false); - holder.fetch_more.setEnabled(false); - holder.fetch_more.setVisibility(View.GONE); - if (context instanceof BaseMainActivity) { - SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open(); - List timelines = new TimelinesDAO(context, db).getDisplayedTimelines(); - for (ManageTimelines tl : timelines) { - if (tl.getType() == ManageTimelines.Type.HOME && mPageReferenceMap != null) { - DisplayStatusFragment homeFragment = (DisplayStatusFragment) mPageReferenceMap.get(tl.getPosition()); - if (homeFragment != null) { - fetch_all_more = true; - homeFragment.fetchMore(status.getId()); + holder.fetch_more.setOnLongClickListener(new View.OnLongClickListener() { + @Override + public boolean onLongClick(View v) { + status.setFetchMore(false); + holder.fetch_more.setEnabled(false); + holder.fetch_more.setVisibility(View.GONE); + if (context instanceof BaseMainActivity) { + SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open(); + List timelines = new TimelinesDAO(context, db).getDisplayedTimelines(); + for (ManageTimelines tl : timelines) { + if (tl.getType() == ManageTimelines.Type.HOME && mPageReferenceMap != null) { + DisplayStatusFragment homeFragment = (DisplayStatusFragment) mPageReferenceMap.get(tl.getPosition()); + if (homeFragment != null) { + fetch_all_more = true; + homeFragment.fetchMore(status.getId()); + } + break; } - break; } + } else { + Toasty.error(context, context.getString(R.string.toast_error), Toast.LENGTH_LONG).show(); } - } else { - Toasty.error(context, context.getString(R.string.toast_error), Toast.LENGTH_LONG).show(); + return false; } - return false; }); } else { holder.fetch_more.setVisibility(View.GONE); @@ -1684,12 +1687,12 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct } int statusColor = prefs.getInt("theme_statuses_color", -1); if (holder.main_card_container != null && statusColor != -1) { - holder.main_card_container.setCardBackgroundColor(statusColor); + holder.main_card_container.setBackgroundColor(statusColor); if (holder.translation_label != null) { holder.translation_label.setBackgroundColor(statusColor); } } else if (holder.main_card_container != null) { - holder.main_card_container.setCardBackgroundColor(ThemeHelper.getAttColor(context, R.attr.cardviewColor)); + holder.main_card_container.setBackgroundColor(ThemeHelper.getAttColor(context, R.attr.cardviewColor)); if (holder.translation_label != null) { holder.translation_label.setBackgroundColor(ThemeHelper.getAttColor(context, R.attr.cardviewColor)); } @@ -3970,7 +3973,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct Button quick_reply_button; ImageView quick_reply_privacy; View status_reply_indicator_top, reply_indicator_dot, status_reply_indicator_bottom, status_reply_indicator_diag_top, status_reply_indicator_diag_bottom; - CardView main_card_container; + RelativeLayout main_card_container; LinearLayout main_linear_container; View translation_border_view; TextView translation_label; diff --git a/app/src/main/java/app/fedilab/android/fragments/DisplayStatusFragment.java b/app/src/main/java/app/fedilab/android/fragments/DisplayStatusFragment.java index 37c2fd65b..075809407 100644 --- a/app/src/main/java/app/fedilab/android/fragments/DisplayStatusFragment.java +++ b/app/src/main/java/app/fedilab/android/fragments/DisplayStatusFragment.java @@ -238,6 +238,7 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn statusDrawerParams.setTagTimeline(tagTimelines.get(0)); statusDrawerParams.setTargetedId(targetedId); statusDrawerParams.setOnWifi(isOnWifi); + statusDrawerParams.setType(type); statusDrawerParams.setStatuses(this.statuses); statusListAdapter = new StatusListAdapter(statusDrawerParams); @@ -251,6 +252,7 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn statusDrawerParams.setTargetedId(targetedId); statusDrawerParams.setOnWifi(isOnWifi); statusDrawerParams.setStatuses(this.statuses); + statusDrawerParams.setType(type); statusListAdapter = new StatusListAdapter(statusDrawerParams); lv_status.setAdapter(statusListAdapter); } @@ -276,6 +278,7 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn lv_status.setAdapter(artListAdapter); } mLayoutManager = new LinearLayoutManager(context); + lv_status.setLayoutManager(mLayoutManager); diff --git a/app/src/main/res/layout/drawer_status.xml b/app/src/main/res/layout/drawer_status.xml index a64118c7e..1c8b8f935 100644 --- a/app/src/main/res/layout/drawer_status.xml +++ b/app/src/main/res/layout/drawer_status.xml @@ -54,7 +54,7 @@ app:layout_constraintTop_toTopOf="@id/reply_indicator_dot" /> - + app:tint="@color/white" /> + app:tint="?attr/iconColor" /> @@ -999,7 +999,7 @@ android:layout_marginStart="15dp" android:contentDescription="@string/pin_add" android:src="@drawable/ic_pin_drop" - android:tint="?attr/iconColor" + app:tint="?attr/iconColor" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toEndOf="@id/status_favorite_count" app:layout_constraintTop_toTopOf="parent" /> @@ -1009,7 +1009,7 @@ android:layout_width="25dp" android:layout_height="25dp" android:layout_marginEnd="15dp" - android:tint="?attr/iconColor" + app:tint="?attr/iconColor" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toStartOf="@id/status_more" app:layout_constraintTop_toTopOf="parent" /> @@ -1020,7 +1020,7 @@ android:layout_height="25dp" android:contentDescription="@string/display_toot_truncate" android:src="@drawable/ic_more_horiz" - android:tint="?attr/iconColor" + app:tint="?attr/iconColor" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent" /> @@ -1058,6 +1058,6 @@ - + diff --git a/app/src/main/res/layout/drawer_status_compact.xml b/app/src/main/res/layout/drawer_status_compact.xml index be3b064e2..cd1afe962 100644 --- a/app/src/main/res/layout/drawer_status_compact.xml +++ b/app/src/main/res/layout/drawer_status_compact.xml @@ -56,7 +56,7 @@ app:layout_constraintStart_toStartOf="@id/reply_indicator_dot" app:layout_constraintTop_toTopOf="@id/reply_indicator_dot" /> - + app:tint="?attr/iconColor" /> + app:tint="?attr/iconColor" /> @@ -873,7 +873,7 @@ android:layout_width="30dp" android:layout_height="30dp" android:src="@drawable/ic_reply" - android:tint="?attr/iconColor" + app:tint="?attr/iconColor" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> @@ -954,7 +954,7 @@ android:layout_marginTop="5dp" android:contentDescription="@string/delete" android:src="@drawable/ic_clear_toot" - android:tint="?attr/iconColorMenu" + app:tint="?attr/iconColorMenu" android:visibility="gone" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toEndOf="@id/new_element" @@ -967,7 +967,7 @@ android:layout_marginStart="15dp" android:contentDescription="@string/pin_add" android:src="@drawable/ic_pin_drop" - android:tint="?attr/iconColor" + app:tint="?attr/iconColor" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toEndOf="@id/status_remove" app:layout_constraintTop_toTopOf="parent" /> @@ -987,7 +987,7 @@ android:layout_height="25dp" android:contentDescription="@string/display_toot_truncate" android:src="@drawable/ic_more_horiz" - android:tint="?attr/iconColor" + app:tint="?attr/iconColor" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent" /> @@ -1031,6 +1031,6 @@ - + \ No newline at end of file