Commit 842169d8 by Lee Munkyeong

動画のフールスクリーンモード追加。

parent d71afac6
......@@ -566,6 +566,10 @@ public class GroupDao extends AbstractDao {
return rawQueryGetDtoList("select * from m_group where user_group_flg = 1 ORDER BY group_name", null, GroupDto.class);
}
public List<GroupDto> geMyGroups() {
return rawQueryGetDtoList("select * from m_group where group_id IN (select group_id from m_shop_member sm inner join r_shop_member_group rmg on sm.shop_member_id = rmg.shop_member_id where sm.self_flg = 1) ORDER BY group_name", null, GroupDto.class);
}
/**
* ユーザが所属しているグループを返す(複数ある場合はどれか一つを返す。1グループに所属するサイネージで使用)
*
......@@ -616,6 +620,24 @@ public class GroupDao extends AbstractDao {
}
}
public void updateUserGroupList(List<Integer> groupIds) {
StringBuffer sql = new StringBuffer();
sql.append(" UPDATE m_group ");
sql.append(" SET user_group_flg = 1 ");
sql.append(" WHERE group_id = ? ");
try {
beginTransaction();
for (Integer groupId : groupIds) {
update(sql.toString(), new Object[] { groupId });
}
commit();
} catch (Exception e) {
rollback();
Logger.e("updateGroupList failed.", e);
throw new RuntimeException(e);
}
}
public void updateFavoriteGroupList(List<GroupDto> groupList) {
StringBuffer sql = new StringBuffer();
sql.append(" UPDATE m_group ");
......
......@@ -189,7 +189,7 @@ public class ShopMemberDao extends AbstractDao {
sql.append(" m_shop_member AS sm ");
sql.append(" INNER JOIN r_shop_member_group AS rsmg ");
sql.append(" ON sm.shop_member_id = rsmg.shop_member_id ");
sql.append(" WHERE rsmg.group_id IN (SELECT group_id FROM m_group WHERE user_group_flg = 1)");
sql.append(" WHERE rsmg.group_id IN (select group_id from m_shop_member sm inner join r_shop_member_group rmg on sm.shop_member_id = rmg.shop_member_id where sm.self_flg = 1)");
sql.append(" AND sm.self_flg != 1");
sql.append(" AND sm.shop_member_name LIKE '%"+shopMemberName+"%' ");
sql.append(" ORDER BY sm.shop_member_name DESC ");
......@@ -208,7 +208,7 @@ public class ShopMemberDao extends AbstractDao {
sql.append(" m_shop_member AS sm ");
sql.append(" INNER JOIN r_shop_member_group AS rsmg ");
sql.append(" ON sm.shop_member_id = rsmg.shop_member_id ");
sql.append(" WHERE rsmg.group_id IN (SELECT group_id FROM m_group WHERE user_group_flg = 1)");
sql.append(" WHERE rsmg.group_id IN (select group_id from m_shop_member sm inner join r_shop_member_group rmg on sm.shop_member_id = rmg.shop_member_id where sm.self_flg = 1)");
sql.append(" AND sm.self_flg != 1");
sql.append(" AND sm.shop_member_id NOT IN (SELECT shop_member_id FROM r_chat_room_shop_member WHERE chat_room_id = ?)");
sql.append(" AND sm.shop_member_name LIKE '%"+shopMemberName+"%' ");
......
......@@ -179,7 +179,7 @@ public class CommunicationLogic extends AbstractLogic {
}
public String getMyGroupUsers() {
List<GroupDto> myGroupIds = groupDao.getUserGroups();
List<GroupDto> myGroupIds = groupDao.geMyGroups();
JSONArray myGroupUsersJson = new JSONArray();
for (GroupDto groupDto : myGroupIds) {
JSONObject groupUserJson = new JSONObject();
......@@ -210,7 +210,7 @@ public class CommunicationLogic extends AbstractLogic {
}
public String getMyGroupUsersNotInRoom(Integer roomId) {
List<GroupDto> myGroupIds = groupDao.getUserGroups();
List<GroupDto> myGroupIds = groupDao.geMyGroups();
JSONArray myGroupUsersJson = new JSONArray();
for (GroupDto groupDto : myGroupIds) {
JSONObject groupUserJson = new JSONObject();
......@@ -682,6 +682,10 @@ public class CommunicationLogic extends AbstractLogic {
shopMemberDao.insertShopMember(shopMemberDto);
}
public void updateMyGroup(List<Integer> groupIds) {
groupDao.updateUserGroupList(groupIds);
}
public void updateFavoriteUser(List<Integer> favoriteUserIds){
for (Integer favoriteUserId : favoriteUserIds) {
ShopMemberDto favoriteUserDto= new ShopMemberDto();
......
......@@ -70,6 +70,7 @@ import jp.agentec.abook.abv.ui.common.dialog.ABookAlertDialog;
import jp.agentec.abook.abv.ui.common.util.ABVToastUtil;
import jp.agentec.abook.abv.ui.common.util.AlertDialogUtil;
import jp.agentec.abook.abv.ui.home.helper.ActivityHandlingHelper;
import jp.agentec.abook.abv.ui.home.view.FullscreenableChromeClient;
import jp.agentec.abook.abv.ui.viewer.activity.ParentWebViewActivity;
import jp.agentec.adf.util.CollectionUtil;
import jp.agentec.adf.util.StringUtil;
......@@ -200,7 +201,8 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
}
}
mChatWebView.setWebChromeClient(new WebChromeClient() {
mChatWebView.setWebChromeClient(new FullscreenableChromeClient(this) {
@Override
public boolean onShowFileChooser(WebView webView, ValueCallback<Uri[]> filePathCallback, FileChooserParams fileChooserParams) {
boolean result = false;
......@@ -1033,6 +1035,7 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
MyInfoJSON resultJson = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).getMyInfo(sid);
if (resultJson.shopMemberDto != null) {
communicationLogic.insertMyInfo(resultJson.shopMemberDto);
communicationLogic.updateMyGroup(resultJson.shopMemberDto.groupIdList);
}
}
......
package jp.agentec.abook.abv.ui.home.view;
import android.app.Activity;
import android.content.Context;
import android.os.Build;
import android.support.v4.content.ContextCompat;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.webkit.WebChromeClient;
import android.widget.FrameLayout;
public class FullscreenableChromeClient extends WebChromeClient {
private Activity mActivity = null;
private View mCustomView;
private WebChromeClient.CustomViewCallback mCustomViewCallback;
private int mOriginalOrientation;
private FrameLayout mFullscreenContainer;
private static final FrameLayout.LayoutParams COVER_SCREEN_PARAMS = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
public FullscreenableChromeClient(Activity activity) {
this.mActivity = activity;
}
@Override
public void onShowCustomView(View view, CustomViewCallback callback) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
if (mCustomView != null) {
callback.onCustomViewHidden();
return;
}
mOriginalOrientation = mActivity.getRequestedOrientation();
FrameLayout decor = (FrameLayout) mActivity.getWindow().getDecorView();
mFullscreenContainer = new FullscreenHolder(mActivity);
mFullscreenContainer.addView(view, COVER_SCREEN_PARAMS);
decor.addView(mFullscreenContainer, COVER_SCREEN_PARAMS);
mCustomView = view;
setFullscreen(true);
mCustomViewCallback = callback;
// mActivity.setRequestedOrientation(requestedOrientation);
}
super.onShowCustomView(view, callback);
}
@SuppressWarnings("deprecation")
@Override
public void onShowCustomView(View view, int requestedOrientation, WebChromeClient.CustomViewCallback callback) {
this.onShowCustomView(view, callback);
}
@Override
public void onHideCustomView() {
if (mCustomView == null) {
return;
}
setFullscreen(false);
FrameLayout decor = (FrameLayout) mActivity.getWindow().getDecorView();
decor.removeView(mFullscreenContainer);
mFullscreenContainer = null;
mCustomView = null;
mCustomViewCallback.onCustomViewHidden();
mActivity.setRequestedOrientation(mOriginalOrientation);
}
private void setFullscreen(boolean enabled) {
Window win = mActivity.getWindow();
WindowManager.LayoutParams winParams = win.getAttributes();
final int bits = WindowManager.LayoutParams.FLAG_FULLSCREEN;
if (enabled) {
winParams.flags |= bits;
} else {
winParams.flags &= ~bits;
if (mCustomView != null) {
mCustomView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);
}
}
win.setAttributes(winParams);
}
private static class FullscreenHolder extends FrameLayout {
public FullscreenHolder(Context ctx) {
super(ctx);
setBackgroundColor(ContextCompat.getColor(ctx, android.R.color.black));
}
@Override
public boolean onTouchEvent(MotionEvent evt) {
return true;
}
}
}
\ No newline at end of file
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