android: Show a hint when the gamelist is empty
This commit is contained in:
parent
633bf381d7
commit
f0dde11030
@ -5,6 +5,7 @@ import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.fragment.app.Fragment;
|
||||
@ -22,6 +23,7 @@ public final class PlatformGamesFragment extends Fragment implements PlatformGam
|
||||
|
||||
private GameAdapter mAdapter;
|
||||
private RecyclerView mRecyclerView;
|
||||
private TextView mTextView;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
@ -62,6 +64,7 @@ public final class PlatformGamesFragment extends Fragment implements PlatformGam
|
||||
@Override
|
||||
public void refresh() {
|
||||
mPresenter.refresh();
|
||||
updateTextView();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -69,9 +72,15 @@ public final class PlatformGamesFragment extends Fragment implements PlatformGam
|
||||
if (mAdapter != null) {
|
||||
mAdapter.swapCursor(games);
|
||||
}
|
||||
updateTextView();
|
||||
}
|
||||
|
||||
private void updateTextView() {
|
||||
mTextView.setVisibility(mAdapter.getItemCount() == 0 ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
|
||||
private void findViews(View root) {
|
||||
mRecyclerView = root.findViewById(R.id.grid_games);
|
||||
mTextView = root.findViewById(R.id.gamelist_empty_text);
|
||||
}
|
||||
}
|
||||
|
@ -9,13 +9,25 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/grid_games"
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="@dimen/activity_horizontal_margin"
|
||||
android:layout_marginRight="@dimen/activity_horizontal_margin"
|
||||
tools:listitem="@layout/card_game"/>
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/gamelist_empty_text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:text="@string/empty_gamelist"
|
||||
android:visibility="gone"
|
||||
android:textSize="18sp"
|
||||
android:gravity="center"/>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/grid_games"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:listitem="@layout/card_game" />
|
||||
</RelativeLayout>
|
||||
|
||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||
</FrameLayout>
|
@ -125,6 +125,7 @@
|
||||
<string name="external_storage_not_mounted">The external storage needs to be available in order to use Citra</string>
|
||||
|
||||
<string name="select_dir">Select This Directory</string>
|
||||
<string name="empty_gamelist">No files were found or no game directory has been selected yet.</string>
|
||||
|
||||
<!-- Software Keyboard -->
|
||||
<string name="software_keyboard">Software Keyboard</string>
|
||||
|
Loading…
x
Reference in New Issue
Block a user