mirror of
https://github.com/izzy2lost/WeeU.git
synced 2026-07-06 00:19:59 -07:00
Update games fragment design
This commit is contained in:
@@ -7,15 +7,12 @@ import android.graphics.Bitmap;
|
||||
import android.os.Bundle;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
@@ -41,6 +38,10 @@ public class GamesFragment extends Fragment {
|
||||
NativeLibrary.addGamePath(gamesPath);
|
||||
RecyclerView recyclerView = binding.gamesRecyclerView;
|
||||
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||
binding.settingsButton.setOnClickListener(v -> {
|
||||
Intent intent = new Intent(requireActivity(), SettingsActivity.class);
|
||||
startActivity(intent);
|
||||
});
|
||||
View rootView = binding.getRoot();
|
||||
gameAdapter = new GameAdapter(titleId -> {
|
||||
Intent intent = new Intent(getContext(), EmulationActivity.class);
|
||||
@@ -66,12 +67,10 @@ public class GamesFragment extends Fragment {
|
||||
binding.gamesSwipeRefresh.setRefreshing(false);
|
||||
});
|
||||
recyclerView.setAdapter(gameAdapter);
|
||||
NativeLibrary.setGameTitleLoadedCallback((titleId, title) -> {
|
||||
requireActivity().runOnUiThread(() -> {
|
||||
gameAdapter.addGameInfo(titleId, title);
|
||||
NativeLibrary.requestGameIcon(titleId);
|
||||
});
|
||||
});
|
||||
NativeLibrary.setGameTitleLoadedCallback((titleId, title) -> requireActivity().runOnUiThread(() -> {
|
||||
gameAdapter.addGameInfo(titleId, title);
|
||||
NativeLibrary.requestGameIcon(titleId);
|
||||
}));
|
||||
NativeLibrary.setGameIconLoadedCallback((titleId, colors, width, height) -> {
|
||||
Bitmap icon = Bitmap.createBitmap(colors, width, height, Bitmap.Config.ARGB_8888);
|
||||
requireActivity().runOnUiThread(() -> gameAdapter.setGameIcon(titleId, icon));
|
||||
@@ -86,7 +85,6 @@ public class GamesFragment extends Fragment {
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
||||
Log.i("TextChanged", charSequence.toString());
|
||||
gameAdapter.getFilter().filter(charSequence.toString());
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package info.cemu.Cemu;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
@@ -14,11 +13,5 @@ public class MainActivity extends AppCompatActivity {
|
||||
super.onCreate(savedInstanceState);
|
||||
ActivityMainBinding binding = ActivityMainBinding.inflate(getLayoutInflater());
|
||||
setContentView(binding.getRoot());
|
||||
binding.fab.setOnClickListener(
|
||||
view -> {
|
||||
Intent intent = new Intent(MainActivity.this, SettingsActivity.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -14,15 +14,4 @@
|
||||
android:layout_height="match_parent"
|
||||
app:defaultNavHost="true"
|
||||
app:navGraph="@navigation/nav_graph" />
|
||||
|
||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
android:id="@+id/fab"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|end"
|
||||
android:layout_marginEnd="@dimen/settings_fab_margin"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:contentDescription="@string/settings"
|
||||
app:srcCompat="@drawable/ic_settings" />
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
@@ -6,44 +6,72 @@
|
||||
android:layout_height="match_parent"
|
||||
android:padding="8dp">
|
||||
|
||||
<LinearLayout
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
style="?attr/materialCardViewFilledStyle"
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/constraintLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:layout_margin="8dp"
|
||||
app:cardCornerRadius="30dp">
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal">
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:id="@+id/materialCardView"
|
||||
style="?attr/materialCardViewFilledStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_margin="8dp"
|
||||
app:cardCornerRadius="30dp"
|
||||
app:layout_constraintEnd_toStartOf="@+id/settings_button"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/game_search_icon"
|
||||
android:layout_width="36dp"
|
||||
android:layout_height="36dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginHorizontal="8dp"
|
||||
android:importantForAccessibility="no"
|
||||
android:src="@drawable/ic_search" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/search_text"
|
||||
android:layout_width="match_parent"
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@android:color/transparent"
|
||||
android:hint="@string/search_games"
|
||||
android:importantForAutofill="no"
|
||||
android:inputType="text"
|
||||
android:maxLines="1" />
|
||||
</LinearLayout>
|
||||
android:orientation="horizontal">
|
||||
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
<ImageView
|
||||
android:id="@+id/game_search_icon"
|
||||
android:layout_width="36dp"
|
||||
android:layout_height="36dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginHorizontal="8dp"
|
||||
android:importantForAccessibility="no"
|
||||
android:src="@drawable/ic_search" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/search_text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@android:color/transparent"
|
||||
android:hint="@string/search_games"
|
||||
android:importantForAutofill="no"
|
||||
android:inputType="text"
|
||||
android:maxLines="1" />
|
||||
</LinearLayout>
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/settings_button"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="8dp"
|
||||
android:contentDescription="@string/settings"
|
||||
android:insetLeft="0dp"
|
||||
android:insetTop="0dp"
|
||||
android:insetRight="0dp"
|
||||
android:insetBottom="0dp"
|
||||
app:icon="@drawable/ic_settings"
|
||||
app:iconGravity="textStart"
|
||||
app:iconPadding="0dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintDimensionRatio="1:1"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/games_list_message"
|
||||
@@ -58,6 +86,7 @@
|
||||
android:id="@+id/games_recycler_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="16dp" />
|
||||
</LinearLayout>
|
||||
android:layout_margin="16dp"
|
||||
app:layout_constraintTop_toBottomOf="@+id/constraintLayout" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||
|
||||
Reference in New Issue
Block a user