V1.0.0(1),应用名改为Mobile Keyboard,完成
This commit is contained in:
parent
40898802df
commit
d7b0481abd
BIN
app/VibeKeyboard.jks
Normal file
BIN
app/VibeKeyboard.jks
Normal file
Binary file not shown.
@ -1,7 +1,10 @@
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Date
|
||||
|
||||
plugins {
|
||||
alias(libs.plugins.android.application)
|
||||
}
|
||||
|
||||
val timestamp = SimpleDateFormat("MM_dd_HH_mm").format(Date())
|
||||
android {
|
||||
namespace = "com.key.vibekeyboard"
|
||||
compileSdk = 34
|
||||
@ -16,7 +19,7 @@ android {
|
||||
targetSdk = 34
|
||||
versionCode = 1
|
||||
versionName = "1.0.0"
|
||||
|
||||
setProperty("archivesBaseName", "Mobile Keyboard" + versionName + "(${versionCode})_$timestamp")
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
|
||||
6
app/keystore.properties
Normal file
6
app/keystore.properties
Normal file
@ -0,0 +1,6 @@
|
||||
app_name=Vibe Keyboard
|
||||
package_name=com.key.vibekeyboard
|
||||
keystoreFile=app/VibeKeyboard.jks
|
||||
key_alias=VibeKeyboardkey0
|
||||
key_store_password=VibeKeyboard
|
||||
key_password=VibeKeyboard
|
||||
15
app/proguard-rules.pro
vendored
15
app/proguard-rules.pro
vendored
@ -19,3 +19,18 @@
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
|
||||
-keepclassmembers class com.key.vibekeyboard.AppApplication {
|
||||
public static final java.lang.String DB_Name;
|
||||
public static final int DB_Version;
|
||||
}
|
||||
|
||||
-keepclassmembers class * {
|
||||
@androidx.room.Query <methods>;
|
||||
}
|
||||
-keep class com.key.vibekeyboard.Room.MyDatabase { *; }
|
||||
-keep class com.key.vibekeyboard.Room.WallpaperInfo { *; }
|
||||
-keep class com.key.vibekeyboard.Room.WallpaperInfoDao { *; }
|
||||
-keep class com.key.vibekeyboard.Room.Category { *; }
|
||||
-keep class com.omicronapplications.** { *; }
|
||||
-keep class net.sf.sevenzipjbinding.** { *; }
|
||||
@ -16,10 +16,12 @@
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.KeyboardDemo"
|
||||
tools:targetApi="31">
|
||||
<activity
|
||||
android:name=".Activity.WriteActivity"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".Activity.MainActivity"
|
||||
android:exported="false">
|
||||
</activity>
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".Activity.PermissionActivity"
|
||||
android:exported="false" />
|
||||
|
||||
@ -54,7 +54,10 @@ public class CategoryActivity extends AppCompatActivity {
|
||||
TextView textView = customView.findViewById(R.id.category_tab_custom_title);
|
||||
Category category = categories.get(position);
|
||||
String dir = category.getClassName();
|
||||
textView.setText(dir.substring(dir.lastIndexOf("_") + 1));
|
||||
String text = dir.substring(dir.lastIndexOf("_") + 1);
|
||||
text = text.substring(0, 1).toUpperCase() + text.substring(1); // 首字母大写
|
||||
textView.setText(text);
|
||||
|
||||
|
||||
}).attach();
|
||||
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.key.vibekeyboard.Activity;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
@ -61,7 +62,6 @@ public class DownloadActivity extends AppCompatActivity {
|
||||
binding = null;
|
||||
}
|
||||
|
||||
|
||||
private void initData() {
|
||||
Intent intent = getIntent();
|
||||
WallpaperInfo wallpaperInfo = intent.getParcelableExtra("wallpaperInfo");
|
||||
@ -79,6 +79,8 @@ public class DownloadActivity extends AppCompatActivity {
|
||||
|
||||
Log.d("DownloadActivity", "wallpaperInfo: " + wallpaperInfo);
|
||||
|
||||
binding.downloadTitle.setText(wallpaperInfo.title);
|
||||
|
||||
DownlaodRecyclerViewAdapter adapter = new DownlaodRecyclerViewAdapter(this, wallpaperInfo, list);
|
||||
binding.downloadRecycler.setAdapter(adapter);
|
||||
binding.downloadRecycler.setLayoutManager(new GridLayoutManager(this, 2));
|
||||
@ -114,8 +116,8 @@ public class DownloadActivity extends AppCompatActivity {
|
||||
if (wallpaperInfo.getPreview() != null) {
|
||||
// 应用圆角变换
|
||||
RequestOptions options = new RequestOptions()
|
||||
.placeholder(R.drawable.ic_launcher_background)
|
||||
.error(R.drawable.ic_launcher_background)
|
||||
.placeholder(R.mipmap.splash)
|
||||
.error(R.mipmap.splash)
|
||||
.transform(new CenterCrop())
|
||||
.transform(new RoundedCorners(16)); // 设置圆角度数
|
||||
|
||||
@ -124,7 +126,7 @@ public class DownloadActivity extends AppCompatActivity {
|
||||
.apply(options)
|
||||
.into(binding.downloadImage);
|
||||
} else {
|
||||
binding.downloadImage.setImageResource(R.drawable.ic_launcher_foreground);
|
||||
binding.downloadImage.setImageResource(R.mipmap.splash);
|
||||
}
|
||||
|
||||
unzipPath = getCacheDir() + "/" + name;
|
||||
@ -170,7 +172,14 @@ public class DownloadActivity extends AppCompatActivity {
|
||||
if (successful) {
|
||||
Mytool.unZip(this, unzipPath, resource, (successful1, resDirPath) -> {
|
||||
if (successful1) {
|
||||
// 将路径存储到 SharedPreferences
|
||||
SharedPreferences sharedPreferences = getSharedPreferences("keyboard_prefs", MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = sharedPreferences.edit();
|
||||
editor.putString("wallpaper_path", resDirPath);
|
||||
editor.apply(); // 使用 apply() 异步保存
|
||||
|
||||
StaticValue.PATH = resDirPath;
|
||||
|
||||
if (otherdata != null) {
|
||||
otherdata.setPath(resDirPath);
|
||||
otherdata.setDownloaded(true);
|
||||
@ -182,10 +191,13 @@ public class DownloadActivity extends AppCompatActivity {
|
||||
Toast.makeText(DownloadActivity.this, "Decompression failure", Toast.LENGTH_SHORT).show();
|
||||
});
|
||||
}
|
||||
|
||||
// 解压完成,隐藏进度条
|
||||
runOnUiThread(() -> {
|
||||
progressBar.setVisibility(View.GONE);
|
||||
view.setVisibility(View.GONE);
|
||||
Intent intent = new Intent(DownloadActivity.this, WriteActivity.class);
|
||||
startActivity(intent);
|
||||
});
|
||||
});
|
||||
} else {
|
||||
|
||||
@ -11,6 +11,7 @@ import com.key.vibekeyboard.Adapter.MainViewpager2Adapter;
|
||||
import com.key.vibekeyboard.AppApplication;
|
||||
import com.key.vibekeyboard.Dialog.PermissionRequestDialog;
|
||||
import com.key.vibekeyboard.Dialog.RecommendedDialog;
|
||||
import com.key.vibekeyboard.R;
|
||||
import com.key.vibekeyboard.Room.Category;
|
||||
import com.key.vibekeyboard.Room.WallpaperInfo;
|
||||
import com.key.vibekeyboard.Utils.Mytool;
|
||||
@ -52,7 +53,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
showPermissionDialog(); // 否则显示权限请求对话框
|
||||
}
|
||||
|
||||
binding.mainViewpager.setUserInputEnabled(false);//禁止页面左右滑动
|
||||
// binding.mainViewpager.setUserInputEnabled(false);//禁止页面左右滑动
|
||||
|
||||
// 初始化 TabLayout(标签栏)
|
||||
tabLayout();
|
||||
@ -83,11 +84,11 @@ public class MainActivity extends AppCompatActivity {
|
||||
|
||||
// 设置默认的图标,未选中状态的图标
|
||||
if (position == 0) {
|
||||
tabBinding.iconCustom.setImageResource(android.R.drawable.ic_menu_camera); // 第一个 Tab 图标
|
||||
tabBinding.iconCustom.setImageResource(R.drawable.home_select); // 第一个 Tab 图标
|
||||
} else if (position == 1) {
|
||||
tabBinding.iconCustom.setImageResource(android.R.drawable.ic_menu_agenda); // 第二个 Tab 图标
|
||||
tabBinding.iconCustom.setImageResource(R.drawable.collection); // 第二个 Tab 图标
|
||||
} else {
|
||||
tabBinding.iconCustom.setImageResource(android.R.drawable.ic_menu_preferences); // 第三个 Tab 图标
|
||||
tabBinding.iconCustom.setImageResource(R.drawable.setting); // 第三个 Tab 图标
|
||||
}
|
||||
}).attach(); // 绑定 TabLayout 和 ViewPager
|
||||
|
||||
@ -99,11 +100,11 @@ public class MainActivity extends AppCompatActivity {
|
||||
MainTabCustomBinding tabBinding = MainTabCustomBinding.bind(Objects.requireNonNull(tab.getCustomView()));
|
||||
int position = tab.getPosition();
|
||||
if (position == 0) {
|
||||
tabBinding.iconCustom.setImageResource(android.R.drawable.ic_menu_camera); // 选中状态的图标
|
||||
tabBinding.iconCustom.setImageResource(R.drawable.home_select); // 选中状态的图标
|
||||
} else if (position == 1) {
|
||||
tabBinding.iconCustom.setImageResource(android.R.drawable.ic_menu_compass); // 第二个 Tab 选中图标
|
||||
tabBinding.iconCustom.setImageResource(R.drawable.collection_select); // 第二个 Tab 选中图标
|
||||
} else {
|
||||
tabBinding.iconCustom.setImageResource(android.R.drawable.ic_menu_rotate); // 第三个 Tab 选中图标
|
||||
tabBinding.iconCustom.setImageResource(R.drawable.setting_select); // 第三个 Tab 选中图标
|
||||
}
|
||||
}
|
||||
|
||||
@ -113,11 +114,11 @@ public class MainActivity extends AppCompatActivity {
|
||||
MainTabCustomBinding tabBinding = MainTabCustomBinding.bind(Objects.requireNonNull(tab.getCustomView()));
|
||||
int position = tab.getPosition();
|
||||
if (position == 0) {
|
||||
tabBinding.iconCustom.setImageResource(android.R.drawable.ic_menu_gallery); // 未选中状态的图标
|
||||
tabBinding.iconCustom.setImageResource(R.drawable.home); // 未选中状态的图标
|
||||
} else if (position == 1) {
|
||||
tabBinding.iconCustom.setImageResource(android.R.drawable.ic_menu_agenda); // 第二个 Tab 未选中图标
|
||||
tabBinding.iconCustom.setImageResource(R.drawable.collection); // 第二个 Tab 未选中图标
|
||||
} else {
|
||||
tabBinding.iconCustom.setImageResource(android.R.drawable.ic_menu_preferences); // 第三个 Tab 未选中图标
|
||||
tabBinding.iconCustom.setImageResource(R.drawable.setting); // 第三个 Tab 未选中图标
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -40,6 +40,8 @@ public class SearchActivity extends AppCompatActivity {
|
||||
|
||||
binding.recyclerView.setAdapter(adapter);
|
||||
|
||||
binding.back.setOnClickListener(v -> finish());
|
||||
|
||||
// 监听输入框内容变化
|
||||
binding.searchEditText.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
|
||||
@ -7,27 +7,32 @@ import android.widget.ProgressBar;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
|
||||
import com.key.vibekeyboard.R;
|
||||
import com.key.vibekeyboard.databinding.ActivitySplashBinding;
|
||||
|
||||
|
||||
public class SplashActivity extends AppCompatActivity {
|
||||
|
||||
private ActivitySplashBinding binding;
|
||||
private static final long TOTAL_TIME = 110;
|
||||
private static final long TOTAL_TIME = 3000;
|
||||
private CountDownTimer countDownTimer;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
// 初始化 ViewBinding
|
||||
binding = ActivitySplashBinding.inflate(getLayoutInflater());
|
||||
setContentView(binding.getRoot());
|
||||
|
||||
// 获取进度条引用
|
||||
ProgressBar progressBar = binding.progressBar;
|
||||
|
||||
// 初始化倒计时
|
||||
Glide.with(this)
|
||||
.load(R.mipmap.ic_launcher_foreground)
|
||||
.transform(new RoundedCorners(16))
|
||||
.into(binding.splashImage);
|
||||
|
||||
countDownTimer = new CountDownTimer(TOTAL_TIME, 100) { // 每100ms更新一次
|
||||
@Override
|
||||
public void onTick(long millisUntilFinished) {
|
||||
@ -38,29 +43,24 @@ public class SplashActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
public void onFinish() {
|
||||
// 确保进度条更新至满值
|
||||
progressBar.setProgress(100);
|
||||
|
||||
// 跳转到主界面
|
||||
startMain();
|
||||
}
|
||||
};
|
||||
|
||||
// 开始倒计时
|
||||
countDownTimer.start();
|
||||
}
|
||||
|
||||
// 跳转到主界面的方法
|
||||
private void startMain() {
|
||||
Intent intent = new Intent(SplashActivity.this, MainActivity.class);
|
||||
startActivity(intent);
|
||||
finish(); // 结束当前 Activity
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
// 取消倒计时,防止内存泄漏
|
||||
if (countDownTimer != null) {
|
||||
countDownTimer.cancel();
|
||||
}
|
||||
|
||||
@ -0,0 +1,21 @@
|
||||
package com.key.vibekeyboard.Activity;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.key.vibekeyboard.databinding.ActivityWriteBinding;
|
||||
|
||||
public class WriteActivity extends AppCompatActivity {
|
||||
|
||||
private ActivityWriteBinding binding;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
binding = ActivityWriteBinding.inflate(getLayoutInflater());
|
||||
setContentView(binding.getRoot());
|
||||
|
||||
binding.back.setOnClickListener(v -> finish());
|
||||
}
|
||||
}
|
||||
@ -46,13 +46,15 @@ public class CategoryRecyclerViewAdapter extends RecyclerView.Adapter<CategoryRe
|
||||
WallpaperInfo wallpaperInfo = list.get(position);
|
||||
Log.d("WallpaperInfo", "WallpaperInfo: " + wallpaperInfo);
|
||||
|
||||
List<WallpaperInfo> limitedList = list.subList(0, Math.min(20, list.size()));
|
||||
|
||||
if (wallpaperInfo != null) {
|
||||
holder.imageView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent(context, DownloadActivity.class);
|
||||
intent.putExtra("wallpaperInfo", wallpaperInfo); // wallpaperInfo 已经实现了 Parcelable
|
||||
intent.putParcelableArrayListExtra("list", new ArrayList<>(list)); // list 中的 WallpaperInfo 对象实现了 Parcelable
|
||||
intent.putParcelableArrayListExtra("list", new ArrayList<>(limitedList)); // list 中的 WallpaperInfo 对象实现了 Parcelable
|
||||
context.startActivity(intent);
|
||||
}
|
||||
});
|
||||
@ -63,8 +65,8 @@ public class CategoryRecyclerViewAdapter extends RecyclerView.Adapter<CategoryRe
|
||||
|
||||
// 应用圆角变换
|
||||
RequestOptions options = new RequestOptions()
|
||||
.placeholder(R.drawable.ic_launcher_background)
|
||||
.error(R.drawable.ic_launcher_background)
|
||||
.placeholder(R.mipmap.splash)
|
||||
.error(R.mipmap.splash)
|
||||
.transform(new CenterCrop())
|
||||
.transform(new RoundedCorners(16)); // 设置圆角度数
|
||||
|
||||
|
||||
@ -44,21 +44,22 @@ public class DownlaodRecyclerViewAdapter extends RecyclerView.Adapter<DownlaodRe
|
||||
|
||||
WallpaperInfo wallpaperInfo1 = list.get(position);
|
||||
|
||||
List<WallpaperInfo> limitedList = list.subList(0, Math.min(20, list.size()));
|
||||
|
||||
holder.imageView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent(downloadActivity, DownloadActivity.class);
|
||||
intent.putExtra("wallpaperInfo", wallpaperInfo1); // wallpaperInfo 已经实现了 Parcelable
|
||||
intent.putParcelableArrayListExtra("list", new ArrayList<>(list)); // list 中的 WallpaperInfo 对象实现了 Parcelable
|
||||
intent.putParcelableArrayListExtra("list", new ArrayList<>(limitedList)); // list 中的 WallpaperInfo 对象实现了 Parcelable
|
||||
downloadActivity.startActivity(intent);
|
||||
}
|
||||
});
|
||||
|
||||
// 应用圆角变换
|
||||
RequestOptions options = new RequestOptions()
|
||||
.placeholder(R.drawable.ic_launcher_background)
|
||||
.error(R.drawable.ic_launcher_background)
|
||||
.placeholder(R.mipmap.splash)
|
||||
.error(R.mipmap.splash)
|
||||
.transform(new CenterCrop())
|
||||
.transform(new RoundedCorners(16)); // 设置圆角度数
|
||||
|
||||
|
||||
@ -47,13 +47,15 @@ public class FavoriteRecyclerViewAdapter extends RecyclerView.Adapter<FavoriteRe
|
||||
|
||||
WallpaperInfo wallpaperInfo = list.get(position);
|
||||
|
||||
List<WallpaperInfo> limitedList = list.subList(0, Math.min(20, list.size()));
|
||||
|
||||
if (wallpaperInfo != null) {
|
||||
holder.imageView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent(context, DownloadActivity.class);
|
||||
intent.putExtra("wallpaperInfo", wallpaperInfo); // wallpaperInfo 已经实现了 Parcelable
|
||||
intent.putParcelableArrayListExtra("list", new ArrayList<>(list)); // list 中的 WallpaperInfo 对象实现了 Parcelable
|
||||
intent.putParcelableArrayListExtra("list", new ArrayList<>(limitedList)); // list 中的 WallpaperInfo 对象实现了 Parcelable
|
||||
context.startActivity(intent);
|
||||
}
|
||||
});
|
||||
@ -61,8 +63,8 @@ public class FavoriteRecyclerViewAdapter extends RecyclerView.Adapter<FavoriteRe
|
||||
|
||||
// 应用圆角变换
|
||||
RequestOptions options = new RequestOptions()
|
||||
.placeholder(R.drawable.ic_launcher_background)
|
||||
.error(R.drawable.ic_launcher_background)
|
||||
.placeholder(R.mipmap.splash)
|
||||
.error(R.mipmap.splash)
|
||||
.transform(new CenterCrop())
|
||||
.transform(new RoundedCorners(16)); // 设置圆角度数
|
||||
if (wallpaperInfo != null) {
|
||||
|
||||
@ -47,12 +47,14 @@ public class HomeRecyclerViewAdapter extends RecyclerView.Adapter<HomeRecyclerVi
|
||||
WallpaperInfo categoryWallpaperInfo = category.getList().get(position);
|
||||
WallpaperInfo wallpaperInfo = category.getList().get(0);
|
||||
|
||||
List<WallpaperInfo> limitedList = list.subList(0, Math.min(20, list.size()));
|
||||
|
||||
holder.imageView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent(context, DownloadActivity.class);
|
||||
intent.putExtra("wallpaperInfo", wallpaperInfo); // wallpaperInfo 已经实现了 Parcelable
|
||||
intent.putParcelableArrayListExtra("list", new ArrayList<>(list)); // list 中的 WallpaperInfo 对象实现了 Parcelable
|
||||
intent.putParcelableArrayListExtra("list", new ArrayList<>(limitedList)); // list 中的 WallpaperInfo 对象实现了 Parcelable
|
||||
context.startActivity(intent);
|
||||
}
|
||||
});
|
||||
@ -60,8 +62,8 @@ public class HomeRecyclerViewAdapter extends RecyclerView.Adapter<HomeRecyclerVi
|
||||
|
||||
// 应用圆角变换
|
||||
RequestOptions options = new RequestOptions()
|
||||
.placeholder(R.drawable.ic_launcher_background)
|
||||
.error(R.drawable.ic_launcher_background)
|
||||
.placeholder(R.mipmap.splash)
|
||||
.error(R.mipmap.splash)
|
||||
.transform(new CenterCrop())
|
||||
.transform(new RoundedCorners(16)); // 设置圆角度数
|
||||
|
||||
|
||||
@ -21,6 +21,7 @@ import com.key.vibekeyboard.Room.WallpaperInfo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class HomeViewPager2Adapter extends RecyclerView.Adapter<HomeViewPager2Adapter.HomeViewPager2ViewHolder> {
|
||||
|
||||
@ -46,23 +47,26 @@ public class HomeViewPager2Adapter extends RecyclerView.Adapter<HomeViewPager2Ad
|
||||
Category category = categories.get(actualPosition);
|
||||
List<WallpaperInfo> list = category.getList();
|
||||
WallpaperInfo categoryWallpaperInfo = category.getList().get(position);
|
||||
WallpaperInfo wallpaperInfo = category.getList().get(0); // 假设只使用列表的第一个壁纸
|
||||
Random random = new Random();
|
||||
int randomIndex = random.nextInt(20);
|
||||
WallpaperInfo wallpaperInfo = category.getList().get(randomIndex);
|
||||
|
||||
List<WallpaperInfo> limitedList = list.subList(0, Math.min(20, list.size()));
|
||||
|
||||
holder.imageView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent(context, DownloadActivity.class);
|
||||
intent.putExtra("wallpaperInfo", wallpaperInfo);
|
||||
intent.putParcelableArrayListExtra("list", new ArrayList<>(list));
|
||||
intent.putParcelableArrayListExtra("list", new ArrayList<>(limitedList));
|
||||
context.startActivity(intent);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// 应用圆角变换
|
||||
RequestOptions options = new RequestOptions()
|
||||
.placeholder(R.drawable.ic_launcher_background)
|
||||
.error(R.drawable.ic_launcher_background)
|
||||
.placeholder(R.mipmap.splash)
|
||||
.error(R.mipmap.splash)
|
||||
.transform(new CenterCrop())
|
||||
.transform(new RoundedCorners(16)); // 设置圆角度数
|
||||
|
||||
|
||||
@ -42,19 +42,21 @@ public class SearchRecyclerViewAdapter extends RecyclerView.Adapter<SearchRecycl
|
||||
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
||||
WallpaperInfo wallpaperInfo = wallpaperList.get(position);
|
||||
|
||||
List<WallpaperInfo> limitedList = wallpaperList.subList(0, Math.min(20, wallpaperList.size()));
|
||||
|
||||
holder.imageView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent(context, DownloadActivity.class);
|
||||
intent.putExtra("wallpaperInfo", wallpaperInfo); // wallpaperInfo 已经实现了 Parcelable
|
||||
intent.putParcelableArrayListExtra("list", new ArrayList<>(wallpaperList)); // list 中的 WallpaperInfo 对象实现了 Parcelable
|
||||
intent.putParcelableArrayListExtra("list", new ArrayList<>(limitedList)); // list 中的 WallpaperInfo 对象实现了 Parcelable
|
||||
context.startActivity(intent);
|
||||
}
|
||||
});
|
||||
// 应用圆角变换
|
||||
RequestOptions options = new RequestOptions()
|
||||
.placeholder(R.drawable.ic_launcher_background)
|
||||
.error(R.drawable.ic_launcher_background)
|
||||
.placeholder(R.mipmap.splash)
|
||||
.error(R.mipmap.splash)
|
||||
.transform(new CenterCrop())
|
||||
.transform(new RoundedCorners(16)); // 设置圆角度数
|
||||
|
||||
|
||||
@ -18,6 +18,8 @@ public class AppApplication extends Application {
|
||||
public static AppApplication instance;
|
||||
public static List<Category> categories;
|
||||
|
||||
public static final int DB_Version = 1;
|
||||
public static final String DB_Name = "image_database";
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
|
||||
@ -3,7 +3,10 @@ package com.key.vibekeyboard.Dialog;
|
||||
import android.app.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;
|
||||
@ -16,7 +19,10 @@ 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.key.vibekeyboard.AppApplication;
|
||||
import com.key.vibekeyboard.R;
|
||||
import com.key.vibekeyboard.Utils.Mytool;
|
||||
import com.key.vibekeyboard.databinding.DialogPermissionBinding;
|
||||
|
||||
@ -24,11 +30,11 @@ public class PermissionRequestDialog extends DialogFragment {
|
||||
|
||||
private DialogPermissionBinding binding;
|
||||
private InputMethodManager methodManager;
|
||||
private ContentObserver inputMethodObserver; // 用于监听输入法变化
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -42,25 +48,23 @@ public class PermissionRequestDialog extends DialogFragment {
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
Dialog dialog = getDialog();
|
||||
setCancelable(true); // 设置为false对话框不可点击外面取消
|
||||
setCancelable(true);
|
||||
if (dialog != null && dialog.getWindow() != null) {
|
||||
Window window = dialog.getWindow();
|
||||
// 设置宽度为屏幕的 90%,高度自适应内容
|
||||
window.setLayout((int) (getResources().getDisplayMetrics().widthPixels * 0.9), WindowManager.LayoutParams.WRAP_CONTENT);
|
||||
}
|
||||
|
||||
// 每次对话框显示时调用 update()
|
||||
update();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
public void init() {
|
||||
methodManager = (InputMethodManager) AppApplication.instance.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
|
||||
Glide.with(requireContext())
|
||||
.load(R.mipmap.ic_launcher_foreground)
|
||||
.transform(new RoundedCorners(16))
|
||||
.into(binding.imageView);
|
||||
|
||||
binding.firstIconTextLayout.setOnClickListener(v -> {
|
||||
Intent intent = new Intent(Settings.ACTION_INPUT_METHOD_SETTINGS);
|
||||
startActivity(intent);
|
||||
@ -70,9 +74,25 @@ public class PermissionRequestDialog extends DialogFragment {
|
||||
methodManager.showInputMethodPicker();
|
||||
});
|
||||
|
||||
binding.imageView.setOnClickListener(v -> {
|
||||
dismiss();
|
||||
});
|
||||
binding.imageView.setOnClickListener(v -> dismiss());
|
||||
|
||||
// 注册ContentObserver监听输入法变化
|
||||
inputMethodObserver = new ContentObserver(new Handler(Looper.getMainLooper())) {
|
||||
@Override
|
||||
public void onChange(boolean selfChange) {
|
||||
super.onChange(selfChange);
|
||||
if (Mytool.isStep1() && Mytool.isStep2()) {
|
||||
dismiss(); // 条件满足,关闭对话框
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// 注册观察输入法变化
|
||||
requireContext().getContentResolver().registerContentObserver(
|
||||
Settings.Secure.getUriFor(Settings.Secure.DEFAULT_INPUT_METHOD),
|
||||
false,
|
||||
inputMethodObserver
|
||||
);
|
||||
}
|
||||
|
||||
public void update() {
|
||||
@ -93,8 +113,9 @@ public class PermissionRequestDialog extends DialogFragment {
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
if (inputMethodObserver != null) {
|
||||
requireContext().getContentResolver().unregisterContentObserver(inputMethodObserver);
|
||||
}
|
||||
binding = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -62,6 +62,8 @@ public class RecommendedDialog extends DialogFragment {
|
||||
int randomIndex = random.nextInt(list.size());
|
||||
wallpaperInfo = list.get(randomIndex); // 获取随机的壁纸信息
|
||||
|
||||
List<WallpaperInfo> limitedList = list.subList(0, Math.min(20, list.size()));
|
||||
|
||||
// 加载图像
|
||||
loadImage();
|
||||
|
||||
@ -73,7 +75,7 @@ public class RecommendedDialog extends DialogFragment {
|
||||
// 将选中的壁纸信息传递给下一个 Activity
|
||||
intent.putExtra("wallpaperInfo", wallpaperInfo); // wallpaperInfo 已经实现了 Parcelable
|
||||
// 将壁纸列表传递给下一个 Activity
|
||||
intent.putParcelableArrayListExtra("list", new ArrayList<>(list)); // list 中的 WallpaperInfo 对象实现了 Parcelable
|
||||
intent.putParcelableArrayListExtra("list", new ArrayList<>(limitedList)); // list 中的 WallpaperInfo 对象实现了 Parcelable
|
||||
dismiss(); // 关闭当前对话框
|
||||
requireContext().startActivity(intent); // 启动下载界面
|
||||
}
|
||||
@ -86,8 +88,8 @@ public class RecommendedDialog extends DialogFragment {
|
||||
if (wallpaperInfo.getPreview() != null && !wallpaperInfo.getPreview().isEmpty()) {
|
||||
// 设置图像的加载选项
|
||||
RequestOptions options = new RequestOptions()
|
||||
.placeholder(R.drawable.ic_launcher_foreground) // 图片加载中的占位图
|
||||
.error(R.drawable.ic_launcher_foreground) // 图片加载失败时的备用图
|
||||
.placeholder(R.mipmap.splash)
|
||||
.error(R.mipmap.splash)
|
||||
.transform(new CenterCrop()) // 中心裁剪,保证图片填满控件
|
||||
.transform(new RoundedCorners(16)); // 设置圆角,16px
|
||||
|
||||
@ -99,7 +101,7 @@ public class RecommendedDialog extends DialogFragment {
|
||||
.into(binding.imageView); // 设置到 ImageView 上显示
|
||||
} else {
|
||||
// 如果预览图 URL 为空,显示默认图像
|
||||
binding.imageView.setImageResource(R.drawable.ic_launcher_background); // 默认图像
|
||||
binding.imageView.setImageResource(R.mipmap.splash); // 默认图像
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -17,6 +17,7 @@ import com.key.vibekeyboard.Utils.ItemDecoration;
|
||||
import com.key.vibekeyboard.ViewModel.FavoriteViewModel;
|
||||
import com.key.vibekeyboard.databinding.FragmentFavoriteBinding;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@ -24,12 +25,16 @@ import java.util.List;
|
||||
|
||||
private FragmentFavoriteBinding binding;
|
||||
private FavoriteRecyclerViewAdapter adapter;
|
||||
private final List<WallpaperInfo> wallpaperInfoList = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
binding = FragmentFavoriteBinding.inflate(inflater, container, false);
|
||||
|
||||
adapter = new FavoriteRecyclerViewAdapter(requireContext(), wallpaperInfoList);
|
||||
binding.favoriteRecyclerview.setAdapter(adapter);
|
||||
|
||||
// 初始化 RecyclerView 和 LayoutManager
|
||||
binding.favoriteRecyclerview.setLayoutManager(new GridLayoutManager(getContext(), 2));
|
||||
binding.favoriteRecyclerview.addItemDecoration(new ItemDecoration(16, 19, 10));
|
||||
@ -41,14 +46,15 @@ import java.util.List;
|
||||
favoriteViewModel.getFavoriteList().observe(getViewLifecycleOwner(), new Observer<List<WallpaperInfo>>() {
|
||||
@Override
|
||||
public void onChanged(List<WallpaperInfo> wallpaperInfoList) {
|
||||
// 更新 RecyclerView 的 Adapter
|
||||
if (adapter == null) {
|
||||
adapter = new FavoriteRecyclerViewAdapter(requireContext(), wallpaperInfoList);
|
||||
binding.favoriteRecyclerview.setAdapter(adapter);
|
||||
|
||||
if (wallpaperInfoList.isEmpty()) {
|
||||
binding.backgroundImage.setVisibility(View.VISIBLE);
|
||||
binding.backgroundText.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
// 更新现有 Adapter 数据
|
||||
adapter.updateList(wallpaperInfoList);
|
||||
binding.backgroundImage.setVisibility(View.GONE);
|
||||
binding.backgroundText.setVisibility(View.GONE);
|
||||
}
|
||||
adapter.updateList(wallpaperInfoList);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@ -12,11 +12,15 @@ import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewTreeObserver;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import com.key.vibekeyboard.Activity.CategoryActivity;
|
||||
import com.key.vibekeyboard.Activity.SearchActivity;
|
||||
import com.key.vibekeyboard.Adapter.HomeRecyclerViewAdapter;
|
||||
import com.key.vibekeyboard.Adapter.HomeViewPager2Adapter;
|
||||
import com.key.vibekeyboard.R;
|
||||
import com.key.vibekeyboard.Room.Category;
|
||||
import com.key.vibekeyboard.Utils.ItemDecoration;
|
||||
import com.key.vibekeyboard.Utils.Mytool;
|
||||
@ -29,6 +33,7 @@ public class HomeFragment extends Fragment {
|
||||
|
||||
private FragmentHomeBinding binding;
|
||||
private HomeViewPager2Adapter homeViewPager2Adapter;
|
||||
private List<Category> categories;
|
||||
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
|
||||
@ -45,12 +50,13 @@ public class HomeFragment extends Fragment {
|
||||
|
||||
public void initData() {
|
||||
// 解析Json
|
||||
List<Category> categories = Mytool.parseJsonToList("keyboard.json");
|
||||
categories = Mytool.parseJsonToList("keyboard.json");
|
||||
Log.d("dsd", "size" + categories.size());
|
||||
|
||||
// 设置ViewPager2
|
||||
homeViewPager2Adapter = new HomeViewPager2Adapter(requireContext(), categories);
|
||||
binding.homeViewPager.setAdapter(homeViewPager2Adapter);
|
||||
setupIndicators(categories.size());
|
||||
|
||||
// 设置RecyclerView
|
||||
binding.homeRecycler.setLayoutManager(new GridLayoutManager(getContext(), 2));
|
||||
@ -91,8 +97,22 @@ public class HomeFragment extends Fragment {
|
||||
}
|
||||
});
|
||||
|
||||
binding.homeViewPager.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
|
||||
@Override
|
||||
public void onGlobalLayout() {
|
||||
// 移除布局监听器,避免重复执行
|
||||
binding.homeViewPager.getViewTreeObserver().removeOnGlobalLayoutListener(this);
|
||||
// 动态生成圆点指示器
|
||||
setupIndicators(categories.size());
|
||||
// 初始设置选中的圆点
|
||||
updateIndicators(0);
|
||||
}
|
||||
});
|
||||
|
||||
// 设置自动轮播功能
|
||||
autoSlideImages();
|
||||
|
||||
setupViewPagerListener();
|
||||
}
|
||||
|
||||
// 自动轮播图片
|
||||
@ -118,6 +138,54 @@ public class HomeFragment extends Fragment {
|
||||
}, delay);
|
||||
}
|
||||
|
||||
private void setupViewPagerListener() {
|
||||
binding.homeViewPager.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() {
|
||||
@Override
|
||||
public void onPageSelected(int position) {
|
||||
super.onPageSelected(position);
|
||||
|
||||
updateIndicators(position); // 更新圆点
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void setupIndicators(int count) {
|
||||
LinearLayout indicatorLayout = binding.indicatorLayout;
|
||||
indicatorLayout.removeAllViews(); // 清空原有的圆点
|
||||
|
||||
for (int i = 0; i < count; i++) {
|
||||
ImageView indicator = new ImageView(getContext());
|
||||
indicator.setImageResource(R.drawable.circle_indicator); // 默认圆点
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
|
||||
ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
params.setMargins(8, 0, 8, 0); // 设置圆点间距
|
||||
indicator.setLayoutParams(params);
|
||||
indicatorLayout.addView(indicator);
|
||||
}
|
||||
|
||||
// 延迟设置选中的圆点
|
||||
indicatorLayout.post(() -> updateIndicators(0)); // 设置第一个圆点为选中状态
|
||||
}
|
||||
|
||||
private void updateIndicators(int position) {
|
||||
LinearLayout indicatorLayout = binding.indicatorLayout;
|
||||
int childCount = indicatorLayout.getChildCount();
|
||||
|
||||
for (int i = 0; i < childCount; i++) {
|
||||
ImageView indicator = (ImageView) indicatorLayout.getChildAt(i);
|
||||
if (i == position) {
|
||||
indicator.setImageResource(R.drawable.circle_indicator_selected); // 当前页选中的圆点
|
||||
} else {
|
||||
indicator.setImageResource(R.drawable.circle_indicator); // 默认圆点
|
||||
}
|
||||
}
|
||||
|
||||
// 强制更新布局,确保圆点大小正确
|
||||
indicatorLayout.requestLayout();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
|
||||
@ -1,10 +1,14 @@
|
||||
package com.key.vibekeyboard.Keyboard;
|
||||
|
||||
import static android.content.Context.MODE_PRIVATE;
|
||||
|
||||
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;
|
||||
@ -113,6 +117,7 @@ public class CustomViewConfig {
|
||||
return null;
|
||||
}
|
||||
BitmapDrawable bitmapDrawable = new BitmapDrawable(context.getResources(), BitmapFactory.decodeFile(filePath));
|
||||
Log.d("custom", "filePath" + filePath);
|
||||
return bitmapDrawable;
|
||||
}
|
||||
|
||||
@ -162,7 +167,7 @@ public class CustomViewConfig {
|
||||
}
|
||||
|
||||
public void updateConfig(Context con) {
|
||||
String resDirPath = StaticValue.PATH;
|
||||
String resDirPath = getSavedWallpaperPath(AppApplication.getContext());
|
||||
if (!resDirPath.isEmpty()) {
|
||||
updateKeyColor(resDirPath);
|
||||
BG = getBackGround(con, resDirPath);
|
||||
@ -175,5 +180,11 @@ public class CustomViewConfig {
|
||||
}
|
||||
}
|
||||
|
||||
public String getSavedWallpaperPath(Context context) {
|
||||
// 读取 SharedPreferences 中保存的路径
|
||||
SharedPreferences sharedPreferences = context.getSharedPreferences("keyboard_prefs", MODE_PRIVATE);
|
||||
return sharedPreferences.getString("wallpaper_path", ""); // 如果没有保存,返回空字符串
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -33,6 +33,9 @@ public class KeyboardService extends InputMethodService implements KeyboardView.
|
||||
// 加载主键盘视图布局文件
|
||||
View inputView = LayoutInflater.from(this).inflate(R.layout.keyboard_view, null, false);
|
||||
myKeyboard = inputView.findViewById(R.id.keyboardView); // 绑定键盘视图
|
||||
|
||||
setBackground();
|
||||
|
||||
myKeyboard.setKeyboard(new MyKeyboard.KeyBoard(this, ViewXmls[0])); // 设置默认键盘布局
|
||||
myKeyboard.setOnKeyboardActionListener(this); // 设置键盘操作监听器
|
||||
// myKeyboard.setPreviewEnabled(false); // 可选项,禁用按键预览
|
||||
@ -43,6 +46,10 @@ public class KeyboardService extends InputMethodService implements KeyboardView.
|
||||
@Override
|
||||
public void onWindowShown() {
|
||||
super.onWindowShown();
|
||||
setBackground();
|
||||
}
|
||||
|
||||
private void setBackground(){
|
||||
curImeAction = getImeAction(getCurrentInputEditorInfo().imeOptions); // 获取当前的输入法动作类型
|
||||
myKeyboard.updateConfigView(this, curImeAction); // 更新键盘配置视图
|
||||
myKeyboard.invalidate(); // 刷新键盘视图
|
||||
@ -54,18 +61,6 @@ public class KeyboardService extends InputMethodService implements KeyboardView.
|
||||
return i;
|
||||
}
|
||||
|
||||
// 键被按下时调用
|
||||
@Override
|
||||
public void onPress(int primaryCode) {
|
||||
|
||||
}
|
||||
|
||||
// 键被释放时调用
|
||||
@Override
|
||||
public void onRelease(int primaryCode) {
|
||||
|
||||
}
|
||||
|
||||
// 键盘按键被按下时调用
|
||||
@Override
|
||||
public void onKey(int primaryCode, int[] keyCodes) {
|
||||
@ -125,6 +120,19 @@ public class KeyboardService extends InputMethodService implements KeyboardView.
|
||||
myKeyboard.setKeyboard(new MyKeyboard.KeyBoard(this, ViewXmls[i])); // 设置新的键盘布局
|
||||
}
|
||||
|
||||
// 键被按下时调用
|
||||
@Override
|
||||
public void onPress(int primaryCode) {
|
||||
|
||||
}
|
||||
|
||||
// 键被释放时调用
|
||||
@Override
|
||||
public void onRelease(int primaryCode) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onText(CharSequence text) {
|
||||
// 文本输入时调用(未实现)
|
||||
|
||||
@ -7,7 +7,7 @@ import androidx.room.RoomDatabase;
|
||||
|
||||
import com.key.vibekeyboard.AppApplication;
|
||||
|
||||
@Database(entities = {WallpaperInfo.class}, version = 1, exportSchema = false)
|
||||
@Database(entities = {WallpaperInfo.class}, version = AppApplication.DB_Version, exportSchema = false)
|
||||
public abstract class MyDatabase extends RoomDatabase {
|
||||
|
||||
public abstract WallpaperInfoDao wallpaperInfoDao();
|
||||
@ -17,7 +17,7 @@ public abstract class MyDatabase extends RoomDatabase {
|
||||
public static MyDatabase getInstance() {
|
||||
if (INSTANCE == null) {
|
||||
synchronized (MyDatabase.class) {
|
||||
INSTANCE = Room.databaseBuilder(AppApplication.getContext(), MyDatabase.class, "Database").build();
|
||||
INSTANCE = Room.databaseBuilder(AppApplication.getContext(), MyDatabase.class, AppApplication.DB_Name).build();
|
||||
}
|
||||
}
|
||||
return INSTANCE;
|
||||
|
||||
@ -8,6 +8,7 @@ import android.graphics.drawable.Drawable;
|
||||
import android.inputmethodservice.Keyboard;
|
||||
import android.os.Build;
|
||||
import android.provider.Settings;
|
||||
import android.util.Log;
|
||||
import android.util.TypedValue;
|
||||
import android.view.inputmethod.InputMethodInfo;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
@ -44,9 +45,11 @@ import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
import java.io.RandomAccessFile;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
@ -178,26 +181,42 @@ public class Mytool {
|
||||
Toast.makeText(context, context.getString(R.string.app_name), Toast.LENGTH_SHORT).show();
|
||||
} else {
|
||||
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 (int d = 0; d < archiveItems.length; d++) {
|
||||
ISimpleInArchiveItem simple = archiveItems[d];
|
||||
File file = new File(urlpath, simple.getPath());
|
||||
File file = new File(extractPath, simple.getPath()); // 将解压路径设置为外部存储目录
|
||||
if (!simple.isFolder()) { // 如果不是文件夹,解压文件
|
||||
RandomAccessFileOutStream outStream = new RandomAccessFileOutStream(new RandomAccessFile(file, "rw"));
|
||||
simple.extractSlow(outStream);
|
||||
itemFilePath = file.getPath(); // 记录解压后的文件路径
|
||||
Log.d("--------", "path: " + itemFilePath);
|
||||
} else {
|
||||
boolean mkdirs = file.mkdirs(); // 创建文件夹
|
||||
}
|
||||
}
|
||||
|
||||
inStream.close();
|
||||
iInArchive.close();
|
||||
|
||||
// 截取资源路径
|
||||
int res = itemFilePath.indexOf("res");
|
||||
String substring = itemFilePath.substring(0, res + 3); // 截取资源路径
|
||||
Log.d("--------", "substring: " + substring);
|
||||
|
||||
callback.onUnzipCall(true, substring); // 调用回调函数
|
||||
}
|
||||
}
|
||||
@ -227,7 +246,23 @@ public class Mytool {
|
||||
public boolean onResourceReady(@NonNull File resource, @NonNull Object model, Target<File> target, @NonNull DataSource dataSource, boolean isFirstResource) {
|
||||
// 下载成功时的回调
|
||||
try {
|
||||
callback.onDownloadCall(true, resource); // 调用回调方法,传递成功状态和下载的文件
|
||||
// 使用外部存储目录或内部存储目录
|
||||
File externalDir = context.getExternalFilesDir(null);
|
||||
if (externalDir == null) {
|
||||
externalDir = context.getFilesDir(); // 如果外部存储不可用,则回退到内部存储
|
||||
}
|
||||
|
||||
// 将下载文件保存到外部存储的特定文件夹
|
||||
File downloadDir = new File(externalDir, "DownloadedFiles");
|
||||
if (!downloadDir.exists()) {
|
||||
downloadDir.mkdirs(); // 创建目录
|
||||
}
|
||||
|
||||
File destinationFile = new File(downloadDir, resource.getName());
|
||||
copyFile(resource, destinationFile); // 使用FileUtils来复制文件
|
||||
|
||||
callback.onDownloadCall(true, destinationFile); // 调用回调方法,传递成功状态和保存后的文件路径
|
||||
Log.d("--------", "resource: " + destinationFile);
|
||||
} catch (FileNotFoundException e) {
|
||||
throw new RuntimeException(e); // 如果捕获到FileNotFoundException异常,抛出运行时异常
|
||||
} catch (IOException e) {
|
||||
@ -238,6 +273,17 @@ public class Mytool {
|
||||
}).preload(); // 预加载文件
|
||||
}
|
||||
|
||||
public static void copyFile(File sourceFile, File destinationFile) throws IOException {
|
||||
try (InputStream in = new FileInputStream(sourceFile);
|
||||
OutputStream out = new FileOutputStream(destinationFile)) {
|
||||
byte[] buffer = new byte[1024];
|
||||
int bytesRead;
|
||||
while ((bytesRead = in.read(buffer)) != -1) {
|
||||
out.write(buffer, 0, bytesRead);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 将文件内容转换为字符串
|
||||
public static String fileToString(File file) throws IOException {
|
||||
FileInputStream fileInputStream = new FileInputStream(file);
|
||||
|
||||
30
app/src/main/res/drawable/all.xml
Normal file
30
app/src/main/res/drawable/all.xml
Normal file
@ -0,0 +1,30 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="48"
|
||||
android:viewportHeight="48">
|
||||
<path
|
||||
android:pathData="M18,6H8C6.895,6 6,6.895 6,8V18C6,19.105 6.895,20 8,20H18C19.105,20 20,19.105 20,18V8C20,6.895 19.105,6 18,6Z"
|
||||
android:strokeLineJoin="round"
|
||||
android:strokeWidth="4"
|
||||
android:fillColor="#00000000"
|
||||
android:strokeColor="#333"/>
|
||||
<path
|
||||
android:pathData="M18,28H8C6.895,28 6,28.895 6,30V40C6,41.105 6.895,42 8,42H18C19.105,42 20,41.105 20,40V30C20,28.895 19.105,28 18,28Z"
|
||||
android:strokeLineJoin="round"
|
||||
android:strokeWidth="4"
|
||||
android:fillColor="#00000000"
|
||||
android:strokeColor="#333"/>
|
||||
<path
|
||||
android:pathData="M40,6H30C28.895,6 28,6.895 28,8V18C28,19.105 28.895,20 30,20H40C41.105,20 42,19.105 42,18V8C42,6.895 41.105,6 40,6Z"
|
||||
android:strokeLineJoin="round"
|
||||
android:strokeWidth="4"
|
||||
android:fillColor="#00000000"
|
||||
android:strokeColor="#333"/>
|
||||
<path
|
||||
android:pathData="M40,28H30C28.895,28 28,28.895 28,30V40C28,41.105 28.895,42 30,42H40C41.105,42 42,41.105 42,40V30C42,28.895 41.105,28 40,28Z"
|
||||
android:strokeLineJoin="round"
|
||||
android:strokeWidth="4"
|
||||
android:fillColor="#00000000"
|
||||
android:strokeColor="#333"/>
|
||||
</vector>
|
||||
8
app/src/main/res/drawable/circle_indicator.xml
Normal file
8
app/src/main/res/drawable/circle_indicator.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<!-- res/drawable/circle_indicator.xml -->
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="@android:color/darker_gray" />
|
||||
<size
|
||||
android:width="10dp"
|
||||
android:height="10dp" />
|
||||
<corners android:radius="5dp"/>
|
||||
</shape>
|
||||
8
app/src/main/res/drawable/circle_indicator_selected.xml
Normal file
8
app/src/main/res/drawable/circle_indicator_selected.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<!-- res/drawable/circle_indicator_selected.xml -->
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="#2196F3" />
|
||||
<size
|
||||
android:width="20dp"
|
||||
android:height="10dp" />
|
||||
<corners android:radius="5dp"/>
|
||||
</shape>
|
||||
27
app/src/main/res/drawable/collection.xml
Normal file
27
app/src/main/res/drawable/collection.xml
Normal file
@ -0,0 +1,27 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="48"
|
||||
android:viewportHeight="48">
|
||||
<path
|
||||
android:pathData="M10,44H38C39.105,44 40,43.105 40,42V14H30V4H10C8.895,4 8,4.895 8,6V42C8,43.105 8.895,44 10,44Z"
|
||||
android:strokeLineJoin="round"
|
||||
android:strokeWidth="4"
|
||||
android:fillColor="#00000000"
|
||||
android:strokeColor="#333"
|
||||
android:strokeLineCap="round"/>
|
||||
<path
|
||||
android:pathData="M30,4L40,14"
|
||||
android:strokeLineJoin="round"
|
||||
android:strokeWidth="4"
|
||||
android:fillColor="#00000000"
|
||||
android:strokeColor="#333"
|
||||
android:strokeLineCap="round"/>
|
||||
<path
|
||||
android:pathData="M20.85,21C18.724,21 17,23.009 17,25.486C17,29.973 21.55,34.051 24,35C26.45,34.051 31,29.973 31,25.486C31,23.009 29.276,21 27.15,21C25.848,21 24.697,21.753 24,22.906C23.303,21.753 22.152,21 20.85,21Z"
|
||||
android:strokeLineJoin="round"
|
||||
android:strokeWidth="4"
|
||||
android:fillColor="#00000000"
|
||||
android:strokeColor="#333"
|
||||
android:strokeLineCap="round"/>
|
||||
</vector>
|
||||
27
app/src/main/res/drawable/collection_select.xml
Normal file
27
app/src/main/res/drawable/collection_select.xml
Normal file
@ -0,0 +1,27 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="48"
|
||||
android:viewportHeight="48">
|
||||
<path
|
||||
android:pathData="M10,44H38C39.105,44 40,43.105 40,42V14H30V4H10C8.895,4 8,4.895 8,6V42C8,43.105 8.895,44 10,44Z"
|
||||
android:strokeLineJoin="round"
|
||||
android:strokeWidth="4"
|
||||
android:fillColor="#2F88FF"
|
||||
android:strokeColor="#333"
|
||||
android:strokeLineCap="round"/>
|
||||
<path
|
||||
android:pathData="M30,4L40,14"
|
||||
android:strokeLineJoin="round"
|
||||
android:strokeWidth="4"
|
||||
android:fillColor="#00000000"
|
||||
android:strokeColor="#333"
|
||||
android:strokeLineCap="round"/>
|
||||
<path
|
||||
android:pathData="M20.85,21C18.724,21 17,23.009 17,25.486C17,29.973 21.55,34.051 24,35C26.45,34.051 31,29.973 31,25.486C31,23.009 29.276,21 27.15,21C25.848,21 24.697,21.753 24,22.906C23.303,21.753 22.152,21 20.85,21Z"
|
||||
android:strokeLineJoin="round"
|
||||
android:strokeWidth="4"
|
||||
android:fillColor="#2F88FF"
|
||||
android:strokeColor="#333"
|
||||
android:strokeLineCap="round"/>
|
||||
</vector>
|
||||
8
app/src/main/res/drawable/edit_text_border.xml
Normal file
8
app/src/main/res/drawable/edit_text_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="#FFFFFF" /> <!-- 背景颜色 -->
|
||||
<stroke
|
||||
android:width="1dp"
|
||||
android:color="#000000" /> <!-- 边框颜色和宽度 -->
|
||||
<corners android:radius="8dp" /> <!-- 圆角半径 -->
|
||||
</shape>
|
||||
25
app/src/main/res/drawable/home.xml
Normal file
25
app/src/main/res/drawable/home.xml
Normal file
@ -0,0 +1,25 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="48"
|
||||
android:viewportHeight="48">
|
||||
<path
|
||||
android:pathData="M9,18V42H39V18L24,6L9,18Z"
|
||||
android:strokeLineJoin="round"
|
||||
android:strokeWidth="4"
|
||||
android:fillColor="#00000000"
|
||||
android:strokeColor="#333"
|
||||
android:strokeLineCap="round"/>
|
||||
<path
|
||||
android:pathData="M19,29V42H29V29H19Z"
|
||||
android:strokeLineJoin="round"
|
||||
android:strokeWidth="4"
|
||||
android:fillColor="#00000000"
|
||||
android:strokeColor="#333"/>
|
||||
<path
|
||||
android:pathData="M9,42H39"
|
||||
android:strokeWidth="4"
|
||||
android:fillColor="#00000000"
|
||||
android:strokeColor="#333"
|
||||
android:strokeLineCap="round"/>
|
||||
</vector>
|
||||
25
app/src/main/res/drawable/home_select.xml
Normal file
25
app/src/main/res/drawable/home_select.xml
Normal file
@ -0,0 +1,25 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="48"
|
||||
android:viewportHeight="48">
|
||||
<path
|
||||
android:pathData="M9,18V42H39V18L24,6L9,18Z"
|
||||
android:strokeLineJoin="round"
|
||||
android:strokeWidth="4"
|
||||
android:fillColor="#2F88FF"
|
||||
android:strokeColor="#333"
|
||||
android:strokeLineCap="round"/>
|
||||
<path
|
||||
android:pathData="M19,29V42H29V29H19Z"
|
||||
android:strokeLineJoin="round"
|
||||
android:strokeWidth="4"
|
||||
android:fillColor="#2F88FF"
|
||||
android:strokeColor="#333"/>
|
||||
<path
|
||||
android:pathData="M9,42H39"
|
||||
android:strokeWidth="4"
|
||||
android:fillColor="#00000000"
|
||||
android:strokeColor="#333"
|
||||
android:strokeLineCap="round"/>
|
||||
</vector>
|
||||
18
app/src/main/res/drawable/setting.xml
Normal file
18
app/src/main/res/drawable/setting.xml
Normal file
@ -0,0 +1,18 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="48"
|
||||
android:viewportHeight="48">
|
||||
<path
|
||||
android:pathData="M34,41L44,24L34,7H14L4,24L14,41H34Z"
|
||||
android:strokeLineJoin="round"
|
||||
android:strokeWidth="4"
|
||||
android:fillColor="#00000000"
|
||||
android:strokeColor="#333"/>
|
||||
<path
|
||||
android:pathData="M24,29C26.761,29 29,26.761 29,24C29,21.239 26.761,19 24,19C21.239,19 19,21.239 19,24C19,26.761 21.239,29 24,29Z"
|
||||
android:strokeLineJoin="round"
|
||||
android:strokeWidth="4"
|
||||
android:fillColor="#00000000"
|
||||
android:strokeColor="#333"/>
|
||||
</vector>
|
||||
18
app/src/main/res/drawable/setting_select.xml
Normal file
18
app/src/main/res/drawable/setting_select.xml
Normal file
@ -0,0 +1,18 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="48"
|
||||
android:viewportHeight="48">
|
||||
<path
|
||||
android:pathData="M34,41L44,24L34,7H14L4,24L14,41H34Z"
|
||||
android:strokeLineJoin="round"
|
||||
android:strokeWidth="4"
|
||||
android:fillColor="#2F88FF"
|
||||
android:strokeColor="#333"/>
|
||||
<path
|
||||
android:pathData="M24,29C26.761,29 29,26.761 29,24C29,21.239 26.761,19 24,19C21.239,19 19,21.239 19,24C19,26.761 21.239,29 24,29Z"
|
||||
android:strokeLineJoin="round"
|
||||
android:strokeWidth="4"
|
||||
android:fillColor="#2F88FF"
|
||||
android:strokeColor="#333"/>
|
||||
</vector>
|
||||
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="@android:color/holo_blue_bright" />
|
||||
<solid android:color="#37D0E7" />
|
||||
<corners android:radius="22dp"/>
|
||||
</shape>
|
||||
@ -11,18 +11,21 @@
|
||||
android:id="@+id/category_back"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="11dp"
|
||||
android:src="@android:drawable/ic_menu_revert"
|
||||
android:layout_marginStart="15dp"
|
||||
android:src="@drawable/back"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
app:layout_constraintTop_toTopOf="@+id/category_title"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/category_title"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/category_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="11dp"
|
||||
android:layout_marginTop="26dp"
|
||||
android:gravity="center"
|
||||
android:text="Simple Keyboard"
|
||||
android:text="@string/app_name"
|
||||
android:textSize="24sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
@ -31,10 +34,11 @@
|
||||
android:id="@+id/category_search"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="11dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:src="@android:drawable/ic_menu_search"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
app:layout_constraintTop_toTopOf="@+id/category_title"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/category_title" />
|
||||
|
||||
<com.google.android.material.tabs.TabLayout
|
||||
android:id="@+id/category_tab"
|
||||
|
||||
@ -12,8 +12,9 @@
|
||||
android:id="@+id/download_back"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="11dp"
|
||||
android:src="@android:drawable/ic_menu_revert"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginTop="26dp"
|
||||
android:src="@drawable/back"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
@ -21,8 +22,10 @@
|
||||
android:id="@+id/download_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="11dp"
|
||||
android:layout_marginTop="26dp"
|
||||
android:gravity="center"
|
||||
android:text="love kiteen"
|
||||
android:textSize="24sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
@ -31,7 +34,8 @@
|
||||
android:id="@+id/download_favorite"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="11dp"
|
||||
android:layout_marginTop="26dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:src="@android:drawable/btn_star"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
@ -40,14 +44,16 @@
|
||||
android:id="@+id/download_image"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="150dp"
|
||||
android:layout_marginTop="15dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/download_back" />
|
||||
app:layout_constraintTop_toBottomOf="@+id/download_title" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/download_download"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:background="@drawable/rounded_rectangle"
|
||||
android:backgroundTint="@android:color/holo_blue_light"
|
||||
android:gravity="center"
|
||||
@ -61,13 +67,14 @@
|
||||
android:id="@+id/download_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:src="@android:drawable/stat_sys_download" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/download_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Download"
|
||||
android:text="Download&Apply"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="16sp" />
|
||||
|
||||
@ -80,7 +87,8 @@
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:gravity="center"
|
||||
android:text="Simple Keyboard"
|
||||
android:text="@string/app_name"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/download_download" />
|
||||
|
||||
@ -89,8 +97,10 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:gravity="center"
|
||||
android:text="View All"
|
||||
android:text="@string/view_all"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintEnd_toStartOf="@+id/download_all"
|
||||
app:layout_constraintTop_toBottomOf="@+id/download_download" />
|
||||
|
||||
@ -100,7 +110,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:src="@android:drawable/ic_menu_sort_by_size"
|
||||
android:src="@drawable/all"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/download_download" />
|
||||
|
||||
@ -127,9 +137,9 @@
|
||||
android:id="@+id/view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#80000000"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:background="#80000000"
|
||||
android:visibility="gone" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@ -1,16 +1,49 @@
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<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="@mipmap/activity_background"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/back"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="15dp"
|
||||
android:src="@drawable/back"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/search_title"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/search_title" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/search_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="26dp"
|
||||
android:text="@string/search"
|
||||
android:textSize="24sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/searchEditText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="Search" />
|
||||
android:layout_marginTop="15dp"
|
||||
android:hint="@string/search"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/search_title" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyclerView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="15dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/searchEditText" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
@ -10,19 +10,21 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/splash_image"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="150dp"
|
||||
android:layout_width="250dp"
|
||||
android:layout_height="250dp"
|
||||
android:src="@mipmap/ic_launcher_foreground"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.552"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.388" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/splash_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginTop="64dp"
|
||||
android:text="@string/app_name"
|
||||
android:textSize="25sp"
|
||||
android:textStyle="bold"
|
||||
|
||||
45
app/src/main/res/layout/activity_write.xml
Normal file
45
app/src/main/res/layout/activity_write.xml
Normal file
@ -0,0 +1,45 @@
|
||||
<?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="@mipmap/activity_background"
|
||||
tools:context=".Activity.WriteActivity">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/back"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginTop="26dp"
|
||||
android:src="@drawable/back"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/download_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="26dp"
|
||||
android:text="@string/write"
|
||||
android:textSize="24sp"
|
||||
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="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:background="@drawable/edit_text_border"
|
||||
android:hint="@string/type_a_message"
|
||||
android:padding="15dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@ -12,6 +12,7 @@
|
||||
android:paddingTop="10dp"
|
||||
android:paddingEnd="12dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="17sp" />
|
||||
|
||||
|
||||
@ -3,14 +3,15 @@
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#f0f0f0">
|
||||
android:background="#00BCD4">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="150dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:src="@drawable/ic_launcher_foreground"
|
||||
android:src="@mipmap/ic_launcher_foreground"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
@ -19,8 +20,9 @@
|
||||
android:id="@+id/textView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:text="示例文字"
|
||||
android:text="@string/activate_vibe_keyboard"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
@ -31,6 +33,7 @@
|
||||
android:id="@+id/firstIconTextLayout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:background="@drawable/permission_select"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
@ -43,12 +46,12 @@
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:src="@drawable/ic_launcher_foreground" />
|
||||
android:src="@mipmap/splash" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="图标文字1" />
|
||||
android:text="@string/step_1_select" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
@ -68,12 +71,24 @@
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:src="@drawable/ic_launcher_foreground" />
|
||||
android:src="@mipmap/splash" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="图标文字2" />
|
||||
android:text="@string/step_2_enable" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toBottomOf="@+id/secondIconTextLayout">
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="15dp"
|
||||
android:background="@android:color/transparent" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
@ -3,24 +3,29 @@
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/black">
|
||||
android:padding="5dp"
|
||||
android:background="#00BCD4">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_marginTop="15dp"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/ic_launcher_foreground" />
|
||||
android:src="@mipmap/splash"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:background="@android:color/transparent"
|
||||
android:gravity="center"
|
||||
android:text="@string/app_name"
|
||||
android:textColor="#333333"
|
||||
android:text="@string/today_s_recommendation"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
tools:context=".Fragment.CategoryFragment">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
|
||||
@ -10,9 +10,11 @@
|
||||
android:id="@+id/favorite_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="11dp"
|
||||
android:layout_marginTop="26dp"
|
||||
android:gravity="center"
|
||||
android:text="Simple Keyboard"
|
||||
android:text="@string/favorite"
|
||||
android:textSize="24sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
@ -22,7 +24,30 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="20dp"
|
||||
app:layout_constraintTop_toBottomOf="@+id/favorite_title"
|
||||
app:layout_constraintBottom_toBottomOf="parent"/>
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/favorite_title" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/background_image"
|
||||
android:layout_width="250dp"
|
||||
android:layout_height="250dp"
|
||||
android:src="@mipmap/favorite_back"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/background_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="30dp"
|
||||
android:text="@string/you_have_not_yet_included_any_favorite_photos_in_the_folder"
|
||||
android:visibility="gone"
|
||||
android:gravity="center"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/background_image" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@ -11,9 +11,11 @@
|
||||
android:id="@+id/home_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="11dp"
|
||||
android:layout_marginTop="26dp"
|
||||
android:gravity="center"
|
||||
android:text="Simple Keyboard"
|
||||
android:text="@string/app_name"
|
||||
android:textSize="24sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
@ -22,21 +24,34 @@
|
||||
android:id="@+id/home_search"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="11dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:src="@android:drawable/ic_menu_search"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/home_title"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
app:layout_constraintTop_toTopOf="@+id/home_title" />
|
||||
|
||||
<androidx.viewpager2.widget.ViewPager2
|
||||
android:id="@+id/home_viewPager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="150dp"
|
||||
android:layout_height="200dp"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
app:layout_constraintTop_toBottomOf="@+id/home_title" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/indicatorLayout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
android:padding="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="@id/home_viewPager" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/home_text1"
|
||||
android:layout_width="wrap_content"
|
||||
@ -44,7 +59,8 @@
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:gravity="center"
|
||||
android:text="More recommendations"
|
||||
android:text="@string/more_recommendations"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/home_viewPager" />
|
||||
|
||||
@ -54,7 +70,9 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:gravity="center"
|
||||
android:text="View All"
|
||||
android:text="@string/view_all"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintEnd_toStartOf="@+id/home_all"
|
||||
app:layout_constraintTop_toBottomOf="@+id/home_viewPager" />
|
||||
|
||||
@ -62,9 +80,9 @@
|
||||
android:id="@+id/home_all"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:src="@android:drawable/ic_menu_sort_by_size"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:src="@drawable/all"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/home_viewPager" />
|
||||
|
||||
@ -73,7 +91,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="12dp"
|
||||
app:layout_constraintTop_toBottomOf="@+id/home_text1"
|
||||
app:layout_constraintBottom_toBottomOf="parent"/>
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/home_text1" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
@ -24,7 +24,8 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:text="Setting"
|
||||
android:textStyle="bold"
|
||||
android:text="@string/setting"
|
||||
android:textSize="24sp" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
@ -55,7 +56,7 @@
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_weight="1"
|
||||
android:text="Version"
|
||||
android:text="@string/version"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
@ -84,7 +85,7 @@
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_weight="1"
|
||||
android:text="Share"
|
||||
android:text="@string/share"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<ImageView
|
||||
|
||||
@ -6,7 +6,6 @@
|
||||
<ImageView
|
||||
android:id="@+id/home_recycler_image"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scaleType="centerCrop" />
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@ -1,12 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="match_parent"
|
||||
android:padding="10dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/home_viewpager_image"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scaleType="centerCrop" />
|
||||
android:scaleType="fitXY" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
BIN
app/src/main/res/mipmap-hdpi/favorite_back.png
Normal file
BIN
app/src/main/res/mipmap-hdpi/favorite_back.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 93 KiB |
@ -1,4 +1,18 @@
|
||||
<resources>
|
||||
<string name="app_name">Vibe Keyboard</string>
|
||||
<string name="app_name">Mobile Keyboard</string>
|
||||
<string name="hello_blank_fragment">Hello blank fragment</string>
|
||||
<string name="you_have_not_yet_included_any_favorite_photos_in_the_folder">"No favorite photos in this folder yet."</string>
|
||||
<string name="type_a_message">Type a Message</string>
|
||||
<string name="write">Write</string>
|
||||
<string name="view_all">All categories</string>
|
||||
<string name="search">Search</string>
|
||||
<string name="step_1_select">Step 1 : Select</string>
|
||||
<string name="step_2_enable">Step 2 : Enable</string>
|
||||
<string name="activate_vibe_keyboard">Activate Vibe Keyboard</string>
|
||||
<string name="today_s_recommendation">Today\'s recommendation</string>
|
||||
<string name="favorite">Favorite</string>
|
||||
<string name="more_recommendations">More recommendations</string>
|
||||
<string name="setting">Setting</string>
|
||||
<string name="version">Version</string>
|
||||
<string name="share">Share</string>
|
||||
</resources>
|
||||
Loading…
Reference in New Issue
Block a user