mirror of
https://github.com/BeyondDimension/SteamTools.git
synced 2026-10-25 19:49:43 +08:00
fix
This commit is contained in:
@@ -39,6 +39,12 @@ namespace System.Application.UI
|
||||
static IEnumerable<Process> GetCurrentAllProcess()
|
||||
{
|
||||
var current = Process.GetCurrentProcess();
|
||||
#if DEBUG
|
||||
if (string.Equals("dotnet", Path.GetFileNameWithoutExtension(current.MainModule?.FileName), StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return Array.Empty<Process>();
|
||||
}
|
||||
#endif
|
||||
var currentMainModule = current.TryGetMainModule();
|
||||
var query = from p in Process.GetProcessesByName(current.ProcessName)
|
||||
let pMainModule = p.TryGetMainModule()
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
// Passing each menu ID as a set of Ids because each
|
||||
// menu should be considered as top level destinations.
|
||||
AppBarConfiguration appBarConfiguration = new AppBarConfiguration.Builder(
|
||||
R.id.navigation_local_auth, R.id.navigation_community_fix, R.id.navigation_my)
|
||||
R.id.navigation_local_auth, R.id.navigation_community_fix, R.id.navigation_game_list, R.id.navigation_my)
|
||||
.build();
|
||||
NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment_activity_main);
|
||||
NavigationUI.setupActionBarWithNavController(this, navController, appBarConfiguration);
|
||||
|
||||
+45
-1
@@ -1,2 +1,46 @@
|
||||
package net.steampp.app.design.ui.fragments;public class GameListFragment {
|
||||
package net.steampp.app.design.ui.fragments;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.Observer;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
|
||||
import net.steampp.app.design.databinding.FragmentGameListBinding;
|
||||
import net.steampp.app.design.ui.viewmodels.GameListViewModel;
|
||||
|
||||
public class GameListFragment extends Fragment {
|
||||
|
||||
private GameListViewModel viewModel;
|
||||
private FragmentGameListBinding binding;
|
||||
|
||||
public View onCreateView(@NonNull LayoutInflater inflater,
|
||||
ViewGroup container, Bundle savedInstanceState) {
|
||||
viewModel =
|
||||
new ViewModelProvider(this).get(GameListViewModel.class);
|
||||
|
||||
binding = FragmentGameListBinding.inflate(inflater, container, false);
|
||||
View root = binding.getRoot();
|
||||
|
||||
final TextView textView = binding.textView;
|
||||
viewModel.getText().observe(getViewLifecycleOwner(), new Observer<String>() {
|
||||
@Override
|
||||
public void onChanged(@Nullable String s) {
|
||||
textView.setText(s);
|
||||
}
|
||||
});
|
||||
return root;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
binding = null;
|
||||
}
|
||||
}
|
||||
|
||||
+23
-1
@@ -1,2 +1,24 @@
|
||||
package net.steampp.app.design.ui.viewmodels;public class GameListViewModel {
|
||||
package net.steampp.app.design.ui.viewmodels;
|
||||
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
import androidx.lifecycle.ViewModel;
|
||||
|
||||
import net.steampp.app.design.R;
|
||||
import net.steampp.app.design.ui.MainApplication;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public class GameListViewModel extends ViewModel {
|
||||
|
||||
private MutableLiveData<String> mText;
|
||||
|
||||
public GameListViewModel() {
|
||||
mText = new MutableLiveData<>();
|
||||
mText.setValue(Arrays.stream(this.getClass().getName().split("\\.")).reduce((first, second) -> second).orElse("").replace("ViewModel","") + "\n" + MainApplication.getContext().getString(R.string.under_construction));
|
||||
}
|
||||
|
||||
public LiveData<String> getText() {
|
||||
return mText;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".ui.fragments.GameListFragment">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:textAlignment="center"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -11,6 +11,11 @@
|
||||
android:icon="@drawable/baseline_person_black_24"
|
||||
android:title="@string/community_fix" />
|
||||
|
||||
<item
|
||||
android:id="@+id/navigation_game_list"
|
||||
android:icon="@drawable/baseline_person_black_24"
|
||||
android:title="@string/game_list" />
|
||||
|
||||
<item
|
||||
android:id="@+id/navigation_my"
|
||||
android:icon="@drawable/baseline_person_black_24"
|
||||
|
||||
@@ -17,6 +17,12 @@
|
||||
android:label="@string/community_fix"
|
||||
tools:layout="@layout/fragment_community_fix" />
|
||||
|
||||
<fragment
|
||||
android:id="@+id/navigation_game_list"
|
||||
android:name="net.steampp.app.design.ui.fragments.GameListFragment"
|
||||
android:label="@string/game_list"
|
||||
tools:layout="@layout/fragment_game_list" />
|
||||
|
||||
<fragment
|
||||
android:id="@+id/navigation_my"
|
||||
android:name="net.steampp.app.design.ui.fragments.MyFragment"
|
||||
|
||||
@@ -3,5 +3,6 @@
|
||||
<string name="local_auth">本地令牌</string>
|
||||
<string name="my">我的</string>
|
||||
<string name="community_fix">社区加速</string>
|
||||
<string name="game_list">库存游戏</string>
|
||||
<string name="under_construction">该功能正在开发中,敬请期待</string>
|
||||
</resources>
|
||||
|
||||
Reference in New Issue
Block a user