在设置窗口里添加应用介绍按钮
This commit is contained in:
		| @@ -1,8 +1,8 @@ | ||||
| #Created by .winboll/winboll_app_build.gradle | ||||
| #Mon Mar 31 13:11:08 HKT 2025 | ||||
| #Mon Mar 31 07:20:43 GMT 2025 | ||||
| stageCount=2 | ||||
| libraryProject= | ||||
| baseVersion=15.2 | ||||
| publishVersion=15.2.1 | ||||
| buildCount=0 | ||||
| buildCount=2 | ||||
| baseBetaVersion=15.2.2 | ||||
|   | ||||
| @@ -188,6 +188,8 @@ | ||||
|  | ||||
|         <activity android:name="cc.winboll.studio.contacts.activities.UnitTestActivity"/> | ||||
|  | ||||
|         <activity android:name="cc.winboll.studio.contacts.activities.AboutActivity"/> | ||||
|  | ||||
|     </application> | ||||
|  | ||||
| </manifest> | ||||
| @@ -0,0 +1,91 @@ | ||||
| package cc.winboll.studio.contacts.activities; | ||||
|  | ||||
| /** | ||||
|  * @Author ZhanGSKen@AliYun.Com | ||||
|  * @Date 2025/03/31 15:15:54 | ||||
|  * @Describe 应用介绍窗口 | ||||
|  */ | ||||
| import android.app.Activity; | ||||
| import android.content.Context; | ||||
| import android.os.Bundle; | ||||
| import android.view.ViewGroup; | ||||
| import android.widget.LinearLayout; | ||||
| import androidx.appcompat.widget.Toolbar; | ||||
| import cc.winboll.studio.contacts.R; | ||||
| import cc.winboll.studio.libaes.winboll.APPInfo; | ||||
| import cc.winboll.studio.libaes.winboll.AboutView; | ||||
| import cc.winboll.studio.libappbase.GlobalApplication; | ||||
| import cc.winboll.studio.libappbase.winboll.IWinBollActivity; | ||||
|  | ||||
| public class AboutActivity extends WinBollActivity implements IWinBollActivity { | ||||
|  | ||||
|     public static final String TAG = "AboutActivity"; | ||||
|  | ||||
|     Context mContext; | ||||
|     Toolbar mToolbar; | ||||
|  | ||||
|     @Override | ||||
|     public Activity getActivity() { | ||||
|         return this; | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public String getTag() { | ||||
|         return TAG; | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     protected void onCreate(Bundle savedInstanceState) { | ||||
|         super.onCreate(savedInstanceState); | ||||
|         mContext = this; | ||||
|         setContentView(R.layout.activity_about); | ||||
|  | ||||
|         mToolbar = findViewById(R.id.toolbar); | ||||
|         setSupportActionBar(mToolbar); | ||||
|         mToolbar.setSubtitle(TAG); | ||||
|         getSupportActionBar().setDisplayHomeAsUpEnabled(true); | ||||
|  | ||||
|         AboutView aboutView = CreateAboutView(); | ||||
|         // 在 Activity 的 onCreate 或其他生命周期方法中调用 | ||||
| //        LinearLayout layout = new LinearLayout(this); | ||||
| //        layout.setOrientation(LinearLayout.VERTICAL); | ||||
| //        // 创建布局参数(宽度和高度) | ||||
| //        ViewGroup.LayoutParams params = new ViewGroup.LayoutParams( | ||||
| //            ViewGroup.LayoutParams.MATCH_PARENT, | ||||
| //            ViewGroup.LayoutParams.MATCH_PARENT | ||||
| //        ); | ||||
| //        addContentView(aboutView, params); | ||||
|  | ||||
|         LinearLayout layout = findViewById(R.id.aboutviewroot_ll); | ||||
|         // 创建布局参数(宽度和高度) | ||||
|         ViewGroup.LayoutParams params = new ViewGroup.LayoutParams( | ||||
|             ViewGroup.LayoutParams.MATCH_PARENT, | ||||
|             ViewGroup.LayoutParams.MATCH_PARENT | ||||
|         ); | ||||
|         layout.addView(aboutView, params); | ||||
|  | ||||
|         GlobalApplication.getWinBollActivityManager().add(this); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     protected void onDestroy() { | ||||
|         super.onDestroy(); | ||||
|         GlobalApplication.getWinBollActivityManager().registeRemove(this); | ||||
|     } | ||||
|  | ||||
|     public AboutView CreateAboutView() { | ||||
|         String szBranchName = "contacts"; | ||||
|         APPInfo appInfo = new APPInfo(); | ||||
|         appInfo.setAppName("Contacts"); | ||||
|         appInfo.setAppIcon(cc.winboll.studio.libaes.R.drawable.ic_winboll); | ||||
|         appInfo.setAppDescription("通讯录与拨号"); | ||||
|         appInfo.setAppGitName("APP"); | ||||
|         appInfo.setAppGitOwner("Studio"); | ||||
|         appInfo.setAppGitAPPBranch(szBranchName); | ||||
|         appInfo.setAppGitAPPSubProjectFolder(szBranchName); | ||||
|         appInfo.setAppHomePage("https://www.winboll.cc/studio/details.php?app=Contacts"); | ||||
|         appInfo.setAppAPKName("Contacts"); | ||||
|         appInfo.setAppAPKFolderName("Contacts"); | ||||
|         return new AboutView(mContext, appInfo); | ||||
|     } | ||||
| } | ||||
| @@ -40,6 +40,7 @@ import cc.winboll.studio.libappbase.winboll.IWinBollActivity; | ||||
| import com.hjq.toast.ToastUtils; | ||||
| import java.lang.reflect.Field; | ||||
| import java.util.List; | ||||
| import cc.winboll.studio.contacts.App; | ||||
|  | ||||
| public class SettingsActivity extends AppCompatActivity implements IWinBollActivity { | ||||
|  | ||||
| @@ -310,4 +311,8 @@ public class SettingsActivity extends AppCompatActivity implements IWinBollActiv | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|      | ||||
|     public void onAbout(View view) { | ||||
|         App.getWinBollActivityManager().startWinBollActivity(this, AboutActivity.class); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -0,0 +1,60 @@ | ||||
| package cc.winboll.studio.contacts.activities; | ||||
|  | ||||
| /** | ||||
|  * @Author ZhanGSKen@AliYun.Com | ||||
|  * @Date 2025/03/31 15:16:45 | ||||
|  * @Describe 应用窗口基类 | ||||
|  */ | ||||
| import android.app.Activity; | ||||
| import android.os.Bundle; | ||||
| import android.view.MenuItem; | ||||
| import androidx.appcompat.app.AppCompatActivity; | ||||
| import cc.winboll.studio.libaes.beans.AESThemeBean; | ||||
| import cc.winboll.studio.libaes.utils.AESThemeUtil; | ||||
| import cc.winboll.studio.libappbase.winboll.IWinBollActivity; | ||||
|  | ||||
| public class WinBollActivity extends AppCompatActivity implements IWinBollActivity { | ||||
|  | ||||
|     public static final String TAG = "WinBollActivity"; | ||||
|  | ||||
|     protected volatile AESThemeBean.ThemeType mThemeType; | ||||
|  | ||||
|     @Override | ||||
|     public Activity getActivity() { | ||||
|         return this; | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public String getTag() { | ||||
|         return TAG; | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     protected void onCreate(Bundle savedInstanceState) { | ||||
|         mThemeType = getThemeType(); | ||||
|         setThemeStyle(); | ||||
|         super.onCreate(savedInstanceState); | ||||
|     } | ||||
|  | ||||
|     AESThemeBean.ThemeType getThemeType() { | ||||
|         /*SharedPreferences sharedPreferences = getSharedPreferences( | ||||
|          SHAREDPREFERENCES_NAME, MODE_PRIVATE); | ||||
|          return AESThemeBean.ThemeType.values()[((sharedPreferences.getInt(DRAWER_THEME_TYPE, AESThemeBean.ThemeType.DEFAULT.ordinal())))]; | ||||
|          */ | ||||
|         return AESThemeBean.getThemeStyleType(AESThemeUtil.getThemeTypeID(getApplicationContext())); | ||||
|     } | ||||
|  | ||||
|     void setThemeStyle() { | ||||
|         //setTheme(AESThemeBean.getThemeStyle(getThemeType())); | ||||
|         setTheme(AESThemeUtil.getThemeTypeID(getApplicationContext())); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public boolean onOptionsItemSelected(MenuItem item) { | ||||
|         if(item.getItemId() == android.R.id.home) { | ||||
|             finish(); | ||||
|             return true; | ||||
|         } | ||||
|         return super.onOptionsItemSelected(item); | ||||
|     } | ||||
| } | ||||
							
								
								
									
										21
									
								
								contacts/src/main/res/layout/activity_about.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								contacts/src/main/res/layout/activity_about.xml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,21 @@ | ||||
| <?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" | ||||
|     android:orientation="vertical" | ||||
|     android:layout_width="match_parent" | ||||
|     android:layout_height="match_parent"> | ||||
|  | ||||
|     <cc.winboll.studio.libaes.views.ASupportToolbar | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="wrap_content" | ||||
|         android:id="@+id/toolbar"/> | ||||
|  | ||||
|     <LinearLayout | ||||
|         android:orientation="vertical" | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="0dp" | ||||
|         android:layout_weight="1.0" | ||||
|         android:id="@+id/aboutviewroot_ll"/> | ||||
|  | ||||
| </LinearLayout> | ||||
| @@ -282,6 +282,25 @@ | ||||
|  | ||||
| 			</LinearLayout> | ||||
|  | ||||
| 			<TextView | ||||
| 				android:layout_width="wrap_content" | ||||
| 				android:layout_height="wrap_content" | ||||
| 				android:text="其他:"/> | ||||
|  | ||||
| 			<LinearLayout | ||||
| 				android:orientation="horizontal" | ||||
| 				android:layout_width="match_parent" | ||||
| 				android:layout_height="wrap_content" | ||||
| 				android:gravity="right"> | ||||
|  | ||||
| 				<Button | ||||
| 					android:layout_width="wrap_content" | ||||
| 					android:layout_height="wrap_content" | ||||
| 					android:text="关于应用" | ||||
| 					android:onClick="onAbout"/> | ||||
|  | ||||
| 			</LinearLayout> | ||||
|  | ||||
| 		</LinearLayout> | ||||
|  | ||||
| 	</LinearLayout> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 ZhanGSKen
					ZhanGSKen