部分Bug修复
This commit is contained in:
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
@@ -4,7 +4,7 @@
|
|||||||
<component name="FrameworkDetectionExcludesConfiguration">
|
<component name="FrameworkDetectionExcludesConfiguration">
|
||||||
<file type="web" url="file://$PROJECT_DIR$" />
|
<file type="web" url="file://$PROJECT_DIR$" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="jbr-21" project-jdk-type="JavaSDK">
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="jbr-21" project-jdk-type="JavaSDK">
|
||||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectType">
|
<component name="ProjectType">
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
package org.astral.findmaimaiultra.adapter;
|
package org.astral.findmaimaiultra.adapter;
|
||||||
|
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
import com.bumptech.glide.Glide;
|
import com.bumptech.glide.Glide;
|
||||||
@@ -20,6 +22,7 @@ import java.util.List;
|
|||||||
public class SuggestMusicRatingAdapter extends RecyclerView.Adapter<SuggestMusicRatingAdapter.ViewHolder> {
|
public class SuggestMusicRatingAdapter extends RecyclerView.Adapter<SuggestMusicRatingAdapter.ViewHolder> {
|
||||||
|
|
||||||
private List<MusicRating> musicRatings;
|
private List<MusicRating> musicRatings;
|
||||||
|
private final SharedPreferences projectE;
|
||||||
private OnItemClickListener listener;
|
private OnItemClickListener listener;
|
||||||
|
|
||||||
public interface OnItemClickListener {
|
public interface OnItemClickListener {
|
||||||
@@ -31,10 +34,12 @@ public class SuggestMusicRatingAdapter extends RecyclerView.Adapter<SuggestMusic
|
|||||||
this.listener = listener;
|
this.listener = listener;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SuggestMusicRatingAdapter(List<MusicRating> musicRatings) {
|
public SuggestMusicRatingAdapter(List<MusicRating> musicRatings, SharedPreferences projectE) {
|
||||||
this.musicRatings = musicRatings;
|
this.musicRatings = musicRatings;
|
||||||
|
this.projectE = projectE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
@@ -91,6 +96,26 @@ public class SuggestMusicRatingAdapter extends RecyclerView.Adapter<SuggestMusic
|
|||||||
listener.onItemClick(musicRating);
|
listener.onItemClick(musicRating);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
// Long-press listener to delete project
|
||||||
|
holder.itemView.setOnLongClickListener(v -> {
|
||||||
|
// Remove project from SharedPreferences
|
||||||
|
String projectKey = "project" + musicRating.getMusicId();
|
||||||
|
if (projectE.contains(projectKey)) {
|
||||||
|
SharedPreferences.Editor editor = projectE.edit();
|
||||||
|
editor.remove(projectKey);
|
||||||
|
editor.apply();
|
||||||
|
|
||||||
|
// Remove item from the list and refresh
|
||||||
|
musicRatings.remove(position);
|
||||||
|
notifyItemRemoved(position);
|
||||||
|
notifyItemRangeChanged(position, musicRatings.size());
|
||||||
|
|
||||||
|
Toast.makeText(v.getContext(), "Project removed", Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getAchievementImageResId(int achievement) {
|
private int getAchievementImageResId(int achievement) {
|
||||||
|
|||||||
@@ -347,26 +347,26 @@ public class HomeFragment extends Fragment {
|
|||||||
|
|
||||||
a.clear();
|
a.clear();
|
||||||
TreeMap<Double, Place> treeMap = new TreeMap<>();
|
TreeMap<Double, Place> treeMap = new TreeMap<>();
|
||||||
|
try {
|
||||||
|
for (Place p : b) {
|
||||||
|
double distance = DistanceCalculator.calculateDistance(Double.parseDouble(x), Double.parseDouble(y), p.getX(), p.getY());
|
||||||
|
|
||||||
for (Place p : b) {
|
if (shoucang.contains(p.getId() + "")) {
|
||||||
double distance = DistanceCalculator.calculateDistance(Double.parseDouble(x), Double.parseDouble(y), p.getX(), p.getY());
|
p.setName(p.getName() + " 收藏" + " 距离您" + String.format(Locale.CHINA, "%.2f", distance) + "km");
|
||||||
|
treeMap.put(distance - 1000, p);
|
||||||
if (shoucang.contains(p.getId() + "")) {
|
} else {
|
||||||
p.setName(p.getName() + " 收藏" + " 距离您" + String.format(Locale.CHINA, "%.2f", distance) + "km");
|
p.setName(p.getName() + " 距离您" + String.format(Locale.CHINA, "%.2f", distance) + "km");
|
||||||
treeMap.put(distance - 1000, p);
|
treeMap.put(distance, p);
|
||||||
} else {
|
}
|
||||||
p.setName(p.getName() + " 距离您" + String.format(Locale.CHINA, "%.2f", distance) + "km");
|
if (p.getNumJ() > 0) {
|
||||||
treeMap.put(distance, p);
|
p.setName(p.getName() + "\uD83D\uDCB3");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (p.getNumJ() > 0) {
|
|
||||||
p.setName(p.getName() + "\uD83D\uDCB3");
|
for (Double key : treeMap.keySet()) {
|
||||||
|
a.add(treeMap.get(key));
|
||||||
}
|
}
|
||||||
}
|
}catch (Exception e) {}
|
||||||
|
|
||||||
for (Double key : treeMap.keySet()) {
|
|
||||||
a.add(treeMap.get(key));
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean flag2 = true;
|
boolean flag2 = true;
|
||||||
if (flag2) {
|
if (flag2) {
|
||||||
getActivity().runOnUiThread(new Runnable() {
|
getActivity().runOnUiThread(new Runnable() {
|
||||||
|
|||||||
@@ -561,7 +561,9 @@ public class MusicFragment extends Fragment {
|
|||||||
.load("https://assets2.lxns.net/maimai/jacket/" + song.getId() + ".png")
|
.load("https://assets2.lxns.net/maimai/jacket/" + song.getId() + ".png")
|
||||||
.into(songImage);
|
.into(songImage);
|
||||||
TextView songTitle = dialogView.findViewById(R.id.song_title);
|
TextView songTitle = dialogView.findViewById(R.id.song_title);
|
||||||
|
songTitle.setTextColor(getResources().getColor(R.color.textcolorPrimary));
|
||||||
TextView songArtist = dialogView.findViewById(R.id.song_artist);
|
TextView songArtist = dialogView.findViewById(R.id.song_artist);
|
||||||
|
songArtist.setTextColor(getResources().getColor(R.color.textcolorPrimary));
|
||||||
songTitle.setText(song.getTitle());
|
songTitle.setText(song.getTitle());
|
||||||
songArtist.setText(song.getArtist());
|
songArtist.setText(song.getArtist());
|
||||||
|
|
||||||
@@ -592,6 +594,7 @@ public class MusicFragment extends Fragment {
|
|||||||
cell.setTextColor(getResources().getColor(R.color.primary));
|
cell.setTextColor(getResources().getColor(R.color.primary));
|
||||||
}else {
|
}else {
|
||||||
cell.setText(100.5001 - (((float)j-1) * 0.5) + "%");
|
cell.setText(100.5001 - (((float)j-1) * 0.5) + "%");
|
||||||
|
cell.setTextColor(getResources().getColor(R.color.textcolorPrimary));
|
||||||
}
|
}
|
||||||
cell.setPadding(8, 8, 8, 8);
|
cell.setPadding(8, 8, 8, 8);
|
||||||
row.addView(cell);
|
row.addView(cell);
|
||||||
@@ -606,6 +609,7 @@ public class MusicFragment extends Fragment {
|
|||||||
double a = 100.5001 - (((float)j-1) * 0.5);
|
double a = 100.5001 - (((float)j-1) * 0.5);
|
||||||
Log.d("TAG", "a: " + a);
|
Log.d("TAG", "a: " + a);
|
||||||
cell.setText("" + getRatingChart(diff.get(i-1),a)); // 示例数据
|
cell.setText("" + getRatingChart(diff.get(i-1),a)); // 示例数据
|
||||||
|
cell.setTextColor(getResources().getColor(R.color.textcolorPrimary));
|
||||||
|
|
||||||
int finalI = i;
|
int finalI = i;
|
||||||
int finalJ = j;
|
int finalJ = j;
|
||||||
@@ -631,6 +635,7 @@ public class MusicFragment extends Fragment {
|
|||||||
Snackbar.make(v, "已添加", Snackbar.LENGTH_SHORT)
|
Snackbar.make(v, "已添加", Snackbar.LENGTH_SHORT)
|
||||||
.setAction("确定", null)
|
.setAction("确定", null)
|
||||||
.show();
|
.show();
|
||||||
|
dataanlysis();
|
||||||
});
|
});
|
||||||
builder1.setNegativeButton("取消", (dialog, which) -> {
|
builder1.setNegativeButton("取消", (dialog, which) -> {
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
@@ -666,6 +671,8 @@ public class MusicFragment extends Fragment {
|
|||||||
else{
|
else{
|
||||||
extraInfo.setText("BPM" + song.getBpm());
|
extraInfo.setText("BPM" + song.getBpm());
|
||||||
}
|
}
|
||||||
|
extraInfo.setTextColor(getResources().getColor(R.color.textcolorPrimary));
|
||||||
|
|
||||||
builder.setPositiveButton("关闭", (dialog, which) -> dialog.dismiss());
|
builder.setPositiveButton("关闭", (dialog, which) -> dialog.dismiss());
|
||||||
builder.show();
|
builder.show();
|
||||||
}
|
}
|
||||||
@@ -909,7 +916,7 @@ public class MusicFragment extends Fragment {
|
|||||||
|
|
||||||
au.setText("Rating分析:最低分 " + worstRating + "分,最高分 " + bestRating + ",平均分" + (finalTotal / 50) + "分");
|
au.setText("Rating分析:最低分 " + worstRating + "分,最高分 " + bestRating + ",平均分" + (finalTotal / 50) + "分");
|
||||||
|
|
||||||
adapterSuggest = new SuggestMusicRatingAdapter(suggestMusicRatingList);
|
adapterSuggest = new SuggestMusicRatingAdapter(suggestMusicRatingList,project);
|
||||||
suggest.setAdapter(adapterSuggest);
|
suggest.setAdapter(adapterSuggest);
|
||||||
adapterSuggest.notifyDataSetChanged();
|
adapterSuggest.notifyDataSetChanged();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -73,12 +73,5 @@
|
|||||||
android:text="额外信息"
|
android:text="额外信息"
|
||||||
android:layout_marginTop="16dp" />
|
android:layout_marginTop="16dp" />
|
||||||
|
|
||||||
<!-- 添加到计划按钮 -->
|
|
||||||
<com.google.android.material.button.MaterialButton
|
|
||||||
android:id="@+id/add_to_plan_button"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="添加到计划"
|
|
||||||
android:layout_marginTop="16dp" />
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
@@ -10,6 +10,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Song Title"
|
android:text="Song Title"
|
||||||
|
android:textColor="@color/textcolorPrimary"
|
||||||
android:textSize="16sp"
|
android:textSize="16sp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textSize="16sp"
|
android:textSize="16sp"
|
||||||
|
android:textColor="@color/textcolorPrimary"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
|||||||
Reference in New Issue
Block a user