Merge hour glass and spinner

This commit is contained in:
M66B 2019-06-12 18:26:15 +02:00
parent 91f0daface
commit 58a45aff3f
3 changed files with 11 additions and 37 deletions

View File

@ -61,7 +61,6 @@ import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.SeekBar;
import android.widget.TextView;
@ -123,7 +122,6 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
private ImageButton ibHintSwipe;
private ImageButton ibHintSelect;
private TextView tvNoEmail;
private ImageView ivBusy;
private FixedRecyclerView rvMessage;
private SeekBar seekBar;
private ImageButton ibDown;
@ -168,6 +166,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
private boolean connected;
private boolean reset = false;
private String searching = null;
private boolean initialized = false;
private boolean loading = false;
private boolean manual = false;
private Integer lastUnseen = null;
@ -270,7 +269,6 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
ibHintSwipe = view.findViewById(R.id.ibHintSwipe);
ibHintSelect = view.findViewById(R.id.ibHintSelect);
tvNoEmail = view.findViewById(R.id.tvNoEmail);
ivBusy = view.findViewById(R.id.ivBusy);
rvMessage = view.findViewById(R.id.rvMessage);
seekBar = view.findViewById(R.id.seekBar);
ibDown = view.findViewById(R.id.ibDown);
@ -772,7 +770,6 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
updateSwipeRefresh();
ivBusy.setVisibility(View.GONE);
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(getContext());
IntentFilter iff = new IntentFilter();
iff.addAction(SimpleTask.ACTION_TASK_COUNT);
@ -793,16 +790,11 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
@Override
public void onReceive(Context context, Intent intent) {
busy = intent.getIntExtra("count", 0);
if (busy == 0)
ivBusy.setVisibility(View.GONE);
else
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
if (busy > 0)
ivBusy.setVisibility(View.VISIBLE);
}
}, 1500);
if (busy == 0) {
if (initialized && !loading)
pbWait.setVisibility(View.GONE);
} else
pbWait.setVisibility(View.VISIBLE);
}
};
@ -2719,7 +2711,8 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
if (submitted == null)
return;
pbWait.setVisibility(View.GONE);
if (initialized && busy == 0)
pbWait.setVisibility(View.GONE);
if (submitted + fetched == 0)
tvNoEmail.setVisibility(View.VISIBLE);
}
@ -2761,7 +2754,8 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
rvMessage.setTag(messages.size());
if (!loading) {
initialized = true;
if (!loading && busy == 0) {
pbWait.setVisibility(View.GONE);
if (messages.size() == 0)
tvNoEmail.setVisibility(View.VISIBLE);

View File

@ -1,10 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M6,2v6h0.01L6,8.01 10,12l-4,4 0.01,0.01H6V22h12v-5.99h-0.01L18,16l-4,-4 4,-3.99 -0.01,-0.01H18V2H6z"/>
</vector>

View File

@ -143,16 +143,6 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/vSeparatorHintSelect" />
<ImageView
android:id="@+id/ivBusy"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/baseline_hourglass_full_24"
app:layout_constraintBottom_toTopOf="@+id/seekBar"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/vSeparatorHintSelect" />
<eu.faircode.email.FixedRecyclerView
android:id="@+id/rvMessage"
android:layout_width="0dp"
@ -177,7 +167,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:indeterminate="true"
app:layout_constraintBottom_toTopOf="@+id/bottom_navigation"
app:layout_constraintBottom_toTopOf="@+id/seekBar"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/vSeparatorHintSelect" />