Skip to content

Commit

Permalink
update to 1.4
Browse files Browse the repository at this point in the history
  • Loading branch information
linesoft2 committed Sep 29, 2020
1 parent befa983 commit d9fd19d
Show file tree
Hide file tree
Showing 14 changed files with 76 additions and 258 deletions.
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions app/build.gradle
Expand Up @@ -2,13 +2,13 @@ apply plugin: 'com.android.application'

android {
compileSdkVersion 30
buildToolsVersion '30.0.1'
buildToolsVersion '30.0.2'
defaultConfig {
applicationId "top.linesoft.open2share"
minSdkVersion 21
targetSdkVersion 30
versionCode 4
versionName '1.3'
versionCode 5
versionName '1.4'
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
Expand All @@ -25,11 +25,11 @@ android {

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
implementation 'androidx.preference:preference:1.1.1'
//implementation 'com.blankj:utilcodex:1.29.0'
testImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}
12 changes: 6 additions & 6 deletions app/src/main/AndroidManifest.xml
Expand Up @@ -18,13 +18,13 @@

<activity
android:name=".SettingsActivity"
android:launchMode="singleTask"
android:label="@string/title_activity_settings">
android:launchMode="singleTop"
android:label="@string/app_name">
</activity>

<activity-alias
android:enabled="true"
android:targetActivity = ".StartActivity"
android:targetActivity = ".SettingsActivity"
android:name="unhide_icon">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand All @@ -34,7 +34,7 @@

<activity-alias
android:enabled="false"
android:targetActivity = ".StartActivity"
android:targetActivity = ".SettingsActivity"
android:name="hide_icon">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand All @@ -49,7 +49,7 @@
android:name=".ReceiveOpenActivity"
android:excludeFromRecents="true">
<intent-filter
android:label="转换为分享文件"
android:label="@string/convert_text"
tools:ignore="AppLinkUrlError">
<action android:name="android.intent.action.VIEW" />

Expand All @@ -58,7 +58,7 @@
<data android:mimeType="*/*" />
</intent-filter>
</activity>
<activity android:name=".StartActivity" />

</application>

</manifest>
4 changes: 2 additions & 2 deletions app/src/main/java/top/linesoft/open2share/GuideActivity.java
Expand Up @@ -13,7 +13,7 @@ protected void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.activity_guide);
WebView webView = findViewById(R.id.webView);
webView.loadUrl("https://doc.linesoft.top/open2share/guide/");
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
this.setTitle("使用说明");
// getSupportActionBar().setDisplayHomeAsUpEnabled(true);
this.setTitle(R.string.guide);
}
}
Expand Up @@ -9,23 +9,12 @@

