Explorar o código

主页添加每日必玩

zengjiebin %!s(int64=7) %!d(string=hai) anos
pai
achega
afa0919109

+ 10 - 1
app/src/main/java/com/sheep/gamegroup/model/api/ApiService.java

@@ -1093,8 +1093,17 @@ public interface ApiService {
      * daily_play:1每日必玩
      * type: 1002:快发出包 1003:腾讯出包 1004:小米出包 1099:其他
      */
-    @GET("app/find")
+    @GET(ApiKey.FIND)
     Observable<BaseMessage> getPlayGameList(@Query("page") int page, @Query("per_page") int per_page, @QueryMap Map<String, Object> map);
+    /**
+     * 玩转游戏——每日必玩
+     * 玩转游戏——近期最热
+     * is_hot:1  others:0
+     * daily_play:1每日必玩
+     * type: 1002:快发出包 1003:腾讯出包 1004:小米出包 1099:其他
+     */
+    @GET(ApiKey.FIND)
+    Observable<BaseMessage> getDailyPlayGameList(@Query("page") int page, @Query("per_page") int per_page, @Query("daily_play") int daily_play);
 
     /**
      * 玩转游戏-获取主页游戏数据 猜你喜欢

+ 10 - 0
app/src/main/java/com/sheep/gamegroup/model/entity/Lp.java

@@ -15,6 +15,7 @@ public class Lp {
     private int width = NONE;
     private int height = NONE;
     private float per = 1.0f;
+    private int gravity = NONE;
 
     public Lp() {
     }
@@ -116,4 +117,13 @@ public class Lp {
         this.rightMargin = margin;
         return this;
     }
+
+    public Lp setGravity(int gravity) {
+        this.gravity = gravity;
+        return this;
+    }
+
+    public int getGravity() {
+        return gravity;
+    }
 }

+ 48 - 0
app/src/main/java/com/sheep/gamegroup/module/home/adapter/AdpDailyPlay.java

@@ -0,0 +1,48 @@
+package com.sheep.gamegroup.module.home.adapter;
+
+import android.support.annotation.Nullable;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+
+import com.chad.library.adapter.base.BaseQuickAdapter;
+import com.chad.library.adapter.base.BaseViewHolder;
+import com.sheep.gamegroup.model.entity.GameEntity;
+import com.sheep.gamegroup.model.entity.WebParams;
+import com.sheep.gamegroup.module.yf_shop.model.PromoteGoods;
+import com.sheep.gamegroup.util.CommonUtil;
+import com.sheep.gamegroup.util.Jump2View;
+import com.sheep.gamegroup.util.ViewUtil;
+import com.sheep.jiuyan.samllsheep.R;
+import com.sheep.jiuyan.samllsheep.SheepApp;
+
+import java.util.List;
+import java.util.Locale;
+
+/**
+ * Created by realicing on 2019/3/26.
+ * realicing@sina.com
+ * 小绵羊3.5.3新增 -- 每日必玩的adapter
+ */
+public class AdpDailyPlay extends BaseQuickAdapter<GameEntity, BaseViewHolder> {
+    public AdpDailyPlay(int layoutResId, @Nullable List<GameEntity> data) {
+        super(layoutResId, data);
+    }
+
+    @Override
+    protected void convert(BaseViewHolder viewHolder, GameEntity item) {
+        ImageView item_icon_iv = viewHolder.itemView.findViewById(R.id.item_icon_iv);
+        TextView item_name_tv = viewHolder.itemView.findViewById(R.id.item_name_tv);
+        LinearLayout item_game_tags = viewHolder.itemView.findViewById(R.id.item_game_tags);
+        TextView item_size_tv = viewHolder.itemView.findViewById(R.id.item_size_tv);
+
+        if(item == null || item.getApp() == null){
+            return;
+        }
+        ViewUtil.setImage(item_icon_iv, item.getApp().getIcon());
+        ViewUtil.setText(item_name_tv, item.getApp().getName());
+        ViewUtil.setText(item_size_tv, item.getApp().getPackageSizeMsg());
+        //tag 标签绘制
+        CommonUtil.getInstance().paintLineaLayout(item, item_game_tags, 4, R.color.txt_bule, R.drawable.shape_blue_stroke_rectangle_no_lb);
+    }
+}

+ 0 - 1
app/src/main/java/com/sheep/gamegroup/module/home/adapter/AdpPromoteGoods.java

@@ -1,7 +1,6 @@
 package com.sheep.gamegroup.module.home.adapter;
 
 import android.support.annotation.Nullable;
-import android.view.View;
 import android.widget.ImageView;
 import android.widget.LinearLayout;
 import android.widget.TextView;

+ 269 - 0
app/src/main/java/com/sheep/gamegroup/module/home/fragment/FgtDailyPlayList.java

@@ -0,0 +1,269 @@
+package com.sheep.gamegroup.module.home.fragment;
+
+import android.app.Activity;
+import android.support.v4.view.ViewPager;
+import android.support.v7.widget.LinearLayoutManager;
+import android.support.v7.widget.RecyclerView;
+import android.view.View;
+import android.view.ViewGroup;
+
+import com.chad.library.adapter.base.BaseQuickAdapter;
+import com.scwang.smartrefresh.layout.SmartRefreshLayout;
+import com.sheep.gamegroup.absBase.ILoadMore;
+import com.sheep.gamegroup.absBase.IRefresh;
+import com.sheep.gamegroup.model.entity.BaseMessage;
+import com.sheep.gamegroup.model.entity.GameEntity;
+import com.sheep.gamegroup.model.util.SheepSubscriber;
+import com.sheep.gamegroup.module.home.adapter.AdpDailyPlay;
+import com.sheep.gamegroup.util.CommonUtil;
+import com.sheep.gamegroup.util.DataUtil;
+import com.sheep.gamegroup.util.Jump2View;
+import com.sheep.gamegroup.util.ListUtil;
+import com.sheep.gamegroup.util.ViewUtil;
+import com.sheep.jiuyan.samllsheep.R;
+import com.sheep.jiuyan.samllsheep.SheepApp;
+import com.sheep.jiuyan.samllsheep.base.BaseFragment;
+import com.sheep.jiuyan.samllsheep.utils.G;
+
+import org.afinal.simplecache.ApiKey;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import butterknife.BindView;
+import io.reactivex.android.schedulers.AndroidSchedulers;
+import io.reactivex.schedulers.Schedulers;
+
+/**
+ * Created by realicing on 2019/3/26.
+ * realicing@sina.com
+ * 小绵羊3.5.3新增 -- 主页 tab 第二个 每日必玩
+ */
+public class FgtDailyPlayList extends BaseFragment implements ILoadMore, IRefresh {
+    @BindView(R.id.view_list)
+    RecyclerView view_list;
+    @BindView(R.id.empty_view)
+    View empty_view;
+
+    private Activity activity;
+    private List<GameEntity> list = new ArrayList<>();
+
+
+    private void notifyDataSetChanged() {
+        if(empty_view == null || view_list == null){
+            return;
+        }
+        ViewUtil.notifyDataSetChanged(view_list);
+        updateEmptyView();
+        refreshOrLoadMoreComplete();
+        resetViewPagerHeight();
+    }
+
+
+    public static FgtDailyPlayList newInstance() {
+        return new FgtDailyPlayList();
+    }
+
+    public FgtDailyPlayList() {
+    }
+
+    @Override
+    public int getLayoutId() {
+        return R.layout.net_empty_rv;
+    }
+
+    @Override
+    public void onViewCreated() {
+        activity = getActivity();
+        initView();
+        initListener();
+        refreshData();
+    }
+
+    public void initView() {
+        if (activity == null) {
+            return;
+        }
+        view_list.setLayoutManager(new LinearLayoutManager(activity));
+        view_list.setHasFixedSize(true);
+        view_list.setNestedScrollingEnabled(false);
+        AdpDailyPlay adapter = new AdpDailyPlay(R.layout.item_hp_daily_play, list);
+        adapter.bindToRecyclerView(view_list);
+        adapter.setOnItemClickListener((baseQuickAdapter, view, i) -> Jump2View.getInstance().goEntity(ListUtil.getItem(list, i)));
+    }
+
+    public void initListener() {
+    }
+
+    private boolean isFirstCache = false;//是否首先尝试缓存
+
+    //先尝试缓存数据,无缓存数据时,再尝试获取网络数据
+    public void initData() {
+        isFirstCache = true;
+        mInitData();
+    }
+
+    //强制刷新数据
+    public void refreshData() {
+        isFirstCache = false;
+        noMore = false;
+        page = 1;
+        list.clear();
+        mInitData();
+    }
+
+
+    public void loadMoreData() {
+        if (ListUtil.size(list) >= per_page * page) {
+            page += 1;
+            //先加载缓存
+            getReleaseFromACache();
+            //再加载网络数据
+            getReleaseFromNetWork();
+        }
+        notifyDataSetChanged();
+    }
+    private int page = 1;
+    private int per_page = DataUtil.PER_PAGE;
+    private int daily_paly = 1;
+
+    public void mInitData() {
+        CommonUtil.getInstance().resetEmptyView(empty_view);
+        //先加载缓存
+        if(isFirstCache) {
+            getReleaseFromACache();
+        }
+        //再加载网络数据
+        getReleaseFromNetWork();
+    }
+
+    private int onResumeCount = 0;
+
+    @Override
+    public void onResume() {
+        super.onResume();
+        if (onResumeCount > 0) {//直接全部刷新
+            refreshData();
+        }
+        onResumeCount++;
+    }
+
+
+    //从ACache获取发布的任务列表
+    private void getReleaseFromACache() {
+        try {
+            List<GameEntity> cacheList = DataUtil.getInstance().getCacheList(getKey(), GameEntity.class);
+            if(!ListUtil.isEmpty(cacheList)){
+                ListUtil.addAllItem(list, cacheList);
+            }
+            notifyDataSetChanged();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    private String getKey() {
+        return ApiKey.pageKeyUrl(ApiKey.FIND, page, per_page) + "&daily_paly="+daily_paly;
+    }
+
+    //从网络获取发布的任务列表
+    private void getReleaseFromNetWork() {
+        SheepApp.getInstance().getNetComponent().getApiService().getDailyPlayGameList(page, per_page, daily_paly)
+                        .subscribeOn(Schedulers.io())
+                        .observeOn(AndroidSchedulers.mainThread())
+                        .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
+                            @Override
+                            public void onNext(BaseMessage baseMessage) {
+                                boolean isNewData = DataUtil.getInstance().isNewData(getKey());
+                                if (isNewData && !isFirstCache) {
+                                    List<GameEntity> cacheList = baseMessage.getDataList(GameEntity.class);
+                                    if(!ListUtil.isEmpty(cacheList)){
+                                        ListUtil.addAllItem(list, cacheList);
+                                    }
+                                }
+                                notifyDataSetChanged();
+                            }
+
+                            @Override
+                            public void onError(BaseMessage baseMessage) {
+                                notifyDataSetChanged();
+                            }
+                        });
+    }
+
+    public int getDataCount() {
+        return list.size();
+    }
+
+    private boolean noMore = false;
+    public boolean isNoMore() {
+        return noMore;
+    }
+
+
+    //加载完成时更新header或footer
+    protected void refreshOrLoadMoreComplete() {
+        if(smartRefreshLayout != null && getUserVisibleHint()) {
+            if (page == 1) {
+                smartRefreshLayout.finishRefresh();
+            } else {
+                smartRefreshLayout.finishLoadMore();
+            }
+        }
+    }
+    //重新设置ViewPager的高度
+    protected void resetViewPagerHeight() {
+        if(viewPager != null && getUserVisibleHint()){
+            int count = getDataCount();
+            ViewGroup.LayoutParams params = viewPager.getLayoutParams();
+            params.height = count == 0 ? G.HEIGHT / 2 : count * getItemHeight();
+//            LogUtil.println("resetViewPagerHeight", count, about_to_begin, show_type, getItemHeight(), params.height);
+            viewPager.setLayoutParams(params);
+        }
+    }
+
+    @Override
+    public void setUserVisibleHint(boolean isVisibleToUser) {
+        super.setUserVisibleHint(isVisibleToUser);
+        resetViewPagerHeight();
+        if(smartRefreshLayout != null && getUserVisibleHint()) {
+            smartRefreshLayout.setNoMoreData(noMore);
+        }
+    }
+    protected int getItemHeight(){
+        return G.getRealPix(104);
+    }
+
+    //是否显示无数据占位图
+    protected void updateEmptyView(){
+        boolean showEmpty = list.isEmpty();
+        CommonUtil.getInstance().updateEmptyView(empty_view, showEmpty);
+    }
+
+    @Override
+    public void onDestroyView() {
+        super.onDestroyView();
+        view_list = null;
+        viewPager = null;
+        smartRefreshLayout = null;
+    }
+
+    protected ViewPager viewPager;
+    protected SmartRefreshLayout smartRefreshLayout;
+
+    public ViewPager getViewPager() {
+        return viewPager;
+    }
+
+    public void setViewPager(ViewPager viewPager) {
+        this.viewPager = viewPager;
+    }
+
+    public SmartRefreshLayout getSmartRefreshLayout() {
+        return smartRefreshLayout;
+    }
+
+    public void setSmartRefreshLayout(SmartRefreshLayout smartRefreshLayout) {
+        this.smartRefreshLayout = smartRefreshLayout;
+    }
+}

+ 4 - 2
app/src/main/java/com/sheep/gamegroup/module/home/fragment/FgtPromoteGoodsList.java

@@ -132,7 +132,9 @@ public class FgtPromoteGoodsList extends BaseFragment implements ILoadMore, IRef
     public void mInitData() {
         CommonUtil.getInstance().resetEmptyView(empty_view);
         //先加载缓存
-        getReleaseFromACache();
+        if(isFirstCache) {
+            getReleaseFromACache();
+        }
         //再加载网络数据
         getReleaseFromNetWork();
     }
@@ -176,7 +178,7 @@ public class FgtPromoteGoodsList extends BaseFragment implements ILoadMore, IRef
                             @Override
                             public void onNext(BaseMessage baseMessage) {
                                 boolean isNewData = DataUtil.getInstance().isNewData(getKey());
-                                if (isNewData) {
+                                if (isNewData && !isFirstCache) {
                                     GetPromoteGoodsUrl getPromoteGoodsUrl = baseMessage.getData(GetPromoteGoodsUrl.class);
                                     if(getPromoteGoodsUrl != null){
                                         adapter.setBaseUrl(getPromoteGoodsUrl.getGoods_url());

+ 10 - 0
app/src/main/java/com/sheep/gamegroup/util/viewHelper/LayoutParamsUtil.java

@@ -3,6 +3,7 @@ package com.sheep.gamegroup.util.viewHelper;
 import android.support.constraint.ConstraintLayout;
 import android.view.View;
 import android.view.ViewGroup;
+import android.widget.FrameLayout;
 import android.widget.LinearLayout;
 import android.widget.RelativeLayout;
 
@@ -40,6 +41,15 @@ public class LayoutParamsUtil {
                 ((LinearLayout.LayoutParams) layoutParams).bottomMargin = lp.getBottomMargin();
             if (lp.getRightMargin() != Lp.NONE)
                 ((LinearLayout.LayoutParams) layoutParams).rightMargin = lp.getRightMargin();
+        } else if (layoutParams instanceof FrameLayout.LayoutParams) {
+            if (lp.getTopMargin() != Lp.NONE)
+                ((FrameLayout.LayoutParams) layoutParams).topMargin = lp.getTopMargin();
+            if (lp.getLeftMargin() != Lp.NONE)
+                ((FrameLayout.LayoutParams) layoutParams).leftMargin = lp.getLeftMargin();
+            if (lp.getBottomMargin() != Lp.NONE)
+                ((FrameLayout.LayoutParams) layoutParams).bottomMargin = lp.getBottomMargin();
+            if (lp.getRightMargin() != Lp.NONE)
+                ((FrameLayout.LayoutParams) layoutParams).rightMargin = lp.getRightMargin();
         } else if (layoutParams instanceof ConstraintLayout.LayoutParams) {
             if (lp.getTopMargin() != Lp.NONE)
                 ((ConstraintLayout.LayoutParams) layoutParams).topMargin = lp.getTopMargin();

+ 19 - 10
app/src/main/java/com/sheep/gamegroup/view/fragment/FgtSmallSheep.java

@@ -34,6 +34,7 @@ import android.view.animation.Animation;
 import android.view.animation.OvershootInterpolator;
 import android.view.animation.TranslateAnimation;
 import android.widget.EditText;
+import android.widget.FrameLayout;
 import android.widget.ImageView;
 import android.widget.LinearLayout;
 import android.widget.PopupWindow;
@@ -71,6 +72,7 @@ import com.sheep.gamegroup.model.util.SheepSubscriber;
 import com.sheep.gamegroup.model.util.ShowRedDot;
 import com.sheep.gamegroup.module.game.util.HpRefreshWelfareHelper;
 import com.sheep.gamegroup.module.home.adapter.AdpHomeList;
+import com.sheep.gamegroup.module.home.fragment.FgtDailyPlayList;
 import com.sheep.gamegroup.module.home.fragment.FgtPromoteGoodsList;
 import com.sheep.gamegroup.module.skin.util.SkinUtil;
 import com.sheep.gamegroup.presenter.SmallSheepContract;
@@ -241,7 +243,7 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
     private TextView willStart;
     private TextView promote_goods_tv;
     private View doItLine;
-    private LinearLayout lines;
+    private FrameLayout lines;
 
     /**
      * @return 是否显示兑换邀请码红包
@@ -520,7 +522,7 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
         if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
             TransitionManager.beginDelayedTransition(titleCardLayout, new ChangeBounds());
         }
-        lines.setGravity(Gravity.START);
+        LayoutParamsUtil.resetLayoutParams(doItLine, new Lp().setGravity(Gravity.START));
     }
 
     /**
@@ -533,7 +535,7 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
         if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
             TransitionManager.beginDelayedTransition(titleCardLayout, new ChangeBounds());
         }
-        lines.setGravity(Gravity.CENTER);
+        LayoutParamsUtil.resetLayoutParams(doItLine, new Lp().setGravity(Gravity.CENTER));
     }
     /**
      * 点击限时抢购
@@ -545,7 +547,7 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
         if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
             TransitionManager.beginDelayedTransition(titleCardLayout, new ChangeBounds());
         }
-        lines.setGravity(Gravity.END);
+        LayoutParamsUtil.resetLayoutParams(doItLine, new Lp().setGravity(Gravity.END));
     }
 
     /**
@@ -622,7 +624,8 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
          */
         mAdapter = new AdpTryMakemoney(getChildFragmentManager(), activity);
         FgtHomeTaskReleaseList firstItem = FgtHomeTaskReleaseList.newInstance(0, "is_hot");
-        FgtHomeTaskReleaseList secondItem = FgtHomeTaskReleaseList.newInstance(1, "about_to_begin");
+//        FgtHomeTaskReleaseList secondItem = FgtHomeTaskReleaseList.newInstance(1, "about_to_begin");
+        FgtDailyPlayList secondItem = FgtDailyPlayList.newInstance();
         FgtPromoteGoodsList thirdItem = FgtPromoteGoodsList.newInstance();
         firstItem.setViewPager(mViewPager);
         firstItem.setSmartRefreshLayout(refresh);
@@ -631,7 +634,7 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
         thirdItem.setViewPager(mViewPager);
         thirdItem.setSmartRefreshLayout(refresh);
         mAdapter.add(firstItem, "每日必做");
-        mAdapter.add(secondItem, "即将开始");
+        mAdapter.add(secondItem, "每日必玩");
         mAdapter.add(thirdItem, "限时抢购");
 
         mViewPager.setOffscreenPageLimit(2);
@@ -647,10 +650,16 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
 
             @Override
             public void onPageSelected(int position) {
-                if (position == 0) {
-                    toDayClick();
-                } else if (position == 1) {
-                    willStartClick();
+                switch (position) {
+                    case 0:
+                        toDayClick();
+                        break;
+                    case 1:
+                        willStartClick();
+                        break;
+                    case 2:
+                        clickPromoteGoods();
+                        break;
                 }
                 curPosition = position;
             }

+ 2 - 0
app/src/main/java/org/afinal/simplecache/ApiKey.java

@@ -92,6 +92,8 @@ public class ApiKey {
     public static final String getGameGroupSearch = "app/game_group/search";
     //获取限时抢购列表
     public static final String PROMOTE_GOODS = "app/yf_shop/promote_goods";
+    //获取游戏列表
+    public static final String FIND = "app/find";
 
     public static final String getPackageVersion(String package_name, String type, int version){
         return String.format(Locale.CHINA, "%s?package_name=%s&type=%s&version=%d", getPackageVersion, package_name, type, version);

+ 60 - 0
app/src/main/res/layout/item_hp_daily_play.xml

@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="utf-8"?>
+<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content">
+
+    <ImageView
+        android:id="@+id/item_icon_iv"
+        android:layout_width="63dp"
+        android:layout_height="62dp"
+        android:layout_marginStart="16dp"
+        android:layout_marginTop="26dp"
+        android:layout_marginBottom="16dp"
+        android:src="@mipmap/sheep_logo"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toTopOf="parent" />
+
+    <TextView
+        android:id="@+id/item_name_tv"
+        android:layout_width="0dp"
+        android:layout_height="wrap_content"
+        android:layout_marginStart="11dp"
+        android:layout_marginEnd="19dp"
+        android:ellipsize="end"
+        android:maxLines="2"
+        android:text="永恒仙域"
+        android:textColor="#ff333333"
+        android:textSize="14sp"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toEndOf="@id/item_icon_iv"
+        app:layout_constraintTop_toTopOf="@id/item_icon_iv" />
+
+    <LinearLayout
+        android:id="@+id/item_game_tags"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:gravity="center_vertical"
+        android:orientation="horizontal"
+        app:layout_constraintBottom_toTopOf="@id/item_size_tv"
+        app:layout_constraintStart_toStartOf="@id/item_name_tv" />
+
+    <TextView
+        android:id="@+id/item_size_tv"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:text="601M"
+        android:textColor="#ff8e8e8e"
+        android:textSize="10sp"
+        app:layout_constraintBottom_toBottomOf="@id/item_icon_iv"
+        app:layout_constraintStart_toStartOf="@id/item_name_tv" />
+
+    <TextView
+        style="@style/style_button_find"
+        android:text="游戏下载"
+        android:layout_marginEnd="16dp"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintTop_toTopOf="parent" />
+</android.support.constraint.ConstraintLayout>

+ 6 - 7
app/src/main/res/layout/view_float_title_card.xml

@@ -37,7 +37,7 @@
                 android:layout_weight="1"
                 android:gravity="center"
                 android:padding="10dp"
-                android:text="即将开始"
+                android:text="每日必玩"
                 android:textColor="@color/black_444444"
                 android:textSize="16sp" />
             <TextView
@@ -52,17 +52,16 @@
                 android:textSize="16sp" />
         </LinearLayout>
 
-        <LinearLayout
+        <FrameLayout
             android:id="@+id/but_will_start"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:gravity="left"
-            android:orientation="horizontal">
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content">
 
             <View
                 android:id="@+id/do_it_every_day_line"
                 android:layout_width="70dp"
                 android:layout_height="2dp"
+                android:layout_gravity="start"
                 android:background="@color/blue_34a6e7" />
 
             <!--<View-->
@@ -71,6 +70,6 @@
             <!--android:layout_height="2dp"-->
             <!--android:background="@color/blue_34a6e7"-->
             <!--android:visibility="invisible" />-->
-        </LinearLayout>
+        </FrameLayout>
     </LinearLayout>
 </LinearLayout>