summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
Diffstat (limited to 'java')
-rw-r--r--java/res/values-bn/strings.xml2
-rw-r--r--java/res/values-ca/strings.xml2
-rw-r--r--java/src/com/android/intentresolver/ChooserActivity.java18
-rw-r--r--java/src/com/android/intentresolver/ChooserListAdapter.java35
4 files changed, 44 insertions, 13 deletions
diff --git a/java/res/values-bn/strings.xml b/java/res/values-bn/strings.xml
index 544f57de..69cbed55 100644
--- a/java/res/values-bn/strings.xml
+++ b/java/res/values-bn/strings.xml
@@ -56,7 +56,7 @@
<string name="other_files" msgid="4501185823517473875">"{count,plural, =1{আরও #টি ফাইল}one{আরও #টি ফাইল}other{আরও #টি ফাইল}}"</string>
<string name="more_files" msgid="1043875756612339842">"{count,plural, =1{আরও #টি ফাইল}one{আরও #টি ফাইল}other{আরও #টি ফাইল}}"</string>
<string name="sharing_text" msgid="8137537443603304062">"টেক্সট শেয়ার করা হচ্ছে"</string>
- <string name="sharing_link" msgid="2307694372813942916">"শেয়ার করার জন্য লিঙ্ক"</string>
+ <string name="sharing_link" msgid="2307694372813942916">"লিঙ্ক শেয়ার করা হচ্ছে"</string>
<string name="sharing_images" msgid="5251443722186962006">"{count,plural, =1{ছবি শেয়ার করা হচ্ছে}one{#টি ছবি শেয়ার করা হচ্ছে}other{#টি ছবি শেয়ার করা হচ্ছে}}"</string>
<string name="sharing_videos" msgid="3583423190182877434">"{count,plural, =1{ভিডিও শেয়ার করা হচ্ছে}one{#টি ভিডিও শেয়ার করা হচ্ছে}other{#টি ভিডিও শেয়ার করা হচ্ছে}}"</string>
<string name="sharing_files" msgid="1275646542246028823">"{count,plural, =1{#টি ফাইল শেয়ার করা হচ্ছে}one{#টি ফাইল শেয়ার করা হচ্ছে}other{#টি ফাইল শেয়ার করা হচ্ছে}}"</string>
diff --git a/java/res/values-ca/strings.xml b/java/res/values-ca/strings.xml
index 23ae264b..dd003124 100644
--- a/java/res/values-ca/strings.xml
+++ b/java/res/values-ca/strings.xml
@@ -57,7 +57,7 @@
<string name="more_files" msgid="1043875756612339842">"{count,plural, =1{# fitxer més}many{# de fitxers més}other{# fitxers més}}"</string>
<string name="sharing_text" msgid="8137537443603304062">"S\'està compartint text"</string>
<string name="sharing_link" msgid="2307694372813942916">"S\'està compartint un enllaç"</string>
- <string name="sharing_images" msgid="5251443722186962006">"{count,plural, =1{]S\'està compartint una imatge}many{S\'estan compartint # d\'imatges}other{S\'estan compartint # imatges}}"</string>
+ <string name="sharing_images" msgid="5251443722186962006">"{count,plural, =1{S\'està compartint una imatge}many{S\'estan compartint # d\'imatges}other{S\'estan compartint # imatges}}"</string>
<string name="sharing_videos" msgid="3583423190182877434">"{count,plural, =1{S\'està compartint un vídeo}many{S\'estan compartint # de vídeos}other{S\'estan compartint # vídeos}}"</string>
<string name="sharing_files" msgid="1275646542246028823">"{count,plural, =1{S\'està compartint # fitxer}many{S\'estan compartint # de fitxers}other{S\'estan compartint # fitxers}}"</string>
<string name="select_items_to_share" msgid="1026071777275022579">"Selecciona els elements que vols compartir"</string>
diff --git a/java/src/com/android/intentresolver/ChooserActivity.java b/java/src/com/android/intentresolver/ChooserActivity.java
index d4cf82ff..aff34580 100644
--- a/java/src/com/android/intentresolver/ChooserActivity.java
+++ b/java/src/com/android/intentresolver/ChooserActivity.java
@@ -23,6 +23,7 @@ import static android.view.WindowManager.LayoutParams.SYSTEM_FLAG_HIDE_NON_SYSTE
import static androidx.lifecycle.LifecycleKt.getCoroutineScope;
import static com.android.intentresolver.ChooserActionFactory.EDIT_SOURCE;
+import static com.android.intentresolver.Flags.delayDrawerOffsetCalculation;
import static com.android.intentresolver.Flags.fixShortcutsFlashingFixed;
import static com.android.intentresolver.Flags.interactiveSession;
import static com.android.intentresolver.Flags.keyboardNavigationFix;
@@ -2353,6 +2354,9 @@ public class ChooserActivity extends Hilt_ChooserActivity implements
|| recyclerView.computeVerticalScrollOffset() != 0) {
return;
}
+ if (delayDrawerOffsetCalculation() && !gridAdapter.getListAdapter().areAppTargetsReady()) {
+ return;
+ }
final int availableWidth = right - left - v.getPaddingLeft() - v.getPaddingRight();
final int maxChooserWidth = getResources().getDimensionPixelSize(R.dimen.chooser_width);
@@ -2381,7 +2385,7 @@ public class ChooserActivity extends Hilt_ChooserActivity implements
}
getMainThreadHandler().post(() -> {
- if (mResolverDrawerLayout == null || gridAdapter == null) {
+ if (mResolverDrawerLayout == null) {
return;
}
int offset = calculateDrawerOffset(top, bottom, recyclerView, gridAdapter);
@@ -2482,15 +2486,9 @@ public class ChooserActivity extends Hilt_ChooserActivity implements
//TODO: move this block inside ChooserListAdapter (should be called when
// ResolverListAdapter#mPostListReadyRunnable is executed.
- if (chooserListAdapter.getDisplayResolveInfoCount() == 0) {
- Log.d(TAG, "getDisplayResolveInfoCount() == 0");
- if (rebuildComplete) {
- onAppTargetsLoaded(listAdapter);
- }
- chooserListAdapter.notifyDataSetChanged();
- } else {
- chooserListAdapter.updateAlphabeticalList(() -> onAppTargetsLoaded(listAdapter));
- }
+ chooserListAdapter.updateAlphabeticalList(
+ rebuildComplete,
+ () -> onAppTargetsLoaded(listAdapter));
if (rebuildComplete) {
long duration = Tracer.INSTANCE.endAppTargetLoadingSection(listProfileUserHandle);
diff --git a/java/src/com/android/intentresolver/ChooserListAdapter.java b/java/src/com/android/intentresolver/ChooserListAdapter.java
index d743f859..7e5de74b 100644
--- a/java/src/com/android/intentresolver/ChooserListAdapter.java
+++ b/java/src/com/android/intentresolver/ChooserListAdapter.java
@@ -124,6 +124,21 @@ public class ChooserListAdapter extends ResolverListAdapter {
private final ItemRevealAnimationTracker mAnimationTracker = new ItemRevealAnimationTracker();
+ /**
+ * Indicates whether the app targets are ready. The flag is reset in
+ * {@link #rebuildList(boolean)} and set to true in {@link #updateAlphabeticalList(Runnable)}'s
+ * onPostExecute.
+ * There's one nuance though, {@link #updateAlphabeticalList(Runnable)} is called by the
+ * {@link ChooserActivity} only when {@link #rebuildList(boolean)} was called with {@code true}
+ * It is called with {@code false} only for inactive tabs in the
+ * MultiProfilePagerAdapter.rebuildTabs which, in turn, is called from either
+ * {@link ChooserActivity#recreatePagerAdapter} or {@link ChooserActivity#configureContentView}
+ * and, in both cases, there are no inactive pages in the MultiProfilePagerAdapter and
+ * {@link #rebuildList(boolean)} will be called with true upon navigation to the missing page.
+ * Yeah.
+ */
+ private boolean mAppTargetsReady = false;
+
// For pinned direct share labels, if the text spans multiple lines, the TextView will consume
// the full width, even if the characters actually take up less than that. Measure the actual
// line widths and constrain the View's width based upon that so that the pin doesn't end up
@@ -312,6 +327,13 @@ public class ChooserListAdapter extends ResolverListAdapter {
}
/**
+ * @return {@code true} if the app targets are ready.
+ */
+ public final boolean areAppTargetsReady() {
+ return mAppTargetsReady;
+ }
+
+ /**
* Set the enabled state for all targets.
*/
public void setTargetsEnabled(boolean isEnabled) {
@@ -354,6 +376,7 @@ public class ChooserListAdapter extends ResolverListAdapter {
public boolean rebuildList(boolean doPostProcessing) {
mAnimationTracker.reset();
mSortedList.clear();
+ mAppTargetsReady = false;
boolean result = super.rebuildList(doPostProcessing);
notifyDataSetChanged();
return result;
@@ -518,7 +541,16 @@ public class ChooserListAdapter extends ResolverListAdapter {
/**
* Group application targets
*/
- public void updateAlphabeticalList(Runnable onCompleted) {
+ public void updateAlphabeticalList(boolean rebuildComplete, Runnable onCompleted) {
+ if (getDisplayResolveInfoCount() == 0) {
+ Log.d(TAG, "getDisplayResolveInfoCount() == 0");
+ if (rebuildComplete) {
+ mAppTargetsReady = true;
+ onCompleted.run();
+ }
+ notifyDataSetChanged();
+ return;
+ }
final DisplayResolveInfoAzInfoComparator
comparator = new DisplayResolveInfoAzInfoComparator(mContext);
ImmutableList<DisplayResolveInfo> displayList = getTargetsInCurrentDisplayList();
@@ -582,6 +614,7 @@ public class ChooserListAdapter extends ResolverListAdapter {
protected void onPostExecute(List<DisplayResolveInfo> newList) {
mSortedList.clear();
mSortedList.addAll(newList);
+ mAppTargetsReady = true;
notifyDataSetChanged();
onCompleted.run();
}