public class ReceiveOpenActivity extends AppCompatActivity {

protected void RemoveFromRecents(){

}

@Override
protected void onDestroy() {
super.onDestroy();
finishAffinity();
}

/**
* Dispatch incoming result to the correct fragment.
*
* @param requestCode
* @param resultCode
* @param data
*/
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
Expand All @@ -52,7 +41,7 @@ protected void onCreate(Bundle savedInstanceState) {
// Log.d("分享","Type:"+ getIntent().getType());
sendIntent.putExtra(Intent.EXTRA_STREAM, getIntent().getData());
sendIntent.setType(getIntent().getType());
startActivityForResult(Intent.createChooser(sendIntent,"分享文件"),1);
startActivityForResult(Intent.createChooser(sendIntent,getString(R.string.share_title)),1);
//finish();

}
Expand Down
18 changes: 9 additions & 9 deletions app/src/main/java/top/linesoft/open2share/SettingsActivity.java
Expand Up @@ -50,10 +50,10 @@ public boolean onPreferenceClick(Preference preference) {
return true;
}else if(preference == aboutPreference){
new AlertDialog.Builder(requireContext())
.setTitle("关于本软件")
.setMessage("作者:双霖")
.setPositiveButton("确定",null)
.setNeutralButton("网站", (dialog, which) -> {
.setTitle(R.string.about_dialogue_title)
.setMessage(R.string.about_dialogue_msg)
.setPositiveButton(R.string.ok,null)
.setNeutralButton(R.string.website, (dialog, which) -> {
Intent intent = new Intent();
intent.setAction("android.intent.action.VIEW");
Uri content_url = Uri.parse("https://www.linesoft.top");
Expand Down Expand Up @@ -94,7 +94,7 @@ public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
*/
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
Log.d("onPreferenceChange", "onPreferenceChange: 被触发");
// Log.d("onPreferenceChange", "onPreferenceChange: 被触发");
if(preference == hidePreference){
// Toast.makeText(getContext(),"当前值为:"+newValue,Toast.LENGTH_LONG).show();
PackageManager pm = requireContext().getPackageManager();
Expand All @@ -103,13 +103,13 @@ public boolean onPreferenceChange(Preference preference, Object newValue) {
if((Boolean) newValue){

AlertDialog.Builder mDialogBuilder = new AlertDialog.Builder(getContext());
mDialogBuilder.setTitle("警告:")
.setMessage("1.在部分系统下,隐藏桌面图标会导致本页面被关闭,您将很难再次进入到本页面.\n2.部分系统不支持该功能.\n是否继续?")
.setPositiveButton("是", (dialog, which) -> {
mDialogBuilder.setTitle(R.string.warn)
.setMessage(R.string.hide_tips)
.setPositiveButton(R.string.yes, (dialog, which) -> {
pm.setComponentEnabledSetting(hideComponentName,PackageManager.COMPONENT_ENABLED_STATE_ENABLED,PackageManager.DONT_KILL_APP);
pm.setComponentEnabledSetting(unhideComponentName,PackageManager.COMPONENT_ENABLED_STATE_DISABLED,PackageManager.DONT_KILL_APP);
SettingsFragment.this.hidePreference.setChecked(true);
}).setNegativeButton("否",null).create().show();
}).setNegativeButton(R.string.no,null).create().show();
return false;


Expand Down
20 changes: 0 additions & 20 deletions app/src/main/java/top/linesoft/open2share/StartActivity.java

This file was deleted.

21 changes: 21 additions & 0 deletions app/src/main/res/values-en/strings.xml
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">open2share</string>
<string name="convert_text">Convert to share</string>
<string name="guide">Usage</string>
<string name="hide_describe">After hiding, you may have to uninstall and reload to display the icon again.</string>
<string name="hide">hide icon from launcher</string>
<string name="about">about</string>
<string name="about_title">about \"open2share\"</string>
<string name="help">help</string>
<string name="settings">settings</string>
<string name="share_title">share</string>
<string name="warn">WARN</string>
<string name="yes">Yes</string>
<string name="no">No</string>
<string name="hide_tips">1. In some systems, hiding the desktop icon will cause this page to be closed, and it will be difficult for you to enter this page again. \n2. Some systems do not support this function. Do you want to continue?</string>
<string name="about_dialogue_title">about</string>
<string name="about_dialogue_msg">Author: 双霖(LineSoft)</string>
<string name="ok">OK</string>
<string name="website">Website</string>
</resources>
32 changes: 17 additions & 15 deletions app/src/main/res/values/strings.xml
@@ -1,19 +1,21 @@
<resources>
<string name="app_name">open2share</string>
<string name="title_activity_settings">open2share</string>
<string name="convert_text">转换为分享文件</string>
<string name="guide">使用说明</string>
<string name="hide_describe">隐藏后,您可能只能通过卸载重装才能再次显示图标。</string>
<string name="hide">隐藏桌面图标</string>
<string name="about">关于</string>
<string name="about_title">关于“open2share”</string>
<string name="help">帮助</string>
<string name="settings">设置</string>
<string name="share_title">分享文件</string>
<string name="warn">警告:</string>
<string name="yes">是</string>
<string name="no">否</string>
<string name="hide_tips">1.在部分系统下,隐藏桌面图标会导致本页面被关闭,您将很难再次进入到本页面.\n2.部分系统不支持该功能. 是否继续?</string>
<string name="about_dialogue_title">关于本软件</string>
<string name="about_dialogue_msg">作者:双霖(LineSoft)</string>
<string name="ok">确定</string>
<string name="website">网站</string>

<!-- Preference Titles -->
<string name="messages_header">Messages</string>
<string name="sync_header">Sync</string>

<!-- Messages Preferences -->
<string name="signature_title">Your signature</string>
<string name="reply_title">Default reply action</string>

<!-- Sync Preferences -->
<string name="sync_title">Sync email periodically</string>
<string name="attachment_title">Download incoming attachments</string>
<string name="attachment_summary_on">Automatically download attachments for incoming emails
</string>
<string name="attachment_summary_off">Only download attachments when manually requested</string>
</resources>
6 changes: 2 additions & 4 deletions app/src/main/res/values/styles.xml
@@ -1,12 +1,10 @@
<resources>

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<style name="AppTheme" parent="Theme.AppCompat.DayNight.DarkActionBar">

<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:forceDarkAllowed">true</item>
</style>

</resources>
14 changes: 7 additions & 7 deletions app/src/main/res/xml/root_preferences.xml
@@ -1,31 +1,31 @@
<PreferenceScreen xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory android:title="帮助">
<PreferenceCategory android:title="@string/help">

<Preference
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:icon="@drawable/ic_baseline_help_24"
android:key="guide"
android:title="使用说明" />
android:title="@string/guide" />
<!-- android:summary="本软件的使用说明"-->

</PreferenceCategory>
<PreferenceCategory android:title="设置">
<PreferenceCategory android:title="@string/settings">

</PreferenceCategory>
<SwitchPreference
android:defaultValue="false"
android:icon="@drawable/ic_baseline_restore_from_trash_24"
android:key="hide_icon"
android:summary="隐藏后,您可能只能通过卸载重装才能再次显示图标。"
android:title="隐藏桌面图标" />
<PreferenceCategory android:title="关于">
android:summary="@string/hide_describe"
android:title="@string/hide" />
<PreferenceCategory android:title="@string/about">
<Preference
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:key="about"
android:title="关于“open2share”"
android:title="@string/about_title"
app:icon="@drawable/ic_baseline_mobile_screen_share_24" />
</PreferenceCategory>
</PreferenceScreen>
2 changes: 1 addition & 1 deletion build.gradle
Expand Up @@ -7,7 +7,7 @@ buildscript {

}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.0'
classpath 'com.android.tools.build:gradle:4.0.1'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
#Sat Jul 11 21:53:12 CST 2020
#Tue Sep 29 16:39:55 CST 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.6.1-all.zip

0 comments on commit d9fd19d

Please sign in to comment.