Skip to content

Commit

Permalink
update RxTitle.class
Browse files Browse the repository at this point in the history
  • Loading branch information
秋逸 committed Mar 1, 2017
1 parent fca5969 commit 26ac4fc
Show file tree
Hide file tree
Showing 10 changed files with 44 additions and 17 deletions.
15 changes: 15 additions & 0 deletions RxTools-library/src/main/java/com/vondear/rxtools/RxBarUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,21 @@
*/
public class RxBarUtils {

/**
* 隐藏状态栏
* <p>也就是设置全屏,一定要在setContentView之前调用,否则报错</p>
* <p>此方法Activity可以继承AppCompatActivity</p>
* <p>启动的时候状态栏会显示一下再隐藏,比如QQ的欢迎界面</p>
* <p>在配置文件中Activity加属性android:theme="@android:style/Theme.NoTitleBar.Fullscreen"</p>
* <p>如加了以上配置Activity不能继承AppCompatActivity,会报错</p>
*
* @param activity activity
*/
public static void hideStatusBar(Activity activity) {
noTitle(activity);
FLAG_FULLSCREEN(activity);
}

/**
* 设置透明状态栏(api大于19方可使用)
* <p>可在Activity的onCreat()中调用</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ private void initView(final Context context, AttributeSet attrs) {

try {
//获得属性值
mBackground = a.getColor(R.styleable.RxTitle_background, getResources().getColor(R.color.transparent));
mBackground = a.getColor(R.styleable.RxTitle_RxBackground, getResources().getColor(R.color.transparent));
mTitle = a.getString(R.styleable.RxTitle_title);
mTitleColor = a.getColor(R.styleable.RxTitle_titleColor, getResources().getColor(R.color.white));
mTitleSize = a.getDimensionPixelSize(R.styleable.RxTitle_titleSize, 20);//TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 16, getResources().getDisplayMetrics())
Expand Down
2 changes: 1 addition & 1 deletion RxTools-library/src/main/res/layout/activity_code_tool.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
android:layout_height="wrap_content"
app:RightIcon="@drawable/set"
app:RightIconVisibility="false"
app:background="@color/mi_green"
app:RxBackground="@color/mi_green"
app:leftIcon="@drawable/back"
app:leftIconVisibility="true"
app:title="扫码工具"
Expand Down
2 changes: 1 addition & 1 deletion RxTools-library/src/main/res/values/attrs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
</declare-styleable>

<declare-styleable name="RxTitle">
<attr name="background" format="color"/>
<attr name="RxBackground" format="color"/>
<attr name="title" format="string"/>
<attr name="titleColor" format="color"/>
<attr name="titleSize" format="dimension"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import android.widget.Button;
import android.widget.LinearLayout;

import com.vondear.rxtools.RxBarUtils;
import com.vondear.rxtools.view.RxFlightSeatView;
import com.vondear.tools.R;

Expand All @@ -29,6 +30,8 @@ public class ActivityFlightSeat extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
RxBarUtils.noTitle(this);
RxBarUtils.setTransparentStatusBar(this);
setContentView(R.layout.activity_flight_seat);
ButterKnife.bind(this);
initView();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import android.widget.LinearLayout;
import android.widget.RelativeLayout;

import com.vondear.rxtools.RxBarUtils;
import com.vondear.rxtools.activity.ActivityBase;
import com.vondear.rxtools.view.RxMovieSeatTable;
import com.vondear.tools.R;
Expand All @@ -21,6 +22,8 @@ public class ActivityMovieSeat extends ActivityBase {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
RxBarUtils.noTitle(this);
RxBarUtils.setTransparentStatusBar(this);
setContentView(R.layout.activity_movie_seat);
ButterKnife.bind(this);
initView();
Expand Down
6 changes: 5 additions & 1 deletion app/src/main/res/layout/activity_flight_seat.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,16 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:clipToPadding="true"
android:fitsSystemWindows="true"
android:background="@color/darkcyan"
tools:context="com.vondear.tools.activity.ActivityFlightSeat">

<com.vondear.rxtools.view.RxTitle

android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/google_green"
app:RxBackground="@color/darkcyan"
app:title="上海 - 长沙 飞机票选座"
app:titleColor="@color/black"/>

Expand Down
7 changes: 5 additions & 2 deletions app/src/main/res/layout/activity_movie_seat.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,17 @@
android:id="@+id/activity_movie_seat"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:background="@color/google_green"
android:orientation="vertical"
android:clipToPadding="true"
android:fitsSystemWindows="true"
tools:context="com.vondear.tools.activity.ActivityMovieSeat">

<com.vondear.rxtools.view.RxTitle

android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/google_green"
app:RxBackground="@color/google_green"
app:title="仙剑奇侠传:电影版"
app:titleColor="@color/black"/>

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_rx_toast.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
android:layout_height="wrap_content"
app:RightIcon="@drawable/set"
app:RightIconVisibility="false"
app:background="@color/blue"
app:RxBackground="@color/blue"
app:leftIcon="@drawable/back"
app:leftIconVisibility="true"
app:title="RxToast的展示使用"
Expand Down
19 changes: 9 additions & 10 deletions app/src/main/res/layout/activity_shopping_view.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_shopping_view"
Expand All @@ -14,14 +13,14 @@
<com.vondear.rxtools.view.RxTitle
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:background="?colorPrimary"
app:title="添加购物控件"/>
app:RxBackground="?colorPrimary"
app:title="添加购物控件" />

<com.vondear.rxtools.view.RxShoppingView
android:id="@+id/sv_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"/>
android:layout_margin="10dp" />

<com.vondear.rxtools.view.RxShoppingView
android:id="@+id/sv_2"
Expand All @@ -30,7 +29,7 @@
android:layout_margin="10dp"
android:layout_marginTop="10dp"
app:sv_bg_color="#CD5555"
app:sv_text="点击购买"/>
app:sv_text="点击购买" />

<com.vondear.rxtools.view.RxShoppingView
android:layout_width="wrap_content"
Expand All @@ -40,7 +39,7 @@
app:sv_bg_color="@color/SUCCESS_COLOR"
app:sv_duration="200"
app:sv_text="SHOPPING"
app:sv_text_size="22sp"/>
app:sv_text_size="22sp" />

<com.vondear.rxtools.view.RxShoppingView
android:layout_width="wrap_content"
Expand All @@ -50,13 +49,13 @@
app:sv_bg_color="#D8BFD8"
app:sv_duration="100"
app:sv_text="RxTools"
app:sv_text_size="18sp"/>
app:sv_text_size="18sp" />

<Button
android:text="外卖点单界面"
android:id="@+id/btn_take_out"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/btn_take_out"/>
android:text="外卖点单界面" />


</LinearLayout>

0 comments on commit 26ac4fc

Please sign in to comment.