@@ -15,6 +15,7 @@ import com.bonait.bnframework.common.model.mode.OrganizeMode; | |||
import com.bonait.bnframework.common.model.mode.ProcessT; | |||
import com.bonait.bnframework.common.model.mode.ResALLData; | |||
import com.bonait.bnframework.common.model.mode.VersionSelectionEnum; | |||
import com.bonait.bnframework.common.utils.ScreenUtils; | |||
import java.util.ArrayList; | |||
import java.util.Arrays; | |||
@@ -47,6 +48,7 @@ public class ConfigName { | |||
public Context dishesCon; | |||
public Context Home; | |||
public Application app; | |||
public boolean IsPortraitScreen=true;//是否竖屏 | |||
//endregion | |||
//region SD卡路径设置 | |||
@@ -0,0 +1,27 @@ | |||
package com.bonait.bnframework.common.utils; | |||
import android.app.Activity; | |||
import android.util.DisplayMetrics; | |||
public class ScreenUtils { | |||
/** | |||
* 是否竖屏 | |||
* | |||
* @return | |||
*/ | |||
public static boolean IsPortraitScreen(Activity mLauncher) { | |||
boolean su = false; | |||
DisplayMetrics dm = new DisplayMetrics(); | |||
mLauncher.getWindowManager().getDefaultDisplay().getMetrics(dm); | |||
int mWidth = dm.widthPixels; | |||
int mHeight = dm.heightPixels; | |||
if (mHeight > mWidth) {//layout port | |||
// 竖屏 ....... | |||
su = true; | |||
} else {//layout land | |||
// 横屏 ....... | |||
su = false; | |||
} | |||
return su; | |||
} | |||
} |
@@ -185,7 +185,7 @@ public class ActivityLifecycleManager implements Application.ActivityLifecycleCa | |||
*/ | |||
pushActivity(activity); | |||
// 设置禁止随屏幕旋转界面 | |||
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); | |||
//activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); | |||
} | |||
@Override | |||
@@ -1,25 +1,32 @@ | |||
package com.bonait.bnframework.modules.home.fragment; | |||
import static com.bonait.bnframework.MainApplication.getContext; | |||
import android.app.Fragment; | |||
import android.content.Context; | |||
import android.content.Intent; | |||
import android.os.Bundle; | |||
import androidx.annotation.NonNull; | |||
import androidx.annotation.Nullable; | |||
import androidx.recyclerview.widget.GridLayoutManager; | |||
import android.view.LayoutInflater; | |||
import android.view.View; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.common.base.BaseFragment; | |||
import com.bonait.bnframework.common.constant.ConfigName; | |||
import com.bonait.bnframework.common.constant.MessageName; | |||
import com.bonait.bnframework.common.message.MessageManager; | |||
import com.bonait.bnframework.common.utils.ScreenUtils; | |||
import com.bonait.bnframework.common.utils.ToastUtils; | |||
import com.bonait.bnframework.modules.home.fragment.from.CpActivity; | |||
import com.bonait.bnframework.modules.home.fragment.from.DiyActivity; | |||
import com.bonait.bnframework.modules.home.fragment.from.SzActivity; | |||
import com.bonait.bnframework.modules.home.fragment.from.WhActivity; | |||
import com.orhanobut.logger.Logger; | |||
import com.qmuiteam.qmui.widget.QMUIAppBarLayout; | |||
import com.qmuiteam.qmui.widget.QMUICollapsingTopBarLayout; | |||
import com.qmuiteam.qmui.widget.QMUITopBar; | |||
@@ -34,6 +41,9 @@ public class Home2Fragment extends BaseFragment { | |||
@BindView(R.id.collapsing_topbar_layout) | |||
QMUICollapsingTopBarLayout mCollapsingTopBarLayout; | |||
@BindView(R.id.appbarlayout) | |||
QMUIAppBarLayout appbarlayout; | |||
@BindView(R.id.topbar) | |||
QMUITopBar mTopBar; | |||
private Context context; | |||
@@ -52,6 +62,8 @@ public class Home2Fragment extends BaseFragment { | |||
super.onViewCreated(view, savedInstanceState); | |||
context = getContext(); | |||
initTopBar(); | |||
appbarlayout.setExpanded(ConfigName.getInstance().IsPortraitScreen); | |||
} | |||
private void initTopBar() { | |||
@@ -27,6 +27,7 @@ import com.bonait.bnframework.common.db.mode.BPA_PLCADDRESS; | |||
import com.bonait.bnframework.common.message.MessageLooper; | |||
import com.bonait.bnframework.common.message.MessageManager; | |||
import com.bonait.bnframework.common.model.mode.CloudGood; | |||
import com.bonait.bnframework.common.utils.ScreenUtils; | |||
import com.bonait.bnframework.common.utils.ToastUtils; | |||
import com.bonait.bnframework.modules.home.fragment.mode.QDListSectionAdapter; | |||
import com.bonait.bnframework.modules.home.fragment.mode.SectionHeader; | |||
@@ -175,13 +176,22 @@ public class CpActivity extends BaseActivity { | |||
// ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); | |||
// } | |||
// }; | |||
final GridLayoutManager layoutManager = new GridLayoutManager(getContext(), 3); | |||
final GridLayoutManager layoutManager; | |||
if(ConfigName.getInstance().IsPortraitScreen)//竖屏 | |||
{ | |||
layoutManager = new GridLayoutManager(getContext(), 3); | |||
}else | |||
{ | |||
layoutManager = new GridLayoutManager(getContext(), 5); | |||
} | |||
layoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() { | |||
@Override | |||
public int getSpanSize(int i) { | |||
return mAdapter.getItemIndex(i) < 0 ? layoutManager.getSpanCount() : 1; | |||
} | |||
}); | |||
return layoutManager; | |||
} | |||
@@ -20,6 +20,7 @@ import android.widget.CompoundButton; | |||
import android.widget.EditText; | |||
import android.widget.ImageView; | |||
import android.widget.LinearLayout; | |||
import android.widget.RelativeLayout; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.business.ConfigData; | |||
@@ -122,6 +123,18 @@ public class LoginActivity extends BaseActivity implements Validator.ValidationL | |||
{ | |||
mEtAccount.requestFocus(); | |||
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN); | |||
if(ConfigName.getInstance().IsPortraitScreen)//竖屏 | |||
{ | |||
RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(mScrollView.getLayoutParams()); | |||
lp.setMargins(15, 80, 15, 0); | |||
mScrollView.setLayoutParams(lp); | |||
}else | |||
{ | |||
RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(mScrollView.getLayoutParams()); | |||
lp.setMargins(15, 40, 15, 0); | |||
mScrollView.setLayoutParams(lp); | |||
} | |||
} | |||
@OnClick({R.id.iv_clean_account, R.id.clean_password, R.id.iv_show_pwd,R.id.forget_password, R.id.btn_login}) | |||
@@ -7,6 +7,8 @@ import android.os.Handler; | |||
import androidx.annotation.NonNull; | |||
import androidx.appcompat.app.AppCompatActivity; | |||
import androidx.recyclerview.widget.GridLayoutManager; | |||
import android.view.KeyEvent; | |||
import com.bonait.bnframework.R; | |||
@@ -14,6 +16,7 @@ import com.bonait.bnframework.business.MainInit; | |||
import com.bonait.bnframework.common.base.BaseActivity; | |||
import com.bonait.bnframework.common.constant.ConfigName; | |||
import com.bonait.bnframework.common.constant.Constants; | |||
import com.bonait.bnframework.common.utils.ScreenUtils; | |||
import com.bonait.bnframework.manager.ActivityLifecycleManager; | |||
import com.bonait.bnframework.modules.home.activity.BottomNavigation2Activity; | |||
import com.bonait.bnframework.test.TestActivity; | |||
@@ -190,6 +193,8 @@ public class WelcomeActivity extends BaseActivity { | |||
private void skipToLoginActivity() { | |||
//初始化 | |||
MainInit.Init(ConfigName.getInstance().app); | |||
ConfigName.getInstance().IsPortraitScreen=ScreenUtils.IsPortraitScreen(this); | |||
// 跳转到登录页面 | |||
Intent intent = new Intent(WelcomeActivity.this, LoginActivity.class); | |||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); | |||
@@ -9,9 +9,8 @@ | |||
<ScrollView | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
android:layout_marginTop="?attr/qmui_topbar_height" | |||
android:background="@color/activity_background" | |||
android:fitsSystemWindows="true"> | |||
android:layout_marginTop="80dp" | |||
android:background="@color/activity_background"> | |||
<RelativeLayout | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content"> | |||
@@ -12,8 +12,7 @@ | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
android:background="@color/activity_background" | |||
android:layout_marginTop="?attr/qmui_topbar_height" | |||
android:fitsSystemWindows="true" | |||
android:layout_marginTop="80dp" | |||
> | |||
<LinearLayout | |||
android:layout_width="match_parent" | |||
@@ -13,9 +13,8 @@ | |||
<RelativeLayout | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
android:layout_marginTop="?attr/qmui_topbar_height" | |||
android:background="@color/qmui_config_color_white" | |||
android:fitsSystemWindows="true"> | |||
android:layout_marginTop="80dp" | |||
android:background="@color/qmui_config_color_white"> | |||
<ScrollView | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent"> | |||
@@ -24,7 +23,8 @@ | |||
android:layout_marginRight="30dp" | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content" | |||
android:orientation="vertical"> | |||
android:orientation="vertical" | |||
> | |||
<LinearLayout | |||
android:layout_marginTop="@dimen/dp_10" | |||
android:layout_width="match_parent" | |||
@@ -280,7 +280,8 @@ | |||
<RelativeLayout | |||
android:layout_marginTop="30dp" | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content"> | |||
android:layout_height="wrap_content" | |||
android:layout_marginBottom="30dp"> | |||
<Button | |||
android:id="@+id/shengchengcaipu" | |||
android:layout_width="match_parent" | |||
@@ -12,9 +12,8 @@ | |||
<RelativeLayout | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
android:layout_marginTop="?attr/qmui_topbar_height" | |||
android:background="@color/qmui_config_color_white" | |||
android:fitsSystemWindows="true"> | |||
android:layout_marginTop="80dp" | |||
android:background="@color/qmui_config_color_white"> | |||
<ScrollView | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent"> | |||
@@ -279,7 +278,8 @@ | |||
<RelativeLayout | |||
android:layout_marginTop="30dp" | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content"> | |||
android:layout_height="wrap_content" | |||
android:layout_marginBottom="30dp"> | |||
<LinearLayout | |||
android:layout_centerHorizontal="true" | |||
android:layout_width="wrap_content" | |||
@@ -13,20 +13,11 @@ | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent"> | |||
<com.bonait.bnframework.common.bg.SnowView | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
android:background="@color/transparent"/> | |||
<ImageView | |||
android:id="@+id/logo" | |||
android:layout_width="100dp" | |||
android:layout_height="100dp" | |||
android:layout_centerHorizontal="true" | |||
android:layout_gravity="center" | |||
android:layout_marginTop="80dp" | |||
android:background="@null" | |||
android:scaleType="centerCrop" | |||
android:src="@mipmap/ico"/> | |||
<!-- <com.bonait.bnframework.common.bg.SnowView--> | |||
<!-- android:layout_width="match_parent"--> | |||
<!-- android:layout_height="match_parent"--> | |||
<!-- android:background="@color/transparent"/>--> | |||
<androidx.core.widget.NestedScrollView | |||
android:id="@+id/scrollView" | |||
android:layout_width="match_parent" | |||
@@ -35,6 +26,7 @@ | |||
android:layout_alignParentTop="true" | |||
android:layout_marginLeft="15dp" | |||
android:layout_marginRight="15dp" | |||
android:layout_marginTop="80dp" | |||
android:fillViewport="true" | |||
android:scrollbarThumbVertical="@android:color/transparent" | |||
android:scrollbars="vertical"> | |||
@@ -43,11 +35,18 @@ | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
android:orientation="vertical"> | |||
<ImageView | |||
android:id="@+id/logo" | |||
android:layout_width="100dp" | |||
android:layout_height="100dp" | |||
android:layout_centerHorizontal="true" | |||
android:layout_gravity="center" | |||
android:background="@null" | |||
android:scaleType="centerCrop" | |||
android:src="@mipmap/ico"/> | |||
<LinearLayout | |||
android:layout_width="match_parent" | |||
android:layout_height="55dp" | |||
android:layout_marginTop="200dp" | |||
android:gravity="center_vertical" | |||
android:orientation="horizontal"> | |||
@@ -10,9 +10,8 @@ | |||
<ScrollView | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
android:layout_marginTop="?attr/qmui_topbar_height" | |||
android:background="@color/activity_background" | |||
android:fitsSystemWindows="true"> | |||
android:layout_marginTop="80dp" | |||
android:background="@color/activity_background"> | |||
<RelativeLayout | |||
android:layout_width="match_parent" | |||
@@ -11,6 +11,7 @@ | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent"> | |||
<com.qmuiteam.qmui.widget.QMUIAppBarLayout | |||
android:id="@+id/appbarlayout" | |||
android:layout_width="match_parent" | |||
android:layout_height="256dp" | |||
android:fitsSystemWindows="true"> | |||
@@ -14,7 +14,8 @@ | |||
<RelativeLayout | |||
android:layout_width="match_parent" | |||
android:layout_height="200dp"> | |||
android:layout_height="0dp" | |||
android:layout_weight="0.3"> | |||
<ImageView | |||
android:id="@+id/h_background" | |||
@@ -43,83 +44,90 @@ | |||
</RelativeLayout> | |||
<ScrollView | |||
<RelativeLayout | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content"> | |||
<LinearLayout | |||
android:id="@+id/information_layout" | |||
android:layout_height="0dp" | |||
android:layout_weight="1"> | |||
<ScrollView | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content" | |||
android:background="@color/main_background" | |||
android:orientation="vertical"> | |||
android:layout_height="wrap_content"> | |||
<com.allen.library.SuperTextView | |||
android:id="@+id/stv_user_name" | |||
android:layout_width="match_parent" | |||
android:layout_height="@dimen/ll_height" | |||
stv:sBottomDividerLineMarginLeft="@dimen/dp_40" | |||
stv:sLeftIconRes="@drawable/icon_personal_user" | |||
stv:sLeftTextString="用户名" | |||
stv:sRightIconRes="@drawable/icon_right" | |||
stv:sRightTextColor="@color/gray" | |||
stv:sRightTextString="用户" /> | |||
<com.allen.library.SuperTextView | |||
android:id="@+id/stv_user_sign" | |||
android:layout_width="match_parent" | |||
android:layout_height="@dimen/ll_height" | |||
stv:sLeftIconRes="@drawable/icon_personal_sign" | |||
stv:sLeftTextString="签名" | |||
stv:sRightIconRes="@drawable/icon_right" | |||
stv:sRightTextColor="@color/gray" | |||
stv:sRightTextString="" /> | |||
<com.allen.library.SuperTextView | |||
android:id="@+id/stv_change_pwd" | |||
<LinearLayout | |||
android:id="@+id/information_layout" | |||
android:layout_width="match_parent" | |||
android:layout_height="@dimen/ll_height" | |||
android:layout_marginTop="@dimen/dp_10" | |||
stv:sBottomDividerLineMarginLeft="@dimen/dp_40" | |||
stv:sLeftIconRes="@drawable/icon_personal_pwd" | |||
stv:sLeftTextString="更改密码" | |||
stv:sRightIconRes="@drawable/icon_right" /> | |||
<com.allen.library.SuperTextView | |||
android:id="@+id/stv_announcement" | |||
android:layout_width="match_parent" | |||
android:layout_height="@dimen/ll_height" | |||
stv:sBottomDividerLineMarginLeft="@dimen/dp_40" | |||
stv:sLeftIconRes="@drawable/icon_personal_announcement" | |||
stv:sLeftTextString="通知" | |||
stv:sRightIconRes="@drawable/icon_right" /> | |||
<com.allen.library.SuperTextView | |||
android:id="@+id/stv_update" | |||
android:layout_width="match_parent" | |||
android:layout_height="@dimen/ll_height" | |||
stv:sLeftIconRes="@drawable/icon_personal_update" | |||
stv:sLeftTextString="版本更新" | |||
stv:sRightIconRes="@drawable/icon_right" /> | |||
android:layout_height="wrap_content" | |||
android:background="@color/main_background" | |||
android:orientation="vertical"> | |||
<com.allen.library.SuperTextView | |||
android:id="@+id/stv_user_name" | |||
android:layout_width="match_parent" | |||
android:layout_height="@dimen/ll_height" | |||
stv:sBottomDividerLineMarginLeft="@dimen/dp_40" | |||
stv:sLeftIconRes="@drawable/icon_personal_user" | |||
stv:sLeftTextString="用户名" | |||
stv:sRightIconRes="@drawable/icon_right" | |||
stv:sRightTextColor="@color/gray" | |||
stv:sRightTextString="用户" /> | |||
<com.allen.library.SuperTextView | |||
android:id="@+id/stv_user_sign" | |||
android:layout_width="match_parent" | |||
android:layout_height="@dimen/ll_height" | |||
stv:sLeftIconRes="@drawable/icon_personal_sign" | |||
stv:sLeftTextString="签名" | |||
stv:sRightIconRes="@drawable/icon_right" | |||
stv:sRightTextColor="@color/gray" | |||
stv:sRightTextString="" /> | |||
<com.allen.library.SuperTextView | |||
android:id="@+id/stv_change_pwd" | |||
android:layout_width="match_parent" | |||
android:layout_height="@dimen/ll_height" | |||
android:layout_marginTop="@dimen/dp_10" | |||
stv:sBottomDividerLineMarginLeft="@dimen/dp_40" | |||
stv:sLeftIconRes="@drawable/icon_personal_pwd" | |||
stv:sLeftTextString="更改密码" | |||
stv:sRightIconRes="@drawable/icon_right" /> | |||
<com.allen.library.SuperTextView | |||
android:id="@+id/stv_announcement" | |||
android:layout_width="match_parent" | |||
android:layout_height="@dimen/ll_height" | |||
stv:sBottomDividerLineMarginLeft="@dimen/dp_40" | |||
stv:sLeftIconRes="@drawable/icon_personal_announcement" | |||
stv:sLeftTextString="通知" | |||
stv:sRightIconRes="@drawable/icon_right" /> | |||
<com.allen.library.SuperTextView | |||
android:id="@+id/stv_update" | |||
android:layout_width="match_parent" | |||
android:layout_height="@dimen/ll_height" | |||
stv:sLeftIconRes="@drawable/icon_personal_update" | |||
stv:sLeftTextString="版本更新" | |||
stv:sRightIconRes="@drawable/icon_right" /> | |||
<com.allen.library.SuperTextView | |||
android:id="@+id/stv_huifu" | |||
android:layout_width="match_parent" | |||
android:layout_height="@dimen/ll_height" | |||
stv:sLeftIconRes="@drawable/hfccsz" | |||
stv:sLeftTextString="恢复出厂设置" | |||
stv:sRightIconRes="@drawable/icon_right" /> | |||
<com.allen.library.SuperTextView | |||
android:id="@+id/stv_logout" | |||
android:layout_width="wrap_content" | |||
android:layout_height="@dimen/ll_height" | |||
android:layout_marginTop="@dimen/dp_10" | |||
stv:sCenterTextColor="@color/red_primary" | |||
stv:sCenterTextString="退出登录" /> | |||
</LinearLayout> | |||
</ScrollView> | |||
</RelativeLayout> | |||
<com.allen.library.SuperTextView | |||
android:id="@+id/stv_huifu" | |||
android:layout_width="match_parent" | |||
android:layout_height="@dimen/ll_height" | |||
stv:sLeftIconRes="@drawable/hfccsz" | |||
stv:sLeftTextString="恢复出厂设置" | |||
stv:sRightIconRes="@drawable/icon_right" /> | |||
<com.allen.library.SuperTextView | |||
android:id="@+id/stv_logout" | |||
android:layout_width="wrap_content" | |||
android:layout_height="@dimen/ll_height" | |||
android:layout_marginTop="@dimen/dp_10" | |||
stv:sCenterTextColor="@color/red_primary" | |||
stv:sCenterTextString="退出登录" /> | |||
</LinearLayout> | |||
</ScrollView> | |||
</LinearLayout> | |||