@@ -33,6 +33,18 @@ | |||
tools:ignore="GoogleAppIndexingWarning" | |||
tools:node="merge" | |||
tools:replace="android:icon"> | |||
<activity | |||
android:name=".HomeFragmentSBKZ" | |||
android:exported="false" /> | |||
<activity | |||
android:name=".HomeFragmentPR" | |||
android:exported="false" /> | |||
<activity | |||
android:name=".modules.home.fragment.Home4Fragment" | |||
android:exported="false" /> | |||
<activity | |||
android:name=".modules.home.activity.BottomNavigationNewActivity" | |||
android:exported="false" /> | |||
<activity | |||
android:name=".modules.mine.fragment.UserActivity" | |||
android:exported="false" /> | |||
@@ -879,11 +879,17 @@ public class ConfigData { | |||
Bitmap bitmap2 = BitmapFactory.decodeResource(context.getResources(), R.mipmap.image2, options); | |||
Bitmap bitmap3 = BitmapFactory.decodeResource(context.getResources(), R.mipmap.image3, options); | |||
Bitmap bitmap4 = BitmapFactory.decodeResource(context.getResources(), R.mipmap.image4, options); | |||
Bitmap bitmap5 = BitmapFactory.decodeResource(context.getResources(), R.mipmap.image5, options); | |||
Bitmap bitmap6 = BitmapFactory.decodeResource(context.getResources(), R.mipmap.image6, options); | |||
LocalCacheUtils localCacheUtils = new LocalCacheUtils(); | |||
localCacheUtils.setBitmapToLocal("image1.png", bitmap1); | |||
localCacheUtils.setBitmapToLocal("image2.png", bitmap2); | |||
localCacheUtils.setBitmapToLocal("image3.png", bitmap3); | |||
localCacheUtils.setBitmapToLocal("image4.png", bitmap4); | |||
localCacheUtils.setBitmapToLocal("image5.png", bitmap5); | |||
localCacheUtils.setBitmapToLocal("image6.png", bitmap6); | |||
} | |||
/** | |||
@@ -0,0 +1,123 @@ | |||
package com.bonait.bnframework.common.view; | |||
import android.content.Context; | |||
import android.graphics.Color; | |||
import android.util.AttributeSet; | |||
import android.view.LayoutInflater; | |||
import android.view.View; | |||
import android.widget.ImageView; | |||
import android.widget.LinearLayout; | |||
import android.widget.TextView; | |||
import androidx.annotation.Nullable; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.common.helper.I.MyClickListener; | |||
import butterknife.BindView; | |||
import butterknife.ButterKnife; | |||
import butterknife.OnClick; | |||
public class BottomNavigationBar extends LinearLayout { | |||
//region 变量 | |||
/** | |||
* 选中页面 | |||
*/ | |||
public int SelectIndex = 1; | |||
/** | |||
* 点击事件 | |||
*/ | |||
public MyClickListener mListener=null; | |||
@BindView(R.id.first) | |||
ImageView first; | |||
@BindView(R.id.z_bj) | |||
ImageView z_bj; | |||
@BindView(R.id.y_bj) | |||
ImageView y_bj; | |||
@BindView(R.id.z_wz) | |||
TextView z_wz; | |||
@BindView(R.id.y_wz) | |||
TextView y_wz; | |||
//endregion | |||
//region 私有 | |||
private View root; | |||
public BottomNavigationBar(Context context, @Nullable AttributeSet attrs) { | |||
super(context, attrs); | |||
root = LayoutInflater.from(context).inflate(R.layout.bottom_navigation, this); | |||
ButterKnife.bind(this, root); | |||
SelectIndexTab(SelectIndex); | |||
} | |||
//endregion | |||
//region 数据处理 | |||
@OnClick({R.id.z_wz, | |||
R.id.y_wz,R.id.first}) | |||
public void onViewClicked(View view) { | |||
switch (view.getId()) { | |||
case R.id.z_wz: | |||
SelectIndex=0; | |||
break; | |||
case R.id.y_wz: | |||
SelectIndex=2; | |||
break; | |||
case R.id.first: | |||
SelectIndex=1; | |||
break; | |||
} | |||
SelectIndexTab(SelectIndex); | |||
if(mListener!=null) | |||
{ | |||
mListener.clickListener(root,SelectIndex); | |||
} | |||
} | |||
//endregion | |||
//region 私有函数 | |||
/** | |||
* 选中 | |||
* | |||
* @param index | |||
*/ | |||
public void SelectIndexTab(int index) { | |||
switch (index) { | |||
case 1: | |||
z_bj.setVisibility(View.GONE); | |||
z_wz.setTextColor(Color.parseColor("#797373")); | |||
y_bj.setVisibility(View.GONE); | |||
y_wz.setTextColor(Color.parseColor("#797373")); | |||
first.setImageResource(R.mipmap.home_select); | |||
break; | |||
case 0: | |||
z_bj.setVisibility(View.VISIBLE); | |||
z_wz.setTextColor(Color.parseColor("#ffffff")); | |||
y_bj.setVisibility(View.GONE); | |||
y_wz.setTextColor(Color.parseColor("#797373")); | |||
first.setImageResource(R.mipmap.home_no); | |||
break; | |||
case 2: | |||
z_bj.setVisibility(View.GONE); | |||
z_wz.setTextColor(Color.parseColor("#797373")); | |||
y_bj.setVisibility(View.VISIBLE); | |||
y_wz.setTextColor(Color.parseColor("#ffffff")); | |||
first.setImageResource(R.mipmap.home_no); | |||
break; | |||
} | |||
} | |||
//endregion | |||
} |
@@ -1,6 +1,7 @@ | |||
package com.bonait.bnframework.modules.home.activity; | |||
import android.os.Bundle; | |||
import androidx.annotation.NonNull; | |||
import com.bonait.bnframework.business.ConfigData; | |||
@@ -12,6 +13,7 @@ import com.bonait.bnframework.common.helper.ThreadManager; | |||
import com.bonait.bnframework.common.modbus.ModbusTcpServer; | |||
import com.bonait.bnframework.common.utils.NetworkUtils; | |||
import com.google.android.material.bottomnavigation.BottomNavigationView; | |||
import androidx.viewpager.widget.ViewPager; | |||
import android.util.Log; | |||
@@ -76,12 +78,12 @@ public class BottomNavigation2Activity extends BaseActivity { | |||
fragmentAdapter.addFragment(new Home1Fragment()); | |||
fragmentAdapter.addFragment(new MyFragment()); | |||
viewPager.setAdapter(fragmentAdapter); | |||
MessageManager.getInstance().registerMessageReceiver(this, MessageName.SelectZY, new MessageLooper.OnMessageListener() { | |||
@Override | |||
public void onMessage(Object msg) { | |||
if (msg != null) { | |||
viewPager.setCurrentItem(1); | |||
int index = (int) msg; | |||
viewPager.setCurrentItem(index); | |||
} | |||
} | |||
}); | |||
@@ -161,8 +163,7 @@ public class BottomNavigation2Activity extends BaseActivity { | |||
/** | |||
* 初始化 | |||
*/ | |||
public void Init() | |||
{ | |||
public void Init() { | |||
//1.同步时间 | |||
NetworkUtils.SynchronizationTime(); | |||
//主持 | |||
@@ -178,47 +179,43 @@ public class BottomNavigation2Activity extends BaseActivity { | |||
/** | |||
* 重新连接plc | |||
*/ | |||
public void ReconnectModbus() | |||
{ | |||
public void ReconnectModbus() { | |||
try { | |||
ThreadManager.Get().StartLong("PLC断线重连线程", true, new IThread() { | |||
@Override | |||
public void Run() throws InterruptedException { | |||
try { | |||
if(ConfigName.getInstance().PlcIsConnect) | |||
{ | |||
if (ConfigName.getInstance().PlcIsConnect) { | |||
//ping 不通 | |||
boolean status = ModbusTcpServer.ping2(ConfigName.getInstance().Address,1,1); | |||
if(!status) //ping 不通 连接 | |||
boolean status = ModbusTcpServer.ping2(ConfigName.getInstance().Address, 1, 1); | |||
if (!status) //ping 不通 连接 | |||
{ | |||
MessageLog.ShowInfo("PLC状态断开,尝试连接..."); | |||
ConfigName.getInstance().PlcIsConnect=false; | |||
ConfigName.getInstance().PlcIsConnect = false; | |||
} | |||
}else | |||
{ | |||
boolean status = ModbusTcpServer.ping2(ConfigName.getInstance().Address,1,1); | |||
if(status) | |||
{ | |||
} else { | |||
boolean status = ModbusTcpServer.ping2(ConfigName.getInstance().Address, 1, 1); | |||
if (status) { | |||
MessageLog.ShowInfo("设备 " + ConfigName.getInstance().Address + " PLC通讯正常,准备连接!"); | |||
ModbusTcpServer.ConnectPLC(); | |||
}else | |||
{ | |||
} else { | |||
MessageLog.ShowInfo("PLC状态断开,尝试连接..."); | |||
ConfigName.getInstance().PlcIsConnect=false; | |||
ConfigName.getInstance().PlcIsConnect = false; | |||
} | |||
} | |||
Thread.sleep(10000); | |||
} catch (Exception e) { | |||
Log.i("PLC", "PLC重连接失败!"+e.getMessage()); | |||
Log.i("PLC", "PLC重连接失败!" + e.getMessage()); | |||
} | |||
} | |||
@Override | |||
public void RunComplete() throws InterruptedException { | |||
} | |||
}); | |||
}catch (Exception e) { | |||
MessageLog.ShowInfo("重新连接Modbus异常," +e.getMessage()); | |||
} catch (Exception e) { | |||
MessageLog.ShowInfo("重新连接Modbus异常," + e.getMessage()); | |||
} | |||
} | |||
} |
@@ -1,248 +0,0 @@ | |||
package com.bonait.bnframework.modules.home.activity; | |||
import android.annotation.SuppressLint; | |||
import android.content.Context; | |||
import android.os.Bundle; | |||
import androidx.fragment.app.Fragment; | |||
import androidx.fragment.app.FragmentTransaction; | |||
import androidx.core.content.ContextCompat; | |||
import androidx.viewpager.widget.ViewPager; | |||
import android.view.Gravity; | |||
import android.view.KeyEvent; | |||
import android.view.View; | |||
import android.view.ViewGroup; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.manager.ActivityLifecycleManager; | |||
import com.bonait.bnframework.common.base.BaseActivity; | |||
import com.bonait.bnframework.common.utils.ToastUtils; | |||
import com.bonait.bnframework.modules.home.fragment.Home1Fragment; | |||
import com.bonait.bnframework.modules.home.fragment.Home2Fragment; | |||
import com.bonait.bnframework.modules.mine.fragment.MyFragment; | |||
import com.lzy.okgo.OkGo; | |||
import com.qmuiteam.qmui.util.QMUIResHelper; | |||
import com.qmuiteam.qmui.widget.QMUIPagerAdapter; | |||
import com.qmuiteam.qmui.widget.QMUIViewPager; | |||
import com.qmuiteam.qmui.widget.tab.QMUITab; | |||
import com.qmuiteam.qmui.widget.tab.QMUITabBuilder; | |||
import com.qmuiteam.qmui.widget.tab.QMUITabSegment; | |||
import butterknife.BindView; | |||
import butterknife.ButterKnife; | |||
public class BottomNavigationActivity extends BaseActivity { | |||
@BindView(R.id.main_view_pager) | |||
QMUIViewPager mViewPager; | |||
@BindView(R.id.main_tabs) | |||
QMUITabSegment mTabSegment; | |||
private Context context; | |||
private long exitTime = 0; | |||
@Override | |||
protected void onCreate(Bundle savedInstanceState) { | |||
super.onCreate(savedInstanceState); | |||
setContentView(R.layout.activity_bottom_navigation); | |||
ButterKnife.bind(this); | |||
context = this; | |||
// 初始化tabs | |||
initTabs(); | |||
// 初始化viewPager,并填充fragment | |||
initPagers(); | |||
} | |||
/** | |||
* 初始化tab | |||
* */ | |||
private void initTabs() { | |||
// int normalColor = QMUIResHelper.getAttrColor(context, R.attr.qmui_config_color_gray_6); | |||
// int selectColor = QMUIResHelper.getAttrColor(context, R.attr.qmui_config_color_blue); | |||
// mTabSegment.setDefaultNormalColor(normalColor); | |||
// mTabSegment.setDefaultSelectedColor(selectColor); | |||
QMUITabBuilder tabBuilder =mTabSegment.tabBuilder().setGravity(Gravity.CENTER); | |||
QMUITab home = tabBuilder | |||
.setNormalDrawable(ContextCompat.getDrawable(context, R.mipmap.icon_tabbar_component)) | |||
.setSelectedDrawable(ContextCompat.getDrawable(context, R.mipmap.icon_tabbar_component_selected)) | |||
.setText("主页") | |||
.build(context); | |||
QMUITab Lab = tabBuilder | |||
.setNormalDrawable(ContextCompat.getDrawable(context, R.mipmap.icon_tabbar_component)) | |||
.setSelectedDrawable(ContextCompat.getDrawable(context, R.mipmap.icon_tabbar_component_selected)) | |||
.setText("烹饪") | |||
.build(context); | |||
QMUITab My = tabBuilder | |||
.setNormalDrawable(ContextCompat.getDrawable(context, R.mipmap.icon_tabbar_component)) | |||
.setSelectedDrawable(ContextCompat.getDrawable(context, R.mipmap.icon_tabbar_component_selected)) | |||
.setText("我的") | |||
.build(context); | |||
mTabSegment.addTab(home) | |||
.addTab(Lab) | |||
.addTab(My); | |||
} | |||
/** | |||
* 初始化viewPager并添加fragment | |||
* */ | |||
private void initPagers() { | |||
QMUIPagerAdapter pagerAdapter = new QMUIPagerAdapter() { | |||
private FragmentTransaction mCurrentTransaction; | |||
private Fragment mCurrentPrimaryItem = null; | |||
@Override | |||
public boolean isViewFromObject(View view, Object object) { | |||
return view == ((Fragment) object).getView(); | |||
} | |||
@Override | |||
public int getCount() { | |||
return 3; | |||
} | |||
@SuppressLint("CommitTransaction") | |||
@Override | |||
protected Object hydrate(ViewGroup container, int position) { | |||
String name = makeFragmentName(container.getId(), position); | |||
if (mCurrentTransaction == null) { | |||
mCurrentTransaction = getSupportFragmentManager() | |||
.beginTransaction(); | |||
} | |||
Fragment fragment = getSupportFragmentManager().findFragmentByTag(name); | |||
if(fragment != null){ | |||
return fragment; | |||
} | |||
switch (position) { | |||
case 0: | |||
return new Home2Fragment(); | |||
case 1: | |||
return new Home1Fragment(); | |||
case 2: | |||
return new MyFragment(); | |||
default: | |||
return new Home2Fragment(); | |||
} | |||
} | |||
@SuppressLint("CommitTransaction") | |||
@Override | |||
protected void populate(ViewGroup container, Object item, int position) { | |||
String name = makeFragmentName(container.getId(), position); | |||
if (mCurrentTransaction == null) { | |||
mCurrentTransaction = getSupportFragmentManager() | |||
.beginTransaction(); | |||
} | |||
Fragment fragment = getSupportFragmentManager().findFragmentByTag(name); | |||
if (fragment != null) { | |||
mCurrentTransaction.attach(fragment); | |||
if(fragment.getView() != null && fragment.getView().getWidth() == 0){ | |||
fragment.getView().requestLayout(); | |||
} | |||
} else { | |||
fragment = (Fragment) item; | |||
mCurrentTransaction.add(container.getId(), fragment, name); | |||
} | |||
if (fragment != mCurrentPrimaryItem) { | |||
fragment.setMenuVisibility(false); | |||
fragment.setUserVisibleHint(false); | |||
} | |||
} | |||
@SuppressLint("CommitTransaction") | |||
@Override | |||
protected void destroy(ViewGroup container, int position, Object object) { | |||
if (mCurrentTransaction == null) { | |||
mCurrentTransaction = getSupportFragmentManager() | |||
.beginTransaction(); | |||
} | |||
mCurrentTransaction.detach((Fragment) object); | |||
} | |||
@Override | |||
public void startUpdate(ViewGroup container) { | |||
if (container.getId() == View.NO_ID) { | |||
throw new IllegalStateException("ViewPager with adapter " + this | |||
+ " requires a view id"); | |||
} | |||
} | |||
@Override | |||
public void finishUpdate(ViewGroup container) { | |||
if (mCurrentTransaction != null) { | |||
mCurrentTransaction.commitNowAllowingStateLoss(); | |||
mCurrentTransaction = null; | |||
} | |||
} | |||
@Override | |||
public void setPrimaryItem(ViewGroup container, int position, Object object) { | |||
Fragment fragment = (Fragment) object; | |||
if (fragment != mCurrentPrimaryItem) { | |||
if (mCurrentPrimaryItem != null) { | |||
mCurrentPrimaryItem.setMenuVisibility(false); | |||
mCurrentPrimaryItem.setUserVisibleHint(false); | |||
} | |||
if (fragment != null) { | |||
fragment.setMenuVisibility(true); | |||
fragment.setUserVisibleHint(true); | |||
} | |||
mCurrentPrimaryItem = fragment; | |||
} | |||
} | |||
private String makeFragmentName(int viewId, long id) { | |||
return BottomNavigationActivity.class.getSimpleName() + ":" + viewId + ":" + id; | |||
} | |||
}; | |||
mViewPager.setAdapter(pagerAdapter); | |||
mViewPager.setOffscreenPageLimit(3); | |||
mViewPager.addOnPageChangeListener(pageChangeListener); | |||
mTabSegment.setupWithViewPager(mViewPager,false); | |||
} | |||
/** | |||
* 配置ViewPager监听器,手指滑动监听 | |||
*/ | |||
private ViewPager.OnPageChangeListener pageChangeListener = new ViewPager.OnPageChangeListener() { | |||
@Override | |||
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { | |||
} | |||
@Override | |||
public void onPageSelected(int position) { | |||
} | |||
@Override | |||
public void onPageScrollStateChanged(int state) { | |||
} | |||
}; | |||
@Override | |||
protected boolean canDragBack() { | |||
return mViewPager.getCurrentItem() == 0; | |||
} | |||
/** | |||
* 重写返回键,实现双击退出程序效果 | |||
*/ | |||
@Override | |||
public boolean onKeyDown(int keyCode, KeyEvent event) { | |||
if (keyCode == KeyEvent.KEYCODE_BACK) { | |||
if (System.currentTimeMillis() - exitTime > 2000) { | |||
ToastUtils.normal("再按一次退出程序"); | |||
exitTime = System.currentTimeMillis(); | |||
} else { | |||
OkGo.getInstance().cancelAll(); | |||
overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out); | |||
ActivityLifecycleManager.get().appExit(); | |||
} | |||
return true; | |||
} | |||
return super.onKeyDown(keyCode, event); | |||
} | |||
} |
@@ -0,0 +1,216 @@ | |||
package com.bonait.bnframework.modules.home.activity; | |||
import androidx.appcompat.app.AppCompatActivity; | |||
import androidx.viewpager.widget.ViewPager; | |||
import android.os.Bundle; | |||
import android.util.Log; | |||
import android.view.KeyEvent; | |||
import android.view.MenuItem; | |||
import android.view.View; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.business.ConfigData; | |||
import com.bonait.bnframework.common.base.BaseActivity; | |||
import com.bonait.bnframework.common.constant.ConfigName; | |||
import com.bonait.bnframework.common.constant.MessageName; | |||
import com.bonait.bnframework.common.helper.I.IThread; | |||
import com.bonait.bnframework.common.helper.I.MyClickListener; | |||
import com.bonait.bnframework.common.helper.MessageLog; | |||
import com.bonait.bnframework.common.helper.ThreadManager; | |||
import com.bonait.bnframework.common.message.MessageLooper; | |||
import com.bonait.bnframework.common.message.MessageManager; | |||
import com.bonait.bnframework.common.modbus.ModbusTcpServer; | |||
import com.bonait.bnframework.common.utils.NetworkUtils; | |||
import com.bonait.bnframework.common.utils.ToastUtils; | |||
import com.bonait.bnframework.common.view.BottomNavigationBar; | |||
import com.bonait.bnframework.manager.ActivityLifecycleManager; | |||
import com.bonait.bnframework.modules.home.adapter.FragmentAdapter; | |||
import com.bonait.bnframework.modules.home.fragment.Home1Fragment; | |||
import com.bonait.bnframework.modules.home.fragment.Home2Fragment; | |||
import com.bonait.bnframework.modules.home.fragment.Home4Fragment; | |||
import com.bonait.bnframework.modules.home.fragment.HomeFragmentPR; | |||
import com.bonait.bnframework.modules.home.fragment.HomeFragmentSBKZ; | |||
import com.bonait.bnframework.modules.mine.fragment.MyFragment; | |||
import com.google.android.material.bottomnavigation.BottomNavigationView; | |||
import com.lzy.okgo.OkGo; | |||
import com.qmuiteam.qmui.widget.QMUIViewPager; | |||
import butterknife.BindView; | |||
import butterknife.ButterKnife; | |||
public class BottomNavigationNewActivity extends BaseActivity { | |||
//region 绑定 | |||
@BindView(R.id.navigation) | |||
BottomNavigationBar bottomNavigationView; | |||
@BindView(R.id.viewpager) | |||
QMUIViewPager viewPager; | |||
//endregion | |||
@Override | |||
protected void onCreate(Bundle savedInstanceState) { | |||
super.onCreate(savedInstanceState); | |||
setContentView(R.layout.activity_bottom_navigation_new); | |||
ButterKnife.bind(this); | |||
initFragment(); | |||
viewPager.addOnPageChangeListener(pageChangeListener); | |||
// 设置viewPager缓存多少个fragment | |||
viewPager.setOffscreenPageLimit(3); | |||
bottomNavigationView.mListener=new MyClickListener() { | |||
@Override | |||
public void clickListener(View v, Object data) { | |||
int index= (int)data; | |||
viewPager.setCurrentItem(index); | |||
} | |||
@Override | |||
public void clickListenerNew(View v, int k, Object data) { | |||
} | |||
}; | |||
viewPager.setCurrentItem(1); | |||
Init(); | |||
} | |||
@Override | |||
protected void onDestroy() { | |||
ConfigData.getInstance().ColsePLC(); | |||
super.onDestroy(); | |||
} | |||
/** | |||
* viewPager里添加fragment | |||
*/ | |||
private void initFragment() { | |||
FragmentAdapter fragmentAdapter = new FragmentAdapter(getSupportFragmentManager()); | |||
fragmentAdapter.addFragment(new HomeFragmentPR()); | |||
fragmentAdapter.addFragment(new Home4Fragment()); | |||
fragmentAdapter.addFragment(new HomeFragmentSBKZ()); | |||
viewPager.setAdapter(fragmentAdapter); | |||
MessageManager.getInstance().registerMessageReceiver(this, MessageName.SelectZY, new MessageLooper.OnMessageListener() { | |||
@Override | |||
public void onMessage(Object msg) { | |||
if (msg != null) { | |||
int index=(int)msg; | |||
viewPager.setCurrentItem(index); | |||
} | |||
} | |||
}); | |||
} | |||
/** | |||
* 配置ViewPager监听器,手指滑动监听 | |||
*/ | |||
private ViewPager.OnPageChangeListener pageChangeListener = new ViewPager.OnPageChangeListener() { | |||
@Override | |||
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { | |||
} | |||
@Override | |||
public void onPageSelected(int position) { | |||
bottomNavigationView.SelectIndexTab(position); | |||
} | |||
@Override | |||
public void onPageScrollStateChanged(int state) { | |||
} | |||
}; | |||
@Override | |||
protected boolean canDragBack() { | |||
return viewPager.getCurrentItem() == 0; | |||
} | |||
private long exitTime = 0; | |||
/** | |||
* 重写返回键,实现双击退出程序效果 | |||
*/ | |||
@Override | |||
public boolean onKeyDown(int keyCode, KeyEvent event) { | |||
if (keyCode == KeyEvent.KEYCODE_BACK) { | |||
if (System.currentTimeMillis() - exitTime > 2000) { | |||
ToastUtils.normal("再按一次退出程序"); | |||
exitTime = System.currentTimeMillis(); | |||
} else { | |||
OkGo.getInstance().cancelAll(); | |||
overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out); | |||
ActivityLifecycleManager.get().appExit(); | |||
} | |||
return true; | |||
} | |||
return super.onKeyDown(keyCode, event); | |||
} | |||
/** | |||
* 初始化 | |||
*/ | |||
public void Init() | |||
{ | |||
//1.同步时间 | |||
NetworkUtils.SynchronizationTime(); | |||
//主持 | |||
ConfigData.getInstance().GetOrganize(this); | |||
//判断连接环境 | |||
ConfigData.getInstance().ToggleEnvironment(); | |||
//2.初始化PLC | |||
ReconnectModbus(); | |||
//初始化阿里云连接 | |||
//AliyunIOTManager.getInstance().OpenDev(this); | |||
} | |||
/** | |||
* 重新连接plc | |||
*/ | |||
public void ReconnectModbus() | |||
{ | |||
try { | |||
ThreadManager.Get().StartLong("PLC断线重连线程", true, new IThread() { | |||
@Override | |||
public void Run() throws InterruptedException { | |||
try { | |||
if(ConfigName.getInstance().PlcIsConnect) | |||
{ | |||
//ping 不通 | |||
boolean status = ModbusTcpServer.ping2(ConfigName.getInstance().Address,1,1); | |||
if(!status) //ping 不通 连接 | |||
{ | |||
MessageLog.ShowInfo("PLC状态断开,尝试连接..."); | |||
ConfigName.getInstance().PlcIsConnect=false; | |||
} | |||
}else | |||
{ | |||
boolean status = ModbusTcpServer.ping2(ConfigName.getInstance().Address,1,1); | |||
if(status) | |||
{ | |||
MessageLog.ShowInfo("设备 " + ConfigName.getInstance().Address + " PLC通讯正常,准备连接!"); | |||
ModbusTcpServer.ConnectPLC(); | |||
}else | |||
{ | |||
MessageLog.ShowInfo("PLC状态断开,尝试连接..."); | |||
ConfigName.getInstance().PlcIsConnect=false; | |||
} | |||
} | |||
Thread.sleep(10000); | |||
} catch (Exception e) { | |||
Log.i("PLC", "PLC重连接失败!"+e.getMessage()); | |||
} | |||
} | |||
@Override | |||
public void RunComplete() throws InterruptedException { | |||
} | |||
}); | |||
}catch (Exception e) { | |||
MessageLog.ShowInfo("重新连接Modbus异常," +e.getMessage()); | |||
} | |||
} | |||
} |
@@ -0,0 +1,240 @@ | |||
package com.bonait.bnframework.modules.home.adapter; | |||
import android.app.Activity; | |||
import android.content.Context; | |||
import android.content.ContextWrapper; | |||
import android.view.LayoutInflater; | |||
import android.view.View; | |||
import android.view.ViewGroup; | |||
import android.widget.ImageView; | |||
import android.widget.TextView; | |||
import androidx.annotation.NonNull; | |||
import androidx.recyclerview.widget.RecyclerView; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.business.ConfigData; | |||
import com.bonait.bnframework.common.constant.ConfigName; | |||
import com.bonait.bnframework.common.constant.MessageName; | |||
import com.bonait.bnframework.common.db.QueryDB; | |||
import com.bonait.bnframework.common.helper.I.MyClickListener; | |||
import com.bonait.bnframework.common.image.MyBitmapUtils; | |||
import com.bonait.bnframework.common.message.MessageManager; | |||
import com.bonait.bnframework.common.utils.AlertDialogUtils; | |||
import com.bonait.bnframework.common.utils.ToastUtils; | |||
import com.bonait.bnframework.modules.home.fragment.mode.SectionItem; | |||
import com.qmuiteam.qmui.widget.dialog.QMUIDialog; | |||
import com.qmuiteam.qmui.widget.dialog.QMUIDialogAction; | |||
import java.math.BigDecimal; | |||
import java.text.DecimalFormat; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
public class good_adapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { | |||
//图标 | |||
private MyBitmapUtils myBitmapUtils = new MyBitmapUtils(); | |||
private final LayoutInflater mLayoutInflater; | |||
private Context context; | |||
ArrayList<SectionItem> liaos = new ArrayList<>(); | |||
/** | |||
* 点击事件 | |||
*/ | |||
public MyClickListener mListener = null; | |||
public good_adapter(Context context, ArrayList<SectionItem> data, MyClickListener _mListener) { | |||
this.context = context; | |||
mLayoutInflater = LayoutInflater.from(context); | |||
liaos = data; | |||
mListener = _mListener; | |||
} | |||
@NonNull | |||
@Override | |||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { | |||
View inflate = mLayoutInflater.inflate(R.layout.good_show, parent, false); | |||
return new MyLCViewHolder1(inflate); | |||
} | |||
@Override | |||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { | |||
try { | |||
if (holder instanceof MyLCViewHolder1) { | |||
MyLCViewHolder1 myViewHolder = (MyLCViewHolder1) holder; | |||
SectionItem mode = (SectionItem) liaos.get(position); | |||
String name = mode.getTag(); | |||
myViewHolder.IsSC = mode.getIsSC(); | |||
String id = mode.getAccount(); | |||
String url = mode.getAddress(); | |||
boolean isCloud = mode.getIsCloud();//是否云端商品 | |||
if (isCloud) { | |||
myViewHolder.Sc_text.setText("下载"); | |||
myViewHolder.delete_text.setVisibility(View.GONE); | |||
myViewHolder.sc_image.setVisibility(View.GONE); | |||
if (mode.getIsdownload()) { | |||
myViewHolder.Sc_text.setVisibility(View.GONE); | |||
} | |||
} else { | |||
myViewHolder.Sc_text.setText("上传"); | |||
if (ConfigName.getInstance().user.userID.equals("研发用户")) { | |||
myViewHolder.sc_image.setVisibility(View.VISIBLE); | |||
myViewHolder.delete_text.setVisibility(View.VISIBLE); | |||
myViewHolder.Sc_text.setVisibility(View.VISIBLE); | |||
}else | |||
{ | |||
myViewHolder.delete_text.setVisibility(View.GONE); | |||
myViewHolder.Sc_text.setVisibility(View.GONE); | |||
} | |||
} | |||
myViewHolder.tvTag.setText(name); | |||
myViewHolder.tvNote.setText("时间:" + mode.getNote() + "秒"); | |||
//设置图片 | |||
if (!url.equals("未知")) { | |||
myBitmapUtils.disPlay(myViewHolder.ImageUrl, url); | |||
} | |||
//上传按钮点击 | |||
myViewHolder.Sc_text.setOnClickListener(new View.OnClickListener() { | |||
@Override | |||
public void onClick(View view) { | |||
if (isCloud) { | |||
ConfigData.getInstance().GetGoodProcess(holder.itemView.getContext(), id, true); | |||
} else { | |||
ConfigData.getInstance().UploadGoods(holder.itemView.getContext(), id); | |||
} | |||
} | |||
}); | |||
//删除按钮点击 | |||
myViewHolder.delete_text.setOnClickListener(new View.OnClickListener() { | |||
@Override | |||
public void onClick(View view) { | |||
//按钮点击 | |||
String title = "删除菜品操作提示!"; | |||
String message = "请问客官确定要删除[" + name + "]菜品吗?"; | |||
AlertDialogUtils.showDialog(holder.itemView.getContext(), title, message, new QMUIDialogAction.ActionListener() { | |||
@Override | |||
public void onClick(QMUIDialog dialog, int index) { | |||
if (mListener != null) { | |||
mListener.clickListenerNew(view, 1, mode); | |||
} | |||
dialog.dismiss(); | |||
} | |||
}); | |||
} | |||
}); | |||
SetImage(myViewHolder.sc_image, myViewHolder.IsSC); | |||
//收藏按钮点击 | |||
myViewHolder.sc_image.setOnClickListener(new View.OnClickListener() { | |||
@Override | |||
public void onClick(View view) { | |||
myViewHolder.IsSC = mode.getIsSC(); | |||
//按钮点击 | |||
String title = "收藏菜品操作提示!"; | |||
String message = "请问客官确定要[" + (myViewHolder.IsSC ? "取消收藏" : "收藏") + "]菜品吗?"; | |||
AlertDialogUtils.showDialog(holder.itemView.getContext(), title, message, new QMUIDialogAction.ActionListener() { | |||
@Override | |||
public void onClick(QMUIDialog dialog, int index) { | |||
myViewHolder.IsSC = !myViewHolder.IsSC; | |||
mode.SetIsSC(myViewHolder.IsSC); | |||
SetImage(myViewHolder.sc_image, myViewHolder.IsSC); | |||
notifyDataSetChanged(); | |||
SectionItem item = mode; | |||
QueryDB.UpdateGoodsSC(item.getAccount(), item.getIsSC() ? 1 : 0); | |||
mListener.clickListenerNew(view, 2, mode); | |||
dialog.dismiss(); | |||
} | |||
}); | |||
} | |||
}); | |||
//点击查看当前商品信息 | |||
myViewHolder.ImageUrl.setOnClickListener(new View.OnClickListener() { | |||
@Override | |||
public void onClick(View view) { | |||
if (isCloud) { | |||
ToastUtils.warning("请先下载该商品!"); | |||
} else { | |||
mListener.clickListenerNew(view, 3, mode); | |||
} | |||
} | |||
}); | |||
} | |||
} catch (Exception e) { | |||
e.printStackTrace(); | |||
} | |||
} | |||
public void SetImage(ImageView image, boolean isxz) { | |||
if (isxz) { | |||
image.setImageResource(R.mipmap.sc3); | |||
} else { | |||
image.setImageResource(R.mipmap.wsc3); | |||
} | |||
} | |||
private Activity findActivity(@NonNull Context context) { | |||
if (context instanceof Activity) { | |||
return (Activity) context; | |||
} else if (context instanceof ContextWrapper) { | |||
return findActivity(((ContextWrapper) context).getBaseContext()); | |||
} else { | |||
return null; | |||
} | |||
} | |||
/** | |||
* 刷新 | |||
* | |||
* @param | |||
*/ | |||
public void refresh() { | |||
Activity activity = findActivity(context); | |||
if (activity != null) { | |||
activity.runOnUiThread(new Runnable() { | |||
@Override | |||
public void run() { | |||
try { | |||
notifyDataSetChanged(); | |||
} catch (Exception e) { | |||
} | |||
} | |||
}); | |||
} | |||
} | |||
@Override | |||
public int getItemCount() { | |||
return liaos.size(); | |||
} | |||
public static class MyLCViewHolder1 extends RecyclerView.ViewHolder { | |||
private TextView tvTag, tvNote, tvAccount, Sc_text, delete_text; | |||
private ImageView ImageUrl;//图片 | |||
private ImageView sc_image;//是否收藏 | |||
public boolean IsSC = false; | |||
public MyLCViewHolder1(View view) { | |||
super(view); | |||
tvTag = view.findViewById(R.id.Tag_text); | |||
tvNote = view.findViewById(R.id.Note_text); | |||
Sc_text = view.findViewById(R.id.Sc_text); | |||
delete_text = view.findViewById(R.id.delete_text); | |||
sc_image = view.findViewById(R.id.sc_image);//收藏 | |||
ImageUrl = view.findViewById(R.id.ImageUrl);//图片 | |||
} | |||
} | |||
} | |||
@@ -7,6 +7,7 @@ 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; | |||
@@ -47,6 +48,7 @@ public class Home2Fragment extends BaseFragment { | |||
@BindView(R.id.topbar) | |||
QMUITopBar mTopBar; | |||
private Context context; | |||
public Home2Fragment() { | |||
} | |||
@@ -70,11 +72,11 @@ public class Home2Fragment extends BaseFragment { | |||
mCollapsingTopBarLayout.setTitle("功能菜单"); | |||
} | |||
@OnClick({R.id.kshr,R.id.diy,R.id.cp,R.id.wh,R.id.sz}) | |||
@OnClick({R.id.kshr, R.id.diy, R.id.cp, R.id.wh, R.id.sz}) | |||
public void onViewClicked(View view) { | |||
switch (view.getId()) { | |||
case R.id.kshr://开始制作商品 | |||
MessageManager.getInstance().sendMessage(MessageName.SelectZY,"Open"); | |||
MessageManager.getInstance().sendMessage(MessageName.SelectZY, 1); | |||
break; | |||
case R.id.diy://diy模式 | |||
skipToActivity(DiyActivity.class); | |||
@@ -111,11 +113,11 @@ public class Home2Fragment extends BaseFragment { | |||
* 当在activity设置viewPager + BottomNavigation + fragment时, | |||
* 为防止viewPager左滑动切换界面,与fragment左滑返回上一界面冲突引起闪退问题, | |||
* 必须加上此方法,禁止fragment左滑返回上一界面。 | |||
* | |||
* <p> | |||
* 切记!切记!切记!否则会闪退! | |||
* | |||
* <p> | |||
* 当在fragment设置viewPager + BottomNavigation + fragment时,则不会出现这个问题。 | |||
* */ | |||
*/ | |||
@Override | |||
protected boolean canDragBack() { | |||
return false; | |||
@@ -0,0 +1,130 @@ | |||
package com.bonait.bnframework.modules.home.fragment; | |||
import androidx.annotation.NonNull; | |||
import androidx.annotation.Nullable; | |||
import androidx.appcompat.app.AppCompatActivity; | |||
import androidx.core.content.ContextCompat; | |||
import android.content.Context; | |||
import android.content.Intent; | |||
import android.os.Bundle; | |||
import android.view.LayoutInflater; | |||
import android.view.View; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.business.ExecuteTheRecipe; | |||
import com.bonait.bnframework.common.base.BaseFragment; | |||
import com.bonait.bnframework.common.constant.MessageName; | |||
import com.bonait.bnframework.common.message.MessageManager; | |||
import com.bonait.bnframework.common.utils.AlertDialogUtils; | |||
import com.bonait.bnframework.common.utils.ToastUtils; | |||
import com.bonait.bnframework.manager.ActivityLifecycleManager; | |||
import com.bonait.bnframework.modules.home.fragment.from.CpxzActivity; | |||
import com.bonait.bnframework.modules.home.fragment.mode.MyStatus; | |||
import com.bonait.bnframework.modules.welcome.activity.LoginActivity; | |||
import com.orhanobut.logger.Logger; | |||
import com.qmuiteam.qmui.widget.QMUITopBarLayout; | |||
import com.qmuiteam.qmui.widget.dialog.QMUIDialog; | |||
import com.qmuiteam.qmui.widget.dialog.QMUIDialogAction; | |||
import butterknife.BindView; | |||
import butterknife.ButterKnife; | |||
import butterknife.OnClick; | |||
public class Home4Fragment extends BaseFragment { | |||
private Context context; | |||
@Override | |||
protected View onCreateView() { | |||
View root = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_home4, null); | |||
ButterKnife.bind(this, root); | |||
return root; | |||
} | |||
@Override | |||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { | |||
super.onViewCreated(view, savedInstanceState); | |||
context = getContext(); | |||
initTopBar(); | |||
initData(); | |||
} | |||
/** | |||
* 初始化TopBar | |||
*/ | |||
private void initTopBar() { | |||
} | |||
/** | |||
* 点击事件 | |||
* | |||
* @param view | |||
*/ | |||
@OnClick({R.id.kaishipengren, R.id.shebeikongzhi, R.id.zhuxiaodenglu | |||
}) | |||
public void onViewClicked(View view) { | |||
switch (view.getId()) { | |||
case R.id.kaishipengren: | |||
MessageManager.getInstance().sendMessage(MessageName.SelectZY, 0); | |||
break; | |||
case R.id.shebeikongzhi: | |||
MessageManager.getInstance().sendMessage(MessageName.SelectZY, 2); | |||
break; | |||
case R.id.zhuxiaodenglu: | |||
String title = "温馨提示!"; | |||
String message = "客官确定要退出程序吗,小菠萝会想你的哦?"; | |||
AlertDialogUtils.showDialog(context, title, message, new QMUIDialogAction.ActionListener() { | |||
@Override | |||
public void onClick(QMUIDialog dialog, int index) { | |||
skipToLoginActivity(); | |||
dialog.dismiss(); | |||
} | |||
}); | |||
break; | |||
} | |||
} | |||
/** | |||
* 跳转登录界面 | |||
*/ | |||
private void skipToLoginActivity() { | |||
// 跳转到登录页面 | |||
Intent intent = new Intent(context, LoginActivity.class); | |||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); | |||
startActivity(intent); | |||
//overridePend1ingTransition(android.R.anim.fade_in, android.R.anim.fade_out); | |||
// 结束所有Activity | |||
ActivityLifecycleManager.get().finishAllActivity(); | |||
} | |||
/** | |||
* 初始化显示数据 | |||
*/ | |||
private void initData() { | |||
} | |||
@Override | |||
public void onDestroy() { | |||
super.onDestroy(); | |||
Logger.d("第一页销毁"); | |||
} | |||
/** | |||
* 当在activity设置viewPager + BottomNavigation + fragment时, | |||
* 为防止viewPager左滑动切换界面,与fragment左滑返回上一界面冲突引起闪退问题, | |||
* 必须加上此方法,禁止fragment左滑返回上一界面。 | |||
* <p> | |||
* 切记!切记!切记!否则会闪退! | |||
* <p> | |||
* 当在fragment设置viewPager + BottomNavigation + fragment时,则不会出现这个问题。 | |||
*/ | |||
@Override | |||
protected boolean canDragBack() { | |||
return false; | |||
} | |||
} |
@@ -0,0 +1,273 @@ | |||
package com.bonait.bnframework.modules.home.fragment; | |||
import static com.bonait.bnframework.MainApplication.getContext; | |||
import androidx.annotation.NonNull; | |||
import androidx.annotation.Nullable; | |||
import androidx.appcompat.app.AppCompatActivity; | |||
import androidx.appcompat.widget.SearchView; | |||
import androidx.core.content.ContextCompat; | |||
import androidx.recyclerview.widget.RecyclerView; | |||
import androidx.recyclerview.widget.StaggeredGridLayoutManager; | |||
import android.annotation.SuppressLint; | |||
import android.app.Activity; | |||
import android.content.Context; | |||
import android.content.Intent; | |||
import android.graphics.Color; | |||
import android.os.Bundle; | |||
import android.os.Handler; | |||
import android.os.Message; | |||
import android.view.LayoutInflater; | |||
import android.view.View; | |||
import android.widget.RelativeLayout; | |||
import android.widget.TextView; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.business.ConfigData; | |||
import com.bonait.bnframework.common.base.BaseFragment; | |||
import com.bonait.bnframework.common.constant.ConfigName; | |||
import com.bonait.bnframework.common.constant.DataBus; | |||
import com.bonait.bnframework.common.constant.MessageName; | |||
import com.bonait.bnframework.common.db.QueryDB; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS; | |||
import com.bonait.bnframework.common.helper.I.MyClickListener; | |||
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.AlertDialogUtils; | |||
import com.bonait.bnframework.common.utils.ToastUtils; | |||
import com.bonait.bnframework.modules.home.adapter.good_adapter; | |||
import com.bonait.bnframework.modules.home.fragment.from.DiyUpdateActivity; | |||
import com.bonait.bnframework.modules.home.fragment.mode.SectionHeader; | |||
import com.bonait.bnframework.modules.home.fragment.mode.SectionItem; | |||
import com.litao.slider.NiftySlider; | |||
import com.orhanobut.logger.Logger; | |||
import com.qmuiteam.qmui.widget.QMUITopBarLayout; | |||
import com.qmuiteam.qmui.widget.dialog.QMUIDialog; | |||
import com.qmuiteam.qmui.widget.dialog.QMUIDialogAction; | |||
import com.qmuiteam.qmui.widget.section.QMUISection; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
import butterknife.BindView; | |||
import butterknife.ButterKnife; | |||
import butterknife.OnClick; | |||
public class HomeFragmentPR extends BaseFragment { | |||
@BindView(R.id.topbar) | |||
QMUITopBarLayout mTopBar;//顶部标题 | |||
@BindView(R.id.recycler_view) | |||
RecyclerView recycler_view;//商品 | |||
@BindView(R.id.quanbucaipu) | |||
TextView quanbucaipu;//全部菜谱 | |||
@BindView(R.id.yunduancaipu) | |||
TextView yunduancaipu;//云端菜谱 | |||
@BindView(R.id.search_view) | |||
SearchView search_view;//查询框 | |||
/** | |||
* 选中行 | |||
*/ | |||
public int SelectIndex = 1; | |||
private Context context; | |||
public Activity activity = null; | |||
@Override | |||
protected View onCreateView() { | |||
View root = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_home_pr, null); | |||
ButterKnife.bind(this, root); | |||
return root; | |||
} | |||
@Override | |||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { | |||
super.onViewCreated(view, savedInstanceState); | |||
context = getContext(); | |||
activity = getActivity(); | |||
initTopBar(); | |||
SelectTab(1); | |||
ConfigData.getInstance().GetGevGood(context, mHandler); | |||
} | |||
@SuppressLint("HandlerLeak") | |||
private Handler mHandler = new Handler() { | |||
@Override | |||
public void handleMessage(Message msg) { | |||
if (msg.obj.toString() == "MSG_REFRESH") { | |||
initData(); | |||
} | |||
} | |||
}; | |||
/** | |||
* 初始化TopBar | |||
*/ | |||
private void initTopBar() { | |||
mTopBar.setBackgroundColor(ContextCompat.getColor(requireContext(), R.color.topbj1)); | |||
mTopBar.setTitle("菜谱"); | |||
/** | |||
* 刷新菜品 | |||
*/ | |||
MessageManager.getInstance().registerMessageReceiver(activity, MessageName.ScGood, new MessageLooper.OnMessageListener() { | |||
@Override | |||
public void onMessage(Object msg) { | |||
if (msg != null) { | |||
initData(); | |||
} | |||
} | |||
}); | |||
search_view.setOnQueryTextListener(new SearchView.OnQueryTextListener() { | |||
@Override | |||
public boolean onQueryTextSubmit(String s) { | |||
return false; | |||
} | |||
@Override | |||
public boolean onQueryTextChange(String s) { | |||
initData(); | |||
return false; | |||
} | |||
}); | |||
} | |||
/** | |||
* 初始化显示数据 | |||
*/ | |||
private void initData() { | |||
StaggeredGridLayoutManager layout = new StaggeredGridLayoutManager | |||
(3, StaggeredGridLayoutManager.VERTICAL); | |||
recycler_view.setLayoutManager(layout); | |||
ArrayList<BPA_GOODS> good =new ArrayList<>(); | |||
String name=search_view.getQuery().toString(); | |||
if (name.isEmpty()) | |||
{ | |||
good=QueryDB.GetGoodsALL(); | |||
}else | |||
{ | |||
good= QueryDB.GetGoodsLike(name); | |||
} | |||
List<String> Bendi_id = new ArrayList<>(); | |||
ArrayList<SectionItem> contents_bdcp = new ArrayList<>(); | |||
ArrayList<SectionItem> contents_ydcp = new ArrayList<>(); | |||
for (BPA_GOODS item : good) { | |||
if (item.url == null) { | |||
item.url = "未知"; | |||
} | |||
contents_bdcp.add(new SectionItem(item.name, String.valueOf(item.maketime), item.id, item.url, item.issc == 1, false, true)); | |||
Bendi_id.add(item.id); | |||
} | |||
for (CloudGood item : ConfigName.getInstance().cloudGoods) { | |||
contents_ydcp.add(new SectionItem(item.goods_Name, "180", item.id, item.goods_ImgUrl, false, true, Bendi_id.contains(item.id) ? true : false)); | |||
} | |||
if (SelectIndex == 1) { | |||
good_adapter adapter = new good_adapter(context, contents_bdcp, myClickListener); | |||
recycler_view.setAdapter(adapter); | |||
} else { | |||
good_adapter adapter = new good_adapter(context, contents_ydcp, myClickListener); | |||
recycler_view.setAdapter(adapter); | |||
} | |||
} | |||
public MyClickListener myClickListener = new MyClickListener() { | |||
@Override | |||
public void clickListener(View v, Object data) { | |||
} | |||
@Override | |||
public void clickListenerNew(View v, int k, Object data) { | |||
SectionItem item = (SectionItem) data; | |||
String goodid = item.getAccount();//商品id | |||
switch (k) { | |||
case 1: | |||
QueryDB.DeleteGoodsid(goodid); | |||
QueryDB.DeleteGoodsSrecipeList(goodid); | |||
initData(); | |||
break; | |||
case 2: | |||
initData(); | |||
break; | |||
case 3: | |||
Intent intent = new Intent(getContext(), DiyUpdateActivity.class); | |||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); | |||
intent.putExtra("id", goodid); | |||
startActivity(intent); | |||
break; | |||
} | |||
} | |||
}; | |||
/** | |||
* 点击事件 | |||
* | |||
* @param view | |||
*/ | |||
@OnClick({R.id.quanbucaipu, R.id.yunduancaipu | |||
}) | |||
public void onViewClicked(View view) { | |||
switch (view.getId()) { | |||
case R.id.quanbucaipu: | |||
SelectTab(1); | |||
break; | |||
case R.id.yunduancaipu: | |||
SelectTab(2); | |||
break; | |||
} | |||
} | |||
/** | |||
* 选中tab行 | |||
* | |||
* @param index | |||
*/ | |||
public void SelectTab(int index) { | |||
SelectIndex = index; | |||
switch (index) { | |||
case 1: | |||
quanbucaipu.setTextColor(Color.parseColor("#BEAA6A")); | |||
yunduancaipu.setTextColor(Color.parseColor("#797373")); | |||
initData(); | |||
break; | |||
case 2: | |||
quanbucaipu.setTextColor(Color.parseColor("#797373")); | |||
yunduancaipu.setTextColor(Color.parseColor("#BEAA6A")); | |||
initData(); | |||
break; | |||
} | |||
} | |||
@Override | |||
public void onDestroy() { | |||
super.onDestroy(); | |||
Logger.d("第一页销毁"); | |||
} | |||
/** | |||
* 当在activity设置viewPager + BottomNavigation + fragment时, | |||
* 为防止viewPager左滑动切换界面,与fragment左滑返回上一界面冲突引起闪退问题, | |||
* 必须加上此方法,禁止fragment左滑返回上一界面。 | |||
* <p> | |||
* 切记!切记!切记!否则会闪退! | |||
* <p> | |||
* 当在fragment设置viewPager + BottomNavigation + fragment时,则不会出现这个问题。 | |||
*/ | |||
@Override | |||
protected boolean canDragBack() { | |||
return false; | |||
} | |||
} |
@@ -0,0 +1,71 @@ | |||
package com.bonait.bnframework.modules.home.fragment; | |||
import androidx.annotation.NonNull; | |||
import androidx.annotation.Nullable; | |||
import androidx.appcompat.app.AppCompatActivity; | |||
import android.content.Context; | |||
import android.os.Bundle; | |||
import android.view.LayoutInflater; | |||
import android.view.View; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.common.base.BaseFragment; | |||
import com.orhanobut.logger.Logger; | |||
import butterknife.ButterKnife; | |||
public class HomeFragmentSBKZ extends BaseFragment { | |||
private Context context; | |||
@Override | |||
protected View onCreateView() { | |||
View root = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_home_sbkz, null); | |||
ButterKnife.bind(this, root); | |||
return root; | |||
} | |||
@Override | |||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { | |||
super.onViewCreated(view, savedInstanceState); | |||
context = getContext(); | |||
initTopBar(); | |||
initData(); | |||
} | |||
/** | |||
* 初始化TopBar | |||
*/ | |||
private void initTopBar() { | |||
} | |||
/** | |||
* 初始化显示数据 | |||
*/ | |||
private void initData() { | |||
} | |||
@Override | |||
public void onDestroy() { | |||
super.onDestroy(); | |||
Logger.d("第一页销毁"); | |||
} | |||
/** | |||
* 当在activity设置viewPager + BottomNavigation + fragment时, | |||
* 为防止viewPager左滑动切换界面,与fragment左滑返回上一界面冲突引起闪退问题, | |||
* 必须加上此方法,禁止fragment左滑返回上一界面。 | |||
* <p> | |||
* 切记!切记!切记!否则会闪退! | |||
* <p> | |||
* 当在fragment设置viewPager + BottomNavigation + fragment时,则不会出现这个问题。 | |||
*/ | |||
@Override | |||
protected boolean canDragBack() { | |||
return false; | |||
} | |||
} |
@@ -41,6 +41,7 @@ import com.bonait.bnframework.common.utils.PreferenceUtils; | |||
import com.bonait.bnframework.common.utils.ToastUtils; | |||
import com.bonait.bnframework.manager.ActivityLifecycleManager; | |||
import com.bonait.bnframework.modules.home.activity.BottomNavigation2Activity; | |||
import com.bonait.bnframework.modules.home.activity.BottomNavigationNewActivity; | |||
import com.bonait.bnframework.modules.welcome.model.AppLoginPo; | |||
import com.bonait.bnframework.test.TestActivity; | |||
import com.lzy.okgo.OkGo; | |||
@@ -345,9 +346,20 @@ public class LoginActivity extends BaseActivity implements Validator.ValidationL | |||
KeyboardToolUtils.hideSoftInput(LoginActivity.this); | |||
// 退出界面之前把状态栏还原为白色字体与图标 | |||
QMUIStatusBarHelper.setStatusBarDarkMode(LoginActivity.this); | |||
Intent intent = new Intent(LoginActivity.this, BottomNavigation2Activity.class); | |||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); | |||
startActivity(intent); | |||
if(ConfigName.getInstance().user.name.equals("admin") || ConfigName.getInstance().user.account.equals("admin") || ConfigName.getInstance().user.userID.equals("超级管理员")) | |||
{ | |||
Intent intent = new Intent(LoginActivity.this, BottomNavigation2Activity.class); | |||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); | |||
startActivity(intent); | |||
}else | |||
{ | |||
Intent intent = new Intent(LoginActivity.this, BottomNavigationNewActivity.class); | |||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); | |||
startActivity(intent); | |||
} | |||
// 结束所有Activity | |||
ActivityLifecycleManager.get().finishAllActivity(); | |||
} | |||
@@ -0,0 +1,47 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" > | |||
<!-- 阴影部分 --> | |||
<!-- 个人觉得更形象的表达:top代表下边的阴影高度,left代表右边的阴影宽度。其实也就是相对应的offset,solid中的颜色是阴影的颜色,也可以设置角度等等 --> | |||
<item | |||
android:left="2dp" | |||
android:top="2dp" | |||
android:right="2dp" | |||
android:bottom="2dp"> | |||
<shape android:shape="rectangle" > | |||
<gradient | |||
android:angle="270" | |||
android:endColor="#0F000000" | |||
android:startColor="#0F000000" /> | |||
<corners | |||
android:bottomLeftRadius="6dip" | |||
android:bottomRightRadius="6dip" | |||
android:topLeftRadius="6dip" | |||
android:topRightRadius="6dip" /> | |||
</shape> | |||
</item> | |||
<!-- 背景部分 --> | |||
<!-- 形象的表达:bottom代表背景部分在上边缘超出阴影的高度,right代表背景部分在左边超出阴影的宽度(相对应的offset) --> | |||
<!-- <item--> | |||
<!-- android:left="3dp"--> | |||
<!-- android:top="3dp"--> | |||
<!-- android:right="3dp"--> | |||
<!-- android:bottom="5dp">--> | |||
<!-- <shape android:shape="rectangle" >--> | |||
<!-- <gradient--> | |||
<!-- android:angle="270"--> | |||
<!-- android:endColor="#FFFFFF"--> | |||
<!-- android:startColor="#FFFFFF" />--> | |||
<!-- <corners--> | |||
<!-- android:bottomLeftRadius="6dip"--> | |||
<!-- android:bottomRightRadius="6dip"--> | |||
<!-- android:topLeftRadius="6dip"--> | |||
<!-- android:topRightRadius="6dip" />--> | |||
<!-- </shape>--> | |||
<!-- </item>--> | |||
</layer-list> |
@@ -0,0 +1,15 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<ripple xmlns:android="http://schemas.android.com/apk/res/android" | |||
android:color="@color/black" | |||
android:radius="-1dp"> | |||
<item> | |||
<shape> | |||
<!-- <solid android:color="@color/white" />--> | |||
<corners android:radius="20dp" /> | |||
<stroke | |||
android:width="1dp" | |||
android:color="@color/black" /> | |||
</shape> | |||
</item> | |||
</ripple> |
@@ -0,0 +1,57 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<ripple xmlns:android="http://schemas.android.com/apk/res/android" | |||
android:color="#7FEF5362" | |||
android:radius="-1dp"> | |||
<item android:left="5dp" | |||
android:top="5dp"> | |||
<shape android:shape="rectangle"> | |||
<gradient | |||
android:angle="0" | |||
android:endColor="#7E574F34" | |||
android:startColor="#7E574F34" /> | |||
<corners android:radius="20dp" /> | |||
</shape> | |||
</item> | |||
<item | |||
android:bottom="5dp" | |||
android:right="5dp"> | |||
<shape android:shape="rectangle" > | |||
<gradient | |||
android:angle="270" | |||
android:endColor="#BEAA6A" | |||
android:startColor="#BEAA6A" /> | |||
<corners android:radius="15dp" /> | |||
</shape> | |||
</item> | |||
<!-- <item android:state_pressed="true">--> | |||
<!-- <shape>--> | |||
<!-- <solid android:color="#BEAA6A" />--> | |||
<!-- <corners android:radius="20dp" />--> | |||
<!-- <gradient--> | |||
<!-- android:angle="270"--> | |||
<!-- android:endColor="#D7AB7A"--> | |||
<!-- android:startColor="#D7AB7A" />--> | |||
<!-- </shape>--> | |||
<!-- </item>--> | |||
<!-- <item android:state_enabled="false">--> | |||
<!-- <shape>--> | |||
<!-- <solid android:color="#cccccc" />--> | |||
<!-- <corners android:radius="20dp" />--> | |||
<!-- </shape>--> | |||
<!-- </item>--> | |||
<!-- <item>--> | |||
<!-- <shape>--> | |||
<!-- <solid android:color="#BEAA6A" />--> | |||
<!-- <corners android:radius="20dp" />--> | |||
<!-- </shape>--> | |||
<!-- </item>--> | |||
</ripple> |
@@ -0,0 +1,54 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<ripple xmlns:android="http://schemas.android.com/apk/res/android" | |||
android:color="#7FEF5362" | |||
android:radius="-1dp"> | |||
<!-- <item android:left="5dp"--> | |||
<!-- android:top="5dp">--> | |||
<!-- <shape android:shape="rectangle">--> | |||
<!-- <gradient--> | |||
<!-- android:angle="0"--> | |||
<!-- android:endColor="#574F34"--> | |||
<!-- android:startColor="#574F34" />--> | |||
<!-- <corners android:radius="20dp" />--> | |||
<!-- </shape>--> | |||
<!-- </item>--> | |||
<item> | |||
<shape android:shape="rectangle" > | |||
<gradient | |||
android:endColor="#BEAA6A" | |||
android:startColor="#BEAA6A" /> | |||
<corners android:radius="20dp" /> | |||
</shape> | |||
</item> | |||
<!-- <item android:state_pressed="true">--> | |||
<!-- <shape>--> | |||
<!-- <solid android:color="#BEAA6A" />--> | |||
<!-- <corners android:radius="20dp" />--> | |||
<!-- <gradient--> | |||
<!-- android:angle="270"--> | |||
<!-- android:endColor="#D7AB7A"--> | |||
<!-- android:startColor="#D7AB7A" />--> | |||
<!-- </shape>--> | |||
<!-- </item>--> | |||
<!-- <item android:state_enabled="false">--> | |||
<!-- <shape>--> | |||
<!-- <solid android:color="#cccccc" />--> | |||
<!-- <corners android:radius="20dp" />--> | |||
<!-- </shape>--> | |||
<!-- </item>--> | |||
<!-- <item>--> | |||
<!-- <shape>--> | |||
<!-- <solid android:color="#BEAA6A" />--> | |||
<!-- <corners android:radius="20dp" />--> | |||
<!-- </shape>--> | |||
<!-- </item>--> | |||
</ripple> |
@@ -1,27 +0,0 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<com.qmuiteam.qmui.widget.QMUIWindowInsetLayout 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="match_parent" | |||
android:background="?attr/app_primary_color"> | |||
<com.qmuiteam.qmui.widget.QMUIViewPager | |||
android:id="@+id/main_view_pager" | |||
android:background="?attr/app_content_bg_color" | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
android:layout_marginBottom="@dimen/home_tab_height" | |||
android:fitsSystemWindows="true"/> | |||
<com.qmuiteam.qmui.widget.tab.QMUITabSegment | |||
android:id="@+id/main_tabs" | |||
android:layout_gravity="bottom" | |||
android:background="@color/qmui_config_color_white" | |||
app:qmui_bottomDividerColor="?attr/qmui_skin_support_color_separator" | |||
app:qmui_bottomDividerHeight="1px" | |||
android:textSize="12sp" | |||
app:qmui_tab_icon_position="top" | |||
android:layout_width="match_parent" | |||
android:layout_height="@dimen/home_tab_height"/> | |||
</com.qmuiteam.qmui.widget.QMUIWindowInsetLayout> |
@@ -0,0 +1,41 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<com.qmuiteam.qmui.widget.QMUIWindowInsetLayout 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:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
android:background="@color/white" | |||
tools:context=".modules.home.activity.BottomNavigationNewActivity"> | |||
<com.qmuiteam.qmui.widget.QMUIViewPager | |||
android:id="@+id/viewpager" | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
android:layout_marginBottom="@dimen/home_tab_height" | |||
android:fitsSystemWindows="true"/> | |||
<com.bonait.bnframework.common.view.BottomNavigationBar | |||
android:id="@+id/navigation" | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content" | |||
android:layout_gravity="bottom"> | |||
</com.bonait.bnframework.common.view.BottomNavigationBar> | |||
<com.bonait.bnframework.common.watermark.WaterMarkView | |||
android:singleLine="false" | |||
android:id="@+id/wm" | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
app:water_mark_align="CENTER" | |||
app:water_mark_degree="-30" | |||
app:water_mark_dx="300px" | |||
app:water_mark_dy="340px" | |||
app:water_mark_sync="true" | |||
app:water_mark_text="黑菠萝技术部" | |||
app:water_mark_textColor="@color/watermarkcolor" | |||
app:water_mark_textBold="true" | |||
app:water_mark_textSize="14px" /> | |||
</com.qmuiteam.qmui.widget.QMUIWindowInsetLayout> |
@@ -0,0 +1,95 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<com.qmuiteam.qmui.widget.QMUIWindowInsetLayout 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:layout_width="match_parent" | |||
android:layout_height="match_parent"> | |||
<RelativeLayout | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent"> | |||
<LinearLayout | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
android:orientation="vertical"> | |||
<ImageView | |||
android:layout_width="match_parent" | |||
android:layout_height="0dp" | |||
android:layout_weight="1" | |||
android:adjustViewBounds="true" | |||
android:scaleType="centerCrop" | |||
android:src="@mipmap/rc"></ImageView> | |||
<LinearLayout | |||
android:layout_width="match_parent" | |||
android:layout_height="0dp" | |||
android:layout_weight="2"> | |||
<LinearLayout | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content" | |||
android:layout_marginTop="200dp"> | |||
<LinearLayout | |||
android:id="@+id/kaishipengren" | |||
android:layout_width="0dp" | |||
android:layout_height="wrap_content" | |||
android:layout_weight="1" | |||
android:orientation="vertical"> | |||
<ImageView | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content" | |||
android:src="@mipmap/home_kspr" /> | |||
<ImageView | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content" | |||
android:src="@mipmap/home_kspr1" /> | |||
</LinearLayout> | |||
<LinearLayout | |||
android:id="@+id/shebeikongzhi" | |||
android:layout_width="0dp" | |||
android:layout_height="wrap_content" | |||
android:layout_weight="1" | |||
android:orientation="vertical"> | |||
<ImageView | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content" | |||
android:src="@mipmap/home_sbkz" /> | |||
<ImageView | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content" | |||
android:layout_marginLeft="10dp" | |||
android:src="@mipmap/home_sbkz1" /> | |||
</LinearLayout> | |||
</LinearLayout> | |||
</LinearLayout> | |||
</LinearLayout> | |||
<RelativeLayout | |||
android:layout_width="match_parent" | |||
android:layout_height="200dp" | |||
android:layout_marginLeft="30dp" | |||
android:layout_marginTop="210dp" | |||
android:layout_marginRight="30dp" | |||
android:background="@mipmap/home1"> | |||
</RelativeLayout> | |||
<RelativeLayout | |||
android:id="@+id/zhuxiaodenglu" | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:layout_alignParentRight="true" | |||
android:layout_alignParentBottom="true" | |||
android:layout_marginRight="-40dp" | |||
android:layout_marginBottom="50dp" | |||
android:background="@mipmap/home2" | |||
android:elevation="40dp"> | |||
</RelativeLayout> | |||
</RelativeLayout> | |||
</com.qmuiteam.qmui.widget.QMUIWindowInsetLayout> |
@@ -0,0 +1,80 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<com.qmuiteam.qmui.widget.QMUIWindowInsetLayout 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:layout_width="match_parent" | |||
android:layout_height="match_parent"> | |||
<RelativeLayout | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
android:layout_marginTop="?attr/qmui_topbar_height"> | |||
<RelativeLayout | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
android:layout_margin="@dimen/dp_10"> | |||
<LinearLayout | |||
android:layout_marginTop="5dp" | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content"> | |||
<RelativeLayout | |||
android:layout_width="wrap_content" | |||
android:layout_height="match_parent" | |||
android:layout_marginLeft="@dimen/dp_10"> | |||
<TextView | |||
android:id="@+id/quanbucaipu" | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:layout_centerInParent="true" | |||
android:text="全部菜谱" | |||
android:textColor="#BEAA6A" | |||
android:textSize="19dp" | |||
android:textStyle="bold" /> | |||
</RelativeLayout> | |||
<RelativeLayout | |||
android:layout_width="wrap_content" | |||
android:layout_height="match_parent" | |||
android:layout_marginLeft="@dimen/dp_10"> | |||
<TextView | |||
android:id="@+id/yunduancaipu" | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:layout_centerInParent="true" | |||
android:text="云端菜谱" | |||
android:textColor="#797373" | |||
android:textSize="19dp" | |||
android:textStyle="bold" /> | |||
</RelativeLayout> | |||
<androidx.appcompat.widget.SearchView | |||
android:id="@+id/search_view" | |||
android:layout_width="0dp" | |||
android:layout_weight="1" | |||
android:layout_height="40dp" | |||
android:layout_marginLeft="@dimen/dp_10" | |||
android:background="@drawable/ssk" /> | |||
</LinearLayout> | |||
<RelativeLayout | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
android:layout_marginTop="60dp" | |||
android:layout_marginBottom="40dp"> | |||
<androidx.recyclerview.widget.RecyclerView | |||
android:id="@+id/recycler_view" | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent"> | |||
</androidx.recyclerview.widget.RecyclerView> | |||
</RelativeLayout> | |||
</RelativeLayout> | |||
</RelativeLayout> | |||
<com.qmuiteam.qmui.widget.QMUITopBarLayout | |||
android:id="@+id/topbar" | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content" /> | |||
</com.qmuiteam.qmui.widget.QMUIWindowInsetLayout> |
@@ -0,0 +1,15 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<com.qmuiteam.qmui.widget.QMUIWindowInsetLayout 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:layout_width="match_parent" | |||
android:layout_height="match_parent"> | |||
<RelativeLayout | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent"> | |||
<TextView | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:text="设备控制"/> | |||
</RelativeLayout> | |||
</com.qmuiteam.qmui.widget.QMUIWindowInsetLayout> |
@@ -0,0 +1,67 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<RelativeLayout 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" | |||
> | |||
<RelativeLayout | |||
android:layout_marginTop="10dp" | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content"> | |||
<ImageView | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content" | |||
android:scaleType="centerCrop" | |||
android:background="@mipmap/home_bottom" /> | |||
<ImageView | |||
android:id="@+id/z_bj" | |||
android:layout_width="240dp" | |||
android:layout_height="85dp" | |||
android:scaleType="centerCrop" | |||
android:background="@mipmap/home_left" | |||
android:layout_alignParentLeft="true"/> | |||
<ImageView | |||
android:id="@+id/y_bj" | |||
android:layout_width="240dp" | |||
android:layout_height="85dp" | |||
android:scaleType="centerCrop" | |||
android:background="@mipmap/home_you" | |||
android:layout_alignParentRight="true" | |||
android:visibility="gone"/> | |||
<TextView | |||
android:id="@+id/z_wz" | |||
android:layout_width="200dp" | |||
android:layout_height="wrap_content" | |||
android:layout_marginTop="30dp" | |||
android:layout_marginRight="10dp" | |||
android:layout_alignParentLeft="true" | |||
android:text="开始烹饪" | |||
android:textAlignment="center" | |||
android:textColor="@color/black" | |||
android:textSize="25dp" | |||
android:textStyle="bold"/> | |||
<TextView | |||
android:id="@+id/y_wz" | |||
android:layout_width="200dp" | |||
android:layout_height="wrap_content" | |||
android:layout_marginTop="30dp" | |||
android:layout_marginRight="10dp" | |||
android:layout_alignParentRight="true" | |||
android:text="设备控制" | |||
android:textAlignment="center" | |||
android:textColor="@color/black" | |||
android:textSize="25dp" | |||
android:textStyle="bold"/> | |||
</RelativeLayout> | |||
<ImageView | |||
android:id="@+id/first" | |||
android:scaleType="centerCrop" | |||
android:layout_centerHorizontal="true" | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:src="@mipmap/home_no" /> | |||
</RelativeLayout> |
@@ -0,0 +1,91 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||
xmlns:tools="http://schemas.android.com/tools" | |||
android:layout_width="165dp" | |||
android:layout_height="165dp"> | |||
<LinearLayout | |||
android:layout_marginTop="5dp" | |||
android:layout_marginLeft="5dp" | |||
android:layout_marginBottom="5dp" | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content" | |||
android:orientation="vertical"> | |||
<RelativeLayout | |||
android:layout_width="match_parent" | |||
android:layout_height="120dp"> | |||
<ImageView | |||
android:id="@+id/ImageUrl" | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
android:src="@mipmap/image2" | |||
android:adjustViewBounds="true" | |||
android:scaleType="centerCrop"/> | |||
<RelativeLayout | |||
android:layout_alignParentBottom="true" | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content" | |||
android:background="#AEFFFFFF"> | |||
<TextView | |||
android:id="@+id/Tag_text" | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content" | |||
android:layout_marginLeft="5dp" | |||
android:text="清炒三月瓜" | |||
android:textAlignment="center" | |||
android:textColor="@color/black" | |||
android:textSize="25dp" | |||
android:textStyle="bold" | |||
tools:ignore="MissingConstraints" /> | |||
</RelativeLayout> | |||
</RelativeLayout> | |||
<LinearLayout | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
android:layout_marginTop="5dp" | |||
android:orientation="horizontal"> | |||
<TextView | |||
android:id="@+id/Sc_text" | |||
android:layout_width="0dp" | |||
android:layout_height="wrap_content" | |||
android:layout_weight="1" | |||
android:text="上传" | |||
android:textAlignment="center" | |||
android:textColor="@color/light_blue_primary" | |||
android:textSize="19dp" /> | |||
<TextView | |||
android:id="@+id/delete_text" | |||
android:layout_width="0dp" | |||
android:layout_height="wrap_content" | |||
android:layout_alignParentRight="true" | |||
android:layout_weight="1" | |||
android:text="删除" | |||
android:textAlignment="center" | |||
android:textColor="@color/red_primary_dark" | |||
android:textSize="19dp" /> | |||
</LinearLayout> | |||
</LinearLayout> | |||
<TextView | |||
android:id="@+id/Note_text" | |||
android:textSize="10dp" | |||
android:textColor="@color/gray" | |||
android:layout_marginLeft="5dp" | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
tools:ignore="MissingConstraints" | |||
android:text="时间:185秒" | |||
android:visibility="gone"/> | |||
<ImageView | |||
android:id="@+id/sc_image" | |||
android:layout_alignParentRight="true" | |||
android:layout_width="30dp" | |||
android:layout_height="30dp" | |||
android:layout_marginTop="@dimen/dp_10" | |||
android:layout_marginRight="@dimen/dp_10" | |||
android:src="@mipmap/wsc3" | |||
android:visibility="gone"/> | |||
</RelativeLayout> |
@@ -12,6 +12,8 @@ | |||
<color name="file_picker_des">#86848B</color> | |||
<color name="file_bottom_line">#ECECEC</color> | |||
<color name="selebottom">#3604BFEF</color> | |||
<color name="topbj1">#BEAA6A</color> | |||
<!-- common --> | |||
<color name="dataGridColumnHeaderColor">#00c2f4</color> | |||
<color name="foreground">#a2c2e8</color> | |||