songixan / Wallpaper
透明屏幕
Stars: ✭ 348
Programming Languages
java
68154 projects - #9 most used programming language
Projects that are alternatives of or similar to Wallpaper
Kyshutterbutton
KYShutterButton is a custom button that is similar to the shutter button of the camera app
Stars: ✭ 293 (-15.8%)
Mutual labels: camera
Grip
Program for rapidly developing computer vision applications
Stars: ✭ 314 (-9.77%)
Mutual labels: camera
Blear
iOS app that transforms your photos into stunning blurry wallpapers for your device
Stars: ✭ 311 (-10.63%)
Mutual labels: wallpaper
Little Backup Box
Software that turns a single-board computer into a versatile and pocketable backup appliance
Stars: ✭ 278 (-20.11%)
Mutual labels: camera
Android Hidden Camera
This library is to take picture using camera without camera preview.
Stars: ✭ 339 (-2.59%)
Mutual labels: camera
Phockup
Media sorting tool to organize photos and videos from your camera in folders by year, month and day.
Stars: ✭ 310 (-10.92%)
Mutual labels: camera
Magicalcamera
A library to take picture easy, transform your data in different format and save photos in your device
Stars: ✭ 327 (-6.03%)
Mutual labels: camera
Stickercamera
This is an Android application with camera,picture cropping,collage sticking and tagging.贴纸标签相机,功能:拍照,相片裁剪,给图片贴贴纸,打标签。
Stars: ✭ 3,109 (+793.39%)
Mutual labels: camera
Goprostream
Tools for handling/displaying GoPro HTTP/UDP stream (Python/Ruby)
Stars: ✭ 311 (-10.63%)
Mutual labels: camera
Zvirtualdesktop
Windows 10 Virtual Desktop Hotkeys, System Tray Icon, Wallpapers, and Task View replacement
Stars: ✭ 322 (-7.47%)
Mutual labels: wallpaper
Daily Reddit Wallpaper
Change your wallpaper to the most upvoted image of the day from /r/wallpapers or any other subreddit on system startup
Stars: ✭ 297 (-14.66%)
Mutual labels: wallpaper
Android Ffmpeg Camerarecord
使用JavaCV提供的支持, 使用OpenGL实时处理+显示摄像头采集的图像, 并使用FFMPEG实时录制音视频
Stars: ✭ 334 (-4.02%)
Mutual labels: camera
Homebridge Unifi Protect
📹 Complete HomeKit integration for UniFi Protect with full support for most features including autoconfiguration, motion detection, and multiple controllers: https://homebridge.io
Stars: ✭ 335 (-3.74%)
Mutual labels: camera
Ypimagepicker
📸 Instagram-like image picker & filters for iOS
Stars: ✭ 3,661 (+952.01%)
Mutual labels: camera
Photo Booth
A multi-platform photo booth software using Electron and your camera
Stars: ✭ 324 (-6.9%)
Mutual labels: camera
Wallpaper
前言
我在 Google Play 上看到一个挺有意思的app:
Url : https://play.google.com/store/apps/details?id=com.m2c.studio.transparent.screen
看着有点酷的样子,试着实现以下.
最终实现效果
实现步骤
- AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.song.wallpaper">
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.SET_WALLPAPER"/>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<!-- 配置实时壁纸Service -->
<service android:label="@string/app_name"
android:name=".CameraLiveWallpaper"
android:permission="android.permission.BIND_WALLPAPER">
<!-- 为实时壁纸配置intent-filter -->
<intent-filter>
<action android:name="android.service.wallpaper.WallpaperService" />
</intent-filter>
<!-- 为实时壁纸配置meta-data -->
<meta-data android:name="android.service.wallpaper"
android:resource="@xml/livewallpaper" />
</service>
</application>
</manifest>
- 在res下面新建一个xml文件夹 然后新建一个livewallpaper.xml 内容如下:
<?xml version="1.0" encoding="utf-8"?>
<!-- ic_launcher 预览是显示的图片-->
<wallpaper
xmlns:android="http://schemas.android.com/apk/res/android"
android:thumbnail="@mipmap/ic_launcher"/>
- 实现动态壁纸的LiveWallpaper.java:
package com.song.wallpaper;
import android.hardware.Camera;
import android.service.wallpaper.WallpaperService;
import android.view.MotionEvent;
import android.view.SurfaceHolder;
import java.io.IOException;
public class CameraLiveWallpaper extends WallpaperService {
// 实现WallpaperService必须实现的抽象方法
public Engine onCreateEngine() {
// 返回自定义的CameraEngine
return new CameraEngine();
}
class CameraEngine extends Engine implements Camera.PreviewCallback {
private Camera camera;
@Override
public void onCreate(SurfaceHolder surfaceHolder) {
super.onCreate(surfaceHolder);
startPreview();
// 设置处理触摸事件
setTouchEventsEnabled(true);
}
@Override
public void onTouchEvent(MotionEvent event) {
super.onTouchEvent(event);
// 时间处理:点击拍照,长按拍照
}
@Override
public void onDestroy() {
super.onDestroy();
stopPreview();
}
@Override
public void onVisibilityChanged(boolean visible) {
if (visible) {
startPreview();
} else {
stopPreview();
}
}
/**
* 开始预览
*/
public void startPreview() {
camera = Camera.open();
camera.setDisplayOrientation(90);
try {
camera.setPreviewDisplay(getSurfaceHolder());
} catch (IOException e) {
e.printStackTrace();
}
camera.startPreview();
}
/**
* 停止预览
*/
public void stopPreview() {
if (camera != null) {
try {
camera.stopPreview();
camera.setPreviewCallback(null);
// camera.lock();
camera.release();
} catch (Exception e) {
e.printStackTrace();
}
camera = null;
}
}
@Override
public void onPreviewFrame(byte[] bytes, Camera camera) {
camera.addCallbackBuffer(bytes);
}
}
}
- 启动动态壁纸的MainActivity.java:
package com.song.wallpaper;
import android.Manifest;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
private static final int PERMISSIONS_REQUEST_CAMERA = 454;
private Context mContext;
static final String PERMISSION_CAMERA = Manifest.permission.CAMERA;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mContext = this;
findViewById(R.id.text)
.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
checkSelfPermission();
}
});
}
/**
* 检查权限
*/
void checkSelfPermission() {
if (ContextCompat.checkSelfPermission(mContext, PERMISSION_CAMERA) != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this,
new String[]{PERMISSION_CAMERA},
PERMISSIONS_REQUEST_CAMERA);
} else {
// setTransparentWallpaper();
startWallpaper();
}
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
switch (requestCode) {
case PERMISSIONS_REQUEST_CAMERA: {
// If request is cancelled, the result arrays are empty.
if (grantResults.length > 0
&& grantResults[0] == PackageManager.PERMISSION_GRANTED) {
// setTransparentWallpaper();
startWallpaper();
} else {
Toast.makeText(mContext, getString(R.string._lease_open_permissions), Toast.LENGTH_SHORT).show();
}
return;
}
}
}
/**
* 选择壁纸
*/
void startWallpaper() {
final Intent pickWallpaper = new Intent(Intent.ACTION_SET_WALLPAPER);
Intent chooser = Intent.createChooser(pickWallpaper, getString(R.string.choose_wallpaper));
startActivity(chooser);
}
/**
* 不需要手动启动服务
*/
void setTransparentWallpaper() {
startService(new Intent(mContext, CameraLiveWallpaper.class));
}
}
这样一个简单装逼神器出来了...
其他资料
- 壁纸
http://blog.csdn.net/t12x3456/article/details/7857741 https://www.diycode.cc/topics/334 http://www.qingpingshan.com/rjbc/az/232984.html http://mzh3344258.blog.51cto.com/1823534/806560/ https://my.oschina.net/u/1770617/blog/339881
- 相机
https://github.com/google/cameraview https://github.com/afollestad/material-camera
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].