@@ -25,6 +25,9 @@ android { | |||
sourceCompatibility JavaVersion.VERSION_1_8 | |||
targetCompatibility JavaVersion.VERSION_1_8 | |||
} | |||
buildFeatures { | |||
viewBinding true | |||
} | |||
} | |||
dependencies { | |||
@@ -2,32 +2,50 @@ | |||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | |||
xmlns:tools="http://schemas.android.com/tools"> | |||
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/> | |||
<uses-permission android:name="android.permission.INTERNET"/> | |||
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" /> | |||
<uses-permission android:name="android.permission.INTERNET" /> | |||
<uses-permission android:name="android.permission.VIBRATE" /> | |||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> | |||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> | |||
<application | |||
android:name="com.example.bpa.app.ICSApp" | |||
android:name=".app.ICSApp" | |||
android:allowBackup="true" | |||
android:icon="@mipmap/ncd" | |||
android:label="@string/app_name" | |||
android:supportsRtl="false" | |||
android:theme="@style/AppTheme" | |||
tools:targetApi="31"> | |||
<activity | |||
android:name=".view.SystemCapabilitiesFragment" | |||
android:exported="false" /> | |||
<activity | |||
android:name=".view.HeplerFragment" | |||
android:exported="false" /> | |||
<activity | |||
android:name=".view.SystemSetFragment" | |||
android:exported="false" /> | |||
<activity | |||
android:name=".view.HomeFragment" | |||
android:exported="false" /> | |||
<activity | |||
android:name=".view.CloudFragment" | |||
android:exported="false" /> | |||
<activity | |||
android:name=".HomeActivity" | |||
android:exported="false" /> | |||
<activity | |||
android:name=".LoginActivity" | |||
android:exported="true" > | |||
android:exported="true"> | |||
<intent-filter> | |||
<action android:name="android.intent.action.MAIN" /> | |||
<category android:name="android.intent.category.LAUNCHER" /> | |||
</intent-filter> | |||
</activity> | |||
<activity | |||
android:name=".MainActivity" | |||
android:configChanges="orientation|screenSize|keyboard|keyboardHidden|navigation" | |||
android:exported="false"> | |||
</activity> | |||
android:exported="false" /> | |||
</application> | |||
</manifest> |
@@ -1,30 +1,57 @@ | |||
package com.example.bpa; | |||
import android.app.Activity; | |||
import android.app.AlertDialog; | |||
import android.content.DialogInterface; | |||
import android.content.Intent; | |||
import android.os.Bundle; | |||
import android.view.View; | |||
import android.widget.Button; | |||
import android.widget.EditText; | |||
import android.widget.FrameLayout; | |||
import android.widget.ImageView; | |||
import android.widget.TextView; | |||
import androidx.fragment.app.Fragment; | |||
import androidx.fragment.app.FragmentActivity; | |||
import androidx.fragment.app.FragmentManager; | |||
import androidx.fragment.app.FragmentTransaction; | |||
import androidx.viewpager.widget.ViewPager; | |||
import com.example.bpa.app.Main; | |||
import com.example.bpa.config.ConfigName; | |||
import com.example.bpa.helper.T; | |||
import com.example.bpa.view.CloudFragment; | |||
import com.example.bpa.view.HeplerFragment; | |||
import com.example.bpa.view.HomeFragment; | |||
import com.example.bpa.view.SystemCapabilitiesFragment; | |||
import com.example.bpa.view.SystemSetFragment; | |||
public class MainActivity extends Activity implements View.OnClickListener{ | |||
public class MainActivity extends FragmentActivity implements View.OnClickListener{ | |||
//region 界面变量 | |||
//标题 | |||
private TextView clist_title; | |||
//返回 云端 系统功能 系统设置 系统帮助 | |||
private ImageView mainreturn,CloudUpdates,SystemCapabilities,SystemSettings,SystemHelp; | |||
private ImageView CloudUpdates,SystemCapabilities,SystemSettings,SystemHelp,HomeMain,ColseMain; | |||
//页面 | |||
private ViewPager id_viewpager; | |||
private FrameLayout fragment_container; | |||
//endregion | |||
//region 界面 | |||
//主页 | |||
public HomeFragment homeFragment=new HomeFragment(); | |||
//更新 | |||
public CloudFragment cloudFragment=new CloudFragment(); | |||
//系统功能 | |||
public SystemCapabilitiesFragment systemCapabilitiesFragment=new SystemCapabilitiesFragment(); | |||
//系统设置 | |||
public SystemSetFragment systemSetFragment=new SystemSetFragment(); | |||
//系统帮助 | |||
public HeplerFragment heplerFragment=new HeplerFragment(); | |||
//endregion | |||
//region 私有函数 | |||
@Override | |||
protected void onCreate(Bundle savedInstanceState) { | |||
@@ -41,23 +68,27 @@ public class MainActivity extends Activity implements View.OnClickListener{ | |||
*/ | |||
private void Init() { | |||
clist_title = findViewById(R.id.clist_title); | |||
mainreturn = findViewById(R.id.mainreturn); | |||
CloudUpdates = findViewById(R.id.CloudUpdates); | |||
SystemCapabilities = findViewById(R.id.SystemCapabilities); | |||
SystemSettings = findViewById(R.id.SystemSettings); | |||
SystemHelp = findViewById(R.id.SystemHelp); | |||
id_viewpager= findViewById(R.id.id_viewpager); | |||
HomeMain= findViewById(R.id.HomeMain); | |||
ColseMain= findViewById(R.id.ColseMain); | |||
fragment_container= findViewById(R.id.fragment_container); | |||
clist_title.setText(ConfigName.getInstance().Shop_Name); | |||
ShowFragment(homeFragment); | |||
} | |||
/** | |||
* 初始化按钮事件 | |||
*/ | |||
private void initEvents() { | |||
//设置四个Tab的点击事件 | |||
mainreturn.setOnClickListener(this); | |||
CloudUpdates.setOnClickListener(this); | |||
SystemCapabilities.setOnClickListener(this); | |||
SystemSettings.setOnClickListener(this); | |||
SystemHelp.setOnClickListener(this); | |||
HomeMain.setOnClickListener(this); | |||
ColseMain.setOnClickListener(this); | |||
} | |||
//endregion | |||
@@ -70,22 +101,74 @@ public class MainActivity extends Activity implements View.OnClickListener{ | |||
@Override | |||
public void onClick(View v) { | |||
switch (v.getId()) { | |||
case R.id.mainreturn://返回按钮 | |||
break; | |||
case R.id.CloudUpdates://系统更新按钮 | |||
ShowFragment(cloudFragment); | |||
break; | |||
case R.id.SystemCapabilities://系统功能按钮 | |||
ShowFragment(systemCapabilitiesFragment); | |||
break; | |||
case R.id.SystemSettings://系统设置按钮 | |||
ShowFragment(systemSetFragment); | |||
break; | |||
case R.id.SystemHelp://系统帮助按钮 | |||
ShowFragment(heplerFragment); | |||
break; | |||
case R.id.HomeMain://主页 | |||
ShowFragment(homeFragment); | |||
break; | |||
case R.id.ColseMain://关闭主窗体 | |||
ColseActive(); | |||
break; | |||
} | |||
} | |||
/** | |||
* 当前选中窗体 | |||
*/ | |||
public Fragment SelectFragment=null; | |||
/** | |||
* 打开窗体 | |||
*/ | |||
public void ShowFragment(Fragment fragment) | |||
{ | |||
FragmentManager manager = getSupportFragmentManager(); | |||
FragmentTransaction transaction = manager.beginTransaction(); | |||
if(SelectFragment!=null) | |||
{ | |||
transaction.remove(SelectFragment); | |||
} | |||
transaction.add(R.id.fragment_container, fragment); | |||
transaction.commit(); | |||
SelectFragment=fragment; | |||
} | |||
/** | |||
* 关闭主窗体 | |||
*/ | |||
public void ColseActive() | |||
{ | |||
// 1.创建弹框对象,显示在当前页面 | |||
AlertDialog.Builder ab = new AlertDialog.Builder(MainActivity.this); | |||
// 2.编辑弹框样式 | |||
// 2.1 创建标题 | |||
ab.setTitle("退出安全提示"); | |||
// 2.3 设置图标 | |||
ab.setIcon(R.mipmap.ts); | |||
// 2.4 设置内容 | |||
ab.setMessage("您是否确定退出程序?"); | |||
// 2.5 设置按钮 | |||
ab.setPositiveButton("取消",null); | |||
ab.setNeutralButton("确定", new DialogInterface.OnClickListener() { | |||
@Override | |||
public void onClick(DialogInterface dialog, int which) { | |||
// 实现程序的退出,结束当前 | |||
MainActivity.this.finish(); | |||
} | |||
}); | |||
// 3.创建弹框 | |||
ab.create(); | |||
// 4.显示弹框 | |||
ab.show(); | |||
} | |||
//endregion | |||
} |
@@ -43,7 +43,7 @@ public class ConfigName { | |||
/** | |||
* 店铺名称 | |||
*/ | |||
public String Shop_Name="茶百道测试app"; | |||
public String Shop_Name="黑菠萝奶茶机"; | |||
/** | |||
* 店铺设备号 | |||
*/ | |||
@@ -0,0 +1,26 @@ | |||
package com.example.bpa.view; | |||
import androidx.annotation.NonNull; | |||
import androidx.annotation.Nullable; | |||
import androidx.appcompat.app.AppCompatActivity; | |||
import androidx.fragment.app.Fragment; | |||
import android.os.Bundle; | |||
import android.view.LayoutInflater; | |||
import android.view.View; | |||
import android.view.ViewGroup; | |||
import com.example.bpa.R; | |||
/** | |||
* 上传云端界面 | |||
*/ | |||
public class CloudFragment extends Fragment { | |||
@Nullable | |||
@Override | |||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { | |||
View view = inflater.inflate(R.layout.fragment_cloud, container,false); | |||
return view; | |||
} | |||
} |
@@ -0,0 +1,26 @@ | |||
package com.example.bpa.view; | |||
import androidx.annotation.NonNull; | |||
import androidx.annotation.Nullable; | |||
import androidx.appcompat.app.AppCompatActivity; | |||
import androidx.fragment.app.Fragment; | |||
import android.os.Bundle; | |||
import android.view.LayoutInflater; | |||
import android.view.View; | |||
import android.view.ViewGroup; | |||
import com.example.bpa.R; | |||
/** | |||
* 系统帮助界面 | |||
*/ | |||
public class HeplerFragment extends Fragment { | |||
@Nullable | |||
@Override | |||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { | |||
View view = inflater.inflate(R.layout.fragment_hepler, container,false); | |||
return view; | |||
} | |||
} |
@@ -0,0 +1,26 @@ | |||
package com.example.bpa.view; | |||
import androidx.annotation.NonNull; | |||
import androidx.annotation.Nullable; | |||
import androidx.appcompat.app.AppCompatActivity; | |||
import androidx.fragment.app.Fragment; | |||
import android.os.Bundle; | |||
import android.view.LayoutInflater; | |||
import android.view.View; | |||
import android.view.ViewGroup; | |||
import com.example.bpa.R; | |||
/** | |||
* 主页界面 | |||
*/ | |||
public class HomeFragment extends Fragment { | |||
@Nullable | |||
@Override | |||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { | |||
View view = inflater.inflate(R.layout.fragment_home, container,false); | |||
return view; | |||
} | |||
} |
@@ -0,0 +1,26 @@ | |||
package com.example.bpa.view; | |||
import androidx.annotation.NonNull; | |||
import androidx.annotation.Nullable; | |||
import androidx.appcompat.app.AppCompatActivity; | |||
import androidx.fragment.app.Fragment; | |||
import android.os.Bundle; | |||
import android.view.LayoutInflater; | |||
import android.view.View; | |||
import android.view.ViewGroup; | |||
import com.example.bpa.R; | |||
/** | |||
* 系统功能界面 | |||
*/ | |||
public class SystemCapabilitiesFragment extends Fragment { | |||
@Nullable | |||
@Override | |||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { | |||
View view = inflater.inflate(R.layout.fragment_system_capabilities, container,false); | |||
return view; | |||
} | |||
} |
@@ -0,0 +1,25 @@ | |||
package com.example.bpa.view; | |||
import androidx.annotation.NonNull; | |||
import androidx.annotation.Nullable; | |||
import androidx.appcompat.app.AppCompatActivity; | |||
import androidx.fragment.app.Fragment; | |||
import android.os.Bundle; | |||
import android.view.LayoutInflater; | |||
import android.view.View; | |||
import android.view.ViewGroup; | |||
import com.example.bpa.R; | |||
/** | |||
* 系统设置界面 | |||
*/ | |||
public class SystemSetFragment extends Fragment { | |||
@Nullable | |||
@Override | |||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { | |||
View view = inflater.inflate(R.layout.fragment_system_set, container,false); | |||
return view; | |||
} | |||
} |
@@ -20,6 +20,7 @@ | |||
android:layout_centerVertical="true" | |||
android:layout_marginLeft="20dp" | |||
android:src="@mipmap/zj" | |||
android:visibility="invisible" | |||
/> | |||
<RelativeLayout | |||
android:layout_centerInParent="true" | |||
@@ -48,6 +49,14 @@ | |||
android:layout_centerVertical="true" | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content"> | |||
<ImageView | |||
android:id="@+id/HomeMain" | |||
android:layout_width="20dp" | |||
android:layout_height="20dp" | |||
android:layout_alignParentRight="true" | |||
android:layout_centerVertical="true" | |||
android:layout_marginRight="20dp" | |||
android:src="@mipmap/zy"/> | |||
<ImageView | |||
android:id="@+id/CloudUpdates" | |||
android:layout_width="20dp" | |||
@@ -80,6 +89,14 @@ | |||
android:layout_centerVertical="true" | |||
android:layout_marginRight="20dp" | |||
android:src="@mipmap/bz"/> | |||
<ImageView | |||
android:id="@+id/ColseMain" | |||
android:layout_width="20dp" | |||
android:layout_height="20dp" | |||
android:layout_alignParentRight="true" | |||
android:layout_centerVertical="true" | |||
android:layout_marginRight="20dp" | |||
android:src="@mipmap/tc"/> | |||
</LinearLayout> | |||
</RelativeLayout> | |||
@@ -87,10 +104,8 @@ | |||
android:layout_width="match_parent" | |||
android:layout_height="1dp" | |||
android:background="#FF03668F" /> | |||
<androidx.viewpager.widget.ViewPager | |||
android:id="@+id/id_viewpager" | |||
<FrameLayout | |||
android:id="@+id/fragment_container" | |||
android:layout_width="match_parent" | |||
android:layout_height="0dp" | |||
android:layout_weight="1"/> | |||
android:layout_height="match_parent"/> | |||
</LinearLayout> |
@@ -0,0 +1,15 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||
xmlns:app="http://schemas.android.com/apk/res-auto" | |||
xmlns:tools="http://schemas.android.com/tools" | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
tools:context=".view.CloudFragment"> | |||
<TextView | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:text="云端更新版本" | |||
android:textSize="50dp" | |||
android:textColor="@color/color_purl"> | |||
</TextView> | |||
</LinearLayout> |
@@ -0,0 +1,15 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||
xmlns:app="http://schemas.android.com/apk/res-auto" | |||
xmlns:tools="http://schemas.android.com/tools" | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
tools:context=".view.HeplerFragment"> | |||
<TextView | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:text="系统帮助" | |||
android:textSize="50dp" | |||
android:textColor="@color/color_purl"> | |||
</TextView> | |||
</LinearLayout> |
@@ -0,0 +1,15 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||
xmlns:app="http://schemas.android.com/apk/res-auto" | |||
xmlns:tools="http://schemas.android.com/tools" | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
tools:context=".view.HomeFragment"> | |||
<TextView | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:text="系统主页" | |||
android:textSize="50dp" | |||
android:textColor="@color/color_purl"> | |||
</TextView> | |||
</LinearLayout> |
@@ -0,0 +1,15 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||
xmlns:app="http://schemas.android.com/apk/res-auto" | |||
xmlns:tools="http://schemas.android.com/tools" | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
tools:context=".view.SystemCapabilitiesFragment"> | |||
<TextView | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:text="系统功能" | |||
android:textSize="50dp" | |||
android:textColor="@color/color_purl"> | |||
</TextView> | |||
</LinearLayout> |
@@ -0,0 +1,15 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||
xmlns:app="http://schemas.android.com/apk/res-auto" | |||
xmlns:tools="http://schemas.android.com/tools" | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
tools:context=".view.SystemSetFragment"> | |||
<TextView | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:text="系统设置" | |||
android:textSize="50dp" | |||
android:textColor="@color/color_purl"> | |||
</TextView> | |||
</LinearLayout> |
@@ -0,0 +1,7 @@ | |||
<resources> | |||
<style name="ThemeOverlay.ChaBaiDao.FullscreenContainer" parent=""> | |||
<item name="fullscreenBackgroundColor">@color/light_blue_900</item> | |||
<item name="fullscreenTextColor">@color/light_blue_A400</item> | |||
</style> | |||
</resources> |
@@ -0,0 +1,6 @@ | |||
<resources> | |||
<declare-styleable name="FullscreenAttrs"> | |||
<attr name="fullscreenBackgroundColor" format="color" /> | |||
<attr name="fullscreenTextColor" format="color" /> | |||
</declare-styleable> | |||
</resources> |
@@ -1,5 +1,4 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<!-- | |||
<?xml version="1.0" encoding="utf-8"?><!-- | |||
Tencent is pleased to support the open source community by making QMUI_Android available. | |||
Copyright (C) 2017-2018 THL A29 Limited, a Tencent company. All rights reserved. | |||
@@ -16,7 +15,7 @@ | |||
--> | |||
<resources> | |||
<color name="test">#FF061B51</color> | |||
<color name="test">#FF061B51</color> | |||
<color name="colorPrimary">#0A1026</color> | |||
<color name="colorPrimaryDark">#0A1026</color> | |||
<color name="colorAccent">#F57F17</color> | |||
@@ -71,4 +70,9 @@ | |||
<color name="colorHelper_square_alpha_background">@color/app_color_theme_4</color> | |||
<color name="colorHelper_square_from_ratio_background">@color/app_color_blue</color> | |||
<color name="colorHelper_square_to_ratio_background">@color/app_color_theme_3</color> | |||
<color name="light_blue_600">#FF039BE5</color> | |||
<color name="light_blue_900">#FF01579B</color> | |||
<color name="light_blue_A200">#FF40C4FF</color> | |||
<color name="light_blue_A400">#FF00B0FF</color> | |||
<color name="black_overlay">#66000000</color> | |||
</resources> |
@@ -161,5 +161,7 @@ | |||
<string name="about_item_homepage">访问官网</string> | |||
<string name="about_item_github">GitHub</string> | |||
<string name="about_copyright">© %1$s QMUI Team All rights reserved.</string> | |||
<string name="dummy_button">Dummy Button</string> | |||
<string name="dummy_content">DUMMY\nCONTENT</string> | |||
</resources> |
@@ -15,6 +15,7 @@ | |||
--> | |||
<resources xmlns:android="http://schemas.android.com/apk/res/android"> | |||
<style name="QDtextAppearanceListItem"> | |||
<item name="android:textColor">?attr/qmui_config_color_black</item> | |||
<item name="android:textSize">18sp</item> | |||
@@ -156,4 +157,9 @@ | |||
<item name="colorControlActivated">@color/colorAccent</item> | |||
<item name="android:textColorHint">@color/warm_gray</item> | |||
</style> | |||
<style name="Widget.AppTheme.ButtonBar.Fullscreen" parent=""> | |||
<item name="android:background">@color/black_overlay</item> | |||
<item name="android:buttonBarStyle">?android:attr/buttonBarStyle</item> | |||
</style> | |||
</resources> |
@@ -0,0 +1,7 @@ | |||
<resources> | |||
<style name="ThemeOverlay.ChaBaiDao.FullscreenContainer" parent=""> | |||
<item name="fullscreenBackgroundColor">@color/light_blue_600</item> | |||
<item name="fullscreenTextColor">@color/light_blue_A200</item> | |||
</style> | |||
</resources> |