完成版
BIN
app/WallpaperKeyboard.jks
Normal file
17
app/proguard-rules.pro
vendored
@ -18,4 +18,19 @@
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
#-renamesourcefileattribute SourceFile
|
||||
|
||||
-keepclassmembers class com.keyboard.wallpaperkeyboard.MyApplication {
|
||||
public static final java.lang.String DB_NAME;
|
||||
public static final int DB_VERSION;
|
||||
}
|
||||
|
||||
-keepclassmembers class * {
|
||||
@androidx.room.Query <methods>;
|
||||
}
|
||||
-keep class com.keyboard.wallpaperkeyboard.data.database.AppDatabase { *; }
|
||||
-keep class com.keyboard.wallpaperkeyboard.data.entity.WallpaperEntity { *; }
|
||||
-keep class com.keyboard.wallpaperkeyboard.data.dao.WallpaperEntityDao { *; }
|
||||
|
||||
-keep class com.omicronapplications.** { *; }
|
||||
-keep class net.sf.sevenzipjbinding.** { *; }
|
||||
@ -23,13 +23,13 @@
|
||||
android:name=".ui.activity.WallpaperActivity"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".ui.activity.SplashActivity"
|
||||
android:name=".ui.activity.MainActivity"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".ui.activity.ListActivity"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".ui.activity.MainActivity"
|
||||
android:name=".ui.activity.SplashActivity"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
@ -28,4 +28,7 @@ public interface WallpaperEntityDao {
|
||||
|
||||
@Query("SELECT * FROM WallpaperEntity WHERE className = :name")
|
||||
LiveData<List<WallpaperEntity>> getCategoryByName(String name);
|
||||
|
||||
@Query("SELECT * FROM WallpaperEntity LIMIT :limit OFFSET :offset")
|
||||
LiveData<List<WallpaperEntity>> getRecommended(int limit, int offset);
|
||||
}
|
||||
|
||||
@ -1,12 +1,14 @@
|
||||
package com.keyboard.wallpaperkeyboard.data.repository;
|
||||
|
||||
public class PathRepository {
|
||||
public class WallpaperPathRepository {
|
||||
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 SPACE_KEY_BACKGROUND = "btn_keyboard_spacekey_normal_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";
|
||||
public static String SPACE_ICON = "sym_keyboard_space_led.9.png";
|
||||
}
|
||||
|
||||
@ -37,4 +37,8 @@ public class WallpaperRepository {
|
||||
public LiveData<List<WallpaperEntity>> getCategoryByName(String name) {
|
||||
return wallpaperEntityDao.getCategoryByName(name);
|
||||
}
|
||||
|
||||
public LiveData<List<WallpaperEntity>> getRecommended(int limit, int offset) {
|
||||
return wallpaperEntityDao.getRecommended(limit, offset);
|
||||
}
|
||||
}
|
||||
|
||||
@ -11,9 +11,10 @@ import android.util.Xml;
|
||||
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import com.keyboard.wallpaperkeyboard.MyApplication;
|
||||
import com.keyboard.wallpaperkeyboard.R;
|
||||
import com.keyboard.wallpaperkeyboard.data.repository.PathRepository;
|
||||
import com.keyboard.wallpaperkeyboard.util.EnhancedFileUtil;
|
||||
import com.keyboard.wallpaperkeyboard.data.repository.WallpaperPathRepository;
|
||||
import com.keyboard.wallpaperkeyboard.util.EnhancedFileUtils;
|
||||
|
||||
import org.xmlpull.v1.XmlPullParser;
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
@ -25,10 +26,12 @@ import java.io.StringReader;
|
||||
public class WallpaperKeyboardThem {
|
||||
private Drawable actionBackgroundDrawable;
|
||||
private Drawable normalBackgroundDrawable;
|
||||
private Drawable spaceBackgroundDrawable;
|
||||
private Drawable shiftIconDrawable;
|
||||
private Drawable shiftLockIconDrawable;
|
||||
private Drawable deleteIconDrawable;
|
||||
private Drawable returnIconDrawable;
|
||||
private Drawable spaceIconDrawable;
|
||||
private Drawable backgroundDrawable;
|
||||
|
||||
private int normalKeyColor;
|
||||
@ -37,17 +40,19 @@ public class WallpaperKeyboardThem {
|
||||
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;
|
||||
private static final int DEFAULT_SHIFT_ICON = R.drawable.shift;
|
||||
private static final int DEFAULT_SHIFT_LOCK_ICON = R.drawable.shift_lock;
|
||||
private static final int DEFAULT_DELETE_ICON = R.drawable.delete;
|
||||
private static final int DEFAULT_RETURN_ICON = R.drawable.return_back;
|
||||
private static final int DEFAULT_SPACE_ICON = R.drawable.space;
|
||||
private static final int DEFAULT_BACKGROUND_COLOR = R.color.soft_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);
|
||||
spaceIconDrawable = ContextCompat.getDrawable(context, DEFAULT_SPACE_ICON);
|
||||
backgroundDrawable = ContextCompat.getDrawable(context, DEFAULT_BACKGROUND_COLOR);
|
||||
normalKeyColor = ContextCompat.getColor(context, R.color.white);
|
||||
actionKeyColor = normalKeyColor;
|
||||
@ -65,6 +70,10 @@ public class WallpaperKeyboardThem {
|
||||
return normalBackgroundDrawable;
|
||||
}
|
||||
|
||||
public Drawable getSpaceBackgroundDrawable() {
|
||||
return spaceBackgroundDrawable;
|
||||
}
|
||||
|
||||
public Drawable getDeleteIconDrawable() {
|
||||
return deleteIconDrawable;
|
||||
}
|
||||
@ -77,6 +86,10 @@ public class WallpaperKeyboardThem {
|
||||
return returnIconDrawable;
|
||||
}
|
||||
|
||||
public Drawable getSpaceIconDrawable() {
|
||||
return spaceIconDrawable;
|
||||
}
|
||||
|
||||
public Drawable getShiftLockIconDrawable() {
|
||||
return shiftLockIconDrawable;
|
||||
}
|
||||
@ -94,12 +107,14 @@ public class WallpaperKeyboardThem {
|
||||
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);
|
||||
normalBackgroundDrawable = getDrawableForKeyBackground(con, resDirPath, WallpaperPathRepository.NORMAL_KEY_BACKGROUND);
|
||||
actionBackgroundDrawable = getDrawableForKeyBackground(con, resDirPath, WallpaperPathRepository.ACTION_KEY_BACKGROUND);
|
||||
spaceBackgroundDrawable = getDrawableForKeyBackground(con, resDirPath, WallpaperPathRepository.SPACE_KEY_BACKGROUND);
|
||||
returnIconDrawable = getDrawableForKeyBackground(con, resDirPath, WallpaperPathRepository.RETURN_ICON);
|
||||
spaceIconDrawable = getDrawableForKeyBackground(con, resDirPath, WallpaperPathRepository.SPACE_ICON);
|
||||
deleteIconDrawable = getDrawableForKeyBackground(con, resDirPath, WallpaperPathRepository.DELETE_ICON);
|
||||
shiftIconDrawable = getDrawableForKeyBackground(con, resDirPath, WallpaperPathRepository.SHIFT_ICON);
|
||||
shiftLockIconDrawable = getDrawableForKeyBackground(con, resDirPath, WallpaperPathRepository.SHIFT_LOCK_ICON);
|
||||
}
|
||||
}
|
||||
|
||||
@ -118,13 +133,12 @@ public class WallpaperKeyboardThem {
|
||||
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);
|
||||
String fileContent = EnhancedFileUtils.readFileToString(colorXmlFile);
|
||||
parser.setInput(new StringReader(fileContent));
|
||||
|
||||
int eventType = parser.getEventType();
|
||||
@ -140,15 +154,12 @@ public class WallpaperKeyboardThem {
|
||||
} 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);
|
||||
} catch (XmlPullParserException | IOException ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
@ -161,11 +172,7 @@ public class WallpaperKeyboardThem {
|
||||
}
|
||||
|
||||
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;
|
||||
SharedPreferences prefs = context.getSharedPreferences(MyApplication.PREF_NAME, Context.MODE_PRIVATE);
|
||||
return prefs.getString(MyApplication.KEY_FILE_PATH, "");
|
||||
}
|
||||
}
|
||||
|
||||
@ -9,11 +9,11 @@ import android.inputmethodservice.KeyboardView;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
import com.keyboard.wallpaperkeyboard.inputmethod.keyboardthem.WallpaperKeyboardThem;
|
||||
import com.keyboard.wallpaperkeyboard.util.DrawableUtils;
|
||||
import com.keyboard.wallpaperkeyboard.util.KeyboardDrawableUtil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class WallpaperKeyboardView extends KeyboardView{
|
||||
public class WallpaperKeyboardView extends KeyboardView {
|
||||
private final Paint mPaint;
|
||||
private final WallpaperKeyboardThem wallpaperKeyboardThem;
|
||||
private ShiftState shiftState = ShiftState.NORMAL;
|
||||
@ -25,7 +25,7 @@ public class WallpaperKeyboardView extends KeyboardView{
|
||||
super(context, attrs);
|
||||
wallpaperKeyboardThem = new WallpaperKeyboardThem(context);
|
||||
mPaint = new Paint();
|
||||
mPaint.setTextSize(DrawableUtils.spToPx(TEXT_SIZE_LARGE, context));
|
||||
mPaint.setTextSize(KeyboardDrawableUtil.spToPx(TEXT_SIZE_LARGE, context));
|
||||
setPreviewEnabled(false);
|
||||
}
|
||||
|
||||
@ -44,16 +44,20 @@ public class WallpaperKeyboardView extends KeyboardView{
|
||||
|
||||
switch (keyCode) {
|
||||
case Keyboard.KEYCODE_SHIFT:
|
||||
DrawableUtils.drawKeyIcon(key, getShiftDrawable(), canvas, this);
|
||||
KeyboardDrawableUtil.drawKeyboardKeyIcon(key, getShiftDrawable(), canvas, this);
|
||||
break;
|
||||
|
||||
case Keyboard.KEYCODE_DELETE:
|
||||
DrawableUtils.drawKeyIcon(key, wallpaperKeyboardThem.getDeleteIconDrawable(), canvas, this);
|
||||
KeyboardDrawableUtil.drawKeyboardKeyIcon(key, wallpaperKeyboardThem.getDeleteIconDrawable(), canvas, this);
|
||||
drawKeyLabel(key, canvas);
|
||||
break;
|
||||
|
||||
case Keyboard.KEYCODE_DONE:
|
||||
DrawableUtils.drawKeyIcon(key, wallpaperKeyboardThem.getReturnIconDrawable(), canvas, this);
|
||||
KeyboardDrawableUtil.drawKeyboardKeyIcon(key, wallpaperKeyboardThem.getReturnIconDrawable(), canvas, this);
|
||||
break;
|
||||
|
||||
case 32:
|
||||
KeyboardDrawableUtil.drawKeyboardKeyIcon(key, wallpaperKeyboardThem.getSpaceIconDrawable(), canvas, this);
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -79,7 +83,11 @@ public class WallpaperKeyboardView extends KeyboardView{
|
||||
|
||||
private Drawable getKeyBackgroundDrawable(int keyCode) {
|
||||
if (isActionKey(keyCode)) {
|
||||
return wallpaperKeyboardThem.getActionBackgroundDrawable();
|
||||
if (keyCode == 32) {
|
||||
return wallpaperKeyboardThem.getSpaceBackgroundDrawable();
|
||||
} else {
|
||||
return wallpaperKeyboardThem.getActionBackgroundDrawable();
|
||||
}
|
||||
} else {
|
||||
return wallpaperKeyboardThem.getNormalBackgroundDrawable();
|
||||
}
|
||||
@ -113,7 +121,7 @@ public class WallpaperKeyboardView extends KeyboardView{
|
||||
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()));
|
||||
mPaint.setTextSize(KeyboardDrawableUtil.spToPx(TEXT_SIZE_NORMAL, this.getContext()));
|
||||
canvas.drawText(key.label.toString(), xPos, yPos, mPaint);
|
||||
}
|
||||
}
|
||||
@ -131,5 +139,4 @@ public class WallpaperKeyboardView extends KeyboardView{
|
||||
public void setShiftState(ShiftState state) {
|
||||
this.shiftState = state;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -48,7 +48,7 @@ public class WallpaperKeyboardService extends InputMethodService implements Keyb
|
||||
@Override
|
||||
public void onWindowShown() {
|
||||
super.onWindowShown();
|
||||
updateKeyboardBackground(); // 更新背景
|
||||
updateKeyboardBackground();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -71,7 +71,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
int iconResId = getIconResource(tab.getPosition(), isSelected);
|
||||
mainItemCustomBinding.image.setImageResource(iconResId);
|
||||
|
||||
int textColor = isSelected ? R.color.blue : R.color.black;
|
||||
int textColor = isSelected ? R.color.blue : R.color.gray;
|
||||
mainItemCustomBinding.text.setTextColor(ContextCompat.getColor(MainActivity.this, textColor));
|
||||
}
|
||||
}
|
||||
@ -80,7 +80,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
|
||||
private void setTab(MainItemCustomBinding mainCustomBinding, int position) {
|
||||
int iconResId = getIconResource(position, false);
|
||||
int textColorResId = R.color.black;
|
||||
int textColorResId = R.color.gray;
|
||||
|
||||
switch (position) {
|
||||
case 0:
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
package com.keyboard.wallpaperkeyboard.ui.activity;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.CountDownTimer;
|
||||
|
||||
import androidx.activity.EdgeToEdge;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
@ -8,19 +10,77 @@ import androidx.core.graphics.Insets;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.WindowInsetsCompat;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
|
||||
import com.keyboard.wallpaperkeyboard.R;
|
||||
import com.keyboard.wallpaperkeyboard.databinding.ActivitySplashBinding;
|
||||
|
||||
public class SplashActivity extends AppCompatActivity {
|
||||
|
||||
private ActivitySplashBinding binding;
|
||||
private static final long TOTAL_TIME = 3000;
|
||||
private CountDownTimer countDownTimer;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
binding = ActivitySplashBinding.inflate(getLayoutInflater());
|
||||
setContentView(binding.getRoot());
|
||||
|
||||
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;
|
||||
});
|
||||
|
||||
initEvent();
|
||||
}
|
||||
|
||||
private void initEvent() {
|
||||
loadImage();
|
||||
startProgressTimer();
|
||||
}
|
||||
|
||||
private void startProgressTimer() {
|
||||
countDownTimer = new CountDownTimer(TOTAL_TIME, 100) {
|
||||
@Override
|
||||
public void onTick(long millisUntilFinished) {
|
||||
int percentage = (int) (100 - (float) millisUntilFinished / TOTAL_TIME * 100);
|
||||
binding.progressBar.setProgress(percentage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinish() {
|
||||
startMain();
|
||||
}
|
||||
};
|
||||
|
||||
countDownTimer.start();
|
||||
}
|
||||
|
||||
private void loadImage() {
|
||||
Glide.with(this)
|
||||
.load(R.mipmap.placeholder)
|
||||
.transform(new RoundedCorners(16))
|
||||
.into(binding.splashImage);
|
||||
}
|
||||
|
||||
private void startMain() {
|
||||
binding.progressBar.setProgress(100);
|
||||
|
||||
Intent intent = new Intent(SplashActivity.this, MainActivity.class);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
if (countDownTimer != null) {
|
||||
countDownTimer.cancel();
|
||||
}
|
||||
binding = null;
|
||||
}
|
||||
}
|
||||
@ -11,6 +11,7 @@ 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;
|
||||
|
||||
@ -24,16 +25,23 @@ 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.dialog.SelectInputMethodDialog;
|
||||
import com.keyboard.wallpaperkeyboard.ui.viewmodel.WallpaperViewModel;
|
||||
import com.keyboard.wallpaperkeyboard.util.FileDownloadAndUnzipUtil;
|
||||
import com.keyboard.wallpaperkeyboard.util.InputMethodCheckerUtils;
|
||||
import com.keyboard.wallpaperkeyboard.util.FileDownloadAndUnzipUtils;
|
||||
import com.keyboard.wallpaperkeyboard.util.ItemDecoration;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class WallpaperActivity extends AppCompatActivity {
|
||||
private ActivityWallpaperBinding binding;
|
||||
private WallpaperViewModel wallpaperViewModel;
|
||||
private WallpaperEntity wallpaperEntity;
|
||||
private InputMethodAdapter inputMethodAdapter;
|
||||
private int limit = 1;
|
||||
private int offset = 20;
|
||||
private String title;
|
||||
private String zipUrl;
|
||||
|
||||
@ -66,12 +74,16 @@ public class WallpaperActivity extends AppCompatActivity {
|
||||
|
||||
wallpaperViewModel = new ViewModelProvider(this).get(WallpaperViewModel.class);
|
||||
|
||||
Random random = new Random();
|
||||
limit = random.nextInt(800);
|
||||
offset = limit + 20;
|
||||
|
||||
title = wallpaperEntity.getTitle();
|
||||
zipUrl = wallpaperEntity.getZipUrl();
|
||||
|
||||
InputMethodAdapter inputMethodAdapter = new InputMethodAdapter(wallpaperViewModel, this, new ArrayList<>(), this, 1);
|
||||
inputMethodAdapter = new InputMethodAdapter(wallpaperViewModel, this, new ArrayList<>(), this, 1);
|
||||
binding.recyclerView.setAdapter(inputMethodAdapter);
|
||||
binding.recyclerView.setLayoutManager(new GridLayoutManager(this, 2));
|
||||
binding.recyclerView.setLayoutManager(new GridLayoutManager(this, 1));
|
||||
binding.recyclerView.addItemDecoration(new ItemDecoration(20, 15, 20));
|
||||
|
||||
if (wallpaperEntity.getPreview() != null) {
|
||||
@ -91,26 +103,33 @@ public class WallpaperActivity extends AppCompatActivity {
|
||||
binding.title.setText(title);
|
||||
|
||||
setLike();
|
||||
getRecommended();
|
||||
}
|
||||
|
||||
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!");
|
||||
if (!InputMethodCheckerUtils.isAppInputMethodEnabled() || !InputMethodCheckerUtils.isAppInputMethodActive()) {
|
||||
SelectInputMethodDialog dialog = new SelectInputMethodDialog();
|
||||
dialog.show(getSupportFragmentManager(), "SelectInputMethodDialog");
|
||||
hideView();
|
||||
} else {
|
||||
FileDownloadAndUnzipUtils.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() {
|
||||
@ -126,6 +145,17 @@ public class WallpaperActivity extends AppCompatActivity {
|
||||
.into(binding.imageView);
|
||||
}
|
||||
|
||||
private void getRecommended() {
|
||||
wallpaperViewModel
|
||||
.getRecommended(limit, offset)
|
||||
.observe(this, new Observer<List<WallpaperEntity>>() {
|
||||
@Override
|
||||
public void onChanged(List<WallpaperEntity> wallpaperEntities) {
|
||||
inputMethodAdapter.updateData(wallpaperEntities);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void setLike() {
|
||||
binding.like.setImageResource(wallpaperEntity.getLike() ? R.drawable.like : R.drawable.un_like);
|
||||
}
|
||||
@ -151,12 +181,12 @@ public class WallpaperActivity extends AppCompatActivity {
|
||||
Toast.makeText(WallpaperActivity.this, message, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
private void showView(){
|
||||
private void showView() {
|
||||
binding.progressBar.setVisibility(View.VISIBLE);
|
||||
binding.view.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
private void hideView(){
|
||||
private void hideView() {
|
||||
binding.progressBar.setVisibility(View.GONE);
|
||||
binding.view.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
package com.keyboard.wallpaperkeyboard.ui.activity;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
|
||||
import androidx.activity.EdgeToEdge;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
@ -9,18 +11,45 @@ import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.WindowInsetsCompat;
|
||||
|
||||
import com.keyboard.wallpaperkeyboard.R;
|
||||
import com.keyboard.wallpaperkeyboard.databinding.ActivityWriteBinding;
|
||||
|
||||
public class WriteActivity extends AppCompatActivity {
|
||||
private ActivityWriteBinding binding;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
EdgeToEdge.enable(this);
|
||||
setContentView(R.layout.activity_write);
|
||||
binding = ActivityWriteBinding.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;
|
||||
});
|
||||
|
||||
initEvent();
|
||||
}
|
||||
|
||||
private void initEvent() {
|
||||
binding.back.setOnClickListener(v -> finish());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWindowFocusChanged(boolean hasFocus) {
|
||||
super.onWindowFocusChanged(hasFocus);
|
||||
if (hasFocus) {
|
||||
binding.editText.requestFocus();
|
||||
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
if (imm != null) {
|
||||
imm.showSoftInput(binding.editText, InputMethodManager.SHOW_IMPLICIT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
binding = null;
|
||||
}
|
||||
}
|
||||
@ -23,7 +23,7 @@ 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;
|
||||
import com.keyboard.wallpaperkeyboard.util.InputMethodCheckerUtils;
|
||||
|
||||
public class SelectInputMethodDialog extends DialogFragment {
|
||||
private SelectDialogBinding binding;
|
||||
@ -58,7 +58,7 @@ public class SelectInputMethodDialog extends DialogFragment {
|
||||
@Override
|
||||
public void onChange(boolean selfChange) {
|
||||
super.onChange(selfChange);
|
||||
if (InputMethodUtils.isInputMethodEnabled() && InputMethodUtils.isCurrentInputMethodActive()) {
|
||||
if (InputMethodCheckerUtils.isAppInputMethodEnabled() && InputMethodCheckerUtils.isAppInputMethodActive()) {
|
||||
dismiss();
|
||||
}
|
||||
}
|
||||
@ -93,7 +93,7 @@ public class SelectInputMethodDialog extends DialogFragment {
|
||||
|
||||
private void loadImage() {
|
||||
Glide.with(requireContext())
|
||||
.load(R.mipmap.ic_launcher_round)
|
||||
.load(R.mipmap.placeholder)
|
||||
.transform(new RoundedCorners(16))
|
||||
.into(binding.imageView);
|
||||
}
|
||||
@ -111,8 +111,8 @@ public class SelectInputMethodDialog extends DialogFragment {
|
||||
}
|
||||
|
||||
private void updateDialogState() {
|
||||
boolean isInputMethodEnabled = InputMethodUtils.isInputMethodEnabled();
|
||||
boolean isCurrentInputMethodActive = InputMethodUtils.isCurrentInputMethodActive();
|
||||
boolean isInputMethodEnabled = InputMethodCheckerUtils.isAppInputMethodEnabled();
|
||||
boolean isCurrentInputMethodActive = InputMethodCheckerUtils.isAppInputMethodActive();
|
||||
|
||||
binding.firstSelect.setClickable(!isInputMethodEnabled);
|
||||
binding.firstSelect.setSelected(isInputMethodEnabled);
|
||||
|
||||
@ -37,4 +37,8 @@ public class WallpaperViewModel extends AndroidViewModel {
|
||||
public LiveData<List<WallpaperEntity>> getCategoryByName(String name) {
|
||||
return wallpaperRepository.getCategoryByName(name);
|
||||
}
|
||||
|
||||
public LiveData<List<WallpaperEntity>> getRecommended(int limit, int offset) {
|
||||
return wallpaperRepository.getRecommended(limit, offset);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,55 +0,0 @@
|
||||
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());
|
||||
}
|
||||
|
||||
}
|
||||
@ -12,7 +12,7 @@ import java.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
import java.nio.file.Files;
|
||||
|
||||
public class EnhancedFileUtil {
|
||||
public class EnhancedFileUtils {
|
||||
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());
|
||||
@ -28,8 +28,8 @@ 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 class FileDownloadAndUnzipUtils {
|
||||
private static final Logger LOGGER = Logger.getLogger(FileDownloadAndUnzipUtils.class.getName());
|
||||
|
||||
public static void downloadAndUnzipFile(Context context, String url, DownloadAndUnzipCallback callback) {
|
||||
downloadFile(context, url, new DownloadCallback() {
|
||||
@ -84,7 +84,7 @@ public class FileDownloadAndUnzipUtil {
|
||||
}
|
||||
|
||||
File destinationFile = new File(downloadDir, resource.getName());
|
||||
EnhancedFileUtil.copyFile(resource, destinationFile);
|
||||
EnhancedFileUtils.copyFile(resource, destinationFile);
|
||||
|
||||
callback.onDownloadCall(true, destinationFile);
|
||||
LOGGER.log(Level.INFO, "resource: " + destinationFile);
|
||||
@ -0,0 +1,34 @@
|
||||
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.keyboard.wallpaperkeyboard.MyApplication;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class InputMethodCheckerUtils {
|
||||
private static final InputMethodManager inputMethodManager =
|
||||
(InputMethodManager) MyApplication.application.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
|
||||
public static boolean isAppInputMethodEnabled() {
|
||||
if (inputMethodManager == null) {
|
||||
return false;
|
||||
}
|
||||
List<InputMethodInfo> enabledInputMethods = inputMethodManager.getEnabledInputMethodList();
|
||||
for (InputMethodInfo inputMethodInfo : enabledInputMethods) {
|
||||
if (inputMethodInfo.getId().startsWith(MyApplication.application.getPackageName())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isAppInputMethodActive() {
|
||||
String currentInputMethod = Settings.Secure.getString(MyApplication.application.getContentResolver(), Settings.Secure.DEFAULT_INPUT_METHOD);
|
||||
return currentInputMethod != null && currentInputMethod.startsWith(MyApplication.application.getPackageName());
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,31 +0,0 @@
|
||||
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,61 @@
|
||||
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 KeyboardDrawableUtil {
|
||||
public static void drawKeyboardKeyIcon(Keyboard.Key currentKey,
|
||||
Drawable keyIconDrawable,
|
||||
Canvas canvas,
|
||||
WallpaperKeyboardView keyboardView) {
|
||||
if (currentKey == null || keyIconDrawable == null || canvas == null || keyboardView == null) {
|
||||
return;
|
||||
}
|
||||
currentKey.icon = keyIconDrawable;
|
||||
currentKey.icon.setBounds(getIconDrawingBounds(currentKey, keyIconDrawable, keyboardView));
|
||||
currentKey.icon.draw(canvas);
|
||||
}
|
||||
|
||||
private static Rect getIconDrawingBounds(Keyboard.Key currentKey,
|
||||
Drawable keyIconDrawable,
|
||||
WallpaperKeyboardView keyboardView) {
|
||||
if (currentKey == null || keyIconDrawable == null || keyboardView == null) {
|
||||
return new Rect();
|
||||
}
|
||||
float iconWidth = keyIconDrawable.getIntrinsicWidth();
|
||||
float iconHeight = keyIconDrawable.getIntrinsicHeight();
|
||||
float widthRatio = iconWidth / currentKey.width;
|
||||
float heightRatio = iconHeight / currentKey.height;
|
||||
|
||||
float scaleFactor;
|
||||
float minScale = 0.5f;
|
||||
if (widthRatio > heightRatio) {
|
||||
scaleFactor = Math.max(widthRatio, minScale);
|
||||
} else {
|
||||
scaleFactor = Math.max(heightRatio, minScale);
|
||||
}
|
||||
|
||||
iconHeight = (iconHeight / Math.max(widthRatio, heightRatio)) * scaleFactor;
|
||||
iconWidth = (iconWidth / Math.max(widthRatio, heightRatio)) * scaleFactor;
|
||||
|
||||
int top = (int) (currentKey.y + keyboardView.getPaddingTop() + (currentKey.height - iconHeight) / 2);
|
||||
int left = (int) (currentKey.x + keyboardView.getPaddingLeft() + (currentKey.width - iconWidth) / 2);
|
||||
int bottom = top + (int) iconHeight;
|
||||
int right = left + (int) iconWidth;
|
||||
|
||||
return new Rect(left, top, right, bottom);
|
||||
}
|
||||
|
||||
public static float spToPx(float spValue, Context context) {
|
||||
if (context == null) {
|
||||
return 0;
|
||||
}
|
||||
return TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, spValue, context.getResources().getDisplayMetrics());
|
||||
}
|
||||
}
|
||||
@ -5,5 +5,5 @@
|
||||
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"/>
|
||||
android:fillColor="@color/blue"/>
|
||||
</vector>
|
||||
|
||||
15
app/src/main/res/drawable/delete.xml
Normal file
@ -0,0 +1,15 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="32dp"
|
||||
android:height="32dp"
|
||||
android:viewportWidth="1025"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:fillColor="@color/gray"
|
||||
android:pathData="M897.1,896H342.4c-12.8,0 -25.6,-4.3 -34.1,-12.8l-298.7,-341.3c-12.8,-17.1 -12.8,-38.4 0,-55.5l298.7,-341.3c8.5,-12.8 21.3,-17.1 34.1,-17.1h554.7c72.5,0 128,55.5 128,128v512c0,72.5 -55.5,128 -128,128zM363.7,810.7H897.1c25.6,0 42.7,-17.1 42.7,-42.7V256c0,-25.6 -17.1,-42.7 -42.7,-42.7H363.7l-260.3,298.7 260.3,298.7z"/>
|
||||
<path
|
||||
android:fillColor="@color/gray"
|
||||
android:pathData="M513.1,682.7c-12.8,0 -21.3,-4.3 -29.9,-12.8 -17.1,-17.1 -17.1,-42.7 0,-59.7l256,-256c17.1,-17.1 42.7,-17.1 59.7,0s17.1,42.7 0,59.7l-256,256c-8.5,8.5 -17.1,12.8 -29.9,12.8z"/>
|
||||
<path
|
||||
android:fillColor="@color/gray"
|
||||
android:pathData="M769.1,682.7c-12.8,0 -21.3,-4.3 -29.9,-12.8l-256,-256c-17.1,-17.1 -17.1,-42.7 0,-59.7s42.7,-17.1 59.7,0l256,256c17.1,17.1 17.1,42.7 0,59.7 -8.5,8.5 -17.1,12.8 -29.9,12.8z"/>
|
||||
</vector>
|
||||
5
app/src/main/res/drawable/dialog_select_background.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/rounded_rectangle_gray" android:state_selected="true" />
|
||||
<item android:drawable="@drawable/rounded_rectangle_purple" android:state_selected="false" />
|
||||
</selector>
|
||||
@ -4,6 +4,6 @@
|
||||
android:viewportWidth="1152"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:fillColor="@color/blue"
|
||||
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>
|
||||
|
||||
8
app/src/main/res/drawable/input_border.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<!-- res/drawable/edit_text_border.xml -->
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="@color/gray" />
|
||||
<stroke
|
||||
android:width="1dp"
|
||||
android:color="#000000" />
|
||||
<corners android:radius="8dp" />
|
||||
</shape>
|
||||
30
app/src/main/res/drawable/progress_bar_color.xml
Normal file
@ -0,0 +1,30 @@
|
||||
<!-- res/drawable/seekbar_progress_drawable.xml -->
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:id="@android:id/background">
|
||||
<shape>
|
||||
<corners android:radius="5dp" />
|
||||
<solid android:color="#D3D3D3" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
<item android:id="@android:id/secondaryProgress">
|
||||
<clip>
|
||||
<shape>
|
||||
<corners android:radius="5dp" />
|
||||
<solid android:color="#FFD700" />
|
||||
</shape>
|
||||
</clip>
|
||||
</item>
|
||||
|
||||
<item android:id="@android:id/progress">
|
||||
<clip>
|
||||
<shape>
|
||||
<corners android:radius="5dp" />
|
||||
<gradient
|
||||
android:startColor="#4891FF"
|
||||
android:endColor="#6CE89E"
|
||||
android:angle="0" />
|
||||
</shape>
|
||||
</clip>
|
||||
</item>
|
||||
</layer-list>
|
||||
12
app/src/main/res/drawable/return_back.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="@color/gray"
|
||||
android:pathData="M224,736c-8.2,0 -16.4,-3.2 -22.6,-9.4l-128,-128c-12.4,-12.4 -12.4,-32.8 0,-45.2l128,-128c12.4,-12.4 32.8,-12.4 45.2,0 12.4,12.4 12.4,32.8 0,45.2L141.2,576l105.4,105.4c12.4,12.4 12.4,32.8 0,45.2 -6.2,6.2 -14.4,9.4 -22.6,9.4z"/>
|
||||
<path
|
||||
android:fillColor="@color/gray"
|
||||
android:pathData="M716,608H128c-17.6,0 -32,-14.4 -32,-32s14.4,-32 32,-32h588c47.8,0 93,-19.2 127.2,-54.4 34,-35 52.8,-81 52.8,-129.6v-40c0,-17.6 14.4,-32 32,-32s32,14.4 32,32v40c0,65.4 -25.2,127.4 -71,174.4 -46.2,47.4 -107.8,73.6 -173,73.6z"/>
|
||||
</vector>
|
||||
10
app/src/main/res/drawable/rounded_rectangle_gray.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="#9C979D" />
|
||||
<corners android:radius="16sp" />
|
||||
<stroke android:width="2dp" android:color="#9C979D" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
||||
9
app/src/main/res/drawable/shift.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="M693.3,874.7a32,32 0,0 1,4.4 63.7L693.3,938.7h-362.7a32,32 0,0 1,-4.4 -63.7l4.4,-0.3h362.7zM469.6,101.2a74.7,74.7 0,0 1,95.1 8.7l4.6,5 335.6,402.7a74.7,74.7 0,0 1,-51.2 122.2l-6.1,0.3h-122.3v96a74.7,74.7 0,0 1,-62.2 73.6l-6.3,0.8 -6.1,0.3h-277.3a74.7,74.7 0,0 1,-74.4 -68.6L298.7,736 298.6,640L176.4,640a74.7,74.7 0,0 1,-35.5 -9l-6.4,-3.8 -6,-4.5a74.7,74.7 0,0 1,-13.7 -99.7l4.1,-5.4 335.6,-402.7 4.6,-5 5,-4.6 5.4,-4.1zM520.2,155.8a10.7,10.7 0,0 0,-12.6 -2.9l-2.4,1.5 -1.4,1.4 -335.6,402.7a10.7,10.7 0,0 0,5.7 17.2l2.5,0.3L330.7,576a32,32 0,0 1,31.7 27.6l0.3,4.4v128a10.7,10.7 0,0 0,8.2 10.4l2.5,0.3h277.3a10.7,10.7 0,0 0,10.4 -8.2l0.3,-2.4v-128a32,32 0,0 1,27.6 -31.7l4.4,-0.3h154.2a10.7,10.7 0,0 0,9.5 -15.4l-1.3,-2 -335.6,-402.7z"
|
||||
android:fillColor="@color/gray"/>
|
||||
</vector>
|
||||
9
app/src/main/res/drawable/shift_lock.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="M682.7,853.3a42.7,42.7 0,0 1,4.9 85L682.7,938.7H341.3a42.7,42.7 0,0 1,-5 -85L341.3,853.3h341.3zM469.6,101.2a74.7,74.7 0,0 1,95.1 8.7l4.6,5 335.6,402.7a74.7,74.7 0,0 1,-51.2 122.2l-6.1,0.3h-122.3v96a74.7,74.7 0,0 1,-62.2 73.6l-6.3,0.8 -6.1,0.3h-277.3a74.7,74.7 0,0 1,-74.4 -68.6L298.7,736 298.6,640H176.4a74.7,74.7 0,0 1,-35.5 -9l-6.4,-3.8 -6,-4.5a74.7,74.7 0,0 1,-13.7 -99.7l4.1,-5.4 335.6,-402.7 4.6,-5 5,-4.6 5.4,-4.1z"
|
||||
android:fillColor="@color/gray"/>
|
||||
</vector>
|
||||
9
app/src/main/res/drawable/space.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:fillColor="#FF000000"
|
||||
android:pathData="M955.7,358.4v238.9H68.3V358.4H-0v307.2h1024v-307.2z"/>
|
||||
</vector>
|
||||
@ -1,4 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
</selector>
|
||||
<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="@color/gray"/>
|
||||
</vector>
|
||||
|
||||
@ -1,4 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
</selector>
|
||||
<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="@color/gray"
|
||||
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>
|
||||
|
||||
@ -8,13 +8,27 @@
|
||||
android:background="@color/soft_black"
|
||||
tools:context=".ui.activity.MainActivity">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="32dp"
|
||||
android:text="@string/app_name"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="24sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.viewpager2.widget.ViewPager2
|
||||
android:id="@+id/main_viewpager2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
app:layout_constraintBottom_toTopOf="@+id/main_tab_layout"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
app:layout_constraintTop_toBottomOf="@+id/title" />
|
||||
|
||||
<com.google.android.material.tabs.TabLayout
|
||||
android:id="@+id/main_tab_layout"
|
||||
|
||||
@ -8,4 +8,43 @@
|
||||
android:background="@color/soft_black"
|
||||
tools:context=".ui.activity.SplashActivity">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/splash_image"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="200dp"
|
||||
android:src="@mipmap/placeholder"
|
||||
app:layout_constraintVertical_bias="0.4"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/splash_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="32dp"
|
||||
android:text="@string/app_name"
|
||||
android:textSize="24sp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/white"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/splash_image" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progress_bar"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="8dp"
|
||||
android:layout_marginStart="25dp"
|
||||
android:layout_marginEnd="25dp"
|
||||
android:layout_marginBottom="80dp"
|
||||
android:max="100"
|
||||
android:progress="0"
|
||||
android:progressDrawable="@drawable/progress_bar_color"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@ -8,4 +8,38 @@
|
||||
android:background="@color/soft_black"
|
||||
tools:context=".ui.activity.WriteActivity">
|
||||
|
||||
<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: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" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/edit_text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:background="@drawable/input_border"
|
||||
android:padding="16dp"
|
||||
android:hint="Please enter text"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@ -16,6 +16,7 @@
|
||||
android:paddingTop="5dp"
|
||||
android:paddingEnd="10dp"
|
||||
android:paddingBottom="5dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="@string/app_name"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
|
||||
@ -9,9 +9,9 @@
|
||||
android:id="@+id/image_view"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="150dp"
|
||||
android:layout_marginTop="24dp"
|
||||
android:layout_marginTop="32dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:src="@mipmap/ic_launcher_round"
|
||||
android:src="@mipmap/placeholder"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
@ -20,9 +20,8 @@
|
||||
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:layout_marginTop="32dp"
|
||||
android:text="Please select an input method"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold"
|
||||
@ -34,8 +33,8 @@
|
||||
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:layout_marginTop="32dp"
|
||||
android:background="@drawable/dialog_select_background"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
android:paddingStart="16dp"
|
||||
@ -50,7 +49,7 @@
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:src="@mipmap/ic_launcher_round" />
|
||||
android:src="@mipmap/placeholder" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
@ -64,7 +63,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:background="@drawable/rounded_rectangle_purple"
|
||||
android:background="@drawable/dialog_select_background"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
android:paddingStart="16dp"
|
||||
@ -79,7 +78,7 @@
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:src="@mipmap/ic_launcher_round" />
|
||||
android:src="@mipmap/placeholder" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
@ -95,7 +94,7 @@
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="15dp"
|
||||
android:layout_height="32dp"
|
||||
android:background="@android:color/transparent" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
@ -1,6 +0,0 @@
|
||||
<?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.png
Normal file
|
After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 982 B |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 1.9 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 5.2 KiB |
|
Before Width: | Height: | Size: 2.8 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 7.2 KiB |
|
Before Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 168 KiB After Width: | Height: | Size: 23 KiB |
@ -2,7 +2,7 @@
|
||||
<input-method xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<subtype
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:icon="@mipmap/placeholder"
|
||||
android:imeSubtypeLocale="en_US"
|
||||
android:imeSubtypeMode = "keyboard"
|
||||
android:label="@string/app_name" />
|
||||
|
||||
6
keystore.properties
Normal file
@ -0,0 +1,6 @@
|
||||
app_name=Wallpaper Keyboard
|
||||
package_name=com.keyboard.wallpaperkeyboard
|
||||
keystoreFile=app/WallpaperKeyboard.jks
|
||||
key_alias=WallpaperKeyboardkey0
|
||||
key_store_password=WallpaperKeyboard
|
||||
key_password=WallpaperKeyboard
|
||||