修改首页actionbar
This commit is contained in:
@ -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) {
|
||||
|
||||
@ -3,7 +3,6 @@ package com.gh.gamecenter.news;
|
||||
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;
|
||||
@ -15,12 +14,10 @@ import android.support.v4.app.FragmentTransaction;
|
||||
import android.support.v4.view.ViewPager;
|
||||
import android.text.TextUtils;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.PopupWindow;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
@ -33,7 +30,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;
|
||||
@ -61,8 +57,6 @@ public class NewsFragment extends Fragment implements View.OnClickListener, View
|
||||
private TextView downloadHint;
|
||||
private TextView searchHint;
|
||||
|
||||
private PopupWindow popWindow;
|
||||
|
||||
private RelativeLayout.LayoutParams rparams;
|
||||
|
||||
private String hint;
|
||||
@ -222,8 +216,6 @@ public class NewsFragment extends Fragment implements View.OnClickListener, View
|
||||
|
||||
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));
|
||||
}
|
||||
@ -310,19 +302,6 @@ public class NewsFragment extends Fragment implements View.OnClickListener, View
|
||||
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.zixun_text) {
|
||||
viewPager.setCurrentItem(0);
|
||||
} else if (id == R.id.yuanchuang_text) {
|
||||
@ -334,28 +313,6 @@ public class NewsFragment extends Fragment implements View.OnClickListener, View
|
||||
}
|
||||
}
|
||||
|
||||
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, LinearLayout.LayoutParams.WRAP_CONTENT,
|
||||
LinearLayout.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 onPageScrolled(int position, float positionOffset,
|
||||
int positionOffsetPixels) {
|
||||
@ -509,7 +466,6 @@ public class NewsFragment extends Fragment implements View.OnClickListener, View
|
||||
tvGuanzhu = null;
|
||||
downloadHint = null;
|
||||
searchHint = null;
|
||||
popWindow = null;
|
||||
rparams = null;
|
||||
hint = null;
|
||||
handler = null;
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 559 B After Width: | Height: | Size: 3.5 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 668 B After Width: | Height: | Size: 3.7 KiB |
@ -4,6 +4,6 @@
|
||||
|
||||
<solid android:color="#ffffff" />
|
||||
|
||||
<corners android:radius="5dip" />
|
||||
<corners android:radius="3dip" />
|
||||
|
||||
</shape>
|
||||
@ -17,8 +17,8 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/actionbar_download"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_width="25dp"
|
||||
android:layout_height="25dp"
|
||||
android:layout_centerInParent="true"
|
||||
android:src="@drawable/ic_actionbar_download" />
|
||||
|
||||
@ -38,16 +38,26 @@
|
||||
<RelativeLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="7dp"
|
||||
android:layout_marginTop="7dp"
|
||||
android:layout_marginBottom="7dp"
|
||||
android:layout_weight="7"
|
||||
android:background="@drawable/actionbar_search_bg" >
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/actionbar_iv_search"
|
||||
android:layout_width="18dp"
|
||||
android:layout_height="18dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:src="@drawable/ic_search" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/actionbar_search_input"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_toRightOf="@id/actionbar_iv_search"
|
||||
android:hint="搜索游戏..."
|
||||
android:paddingLeft="8dp"
|
||||
android:paddingRight="8dp"
|
||||
@ -55,23 +65,6 @@
|
||||
android:textColorHint="#B2B2B2"
|
||||
android:textSize="18sp" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/actionbar_iv_search"
|
||||
android:layout_width="25dp"
|
||||
android:layout_height="25dp"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginRight="5dp"
|
||||
android:src="@drawable/reuse_search_black" />
|
||||
|
||||
<View
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:layout_marginRight="5dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_toLeftOf="@id/actionbar_iv_search"
|
||||
android:background="#B2B2B2" />
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
@ -81,23 +74,10 @@
|
||||
android:layout_weight="1" >
|
||||
|
||||
<ImageView
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_width="25dp"
|
||||
android:layout_height="25dp"
|
||||
android:layout_centerInParent="true"
|
||||
android:src="@drawable/ic_actionbar_notification" />
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/actionbar_overflow"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1" >
|
||||
|
||||
<ImageView
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_centerInParent="true"
|
||||
android:src="@drawable/ic_actionbar_overflow" />
|
||||
</RelativeLayout>
|
||||
|
||||
</LinearLayout>
|
||||
Reference in New Issue
Block a user