添加磁贴模块
This commit is contained in:
		@@ -1,8 +1,8 @@
 | 
				
			|||||||
#Created by .winboll/winboll_app_build.gradle
 | 
					#Created by .winboll/winboll_app_build.gradle
 | 
				
			||||||
#Thu Feb 13 06:53:49 HKT 2025
 | 
					#Thu Feb 13 12:38:29 GMT 2025
 | 
				
			||||||
stageCount=1
 | 
					stageCount=1
 | 
				
			||||||
libraryProject=libappbase
 | 
					libraryProject=libappbase
 | 
				
			||||||
baseVersion=1.5
 | 
					baseVersion=1.5
 | 
				
			||||||
publishVersion=1.5.0
 | 
					publishVersion=1.5.0
 | 
				
			||||||
buildCount=0
 | 
					buildCount=12
 | 
				
			||||||
baseBetaVersion=1.5.1
 | 
					baseBetaVersion=1.5.1
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -18,19 +18,30 @@
 | 
				
			|||||||
            <intent-filter>
 | 
					            <intent-filter>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                <action android:name="android.intent.action.MAIN"/>
 | 
					                <action android:name="android.intent.action.MAIN"/>
 | 
				
			||||||
 | 
					 | 
				
			||||||
                <category android:name="android.intent.category.LAUNCHER"/>
 | 
					                <category android:name="android.intent.category.LAUNCHER"/>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            </intent-filter>
 | 
					                // 磁贴响应设置
 | 
				
			||||||
 | 
					                <action android:name="android.service.quicksettings.action.QS_TILE_PREFERENCES" />
 | 
				
			||||||
 | 
					                <category android:name="android.intent.category.DEFAULT" />
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            </intent-filter>
 | 
				
			||||||
        </activity>
 | 
					        </activity>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        <activity android:name=".GlobalApplication$CrashActivity"/>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        <service
 | 
				
			||||||
 | 
					            android:name=".MyTileService"
 | 
				
			||||||
 | 
					            android:label="@string/tileservice_name"
 | 
				
			||||||
 | 
					            android:icon="@drawable/ic_launcher"
 | 
				
			||||||
 | 
					            android:permission="android.permission.BIND_QUICK_SETTINGS_TILE">
 | 
				
			||||||
 | 
					            <intent-filter>
 | 
				
			||||||
 | 
					                <action android:name="android.service.quicksettings.action.QS_TILE"/>
 | 
				
			||||||
 | 
					            </intent-filter>
 | 
				
			||||||
 | 
					        </service>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <meta-data
 | 
					        <meta-data
 | 
				
			||||||
            android:name="android.max_aspect"
 | 
					            android:name="android.max_aspect"
 | 
				
			||||||
            android:value="4.0"/>
 | 
					            android:value="4.0"/>
 | 
				
			||||||
 | 
					 | 
				
			||||||
        <activity android:name=".GlobalApplication$CrashActivity"/>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    </application>
 | 
					    </application>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
</manifest>
 | 
					</manifest>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -9,12 +9,12 @@ import androidx.appcompat.app.AppCompatActivity;
 | 
				
			|||||||
import androidx.appcompat.widget.Toolbar;
 | 
					import androidx.appcompat.widget.Toolbar;
 | 
				
			||||||
import cc.winboll.studio.appbase.R;
 | 
					import cc.winboll.studio.appbase.R;
 | 
				
			||||||
import cc.winboll.studio.libappbase.GlobalApplication;
 | 
					import cc.winboll.studio.libappbase.GlobalApplication;
 | 
				
			||||||
 | 
					import cc.winboll.studio.libappbase.ISOSAPP;
 | 
				
			||||||
import cc.winboll.studio.libappbase.LogUtils;
 | 
					import cc.winboll.studio.libappbase.LogUtils;
 | 
				
			||||||
import cc.winboll.studio.libappbase.LogView;
 | 
					import cc.winboll.studio.libappbase.LogView;
 | 
				
			||||||
import cc.winboll.studio.libappbase.SOSCSBroadcastReceiver;
 | 
					import cc.winboll.studio.libappbase.SOSCSBroadcastReceiver;
 | 
				
			||||||
import cc.winboll.studio.libappbase.SimpleOperateSignalCenterService;
 | 
					import cc.winboll.studio.libappbase.SimpleOperateSignalCenterService;
 | 
				
			||||||
import com.hjq.toast.ToastUtils;
 | 
					import com.hjq.toast.ToastUtils;
 | 
				
			||||||
