修改首页actionbar

This commit is contained in:
huangzhuanghua
2016-08-12 10:16:48 +08:00
parent 322f13072c
commit 9ae9f307bc
6 changed files with 16 additions and 121 deletions

View File

@ -3,7 +3,6 @@ package com.gh.gamecenter.game;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Rect;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
@ -16,14 +15,12 @@ import android.support.v4.view.ViewPager;
import android.support.v4.view.ViewPager.OnPageChangeListener;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
import android.widget.PopupWindow;
import android.widget.RelativeLayout;
import android.widget.TextView;
@ -36,7 +33,6 @@ import com.gh.gamecenter.DownloadManagerActivity;
import com.gh.gamecenter.MainActivity;
import com.gh.gamecenter.R;
import com.gh.gamecenter.SearchActivity;
import com.gh.gamecenter.SettingActivity;
import com.gh.gamecenter.eventbus.EBRedDot;
import com.gh.gamecenter.eventbus.EBTopState;
import com.gh.gamecenter.eventbus.EBUISwitch;
@ -67,8 +63,6 @@ public class GameFragment extends Fragment implements OnClickListener,
private TextView downloadHint;
private TextView searchHint;
private PopupWindow popWindow;
private RelativeLayout.LayoutParams rparams;
private String hint;
@ -214,8 +208,6 @@ public class GameFragment extends Fragment implements OnClickListener,
view.findViewById(R.id.actionbar_notification).setOnClickListener(this);
view.findViewById(R.id.actionbar_overflow).setOnClickListener(this);
if (downloadSize != 0 || updateSize != 0) {
EventBus.getDefault().post(new EBTopState("显示", null));
}
@ -301,19 +293,6 @@ public class GameFragment extends Fragment implements OnClickListener,
searchIntent.putExtra("clicked", true);
searchIntent.putExtra("hint", hint);
startActivity(searchIntent);
} else if (id == R.id.actionbar_overflow) {
DataUtils.onEvent(getActivity(), "主页", "更多图标");
Map<String, Object> map = new HashMap<String, Object>();
map.put("location", "更多图标");
map.put("createOn", System.currentTimeMillis() / 1000);
map.put("page", "主页");
DataCollectionManager.onEvent(getActivity(), "click-item", map);
popUpOverflow(v);
} else if (id == R.id.menu_rl_set) {
popWindow.dismiss();
startActivity(new Intent(getActivity(), SettingActivity.class));
} else if (id == R.id.jingpin_text) {
viewPager.setCurrentItem(0);
} else if (id == R.id.zuixin_text) {
@ -323,26 +302,6 @@ public class GameFragment extends Fragment implements OnClickListener,
}
}
private void popUpOverflow(View view) {
Rect frame = new Rect();
getActivity().getWindow().getDecorView().getWindowVisibleDisplayFrame(frame);
int xOffset = DisplayUtils.dip2px(getActivity(), 5);
int yOffset = frame.top + DisplayUtils.dip2px(getActivity(), 48) + xOffset;
View popView = View.inflate(getActivity(), R.layout.menu_popwindow, null);
popView.findViewById(R.id.menu_rl_set).setOnClickListener(this);
popWindow = new PopupWindow(popView, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, true);
popWindow.setOutsideTouchable(true);
popWindow.setAnimationStyle(android.R.style.Animation_Dialog);
popWindow.setBackgroundDrawable(getResources().getDrawable(R.drawable.shape));
popWindow.showAtLocation(view, Gravity.TOP | Gravity.RIGHT, xOffset, yOffset);
}
@Override
public void onPageSelected(int position) {
if (position == 0) {