创建仓库
15
.gitignore
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
*.iml
|
||||
.gradle
|
||||
/local.properties
|
||||
/.idea/caches
|
||||
/.idea/libraries
|
||||
/.idea/modules.xml
|
||||
/.idea/workspace.xml
|
||||
/.idea/navEditor.xml
|
||||
/.idea/assetWizardSettings.xml
|
||||
.DS_Store
|
||||
/build
|
||||
/captures
|
||||
.externalNativeBuild
|
||||
.cxx
|
||||
local.properties
|
||||
1
app/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/build
|
||||
60
app/build.gradle.kts
Normal file
@ -0,0 +1,60 @@
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Date
|
||||
|
||||
plugins {
|
||||
alias(libs.plugins.android.application)
|
||||
}
|
||||
val timestamp: String = SimpleDateFormat("MM_dd_HH_mm").format(Date())
|
||||
android {
|
||||
namespace = "com.keyboard.wallpaperkeyboard"
|
||||
compileSdk = 35
|
||||
|
||||
defaultConfig {
|
||||
applicationId = "com.keyboard.wallpaperkeyboard"
|
||||
minSdk = 23
|
||||
targetSdk = 35
|
||||
versionCode = 1
|
||||
versionName = "1.0.0"
|
||||
setProperty(
|
||||
"archivesBaseName",
|
||||
"Wallpaper Keyboard" + versionName + "(${versionCode})_$timestamp"
|
||||
)
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
buildFeatures {
|
||||
viewBinding = true
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
isMinifyEnabled = true
|
||||
proguardFiles(
|
||||
getDefaultProguardFile("proguard-android-optimize.txt"),
|
||||
"proguard-rules.pro"
|
||||
)
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility = JavaVersion.VERSION_11
|
||||
targetCompatibility = JavaVersion.VERSION_11
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
implementation(libs.appcompat)
|
||||
implementation(libs.material)
|
||||
implementation(libs.activity)
|
||||
implementation(libs.constraintlayout)
|
||||
testImplementation(libs.junit)
|
||||
androidTestImplementation(libs.ext.junit)
|
||||
androidTestImplementation(libs.espresso.core)
|
||||
|
||||
implementation("androidx.room:room-runtime:2.6.1")
|
||||
annotationProcessor("androidx.room:room-compiler:2.6.1")
|
||||
|
||||
implementation("com.github.bumptech.glide:glide:4.16.0")
|
||||
|
||||
implementation("com.github.omicronapps:7-Zip-JBinding-4Android:Release-16.02-2.02")
|
||||
}
|
||||
21
app/proguard-rules.pro
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
@ -0,0 +1,26 @@
|
||||
package com.keyboard.wallpaperkeyboard;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.test.platform.app.InstrumentationRegistry;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Instrumented test, which will execute on an Android device.
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class ExampleInstrumentedTest {
|
||||
@Test
|
||||
public void useAppContext() {
|
||||
// Context of the app under test.
|
||||
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
|
||||
assertEquals("com.keyboard.wallpaperkeyboard", appContext.getPackageName());
|
||||
}
|
||||
}
|
||||
57
app/src/main/AndroidManifest.xml
Normal file
@ -0,0 +1,57 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
|
||||
<application
|
||||
android:name=".MyApplication"
|
||||
android:allowBackup="true"
|
||||
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||
android:fullBackupContent="@xml/backup_rules"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.WallpaperKeyboard"
|
||||
tools:targetApi="31">
|
||||
<activity
|
||||
android:name=".ui.activity.WriteActivity"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".ui.activity.WallpaperActivity"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".ui.activity.SplashActivity"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".ui.activity.ListActivity"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".ui.activity.MainActivity"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<service
|
||||
android:name=".inputmethod.service.WallpaperKeyboardService"
|
||||
android:enabled="true"
|
||||
android:exported="true"
|
||||
android:label="@string/app_name"
|
||||
android:permission="android.permission.BIND_INPUT_METHOD">
|
||||
<intent-filter>
|
||||
<action android:name="android.view.InputMethod" />
|
||||
</intent-filter>
|
||||
|
||||
<meta-data
|
||||
android:name="android.view.im"
|
||||
android:resource="@xml/im" />
|
||||
</service>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
5555
app/src/main/assets/inputmethod.json
Normal file
@ -0,0 +1,48 @@
|
||||
package com.keyboard.wallpaperkeyboard;
|
||||
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
|
||||
import com.keyboard.wallpaperkeyboard.data.dao.WallpaperEntityDao;
|
||||
import com.keyboard.wallpaperkeyboard.data.database.AppDatabase;
|
||||
import com.keyboard.wallpaperkeyboard.data.entity.WallpaperEntity;
|
||||
import com.keyboard.wallpaperkeyboard.data.repository.WallpaperRepository;
|
||||
import com.keyboard.wallpaperkeyboard.util.JsonUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class MyApplication extends Application {
|
||||
public static MyApplication application;
|
||||
public static final int DB_VERSION = 1;
|
||||
public static final String DB_NAME = "keyboard_database";
|
||||
public static final String PREF_NAME = "app_preferences";
|
||||
public static final String KEY_FILE_PATH = "file_path";
|
||||
private static final String KEY_INITIALIZED = "is_database_initialized";
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
|
||||
application = this;
|
||||
|
||||
SharedPreferences preferences = getSharedPreferences(PREF_NAME, MODE_PRIVATE);
|
||||
boolean isDatabaseInitialized = preferences.getBoolean(KEY_INITIALIZED, false);
|
||||
|
||||
if (!isDatabaseInitialized) {
|
||||
initializeDatabase();
|
||||
preferences.edit().putBoolean(KEY_INITIALIZED, true).apply();
|
||||
}
|
||||
}
|
||||
|
||||
public static Context getContext() {
|
||||
return application.getApplicationContext();
|
||||
}
|
||||
|
||||
private void initializeDatabase() {
|
||||
WallpaperEntityDao wallpaperEntityDao = AppDatabase.getInstance(getContext()).wallpaperEntityDao();
|
||||
WallpaperRepository wallpaperRepository = new WallpaperRepository(wallpaperEntityDao);
|
||||
List<WallpaperEntity> wallpaperEntities = JsonUtils.parseJson(getContext(), "inputmethod.json");
|
||||
wallpaperRepository.insertAll(wallpaperEntities);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,5 @@
|
||||
package com.keyboard.wallpaperkeyboard.callback;
|
||||
|
||||
public interface DownloadAndUnzipCallback {
|
||||
void onResult(boolean success, String resultPath);
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
package com.keyboard.wallpaperkeyboard.callback;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
public interface DownloadCallback {
|
||||
void onDownloadCall(boolean success, File file) throws IOException;
|
||||
}
|
||||
@ -0,0 +1,5 @@
|
||||
package com.keyboard.wallpaperkeyboard.callback;
|
||||
|
||||
public interface UnzipCallback {
|
||||
void onUnzipCall(boolean success, String path);
|
||||
}
|
||||
@ -0,0 +1,31 @@
|
||||
package com.keyboard.wallpaperkeyboard.data.dao;
|
||||
|
||||
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.room.Dao;
|
||||
import androidx.room.Insert;
|
||||
import androidx.room.Query;
|
||||
import androidx.room.Update;
|
||||
|
||||
import com.keyboard.wallpaperkeyboard.data.entity.WallpaperEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Dao
|
||||
public interface WallpaperEntityDao {
|
||||
|
||||
@Insert
|
||||
void insertAll(List<WallpaperEntity> likeDataList);
|
||||
|
||||
@Update
|
||||
void update(WallpaperEntity wallpaperInfo);
|
||||
|
||||
@Query("SELECT * FROM WallpaperEntity WHERE islike = :isLike")
|
||||
LiveData<List<WallpaperEntity>> getLikeList(boolean isLike);
|
||||
|
||||
@Query("SELECT * FROM WallpaperEntity WHERE id IN (SELECT MIN(id) FROM WallpaperEntity GROUP BY className)")
|
||||
LiveData<List<WallpaperEntity>> getFirstWallpaper();
|
||||
|
||||
@Query("SELECT * FROM WallpaperEntity WHERE className = :name")
|
||||
LiveData<List<WallpaperEntity>> getCategoryByName(String name);
|
||||
}
|
||||
@ -0,0 +1,32 @@
|
||||
package com.keyboard.wallpaperkeyboard.data.database;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.room.Database;
|
||||
import androidx.room.Room;
|
||||
import androidx.room.RoomDatabase;
|
||||
|
||||
import com.keyboard.wallpaperkeyboard.MyApplication;
|
||||
import com.keyboard.wallpaperkeyboard.data.dao.WallpaperEntityDao;
|
||||
import com.keyboard.wallpaperkeyboard.data.entity.WallpaperEntity;
|
||||
|
||||
@Database(entities = {WallpaperEntity.class}, version = MyApplication.DB_VERSION, exportSchema = false)
|
||||
public abstract class AppDatabase extends RoomDatabase {
|
||||
|
||||
public abstract WallpaperEntityDao wallpaperEntityDao();
|
||||
|
||||
private static volatile AppDatabase INSTANCE;
|
||||
|
||||
public static AppDatabase getInstance(Context context) {
|
||||
if (INSTANCE == null) {
|
||||
synchronized (AppDatabase.class) {
|
||||
if (INSTANCE == null) {
|
||||
INSTANCE = Room.databaseBuilder(context.getApplicationContext(),
|
||||
AppDatabase.class, MyApplication.DB_NAME)
|
||||
.build();
|
||||
}
|
||||
}
|
||||
}
|
||||
return INSTANCE;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,84 @@
|
||||
package com.keyboard.wallpaperkeyboard.data.entity;
|
||||
|
||||
import androidx.room.Entity;
|
||||
import androidx.room.PrimaryKey;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Entity
|
||||
public class WallpaperEntity implements Serializable {
|
||||
|
||||
@PrimaryKey(autoGenerate = true)
|
||||
public int id;
|
||||
public String className;
|
||||
public String preview;
|
||||
public String thumb;
|
||||
public String title;
|
||||
public String zipUrl;
|
||||
public Boolean isLike;
|
||||
|
||||
public WallpaperEntity(String className, String preview, String thumb, String title, String zipUrl, Boolean isLike) {
|
||||
this.className = className;
|
||||
this.preview = preview;
|
||||
this.thumb = thumb;
|
||||
this.title = title;
|
||||
this.zipUrl = zipUrl;
|
||||
this.isLike = isLike;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getClassName() {
|
||||
return className;
|
||||
}
|
||||
|
||||
public void setClassName(String className) {
|
||||
this.className = className;
|
||||
}
|
||||
|
||||
public String getPreview() {
|
||||
return preview;
|
||||
}
|
||||
|
||||
public void setPreview(String preview) {
|
||||
this.preview = preview;
|
||||
}
|
||||
|
||||
public String getThumb() {
|
||||
return thumb;
|
||||
}
|
||||
|
||||
public void setThumb(String thumb) {
|
||||
this.thumb = thumb;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getZipUrl() {
|
||||
return zipUrl;
|
||||
}
|
||||
|
||||
public void setZipUrl(String zipUrl) {
|
||||
this.zipUrl = zipUrl;
|
||||
}
|
||||
|
||||
public Boolean getLike() {
|
||||
return isLike;
|
||||
}
|
||||
|
||||
public void setLike(Boolean like) {
|
||||
isLike = like;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
package com.keyboard.wallpaperkeyboard.data.repository;
|
||||
|
||||
public class PathRepository {
|
||||
public static String NORMAL_KEY_BACKGROUND = "btn_keyboard_key_normal_normal.9.png";
|
||||
public static String ACTION_KEY_BACKGROUND = "btn_keyboard_key_functional_normal.9.png";
|
||||
|
||||
public static String DELETE_ICON = "sym_keyboard_delete_normal.png";
|
||||
public static String SHIFT_ICON = "sym_keyboard_shift.png";
|
||||
public static String SHIFT_LOCK_ICON = "sym_keyboard_shift_locked.png";
|
||||
public static String RETURN_ICON = "sym_keyboard_return_normal.png";
|
||||
}
|
||||
|
||||
@ -0,0 +1,40 @@
|
||||
package com.keyboard.wallpaperkeyboard.data.repository;
|
||||
|
||||
import androidx.lifecycle.LiveData;
|
||||
|
||||
import com.keyboard.wallpaperkeyboard.data.dao.WallpaperEntityDao;
|
||||
import com.keyboard.wallpaperkeyboard.data.entity.WallpaperEntity;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
public class WallpaperRepository {
|
||||
private final WallpaperEntityDao wallpaperEntityDao;
|
||||
private final ExecutorService executorService;
|
||||
|
||||
public WallpaperRepository(WallpaperEntityDao wallpaperEntityDao) {
|
||||
this.wallpaperEntityDao = wallpaperEntityDao;
|
||||
this.executorService = Executors.newSingleThreadExecutor();
|
||||
}
|
||||
|
||||
public void insertAll(List<WallpaperEntity> wallpaperEntityList) {
|
||||
executorService.execute(() -> wallpaperEntityDao.insertAll(wallpaperEntityList));
|
||||
}
|
||||
|
||||
public void update(WallpaperEntity wallpaperEntity) {
|
||||
executorService.execute(() -> wallpaperEntityDao.update(wallpaperEntity));
|
||||
}
|
||||
|
||||
public LiveData<List<WallpaperEntity>> getLikeList(boolean isLike) {
|
||||
return wallpaperEntityDao.getLikeList(isLike);
|
||||
}
|
||||
|
||||
public LiveData<List<WallpaperEntity>> getFirstWallpaper() {
|
||||
return wallpaperEntityDao.getFirstWallpaper();
|
||||
}
|
||||
|
||||
public LiveData<List<WallpaperEntity>> getCategoryByName(String name) {
|
||||
return wallpaperEntityDao.getCategoryByName(name);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,171 @@
|
||||
package com.keyboard.wallpaperkeyboard.inputmethod.keyboardthem;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.Log;
|
||||
import android.util.Xml;
|
||||
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import com.keyboard.wallpaperkeyboard.R;
|
||||
import com.keyboard.wallpaperkeyboard.data.repository.PathRepository;
|
||||
import com.keyboard.wallpaperkeyboard.util.EnhancedFileUtil;
|
||||
|
||||
import org.xmlpull.v1.XmlPullParser;
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.StringReader;
|
||||
|
||||
public class WallpaperKeyboardThem {
|
||||
private Drawable actionBackgroundDrawable;
|
||||
private Drawable normalBackgroundDrawable;
|
||||
private Drawable shiftIconDrawable;
|
||||
private Drawable shiftLockIconDrawable;
|
||||
private Drawable deleteIconDrawable;
|
||||
private Drawable returnIconDrawable;
|
||||
private Drawable backgroundDrawable;
|
||||
|
||||
private int normalKeyColor;
|
||||
private int actionKeyColor;
|
||||
|
||||
private static final String COLOR_NORMAL_KEY_TEXT = "key_text_color_normal";
|
||||
private static final String COLOR_ACTION_KEY_TEXT = "key_text_color_functional";
|
||||
|
||||
private static final int DEFAULT_SHIFT_ICON = android.R.drawable.stat_sys_upload;
|
||||
private static final int DEFAULT_SHIFT_LOCK_ICON = android.R.drawable.stat_sys_upload;
|
||||
private static final int DEFAULT_DELETE_ICON = android.R.drawable.ic_input_delete;
|
||||
private static final int DEFAULT_RETURN_ICON = android.R.drawable.screen_background_light_transparent;
|
||||
private static final int DEFAULT_BACKGROUND_COLOR = R.color.black;
|
||||
|
||||
public WallpaperKeyboardThem(Context context) {
|
||||
shiftIconDrawable = ContextCompat.getDrawable(context, DEFAULT_SHIFT_ICON);
|
||||
shiftLockIconDrawable = ContextCompat.getDrawable(context, DEFAULT_SHIFT_LOCK_ICON);
|
||||
deleteIconDrawable = ContextCompat.getDrawable(context, DEFAULT_DELETE_ICON);
|
||||
returnIconDrawable = ContextCompat.getDrawable(context, DEFAULT_RETURN_ICON);
|
||||
backgroundDrawable = ContextCompat.getDrawable(context, DEFAULT_BACKGROUND_COLOR);
|
||||
normalKeyColor = ContextCompat.getColor(context, R.color.white);
|
||||
actionKeyColor = normalKeyColor;
|
||||
}
|
||||
|
||||
public Drawable getBackgroundDrawable() {
|
||||
return backgroundDrawable;
|
||||
}
|
||||
|
||||
public Drawable getActionBackgroundDrawable() {
|
||||
return actionBackgroundDrawable;
|
||||
}
|
||||
|
||||
public Drawable getNormalBackgroundDrawable() {
|
||||
return normalBackgroundDrawable;
|
||||
}
|
||||
|
||||
public Drawable getDeleteIconDrawable() {
|
||||
return deleteIconDrawable;
|
||||
}
|
||||
|
||||
public Drawable getShiftIconDrawable() {
|
||||
return shiftIconDrawable;
|
||||
}
|
||||
|
||||
public Drawable getReturnIconDrawable() {
|
||||
return returnIconDrawable;
|
||||
}
|
||||
|
||||
public Drawable getShiftLockIconDrawable() {
|
||||
return shiftLockIconDrawable;
|
||||
}
|
||||
|
||||
public int getNormalKeyColor() {
|
||||
return normalKeyColor;
|
||||
}
|
||||
|
||||
public int getActionKeyColor() {
|
||||
return actionKeyColor;
|
||||
}
|
||||
|
||||
public void updateBackground(Context con) {
|
||||
String resDirPath = getWallpaperPath(con);
|
||||
if (!resDirPath.isEmpty()) {
|
||||
updateKeyColors(resDirPath);
|
||||
backgroundDrawable = getKeyboardBackground(con, resDirPath);
|
||||
returnIconDrawable = getDrawableForKeyBackground(con, resDirPath, PathRepository.RETURN_ICON);
|
||||
normalBackgroundDrawable = getDrawableForKeyBackground(con, resDirPath, PathRepository.NORMAL_KEY_BACKGROUND);
|
||||
actionBackgroundDrawable = getDrawableForKeyBackground(con, resDirPath, PathRepository.ACTION_KEY_BACKGROUND);
|
||||
deleteIconDrawable = getDrawableForKeyBackground(con, resDirPath, PathRepository.DELETE_ICON);
|
||||
shiftIconDrawable = getDrawableForKeyBackground(con, resDirPath, PathRepository.SHIFT_ICON);
|
||||
shiftLockIconDrawable = getDrawableForKeyBackground(con, resDirPath, PathRepository.SHIFT_LOCK_ICON);
|
||||
}
|
||||
}
|
||||
|
||||
private Drawable getKeyboardBackground(Context context, String resourceDirectoryPath) {
|
||||
String filePath = resourceDirectoryPath + "/drawable-xxhdpi-v4/keyboard_background.jpg";
|
||||
return loadDrawableFromFile(context, filePath);
|
||||
}
|
||||
|
||||
private Drawable getDrawableForKeyBackground(Context context, String resourceDirectoryPath, String drawableName) {
|
||||
String drawablePath = "/drawable-xhdpi-v4/" + drawableName;
|
||||
return loadDrawableFromFile(context, resourceDirectoryPath + drawablePath);
|
||||
}
|
||||
|
||||
private void updateKeyColors(String resDirPath) {
|
||||
String colorXmlPath = resDirPath + "/colors.xml";
|
||||
File colorXmlFile = new File(colorXmlPath);
|
||||
|
||||
if (!colorXmlFile.exists()) {
|
||||
Log.w("updateKeyColors", "File not found: " + colorXmlPath);
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
XmlPullParser parser = Xml.newPullParser();
|
||||
String fileContent = EnhancedFileUtil.readFileToString(colorXmlFile);
|
||||
parser.setInput(new StringReader(fileContent));
|
||||
|
||||
int eventType = parser.getEventType();
|
||||
while (eventType != XmlPullParser.END_DOCUMENT) {
|
||||
if (eventType == XmlPullParser.START_TAG) {
|
||||
String tagName = parser.getName();
|
||||
if ("color".equals(tagName) || "item".equals(tagName)) {
|
||||
String attributeName = parser.getAttributeValue(null, "name");
|
||||
String colorValue = parser.nextText();
|
||||
if (colorValue != null && !colorValue.trim().isEmpty()) {
|
||||
if (COLOR_NORMAL_KEY_TEXT.equals(attributeName)) {
|
||||
normalKeyColor = Color.parseColor(colorValue);
|
||||
} else if (COLOR_ACTION_KEY_TEXT.equals(attributeName)) {
|
||||
actionKeyColor = Color.parseColor(colorValue);
|
||||
}
|
||||
} else {
|
||||
Log.w("updateKeyColors", "Invalid color value for: " + attributeName);
|
||||
}
|
||||
}
|
||||
}
|
||||
eventType = parser.next();
|
||||
}
|
||||
} catch (XmlPullParserException | IOException e) {
|
||||
Log.e("updateKeyColors", "Error parsing colors XML", e);
|
||||
}
|
||||
}
|
||||
|
||||
private Drawable loadDrawableFromFile(Context context, String filePath) {
|
||||
File file = new File(filePath);
|
||||
if (file.exists()) {
|
||||
return new BitmapDrawable(context.getResources(), BitmapFactory.decodeFile(filePath));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private String getWallpaperPath(Context context) {
|
||||
SharedPreferences prefs = context.getSharedPreferences("keyboard_info", Context.MODE_PRIVATE);
|
||||
String path = prefs.getString("wallpaper_path", "");
|
||||
if (path.isEmpty()) {
|
||||
Log.w("KeyboardThemeManager", "Wallpaper path is empty.");
|
||||
}
|
||||
return path;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,135 @@
|
||||
package com.keyboard.wallpaperkeyboard.inputmethod.keyboardview;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.inputmethodservice.Keyboard;
|
||||
import android.inputmethodservice.KeyboardView;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
import com.keyboard.wallpaperkeyboard.inputmethod.keyboardthem.WallpaperKeyboardThem;
|
||||
import com.keyboard.wallpaperkeyboard.util.DrawableUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class WallpaperKeyboardView extends KeyboardView{
|
||||
private final Paint mPaint;
|
||||
private final WallpaperKeyboardThem wallpaperKeyboardThem;
|
||||
private ShiftState shiftState = ShiftState.NORMAL;
|
||||
|
||||
private static final float TEXT_SIZE_NORMAL = 18f;
|
||||
private static final float TEXT_SIZE_LARGE = 20f;
|
||||
|
||||
public WallpaperKeyboardView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
wallpaperKeyboardThem = new WallpaperKeyboardThem(context);
|
||||
mPaint = new Paint();
|
||||
mPaint.setTextSize(DrawableUtils.spToPx(TEXT_SIZE_LARGE, context));
|
||||
setPreviewEnabled(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDraw(Canvas canvas) {
|
||||
List<Keyboard.Key> keys = getKeyboard().getKeys();
|
||||
|
||||
for (Keyboard.Key key : keys) {
|
||||
int keyCode = key.codes[0];
|
||||
setPaintColor(keyCode);
|
||||
|
||||
Drawable keyBackground = getKeyBackgroundDrawable(keyCode);
|
||||
if (keyBackground != null) {
|
||||
drawKeyBackground(key, keyBackground, canvas);
|
||||
}
|
||||
|
||||
switch (keyCode) {
|
||||
case Keyboard.KEYCODE_SHIFT:
|
||||
DrawableUtils.drawKeyIcon(key, getShiftDrawable(), canvas, this);
|
||||
break;
|
||||
|
||||
case Keyboard.KEYCODE_DELETE:
|
||||
DrawableUtils.drawKeyIcon(key, wallpaperKeyboardThem.getDeleteIconDrawable(), canvas, this);
|
||||
drawKeyLabel(key, canvas);
|
||||
break;
|
||||
|
||||
case Keyboard.KEYCODE_DONE:
|
||||
DrawableUtils.drawKeyIcon(key, wallpaperKeyboardThem.getReturnIconDrawable(), canvas, this);
|
||||
break;
|
||||
|
||||
default:
|
||||
drawKeyLabel(key, canvas);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void setPaintColor(int keyCode) {
|
||||
if (isActionKey(keyCode)) {
|
||||
mPaint.setColor(wallpaperKeyboardThem.getActionKeyColor());
|
||||
} else {
|
||||
mPaint.setColor(wallpaperKeyboardThem.getNormalKeyColor());
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isActionKey(int keyCode) {
|
||||
return keyCode == Keyboard.KEYCODE_SHIFT || keyCode == Keyboard.KEYCODE_DELETE ||
|
||||
keyCode == Keyboard.KEYCODE_MODE_CHANGE || keyCode == Keyboard.KEYCODE_DONE
|
||||
|| keyCode == -1000 || keyCode == 32;
|
||||
}
|
||||
|
||||
private Drawable getKeyBackgroundDrawable(int keyCode) {
|
||||
if (isActionKey(keyCode)) {
|
||||
return wallpaperKeyboardThem.getActionBackgroundDrawable();
|
||||
} else {
|
||||
return wallpaperKeyboardThem.getNormalBackgroundDrawable();
|
||||
}
|
||||
}
|
||||
|
||||
private Drawable getShiftDrawable() {
|
||||
if (shiftState == ShiftState.NORMAL) {
|
||||
return wallpaperKeyboardThem.getShiftIconDrawable();
|
||||
} else if (shiftState == ShiftState.CAPS) {
|
||||
return wallpaperKeyboardThem.getShiftLockIconDrawable();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void drawKeyBackground(Keyboard.Key key, Drawable keyBackground, Canvas canvas) {
|
||||
if (keyBackground != null) {
|
||||
int left = key.x + getPaddingLeft();
|
||||
int top = key.y + getPaddingTop();
|
||||
int right = left + key.width;
|
||||
int bottom = top + key.height;
|
||||
|
||||
keyBackground.setBounds(left, top, right, bottom);
|
||||
keyBackground.setState(key.getCurrentDrawableState());
|
||||
keyBackground.draw(canvas);
|
||||
}
|
||||
}
|
||||
|
||||
private void drawKeyLabel(Keyboard.Key key, Canvas canvas) {
|
||||
if (key.label != null && !key.label.toString().isEmpty()) {
|
||||
float xPos = key.x + getPaddingLeft() + (key.width / 2f);
|
||||
float yPos = key.y + key.height / 2f - (mPaint.descent() + mPaint.ascent()) / 2f;
|
||||
xPos -= mPaint.measureText(key.label.toString()) / 2f;
|
||||
|
||||
mPaint.setTextSize(DrawableUtils.spToPx(TEXT_SIZE_NORMAL, this.getContext()));
|
||||
canvas.drawText(key.label.toString(), xPos, yPos, mPaint);
|
||||
}
|
||||
}
|
||||
|
||||
public void updateKeyboardView(Context context) {
|
||||
wallpaperKeyboardThem.updateBackground(context);
|
||||
setBackground(wallpaperKeyboardThem.getBackgroundDrawable());
|
||||
invalidateAllKeys();
|
||||
}
|
||||
|
||||
public enum ShiftState {
|
||||
NORMAL, CAPS
|
||||
}
|
||||
|
||||
public void setShiftState(ShiftState state) {
|
||||
this.shiftState = state;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,168 @@
|
||||
package com.keyboard.wallpaperkeyboard.inputmethod.service;
|
||||
|
||||
import android.inputmethodservice.InputMethodService;
|
||||
import android.inputmethodservice.Keyboard;
|
||||
import android.inputmethodservice.KeyboardView;
|
||||
import android.view.View;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.view.inputmethod.InputConnection;
|
||||
|
||||
import com.keyboard.wallpaperkeyboard.R;
|
||||
import com.keyboard.wallpaperkeyboard.inputmethod.keyboardview.WallpaperKeyboardView;
|
||||
|
||||
public class WallpaperKeyboardService extends InputMethodService implements KeyboardView.OnKeyboardActionListener{
|
||||
private Keyboard keyboardLowercase;
|
||||
private Keyboard keyboardUppercase;
|
||||
private Keyboard keyboardSymbols;
|
||||
private Keyboard keyboardMoreSymbols;
|
||||
private Keyboard currentKeyboard;
|
||||
|
||||
private WallpaperKeyboardView wallpaperKeyboardView;
|
||||
|
||||
private static final int KEYCODE_MORE_SYMBOLS = -1000;
|
||||
|
||||
@Override
|
||||
public View onCreateInputView() {
|
||||
wallpaperKeyboardView = (WallpaperKeyboardView) getLayoutInflater().inflate(R.layout.wallpaper_keyboard_view, null, false);
|
||||
|
||||
initializeKeyboards();
|
||||
setUpCustomKeyboardView();
|
||||
|
||||
return wallpaperKeyboardView;
|
||||
}
|
||||
|
||||
private void initializeKeyboards() {
|
||||
keyboardLowercase = new Keyboard(this, R.xml.keyboard_lowercase);
|
||||
keyboardUppercase = new Keyboard(this, R.xml.keyboard_uppercase);
|
||||
keyboardSymbols = new Keyboard(this, R.xml.keyboard_symbols);
|
||||
keyboardMoreSymbols = new Keyboard(this, R.xml.keyboard_more_symbols);
|
||||
|
||||
currentKeyboard = keyboardLowercase;
|
||||
}
|
||||
|
||||
private void setUpCustomKeyboardView() {
|
||||
wallpaperKeyboardView.setKeyboard(currentKeyboard);
|
||||
wallpaperKeyboardView.setOnKeyboardActionListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWindowShown() {
|
||||
super.onWindowShown();
|
||||
updateKeyboardBackground(); // 更新背景
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onKey(int primaryCode, int[] keyCodes) {
|
||||
InputConnection inputConnection = getCurrentInputConnection();
|
||||
if (inputConnection == null) return;
|
||||
|
||||
switch (primaryCode) {
|
||||
case Keyboard.KEYCODE_DELETE:
|
||||
handleDelete(inputConnection);
|
||||
break;
|
||||
|
||||
case Keyboard.KEYCODE_SHIFT:
|
||||
toggleCaseMode();
|
||||
break;
|
||||
|
||||
case Keyboard.KEYCODE_MODE_CHANGE:
|
||||
toggleKeyboardLayout();
|
||||
break;
|
||||
|
||||
case Keyboard.KEYCODE_DONE:
|
||||
performActionBasedOnEditorInfo(inputConnection);
|
||||
break;
|
||||
|
||||
case KEYCODE_MORE_SYMBOLS:
|
||||
toggleMoreSymbolsKeyboard();
|
||||
break;
|
||||
|
||||
default:
|
||||
handleCharacterInput(primaryCode, inputConnection);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void handleDelete(InputConnection inputConnection) {
|
||||
inputConnection.deleteSurroundingText(1, 0);
|
||||
}
|
||||
|
||||
private void toggleCaseMode() {
|
||||
if (currentKeyboard == keyboardLowercase) {
|
||||
switchToNewKeyboard(keyboardUppercase);
|
||||
wallpaperKeyboardView.setShiftState(WallpaperKeyboardView.ShiftState.CAPS);
|
||||
} else {
|
||||
switchToNewKeyboard(keyboardLowercase);
|
||||
wallpaperKeyboardView.setShiftState(WallpaperKeyboardView.ShiftState.NORMAL);
|
||||
}
|
||||
}
|
||||
|
||||
private void toggleKeyboardLayout() {
|
||||
if (currentKeyboard == keyboardLowercase || currentKeyboard == keyboardUppercase) {
|
||||
switchToNewKeyboard(keyboardSymbols);
|
||||
} else if (currentKeyboard == keyboardSymbols || currentKeyboard == keyboardMoreSymbols) {
|
||||
switchToNewKeyboard(keyboardLowercase);
|
||||
}
|
||||
}
|
||||
|
||||
private void switchToNewKeyboard(Keyboard newKeyboard) {
|
||||
if (currentKeyboard != newKeyboard) {
|
||||
currentKeyboard = newKeyboard;
|
||||
wallpaperKeyboardView.setKeyboard(currentKeyboard);
|
||||
updateKeyboardBackground();
|
||||
}
|
||||
}
|
||||
|
||||
private void performActionBasedOnEditorInfo(InputConnection inputConnection) {
|
||||
EditorInfo editorInfo = getCurrentInputEditorInfo();
|
||||
if ((editorInfo.imeOptions & EditorInfo.IME_ACTION_SEARCH) != 0) {
|
||||
inputConnection.performEditorAction(EditorInfo.IME_ACTION_SEARCH);
|
||||
} else if ((editorInfo.imeOptions & EditorInfo.IME_ACTION_DONE) != 0) {
|
||||
inputConnection.performEditorAction(EditorInfo.IME_ACTION_DONE);
|
||||
} else {
|
||||
inputConnection.performEditorAction(EditorInfo.IME_ACTION_UNSPECIFIED);
|
||||
}
|
||||
}
|
||||
|
||||
private void toggleMoreSymbolsKeyboard() {
|
||||
switchToNewKeyboard(currentKeyboard == keyboardSymbols ? keyboardMoreSymbols : keyboardSymbols);
|
||||
}
|
||||
|
||||
private void handleCharacterInput(int primaryCode, InputConnection inputConnection) {
|
||||
char code = (char) primaryCode;
|
||||
inputConnection.commitText(String.valueOf(code), 1);
|
||||
}
|
||||
|
||||
private void updateKeyboardBackground() {
|
||||
wallpaperKeyboardView.updateKeyboardView(this);
|
||||
wallpaperKeyboardView.invalidate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPress(int primaryCode) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRelease(int primaryCode) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onText(CharSequence text) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void swipeLeft() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void swipeRight() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void swipeDown() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void swipeUp() {
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,81 @@
|
||||
package com.keyboard.wallpaperkeyboard.ui.activity;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.activity.EdgeToEdge;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.graphics.Insets;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.WindowInsetsCompat;
|
||||
import androidx.lifecycle.Observer;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
|
||||
import com.keyboard.wallpaperkeyboard.R;
|
||||
import com.keyboard.wallpaperkeyboard.data.entity.WallpaperEntity;
|
||||
import com.keyboard.wallpaperkeyboard.databinding.ActivityListBinding;
|
||||
import com.keyboard.wallpaperkeyboard.ui.adapter.InputMethodAdapter;
|
||||
import com.keyboard.wallpaperkeyboard.ui.viewmodel.WallpaperViewModel;
|
||||
import com.keyboard.wallpaperkeyboard.util.ItemDecoration;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ListActivity extends AppCompatActivity {
|
||||
private ActivityListBinding binding;
|
||||
private InputMethodAdapter adapter;
|
||||
private WallpaperViewModel wallpaperViewModel;
|
||||
private String name;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
EdgeToEdge.enable(this);
|
||||
binding = ActivityListBinding.inflate(getLayoutInflater());
|
||||
setContentView(binding.getRoot());
|
||||
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
|
||||
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
|
||||
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
|
||||
return insets;
|
||||
});
|
||||
|
||||
initData();
|
||||
initEvent();
|
||||
}
|
||||
|
||||
private void initData() {
|
||||
name = getIntent().getStringExtra("name");
|
||||
if (name == null) {
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
|
||||
wallpaperViewModel = new ViewModelProvider(this).get(WallpaperViewModel.class);
|
||||
|
||||
binding.recyclerView.setLayoutManager(new GridLayoutManager(this, 1));
|
||||
|
||||
adapter = new InputMethodAdapter(wallpaperViewModel, this, new ArrayList<>(), this, 1);
|
||||
binding.recyclerView.setAdapter(adapter);
|
||||
|
||||
ItemDecoration itemDecoration = new ItemDecoration(20, 15, 20);
|
||||
binding.recyclerView.addItemDecoration(itemDecoration);
|
||||
}
|
||||
|
||||
private void initEvent() {
|
||||
binding.back.setOnClickListener(view -> finish());
|
||||
binding.title.setText(name);
|
||||
|
||||
getCategoryByClassName();
|
||||
}
|
||||
|
||||
private void getCategoryByClassName() {
|
||||
wallpaperViewModel
|
||||
.getCategoryByName(name)
|
||||
.observe(this, new Observer<List<WallpaperEntity>>() {
|
||||
@Override
|
||||
public void onChanged(List<WallpaperEntity> wallpaperEntities) {
|
||||
adapter.updateData(wallpaperEntities);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,112 @@
|
||||
package com.keyboard.wallpaperkeyboard.ui.activity;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
|
||||
import androidx.activity.EdgeToEdge;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.core.graphics.Insets;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.WindowInsetsCompat;
|
||||
|
||||
import com.google.android.material.tabs.TabLayout;
|
||||
import com.google.android.material.tabs.TabLayoutMediator;
|
||||
import com.keyboard.wallpaperkeyboard.R;
|
||||
import com.keyboard.wallpaperkeyboard.databinding.ActivityMainBinding;
|
||||
import com.keyboard.wallpaperkeyboard.databinding.MainItemCustomBinding;
|
||||
import com.keyboard.wallpaperkeyboard.ui.adapter.MainViewPager2Adapter;
|
||||
|
||||
public class MainActivity extends AppCompatActivity {
|
||||
private ActivityMainBinding binding;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
EdgeToEdge.enable(this);
|
||||
binding = ActivityMainBinding.inflate(getLayoutInflater());
|
||||
setContentView(binding.getRoot());
|
||||
|
||||
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
|
||||
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
|
||||
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
|
||||
return insets;
|
||||
});
|
||||
|
||||
initData();
|
||||
initEvent();
|
||||
}
|
||||
|
||||
private void initData() {
|
||||
MainViewPager2Adapter adapter = new MainViewPager2Adapter(this);
|
||||
binding.mainViewpager2.setAdapter(adapter);
|
||||
}
|
||||
|
||||
private void initEvent() {
|
||||
new TabLayoutMediator(binding.mainTabLayout, binding.mainViewpager2, (tab, position) -> {
|
||||
MainItemCustomBinding mainItemCustomBinding = MainItemCustomBinding.inflate(LayoutInflater.from(this));
|
||||
tab.setCustomView(mainItemCustomBinding.getRoot());
|
||||
setTab(mainItemCustomBinding, position);
|
||||
}).attach();
|
||||
|
||||
binding.mainTabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
|
||||
@Override
|
||||
public void onTabSelected(TabLayout.Tab tab) {
|
||||
updateTab(tab, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTabUnselected(TabLayout.Tab tab) {
|
||||
updateTab(tab, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTabReselected(TabLayout.Tab tab) {
|
||||
}
|
||||
|
||||
private void updateTab(TabLayout.Tab tab, boolean isSelected) {
|
||||
if (tab.getCustomView() != null) {
|
||||
MainItemCustomBinding mainItemCustomBinding = MainItemCustomBinding.bind(tab.getCustomView());
|
||||
|
||||
int iconResId = getIconResource(tab.getPosition(), isSelected);
|
||||
mainItemCustomBinding.image.setImageResource(iconResId);
|
||||
|
||||
int textColor = isSelected ? R.color.blue : R.color.black;
|
||||
mainItemCustomBinding.text.setTextColor(ContextCompat.getColor(MainActivity.this, textColor));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void setTab(MainItemCustomBinding mainCustomBinding, int position) {
|
||||
int iconResId = getIconResource(position, false);
|
||||
int textColorResId = R.color.black;
|
||||
|
||||
switch (position) {
|
||||
case 0:
|
||||
mainCustomBinding.text.setText("Home");
|
||||
iconResId = R.drawable.home;
|
||||
textColorResId = R.color.blue;
|
||||
break;
|
||||
case 1:
|
||||
mainCustomBinding.text.setText("Collection");
|
||||
break;
|
||||
}
|
||||
|
||||
mainCustomBinding.image.setImageResource(iconResId);
|
||||
mainCustomBinding.text.setTextColor(ContextCompat.getColor(this, textColorResId));
|
||||
}
|
||||
|
||||
private int getIconResource(int position, boolean isSelected) {
|
||||
if (position == 1) {
|
||||
return isSelected ? R.drawable.collection : R.drawable.un_collection;
|
||||
}
|
||||
return isSelected ? R.drawable.home : R.drawable.un_home;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
binding = null;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,26 @@
|
||||
package com.keyboard.wallpaperkeyboard.ui.activity;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.activity.EdgeToEdge;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.graphics.Insets;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.WindowInsetsCompat;
|
||||
|
||||
import com.keyboard.wallpaperkeyboard.R;
|
||||
|
||||
public class SplashActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
EdgeToEdge.enable(this);
|
||||
setContentView(R.layout.activity_splash);
|
||||
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
|
||||
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
|
||||
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
|
||||
return insets;
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,169 @@
|
||||
package com.keyboard.wallpaperkeyboard.ui.activity;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.activity.EdgeToEdge;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.graphics.Insets;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.WindowInsetsCompat;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.load.resource.bitmap.CenterCrop;
|
||||
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.keyboard.wallpaperkeyboard.MyApplication;
|
||||
import com.keyboard.wallpaperkeyboard.R;
|
||||
import com.keyboard.wallpaperkeyboard.callback.DownloadAndUnzipCallback;
|
||||
import com.keyboard.wallpaperkeyboard.data.entity.WallpaperEntity;
|
||||
import com.keyboard.wallpaperkeyboard.databinding.ActivityWallpaperBinding;
|
||||
import com.keyboard.wallpaperkeyboard.ui.adapter.InputMethodAdapter;
|
||||
import com.keyboard.wallpaperkeyboard.ui.viewmodel.WallpaperViewModel;
|
||||
import com.keyboard.wallpaperkeyboard.util.FileDownloadAndUnzipUtil;
|
||||
import com.keyboard.wallpaperkeyboard.util.ItemDecoration;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class WallpaperActivity extends AppCompatActivity {
|
||||
private ActivityWallpaperBinding binding;
|
||||
private WallpaperViewModel wallpaperViewModel;
|
||||
private WallpaperEntity wallpaperEntity;
|
||||
private String title;
|
||||
private String zipUrl;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
binding = ActivityWallpaperBinding.inflate(getLayoutInflater());
|
||||
setContentView(binding.getRoot());
|
||||
|
||||
EdgeToEdge.enable(this);
|
||||
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
|
||||
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
|
||||
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
|
||||
return insets;
|
||||
});
|
||||
|
||||
initData();
|
||||
initEvent();
|
||||
}
|
||||
|
||||
private void initData() {
|
||||
wallpaperEntity = (WallpaperEntity) getIntent().getSerializableExtra("wallpaper");
|
||||
|
||||
if (wallpaperEntity == null) {
|
||||
showToast("Wallpaper is empty!");
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
|
||||
wallpaperViewModel = new ViewModelProvider(this).get(WallpaperViewModel.class);
|
||||
|
||||
title = wallpaperEntity.getTitle();
|
||||
zipUrl = wallpaperEntity.getZipUrl();
|
||||
|
||||
InputMethodAdapter inputMethodAdapter = new InputMethodAdapter(wallpaperViewModel, this, new ArrayList<>(), this, 1);
|
||||
binding.recyclerView.setAdapter(inputMethodAdapter);
|
||||
binding.recyclerView.setLayoutManager(new GridLayoutManager(this, 2));
|
||||
binding.recyclerView.addItemDecoration(new ItemDecoration(20, 15, 20));
|
||||
|
||||
if (wallpaperEntity.getPreview() != null) {
|
||||
loadImage();
|
||||
} else {
|
||||
showToast("Wallpaper is empty!");
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
private void initEvent() {
|
||||
binding.back.setOnClickListener(v -> finish());
|
||||
binding.downloadApply.setOnClickListener(v -> downloadAndUnzip());
|
||||
binding.like.setOnClickListener(v -> toggleLike());
|
||||
binding.home.setOnClickListener(v -> jumpToMainActivity());
|
||||
|
||||
binding.title.setText(title);
|
||||
|
||||
setLike();
|
||||
}
|
||||
|
||||
private void downloadAndUnzip() {
|
||||
showView();
|
||||
|
||||
FileDownloadAndUnzipUtil.downloadAndUnzipFile(WallpaperActivity.this, zipUrl, new DownloadAndUnzipCallback() {
|
||||
@Override
|
||||
public void onResult(boolean success, String resultPath) {
|
||||
if (success) {
|
||||
SharedPreferences preferences = getSharedPreferences(MyApplication.PREF_NAME, MODE_PRIVATE);
|
||||
preferences.edit().putString(MyApplication.KEY_FILE_PATH, resultPath).apply();
|
||||
hideView();
|
||||
showToast("Wallpaper applied successfully!");
|
||||
jumpToWriteActivity();
|
||||
} else {
|
||||
hideView();
|
||||
showToast("Failed to apply wallpaper!");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void loadImage() {
|
||||
RequestOptions options = new RequestOptions()
|
||||
.placeholder(R.mipmap.placeholder)
|
||||
.error(R.mipmap.placeholder)
|
||||
.transform(new CenterCrop())
|
||||
.transform(new RoundedCorners(16));
|
||||
|
||||
Glide.with(this)
|
||||
.load(wallpaperEntity.getPreview())
|
||||
.apply(options)
|
||||
.into(binding.imageView);
|
||||
}
|
||||
|
||||
private void setLike() {
|
||||
binding.like.setImageResource(wallpaperEntity.getLike() ? R.drawable.like : R.drawable.un_like);
|
||||
}
|
||||
|
||||
private void toggleLike() {
|
||||
boolean newStatus = !wallpaperEntity.getLike();
|
||||
wallpaperEntity.setLike(newStatus);
|
||||
wallpaperViewModel.update(wallpaperEntity);
|
||||
setLike();
|
||||
}
|
||||
|
||||
private void jumpToMainActivity() {
|
||||
Intent intent = new Intent(WallpaperActivity.this, MainActivity.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
private void jumpToWriteActivity() {
|
||||
Intent intent = new Intent(WallpaperActivity.this, WriteActivity.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
private void showToast(String message) {
|
||||
Toast.makeText(WallpaperActivity.this, message, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
private void showView(){
|
||||
binding.progressBar.setVisibility(View.VISIBLE);
|
||||
binding.view.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
private void hideView(){
|
||||
binding.progressBar.setVisibility(View.GONE);
|
||||
binding.view.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
binding = null;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,26 @@
|
||||
package com.keyboard.wallpaperkeyboard.ui.activity;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.activity.EdgeToEdge;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.graphics.Insets;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.WindowInsetsCompat;
|
||||
|
||||
import com.keyboard.wallpaperkeyboard.R;
|
||||
|
||||
public class WriteActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
EdgeToEdge.enable(this);
|
||||
setContentView(R.layout.activity_write);
|
||||
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
|
||||
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
|
||||
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
|
||||
return insets;
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,126 @@
|
||||
package com.keyboard.wallpaperkeyboard.ui.adapter;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
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.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
|
||||
import com.keyboard.wallpaperkeyboard.R;
|
||||
import com.keyboard.wallpaperkeyboard.data.entity.WallpaperEntity;
|
||||
import com.keyboard.wallpaperkeyboard.ui.activity.ListActivity;
|
||||
import com.keyboard.wallpaperkeyboard.ui.activity.WallpaperActivity;
|
||||
import com.keyboard.wallpaperkeyboard.ui.viewmodel.WallpaperViewModel;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class InputMethodAdapter extends RecyclerView.Adapter<InputMethodAdapter.ViewHolder> {
|
||||
private final WallpaperViewModel wallpaperViewModel;
|
||||
private final Context context;
|
||||
private List<WallpaperEntity> wallpaperEntries;
|
||||
private final Activity activity;
|
||||
private final int type;
|
||||
|
||||
public InputMethodAdapter(WallpaperViewModel wallpaperViewModel, Context context, List<WallpaperEntity> wallpaperEntries, Activity activity, int type) {
|
||||
this.wallpaperViewModel = wallpaperViewModel;
|
||||
this.context = context;
|
||||
this.wallpaperEntries = wallpaperEntries;
|
||||
this.activity = activity;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public void updateData(List<WallpaperEntity> newWallpaperEntries) {
|
||||
this.wallpaperEntries = newWallpaperEntries;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(context).inflate(R.layout.item_keyboard, parent, false);
|
||||
return new ViewHolder(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(ViewHolder holder, int position) {
|
||||
WallpaperEntity wallpaperEntity = wallpaperEntries.get(position);
|
||||
holder.bind(wallpaperEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return wallpaperEntries.size();
|
||||
}
|
||||
|
||||
public class ViewHolder extends RecyclerView.ViewHolder {
|
||||
private final ImageView imageView;
|
||||
private final ImageView favorite;
|
||||
private final TextView title;
|
||||
|
||||
public ViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
imageView = itemView.findViewById(R.id.item_image_view);
|
||||
favorite = itemView.findViewById(R.id.item_like);
|
||||
title = itemView.findViewById(R.id.item_title);
|
||||
}
|
||||
|
||||
public void bind(WallpaperEntity wallpaperEntity) {
|
||||
String imagePath = wallpaperEntity.getPreview();
|
||||
loadImage(imagePath);
|
||||
|
||||
if (type == 0) {
|
||||
title.setText(wallpaperEntity.getClassName());
|
||||
favorite.setVisibility(View.GONE);
|
||||
} else {
|
||||
title.setText(wallpaperEntity.getTitle());
|
||||
setFavoriteButton(wallpaperEntity);
|
||||
}
|
||||
|
||||
setClickListeners(wallpaperEntity);
|
||||
}
|
||||
|
||||
private void loadImage(String imagePath) {
|
||||
Glide.with(context)
|
||||
.load(imagePath)
|
||||
.transform(new RoundedCorners(16))
|
||||
.error(R.mipmap.placeholder)
|
||||
.placeholder(R.mipmap.placeholder)
|
||||
.into(imageView);
|
||||
}
|
||||
|
||||
private void setFavoriteButton(WallpaperEntity wallpaperEntity) {
|
||||
favorite.setImageResource(wallpaperEntity.getLike() ? R.drawable.like : R.drawable.un_like);
|
||||
}
|
||||
|
||||
private void setClickListeners(WallpaperEntity wallpaperEntity) {
|
||||
imageView.setOnClickListener(view -> {
|
||||
Intent intent;
|
||||
if (type == 0) {
|
||||
intent = new Intent(activity, ListActivity.class);
|
||||
intent.putExtra("name", wallpaperEntity.getClassName());
|
||||
} else {
|
||||
intent = new Intent(activity, WallpaperActivity.class);
|
||||
intent.putExtra("wallpaper", wallpaperEntity);
|
||||
}
|
||||
activity.startActivity(intent);
|
||||
});
|
||||
|
||||
favorite.setOnClickListener(view -> toggleLike(wallpaperEntity));
|
||||
}
|
||||
|
||||
private void toggleLike(WallpaperEntity wallpaperEntity) {
|
||||
boolean newStatus = !wallpaperEntity.getLike();
|
||||
wallpaperEntity.setLike(newStatus);
|
||||
wallpaperViewModel.update(wallpaperEntity);
|
||||
notifyItemChanged(getAdapterPosition());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,33 @@
|
||||
package com.keyboard.wallpaperkeyboard.ui.adapter;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.viewpager2.adapter.FragmentStateAdapter;
|
||||
|
||||
import com.keyboard.wallpaperkeyboard.ui.fragment.CollectionFragment;
|
||||
import com.keyboard.wallpaperkeyboard.ui.fragment.HomeFragment;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class MainViewPager2Adapter extends FragmentStateAdapter {
|
||||
private final List<Fragment> fragmentList = new ArrayList<>();
|
||||
|
||||
public MainViewPager2Adapter(@NonNull FragmentActivity fragmentActivity) {
|
||||
super(fragmentActivity);
|
||||
fragmentList.add(new HomeFragment());
|
||||
fragmentList.add(new CollectionFragment());
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Fragment createFragment(int position) {
|
||||
return fragmentList.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return fragmentList.size();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,132 @@
|
||||
package com.keyboard.wallpaperkeyboard.ui.dialog;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.database.ContentObserver;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.provider.Settings;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
|
||||
import com.keyboard.wallpaperkeyboard.MyApplication;
|
||||
import com.keyboard.wallpaperkeyboard.R;
|
||||
import com.keyboard.wallpaperkeyboard.databinding.SelectDialogBinding;
|
||||
import com.keyboard.wallpaperkeyboard.util.InputMethodUtils;
|
||||
|
||||
public class SelectInputMethodDialog extends DialogFragment {
|
||||
private SelectDialogBinding binding;
|
||||
private InputMethodManager inputMethodManager;
|
||||
private ContentObserver contentObserver;
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setCancelable(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
binding = SelectDialogBinding.inflate(inflater, container, false);
|
||||
initEvent();
|
||||
return binding.getRoot();
|
||||
}
|
||||
|
||||
public void initEvent() {
|
||||
inputMethodManager = (InputMethodManager) MyApplication.application.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
|
||||
loadImage();
|
||||
|
||||
binding.firstSelect.setOnClickListener(v -> jumpToSetting());
|
||||
|
||||
binding.secondSelect.setOnClickListener(v -> inputMethodManager.showInputMethodPicker());
|
||||
|
||||
binding.imageView.setOnClickListener(v -> dismiss());
|
||||
|
||||
contentObserver = new ContentObserver(new Handler(Looper.getMainLooper())) {
|
||||
@Override
|
||||
public void onChange(boolean selfChange) {
|
||||
super.onChange(selfChange);
|
||||
if (InputMethodUtils.isInputMethodEnabled() && InputMethodUtils.isCurrentInputMethodActive()) {
|
||||
dismiss();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
requireContext().getContentResolver().registerContentObserver(
|
||||
Settings.Secure.getUriFor(Settings.Secure.DEFAULT_INPUT_METHOD),
|
||||
false,
|
||||
contentObserver
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStop() {
|
||||
super.onStop();
|
||||
if (contentObserver != null) {
|
||||
requireContext().getContentResolver().unregisterContentObserver(contentObserver);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
|
||||
configureDialogWindow();
|
||||
updateDialogState();
|
||||
}
|
||||
|
||||
private void loadImage() {
|
||||
Glide.with(requireContext())
|
||||
.load(R.mipmap.ic_launcher_round)
|
||||
.transform(new RoundedCorners(16))
|
||||
.into(binding.imageView);
|
||||
}
|
||||
|
||||
private void jumpToSetting() {
|
||||
Intent intent = new Intent(Settings.ACTION_INPUT_METHOD_SETTINGS);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
private void configureDialogWindow() {
|
||||
if (getDialog() != null && getDialog().getWindow() != null) {
|
||||
Window window = getDialog().getWindow();
|
||||
window.setLayout((int) (getResources().getDisplayMetrics().widthPixels * 0.9), WindowManager.LayoutParams.WRAP_CONTENT);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateDialogState() {
|
||||
boolean isInputMethodEnabled = InputMethodUtils.isInputMethodEnabled();
|
||||
boolean isCurrentInputMethodActive = InputMethodUtils.isCurrentInputMethodActive();
|
||||
|
||||
binding.firstSelect.setClickable(!isInputMethodEnabled);
|
||||
binding.firstSelect.setSelected(isInputMethodEnabled);
|
||||
|
||||
binding.secondSelect.setSelected(isCurrentInputMethodActive);
|
||||
|
||||
if (isInputMethodEnabled && isCurrentInputMethodActive) {
|
||||
dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
binding = null;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,71 @@
|
||||
package com.keyboard.wallpaperkeyboard.ui.fragment;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.Observer;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.StaggeredGridLayoutManager;
|
||||
|
||||
import com.keyboard.wallpaperkeyboard.data.entity.WallpaperEntity;
|
||||
import com.keyboard.wallpaperkeyboard.databinding.FragmentCollectionBinding;
|
||||
import com.keyboard.wallpaperkeyboard.databinding.FragmentHomeBinding;
|
||||
import com.keyboard.wallpaperkeyboard.ui.adapter.InputMethodAdapter;
|
||||
import com.keyboard.wallpaperkeyboard.ui.viewmodel.WallpaperViewModel;
|
||||
import com.keyboard.wallpaperkeyboard.util.ItemDecoration;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class CollectionFragment extends Fragment {
|
||||
private FragmentCollectionBinding binding;
|
||||
private InputMethodAdapter adapter;
|
||||
private WallpaperViewModel wallpaperViewModel;
|
||||
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
binding = FragmentCollectionBinding.inflate(inflater, container, false);
|
||||
initData();
|
||||
initEvent();
|
||||
return binding.getRoot();
|
||||
}
|
||||
|
||||
private void initData() {
|
||||
wallpaperViewModel = new ViewModelProvider(this).get(WallpaperViewModel.class);
|
||||
|
||||
binding.recyclerView.setLayoutManager(new GridLayoutManager(getContext(),1));
|
||||
|
||||
adapter = new InputMethodAdapter(wallpaperViewModel, requireContext(), new ArrayList<>(), requireActivity(), 1);
|
||||
binding.recyclerView.setAdapter(adapter);
|
||||
|
||||
ItemDecoration itemDecoration = new ItemDecoration(20, 15, 20);
|
||||
binding.recyclerView.addItemDecoration(itemDecoration);
|
||||
}
|
||||
|
||||
private void initEvent() {
|
||||
loadFirstWallpaper();
|
||||
}
|
||||
|
||||
private void loadFirstWallpaper() {
|
||||
wallpaperViewModel
|
||||
.getLikeList(true)
|
||||
.observe(getViewLifecycleOwner(), new Observer<List<WallpaperEntity>>() {
|
||||
@Override
|
||||
public void onChanged(List<WallpaperEntity> wallpaperEntities) {
|
||||
adapter.updateData(wallpaperEntities);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
binding = null;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,70 @@
|
||||
package com.keyboard.wallpaperkeyboard.ui.fragment;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.Observer;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.StaggeredGridLayoutManager;
|
||||
|
||||
import com.keyboard.wallpaperkeyboard.data.entity.WallpaperEntity;
|
||||
import com.keyboard.wallpaperkeyboard.databinding.FragmentHomeBinding;
|
||||
import com.keyboard.wallpaperkeyboard.ui.adapter.InputMethodAdapter;
|
||||
import com.keyboard.wallpaperkeyboard.ui.viewmodel.WallpaperViewModel;
|
||||
import com.keyboard.wallpaperkeyboard.util.ItemDecoration;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class HomeFragment extends Fragment {
|
||||
private FragmentHomeBinding binding;
|
||||
private InputMethodAdapter adapter;
|
||||
private WallpaperViewModel wallpaperViewModel;
|
||||
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
binding = FragmentHomeBinding.inflate(inflater, container, false);
|
||||
initData();
|
||||
initEvent();
|
||||
return binding.getRoot();
|
||||
}
|
||||
|
||||
private void initData() {
|
||||
wallpaperViewModel = new ViewModelProvider(this).get(WallpaperViewModel.class);
|
||||
|
||||
binding.recyclerView.setLayoutManager(new GridLayoutManager(getContext(),1));
|
||||
|
||||
adapter = new InputMethodAdapter(wallpaperViewModel, requireContext(), new ArrayList<>(), requireActivity(), 0);
|
||||
binding.recyclerView.setAdapter(adapter);
|
||||
|
||||
ItemDecoration itemDecoration = new ItemDecoration(20, 15, 20);
|
||||
binding.recyclerView.addItemDecoration(itemDecoration);
|
||||
}
|
||||
|
||||
private void initEvent() {
|
||||
loadFirstWallpaper();
|
||||
}
|
||||
|
||||
private void loadFirstWallpaper() {
|
||||
wallpaperViewModel
|
||||
.getFirstWallpaper()
|
||||
.observe(getViewLifecycleOwner(), new Observer<List<WallpaperEntity>>() {
|
||||
@Override
|
||||
public void onChanged(List<WallpaperEntity> wallpaperEntities) {
|
||||
adapter.updateData(wallpaperEntities);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
binding = null;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,40 @@
|
||||
package com.keyboard.wallpaperkeyboard.ui.viewmodel;
|
||||
|
||||
import android.app.Application;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.AndroidViewModel;
|
||||
import androidx.lifecycle.LiveData;
|
||||
|
||||
import com.keyboard.wallpaperkeyboard.data.dao.WallpaperEntityDao;
|
||||
import com.keyboard.wallpaperkeyboard.data.database.AppDatabase;
|
||||
import com.keyboard.wallpaperkeyboard.data.entity.WallpaperEntity;
|
||||
import com.keyboard.wallpaperkeyboard.data.repository.WallpaperRepository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class WallpaperViewModel extends AndroidViewModel {
|
||||
private final WallpaperRepository wallpaperRepository;
|
||||
|
||||
public WallpaperViewModel(@NonNull Application application) {
|
||||
super(application);
|
||||
WallpaperEntityDao wallpaperInfoDao = AppDatabase.getInstance(application).wallpaperEntityDao();
|
||||
wallpaperRepository = new WallpaperRepository(wallpaperInfoDao);
|
||||
}
|
||||
|
||||
public void update(WallpaperEntity wallpaperEntity) {
|
||||
wallpaperRepository.update(wallpaperEntity);
|
||||
}
|
||||
|
||||
public LiveData<List<WallpaperEntity>> getLikeList(boolean isLike) {
|
||||
return wallpaperRepository.getLikeList(isLike);
|
||||
}
|
||||
|
||||
public LiveData<List<WallpaperEntity>> getFirstWallpaper() {
|
||||
return wallpaperRepository.getFirstWallpaper();
|
||||
}
|
||||
|
||||
public LiveData<List<WallpaperEntity>> getCategoryByName(String name) {
|
||||
return wallpaperRepository.getCategoryByName(name);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,55 @@
|
||||
package com.keyboard.wallpaperkeyboard.util;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.inputmethodservice.Keyboard;
|
||||
import android.util.TypedValue;
|
||||
|
||||
import com.keyboard.wallpaperkeyboard.inputmethod.keyboardview.WallpaperKeyboardView;
|
||||
|
||||
public class DrawableUtils {
|
||||
|
||||
public static void drawKeyIcon(Keyboard.Key currentKey,
|
||||
Drawable drawKeyIcon,
|
||||
Canvas myCanvas,
|
||||
WallpaperKeyboardView wallpaperKeyboardView) {
|
||||
currentKey.icon = drawKeyIcon;
|
||||
currentKey.icon.setBounds(getIconBounds(currentKey, drawKeyIcon, wallpaperKeyboardView));
|
||||
currentKey.icon.draw(myCanvas);
|
||||
}
|
||||
|
||||
private static Rect getIconBounds(Keyboard.Key currentKey,
|
||||
Drawable drawKeyIcon,
|
||||
WallpaperKeyboardView wallpaperKeyboardView) {
|
||||
float icon_w = drawKeyIcon.getIntrinsicWidth();
|
||||
float icon_h = drawKeyIcon.getIntrinsicHeight();
|
||||
float icon_wr = icon_w / currentKey.width;
|
||||
float icon_hr = icon_h / currentKey.height;
|
||||
|
||||
float tep1, tep2;
|
||||
if (icon_wr > icon_hr) {
|
||||
tep2 = icon_wr;
|
||||
tep1 = Math.max(icon_wr, 0.5f);
|
||||
} else {
|
||||
tep2 = icon_hr;
|
||||
tep1 = Math.max(icon_hr, 0.5f);
|
||||
}
|
||||
|
||||
icon_h = (icon_h / tep2) * tep1;
|
||||
icon_w = (icon_w / tep2) * tep1;
|
||||
|
||||
int top = (int) (currentKey.y + wallpaperKeyboardView.getPaddingTop() + (currentKey.height - icon_h) / 2);
|
||||
int left = (int) (currentKey.x + wallpaperKeyboardView.getPaddingLeft() + (currentKey.width - icon_w) / 2);
|
||||
int bottom = top + (int) icon_h;
|
||||
int right = left + (int) icon_w;
|
||||
|
||||
return new Rect(left, top, right, bottom);
|
||||
}
|
||||
|
||||
public static float spToPx(Float values, Context context) {
|
||||
return TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, values, context.getResources().getDisplayMetrics());
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,49 @@
|
||||
package com.keyboard.wallpaperkeyboard.util;
|
||||
|
||||
import android.os.Build;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
import java.nio.file.Files;
|
||||
|
||||
public class EnhancedFileUtil {
|
||||
public static void copyFile(File sourceFile, File destinationFile) throws IOException {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
try (InputStream in = Files.newInputStream(sourceFile.toPath());
|
||||
OutputStream out = Files.newOutputStream(destinationFile.toPath())) {
|
||||
copyStream(in, out);
|
||||
}
|
||||
} else {
|
||||
try (InputStream in = new FileInputStream(sourceFile);
|
||||
OutputStream out = new FileOutputStream(destinationFile)) {
|
||||
copyStream(in, out);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static String readFileToString(File file) throws IOException {
|
||||
try (FileInputStream fileInputStream = new FileInputStream(file);
|
||||
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(fileInputStream))) {
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
String line;
|
||||
while ((line = bufferedReader.readLine()) != null) {
|
||||
stringBuilder.append(line);
|
||||
}
|
||||
return stringBuilder.toString();
|
||||
}
|
||||
}
|
||||
|
||||
private static void copyStream(InputStream in, OutputStream out) throws IOException {
|
||||
byte[] buffer = new byte[1024];
|
||||
int bytesRead;
|
||||
while ((bytesRead = in.read(buffer)) != -1) {
|
||||
out.write(buffer, 0, bytesRead);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,144 @@
|
||||
package com.keyboard.wallpaperkeyboard.util;
|
||||
|
||||
import android.content.Context;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.load.DataSource;
|
||||
import com.bumptech.glide.load.engine.GlideException;
|
||||
import com.bumptech.glide.request.RequestListener;
|
||||
import com.bumptech.glide.request.target.Target;
|
||||
import com.keyboard.wallpaperkeyboard.callback.DownloadAndUnzipCallback;
|
||||
import com.keyboard.wallpaperkeyboard.callback.DownloadCallback;
|
||||
import com.keyboard.wallpaperkeyboard.callback.UnzipCallback;
|
||||
|
||||
import net.sf.sevenzipjbinding.ArchiveFormat;
|
||||
import net.sf.sevenzipjbinding.IInArchive;
|
||||
import net.sf.sevenzipjbinding.SevenZip;
|
||||
import net.sf.sevenzipjbinding.impl.RandomAccessFileInStream;
|
||||
import net.sf.sevenzipjbinding.impl.RandomAccessFileOutStream;
|
||||
import net.sf.sevenzipjbinding.simple.ISimpleInArchiveItem;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.RandomAccessFile;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class FileDownloadAndUnzipUtil {
|
||||
private static final Logger LOGGER = Logger.getLogger(FileDownloadAndUnzipUtil.class.getName());
|
||||
|
||||
public static void downloadAndUnzipFile(Context context, String url, DownloadAndUnzipCallback callback) {
|
||||
downloadFile(context, url, new DownloadCallback() {
|
||||
@Override
|
||||
public void onDownloadCall(boolean success, File file) {
|
||||
if (success) {
|
||||
try {
|
||||
unzipFile(context, file, new UnzipCallback() {
|
||||
@Override
|
||||
public void onUnzipCall(boolean success, String path) {
|
||||
callback.onResult(success, path);
|
||||
}
|
||||
});
|
||||
} catch (IOException e) {
|
||||
LOGGER.log(Level.SEVERE, "An error occurred while unzipping the file", e);
|
||||
callback.onResult(false, null);
|
||||
}
|
||||
} else {
|
||||
callback.onResult(false, null);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static void downloadFile(Context context, String url, DownloadCallback callback) {
|
||||
Glide.with(context)
|
||||
.asFile()
|
||||
.load(url)
|
||||
.listener(new RequestListener<File>() {
|
||||
@Override
|
||||
public boolean onLoadFailed(@Nullable GlideException e, @Nullable Object model, @NonNull Target<File> target, boolean isFirstResource) {
|
||||
try {
|
||||
callback.onDownloadCall(false, null);
|
||||
} catch (IOException ex) {
|
||||
LOGGER.log(Level.SEVERE, "Download failed callback error", ex);
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onResourceReady(@NonNull File resource, @NonNull Object model, Target<File> target, @NonNull DataSource dataSource, boolean isFirstResource) {
|
||||
try {
|
||||
File externalDir = context.getExternalFilesDir(null);
|
||||
if (externalDir == null) {
|
||||
externalDir = context.getFilesDir();
|
||||
}
|
||||
|
||||
File downloadDir = new File(externalDir, "DownloadedFiles");
|
||||
if (!downloadDir.exists()) {
|
||||
boolean mkdirs = downloadDir.mkdirs();
|
||||
}
|
||||
|
||||
File destinationFile = new File(downloadDir, resource.getName());
|
||||
EnhancedFileUtil.copyFile(resource, destinationFile);
|
||||
|
||||
callback.onDownloadCall(true, destinationFile);
|
||||
LOGGER.log(Level.INFO, "resource: " + destinationFile);
|
||||
} catch (IOException e) {
|
||||
LOGGER.log(Level.SEVERE, "Download success Processing error", e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}).preload();
|
||||
}
|
||||
|
||||
private static void unzipFile(Context context, File resource, UnzipCallback callback) throws IOException {
|
||||
if (!resource.exists()) {
|
||||
Toast.makeText(context, "error", Toast.LENGTH_SHORT).show();
|
||||
callback.onUnzipCall(false, null);
|
||||
return;
|
||||
}
|
||||
String itemFilePath = "";
|
||||
|
||||
File externalDir = context.getExternalFilesDir(null);
|
||||
if (externalDir == null) {
|
||||
externalDir = context.getFilesDir();
|
||||
}
|
||||
|
||||
String extractPath = new File(externalDir, "ExtractedFiles").getAbsolutePath();
|
||||
|
||||
RandomAccessFile accessFile = new RandomAccessFile(resource, "r");
|
||||
RandomAccessFileInStream inStream = new RandomAccessFileInStream(accessFile);
|
||||
IInArchive iInArchive = SevenZip.openInArchive(ArchiveFormat.SEVEN_ZIP, inStream);
|
||||
ISimpleInArchiveItem[] archiveItems = iInArchive.getSimpleInterface().getArchiveItems();
|
||||
|
||||
for (ISimpleInArchiveItem simple : archiveItems) {
|
||||
File file = new File(extractPath, simple.getPath());
|
||||
if (!simple.isFolder()) {
|
||||
RandomAccessFileOutStream outStream = new RandomAccessFileOutStream(new RandomAccessFile(file, "rw"));
|
||||
simple.extractSlow(outStream);
|
||||
itemFilePath = file.getPath();
|
||||
LOGGER.log(Level.INFO, "path: " + itemFilePath);
|
||||
} else {
|
||||
boolean mkdirs = file.mkdirs();
|
||||
}
|
||||
}
|
||||
|
||||
inStream.close();
|
||||
iInArchive.close();
|
||||
|
||||
int res = itemFilePath.indexOf("res");
|
||||
if (res != -1) {
|
||||
String substring = itemFilePath.substring(0, res + 3);
|
||||
LOGGER.log(Level.INFO, "substring: " + substring);
|
||||
callback.onUnzipCall(true, substring);
|
||||
} else {
|
||||
callback.onUnzipCall(false, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,31 @@
|
||||
package com.keyboard.wallpaperkeyboard.util;
|
||||
|
||||
import android.content.Context;
|
||||
import android.provider.Settings;
|
||||
import android.view.inputmethod.InputMethodInfo;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
|
||||
import com.key.vibekeyboard.MyApplication;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class InputMethodUtils {
|
||||
private static final InputMethodManager methodManager =
|
||||
(InputMethodManager) MyApplication.instance.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
|
||||
public static boolean isInputMethodEnabled() {
|
||||
List<InputMethodInfo> enabledInputMethods = methodManager.getEnabledInputMethodList();
|
||||
for (InputMethodInfo inputMethodInfo : enabledInputMethods) {
|
||||
if (inputMethodInfo.getId().startsWith(MyApplication.instance.getPackageName())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isCurrentInputMethodActive() {
|
||||
String currentInputMethod = Settings.Secure.getString(MyApplication.instance.getContentResolver(), Settings.Secure.DEFAULT_INPUT_METHOD);
|
||||
return currentInputMethod != null && currentInputMethod.startsWith(MyApplication.instance.getPackageName());
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,74 @@
|
||||
package com.keyboard.wallpaperkeyboard.util;
|
||||
|
||||
import android.graphics.Rect;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.recyclerview.widget.StaggeredGridLayoutManager;
|
||||
|
||||
import com.keyboard.wallpaperkeyboard.MyApplication;
|
||||
|
||||
public class ItemDecoration extends RecyclerView.ItemDecoration {
|
||||
private final int v;
|
||||
private final int h;
|
||||
private final int ex;
|
||||
|
||||
public ItemDecoration(int v, int h, int ex) {
|
||||
this.v = Math.round(dpToPx(v));
|
||||
this.h = Math.round(dpToPx(h));
|
||||
this.ex = Math.round(dpToPx(ex));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getItemOffsets(@NonNull Rect outRect, @NonNull View view, @NonNull RecyclerView parent, @NonNull RecyclerView.State state) {
|
||||
super.getItemOffsets(outRect, view, parent, state);
|
||||
int spanCount = 1;
|
||||
int spanSize = 1;
|
||||
int spanIndex = 0;
|
||||
|
||||
int childAdapterPosition = parent.getChildAdapterPosition(view);
|
||||
RecyclerView.LayoutManager layoutManager = parent.getLayoutManager();
|
||||
if (layoutManager instanceof StaggeredGridLayoutManager) {
|
||||
StaggeredGridLayoutManager staggeredGridLayoutManager = (StaggeredGridLayoutManager) layoutManager;
|
||||
StaggeredGridLayoutManager.LayoutParams layoutParams = (StaggeredGridLayoutManager.LayoutParams) view.getLayoutParams();
|
||||
spanCount = staggeredGridLayoutManager.getSpanCount();
|
||||
if (layoutParams.isFullSpan()) {
|
||||
spanSize = spanCount;
|
||||
}
|
||||
spanIndex = layoutParams.getSpanIndex();
|
||||
} else if (layoutManager instanceof GridLayoutManager) {
|
||||
GridLayoutManager gridLayoutManager = (GridLayoutManager) layoutManager;
|
||||
GridLayoutManager.LayoutParams layoutParams = (GridLayoutManager.LayoutParams) view.getLayoutParams();
|
||||
spanCount = gridLayoutManager.getSpanCount();
|
||||
spanSize = gridLayoutManager.getSpanSizeLookup().getSpanSize(childAdapterPosition);
|
||||
spanIndex = layoutParams.getSpanIndex();
|
||||
} else if (layoutManager instanceof LinearLayoutManager) {
|
||||
outRect.left = v;
|
||||
outRect.right = v;
|
||||
outRect.bottom = h;
|
||||
}
|
||||
|
||||
if (spanSize == spanCount) {
|
||||
outRect.left = v + ex;
|
||||
outRect.right = v + ex;
|
||||
|
||||
} else {
|
||||
int itemAllSpacing = (v * (spanCount + 1) + ex * 2) / spanCount;
|
||||
int left = v * (spanIndex + 1) - itemAllSpacing * spanIndex + ex;
|
||||
int right = itemAllSpacing - left;
|
||||
outRect.left = left;
|
||||
outRect.right = right;
|
||||
|
||||
}
|
||||
outRect.bottom = h;
|
||||
|
||||
}
|
||||
|
||||
public static float dpToPx(float dpValue) {
|
||||
float density = MyApplication.getContext().getResources().getDisplayMetrics().density;
|
||||
return density * dpValue + 0.5f;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,68 @@
|
||||
package com.keyboard.wallpaperkeyboard.util;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.keyboard.wallpaperkeyboard.data.entity.WallpaperEntity;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class JsonUtils {
|
||||
|
||||
private static String loadJSONFromAsset(Context context, String fileName) {
|
||||
StringBuilder jsonString = new StringBuilder();
|
||||
try {
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(
|
||||
context.getAssets().open(fileName)));
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
jsonString.append(line);
|
||||
}
|
||||
reader.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return jsonString.toString();
|
||||
}
|
||||
|
||||
public static List<WallpaperEntity> parseJson(Context context, String fileName) {
|
||||
List<WallpaperEntity> wallPaperList = new ArrayList<>();
|
||||
try {
|
||||
String jsonString = loadJSONFromAsset(context, fileName);
|
||||
if (jsonString.isEmpty()) {
|
||||
throw new IllegalArgumentException("JSON file is empty or invalid.");
|
||||
}
|
||||
|
||||
JSONArray jsonArray = new JSONArray(jsonString);
|
||||
|
||||
for (int i = 0; i < jsonArray.length(); i++) {
|
||||
JSONObject categoryObject = jsonArray.getJSONObject(i);
|
||||
|
||||
String classname = categoryObject.getString("className");
|
||||
|
||||
JSONArray listArray = categoryObject.getJSONArray("list");
|
||||
|
||||
for (int j = 0; j < listArray.length(); j++) {
|
||||
JSONObject itemObject = listArray.getJSONObject(j);
|
||||
|
||||
String preview = itemObject.getString("preview");
|
||||
String thumb = itemObject.getString("thumb");
|
||||
String title = itemObject.getString("title");
|
||||
String zipUrl = itemObject.getString("zipUrl");
|
||||
|
||||
wallPaperList.add(new WallpaperEntity(classname, preview, thumb, title, zipUrl, false));
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return wallPaperList;
|
||||
}
|
||||
}
|
||||
30
app/src/main/res/drawable-v24/ic_launcher_foreground.xml
Normal file
@ -0,0 +1,30 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:aapt="http://schemas.android.com/aapt"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
<filePath android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
|
||||
<aapt:attr name="android:fillColor">
|
||||
<gradient
|
||||
android:endX="85.84757"
|
||||
android:endY="92.4963"
|
||||
android:startX="42.9492"
|
||||
android:startY="49.59793"
|
||||
android:type="linear">
|
||||
<item
|
||||
android:color="#44000000"
|
||||
android:offset="0.0" />
|
||||
<item
|
||||
android:color="#00000000"
|
||||
android:offset="1.0" />
|
||||
</gradient>
|
||||
</aapt:attr>
|
||||
</filePath>
|
||||
<filePath
|
||||
android:fillColor="#FFFFFF"
|
||||
android:fillType="nonZero"
|
||||
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
|
||||
android:strokeWidth="1"
|
||||
android:strokeColor="#00000000" />
|
||||
</vector>
|
||||
9
app/src/main/res/drawable/back.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="32dp"
|
||||
android:height="32dp"
|
||||
android:viewportWidth="1024"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:pathData="M512,0c282.3,0 512,229.7 512,512s-229.7,512 -512,512S0,794.3 0,512 229.7,0 512,0zM512,960c247,0 448,-201 448,-448S759,64 512,64 64,264.9 64,512s201,448 448,448zM768,479.9a32,32 0,0 1,0 64L333.2,543.9l137.4,137.4a32,32 0,0 1,-45.3 45.3l-192,-192a32,32 0,0 1,0 -45.3l192,-192a32,32 0,0 1,45.3 45.3L333.3,479.9L768,479.9z"
|
||||
android:fillColor="#1890FF"/>
|
||||
</vector>
|
||||
9
app/src/main/res/drawable/collection.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="16dp"
|
||||
android:height="16dp"
|
||||
android:viewportWidth="1024"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:pathData="M854,512l0,-342 -214,0 0,342 106,-64zM854,86q34,0 59,25t25,59l0,512q0,34 -25,60t-59,26l-512,0q-34,0 -60,-26t-26,-60l0,-512q0,-34 26,-59t60,-25l512,0zM170,256l0,598 598,0 0,84 -598,0q-34,0 -59,-25t-25,-59l0,-598 84,0z"
|
||||
android:fillColor="#444444"/>
|
||||
</vector>
|
||||
9
app/src/main/res/drawable/download.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="32dp"
|
||||
android:height="32dp"
|
||||
android:viewportWidth="1024"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:pathData="M271.6,912.6h480.9c84,0 152.3,-68.3 152.3,-152.3L904.7,273.6c0,-84 -68.3,-152.3 -152.3,-152.3L271.6,121.3c-84,0 -152.3,68.3 -152.3,152.3v486.7c0,84 68.3,152.3 152.3,152.3zM328.1,375.6a30.8,30.8 0,0 1,43.5 -0.2L481.3,484.4L481.3,292.1c0,-16.9 13.8,-30.7 30.7,-30.7s30.7,13.8 30.7,30.7L542.7,485.9l109.5,-111.3a30.7,30.7 0,0 1,21.9 -9.2c7.8,0 15.6,2.9 21.6,8.8 12.1,11.9 12.2,31.3 0.4,43.5l-160.7,163.4a30.7,30.7 0,0 1,-21.7 9.2c-8.4,-0.1 -16,-3.2 -21.8,-8.9L328.3,419c-12,-12 -12.1,-31.4 -0.2,-43.5zM343.1,685.2L681,685.2c16.9,0 30.7,13.8 30.7,30.7s-13.8,30.7 -30.7,30.7L343.1,746.6c-16.9,0 -30.7,-13.8 -30.7,-30.7s13.7,-30.7 30.7,-30.7z"
|
||||
android:fillColor="#505587"/>
|
||||
</vector>
|
||||
9
app/src/main/res/drawable/home.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="36dp"
|
||||
android:height="32dp"
|
||||
android:viewportWidth="1152"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M1082,458.3l-122,-99.7v-154.8a12,12 0,0 0,-12 -12h-40a12,12 0,0 0,-12 12v102.7L616.4,78.3a64.3,64.3 0,0 0,-80.8 0L70,458.3a16,16 0,0 0,-2.3 22.5l20.2,24.8a16,16 0,0 0,22.4 2.4L192,441.2v486a32,32 0,0 0,32 32h256a32,32 0,0 0,32 -32v-256l128,0.6L640,928a32,32 0,0 0,32 32l256,-0.7a32,32 0,0 0,32 -32L960,441.2L1041.7,508a16,16 0,0 0,22.5 -2.3l20.2,-24.8a16,16 0,0 0,-2.4 -22.5zM895.8,895.5h0.2l-192,0.6L704,639.8a32.1,32.1 0,0 0,-31.9 -32l-192,-0.5a32,32 0,0 0,-32.1 32v256.3L256,895.5L256,389L576,127.9l320,261.1z"/>
|
||||
</vector>
|
||||
9
app/src/main/res/drawable/home_white.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="36dp"
|
||||
android:height="32dp"
|
||||
android:viewportWidth="1152"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:fillColor="#FFF"
|
||||
android:pathData="M1082,458.3l-122,-99.7v-154.8a12,12 0,0 0,-12 -12h-40a12,12 0,0 0,-12 12v102.7L616.4,78.3a64.3,64.3 0,0 0,-80.8 0L70,458.3a16,16 0,0 0,-2.3 22.5l20.2,24.8a16,16 0,0 0,22.4 2.4L192,441.2v486a32,32 0,0 0,32 32h256a32,32 0,0 0,32 -32v-256l128,0.6L640,928a32,32 0,0 0,32 32l256,-0.7a32,32 0,0 0,32 -32L960,441.2L1041.7,508a16,16 0,0 0,22.5 -2.3l20.2,-24.8a16,16 0,0 0,-2.4 -22.5zM895.8,895.5h0.2l-192,0.6L704,639.8a32.1,32.1 0,0 0,-31.9 -32l-192,-0.5a32,32 0,0 0,-32.1 32v256.3L256,895.5L256,389L576,127.9l320,261.1z"/>
|
||||
</vector>
|
||||
170
app/src/main/res/drawable/ic_launcher_background.xml
Normal file
@ -0,0 +1,170 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
<filePath
|
||||
android:fillColor="#3DDC84"
|
||||
android:pathData="M0,0h108v108h-108z" />
|
||||
<filePath
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M9,0L9,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<filePath
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,0L19,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<filePath
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M29,0L29,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<filePath
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M39,0L39,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<filePath
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M49,0L49,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<filePath
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M59,0L59,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<filePath
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M69,0L69,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<filePath
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M79,0L79,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<filePath
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M89,0L89,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<filePath
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M99,0L99,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<filePath
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,9L108,9"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<filePath
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,19L108,19"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<filePath
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,29L108,29"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<filePath
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,39L108,39"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<filePath
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,49L108,49"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<filePath
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,59L108,59"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<filePath
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,69L108,69"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<filePath
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,79L108,79"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<filePath
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,89L108,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<filePath
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,99L108,99"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<filePath
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,29L89,29"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<filePath
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,39L89,39"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<filePath
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,49L89,49"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<filePath
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,59L89,59"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<filePath
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,69L89,69"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<filePath
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,79L89,79"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<filePath
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M29,19L29,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<filePath
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M39,19L39,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<filePath
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M49,19L49,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<filePath
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M59,19L59,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<filePath
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M69,19L69,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<filePath
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M79,19L79,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
</vector>
|
||||
12
app/src/main/res/drawable/like.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="32dp"
|
||||
android:height="32dp"
|
||||
android:viewportWidth="1024"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:fillColor="#FF0000"
|
||||
android:pathData="M965.4,342.8c-19.5,-52.2 -47.7,-100.4 -83.9,-143.2 -18.3,-21.6 -50.6,-24.3 -72.2,-6 -21.6,18.3 -24.3,50.6 -6,72.2C861.4,334.4 893.4,421.9 893.4,512c0,210.3 -171.1,381.4 -381.4,381.4 -210.3,0 -381.4,-171.1 -381.4,-381.4 0,-210.3 171.1,-381.4 381.4,-381.4 60.5,0 118.3,13.7 171.9,40.8 25.2,12.8 56,2.6 68.8,-22.6 12.8,-25.2 2.6,-56 -22.6,-68.8C662.1,45.6 588.7,28.2 512,28.2c-65.3,0 -128.7,12.8 -188.3,38 -57.6,24.4 -109.4,59.3 -153.8,103.7 -44.4,44.4 -79.3,96.2 -103.7,153.8C41,383.3 28.2,446.7 28.2,512c0,65.3 12.8,128.7 38,188.3 24.4,57.6 59.3,109.4 103.7,153.8s96.2,79.3 153.8,103.7C383.3,983 446.7,995.8 512,995.8c65.3,0 128.7,-12.8 188.3,-38 57.6,-24.4 109.4,-59.3 153.8,-103.7 44.4,-44.4 79.3,-96.2 103.7,-153.8C983,640.7 995.8,577.3 995.8,512 995.8,453.8 985.6,396.9 965.4,342.8z"/>
|
||||
<path
|
||||
android:fillColor="#FF0000"
|
||||
android:pathData="M626.5,286.7c-26.2,3 -50,12.2 -71.5,27 -9.1,6.3 -17.6,13.7 -25.9,21 -5.4,4.7 -10.1,10.2 -15.9,16.3 -7.1,-7.4 -13.3,-14.4 -20.1,-20.9 -23.2,-22.2 -50.7,-36.6 -82.3,-41.6 -16.4,-2.6 -33.4,-3.6 -50,-2.5 -23.1,1.7 -44.9,8.9 -65.2,20.7 -13,7.6 -24.9,16.3 -35.6,26.9 -23.7,23.4 -38.7,51.4 -46,83.7 -1.6,7.2 -2.7,14.5 -4,21.8 0,9.8 0,19.6 0,29.4 1.3,7.1 2.5,14.1 4,21.2 5.5,24.9 15.9,47.7 31.9,67.5 18.7,23.1 41.5,42.2 64.4,61 16,13.1 31.2,27 47,40.4 24.4,20.7 48.9,41.2 73.3,61.9 16.2,13.8 32.1,27.9 48.3,41.8 9.7,8.3 19.8,16.4 29.6,24.6 1.4,1.2 2.4,2.9 3.6,4.3 0.9,0 1.7,0 2.6,0 16.7,-14.4 33.3,-28.9 50.1,-43.2 24.4,-20.7 49,-41.2 73.3,-61.9 16.2,-13.8 32.1,-28 48.3,-41.8 21.3,-18.1 43.2,-35.6 64.1,-54.2 19.4,-17.3 37.1,-36.5 48.8,-60.1 8.2,-16.8 14.2,-34.3 16.2,-53.1 0.1,-0.7 0.9,-1.2 1.3,-1.8 0,-14.5 0,-29 0,-43.5 -2.1,-8.4 -4.3,-16.7 -6.3,-25.1 -5,-20.2 -14.8,-38.2 -27.1,-54.8 -20.7,-27.9 -48.1,-46.8 -80.6,-58C678,285 652.4,283.7 626.5,286.7z"/>
|
||||
</vector>
|
||||
9
app/src/main/res/drawable/rounded_rectangle_blue.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<gradient
|
||||
android:angle="45"
|
||||
android:endColor="#006B8C"
|
||||
android:startColor="#8EE5EE"
|
||||
android:type="linear"
|
||||
android:useLevel="false" />
|
||||
<corners android:radius="16sp" />
|
||||
</shape>
|
||||
9
app/src/main/res/drawable/rounded_rectangle_purple.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<gradient
|
||||
android:angle="45"
|
||||
android:endColor="#9C27B0"
|
||||
android:startColor="#009688"
|
||||
android:type="linear"
|
||||
android:useLevel="false" />
|
||||
<corners android:radius="16sp" />
|
||||
</shape>
|
||||
4
app/src/main/res/drawable/un_collection.xml
Normal file
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
</selector>
|
||||
4
app/src/main/res/drawable/un_home.xml
Normal file
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
</selector>
|
||||
12
app/src/main/res/drawable/un_like.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="32dp"
|
||||
android:height="32dp"
|
||||
android:viewportWidth="1024"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M965.4,342.8c-19.5,-52.2 -47.7,-100.4 -83.9,-143.2 -18.3,-21.6 -50.6,-24.3 -72.2,-6 -21.6,18.3 -24.3,50.6 -6,72.2C861.4,334.4 893.4,421.9 893.4,512c0,210.3 -171.1,381.4 -381.4,381.4 -210.3,0 -381.4,-171.1 -381.4,-381.4 0,-210.3 171.1,-381.4 381.4,-381.4 60.5,0 118.3,13.7 171.9,40.8 25.2,12.8 56,2.6 68.8,-22.6 12.8,-25.2 2.6,-56 -22.6,-68.8C662.1,45.6 588.7,28.2 512,28.2c-65.3,0 -128.7,12.8 -188.3,38 -57.6,24.4 -109.4,59.3 -153.8,103.7 -44.4,44.4 -79.3,96.2 -103.7,153.8C41,383.3 28.2,446.7 28.2,512c0,65.3 12.8,128.7 38,188.3 24.4,57.6 59.3,109.4 103.7,153.8s96.2,79.3 153.8,103.7C383.3,983 446.7,995.8 512,995.8c65.3,0 128.7,-12.8 188.3,-38 57.6,-24.4 109.4,-59.3 153.8,-103.7 44.4,-44.4 79.3,-96.2 103.7,-153.8C983,640.7 995.8,577.3 995.8,512 995.8,453.8 985.6,396.9 965.4,342.8z"/>
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M626.5,286.7c-26.2,3 -50,12.2 -71.5,27 -9.1,6.3 -17.6,13.7 -25.9,21 -5.4,4.7 -10.1,10.2 -15.9,16.3 -7.1,-7.4 -13.3,-14.4 -20.1,-20.9 -23.2,-22.2 -50.7,-36.6 -82.3,-41.6 -16.4,-2.6 -33.4,-3.6 -50,-2.5 -23.1,1.7 -44.9,8.9 -65.2,20.7 -13,7.6 -24.9,16.3 -35.6,26.9 -23.7,23.4 -38.7,51.4 -46,83.7 -1.6,7.2 -2.7,14.5 -4,21.8 0,9.8 0,19.6 0,29.4 1.3,7.1 2.5,14.1 4,21.2 5.5,24.9 15.9,47.7 31.9,67.5 18.7,23.1 41.5,42.2 64.4,61 16,13.1 31.2,27 47,40.4 24.4,20.7 48.9,41.2 73.3,61.9 16.2,13.8 32.1,27.9 48.3,41.8 9.7,8.3 19.8,16.4 29.6,24.6 1.4,1.2 2.4,2.9 3.6,4.3 0.9,0 1.7,0 2.6,0 16.7,-14.4 33.3,-28.9 50.1,-43.2 24.4,-20.7 49,-41.2 73.3,-61.9 16.2,-13.8 32.1,-28 48.3,-41.8 21.3,-18.1 43.2,-35.6 64.1,-54.2 19.4,-17.3 37.1,-36.5 48.8,-60.1 8.2,-16.8 14.2,-34.3 16.2,-53.1 0.1,-0.7 0.9,-1.2 1.3,-1.8 0,-14.5 0,-29 0,-43.5 -2.1,-8.4 -4.3,-16.7 -6.3,-25.1 -5,-20.2 -14.8,-38.2 -27.1,-54.8 -20.7,-27.9 -48.1,-46.8 -80.6,-58C678,285 652.4,283.7 626.5,286.7z"/>
|
||||
</vector>
|
||||
42
app/src/main/res/layout/activity_list.xml
Normal file
@ -0,0 +1,42 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout 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:id="@+id/main"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/soft_black"
|
||||
tools:context=".ui.activity.ListActivity">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/back"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="24dp"
|
||||
android:src="@drawable/back"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/title"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/title" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="32dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/app_name"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="24sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recycler_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="16dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/title" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
29
app/src/main/res/layout/activity_main.xml
Normal file
@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout 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:id="@+id/main"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/soft_black"
|
||||
tools:context=".ui.activity.MainActivity">
|
||||
|
||||
<androidx.viewpager2.widget.ViewPager2
|
||||
android:id="@+id/main_viewpager2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
app:layout_constraintBottom_toTopOf="@+id/main_tab_layout"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<com.google.android.material.tabs.TabLayout
|
||||
android:id="@+id/main_tab_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="100dp"
|
||||
android:layout_marginBottom="25dp"
|
||||
android:background="@android:color/transparent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:tabIndicatorHeight="0dp"
|
||||
app:tabRippleColor="@android:color/transparent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
11
app/src/main/res/layout/activity_splash.xml
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout 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:id="@+id/main"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/soft_black"
|
||||
tools:context=".ui.activity.SplashActivity">
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
147
app/src/main/res/layout/activity_wallpaper.xml
Normal file
@ -0,0 +1,147 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout 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:id="@+id/main"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/soft_black"
|
||||
tools:context=".ui.activity.WallpaperActivity">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/back"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="24dp"
|
||||
android:layout_marginTop="32dp"
|
||||
android:src="@drawable/back"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="32dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/app_name"
|
||||
android:textSize="24sp"
|
||||
android:textColor="@color/white"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/like"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="32dp"
|
||||
android:layout_marginEnd="24dp"
|
||||
android:src="@drawable/un_like"
|
||||
android:background="@drawable/rounded_rectangle_blue"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/image_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="250dp"
|
||||
android:layout_marginTop="32dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/title" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/download_apply"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:background="@drawable/rounded_rectangle_blue"
|
||||
android:backgroundTint="@android:color/holo_blue_light"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
android:padding="8dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/image_view">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:src="@drawable/download" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Download&Apply"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="16sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/recommended"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginTop="24dp"
|
||||
android:gravity="center"
|
||||
android:text="Recommended"
|
||||
android:textSize="20sp"
|
||||
android:textColor="@color/white"
|
||||
android:textStyle="italic"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/download_apply" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:text="Home"
|
||||
android:textSize="20sp"
|
||||
android:textColor="@color/white"
|
||||
android:textStyle="italic"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/recommended"
|
||||
app:layout_constraintEnd_toStartOf="@+id/home"
|
||||
app:layout_constraintTop_toTopOf="@+id/recommended" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/home"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:src="@drawable/home_white"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/recommended"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/recommended" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recycler_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="24dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/recommended" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progressBar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:indeterminate="true"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<View
|
||||
android:id="@+id/view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#80000000"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:visibility="gone" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
11
app/src/main/res/layout/activity_write.xml
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout 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:id="@+id/main"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/soft_black"
|
||||
tools:context=".ui.activity.WriteActivity">
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
14
app/src/main/res/layout/fragment_collection.xml
Normal file
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".ui.fragment.CollectionFragment">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recycler_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="16dp" />
|
||||
|
||||
</FrameLayout>
|
||||
14
app/src/main/res/layout/fragment_home.xml
Normal file
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".ui.fragment.HomeFragment">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recycler_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="16dp" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
48
app/src/main/res/layout/item_keyboard.xml
Normal file
@ -0,0 +1,48 @@
|
||||
<androidx.constraintlayout.widget.ConstraintLayout 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"
|
||||
android:background="@drawable/rounded_rectangle_purple"
|
||||
android:padding="10dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/item_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/rounded_rectangle_blue"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:paddingStart="10dp"
|
||||
android:paddingTop="5dp"
|
||||
android:paddingEnd="10dp"
|
||||
android:paddingBottom="5dp"
|
||||
android:text="@string/app_name"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/item_image_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="250dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:scaleType="centerInside"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/item_title" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/item_like"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:src="@drawable/un_like"
|
||||
android:background="@drawable/rounded_rectangle_blue"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/item_title"
|
||||
app:layout_constraintEnd_toEndOf="@id/item_image_view"
|
||||
app:layout_constraintTop_toTopOf="@id/item_title" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
32
app/src/main/res/layout/main_item_custom.xml
Normal file
@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/main"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingBottom="5dp"
|
||||
android:paddingTop="5dp"
|
||||
android:background="@drawable/rounded_rectangle_blue">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/image"
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="16dp"
|
||||
app:layout_constraintBottom_toTopOf="@+id/text"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textStyle="bold"
|
||||
android:gravity="center"
|
||||
android:layout_marginTop="5dp"
|
||||
android:text="@string/app_name"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintTop_toBottomOf="@+id/image" />
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
103
app/src/main/res/layout/select_dialog.xml
Normal file
@ -0,0 +1,103 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout 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="@color/soft_black">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/image_view"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="150dp"
|
||||
android:layout_marginTop="24dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:src="@mipmap/ic_launcher_round"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:text=""
|
||||
android:textColor="@color/white"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/image_view" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/first_select"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:background="@drawable/rounded_rectangle_purple"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingTop="10dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:paddingBottom="10dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/title">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:src="@mipmap/ic_launcher_round" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Enable the input method"
|
||||
android:textColor="@color/white" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/second_select"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:background="@drawable/rounded_rectangle_purple"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingTop="10dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:paddingBottom="10dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/first_select">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:src="@mipmap/ic_launcher_round" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Select an input method "
|
||||
android:textColor="@color/white" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toBottomOf="@+id/second_select">
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="15dp"
|
||||
android:background="@android:color/transparent" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
5
app/src/main/res/layout/wallpaper_keyboard_view.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<com.keyboard.wallpaperkeyboard.inputmethod.keyboardview.WallpaperKeyboardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/keyboard_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
6
app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
||||
6
app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
||||
BIN
app/src/main/res/mipmap-hdpi/ic_launcher.webp
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
app/src/main/res/mipmap-hdpi/ic_launcher_round.webp
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher.webp
Normal file
|
After Width: | Height: | Size: 982 B |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher_round.webp
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher.webp
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher.webp
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp
Normal file
|
After Width: | Height: | Size: 5.8 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp
Normal file
|
After Width: | Height: | Size: 7.6 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/placeholder.png
Normal file
|
After Width: | Height: | Size: 168 KiB |
7
app/src/main/res/values-night/themes.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<!-- Base application theme. -->
|
||||
<style name="Base.Theme.WallpaperKeyboard" parent="Theme.Material3.DayNight.NoActionBar">
|
||||
<!-- Customize your dark theme here. -->
|
||||
<!-- <item name="colorPrimary">@color/my_dark_primary</item> -->
|
||||
</style>
|
||||
</resources>
|
||||
8
app/src/main/res/values/colors.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="black">#FF000000</color>
|
||||
<color name="white">#FFFFFFFF</color>
|
||||
<color name="blue">#8EE5EE</color>
|
||||
<color name="gray">#9C979D</color>
|
||||
<color name="soft_black">#0D1B2A</color>
|
||||
</resources>
|
||||
5
app/src/main/res/values/strings.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<resources>
|
||||
<string name="app_name">Wallpaper Keyboard</string>
|
||||
<!-- TODO: Remove or change this placeholder text -->
|
||||
<string name="hello_blank_fragment">Hello blank fragment</string>
|
||||
</resources>
|
||||
9
app/src/main/res/values/themes.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<!-- Base application theme. -->
|
||||
<style name="Base.Theme.WallpaperKeyboard" parent="Theme.Material3.DayNight.NoActionBar">
|
||||
<!-- Customize your light theme here. -->
|
||||
<!-- <item name="colorPrimary">@color/my_light_primary</item> -->
|
||||
</style>
|
||||
|
||||
<style name="Theme.WallpaperKeyboard" parent="Base.Theme.WallpaperKeyboard" />
|
||||
</resources>
|
||||
13
app/src/main/res/xml/backup_rules.xml
Normal file
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
Sample backup rules file; uncomment and customize as necessary.
|
||||
See https://developer.android.com/guide/topics/data/autobackup
|
||||
for details.
|
||||
Note: This file is ignored for devices older that API 31
|
||||
See https://developer.android.com/about/versions/12/backup-restore
|
||||
-->
|
||||
<full-backup-content>
|
||||
<!--
|
||||
<include domain="sharedpref" filePath="."/>
|
||||
<exclude domain="sharedpref" filePath="device.xml"/>
|
||||
-->
|
||||
</full-backup-content>
|
||||
19
app/src/main/res/xml/data_extraction_rules.xml
Normal file
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
Sample data extraction rules file; uncomment and customize as necessary.
|
||||
See https://developer.android.com/about/versions/12/backup-restore#xml-changes
|
||||
for details.
|
||||
-->
|
||||
<data-extraction-rules>
|
||||
<cloud-backup>
|
||||
<!-- TODO: Use <include> and <exclude> to control what is backed up.
|
||||
<include .../>
|
||||
<exclude .../>
|
||||
-->
|
||||
</cloud-backup>
|
||||
<!--
|
||||
<device-transfer>
|
||||
<include .../>
|
||||
<exclude .../>
|
||||
</device-transfer>
|
||||
-->
|
||||
</data-extraction-rules>
|
||||
10
app/src/main/res/xml/im.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<input-method xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<subtype
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:imeSubtypeLocale="en_US"
|
||||
android:imeSubtypeMode = "keyboard"
|
||||
android:label="@string/app_name" />
|
||||
|
||||
</input-method>
|
||||
172
app/src/main/res/xml/keyboard_lowercase.xml
Normal file
@ -0,0 +1,172 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Keyboard xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<Row
|
||||
android:horizontalGap="0.5%"
|
||||
android:keyWidth="9.45%"
|
||||
android:keyHeight="50dp">
|
||||
<Key
|
||||
android:codes="113"
|
||||
android:keyEdgeFlags="left"
|
||||
android:keyLabel="q" />
|
||||
|
||||
<Key
|
||||
android:codes="119"
|
||||
android:keyLabel="w" />
|
||||
|
||||
<Key
|
||||
android:codes="101"
|
||||
android:keyLabel="e" />
|
||||
|
||||
<Key
|
||||
android:codes="114"
|
||||
android:keyLabel="r" />
|
||||
|
||||
<Key
|
||||
android:codes="116"
|
||||
android:keyLabel="t" />
|
||||
|
||||
<Key
|
||||
android:codes="121"
|
||||
android:keyLabel="y" />
|
||||
|
||||
<Key
|
||||
android:codes="117"
|
||||
android:keyLabel="u" />
|
||||
|
||||
<Key
|
||||
android:codes="105"
|
||||
android:keyLabel="i" />
|
||||
|
||||
<Key
|
||||
android:codes="111"
|
||||
android:keyLabel="o" />
|
||||
|
||||
<Key
|
||||
android:codes="112"
|
||||
android:keyEdgeFlags="right"
|
||||
android:keyLabel="p" />
|
||||
</Row>
|
||||
|
||||
<Row
|
||||
android:horizontalGap="0.5%"
|
||||
android:keyWidth="9.444444%"
|
||||
android:keyHeight="50dp">
|
||||
<Key
|
||||
android:codes="97"
|
||||
android:horizontalGap="5.5%"
|
||||
android:keyLabel="a" />
|
||||
<Key
|
||||
android:codes="115"
|
||||
android:keyLabel="s" />
|
||||
|
||||
<Key
|
||||
android:codes="100"
|
||||
android:keyLabel="d" />
|
||||
|
||||
<Key
|
||||
android:codes="102"
|
||||
android:keyLabel="f" />
|
||||
|
||||
<Key
|
||||
android:codes="103"
|
||||
android:keyLabel="g" />
|
||||
|
||||
<Key
|
||||
android:codes="104"
|
||||
android:keyLabel="h" />
|
||||
|
||||
<Key
|
||||
android:codes="106"
|
||||
android:keyLabel="j" />
|
||||
|
||||
<Key
|
||||
android:codes="107"
|
||||
android:keyLabel="k" />
|
||||
|
||||
<Key
|
||||
android:codes="108"
|
||||
android:keyLabel="l" />
|
||||
</Row>
|
||||
|
||||
<Row
|
||||
android:horizontalGap="0.5%"
|
||||
android:keyWidth="9.5%"
|
||||
android:keyHeight="50dp">
|
||||
<Key
|
||||
android:codes="-1"
|
||||
android:isModifier="true"
|
||||
android:isSticky="true"
|
||||
android:keyWidth="14.25%"
|
||||
android:keyEdgeFlags="left"
|
||||
android:keyLabel="Shift" />
|
||||
|
||||
<Key
|
||||
android:codes="122"
|
||||
android:keyLabel="z" />
|
||||
|
||||
<Key
|
||||
android:codes="120"
|
||||
android:keyLabel="x" />
|
||||
|
||||
<Key
|
||||
android:codes="99"
|
||||
android:keyLabel="c" />
|
||||
|
||||
<Key
|
||||
android:codes="118"
|
||||
android:keyLabel="v" />
|
||||
|
||||
<Key
|
||||
android:codes="98"
|
||||
android:keyLabel="b" />
|
||||
|
||||
<Key
|
||||
android:codes="110"
|
||||
android:keyLabel="n" />
|
||||
|
||||
<Key
|
||||
android:codes="109"
|
||||
android:keyLabel="m" />
|
||||
|
||||
<Key
|
||||
android:codes="-5"
|
||||
android:isModifier="true"
|
||||
android:isRepeatable="true"
|
||||
android:keyWidth="14.25%"
|
||||
android:keyEdgeFlags="right"
|
||||
android:keyLabel="" />
|
||||
</Row>
|
||||
|
||||
<Row
|
||||
android:horizontalGap="0.5%"
|
||||
android:keyWidth="9.5%"
|
||||
android:keyHeight="50dp"
|
||||
android:rowEdgeFlags="bottom">
|
||||
|
||||
<Key
|
||||
android:codes="-2"
|
||||
android:keyWidth="14.25%"
|
||||
android:keyEdgeFlags="left"
|
||||
android:keyLabel="\?123" />
|
||||
|
||||
<Key
|
||||
android:codes="44"
|
||||
android:keyLabel="," />
|
||||
|
||||
<Key
|
||||
android:codes="32"
|
||||
android:keyWidth="49.5%"
|
||||
android:keyLabel="Space" />
|
||||
|
||||
<Key
|
||||
android:codes="46"
|
||||
android:keyLabel="." />
|
||||
|
||||
<Key
|
||||
android:codes="-4"
|
||||
android:keyWidth="14.25%"
|
||||
android:keyEdgeFlags="right"
|
||||
android:keyLabel="Done" />
|
||||
</Row>
|
||||
|
||||
</Keyboard>
|
||||
185
app/src/main/res/xml/keyboard_more_symbols.xml
Normal file
@ -0,0 +1,185 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Keyboard xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<Row
|
||||
android:horizontalGap="0.5%"
|
||||
android:keyWidth="9.45%"
|
||||
android:keyHeight="50dp"
|
||||
android:rowEdgeFlags="top">
|
||||
<Key
|
||||
android:codes="126"
|
||||
android:keyEdgeFlags="left"
|
||||
android:keyLabel="~" />
|
||||
|
||||
<Key
|
||||
android:codes="96"
|
||||
android:keyLabel="`" />
|
||||
|
||||
<Key
|
||||
android:codes="124"
|
||||
android:keyLabel="|" />
|
||||
|
||||
<Key
|
||||
android:codes="149"
|
||||
android:keyLabel="•" />
|
||||
|
||||
<Key
|
||||
android:codes="10004"
|
||||
android:keyLabel="✔" />
|
||||
|
||||
<Key
|
||||
android:codes="960"
|
||||
android:keyLabel="π" />
|
||||
|
||||
<Key
|
||||
android:codes="247"
|
||||
android:keyLabel="÷" />
|
||||
|
||||
<Key
|
||||
android:codes="215"
|
||||
android:keyLabel="×" />
|
||||
|
||||
<Key
|
||||
android:codes="182"
|
||||
android:keyLabel="¶" />
|
||||
|
||||
<Key
|
||||
android:codes="8710"
|
||||
android:keyEdgeFlags="right"
|
||||
android:keyLabel="∆" />
|
||||
</Row>
|
||||
|
||||
<Row
|
||||
android:horizontalGap="0.5%"
|
||||
android:keyWidth="9.444444%"
|
||||
android:keyHeight="50dp">
|
||||
<Key
|
||||
android:codes="163"
|
||||
android:horizontalGap="5.5%"
|
||||
android:keyEdgeFlags="left"
|
||||
android:keyLabel="£" />
|
||||
|
||||
<Key
|
||||
android:codes="65504"
|
||||
android:keyLabel="¢" />
|
||||
|
||||
<Key
|
||||
android:codes="8364"
|
||||
android:keyLabel="€" />
|
||||
|
||||
<Key
|
||||
android:codes="165"
|
||||
android:keyLabel="¥" />
|
||||
|
||||
<Key
|
||||
android:codes="94"
|
||||
android:keyLabel="^" />
|
||||
|
||||
<Key
|
||||
android:codes="176"
|
||||
android:keyLabel="°" />
|
||||
|
||||
<Key
|
||||
android:codes="61"
|
||||
android:keyLabel="=" />
|
||||
|
||||
<Key
|
||||
android:codes="123"
|
||||
android:keyLabel="{" />
|
||||
|
||||
<Key
|
||||
android:codes="125"
|
||||
android:keyEdgeFlags="right"
|
||||
android:keyLabel="}" />
|
||||
</Row>
|
||||
|
||||
<Row
|
||||
android:horizontalGap="0.5%"
|
||||
android:keyWidth="9.5%"
|
||||
android:keyHeight="50dp">
|
||||
|
||||
<Key
|
||||
android:codes="-1000"
|
||||
android:isModifier="true"
|
||||
android:keyWidth="14.25%"
|
||||
android:keyEdgeFlags="left"
|
||||
android:keyLabel="\?123" />
|
||||
|
||||
<Key
|
||||
android:codes="92"
|
||||
android:keyLabel="\\" />
|
||||
|
||||
<Key
|
||||
android:codes="9400"
|
||||
android:keyLabel="Ⓒ" />
|
||||
|
||||
<Key
|
||||
android:codes="174"
|
||||
android:keyLabel="®" />
|
||||
|
||||
<Key
|
||||
android:codes="8482"
|
||||
android:keyLabel="™" />
|
||||
|
||||
<Key
|
||||
android:codes="8453"
|
||||
android:keyLabel="℅" />
|
||||
|
||||
<Key
|
||||
android:codes="91"
|
||||
android:keyLabel="[" />
|
||||
|
||||
<Key
|
||||
android:codes="93"
|
||||
android:keyLabel="]" />
|
||||
|
||||
<Key
|
||||
android:codes="-5"
|
||||
android:isModifier="true"
|
||||
android:isRepeatable="true"
|
||||
android:keyWidth="14.25%"
|
||||
android:keyLabel=""
|
||||
android:keyEdgeFlags="right" />
|
||||
</Row>
|
||||
|
||||
<Row
|
||||
android:horizontalGap="0.5%"
|
||||
android:keyWidth="9.5%"
|
||||
android:keyHeight="50dp"
|
||||
android:rowEdgeFlags="bottom">
|
||||
|
||||
<Key
|
||||
android:codes="-2"
|
||||
android:keyWidth="14.25%"
|
||||
android:keyEdgeFlags="left"
|
||||
android:keyLabel="ABC" />
|
||||
|
||||
<Key
|
||||
android:codes="46"
|
||||
android:keyLabel="," />
|
||||
|
||||
<Key
|
||||
android:codes="60"
|
||||
android:keyLabel="<" />
|
||||
|
||||
<Key
|
||||
android:codes="32"
|
||||
android:keyWidth="29.5%"
|
||||
android:keyLabel="Space" />
|
||||
|
||||
<Key
|
||||
android:codes="62"
|
||||
android:keyLabel=">" />
|
||||
|
||||
<Key
|
||||
android:codes="46"
|
||||
android:keyLabel="." />
|
||||
|
||||
<Key
|
||||
android:codes="-4"
|
||||
android:keyWidth="14.25%"
|
||||
android:keyEdgeFlags="right"
|
||||
android:keyLabel="Done" />
|
||||
</Row>
|
||||
|
||||
</Keyboard>
|
||||
185
app/src/main/res/xml/keyboard_symbols.xml
Normal file
@ -0,0 +1,185 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Keyboard xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<Row
|
||||
android:horizontalGap="0.5%"
|
||||
android:keyWidth="9.45%"
|
||||
android:keyHeight="50dp"
|
||||
android:rowEdgeFlags="top">
|
||||
<Key
|
||||
android:codes="49"
|
||||
android:keyEdgeFlags="left"
|
||||
android:keyLabel="1" />
|
||||
|
||||
<Key
|
||||
android:codes="50"
|
||||
android:keyLabel="2" />
|
||||
|
||||
<Key
|
||||
android:codes="51"
|
||||
android:keyLabel="3" />
|
||||
|
||||
<Key
|
||||
android:codes="52"
|
||||
android:keyLabel="4" />
|
||||
|
||||
<Key
|
||||
android:codes="53"
|
||||
android:keyLabel="5" />
|
||||
|
||||
<Key
|
||||
android:codes="54"
|
||||
android:keyLabel="6" />
|
||||
|
||||
<Key
|
||||
android:codes="55"
|
||||
android:keyLabel="7" />
|
||||
|
||||
<Key
|
||||
android:codes="56"
|
||||
android:keyLabel="8" />
|
||||
|
||||
<Key
|
||||
android:codes="57"
|
||||
android:keyLabel="9" />
|
||||
|
||||
<Key
|
||||
android:codes="48"
|
||||
android:keyEdgeFlags="right"
|
||||
android:keyLabel="0" />
|
||||
</Row>
|
||||
|
||||
<Row
|
||||
android:horizontalGap="0.5%"
|
||||
android:keyWidth="9.444444%"
|
||||
android:keyHeight="50dp">
|
||||
<Key
|
||||
android:codes="64"
|
||||
android:horizontalGap="5.5%"
|
||||
android:keyEdgeFlags="left"
|
||||
android:keyLabel="\@" />
|
||||
|
||||
<Key
|
||||
android:codes="35"
|
||||
android:keyLabel="#" />
|
||||
|
||||
<Key
|
||||
android:codes="36"
|
||||
android:keyLabel="\$" />
|
||||
|
||||
<Key
|
||||
android:codes="37"
|
||||
android:keyLabel="%" />
|
||||
|
||||
<Key
|
||||
android:codes="38"
|
||||
android:keyLabel="&" />
|
||||
|
||||
<Key
|
||||
android:codes="45"
|
||||
android:keyLabel="-" />
|
||||
|
||||
<Key
|
||||
android:codes="43"
|
||||
android:keyLabel="+" />
|
||||
|
||||
<Key
|
||||
android:codes="40"
|
||||
android:keyLabel="(" />
|
||||
|
||||
<Key
|
||||
android:codes="41"
|
||||
android:keyEdgeFlags="right"
|
||||
android:keyLabel=")" />
|
||||
</Row>
|
||||
|
||||
<Row
|
||||
android:horizontalGap="0.5%"
|
||||
android:keyWidth="9.5%"
|
||||
android:keyHeight="50dp">
|
||||
|
||||
<Key
|
||||
android:codes="-1000"
|
||||
android:isModifier="true"
|
||||
android:keyWidth="14.25%"
|
||||
android:keyEdgeFlags="left"
|
||||
android:keyLabel="more" />
|
||||
|
||||
<Key
|
||||
android:codes="42"
|
||||
android:keyLabel="*" />
|
||||
|
||||
|
||||
<Key
|
||||
android:codes="34"
|
||||
android:keyLabel=""" />
|
||||
|
||||
<Key
|
||||
android:codes="39"
|
||||
android:keyLabel="'" />
|
||||
|
||||
<Key
|
||||
android:codes="58"
|
||||
android:keyLabel=":" />
|
||||
|
||||
<Key
|
||||
android:codes="59"
|
||||
android:keyLabel=";" />
|
||||
|
||||
<Key
|
||||
android:codes="33"
|
||||
android:keyLabel="!" />
|
||||
|
||||
<Key
|
||||
android:codes="63"
|
||||
android:keyLabel="\?" />
|
||||
|
||||
<Key
|
||||
android:codes="-5"
|
||||
android:isModifier="true"
|
||||
android:isRepeatable="true"
|
||||
android:keyWidth="14.25%"
|
||||
android:keyEdgeFlags="right"
|
||||
android:keyLabel="" />
|
||||
</Row>
|
||||
|
||||
<Row
|
||||
android:horizontalGap="0.5%"
|
||||
android:keyWidth="9.5%"
|
||||
android:keyHeight="50dp"
|
||||
android:rowEdgeFlags="bottom">
|
||||
|
||||
<Key
|
||||
android:codes="-2"
|
||||
android:keyWidth="14.25%"
|
||||
android:keyEdgeFlags="left"
|
||||
android:keyLabel="ABC" />
|
||||
|
||||
<Key
|
||||
android:codes="44"
|
||||
android:keyLabel="," />
|
||||
|
||||
<Key
|
||||
android:codes="95"
|
||||
android:keyLabel="_" />
|
||||
<Key
|
||||
android:codes="32"
|
||||
android:keyWidth="29.5%"
|
||||
android:keyLabel="Space" />
|
||||
|
||||
<Key
|
||||
android:codes="47"
|
||||
android:keyLabel="/" />
|
||||
|
||||
<Key
|
||||
android:codes="46"
|
||||
android:keyLabel="." />
|
||||
|
||||
<Key
|
||||
android:codes="-4"
|
||||
android:keyWidth="14.25%"
|
||||
android:keyEdgeFlags="right"
|
||||
android:keyLabel="Done" />
|
||||
</Row>
|
||||
|
||||
</Keyboard>
|
||||
177
app/src/main/res/xml/keyboard_uppercase.xml
Normal file
@ -0,0 +1,177 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:keyHeight="50dp">
|
||||
|
||||
<Row
|
||||
android:horizontalGap="0.5%"
|
||||
android:keyWidth="9.45%"
|
||||
android:keyHeight="50dp"
|
||||
android:rowEdgeFlags="top">
|
||||
<Key
|
||||
android:codes="81"
|
||||
android:keyEdgeFlags="left"
|
||||
android:keyLabel="Q" />
|
||||
|
||||
<Key
|
||||
android:codes="87"
|
||||
android:keyLabel="W" />
|
||||
|
||||
<Key
|
||||
android:codes="69"
|
||||
android:keyLabel="E" />
|
||||
|
||||
<Key
|
||||
android:codes="82"
|
||||
android:keyLabel="R" />
|
||||
|
||||
<Key
|
||||
android:codes="84"
|
||||
android:keyLabel="T" />
|
||||
|
||||
<Key
|
||||
android:codes="89"
|
||||
android:keyLabel="Y" />
|
||||
|
||||
<Key
|
||||
android:codes="85"
|
||||
android:keyLabel="U" />
|
||||
|
||||
<Key
|
||||
android:codes="73"
|
||||
android:keyLabel="I" />
|
||||
|
||||
<Key
|
||||
android:codes="79"
|
||||
android:keyLabel="O" />
|
||||
|
||||
<Key
|
||||
android:codes="80"
|
||||
android:keyEdgeFlags="right"
|
||||
android:keyLabel="P" />
|
||||
</Row>
|
||||
|
||||
<Row
|
||||
android:horizontalGap="0.5%"
|
||||
android:keyWidth="9.444444%"
|
||||
android:keyHeight="50dp">
|
||||
<Key
|
||||
android:codes="65"
|
||||
android:horizontalGap="5.5%"
|
||||
android:keyLabel="A" />
|
||||
|
||||
<Key
|
||||
android:codes="83"
|
||||
android:keyLabel="S" />
|
||||
|
||||
<Key
|
||||
android:codes="68"
|
||||
android:keyLabel="D" />
|
||||
|
||||
<Key
|
||||
android:codes="70"
|
||||
android:keyLabel="F" />
|
||||
|
||||
<Key
|
||||
android:codes="71"
|
||||
android:keyLabel="G" />
|
||||
|
||||
<Key
|
||||
android:codes="72"
|
||||
android:keyLabel="H" />
|
||||
|
||||
<Key
|
||||
android:codes="74"
|
||||
android:keyLabel="J" />
|
||||
|
||||
<Key
|
||||
android:codes="75"
|
||||
android:keyLabel="K" />
|
||||
|
||||
<Key
|
||||
android:codes="76"
|
||||
android:keyLabel="L" />
|
||||
</Row>
|
||||
|
||||
<Row
|
||||
android:horizontalGap="0.5%"
|
||||
android:keyWidth="9.5%"
|
||||
android:keyHeight="50dp">
|
||||
|
||||
<Key
|
||||
android:codes="-1"
|
||||
android:isModifier="true"
|
||||
android:isSticky="true"
|
||||
android:keyWidth="14.25%"
|
||||
android:keyEdgeFlags="left"
|
||||
android:keyLabel="Shift" />
|
||||
|
||||
<Key
|
||||
android:codes="90"
|
||||
android:keyLabel="Z" />
|
||||
|
||||
<Key
|
||||
android:codes="88"
|
||||
android:keyLabel="X" />
|
||||
|
||||
<Key
|
||||
android:codes="67"
|
||||
android:keyLabel="C" />
|
||||
|
||||
<Key
|
||||
android:codes="86"
|
||||
android:keyLabel="V" />
|
||||
|
||||
<Key
|
||||
android:codes="66"
|
||||
android:keyLabel="B" />
|
||||
|
||||
<Key
|
||||
android:codes="78"
|
||||
android:keyLabel="N" />
|
||||
|
||||
<Key
|
||||
android:codes="77"
|
||||
android:keyLabel="M" />
|
||||
|
||||
<Key
|
||||
android:codes="-5"
|
||||
android:isModifier="true"
|
||||
android:isRepeatable="true"
|
||||
android:keyWidth="14.25%"
|
||||
android:keyEdgeFlags="right"
|
||||
android:keyLabel="" />
|
||||
</Row>
|
||||
|
||||
<Row
|
||||
android:horizontalGap="0.5%"
|
||||
android:keyWidth="9.5%"
|
||||
android:keyHeight="50dp"
|
||||
android:rowEdgeFlags="bottom">
|
||||
|
||||
<Key
|
||||
android:codes="-2"
|
||||
android:keyWidth="14.25%"
|
||||
android:keyEdgeFlags="left"
|
||||
android:keyLabel="\?123" />
|
||||
|
||||
<Key
|
||||
android:codes="44"
|
||||
android:keyLabel="," />
|
||||
<Key
|
||||
android:codes="32"
|
||||
android:keyWidth="49.5%"
|
||||
android:keyLabel="Space" />
|
||||
|
||||
<Key
|
||||
android:codes="46"
|
||||
android:keyLabel="." />
|
||||
|
||||
<Key
|
||||
android:codes="-4"
|
||||
android:keyWidth="14.25%"
|
||||
android:keyEdgeFlags="right"
|
||||
android:keyLabel="Done" />
|
||||
</Row>
|
||||
|
||||
|
||||
</Keyboard>
|
||||
@ -0,0 +1,17 @@
|
||||
package com.keyboard.wallpaperkeyboard;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
public class ExampleUnitTest {
|
||||
@Test
|
||||
public void addition_isCorrect() {
|
||||
assertEquals(4, 2 + 2);
|
||||
}
|
||||
}
|
||||
4
build.gradle.kts
Normal file
@ -0,0 +1,4 @@
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
plugins {
|
||||
alias(libs.plugins.android.application) apply false
|
||||
}
|
||||
21
gradle.properties
Normal file
@ -0,0 +1,21 @@
|
||||
# Project-wide Gradle settings.
|
||||
# IDE (e.g. Android Studio) users:
|
||||
# Gradle settings configured through the IDE *will override*
|
||||
# any settings specified in this file.
|
||||
# For more details on how to configure your build environment visit
|
||||
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
||||
# Specifies the JVM arguments used for the daemon process.
|
||||
# The setting is particularly useful for tweaking memory settings.
|
||||
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
|
||||
# When configured, Gradle will run in incubating parallel mode.
|
||||
# This option should only be used with decoupled projects. For more details, visit
|
||||
# https://developer.android.com/r/tools/gradle-multi-project-decoupled-projects
|
||||
# org.gradle.parallel=true
|
||||
# AndroidX package structure to make it clearer which packages are bundled with the
|
||||
# Android operating system, and which are packaged with your app's APK
|
||||
# https://developer.android.com/topic/libraries/support-library/androidx-rn
|
||||
android.useAndroidX=true
|
||||
# Enables namespacing of each library's R class so that its R class includes only the
|
||||
# resources declared in the library itself and none from the library's dependencies,
|
||||
# thereby reducing the size of the R class for that library
|
||||
android.nonTransitiveRClass=true
|
||||
22
gradle/libs.versions.toml
Normal file
@ -0,0 +1,22 @@
|
||||
[versions]
|
||||
agp = "8.8.1"
|
||||
junit = "4.13.2"
|
||||
junitVersion = "1.2.1"
|
||||
espressoCore = "3.6.1"
|
||||
appcompat = "1.7.0"
|
||||
material = "1.12.0"
|
||||
activity = "1.10.0"
|
||||
constraintlayout = "2.2.0"
|
||||
|
||||
[libraries]
|
||||
junit = { group = "junit", name = "junit", version.ref = "junit" }
|
||||
ext-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
|
||||
espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }
|
||||
appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" }
|
||||
material = { group = "com.google.android.material", name = "material", version.ref = "material" }
|
||||
activity = { group = "androidx.activity", name = "activity", version.ref = "activity" }
|
||||
constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "constraintlayout" }
|
||||
|
||||
[plugins]
|
||||
android-application = { id = "com.android.application", version.ref = "agp" }
|
||||
|
||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
6
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
#Wed Feb 19 17:02:15 CST 2025
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
185
gradlew
vendored
Normal file
@ -0,0 +1,185 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
#
|
||||
# Copyright 2015 the original author or authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
NONSTOP* )
|
||||
nonstop=true
|
||||
;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=`expr $i + 1`
|
||||
done
|
||||
case $i in
|
||||
0) set -- ;;
|
||||
1) set -- "$args0" ;;
|
||||
2) set -- "$args0" "$args1" ;;
|
||||
3) set -- "$args0" "$args1" "$args2" ;;
|
||||
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Escape application args
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
APP_ARGS=`save "$@"`
|
||||
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
89
gradlew.bat
vendored
Normal file
@ -0,0 +1,89 @@
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
25
settings.gradle.kts
Normal file
@ -0,0 +1,25 @@
|
||||
pluginManagement {
|
||||
repositories {
|
||||
google {
|
||||
content {
|
||||
includeGroupByRegex("com\\.android.*")
|
||||
includeGroupByRegex("com\\.google.*")
|
||||
includeGroupByRegex("androidx.*")
|
||||
}
|
||||
}
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
}
|
||||
}
|
||||
dependencyResolutionManagement {
|
||||
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
maven("https://jitpack.io")
|
||||
}
|
||||
}
|
||||
|
||||
rootProject.name = "WallpaperKeyboard"
|
||||
include(":app")
|
||||
|
||||