import cc.winboll.studio.libappbase.ISOSAPP;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class MainActivity extends AppCompatActivity {
 | 
					public class MainActivity extends AppCompatActivity {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -77,6 +77,10 @@ public class MainActivity extends AppCompatActivity {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public void onSOS(View view) {
 | 
					    public void onSOS(View view) {
 | 
				
			||||||
 | 
					        sos2();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void sos() {
 | 
				
			||||||
        // 创建Intent对象,指定广播的action
 | 
					        // 创建Intent对象,指定广播的action
 | 
				
			||||||
        Intent intent = new Intent(SOSCSBroadcastReceiver.ACTION_SOS);
 | 
					        Intent intent = new Intent(SOSCSBroadcastReceiver.ACTION_SOS);
 | 
				
			||||||
        // 目标服务的包名和类名
 | 
					        // 目标服务的包名和类名
 | 
				
			||||||
@@ -88,4 +92,17 @@ public class MainActivity extends AppCompatActivity {
 | 
				
			|||||||
        sendBroadcast(intent);
 | 
					        sendBroadcast(intent);
 | 
				
			||||||
        LogUtils.d(TAG, "onSOS");
 | 
					        LogUtils.d(TAG, "onSOS");
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void sos2() {
 | 
				
			||||||
 | 
					        // 创建Intent对象,指定广播的action
 | 
				
			||||||
 | 
					        Intent intent = new Intent(SOSCSBroadcastReceiver.ACTION_SOS);
 | 
				
			||||||
 | 
					        // 目标服务的包名和类名
 | 
				
			||||||
 | 
					        String packageName = this.getPackageName();
 | 
				
			||||||
 | 
					        String serviceClassName = SimpleOperateSignalCenterService.class.getName();
 | 
				
			||||||
 | 
					        intent.putExtra(ISOSAPP.EXTRA_PACKAGE, packageName);
 | 
				
			||||||
 | 
					        intent.putExtra(ISOSAPP.EXTRA_SERVICE, serviceClassName);
 | 
				
			||||||
 | 
					        // 发送广播
 | 
				
			||||||
 | 
					        sendBroadcast(intent);
 | 
				
			||||||
 | 
					        LogUtils.d(TAG, "onSOS2");
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -0,0 +1,44 @@
 | 
				
			|||||||
 | 
					package cc.winboll.studio.appbase;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @Author ZhanGSKen@AliYun.Com
 | 
				
			||||||
 | 
					 * @Date 2025/02/13 19:30:10
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					import android.app.PendingIntent;
 | 
				
			||||||
 | 
					import android.content.Intent;
 | 
				
			||||||
 | 
					import android.os.Build;
 | 
				
			||||||
 | 
					import android.service.quicksettings.Tile;
 | 
				
			||||||
 | 
					import android.service.quicksettings.TileService;
 | 
				
			||||||
 | 
					import android.widget.Toast;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class MyTileService extends TileService {
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public void onStartListening() {
 | 
				
			||||||
 | 
					        super.onStartListening();
 | 
				
			||||||
 | 
					        Tile tile = getQsTile();
 | 
				
			||||||
 | 
					        tile.setState(Tile.STATE_INACTIVE);
 | 
				
			||||||
 | 
					        tile.setLabel(getString(R.string.tileservice_name));
 | 
				
			||||||
 | 
					        tile.setIcon(android.graphics.drawable.Icon.createWithResource(this, R.drawable.ic_cloud_outline));
 | 
				
			||||||
 | 
					       
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        tile.updateTile();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public void onClick() {
 | 
				
			||||||
 | 
					        super.onClick();
 | 
				
			||||||
 | 
					        Toast.makeText(this, "磁贴被点击", Toast.LENGTH_SHORT).show();
 | 
				
			||||||
 | 
					        Tile tile = getQsTile();
 | 
				
			||||||
 | 
					        if (tile.getState() == Tile.STATE_INACTIVE) {
 | 
				
			||||||
 | 
					            tile.setState(Tile.STATE_ACTIVE);
 | 
				
			||||||
 | 
					            tile.setIcon(android.graphics.drawable.Icon.createWithResource(this, R.drawable.ic_cloud));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            tile.setState(Tile.STATE_INACTIVE);
 | 
				
			||||||
 | 
					            tile.setIcon(android.graphics.drawable.Icon.createWithResource(this, R.drawable.ic_cloud_outline));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        tile.updateTile();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										11
									
								
								appbase/src/main/res/drawable/ic_cloud.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								appbase/src/main/res/drawable/ic_cloud.xml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,11 @@
 | 
				
			|||||||
 | 
					<?xml version="1.0" encoding="utf-8"?>
 | 
				
			||||||
 | 
					<vector xmlns:android="http://schemas.android.com/apk/res/android"
 | 
				
			||||||
 | 
					    android:width="24dp"
 | 
				
			||||||
 | 
					    android:height="24dp"
 | 
				
			||||||
 | 
					    android:viewportHeight="24"
 | 
				
			||||||
 | 
					    android:viewportWidth="24">
 | 
				
			||||||
 | 
					    <path
 | 
				
			||||||
 | 
					        android:fillColor="#ff000000"
 | 
				
			||||||
 | 
					        android:pathData="M6.5,20Q4.22,20 2.61,18.43 1,16.85 1,14.58 1,12.63 2.17,11.1 3.35,9.57 5.25,9.15 5.88,6.85 7.75,5.43 9.63,4 12,4 14.93,4 16.96,6.04 19,8.07 19,11 20.73,11.2 21.86,12.5 23,13.78 23,15.5 23,17.38 21.69,18.69 20.38,20 18.5,20Z"/>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					</vector>
 | 
				
			||||||
							
								
								
									
										11
									
								
								appbase/src/main/res/drawable/ic_cloud_outline.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								appbase/src/main/res/drawable/ic_cloud_outline.xml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,11 @@
 | 
				
			|||||||
 | 
					<?xml version="1.0" encoding="utf-8"?>
 | 
				
			||||||
 | 
					<vector xmlns:android="http://schemas.android.com/apk/res/android"
 | 
				
			||||||
 | 
					    android:width="24dp"
 | 
				
			||||||
 | 
					    android:height="24dp"
 | 
				
			||||||
 | 
					    android:viewportHeight="24"
 | 
				
			||||||
 | 
					    android:viewportWidth="24">
 | 
				
			||||||
 | 
					    <path
 | 
				
			||||||
 | 
					        android:fillColor="#ff000000"
 | 
				
			||||||
 | 
					        android:pathData="M6.5,20Q4.22,20 2.61,18.43 1,16.85 1,14.58 1,12.63 2.17,11.1 3.35,9.57 5.25,9.15 5.88,6.85 7.75,5.43 9.63,4 12,4 14.93,4 16.96,6.04 19,8.07 19,11 20.73,11.2 21.86,12.5 23,13.78 23,15.5 23,17.38 21.69,18.69 20.38,20 18.5,20M6.5,18H18.5Q19.55,18 20.27,17.27 21,16.55 21,15.5 21,14.45 20.27,13.73 19.55,13 18.5,13H17V11Q17,8.93 15.54,7.46 14.08,6 12,6 9.93,6 8.46,7.46 7,8.93 7,11H6.5Q5.05,11 4.03,12.03 3,13.05 3,14.5 3,15.95 4.03,17 5.05,18 6.5,18M12,12Z"/>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					</vector>
 | 
				
			||||||
										
											Binary file not shown.
										
									
								
							| 
		 Before Width: | Height: | Size: 9.0 KiB  | 
@@ -1,4 +1,5 @@
 | 
				
			|||||||
<?xml version="1.0" encoding="utf-8"?>
 | 
					<?xml version="1.0" encoding="utf-8"?>
 | 
				
			||||||
<resources>
 | 
					<resources>
 | 
				
			||||||
    <string name="app_name">AppBase</string>
 | 
					    <string name="app_name">AppBase</string>
 | 
				
			||||||
 | 
					    <string name="tileservice_name">WinBoll</string>
 | 
				
			||||||
</resources>
 | 
					</resources>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,8 +1,8 @@
 | 
				
			|||||||
#Created by .winboll/winboll_app_build.gradle
 | 
					#Created by .winboll/winboll_app_build.gradle
 | 
				
			||||||
#Thu Feb 13 06:53:34 HKT 2025
 | 
					#Thu Feb 13 12:38:29 GMT 2025
 | 
				
			||||||
stageCount=1
 | 
					stageCount=1
 | 
				
			||||||
libraryProject=libappbase
 | 
					libraryProject=libappbase
 | 
				
			||||||
baseVersion=1.5
 | 
					baseVersion=1.5
 | 
				
			||||||
publishVersion=1.5.0
 | 
					publishVersion=1.5.0
 | 
				
			||||||
buildCount=0
 | 
					buildCount=12
 | 
				
			||||||
baseBetaVersion=1.5.1
 | 
					baseBetaVersion=1.5.1
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user