Commit 0ba1b0de authored by fallenstardust's avatar fallenstardust

偏好房间置顶,添加标记

parent 4bc05604
...@@ -8,7 +8,7 @@ android { ...@@ -8,7 +8,7 @@ android {
applicationId "cn.garymb.ygomobile" applicationId "cn.garymb.ygomobile"
minSdkVersion 16 minSdkVersion 16
targetSdkVersion 22 targetSdkVersion 22
versionCode 32010524 versionCode 32010525
versionName "3.2.1" versionName "3.2.1"
flavorDimensions "versionCode" flavorDimensions "versionCode"
vectorDrawables.useSupportLibrary = true vectorDrawables.useSupportLibrary = true
......
package cn.garymb.ygomobile.ui.adapters; package cn.garymb.ygomobile.ui.adapters;
import android.content.Context; import android.content.Context;
import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.EventBus;
...@@ -9,6 +10,7 @@ import cn.garymb.ygomobile.bean.ServerInfo; ...@@ -9,6 +10,7 @@ import cn.garymb.ygomobile.bean.ServerInfo;
import cn.garymb.ygomobile.lite.R; import cn.garymb.ygomobile.lite.R;
import cn.garymb.ygomobile.bean.events.ServerInfoEvent; import cn.garymb.ygomobile.bean.events.ServerInfoEvent;
import cn.garymb.ygomobile.ui.home.ServerInfoViewHolder; import cn.garymb.ygomobile.ui.home.ServerInfoViewHolder;
import cn.garymb.ygomobile.ui.plus.DialogPlus;
public class ServerListAdapter extends BaseRecyclerAdapterPlus<ServerInfo, ServerInfoViewHolder> { public class ServerListAdapter extends BaseRecyclerAdapterPlus<ServerInfo, ServerInfoViewHolder> {
public ServerListAdapter(Context context) { public ServerListAdapter(Context context) {
...@@ -27,6 +29,18 @@ public class ServerListAdapter extends BaseRecyclerAdapterPlus<ServerInfo, Serve ...@@ -27,6 +29,18 @@ public class ServerListAdapter extends BaseRecyclerAdapterPlus<ServerInfo, Serve
holder.serverIp.setText(item.getServerAddr()); holder.serverIp.setText(item.getServerAddr());
holder.userName.setText(item.getPlayerName()); holder.userName.setText(item.getPlayerName());
holder.serverPort.setText(String.valueOf(item.getPort())); holder.serverPort.setText(String.valueOf(item.getPort()));
if(position==0){
holder.iv_fond.setVisibility(View.VISIBLE);
holder.iv_fond.setOnClickListener((v) -> {
DialogPlus builder = new DialogPlus(getContext());
builder.setMessage(R.string.join_helper_tip);
builder.show();
});
}else{
holder.iv_fond.setVisibility(View.GONE);
}
bindMenu(holder, position); bindMenu(holder, position);
} }
......
...@@ -103,6 +103,7 @@ abstract class HomeActivity extends BaseActivity implements NavigationView.OnNav ...@@ -103,6 +103,7 @@ abstract class HomeActivity extends BaseActivity implements NavigationView.OnNav
dialogPlus.setMessageGravity(Gravity.CENTER_HORIZONTAL); dialogPlus.setMessageGravity(Gravity.CENTER_HORIZONTAL);
dialogPlus.setLeftButtonListener((dialog, which) -> { dialogPlus.setLeftButtonListener((dialog, which) -> {
mServerListManager.delete(event.position); mServerListManager.delete(event.position);
mServerListAdapter.notifyDataSetChanged();
dialog.dismiss(); dialog.dismiss();
}); });
dialogPlus.setCancelable(false); dialogPlus.setCancelable(false);
......
package cn.garymb.ygomobile.ui.home; package cn.garymb.ygomobile.ui.home;
import android.view.View; import android.view.View;
import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import com.tubb.smrv.SwipeHorizontalMenuLayout; import com.tubb.smrv.SwipeHorizontalMenuLayout;
...@@ -19,6 +20,7 @@ public class ServerInfoViewHolder extends BaseRecyclerAdapterPlus.BaseViewHolder ...@@ -19,6 +20,7 @@ public class ServerInfoViewHolder extends BaseRecyclerAdapterPlus.BaseViewHolder
btnDelete = $(R.id.btn_delete); btnDelete = $(R.id.btn_delete);
mMenuLayout = $(R.id.swipe_layout); mMenuLayout = $(R.id.swipe_layout);
contentView = $(R.id.smContentView); contentView = $(R.id.smContentView);
iv_fond=$(R.id.iv_fond);
} }
public final SwipeHorizontalMenuLayout mMenuLayout; public final SwipeHorizontalMenuLayout mMenuLayout;
...@@ -28,4 +30,5 @@ public class ServerInfoViewHolder extends BaseRecyclerAdapterPlus.BaseViewHolder ...@@ -28,4 +30,5 @@ public class ServerInfoViewHolder extends BaseRecyclerAdapterPlus.BaseViewHolder
public final TextView serverIp; public final TextView serverIp;
public final TextView serverPort; public final TextView serverPort;
public final View btnEdit, btnDelete; public final View btnEdit, btnDelete;
public ImageView iv_fond;
} }
...@@ -163,6 +163,7 @@ public class ServerListManager { ...@@ -163,6 +163,7 @@ public class ServerListManager {
super.onSelectedChanged(viewHolder, actionState); super.onSelectedChanged(viewHolder, actionState);
if (mChanged && actionState == ItemTouchHelper.ACTION_STATE_IDLE) { if (mChanged && actionState == ItemTouchHelper.ACTION_STATE_IDLE) {
saveItems(); saveItems();
mAdapter.notifyDataSetChanged();
} }
mChanged = false; mChanged = false;
} }
......
...@@ -71,6 +71,7 @@ ...@@ -71,6 +71,7 @@
android:textAppearance="@style/TextAppearance.AppCompat.Title" android:textAppearance="@style/TextAppearance.AppCompat.Title"
android:textColor="@color/brightgreen" android:textColor="@color/brightgreen"
tools:text="233正式服务器"/> tools:text="233正式服务器"/>
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
...@@ -155,6 +156,14 @@ ...@@ -155,6 +156,14 @@
android:textAppearance="@style/TextAppearance.AppCompat.Body1" android:textAppearance="@style/TextAppearance.AppCompat.Body1"
android:textColor="@color/holo_blue_bright" android:textColor="@color/holo_blue_bright"
tools:text="player"/> tools:text="player"/>
<ImageView
android:id="@+id/iv_fond"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginRight="20dp"
android:gravity="center"
android:background="@drawable/buttonfunction"/>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
......
...@@ -187,7 +187,7 @@ ...@@ -187,7 +187,7 @@
<string name="mc_home">大厅</string> <string name="mc_home">大厅</string>
<string name="bbs">社区</string> <string name="bbs">社区</string>
<string name="settings_pref_settings_only_game">直接启动游戏</string> <string name="settings_pref_settings_only_game">直接启动游戏</string>
<string name="only_game_tip">取消设置,只能清空应用的数据,或者重装</string> <string name="only_game_tip">慎重勾选,清除应用数据或者重装才能恢复</string>
<string name="title_use_ex">使用额外卡库</string> <string name="title_use_ex">使用额外卡库</string>
<string name="tip_network_image">服务器爆炸了</string> <string name="tip_network_image">服务器爆炸了</string>
<string name="game_version">游戏版本</string> <string name="game_version">游戏版本</string>
...@@ -200,4 +200,5 @@ ...@@ -200,4 +200,5 @@
<string name="deck_name">卡组</string> <string name="deck_name">卡组</string>
<string name="save_quit">保存并退出</string> <string name="save_quit">保存并退出</string>
<string name="tip_reset_game_res">游戏数据检查完成</string> <string name="tip_reset_game_res">游戏数据检查完成</string>
<string name="join_helper_tip">你可以把偏好的服务器拖到置顶\n那么快捷加房时候就会加入置顶的服务器</string>
</resources> </resources>
...@@ -203,4 +203,5 @@ ...@@ -203,4 +203,5 @@
<string name="deck_name">卡组</string> <string name="deck_name">卡组</string>
<string name="save_quit">Save and quit</string> <string name="save_quit">Save and quit</string>
<string name="tip_reset_game_res">Reset game resources completed</string> <string name="tip_reset_game_res">Reset game resources completed</string>
<string name="join_helper_tip">you can move your favourite sever on top\n then join helper will acquiescently start in it</string>
</resources> </resources>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment