├── .gitignore ├── LICENSE ├── Preview ├── about.png ├── main.png └── startup.png ├── README.md ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── djzhao │ │ └── smarttool │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── assets │ │ └── litepal.xml │ ├── java │ │ └── com │ │ │ └── djzhao │ │ │ └── smarttool │ │ │ ├── activity │ │ │ ├── AboutActivity.java │ │ │ ├── MainActivity.java │ │ │ ├── SplashActivity.java │ │ │ ├── base │ │ │ │ └── BaseActivity.java │ │ │ ├── chooseproblem │ │ │ │ ├── ChooseProblemDetailListActivity.java │ │ │ │ ├── ChooseProblemListActivity.java │ │ │ │ └── ChooseProblemMainActivity.java │ │ │ ├── github │ │ │ │ └── GithubAddressMainActivity.java │ │ │ ├── htmlget │ │ │ │ ├── HtmlCodeActivity.java │ │ │ │ └── HtmlGetMainActivity.java │ │ │ ├── morsecode │ │ │ │ └── MorseCodeActivity.java │ │ │ ├── qrcodevisitacard │ │ │ │ └── QRCodeVisitingCardMainActivity.java │ │ │ ├── radix │ │ │ │ └── RadixMainActivity.java │ │ │ ├── randomnumber │ │ │ │ └── RandomNumberMainActivity.java │ │ │ ├── ruler │ │ │ │ └── RulerMainActivity.java │ │ │ ├── shortlink │ │ │ │ └── ShortLinkMainActivity.java │ │ │ ├── torch │ │ │ │ └── MainActivity.java │ │ │ ├── transcoding │ │ │ │ └── TranscodingActivity.java │ │ │ └── weather │ │ │ │ ├── MainActivity.java │ │ │ │ └── WeatherActivity.java │ │ │ ├── adapter │ │ │ ├── chooseproblem │ │ │ │ └── ItemListAdapter.java │ │ │ ├── qrcode │ │ │ │ └── ViewPagerAdapter.java │ │ │ └── transcoding │ │ │ │ └── FragmentAdapter.java │ │ │ ├── broadcast │ │ │ └── torch │ │ │ │ └── TorchWidgetProvider.java │ │ │ ├── db │ │ │ ├── chooseproblem │ │ │ │ └── ChooseProblemItem.java │ │ │ └── weather │ │ │ │ ├── City.java │ │ │ │ ├── County.java │ │ │ │ └── Province.java │ │ │ ├── dialog │ │ │ ├── chooseproblem │ │ │ │ └── AddItemDialog.java │ │ │ └── torch │ │ │ │ └── FlashlightDialog.java │ │ │ ├── fragment │ │ │ ├── base │ │ │ │ └── BaseFragment.java │ │ │ ├── qrcodecard │ │ │ │ ├── DIYCodeFragment.java │ │ │ │ └── VisitingCardFragment.java │ │ │ ├── tanscoding │ │ │ │ ├── BASE64Fragment.java │ │ │ │ ├── MD5Fragment.java │ │ │ │ └── SHA1Fragment.java │ │ │ └── weather │ │ │ │ └── ChooseFragment.java │ │ │ ├── gson │ │ │ └── weather │ │ │ │ ├── AQI.java │ │ │ │ ├── Basic.java │ │ │ │ ├── Forecast.java │ │ │ │ ├── Now.java │ │ │ │ ├── Suggestion.java │ │ │ │ └── Weather.java │ │ │ ├── service │ │ │ └── weather │ │ │ │ └── AutoUpdateService.java │ │ │ ├── util │ │ │ ├── AppManager.java │ │ │ ├── ClipboardUtil.java │ │ │ ├── Constants.java │ │ │ ├── HttpUtil.java │ │ │ ├── morsecode │ │ │ │ └── ContrastList.java │ │ │ ├── torch │ │ │ │ └── TorchUtils.java │ │ │ └── weather │ │ │ │ └── Utility.java │ │ │ └── view │ │ │ └── ruler │ │ │ └── RulerView.java │ └── res │ │ ├── anim │ │ └── anim_down_up_show.xml │ │ ├── drawable-v24 │ │ └── ic_launcher_foreground.xml │ │ ├── drawable-xhdpi │ │ ├── button_off.png │ │ ├── button_on.png │ │ ├── checkbox_style.xml │ │ ├── checked.png │ │ ├── dashboard_bg.jpg │ │ ├── dashboard_binary.png │ │ ├── dashboard_choose.png │ │ ├── dashboard_github.png │ │ ├── dashboard_html.png │ │ ├── dashboard_hyperlink.png │ │ ├── dashboard_mecard_qrcode.png │ │ ├── dashboard_morse_code.png │ │ ├── dashboard_nav_about.png │ │ ├── dashboard_nav_exit.png │ │ ├── dashboard_qrcode.png │ │ ├── dashboard_random.png │ │ ├── dashboard_ruler.png │ │ ├── dashboard_tanscoding.png │ │ ├── dashboard_torch.png │ │ ├── dashboard_visit_card.png │ │ ├── dashboard_weather.png │ │ ├── djzhao_header.jpg │ │ ├── flashlight_dialog_bg.xml │ │ ├── ic_back.png │ │ ├── ic_clear.png │ │ ├── ic_copy.png │ │ ├── ic_diy_textarea.png │ │ ├── ic_done.png │ │ ├── ic_home.png │ │ ├── ic_mail.png │ │ ├── ic_message.png │ │ ├── ic_random.png │ │ ├── ic_visiting_card.png │ │ ├── ic_web.png │ │ ├── logo.png │ │ ├── torch_widget.png │ │ └── unchecked.png │ │ ├── drawable │ │ ├── ic_launcher_background.xml │ │ └── unread.png │ │ ├── layout │ │ ├── activity_about.xml │ │ ├── activity_dashboard.xml │ │ ├── activity_splash.xml │ │ ├── choose_problem_activity_main.xml │ │ ├── choose_problem_add_item_dialog_layout.xml │ │ ├── choose_problem_list_activity.xml │ │ ├── choose_problem_list_item.xml │ │ ├── choose_problem_list_item_footer.xml │ │ ├── dashboard_grid_view_item.xml │ │ ├── dashboard_nav_header.xml │ │ ├── dialog_bottom_sheet.xml │ │ ├── github_address_activity_main.xml │ │ ├── html_get_code_activity.xml │ │ ├── html_get_main_activity.xml │ │ ├── morse_code_main_activity.xml │ │ ├── qrcode_diy_code_fragment.xml │ │ ├── qrcode_visiting_card_fragment.xml │ │ ├── qrcode_visiting_card_main_activity.xml │ │ ├── radix_activity_main.xml │ │ ├── random_number_main_activity.xml │ │ ├── ruler_main_activity.xml │ │ ├── short_link_main_activity.xml │ │ ├── splash_layout.xml │ │ ├── title_with_back_layout.xml │ │ ├── torch_flashlight_dialog_layout.xml │ │ ├── torch_main.xml │ │ ├── torch_widget_layout.xml │ │ ├── transcoding_activity_main.xml │ │ ├── transcoding_fragment_base64.xml │ │ ├── transcoding_fragment_md5.xml │ │ ├── weather_activity_main.xml │ │ ├── weather_activity_weather.xml │ │ ├── weather_aqi.xml │ │ ├── weather_choose_area.xml │ │ ├── weather_forecast.xml │ │ ├── weather_forecast_item.xml │ │ ├── weather_main_title.xml │ │ ├── weather_now.xml │ │ └── weather_suggestion.xml │ │ ├── menu │ │ ├── dashboard_nav_menu.xml │ │ └── qrcode_visiting_card_main_bottom_nav.xml │ │ ├── mipmap-anydpi-v26 │ │ ├── ic_launcher.xml │ │ └── ic_launcher_round.xml │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-mdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── values │ │ ├── arrays.xml │ │ ├── colors.xml │ │ ├── strings.xml │ │ └── styles.xml │ │ └── xml │ │ ├── filepaths.xml │ │ └── torch_app_widget_provider_info.xml │ └── test │ └── java │ └── com │ └── djzhao │ └── smarttool │ └── ExampleUnitTest.java ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | /app/build 3 | /app/release 4 | /captures 5 | /.gradle 6 | /.idea 7 | /local.properties 8 | *.iml 9 | .DS_Store 10 | .externalNativeBuild 11 | -------------------------------------------------------------------------------- /Preview/about.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djzhao627/SmartTool/11c3c44661edf56c7145e730929fb35f74767cd8/Preview/about.png -------------------------------------------------------------------------------- /Preview/main.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djzhao627/SmartTool/11c3c44661edf56c7145e730929fb35f74767cd8/Preview/main.png -------------------------------------------------------------------------------- /Preview/startup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djzhao627/SmartTool/11c3c44661edf56c7145e730929fb35f74767cd8/Preview/startup.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SmartTool 2 | 一个Android工具箱APP 3 | 4 | ## 重要提示 5 | 需要使用天气的功能,需要在 6 | > `com.djzhao.smarttool.util.Constants` 7 | 8 | 中的`TODO`处填入您自己申请“和风天气”的`key` 9 | 10 | ## 功能一览 11 | 12 | 这是一个Android工具箱APP,主要功能列表: 13 | 14 | - 天气查询 15 | - 手电筒 16 | - 编码/解码(BASE64、MD5、SHA1) 17 | - 摩斯码 18 | - 屏幕直尺 19 | - 短网址生成 20 | - 网页源码获取 21 | - 随机数生成 22 | - 进制转换(2/8/10/16) 23 | - 名片二维码生成器 24 | - GitHub下载地址解析 25 | - 随机选择器(选择困难症专用) 26 | - [一个]每日一句和每日一图展示 27 | 28 | 29 | |key |value | 30 | |--|:--| 31 | | 开发工具 | Android Studio 3.1.2 | 32 | | 安卓最低版本 | 16(Jelly Bean 糖豆)Android 4.1| 33 | | 安卓目标版本 | 27(Oreo MR1 奥利奥)Android 8.1| 34 | | 安卓编译版本 | 27(Oreo MR1 奥利奥)Android 8.1| 35 | | 项目构建工具 | Gradle 3.1.2| 36 | | 安卓调试工具 | ADB 1.0.39(Android Debug Bridge)| 37 | | 数据传输格式 | JSON| 38 | | 网络通讯协议 | HTTP 1.1| 39 | | JAVA 运行环境 | JDK 1.8| 40 | | 使用的开源项目| LitePal: [https://github.com/LitePalFramework/LitePal](https://github.com/LitePalFramework/LitePal)
OkHttp: [https://github.com/square/okhttp](https://github.com/square/okhttp)
CircleImageView: [https://github.com/hdodenhof/CircleImageView](https://github.com/hdodenhof/CircleImageView)
Glide: [https://github.com/bumptech/glide](https://github.com/bumptech/glide)
Gson: [https://github.com/google/gson](https://github.com/google/gson)
Zxing: [https://github.com/zxing/zxing](https://github.com/zxing/zxing)| 41 | 42 | 43 | 44 | ## 预览 45 | 46 | **启动界面** 47 | 48 | ![启动图](https://github.com/djzhao627/SmartTool/blob/master/Preview/startup.png) 49 | 50 | **首页** 51 | 52 | ![首页](https://github.com/djzhao627/SmartTool/blob/master/Preview/main.png) 53 | 54 | **关于页** 55 | 56 | ![关于页](https://github.com/djzhao627/SmartTool/blob/master/Preview/about.png) 57 | 58 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 27 5 | defaultConfig { 6 | applicationId "com.djzhao.smarttool" 7 | minSdkVersion 16 8 | targetSdkVersion 27 9 | versionCode 1 10 | versionName "1.0" 11 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 12 | } 13 | buildTypes { 14 | release { 15 | minifyEnabled false 16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 17 | } 18 | } 19 | } 20 | 21 | dependencies { 22 | implementation fileTree(include: ['*.jar'], dir: 'libs') 23 | implementation 'com.android.support:appcompat-v7:27.1.1' 24 | implementation 'com.android.support.constraint:constraint-layout:1.0.2' 25 | implementation 'com.android.support:support-v4:27.1.1' 26 | testImplementation 'junit:junit:4.12' 27 | androidTestImplementation 'com.android.support.test:runner:1.0.1' 28 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' 29 | implementation 'org.litepal.android:core:1.6.1' 30 | implementation 'com.squareup.okhttp3:okhttp:3.10.0' 31 | implementation 'com.google.code.gson:gson:2.8.2' 32 | implementation 'com.github.bumptech.glide:glide:4.7.1' 33 | implementation 'com.android.support:design:27.1.1' 34 | implementation 'de.hdodenhof:circleimageview:2.1.0' 35 | implementation 'com.android.support:recyclerview-v7:27.1.1' 36 | implementation 'com.android.support:cardview-v7:27.1.1' 37 | // implementation 'com.google.zxing:core:3.3.2' 38 | // implementation 'pub.devrel:easypermissions:1.2.0' 39 | implementation 'cn.yipianfengye.android:zxing-library:2.2' 40 | } 41 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/djzhao/smarttool/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.djzhao.smarttool; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | import android.util.Log; 7 | 8 | import com.djzhao.smarttool.util.HttpUtil; 9 | 10 | import org.junit.Test; 11 | import org.junit.runner.RunWith; 12 | 13 | import java.io.IOException; 14 | 15 | import okhttp3.Call; 16 | import okhttp3.Callback; 17 | import okhttp3.Response; 18 | 19 | import static org.junit.Assert.*; 20 | 21 | /** 22 | * Instrumented test, which will execute on an Android device. 23 | * 24 | * @see Testing documentation 25 | */ 26 | @RunWith(AndroidJUnit4.class) 27 | public class ExampleInstrumentedTest { 28 | @Test 29 | public void useAppContext() { 30 | // Context of the app under test. 31 | Context appContext = InstrumentationRegistry.getTargetContext(); 32 | 33 | assertEquals("com.djzhao.smarttool", appContext.getPackageName()); 34 | } 35 | 36 | @Test 37 | public void testResult() { 38 | HttpUtil.sendOkHttpRequest("http://www.baidu.com", new Callback() { 39 | @Override 40 | public void onFailure(Call call, IOException e) { 41 | 42 | } 43 | 44 | @Override 45 | public void onResponse(Call call, Response response) throws IOException { 46 | Log.w("test", response.body().toString()); 47 | System.out.println(response.body().toString()); 48 | } 49 | }); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 40 | 41 | 42 | 45 | 46 | 47 | 50 | 51 | 52 | 55 | 56 | 57 | 60 | 61 | 62 | 66 | 67 | 70 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 92 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | -------------------------------------------------------------------------------- /app/src/main/assets/litepal.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/java/com/djzhao/smarttool/activity/AboutActivity.java: -------------------------------------------------------------------------------- 1 | package com.djzhao.smarttool.activity; 2 | 3 | import android.content.Intent; 4 | import android.net.Uri; 5 | import android.support.design.widget.Snackbar; 6 | import android.os.Bundle; 7 | import android.support.v7.widget.CardView; 8 | import android.view.View; 9 | import android.view.animation.Animation; 10 | import android.view.animation.AnimationUtils; 11 | import android.widget.Button; 12 | import android.widget.LinearLayout; 13 | 14 | import com.djzhao.smarttool.R; 15 | import com.djzhao.smarttool.util.Constants; 16 | import com.djzhao.smarttool.activity.base.BaseActivity; 17 | 18 | public class AboutActivity extends BaseActivity implements View.OnClickListener { 19 | 20 | private Button backBtn; 21 | private LinearLayout myWeb; 22 | private LinearLayout contactMe; 23 | private LinearLayout mailMe; 24 | 25 | private CardView introAppLayout; 26 | private CardView devAndSupportLayout; 27 | private CardView feedbackAndContactLayout; 28 | private CardView openLicensesLayout; 29 | 30 | @Override 31 | protected void findViewById() { 32 | backBtn = $(R.id.about_back_button); 33 | myWeb = $(R.id.about_my_web); 34 | contactMe = $(R.id.about_contact_me); 35 | mailMe = $(R.id.about_mail_me); 36 | 37 | introAppLayout = $(R.id.about_card_introduce_app); 38 | devAndSupportLayout = $(R.id.about_card_dev_and_support); 39 | feedbackAndContactLayout = $(R.id.about_card_feedback_and_contact); 40 | openLicensesLayout = $(R.id.about_card_open_licenses); 41 | } 42 | 43 | @Override 44 | protected void initView() { 45 | backBtn.setOnClickListener(this); 46 | myWeb.setOnClickListener(this); 47 | contactMe.setOnClickListener(this); 48 | mailMe.setOnClickListener(this); 49 | 50 | Animation animation = AnimationUtils.loadAnimation(mContext, R.anim.anim_down_up_show); 51 | introAppLayout.setAnimation(animation); 52 | devAndSupportLayout.setAnimation(animation); 53 | feedbackAndContactLayout.setAnimation(animation); 54 | openLicensesLayout.setAnimation(animation); 55 | } 56 | 57 | @Override 58 | protected void onCreate(Bundle savedInstanceState) { 59 | super.onCreate(savedInstanceState); 60 | setContentView(R.layout.activity_about); 61 | 62 | findViewById(); 63 | initView(); 64 | } 65 | 66 | @Override 67 | public void onClick(View v) { 68 | Intent intent = new Intent(); 69 | switch (v.getId()) { 70 | case R.id.about_back_button: 71 | finish(); 72 | break; 73 | case R.id.about_my_web: 74 | intent.setData(Uri.parse(Constants.MY_HOMEPAGE_ADDRESS)); 75 | intent.setAction(Intent.ACTION_VIEW); 76 | startActivity(intent); 77 | break; 78 | case R.id.about_contact_me: 79 | intent.setData(Uri.parse(Constants.CONTACT_MY_QQ)); 80 | intent.setAction(Intent.ACTION_VIEW); 81 | startActivity(intent); 82 | break; 83 | case R.id.about_mail_me: 84 | intent.setAction(Intent.ACTION_SENDTO); 85 | intent.setData(Uri.parse("mailto:" + Constants.EMAIL_ADDRESS)); 86 | intent.putExtra(Intent.EXTRA_SUBJECT, "关于 一个工具箱"); 87 | try { 88 | startActivity(intent); 89 | } catch (Exception e) { 90 | Snackbar.make(mailMe, "没有邮件程序", Snackbar.LENGTH_LONG).show(); 91 | } 92 | break; 93 | } 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /app/src/main/java/com/djzhao/smarttool/activity/SplashActivity.java: -------------------------------------------------------------------------------- 1 | package com.djzhao.smarttool.activity; 2 | 3 | import android.os.Handler; 4 | import android.support.v7.app.AppCompatActivity; 5 | import android.os.Bundle; 6 | import android.view.Window; 7 | import android.view.WindowManager; 8 | 9 | import com.djzhao.smarttool.R; 10 | import com.djzhao.smarttool.activity.base.BaseActivity; 11 | 12 | public class SplashActivity extends BaseActivity { 13 | 14 | @Override 15 | protected void findViewById() { 16 | 17 | } 18 | 19 | @Override 20 | protected void initView() { 21 | 22 | } 23 | 24 | @Override 25 | protected void onCreate(Bundle savedInstanceState) { 26 | super.onCreate(savedInstanceState); 27 | requestWindowFeature(Window.FEATURE_NO_TITLE);// 隐藏标题 28 | getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);// 设置全屏 29 | setContentView(R.layout.activity_splash); 30 | 31 | Handler handler = new Handler(); 32 | handler.postDelayed(new Runnable() { 33 | @Override 34 | public void run() { 35 | openActivity(MainActivity.class); 36 | finish(); 37 | } 38 | }, 2000); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /app/src/main/java/com/djzhao/smarttool/activity/chooseproblem/ChooseProblemMainActivity.java: -------------------------------------------------------------------------------- 1 | package com.djzhao.smarttool.activity.chooseproblem; 2 | 3 | import android.os.Bundle; 4 | import android.os.SystemClock; 5 | import android.support.design.widget.Snackbar; 6 | import android.view.View; 7 | import android.widget.AdapterView; 8 | import android.widget.ArrayAdapter; 9 | import android.widget.Button; 10 | import android.widget.Spinner; 11 | import android.widget.TextView; 12 | 13 | import com.djzhao.smarttool.R; 14 | import com.djzhao.smarttool.activity.base.BaseActivity; 15 | import com.djzhao.smarttool.db.chooseproblem.ChooseProblemItem; 16 | 17 | import org.litepal.crud.DataSupport; 18 | 19 | import java.util.ArrayList; 20 | import java.util.List; 21 | import java.util.Random; 22 | 23 | public class ChooseProblemMainActivity extends BaseActivity implements View.OnClickListener, AdapterView.OnItemSelectedListener { 24 | 25 | private Button backBtn, chooseBtn; 26 | private Spinner spinner; 27 | private TextView title, resultTxt, managerBtn; 28 | 29 | private List menuList; // 一级列表 30 | private List itemList; // 二级列表 31 | private List titles; 32 | private ChooseProblemItem selectedItem; 33 | 34 | @Override 35 | protected void findViewById() { 36 | backBtn = $(R.id.title_layout_back_button); 37 | managerBtn = $(R.id.title_layout_option_button); 38 | chooseBtn = $(R.id.choose_problem_main_choose_btn); 39 | spinner = $(R.id.choose_problem_main_spinner); 40 | title = $(R.id.title_layout_title_text); 41 | resultTxt = $(R.id.choose_problem_main_result); 42 | } 43 | 44 | @Override 45 | protected void initView() { 46 | title.setText("帮我选择"); 47 | managerBtn.setText("管理"); 48 | backBtn.setOnClickListener(this); 49 | managerBtn.setOnClickListener(this); 50 | managerBtn.setVisibility(View.VISIBLE); 51 | chooseBtn.setOnClickListener(this); 52 | spinner.setOnItemSelectedListener(this); 53 | } 54 | 55 | @Override 56 | protected void onResume() { 57 | super.onResume(); 58 | refreshData(); 59 | } 60 | 61 | private void refreshData() { 62 | menuList = DataSupport.where("parentId = 0").find(ChooseProblemItem.class); 63 | if (menuList == null || menuList.size() == 0) { 64 | openActivity(ChooseProblemListActivity.class); 65 | finish(); 66 | } else { 67 | selectedItem = menuList.get(0); 68 | titles = new ArrayList<>(); 69 | for (ChooseProblemItem item : menuList) { 70 | titles.add(item.getTitle()); 71 | } 72 | ArrayAdapter adapter = new ArrayAdapter(this, 73 | android.R.layout.simple_spinner_item, titles); 74 | adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); 75 | spinner.setAdapter(adapter); 76 | } 77 | } 78 | 79 | @Override 80 | protected void onCreate(Bundle savedInstanceState) { 81 | super.onCreate(savedInstanceState); 82 | setContentView(R.layout.choose_problem_activity_main); 83 | 84 | findViewById(); 85 | initView(); 86 | } 87 | 88 | @Override 89 | public void onClick(View v) { 90 | switch (v.getId()) { 91 | case R.id.title_layout_back_button: 92 | finish(); 93 | break; 94 | case R.id.title_layout_option_button: 95 | openActivity(ChooseProblemListActivity.class); 96 | break; 97 | case R.id.choose_problem_main_choose_btn: 98 | choose(); 99 | break; 100 | } 101 | } 102 | 103 | private void choose() { 104 | resultTxt.setText(""); 105 | itemList = DataSupport.where("parentId = ?", selectedItem.getId() + "").find(ChooseProblemItem.class); 106 | if (itemList.size() == 0) { 107 | Snackbar.make(chooseBtn, "该类别下面没有内容,请添加内容", Snackbar.LENGTH_LONG).show(); 108 | } else { 109 | Random random = new Random(); 110 | int index = random.nextInt(itemList.size()); 111 | resultTxt.setText(itemList.get(index).getTitle()); 112 | } 113 | return; 114 | } 115 | 116 | @Override 117 | public void onItemSelected(AdapterView parent, View view, int position, long id) { 118 | selectedItem = menuList.get(position); 119 | } 120 | 121 | @Override 122 | public void onNothingSelected(AdapterView parent) { 123 | 124 | } 125 | } 126 | -------------------------------------------------------------------------------- /app/src/main/java/com/djzhao/smarttool/activity/github/GithubAddressMainActivity.java: -------------------------------------------------------------------------------- 1 | package com.djzhao.smarttool.activity.github; 2 | 3 | import android.support.design.widget.FloatingActionButton; 4 | import android.support.design.widget.Snackbar; 5 | import android.support.v7.app.AppCompatActivity; 6 | import android.os.Bundle; 7 | import android.text.TextUtils; 8 | import android.view.View; 9 | import android.widget.Button; 10 | import android.widget.EditText; 11 | import android.widget.TextView; 12 | 13 | import com.djzhao.smarttool.R; 14 | import com.djzhao.smarttool.activity.base.BaseActivity; 15 | import com.djzhao.smarttool.util.ClipboardUtil; 16 | 17 | public class GithubAddressMainActivity extends BaseActivity implements View.OnClickListener { 18 | 19 | private Button backBtn, parseBtn, clearInput; 20 | private TextView title, result; 21 | private FloatingActionButton copyResultBtn; 22 | private EditText inputTxt; 23 | 24 | @Override 25 | protected void findViewById() { 26 | backBtn = $(R.id.title_layout_back_button); 27 | clearInput = $(R.id.github_address_clear_input_btn); 28 | parseBtn = $(R.id.github_address_parse_btn); 29 | title = $(R.id.title_layout_title_text); 30 | result = $(R.id.github_address_result_txt); 31 | copyResultBtn = $(R.id.github_address_copy_result_btn); 32 | inputTxt = $(R.id.github_address_input_txt); 33 | } 34 | 35 | @Override 36 | protected void initView() { 37 | title.setText("Github文件地址解析"); 38 | backBtn.setOnClickListener(this); 39 | parseBtn.setOnClickListener(this); 40 | copyResultBtn.setOnClickListener(this); 41 | clearInput.setOnClickListener(this); 42 | } 43 | 44 | @Override 45 | protected void onCreate(Bundle savedInstanceState) { 46 | super.onCreate(savedInstanceState); 47 | setContentView(R.layout.github_address_activity_main); 48 | findViewById(); 49 | initView(); 50 | } 51 | 52 | @Override 53 | public void onClick(View v) { 54 | switch (v.getId()) { 55 | case R.id.github_address_parse_btn: 56 | parseUrl(); 57 | break; 58 | case R.id.github_address_copy_result_btn: 59 | copyResult(); 60 | break; 61 | case R.id.title_layout_back_button: 62 | finish(); 63 | break; 64 | case R.id.github_address_clear_input_btn: 65 | inputTxt.setText(""); 66 | break; 67 | } 68 | } 69 | 70 | private void copyResult() { 71 | String result = this.result.getText().toString().trim(); 72 | if (!TextUtils.isEmpty(result)) { 73 | ClipboardUtil.copyToClipboard(result); 74 | Snackbar.make(inputTxt, "结果已经复制到剪贴板", Snackbar.LENGTH_LONG).show(); 75 | } 76 | } 77 | 78 | private void parseUrl() { 79 | // https://github.com/ djzhao627/fitness_Android/blob/master/APP/Fitness/build.gradle 80 | // https://raw.githubusercontent.com/ djzhao627/fitness_Android/master/APP/Fitness/app/build.gradle 81 | String url = inputTxt.getText().toString().trim(); 82 | if (TextUtils.isEmpty(url)) { 83 | Snackbar.make(inputTxt, "请先输入文件地址", Snackbar.LENGTH_LONG).show(); 84 | return; 85 | } 86 | 87 | if (!url.startsWith("https://github.com") && !url.startsWith("http://github.com")) { 88 | Snackbar.make(inputTxt, "文件地址不正确", Snackbar.LENGTH_LONG).show(); 89 | return; 90 | } 91 | url = url.replace("github.com", "raw.githubusercontent.com"); 92 | url = url.replace("blob/", ""); 93 | result.setText(url); 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /app/src/main/java/com/djzhao/smarttool/activity/htmlget/HtmlCodeActivity.java: -------------------------------------------------------------------------------- 1 | package com.djzhao.smarttool.activity.htmlget; 2 | 3 | import android.support.design.widget.FloatingActionButton; 4 | import android.os.Bundle; 5 | import android.support.design.widget.Snackbar; 6 | import android.view.View; 7 | import android.widget.TextView; 8 | 9 | import com.djzhao.smarttool.R; 10 | import com.djzhao.smarttool.activity.base.BaseActivity; 11 | import com.djzhao.smarttool.util.ClipboardUtil; 12 | 13 | public class HtmlCodeActivity extends BaseActivity implements View.OnClickListener { 14 | 15 | private TextView resultTxt; 16 | private FloatingActionButton copyBtn; 17 | private String result; 18 | 19 | @Override 20 | protected void findViewById() { 21 | resultTxt = $(R.id.html_get_code_result); 22 | copyBtn = $(R.id.html_get_code_copy_fab); 23 | } 24 | 25 | @Override 26 | protected void initView() { 27 | result = getIntent().getStringExtra("code"); 28 | resultTxt.setText(result); 29 | copyBtn.setOnClickListener(this); 30 | } 31 | 32 | @Override 33 | protected void onCreate(Bundle savedInstanceState) { 34 | super.onCreate(savedInstanceState); 35 | setContentView(R.layout.html_get_code_activity); 36 | 37 | findViewById(); 38 | initView(); 39 | } 40 | 41 | @Override 42 | public void onClick(View v) { 43 | switch (v.getId()) { 44 | case R.id.html_get_code_copy_fab: 45 | ClipboardUtil.copyToClipboard(result); 46 | Snackbar.make(resultTxt, "源码已经复制到剪贴板", Snackbar.LENGTH_LONG).show(); 47 | break; 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /app/src/main/java/com/djzhao/smarttool/activity/htmlget/HtmlGetMainActivity.java: -------------------------------------------------------------------------------- 1 | package com.djzhao.smarttool.activity.htmlget; 2 | 3 | import android.content.Intent; 4 | import android.support.design.widget.Snackbar; 5 | import android.support.v7.app.AppCompatActivity; 6 | import android.os.Bundle; 7 | import android.text.TextUtils; 8 | import android.view.View; 9 | import android.widget.Button; 10 | import android.widget.EditText; 11 | import android.widget.TextView; 12 | 13 | import com.djzhao.smarttool.R; 14 | import com.djzhao.smarttool.activity.base.BaseActivity; 15 | import com.djzhao.smarttool.util.HttpUtil; 16 | 17 | import java.io.IOException; 18 | 19 | import okhttp3.Call; 20 | import okhttp3.Callback; 21 | import okhttp3.Response; 22 | 23 | public class HtmlGetMainActivity extends BaseActivity implements View.OnClickListener { 24 | 25 | private Button backBtn, getHtmlBtn, clearInputBtn; 26 | private EditText inputTxt; 27 | private TextView title; 28 | 29 | @Override 30 | protected void findViewById() { 31 | title = $(R.id.title_layout_title_text); 32 | backBtn = $(R.id.title_layout_back_button); 33 | inputTxt = $(R.id.html_get_input); 34 | getHtmlBtn = $(R.id.html_get_generate_btn); 35 | clearInputBtn = $(R.id.html_get_clear_input); 36 | } 37 | 38 | @Override 39 | protected void initView() { 40 | title.setText("网页源码获取"); 41 | backBtn.setOnClickListener(this); 42 | getHtmlBtn.setOnClickListener(this); 43 | clearInputBtn.setOnClickListener(this); 44 | } 45 | 46 | @Override 47 | protected void onCreate(Bundle savedInstanceState) { 48 | super.onCreate(savedInstanceState); 49 | setContentView(R.layout.html_get_main_activity); 50 | 51 | findViewById(); 52 | initView(); 53 | } 54 | 55 | @Override 56 | public void onClick(View v) { 57 | switch (v.getId()) { 58 | case R.id.title_layout_back_button: 59 | finish(); 60 | break; 61 | case R.id.html_get_generate_btn: 62 | hideOrShowSoftInput(false, inputTxt); 63 | getHtml(); 64 | break; 65 | case R.id.html_get_clear_input: 66 | inputTxt.setText("http://"); 67 | break; 68 | } 69 | } 70 | 71 | public void getHtml() { 72 | final String input = inputTxt.getText().toString().trim(); 73 | if (TextUtils.isEmpty(input)) { 74 | Snackbar.make(inputTxt, "请先输入网址", Snackbar.LENGTH_LONG).show(); 75 | return; 76 | } 77 | if (input.length() < 8) { 78 | Snackbar.make(inputTxt, "需要输入协议+网址", Snackbar.LENGTH_LONG).show(); 79 | return; 80 | } 81 | showProgressDialog("获取源码中,请等待..."); 82 | HttpUtil.sendOkHttpRequest(input, new Callback() { 83 | @Override 84 | public void onResponse(Call call, Response response) throws IOException { 85 | final String result = response.body().string(); 86 | runOnUiThread(new Runnable() { 87 | @Override 88 | public void run() { 89 | closeProgressDialog(); 90 | Intent intent = new Intent(HtmlGetMainActivity.this, HtmlCodeActivity.class); 91 | intent.putExtra("code", result); 92 | startActivity(intent); 93 | } 94 | }); 95 | } 96 | 97 | @Override 98 | public void onFailure(Call call, IOException e) { 99 | runOnUiThread(new Runnable() { 100 | @Override 101 | public void run() { 102 | closeProgressDialog(); 103 | Snackbar.make(inputTxt, "出了点问题,无法获取源码", Snackbar.LENGTH_LONG).show(); 104 | } 105 | }); 106 | } 107 | }); 108 | } 109 | } 110 | -------------------------------------------------------------------------------- /app/src/main/java/com/djzhao/smarttool/activity/qrcodevisitacard/QRCodeVisitingCardMainActivity.java: -------------------------------------------------------------------------------- 1 | package com.djzhao.smarttool.activity.qrcodevisitacard; 2 | 3 | import android.Manifest; 4 | import android.content.pm.PackageManager; 5 | import android.os.Bundle; 6 | import android.support.annotation.NonNull; 7 | import android.support.design.widget.BottomNavigationView; 8 | import android.support.v4.app.ActivityCompat; 9 | import android.support.v4.content.ContextCompat; 10 | import android.support.v4.view.ViewPager; 11 | import android.view.MenuItem; 12 | import android.view.View; 13 | import android.widget.Button; 14 | import android.widget.TextView; 15 | 16 | import com.djzhao.smarttool.R; 17 | import com.djzhao.smarttool.activity.base.BaseActivity; 18 | import com.djzhao.smarttool.adapter.qrcode.ViewPagerAdapter; 19 | 20 | public class QRCodeVisitingCardMainActivity extends BaseActivity implements View.OnClickListener, BottomNavigationView.OnNavigationItemSelectedListener, ViewPager.OnPageChangeListener { 21 | 22 | private ViewPager viewPager; 23 | private BottomNavigationView navigationView; 24 | private TextView title; 25 | private Button backBtn; 26 | 27 | @Override 28 | protected void findViewById() { 29 | viewPager = $(R.id.qrcode_visiting_card_view_pager); 30 | navigationView = $(R.id.qrcode_visiting_card_bottom_nav); 31 | title = $(R.id.title_layout_title_text); 32 | backBtn = $(R.id.title_layout_back_button); 33 | } 34 | 35 | @Override 36 | protected void initView() { 37 | title.setText("名片/二维码"); 38 | backBtn.setOnClickListener(this); 39 | initPageViewer(); 40 | } 41 | 42 | private void initPageViewer() { 43 | navigationView.setOnNavigationItemSelectedListener(this); 44 | navigationView.setSelectedItemId(R.id.qrcode_visiting_card_bottom_nav_card); 45 | viewPager.setAdapter(new ViewPagerAdapter(getSupportFragmentManager())); 46 | viewPager.addOnPageChangeListener(this); 47 | } 48 | 49 | @Override 50 | protected void onCreate(Bundle savedInstanceState) { 51 | super.onCreate(savedInstanceState); 52 | setContentView(R.layout.qrcode_visiting_card_main_activity); 53 | 54 | findViewById(); 55 | initView(); 56 | checkPermissions(); 57 | } 58 | 59 | private void checkPermissions() { 60 | if (ContextCompat.checkSelfPermission(mContext, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) { 61 | ActivityCompat.requestPermissions(QRCodeVisitingCardMainActivity.this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, 1); 62 | } 63 | } 64 | 65 | @Override 66 | public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { 67 | switch (requestCode) { 68 | case 1: 69 | if (grantResults.length > 0 && grantResults[0] != PackageManager.PERMISSION_GRANTED) { 70 | DisplayToast("没有授权您无法使用该项功能"); 71 | finish(); 72 | } 73 | } 74 | } 75 | 76 | @Override 77 | public void onClick(View v) { 78 | switch (v.getId()) { 79 | case R.id.title_layout_back_button: 80 | finish(); 81 | break; 82 | } 83 | } 84 | 85 | @Override 86 | public boolean onNavigationItemSelected(@NonNull MenuItem item) { 87 | switch (item.getItemId()) { 88 | case R.id.qrcode_visiting_card_bottom_nav_card: 89 | clickCard(); 90 | return true; 91 | case R.id.qrcode_visiting_card_bottom_nav_diy: 92 | clickDiy(); 93 | return true; 94 | } 95 | return false; 96 | } 97 | 98 | private void clickDiy() { 99 | viewPager.setCurrentItem(1); 100 | } 101 | 102 | private void clickCard() { 103 | viewPager.setCurrentItem(0); 104 | } 105 | 106 | @Override 107 | public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { 108 | 109 | } 110 | 111 | @Override 112 | public void onPageSelected(int position) { 113 | navigationView.getMenu().getItem(position).setChecked(true); 114 | } 115 | 116 | @Override 117 | public void onPageScrollStateChanged(int state) { 118 | 119 | } 120 | } 121 | -------------------------------------------------------------------------------- /app/src/main/java/com/djzhao/smarttool/activity/randomnumber/RandomNumberMainActivity.java: -------------------------------------------------------------------------------- 1 | package com.djzhao.smarttool.activity.randomnumber; 2 | 3 | import android.os.Bundle; 4 | import android.support.design.widget.FloatingActionButton; 5 | import android.support.design.widget.Snackbar; 6 | import android.view.View; 7 | import android.widget.Button; 8 | import android.widget.EditText; 9 | import android.widget.TextView; 10 | 11 | import com.djzhao.smarttool.R; 12 | import com.djzhao.smarttool.activity.base.BaseActivity; 13 | 14 | import java.util.Random; 15 | 16 | public class RandomNumberMainActivity extends BaseActivity implements View.OnClickListener { 17 | 18 | private Button backBtn; 19 | private TextView resultTxt, title; 20 | private EditText maxInput, minInput; 21 | private FloatingActionButton createRandomNumBtn; 22 | 23 | @Override 24 | protected void findViewById() { 25 | backBtn = $(R.id.title_layout_back_button); 26 | resultTxt = $(R.id.random_number_result); 27 | title = $(R.id.title_layout_title_text); 28 | maxInput = $(R.id.random_number_max_input); 29 | minInput = $(R.id.random_number_min_input); 30 | createRandomNumBtn = $(R.id.random_number_generate_btn); 31 | } 32 | 33 | @Override 34 | protected void initView() { 35 | title.setText("随机数"); 36 | backBtn.setOnClickListener(this); 37 | createRandomNumBtn.setOnClickListener(this); 38 | } 39 | 40 | @Override 41 | protected void onCreate(Bundle savedInstanceState) { 42 | super.onCreate(savedInstanceState); 43 | setContentView(R.layout.random_number_main_activity); 44 | 45 | findViewById(); 46 | initView(); 47 | } 48 | 49 | @Override 50 | public void onClick(View v) { 51 | switch (v.getId()) { 52 | case R.id.title_layout_back_button: 53 | finish(); 54 | break; 55 | case R.id.random_number_generate_btn: 56 | hideOrShowSoftInput(false, maxInput); 57 | try { 58 | createRandomNumber(); 59 | } catch (Exception e) { 60 | e.printStackTrace(); 61 | Snackbar.make(maxInput, e.getMessage(), Snackbar.LENGTH_LONG).show(); 62 | } 63 | } 64 | } 65 | 66 | private void createRandomNumber() { 67 | int min = Integer.parseInt(minInput.getText().toString().trim()); 68 | int max = Integer.parseInt(maxInput.getText().toString().trim()); 69 | if (min > max) { 70 | Snackbar.make(maxInput, "最小值似乎比最大值还要大", Snackbar.LENGTH_LONG).show(); 71 | return; 72 | } 73 | if (min == max) { 74 | resultTxt.setText(min + ""); 75 | return; 76 | } 77 | Random random = new Random(); 78 | if (max - min == 1) { 79 | if (random.nextBoolean()) { 80 | resultTxt.setText(max + ""); 81 | } else { 82 | resultTxt.setText(min + ""); 83 | } 84 | return; 85 | } 86 | int result = 0; 87 | if (max <= 0) { 88 | result = -random.nextInt(max - min + 1) + max; 89 | } else if (min < 0) { 90 | if (random.nextBoolean()) { 91 | result = -random.nextInt(-min + 1); 92 | } else { 93 | result = random.nextInt(max + 1); 94 | } 95 | } else { 96 | result = random.nextInt(max - min + 1) + min; 97 | } 98 | resultTxt.setText(result + ""); 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /app/src/main/java/com/djzhao/smarttool/activity/ruler/RulerMainActivity.java: -------------------------------------------------------------------------------- 1 | package com.djzhao.smarttool.activity.ruler; 2 | 3 | import android.annotation.SuppressLint; 4 | import android.graphics.Point; 5 | import android.os.Build; 6 | import android.support.v7.app.AppCompatActivity; 7 | import android.os.Bundle; 8 | import android.text.BoringLayout; 9 | import android.util.DisplayMetrics; 10 | import android.view.Window; 11 | import android.view.WindowManager; 12 | import android.widget.TextView; 13 | 14 | import com.djzhao.smarttool.R; 15 | import com.djzhao.smarttool.activity.base.BaseActivity; 16 | import com.djzhao.smarttool.view.ruler.RulerView; 17 | 18 | import java.text.DecimalFormat; 19 | 20 | public class RulerMainActivity extends BaseActivity { 21 | 22 | private RulerView rulerView; 23 | private TextView textHint; 24 | 25 | @Override 26 | protected void findViewById() { 27 | rulerView = $(R.id.ruler_view); 28 | textHint = $(R.id.ruler_text_hint); 29 | } 30 | 31 | 32 | @Override 33 | protected void initView() { 34 | Point point = new Point(); 35 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { 36 | getWindowManager().getDefaultDisplay().getRealSize(point); 37 | } else { 38 | getWindowManager().getDefaultDisplay().getSize(point); 39 | } 40 | DisplayMetrics dm = getResources().getDisplayMetrics(); 41 | double inchesX = point.x / dm.xdpi; 42 | double inchesY = point.y / dm.ydpi; 43 | double cmX = inchesX * 2.54; 44 | double cmY = inchesY * 2.54; 45 | rulerView.setSize(toInt(cmX * 10), toInt(cmY * 10)) 46 | .setTextSize(dm.xdpi * 12 / 160) 47 | .setLineLength((int) (dm.xdpi * 10 / 160)) 48 | .build(); 49 | DecimalFormat decimalFormat = new DecimalFormat("###.00"); 50 | textHint.setText("屏幕信息\n宽:" + decimalFormat.format(cmX) + " CM\n高:" + decimalFormat.format(cmY) + " CM"); 51 | }// http://suo.im/api.php?url= 52 | 53 | /** 54 | * 四舍五入 55 | * 56 | * @param number 57 | * @return 58 | */ 59 | private int toInt(double number) { 60 | return Integer.parseInt(new java.text.DecimalFormat("0").format(number)); 61 | } 62 | 63 | @Override 64 | protected void onCreate(Bundle savedInstanceState) { 65 | super.onCreate(savedInstanceState); 66 | requestWindowFeature(Window.FEATURE_NO_TITLE);// 隐藏标题 67 | getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);// 设置全屏 68 | setContentView(R.layout.ruler_main_activity); 69 | 70 | findViewById(); 71 | initView(); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /app/src/main/java/com/djzhao/smarttool/activity/shortlink/ShortLinkMainActivity.java: -------------------------------------------------------------------------------- 1 | package com.djzhao.smarttool.activity.shortlink; 2 | 3 | import android.os.Bundle; 4 | import android.support.design.widget.Snackbar; 5 | import android.text.TextUtils; 6 | import android.view.View; 7 | import android.widget.Button; 8 | import android.widget.EditText; 9 | import android.widget.TextView; 10 | 11 | import com.djzhao.smarttool.R; 12 | import com.djzhao.smarttool.activity.base.BaseActivity; 13 | import com.djzhao.smarttool.util.ClipboardUtil; 14 | import com.djzhao.smarttool.util.HttpUtil; 15 | 16 | import java.io.IOException; 17 | 18 | import okhttp3.Call; 19 | import okhttp3.Callback; 20 | import okhttp3.Response; 21 | 22 | public class ShortLinkMainActivity extends BaseActivity implements View.OnClickListener { 23 | 24 | private Button clearInput, generateBtn, copyResultBtn, backBtn; 25 | private EditText inputTxt; 26 | private TextView resultTxt, title; 27 | 28 | @Override 29 | protected void findViewById() { 30 | title = $(R.id.title_layout_title_text); 31 | backBtn = $(R.id.title_layout_back_button); 32 | clearInput = $(R.id.short_link_clear_input); 33 | generateBtn = $(R.id.short_link_generate_btn); 34 | copyResultBtn = $(R.id.short_link_copy_btn); 35 | inputTxt = $(R.id.short_link_input); 36 | resultTxt = $(R.id.short_link_result); 37 | } 38 | 39 | @Override 40 | protected void initView() { 41 | title.setText("短网址生成"); 42 | backBtn.setOnClickListener(this); 43 | clearInput.setOnClickListener(this); 44 | generateBtn.setOnClickListener(this); 45 | copyResultBtn.setOnClickListener(this); 46 | } 47 | 48 | @Override 49 | protected void onCreate(Bundle savedInstanceState) { 50 | super.onCreate(savedInstanceState); 51 | setContentView(R.layout.short_link_main_activity); 52 | 53 | findViewById(); 54 | initView(); 55 | } 56 | 57 | @Override 58 | public void onClick(View v) { 59 | switch (v.getId()) { 60 | case R.id.title_layout_back_button: 61 | finish(); 62 | break; 63 | case R.id.short_link_clear_input: 64 | inputTxt.setText(""); 65 | break; 66 | case R.id.short_link_generate_btn: 67 | hideOrShowSoftInput(false, inputTxt); 68 | generateLink(); 69 | break; 70 | case R.id.short_link_copy_btn: 71 | copyResult(); 72 | break; 73 | } 74 | } 75 | 76 | private void copyResult() { 77 | ClipboardUtil.copyToClipboard(resultTxt.getText().toString().trim()); 78 | Snackbar.make(inputTxt, "结果已经复制到剪贴板", Snackbar.LENGTH_SHORT).show(); 79 | } 80 | 81 | private void generateLink() { 82 | String input = inputTxt.getText().toString().trim(); 83 | if (TextUtils.isEmpty(input)) { 84 | Snackbar.make(inputTxt, "请先输入网址", Snackbar.LENGTH_LONG).show(); 85 | } else { 86 | String url = "http://suo.im/api.php?url=" + input; 87 | showProgressDialog("生成中,请等待..."); 88 | HttpUtil.sendOkHttpRequest(url, new Callback() { 89 | @Override 90 | public void onFailure(Call call, IOException e) { 91 | runOnUiThread(new Runnable() { 92 | @Override 93 | public void run() { 94 | closeProgressDialog(); 95 | Snackbar.make(inputTxt, "网络异常", Snackbar.LENGTH_LONG).show(); 96 | } 97 | }); 98 | } 99 | 100 | @Override 101 | public void onResponse(Call call, Response response) throws IOException { 102 | final String string = response.body().string(); 103 | runOnUiThread(new Runnable() { 104 | @Override 105 | public void run() { 106 | closeProgressDialog(); 107 | if (string.startsWith("http")) { 108 | resultTxt.setText(string); 109 | } else { 110 | Snackbar.make(inputTxt, string, Snackbar.LENGTH_LONG).show(); 111 | } 112 | } 113 | }); 114 | } 115 | }); 116 | } 117 | } 118 | } 119 | -------------------------------------------------------------------------------- /app/src/main/java/com/djzhao/smarttool/activity/transcoding/TranscodingActivity.java: -------------------------------------------------------------------------------- 1 | package com.djzhao.smarttool.activity.transcoding; 2 | 3 | import android.os.Bundle; 4 | import android.support.design.widget.TabLayout; 5 | import android.support.v4.app.Fragment; 6 | import android.support.v4.view.ViewPager; 7 | import android.view.View; 8 | import android.widget.Button; 9 | import android.widget.TextView; 10 | 11 | import com.djzhao.smarttool.R; 12 | import com.djzhao.smarttool.adapter.transcoding.FragmentAdapter; 13 | import com.djzhao.smarttool.fragment.tanscoding.BASE64Fragment; 14 | import com.djzhao.smarttool.fragment.tanscoding.MD5Fragment; 15 | import com.djzhao.smarttool.fragment.tanscoding.SHA1Fragment; 16 | import com.djzhao.smarttool.activity.base.BaseActivity; 17 | 18 | import java.util.ArrayList; 19 | import java.util.List; 20 | 21 | public class TranscodingActivity extends BaseActivity implements View.OnClickListener { 22 | 23 | private TabLayout tabLayout; 24 | private ViewPager viewPager; 25 | private Button backBtn; 26 | private TextView title; 27 | 28 | @Override 29 | protected void findViewById() { 30 | tabLayout = $(R.id.transcoding_tab_layout); 31 | viewPager = $(R.id.transcoding_view_pager); 32 | backBtn = $(R.id.title_layout_back_button); 33 | title = $(R.id.title_layout_title_text); 34 | } 35 | 36 | @Override 37 | protected void initView() { 38 | backBtn.setOnClickListener(this); 39 | title.setText("编码/解码"); 40 | initPageViewer(); 41 | } 42 | 43 | private void initPageViewer() { 44 | List titles = new ArrayList<>(); 45 | titles.add("Base64"); 46 | titles.add("MD5"); 47 | titles.add("SHA1"); 48 | tabLayout.addTab(tabLayout.newTab().setText(titles.get(0))); 49 | tabLayout.addTab(tabLayout.newTab().setText(titles.get(1))); 50 | tabLayout.addTab(tabLayout.newTab().setText(titles.get(2))); 51 | 52 | List fragments = new ArrayList<>(); 53 | fragments.add(new BASE64Fragment()); 54 | fragments.add(new MD5Fragment()); 55 | fragments.add(new SHA1Fragment()); 56 | 57 | viewPager.setOffscreenPageLimit(2); 58 | 59 | FragmentAdapter adapter = new FragmentAdapter(getSupportFragmentManager(), fragments, titles); 60 | viewPager.setAdapter(adapter); 61 | tabLayout.setupWithViewPager(viewPager); 62 | } 63 | 64 | @Override 65 | protected void onCreate(Bundle savedInstanceState) { 66 | super.onCreate(savedInstanceState); 67 | setContentView(R.layout.transcoding_activity_main); 68 | 69 | findViewById(); 70 | initView(); 71 | } 72 | 73 | @Override 74 | public void onClick(View v) { 75 | switch (v.getId()) { 76 | case R.id.title_layout_back_button: 77 | finish(); 78 | break; 79 | } 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /app/src/main/java/com/djzhao/smarttool/activity/weather/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.djzhao.smarttool.activity.weather; 2 | 3 | import android.content.Intent; 4 | import android.content.SharedPreferences; 5 | import android.os.Bundle; 6 | import android.preference.PreferenceManager; 7 | import android.support.v7.app.AppCompatActivity; 8 | 9 | import com.djzhao.smarttool.R; 10 | 11 | public class MainActivity extends AppCompatActivity { 12 | 13 | @Override 14 | protected void onCreate(Bundle savedInstanceState) { 15 | super.onCreate(savedInstanceState); 16 | setContentView(R.layout.weather_activity_main); 17 | SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this); 18 | if (preferences.getString("weather", null) != null) { 19 | // ClipboardManager manager = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE); 20 | // manager.setPrimaryClip(ClipData.newPlainText("debug", preferences.getString("weather", null))); 21 | Intent intent = new Intent(this, WeatherActivity.class); 22 | startActivity(intent); 23 | finish(); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/java/com/djzhao/smarttool/adapter/chooseproblem/ItemListAdapter.java: -------------------------------------------------------------------------------- 1 | package com.djzhao.smarttool.adapter.chooseproblem; 2 | 3 | import android.content.Context; 4 | import android.support.annotation.NonNull; 5 | import android.support.v7.widget.RecyclerView; 6 | import android.view.LayoutInflater; 7 | import android.view.View; 8 | import android.view.ViewGroup; 9 | import android.widget.LinearLayout; 10 | import android.widget.TextView; 11 | 12 | import com.djzhao.smarttool.R; 13 | import com.djzhao.smarttool.db.chooseproblem.ChooseProblemItem; 14 | 15 | import java.util.List; 16 | 17 | /** 18 | * Created by djzhao on 18/05/06. 19 | */ 20 | public class ItemListAdapter extends RecyclerView.Adapter { 21 | 22 | private Context mContext; 23 | 24 | private List items; 25 | 26 | private static boolean isMenu; 27 | 28 | private OnRecyclerViewItemClickListener mOnItemClickListener = null; 29 | private OnRecyclerItemLongListener mOnItemLongClickListener = null; 30 | 31 | public ItemListAdapter(List items, boolean isMenu) { 32 | this.items = items; 33 | this.isMenu = isMenu; 34 | } 35 | 36 | static class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener, View.OnLongClickListener { 37 | private OnRecyclerViewItemClickListener mOnItemClickListener = null; 38 | private OnRecyclerItemLongListener mOnItemLongClickListener = null; 39 | LinearLayout layout; 40 | 41 | TextView title; 42 | 43 | public ViewHolder(View itemView, OnRecyclerViewItemClickListener mClickListener, OnRecyclerItemLongListener mLongClickListener) { 44 | super(itemView); 45 | this.mOnItemClickListener = mClickListener; 46 | this.mOnItemLongClickListener = mLongClickListener; 47 | layout = (LinearLayout) itemView; 48 | title = itemView.findViewById(R.id.choose_problem_list_item_text); 49 | if (isMenu) { 50 | layout.setOnClickListener(this); 51 | } 52 | layout.setOnLongClickListener(this); 53 | } 54 | 55 | @Override 56 | public void onClick(View v) { 57 | if (mOnItemClickListener != null) { 58 | mOnItemClickListener.onItemClick(v, getAdapterPosition()); 59 | } 60 | } 61 | 62 | @Override 63 | public boolean onLongClick(View v) { 64 | if (mOnItemLongClickListener != null) { 65 | mOnItemLongClickListener.onItemLongClick(v, getAdapterPosition()); 66 | } 67 | return false; 68 | } 69 | 70 | } 71 | 72 | @NonNull 73 | @Override 74 | public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { 75 | if (mContext == null) { 76 | mContext = parent.getContext(); 77 | } 78 | View view = LayoutInflater.from(mContext).inflate(R.layout.choose_problem_list_item, parent, false); 79 | return new ViewHolder(view, mOnItemClickListener, mOnItemLongClickListener); 80 | } 81 | 82 | @Override 83 | public void onBindViewHolder(@NonNull ViewHolder holder, int position) { 84 | holder.title.setText(items.get(position).getTitle()); 85 | } 86 | 87 | @Override 88 | public int getItemCount() { 89 | return items.size(); 90 | } 91 | 92 | //define interface 93 | public interface OnRecyclerViewItemClickListener { 94 | void onItemClick(View view, int data); 95 | 96 | } 97 | 98 | public interface OnRecyclerItemLongListener { 99 | void onItemLongClick(View view, int position); 100 | } 101 | 102 | public void setOnItemClickListener(OnRecyclerViewItemClickListener listener) { 103 | this.mOnItemClickListener = listener; 104 | } 105 | 106 | public void setOnItemLongClickListener(OnRecyclerItemLongListener listener) { 107 | this.mOnItemLongClickListener = listener; 108 | } 109 | 110 | } 111 | -------------------------------------------------------------------------------- /app/src/main/java/com/djzhao/smarttool/adapter/qrcode/ViewPagerAdapter.java: -------------------------------------------------------------------------------- 1 | package com.djzhao.smarttool.adapter.qrcode; 2 | 3 | import android.support.v4.app.Fragment; 4 | import android.support.v4.app.FragmentManager; 5 | import android.support.v4.app.FragmentPagerAdapter; 6 | 7 | import com.djzhao.smarttool.fragment.qrcodecard.DIYCodeFragment; 8 | import com.djzhao.smarttool.fragment.qrcodecard.VisitingCardFragment; 9 | 10 | /** 11 | * Created by djzhao on 18/05/04. 12 | */ 13 | public class ViewPagerAdapter extends FragmentPagerAdapter { 14 | 15 | private Fragment[] fragments = new Fragment[]{new VisitingCardFragment(), new DIYCodeFragment()}; 16 | 17 | public ViewPagerAdapter(FragmentManager fm) { 18 | super(fm); 19 | } 20 | 21 | @Override 22 | public Fragment getItem(int position) { 23 | return fragments[position]; 24 | } 25 | 26 | @Override 27 | public int getCount() { 28 | return fragments.length; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/src/main/java/com/djzhao/smarttool/adapter/transcoding/FragmentAdapter.java: -------------------------------------------------------------------------------- 1 | package com.djzhao.smarttool.adapter.transcoding; 2 | 3 | import android.support.v4.app.Fragment; 4 | import android.support.v4.app.FragmentManager; 5 | import android.support.v4.app.FragmentStatePagerAdapter; 6 | 7 | import java.util.List; 8 | 9 | public class FragmentAdapter extends FragmentStatePagerAdapter { 10 | private List mFragments; 11 | private List mTitles; 12 | 13 | public FragmentAdapter(FragmentManager fm, List fragments, List titles) { 14 | super(fm); 15 | mFragments = fragments; 16 | mTitles = titles; 17 | } 18 | 19 | @Override 20 | public Fragment getItem(int position) { 21 | return mFragments.get(position); 22 | } 23 | 24 | @Override 25 | public int getCount() { 26 | return mFragments.size(); 27 | } 28 | 29 | @Override 30 | public CharSequence getPageTitle(int position) { 31 | return mTitles.get(position); 32 | } 33 | 34 | } -------------------------------------------------------------------------------- /app/src/main/java/com/djzhao/smarttool/broadcast/torch/TorchWidgetProvider.java: -------------------------------------------------------------------------------- 1 | package com.djzhao.smarttool.broadcast.torch; 2 | import android.app.*; 3 | import android.appwidget.*; 4 | import android.content.*; 5 | import android.util.*; 6 | import android.widget.*; 7 | 8 | import com.djzhao.smarttool.R; 9 | import com.djzhao.smarttool.util.torch.TorchUtils; 10 | 11 | public class TorchWidgetProvider extends AppWidgetProvider 12 | { 13 | public static final String CLICK_ACTION = "cc.trv.simpletorch.action.TORCH_WIDGET_CLICK";// 点击事件的广播ACTION 14 | private int appWidgetId = 0; 15 | 16 | @Override 17 | public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) 18 | { 19 | super.onUpdate(context, appWidgetManager, appWidgetIds); 20 | RemoteViews remoteViews = new RemoteViews(context.getPackageName(), R.layout.torch_widget_layout); 21 | Intent intent = new Intent(CLICK_ACTION); 22 | intent.putExtra("appWidgetId", appWidgetIds[0]); 23 | appWidgetId = appWidgetIds[0]; 24 | PendingIntent pi = PendingIntent.getBroadcast(context, R.id.torch_widget_icon, intent, PendingIntent.FLAG_UPDATE_CURRENT); 25 | remoteViews.setOnClickPendingIntent(R.id.torch_widget_icon, pi); 26 | for (int appWidgetId : appWidgetIds) 27 | { 28 | appWidgetManager.updateAppWidget(appWidgetId, remoteViews); 29 | } 30 | } 31 | 32 | @Override 33 | public void onReceive(Context context, Intent intent) 34 | { 35 | super.onReceive(context, intent); 36 | if (CLICK_ACTION.equals(intent.getAction())) 37 | { 38 | Log.i("dj", appWidgetId + ""); 39 | RemoteViews remoteViews = new RemoteViews(context.getPackageName(), R.layout.torch_widget_layout); 40 | try 41 | { 42 | if (!TorchUtils.IS_TORCH_ON) 43 | { 44 | TorchUtils.openFlash(context, false); 45 | remoteViews.setImageViewResource(R.id.torch_widget_icon, R.drawable.button_on); 46 | } 47 | else 48 | { 49 | TorchUtils.closeFlash(false); 50 | remoteViews.setImageViewResource(R.id.torch_widget_icon, R.drawable.button_off); 51 | } 52 | TorchUtils.IS_TORCH_ON = !TorchUtils.IS_TORCH_ON; 53 | AppWidgetManager.getInstance(context).updateAppWidget(appWidgetId, remoteViews); 54 | } 55 | catch (Exception e) 56 | {} 57 | } 58 | } 59 | 60 | @Override 61 | public void onEnabled(Context context) 62 | { 63 | super.onEnabled(context); 64 | 65 | RemoteViews remoteViews = new RemoteViews(context.getPackageName(), R.layout.torch_widget_layout); 66 | if (!TorchUtils.IS_TORCH_ON) 67 | { 68 | remoteViews.setImageViewResource(R.id.torch_widget_icon, R.drawable.button_on); 69 | } 70 | else 71 | { 72 | remoteViews.setImageViewResource(R.id.torch_widget_icon, R.drawable.button_off); 73 | } 74 | } 75 | 76 | 77 | 78 | @Override 79 | public void onDeleted(Context context, int[] appWidgetIds) 80 | { 81 | super.onDeleted(context, appWidgetIds); 82 | TorchUtils.closeFlash(false); 83 | } 84 | 85 | 86 | 87 | } 88 | -------------------------------------------------------------------------------- /app/src/main/java/com/djzhao/smarttool/db/chooseproblem/ChooseProblemItem.java: -------------------------------------------------------------------------------- 1 | package com.djzhao.smarttool.db.chooseproblem; 2 | 3 | import org.litepal.crud.DataSupport; 4 | 5 | /** 6 | * Created by djzhao on 18/05/07. 7 | */ 8 | public class ChooseProblemItem extends DataSupport { 9 | private int id; 10 | private String title; 11 | private int parentId; 12 | 13 | public int getId() { 14 | return id; 15 | } 16 | 17 | public void setId(int id) { 18 | this.id = id; 19 | } 20 | 21 | public String getTitle() { 22 | return title; 23 | } 24 | 25 | public void setTitle(String title) { 26 | this.title = title; 27 | } 28 | 29 | public int getParentId() { 30 | return parentId; 31 | } 32 | 33 | public void setParentId(int parentId) { 34 | this.parentId = parentId; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /app/src/main/java/com/djzhao/smarttool/db/weather/City.java: -------------------------------------------------------------------------------- 1 | package com.djzhao.smarttool.db.weather; 2 | 3 | import org.litepal.crud.DataSupport; 4 | 5 | /** 6 | * Created by djzhao on 18/04/18. 7 | */ 8 | 9 | public class City extends DataSupport { 10 | 11 | private int id; 12 | 13 | private String cityName; 14 | 15 | private int cityCode; 16 | 17 | private int provinceId; 18 | 19 | public int getId() { 20 | return id; 21 | } 22 | 23 | public void setId(int id) { 24 | this.id = id; 25 | } 26 | 27 | public String getCityName() { 28 | return cityName; 29 | } 30 | 31 | public void setCityName(String cityName) { 32 | this.cityName = cityName; 33 | } 34 | 35 | public int getCityCode() { 36 | return cityCode; 37 | } 38 | 39 | public void setCityCode(int cityCode) { 40 | this.cityCode = cityCode; 41 | } 42 | 43 | public int getProvinceId() { 44 | return provinceId; 45 | } 46 | 47 | public void setProvinceId(int provinceId) { 48 | this.provinceId = provinceId; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /app/src/main/java/com/djzhao/smarttool/db/weather/County.java: -------------------------------------------------------------------------------- 1 | package com.djzhao.smarttool.db.weather; 2 | 3 | import org.litepal.crud.DataSupport; 4 | 5 | /** 6 | * Created by djzhao on 18/04/18. 7 | */ 8 | 9 | public class County extends DataSupport { 10 | 11 | private int id; 12 | 13 | private String countyName; 14 | 15 | private String weatherId; 16 | 17 | private int cityId; 18 | 19 | public int getId() { 20 | return id; 21 | } 22 | 23 | public void setId(int id) { 24 | this.id = id; 25 | } 26 | 27 | public String getCountyName() { 28 | return countyName; 29 | } 30 | 31 | public void setCountyName(String countyName) { 32 | this.countyName = countyName; 33 | } 34 | 35 | public String getWeatherId() { 36 | return weatherId; 37 | } 38 | 39 | public void setWeatherId(String weatherId) { 40 | this.weatherId = weatherId; 41 | } 42 | 43 | public int getCityId() { 44 | return cityId; 45 | } 46 | 47 | public void setCityId(int cityId) { 48 | this.cityId = cityId; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /app/src/main/java/com/djzhao/smarttool/db/weather/Province.java: -------------------------------------------------------------------------------- 1 | package com.djzhao.smarttool.db.weather; 2 | 3 | import org.litepal.crud.DataSupport; 4 | 5 | /** 6 | * Created by djzhao on 18/04/18. 7 | */ 8 | 9 | public class Province extends DataSupport { 10 | 11 | private int id; 12 | 13 | private String provinceName; 14 | 15 | private int provinceCode; 16 | 17 | public int getId() { 18 | return id; 19 | } 20 | 21 | public void setId(int id) { 22 | this.id = id; 23 | } 24 | 25 | public String getProvinceName() { 26 | return provinceName; 27 | } 28 | 29 | public void setProvinceName(String provinceName) { 30 | this.provinceName = provinceName; 31 | } 32 | 33 | public int getProvinceCode() { 34 | return provinceCode; 35 | } 36 | 37 | public void setProvinceCode(int provinceCode) { 38 | this.provinceCode = provinceCode; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /app/src/main/java/com/djzhao/smarttool/dialog/chooseproblem/AddItemDialog.java: -------------------------------------------------------------------------------- 1 | package com.djzhao.smarttool.dialog.chooseproblem; 2 | 3 | import android.app.Dialog; 4 | import android.content.Context; 5 | import android.os.Bundle; 6 | import android.view.View; 7 | import android.widget.Button; 8 | import android.widget.EditText; 9 | 10 | import com.djzhao.smarttool.R; 11 | 12 | public class AddItemDialog extends Dialog { 13 | 14 | private Button cancelBtn; 15 | private Button addBtn; 16 | private EditText inputTxt; 17 | 18 | private onCancelClickedListener cancelListener; 19 | private onAddClickedListener addListener; 20 | 21 | 22 | public AddItemDialog(Context context) { 23 | super(context, R.style.dialog_custom); 24 | } 25 | 26 | @Override 27 | protected void onCreate(Bundle savedInstanceState) { 28 | super.onCreate(savedInstanceState); 29 | setContentView(R.layout.choose_problem_add_item_dialog_layout); 30 | setCanceledOnTouchOutside(false); 31 | 32 | initView(); 33 | initEvent(); 34 | } 35 | 36 | private void initView() { 37 | cancelBtn = findViewById(R.id.choose_problem_add_item_cancel_btn); 38 | addBtn = findViewById(R.id.choose_problem_add_item_add_btn); 39 | inputTxt = findViewById(R.id.choose_problem_add_item_input_txt); 40 | } 41 | 42 | private void initEvent() { 43 | cancelBtn.setOnClickListener(new View.OnClickListener() { 44 | public void onClick(View v) { 45 | if (cancelListener != null) { 46 | cancelListener.onClick(); 47 | } 48 | } 49 | }); 50 | 51 | addBtn.setOnClickListener(new View.OnClickListener() { 52 | public void onClick(View v) { 53 | if (addListener != null) { 54 | addListener.onClick(inputTxt.getText().toString().trim()); 55 | } 56 | } 57 | }); 58 | } 59 | 60 | public void setOnCancelClickedListener(onCancelClickedListener cancelListener) { 61 | this.cancelListener = cancelListener; 62 | } 63 | 64 | public void setOnAddClickedListener(onAddClickedListener startListener) { 65 | this.addListener = startListener; 66 | } 67 | 68 | public interface onCancelClickedListener { 69 | public void onClick(); 70 | } 71 | 72 | public interface onAddClickedListener { 73 | public void onClick(String title); 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /app/src/main/java/com/djzhao/smarttool/dialog/torch/FlashlightDialog.java: -------------------------------------------------------------------------------- 1 | package com.djzhao.smarttool.dialog.torch; 2 | 3 | import android.app.Dialog; 4 | import android.content.Context; 5 | import android.os.Bundle; 6 | import android.view.View; 7 | import android.widget.Button; 8 | import android.widget.SeekBar; 9 | 10 | import com.djzhao.smarttool.R; 11 | 12 | public class FlashlightDialog extends Dialog { 13 | 14 | private Button cancel; 15 | private Button start; 16 | private SeekBar frequency; 17 | 18 | private onCancelClickedListener cancelListener; 19 | private onStartClickedListener startListener; 20 | 21 | 22 | 23 | public FlashlightDialog(Context context) { 24 | super(context, R.style.dialog_custom); 25 | } 26 | 27 | @Override 28 | protected void onCreate(Bundle savedInstanceState) { 29 | super.onCreate(savedInstanceState); 30 | setContentView(R.layout.torch_flashlight_dialog_layout); 31 | setCanceledOnTouchOutside(false); 32 | 33 | initView(); 34 | initEvent(); 35 | } 36 | 37 | private void initView() { 38 | cancel = (Button) findViewById(R.id.flashlight_dialog_layout_cancel); 39 | start = (Button) findViewById(R.id.flashlight_dialog_layout_start); 40 | frequency = (SeekBar) findViewById(R.id.flashlight_dialog_layout_seek_bar); 41 | } 42 | 43 | private void initEvent() { 44 | cancel.setOnClickListener(new View.OnClickListener() { 45 | public void onClick(View v) { 46 | if (cancelListener != null) { 47 | cancelListener.onClick(); 48 | } 49 | } 50 | }); 51 | 52 | start.setOnClickListener(new View.OnClickListener() { 53 | public void onClick(View v) { 54 | if (startListener != null) { 55 | startListener.onClick(frequency.getProgress()); 56 | } 57 | } 58 | }); 59 | } 60 | 61 | public void setOnCancelClickedListener(onCancelClickedListener cancelListener) { 62 | this.cancelListener = cancelListener; 63 | } 64 | 65 | public void setOnStartClickedListener(onStartClickedListener startListener) { 66 | this.startListener = startListener; 67 | } 68 | 69 | public interface onCancelClickedListener { 70 | public void onClick(); 71 | } 72 | 73 | public interface onStartClickedListener { 74 | public void onClick(int fre); 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /app/src/main/java/com/djzhao/smarttool/fragment/base/BaseFragment.java: -------------------------------------------------------------------------------- 1 | package com.djzhao.smarttool.fragment.base; 2 | 3 | import android.app.Activity; 4 | import android.os.Bundle; 5 | import android.support.v4.app.Fragment; 6 | import android.view.LayoutInflater; 7 | import android.view.View; 8 | import android.view.ViewGroup; 9 | 10 | import com.djzhao.smarttool.activity.base.BaseActivity; 11 | 12 | public abstract class BaseFragment extends Fragment { 13 | protected BaseActivity mActivity; 14 | 15 | protected abstract int setView(); 16 | 17 | protected abstract void init(View view); 18 | 19 | protected abstract void initData(Bundle savedInstanceState); 20 | 21 | @Override 22 | public void onAttach(Activity activity) { 23 | super.onAttach(activity); 24 | mActivity = (BaseActivity) activity; 25 | } 26 | 27 | @Override 28 | public void onCreate(Bundle savedInstanceState) { 29 | super.onCreate(savedInstanceState); 30 | } 31 | 32 | @Override 33 | public View onCreateView(LayoutInflater inflater, ViewGroup container, 34 | Bundle savedInstanceState) { 35 | return inflater.inflate(setView(), container, false); 36 | } 37 | 38 | @Override 39 | public void onViewCreated(View view, Bundle savedInstanceState) { 40 | super.onViewCreated(view, savedInstanceState); 41 | init(view); 42 | } 43 | 44 | @Override 45 | public void onActivityCreated(Bundle savedInstanceState) { 46 | super.onActivityCreated(savedInstanceState); 47 | initData(savedInstanceState); 48 | } 49 | 50 | @Override 51 | public void onStart() { 52 | super.onStart(); 53 | } 54 | 55 | @Override 56 | public void onResume() { 57 | super.onResume(); 58 | } 59 | 60 | @Override 61 | public void onPause() { 62 | super.onPause(); 63 | } 64 | 65 | 66 | @Override 67 | public void onStop() { 68 | super.onStop(); 69 | } 70 | 71 | 72 | @Override 73 | public void onDestroyView() { 74 | super.onDestroyView(); 75 | } 76 | 77 | @Override 78 | public void onDestroy() { 79 | super.onDestroy(); 80 | } 81 | 82 | @Override 83 | public void onDetach() { 84 | super.onDetach(); 85 | } 86 | } -------------------------------------------------------------------------------- /app/src/main/java/com/djzhao/smarttool/fragment/tanscoding/BASE64Fragment.java: -------------------------------------------------------------------------------- 1 | package com.djzhao.smarttool.fragment.tanscoding; 2 | 3 | 4 | import android.content.ClipData; 5 | import android.content.ClipboardManager; 6 | import android.content.Context; 7 | import android.os.Bundle; 8 | import android.support.annotation.NonNull; 9 | import android.support.annotation.Nullable; 10 | import android.support.design.widget.Snackbar; 11 | import android.support.v4.app.Fragment; 12 | import android.text.TextUtils; 13 | import android.text.method.ScrollingMovementMethod; 14 | import android.util.Base64; 15 | import android.view.LayoutInflater; 16 | import android.view.View; 17 | import android.view.ViewGroup; 18 | import android.widget.Button; 19 | import android.widget.EditText; 20 | import android.widget.LinearLayout; 21 | import android.widget.RadioButton; 22 | import android.widget.TextView; 23 | 24 | import com.djzhao.smarttool.R; 25 | import com.djzhao.smarttool.util.ClipboardUtil; 26 | 27 | public class BASE64Fragment extends Fragment implements View.OnClickListener { 28 | 29 | private RadioButton encodeRadio; 30 | private EditText inputText; 31 | private Button dealInput; 32 | private TextView resultText; 33 | private TextView clearBtn; 34 | 35 | @Nullable 36 | @Override 37 | public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { 38 | LinearLayout linearLayout = (LinearLayout) inflater.inflate(R.layout.transcoding_fragment_base64, container, false); 39 | encodeRadio = linearLayout.findViewById(R.id.fag_base64_encode); 40 | inputText = linearLayout.findViewById(R.id.fag_base64_input); 41 | dealInput = linearLayout.findViewById(R.id.fag_base64_deal); 42 | resultText = linearLayout.findViewById(R.id.fag_base64_result); 43 | clearBtn = linearLayout.findViewById(R.id.fag_base64_clear); 44 | return linearLayout; 45 | } 46 | 47 | @Override 48 | public void onActivityCreated(@Nullable Bundle savedInstanceState) { 49 | super.onActivityCreated(savedInstanceState); 50 | inputText.requestFocus(); 51 | dealInput.setOnClickListener(this); 52 | clearBtn.setOnClickListener(this); 53 | resultText.setMovementMethod(new ScrollingMovementMethod()); 54 | } 55 | 56 | @Override 57 | public void onClick(View v) { 58 | switch (v.getId()) { 59 | case R.id.fag_base64_deal: 60 | if (TextUtils.isEmpty(inputText.getText())) { 61 | Snackbar.make(getView(), "请先输入文本", Snackbar.LENGTH_SHORT).show(); 62 | } else { 63 | String text = inputText.getText().toString(); 64 | byte[] bytes; 65 | if (encodeRadio.isChecked()) { 66 | bytes = Base64.encode(text.getBytes(), Base64.DEFAULT); 67 | } else { 68 | bytes = Base64.decode(text, Base64.DEFAULT); 69 | } 70 | resultText.setText(new String(bytes)); 71 | ClipboardUtil.copyToClipboard(resultText.getText().toString().trim()); 72 | Snackbar.make(getView(), "结果已经复制到剪贴板", Snackbar.LENGTH_LONG).show(); 73 | } 74 | break; 75 | case R.id.fag_base64_clear: 76 | inputText.setText(""); 77 | break; 78 | } 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /app/src/main/java/com/djzhao/smarttool/fragment/tanscoding/MD5Fragment.java: -------------------------------------------------------------------------------- 1 | package com.djzhao.smarttool.fragment.tanscoding; 2 | 3 | 4 | import android.content.ClipData; 5 | import android.content.ClipboardManager; 6 | import android.content.Context; 7 | import android.os.Bundle; 8 | import android.support.annotation.NonNull; 9 | import android.support.annotation.Nullable; 10 | import android.support.design.widget.Snackbar; 11 | import android.support.v4.app.Fragment; 12 | import android.text.TextUtils; 13 | import android.text.method.ScrollingMovementMethod; 14 | import android.util.Base64; 15 | import android.view.LayoutInflater; 16 | import android.view.View; 17 | import android.view.ViewGroup; 18 | import android.widget.Button; 19 | import android.widget.EditText; 20 | import android.widget.LinearLayout; 21 | import android.widget.RadioButton; 22 | import android.widget.TextView; 23 | 24 | import com.djzhao.smarttool.R; 25 | import com.djzhao.smarttool.util.ClipboardUtil; 26 | 27 | import java.security.MessageDigest; 28 | import java.security.NoSuchAlgorithmException; 29 | 30 | public class MD5Fragment extends Fragment implements View.OnClickListener { 31 | 32 | private RadioButton encodeRadio; 33 | private EditText inputText; 34 | private Button dealInput; 35 | private TextView resultText; 36 | private TextView clearBtn; 37 | 38 | @Nullable 39 | @Override 40 | public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { 41 | LinearLayout linearLayout = (LinearLayout) inflater.inflate(R.layout.transcoding_fragment_md5, container, false); 42 | encodeRadio = linearLayout.findViewById(R.id.fag_md5_encode); 43 | inputText = linearLayout.findViewById(R.id.fag_md5_input); 44 | dealInput = linearLayout.findViewById(R.id.fag_md5_deal); 45 | resultText = linearLayout.findViewById(R.id.fag_md5_result); 46 | clearBtn = linearLayout.findViewById(R.id.fag_md5_clear); 47 | return linearLayout; 48 | } 49 | 50 | @Override 51 | public void onActivityCreated(@Nullable Bundle savedInstanceState) { 52 | super.onActivityCreated(savedInstanceState); 53 | inputText.requestFocus(); 54 | dealInput.setOnClickListener(this); 55 | clearBtn.setOnClickListener(this); 56 | resultText.setMovementMethod(new ScrollingMovementMethod()); 57 | } 58 | 59 | @Override 60 | public void onClick(View v) { 61 | switch (v.getId()) { 62 | case R.id.fag_md5_deal: 63 | if (TextUtils.isEmpty(inputText.getText())) { 64 | Snackbar.make(getView(), "请先输入文本", Snackbar.LENGTH_SHORT).show(); 65 | } else { 66 | String text = inputText.getText().toString(); 67 | resultText.setText(MD5Encode(text)); 68 | ClipboardUtil.copyToClipboard(resultText.getText().toString()); 69 | Snackbar.make(getView(), "结果已经复制到剪贴板", Snackbar.LENGTH_LONG).show(); 70 | } 71 | break; 72 | case R.id.fag_md5_clear: 73 | inputText.setText(""); 74 | break; 75 | } 76 | } 77 | 78 | private String MD5Encode(String plaintext) { 79 | char hexDigits[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 80 | 'a', 'b', 'c', 'd', 'e', 'f'}; 81 | try { 82 | byte[] btInput = plaintext.getBytes(); 83 | // 获得MD5摘要算法的 MessageDigest 对象 84 | MessageDigest mdInst = MessageDigest.getInstance("MD5"); 85 | // 使用指定的字节更新摘要 86 | mdInst.update(btInput); 87 | // 获得密文 88 | byte[] md = mdInst.digest(); 89 | // 把密文转换成十六进制的字符串形式 90 | int j = md.length; 91 | char str[] = new char[j * 2]; 92 | int k = 0; 93 | for (int i = 0; i < j; i++) { 94 | byte byte0 = md[i]; 95 | str[k++] = hexDigits[byte0 >>> 4 & 0xf]; 96 | str[k++] = hexDigits[byte0 & 0xf]; 97 | } 98 | return new String(str); 99 | } catch (Exception e) { 100 | return null; 101 | } 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /app/src/main/java/com/djzhao/smarttool/fragment/tanscoding/SHA1Fragment.java: -------------------------------------------------------------------------------- 1 | package com.djzhao.smarttool.fragment.tanscoding; 2 | 3 | 4 | import android.content.ClipData; 5 | import android.content.ClipboardManager; 6 | import android.content.Context; 7 | import android.os.Bundle; 8 | import android.support.annotation.NonNull; 9 | import android.support.annotation.Nullable; 10 | import android.support.design.widget.Snackbar; 11 | import android.support.v4.app.Fragment; 12 | import android.text.TextUtils; 13 | import android.text.method.ScrollingMovementMethod; 14 | import android.view.LayoutInflater; 15 | import android.view.View; 16 | import android.view.ViewGroup; 17 | import android.widget.Button; 18 | import android.widget.EditText; 19 | import android.widget.LinearLayout; 20 | import android.widget.RadioButton; 21 | import android.widget.TextView; 22 | 23 | import com.djzhao.smarttool.R; 24 | import com.djzhao.smarttool.util.ClipboardUtil; 25 | 26 | import java.security.MessageDigest; 27 | 28 | public class SHA1Fragment extends Fragment implements View.OnClickListener { 29 | 30 | private RadioButton encodeRadio; 31 | private EditText inputText; 32 | private Button dealInput; 33 | private TextView resultText; 34 | private TextView clearBtn; 35 | 36 | @Nullable 37 | @Override 38 | public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { 39 | LinearLayout linearLayout = (LinearLayout) inflater.inflate(R.layout.transcoding_fragment_md5, container, false); 40 | encodeRadio = linearLayout.findViewById(R.id.fag_md5_encode); 41 | inputText = linearLayout.findViewById(R.id.fag_md5_input); 42 | dealInput = linearLayout.findViewById(R.id.fag_md5_deal); 43 | resultText = linearLayout.findViewById(R.id.fag_md5_result); 44 | clearBtn = linearLayout.findViewById(R.id.fag_md5_clear); 45 | return linearLayout; 46 | } 47 | 48 | @Override 49 | public void onActivityCreated(@Nullable Bundle savedInstanceState) { 50 | super.onActivityCreated(savedInstanceState); 51 | inputText.requestFocus(); 52 | dealInput.setOnClickListener(this); 53 | clearBtn.setOnClickListener(this); 54 | resultText.setMovementMethod(new ScrollingMovementMethod()); 55 | } 56 | 57 | @Override 58 | public void onClick(View v) { 59 | switch (v.getId()) { 60 | case R.id.fag_md5_deal: 61 | if (TextUtils.isEmpty(inputText.getText())) { 62 | Snackbar.make(getView(), "请先输入文本", Snackbar.LENGTH_SHORT).show(); 63 | } else { 64 | String text = inputText.getText().toString(); 65 | resultText.setText(SHA1Encode(text)); 66 | ClipboardUtil.copyToClipboard(resultText.getText().toString()); 67 | Snackbar.make(getView(), "结果已经复制到剪贴板", Snackbar.LENGTH_LONG).show(); 68 | } 69 | break; 70 | case R.id.fag_md5_clear: 71 | inputText.setText(""); 72 | break; 73 | } 74 | } 75 | 76 | private final char[] HEX = {'0', '1', '2', '3', '4', '5', 77 | '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}; 78 | 79 | private String getFormattedText(byte[] bytes) { 80 | int len = bytes.length; 81 | StringBuilder buf = new StringBuilder(len * 2); 82 | // 把密文转换成十六进制的字符串形式 83 | for (int j = 0; j < len; j++) { 84 | buf.append(HEX[(bytes[j] >> 4) & 0x0f]); 85 | buf.append(HEX[bytes[j] & 0x0f]); 86 | } 87 | return buf.toString(); 88 | } 89 | 90 | public String SHA1Encode(String str) { 91 | if (str == null) { 92 | return null; 93 | } 94 | try { 95 | MessageDigest messageDigest = MessageDigest.getInstance("SHA1"); 96 | messageDigest.update(str.getBytes()); 97 | return getFormattedText(messageDigest.digest()); 98 | } catch (Exception e) { 99 | throw new RuntimeException(e); 100 | } 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /app/src/main/java/com/djzhao/smarttool/gson/weather/AQI.java: -------------------------------------------------------------------------------- 1 | package com.djzhao.smarttool.gson.weather; 2 | 3 | /** 4 | * Created by djzhao on 18/04/19. 5 | * 6 | * "aqi":{ 7 | * "city":{ 8 | * "aqi":"44", 9 | * "pm25":"13" 10 | * } 11 | * } 12 | * 13 | */ 14 | 15 | public class AQI { 16 | 17 | public AQICity city; 18 | 19 | public class AQICity { 20 | 21 | public String aqi; 22 | 23 | public String pm25; 24 | 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /app/src/main/java/com/djzhao/smarttool/gson/weather/Basic.java: -------------------------------------------------------------------------------- 1 | package com.djzhao.smarttool.gson.weather; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | 5 | /** 6 | * Created by djzhao on 18/04/19. 7 | * 8 | *"basic":{ 9 | * "city":"苏州", 10 | * "id":"CN101190401", 11 | * "update":{ 12 | * "loc":"2016-08-08 21:58" 13 | * } 14 | *} 15 | */ 16 | 17 | public class Basic { 18 | 19 | @SerializedName("city") 20 | public String cityName; 21 | 22 | @SerializedName("id") 23 | public String weatherId; 24 | 25 | public Update update; 26 | 27 | public class Update { 28 | 29 | @SerializedName("loc") 30 | public String updateTime; 31 | 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /app/src/main/java/com/djzhao/smarttool/gson/weather/Forecast.java: -------------------------------------------------------------------------------- 1 | package com.djzhao.smarttool.gson.weather; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | 5 | /** 6 | * Created by djzhao on 18/04/19. 7 | * 8 | * "daily_forecast":[ 9 | * { 10 | * "date":"2016-08-08", 11 | * "cond":{ 12 | * "txt_d":"阵雨" 13 | * }, 14 | * "tmp":{ 15 | * "max":"34", 16 | * "min":"27" 17 | * } 18 | * }, 19 | * { 20 | * "date":"2016-08-09", 21 | * "cond":{ 22 | * "txt_d":"多云" 23 | * }, 24 | * "tmp":{ 25 | * "max":"35", 26 | * "min":"29" 27 | * } 28 | * }, 29 | * ... 30 | * } 31 | */ 32 | 33 | public class Forecast { 34 | 35 | public String date; 36 | 37 | @SerializedName("tmp") 38 | public Temperature temperature; 39 | 40 | @SerializedName("cond") 41 | public More more; 42 | 43 | 44 | public class Temperature { 45 | 46 | public String max; 47 | 48 | public String min; 49 | 50 | } 51 | 52 | public class More { 53 | 54 | @SerializedName("txt_d") 55 | public String info; 56 | 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /app/src/main/java/com/djzhao/smarttool/gson/weather/Now.java: -------------------------------------------------------------------------------- 1 | package com.djzhao.smarttool.gson.weather; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | 5 | /** 6 | * Created by djzhao on 18/04/19. 7 | * 8 | * "now":{ 9 | * "tmp":"29", 10 | * "cond":{ 11 | * "txt":"阵雨" 12 | * } 13 | * } 14 | */ 15 | 16 | public class Now { 17 | 18 | @SerializedName("tmp") 19 | public String temperature; 20 | 21 | @SerializedName("cond") 22 | public More more; 23 | 24 | public class More { 25 | 26 | @SerializedName("txt") 27 | public String info; 28 | 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/src/main/java/com/djzhao/smarttool/gson/weather/Suggestion.java: -------------------------------------------------------------------------------- 1 | package com.djzhao.smarttool.gson.weather; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | 5 | /** 6 | * Created by djzhao on 18/04/19. 7 | * 8 | * "suggestion":{ 9 | * "comf":{ 10 | * "txt":"白天天气较热,虽然有雨,但仍然无法削弱较高气温给人们带来的暑意, 11 | * 这种天气会让您感到不很舒适。" 12 | * }, 13 | * "cw":{ 14 | * "txt":"不宜洗车,未来 24 小时内有雨,如果在此期间洗车,雨水和路上的泥水 15 | * 可能会再次弄脏您的爱车。" 16 | * }, 17 | * "sport":{ 18 | * "txt":"有降水,且风力较强,推荐您在室内进行低强度运动;若坚持户外运动, 19 | * 请选择避雨防风的地点。" 20 | * } 21 | * } 22 | */ 23 | 24 | public class Suggestion { 25 | 26 | @SerializedName("comf") 27 | public Comfort comfort; 28 | 29 | @SerializedName("cw") 30 | public CarWash carWash; 31 | 32 | public Sport sport; 33 | 34 | public class Comfort { 35 | 36 | @SerializedName("txt") 37 | public String info; 38 | 39 | } 40 | 41 | public class CarWash { 42 | 43 | @SerializedName("txt") 44 | public String info; 45 | 46 | } 47 | 48 | public class Sport { 49 | 50 | @SerializedName("txt") 51 | public String info; 52 | 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /app/src/main/java/com/djzhao/smarttool/gson/weather/Weather.java: -------------------------------------------------------------------------------- 1 | package com.djzhao.smarttool.gson.weather; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * Created by djzhao on 18/04/19. 9 | * 10 | * { 11 | * "HeWeather": [ 12 | * { 13 | * "status": "ok", 14 | * "basic": {}, 15 | * "aqi": {}, 16 | * "now": {}, 17 | * "suggestion": {}, 18 | * "daily_forecast": [] 19 | * } 20 | * ] 21 | * } 22 | */ 23 | 24 | public class Weather { 25 | 26 | public String status; 27 | 28 | public Basic basic; 29 | 30 | public AQI aqi; 31 | 32 | public Now now; 33 | 34 | public Suggestion suggestion; 35 | 36 | @SerializedName("daily_forecast") 37 | public List forecastList; 38 | 39 | } 40 | -------------------------------------------------------------------------------- /app/src/main/java/com/djzhao/smarttool/service/weather/AutoUpdateService.java: -------------------------------------------------------------------------------- 1 | package com.djzhao.smarttool.service.weather; 2 | 3 | import android.app.AlarmManager; 4 | import android.app.PendingIntent; 5 | import android.app.Service; 6 | import android.content.Intent; 7 | import android.content.SharedPreferences; 8 | import android.os.IBinder; 9 | import android.os.SystemClock; 10 | import android.preference.PreferenceManager; 11 | 12 | import com.djzhao.smarttool.gson.weather.Weather; 13 | import com.djzhao.smarttool.util.HttpUtil; 14 | import com.djzhao.smarttool.util.weather.Utility; 15 | 16 | import java.io.IOException; 17 | 18 | import okhttp3.Call; 19 | import okhttp3.Callback; 20 | import okhttp3.Response; 21 | 22 | import static com.djzhao.smarttool.util.Constants.HEFENG_KEY; 23 | 24 | public class AutoUpdateService extends Service { 25 | public AutoUpdateService() { 26 | } 27 | 28 | @Override 29 | public IBinder onBind(Intent intent) { 30 | return null; 31 | } 32 | 33 | @Override 34 | public int onStartCommand(Intent intent, int flags, int startId) { 35 | updateWeather(); 36 | updateBingDailyPic(); 37 | AlarmManager manager = (AlarmManager) getSystemService(ALARM_SERVICE); 38 | int anHour = 8 * 60 * 60 * 1000; // 8小时 39 | long triggerAtTime = (int) SystemClock.elapsedRealtime() + anHour; 40 | Intent i = new Intent(this, AutoUpdateService.class); 41 | PendingIntent pendingIntent = PendingIntent.getService(this, 0, i, 0); 42 | manager.cancel(pendingIntent); 43 | manager.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, triggerAtTime, pendingIntent); 44 | return super.onStartCommand(intent, flags, startId); 45 | } 46 | 47 | /** 48 | * 更新天气信息 49 | */ 50 | private void updateWeather() { 51 | SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this); 52 | String weatherString = preferences.getString("weather", null); 53 | if (weatherString != null) { 54 | Weather weather = Utility.handleWeatherResponse(weatherString); 55 | final String weatherId = weather.basic.weatherId; 56 | String weatherURL = "http://guolin.tech/api/weather?cityid=" + 57 | weatherId + "&key=" + HEFENG_KEY; 58 | HttpUtil.sendOkHttpRequest(weatherURL, new Callback() { 59 | @Override 60 | public void onResponse(Call call, Response response) throws IOException { 61 | String responseString = response.body().string(); 62 | Weather weather = Utility.handleWeatherResponse(responseString); 63 | if (weather != null && "ok".equals(weather.status)) { 64 | SharedPreferences.Editor editor = PreferenceManager.getDefaultSharedPreferences(AutoUpdateService.this).edit(); 65 | editor.putString("weather", responseString); 66 | editor.apply(); 67 | } 68 | } 69 | 70 | 71 | @Override 72 | public void onFailure(Call call, IOException e) { 73 | } 74 | }); 75 | } 76 | } 77 | 78 | /** 79 | * 后台自动更新每日一图 80 | */ 81 | private void updateBingDailyPic() { 82 | String requestBingDailyPicUrl = "http://guolin.tech/api/bing_pic"; 83 | HttpUtil.sendOkHttpRequest(requestBingDailyPicUrl, new Callback() { 84 | @Override 85 | public void onResponse(Call call, Response response) throws IOException { 86 | String responseString = response.body().string(); 87 | SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(AutoUpdateService.this); 88 | SharedPreferences.Editor editor = preferences.edit(); 89 | editor.putString("bing_daily_pic", responseString); 90 | editor.apply(); 91 | } 92 | 93 | @Override 94 | public void onFailure(Call call, IOException e) { 95 | } 96 | }); 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /app/src/main/java/com/djzhao/smarttool/util/AppManager.java: -------------------------------------------------------------------------------- 1 | package com.djzhao.smarttool.util; 2 | 3 | import android.app.Activity; 4 | import android.app.ActivityManager; 5 | import android.content.Context; 6 | 7 | import java.util.Iterator; 8 | import java.util.Stack; 9 | 10 | /** 11 | * Created by djzhao on 18/03/15. 12 | */ 13 | public class AppManager { 14 | private static Stack mActivityStack; 15 | private static AppManager mAppManager; 16 | 17 | public static AppManager getInstance() { 18 | if (mAppManager == null) 19 | mAppManager = new AppManager(); 20 | return mAppManager; 21 | } 22 | 23 | @SuppressWarnings("deprecation") 24 | public void AppExit(Context paramContext) { 25 | try { 26 | killAllActivity(); 27 | ((ActivityManager) paramContext.getSystemService(Activity.ACTIVITY_SERVICE)) 28 | .restartPackage(paramContext.getPackageName()); 29 | System.exit(0); 30 | return; 31 | } catch (Exception localException) { 32 | } 33 | } 34 | 35 | public void addActivity(Activity paramActivity) { 36 | if (mActivityStack == null) 37 | mActivityStack = new Stack(); 38 | mActivityStack.add(paramActivity); 39 | } 40 | 41 | public Activity getTopActivity() { 42 | return (Activity) mActivityStack.lastElement(); 43 | } 44 | 45 | public void killActivity(Activity paramActivity) { 46 | if (paramActivity != null) { 47 | mActivityStack.remove(paramActivity); 48 | paramActivity.finish(); 49 | } 50 | } 51 | 52 | public void killActivity(Class paramClass) { 53 | Iterator localIterator = mActivityStack.iterator(); 54 | while (true) { 55 | if (!localIterator.hasNext()) 56 | return; 57 | Activity localActivity = localIterator.next(); 58 | if (localActivity.getClass().equals(paramClass)) 59 | killActivity(localActivity); 60 | } 61 | } 62 | 63 | public void killAllActivity() { 64 | int i = 0; 65 | int j = mActivityStack.size(); 66 | while (true) { 67 | if (i >= j) { 68 | mActivityStack.clear(); 69 | return; 70 | } 71 | if (mActivityStack.get(i) != null) 72 | ((Activity) mActivityStack.get(i)).finish(); 73 | i++; 74 | } 75 | } 76 | 77 | public void killTopActivity() { 78 | killActivity((Activity) mActivityStack.lastElement()); 79 | } 80 | } -------------------------------------------------------------------------------- /app/src/main/java/com/djzhao/smarttool/util/ClipboardUtil.java: -------------------------------------------------------------------------------- 1 | package com.djzhao.smarttool.util; 2 | 3 | import android.content.ClipData; 4 | import android.content.ClipboardManager; 5 | import android.content.Context; 6 | 7 | import static org.litepal.LitePalApplication.getContext; 8 | 9 | /** 10 | * Created by djzhao on 18/05/02. 11 | */ 12 | public class ClipboardUtil { 13 | public static void copyToClipboard(String result) { 14 | ClipboardManager clipboardManager = (ClipboardManager) getContext().getSystemService(Context.CLIPBOARD_SERVICE); 15 | ClipData data = ClipData.newPlainText("result", result); 16 | clipboardManager.setPrimaryClip(data); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /app/src/main/java/com/djzhao/smarttool/util/Constants.java: -------------------------------------------------------------------------------- 1 | package com.djzhao.smarttool.util; 2 | 3 | /** 4 | * Created by djzhao on 18/04/30. 5 | */ 6 | public class Constants { 7 | 8 | public static final String EMAIL_ADDRESS = "djzhao627@gmail.com"; 9 | 10 | public static final String MY_HOMEPAGE_ADDRESS = "https://djzhao.js.org"; 11 | 12 | public static final String CONTACT_MY_QQ = "mqqwpa://im/chat?chat_type=wpa&uin=894559192"; 13 | 14 | public static final String HEFENG_KEY = "Your key here";// TODO 你申请的和风天气key 15 | 16 | } 17 | -------------------------------------------------------------------------------- /app/src/main/java/com/djzhao/smarttool/util/HttpUtil.java: -------------------------------------------------------------------------------- 1 | package com.djzhao.smarttool.util; 2 | 3 | import okhttp3.OkHttpClient; 4 | import okhttp3.Request; 5 | 6 | /** 7 | * Created by djzhao on 18/04/18. 8 | */ 9 | 10 | public class HttpUtil { 11 | 12 | public static void sendOkHttpRequest(String address, okhttp3.Callback callback) { 13 | OkHttpClient client = new OkHttpClient(); 14 | Request request = new Request.Builder().url(address).build(); 15 | client.newCall(request).enqueue(callback); 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /app/src/main/java/com/djzhao/smarttool/util/morsecode/ContrastList.java: -------------------------------------------------------------------------------- 1 | package com.djzhao.smarttool.util.morsecode; 2 | 3 | import java.util.HashMap; 4 | import java.util.Map; 5 | 6 | public class ContrastList { 7 | public static Map MORSE_CODE_MAP_LIST = new HashMap<>();// 摩尔斯编码表集合 8 | 9 | static { 10 | MORSE_CODE_MAP_LIST.put('A', ".-"); 11 | MORSE_CODE_MAP_LIST.put('B', "-..."); 12 | MORSE_CODE_MAP_LIST.put('C', "-.-."); 13 | MORSE_CODE_MAP_LIST.put('D', "-.."); 14 | MORSE_CODE_MAP_LIST.put('E', "."); 15 | MORSE_CODE_MAP_LIST.put('F', "..-."); 16 | MORSE_CODE_MAP_LIST.put('G', "--."); 17 | MORSE_CODE_MAP_LIST.put('H', "...."); 18 | MORSE_CODE_MAP_LIST.put('I', ".."); 19 | MORSE_CODE_MAP_LIST.put('J', ".---"); 20 | MORSE_CODE_MAP_LIST.put('K', "-.-"); 21 | MORSE_CODE_MAP_LIST.put('L', ".-.."); 22 | MORSE_CODE_MAP_LIST.put('M', "--"); 23 | MORSE_CODE_MAP_LIST.put('N', "-."); 24 | MORSE_CODE_MAP_LIST.put('O', "---"); 25 | MORSE_CODE_MAP_LIST.put('P', ".--."); 26 | MORSE_CODE_MAP_LIST.put('Q', "--.-"); 27 | MORSE_CODE_MAP_LIST.put('R', ".-."); 28 | MORSE_CODE_MAP_LIST.put('S', "..."); 29 | MORSE_CODE_MAP_LIST.put('T', "-"); 30 | MORSE_CODE_MAP_LIST.put('U', "..-"); 31 | MORSE_CODE_MAP_LIST.put('V', "...-"); 32 | MORSE_CODE_MAP_LIST.put('W', ".--"); 33 | MORSE_CODE_MAP_LIST.put('X', "-..-"); 34 | MORSE_CODE_MAP_LIST.put('Y', "-.--"); 35 | MORSE_CODE_MAP_LIST.put('Z', "--.."); 36 | 37 | /* 数字电码0-9 */ 38 | MORSE_CODE_MAP_LIST.put('0', "-----"); 39 | MORSE_CODE_MAP_LIST.put('1', ".----"); 40 | MORSE_CODE_MAP_LIST.put('2', "..---"); 41 | MORSE_CODE_MAP_LIST.put('3', "...--"); 42 | MORSE_CODE_MAP_LIST.put('4', "....-"); 43 | MORSE_CODE_MAP_LIST.put('5', "....."); 44 | MORSE_CODE_MAP_LIST.put('6', "-...."); 45 | MORSE_CODE_MAP_LIST.put('7', "--..."); 46 | MORSE_CODE_MAP_LIST.put('8', "---.."); 47 | MORSE_CODE_MAP_LIST.put('9', "----."); 48 | 49 | /* 标点符号,可自增删 */ 50 | MORSE_CODE_MAP_LIST.put(',', "--..--"); // ,逗号 51 | MORSE_CODE_MAP_LIST.put('.', ".-.-.-"); // .句号 52 | MORSE_CODE_MAP_LIST.put('?', "..--.."); // ?问号 53 | MORSE_CODE_MAP_LIST.put('!', "-.-.--"); // !感叹号 54 | MORSE_CODE_MAP_LIST.put('\'', ".----.");// '单引号 55 | MORSE_CODE_MAP_LIST.put('\"', ".-..-.");// "引号 56 | MORSE_CODE_MAP_LIST.put('=', "-...-"); // =等号 57 | MORSE_CODE_MAP_LIST.put(':', "---..."); // :冒号 58 | MORSE_CODE_MAP_LIST.put(';', "-.-.-."); // ;分号 59 | MORSE_CODE_MAP_LIST.put('(', "-.--."); // (前括号 60 | MORSE_CODE_MAP_LIST.put(')', "-.--.-"); // )后括号 61 | MORSE_CODE_MAP_LIST.put(' ', "●"); // 留空格,这里的"●"是自定义的 62 | } 63 | 64 | } -------------------------------------------------------------------------------- /app/src/main/java/com/djzhao/smarttool/util/torch/TorchUtils.java: -------------------------------------------------------------------------------- 1 | package com.djzhao.smarttool.util.torch; 2 | 3 | import android.content.Context; 4 | import android.hardware.Camera; 5 | import android.hardware.camera2.CameraCharacteristics; 6 | import android.hardware.camera2.CameraManager; 7 | import android.os.Build; 8 | import android.util.Log; 9 | 10 | public class TorchUtils { 11 | public static boolean IS_TORCH_ON = false; 12 | private static CameraManager manager; 13 | private static Camera camera; 14 | 15 | public static void openFlash(Context context, boolean isFront) { 16 | try { 17 | if (Build.VERSION.SDK_INT > Build.VERSION_CODES.M) { 18 | // if (Build.VERSION.SDK_INT > 30) { 19 | manager = (CameraManager) context.getSystemService(Context.CAMERA_SERVICE); 20 | if (manager != null) { 21 | if (isFront) { 22 | manager.setTorchMode("1", true); 23 | } else { 24 | manager.setTorchMode("0", true); 25 | } 26 | } 27 | } else { 28 | if (isFront) { 29 | camera = Camera.open(1); 30 | } else { 31 | camera = Camera.open(); 32 | } 33 | camera.startPreview(); 34 | Camera.Parameters parameters = camera.getParameters(); 35 | parameters.setFlashMode(Camera.Parameters.FLASH_MODE_ON); 36 | camera.setParameters(parameters); 37 | } 38 | } catch (Exception e) { 39 | e.printStackTrace(); 40 | } 41 | } 42 | 43 | public static void closeFlash(boolean isFront) { 44 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { 45 | // if (Build.VERSION.SDK_INT >= 30) { 46 | try { 47 | if (manager == null) { 48 | return; 49 | } 50 | if (isFront) { 51 | manager.setTorchMode("1", false); 52 | } else { 53 | manager.setTorchMode("0", false); 54 | } 55 | } catch (Exception e) { 56 | e.printStackTrace(); 57 | } 58 | } else { 59 | if (camera == null) { 60 | return; 61 | } 62 | camera.getParameters().setFlashMode(Camera.Parameters.FLASH_MODE_OFF); 63 | camera.setParameters(camera.getParameters()); 64 | camera.stopPreview(); 65 | camera.setPreviewCallback(null); 66 | camera.release(); 67 | camera = null; 68 | } 69 | } 70 | 71 | public static int frontFlashLightId() { 72 | Camera.CameraInfo cameraInfo = new Camera.CameraInfo(); 73 | for (int i = 0; i < Camera.getNumberOfCameras(); i++) { 74 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { 75 | try { 76 | String[] ids = manager.getCameraIdList(); 77 | if (ids.length > 1) { 78 | String id = ids[1]; 79 | CameraCharacteristics chars = manager.getCameraCharacteristics(id); 80 | boolean isFlashAvailable = chars.get(CameraCharacteristics.FLASH_INFO_AVAILABLE); 81 | if (isFlashAvailable) { 82 | return 1; 83 | } 84 | } 85 | } catch (Exception e) { 86 | Log.e("dj", e.getMessage()); 87 | } 88 | } else { 89 | Camera.getCameraInfo(i, cameraInfo); 90 | if (cameraInfo.facing == Camera.CameraInfo.CAMERA_FACING_FRONT) { 91 | return i; 92 | } 93 | } 94 | } 95 | return -1; 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /app/src/main/java/com/djzhao/smarttool/util/weather/Utility.java: -------------------------------------------------------------------------------- 1 | package com.djzhao.smarttool.util.weather; 2 | 3 | import android.text.TextUtils; 4 | 5 | import com.djzhao.smarttool.db.weather.City; 6 | import com.djzhao.smarttool.db.weather.County; 7 | import com.djzhao.smarttool.db.weather.Province; 8 | import com.djzhao.smarttool.gson.weather.Weather; 9 | import com.google.gson.Gson; 10 | 11 | import org.json.JSONArray; 12 | import org.json.JSONException; 13 | import org.json.JSONObject; 14 | 15 | /** 16 | * Created by djzhao on 18/04/18. 17 | */ 18 | 19 | public class Utility { 20 | 21 | /** 22 | * 解析和处理服务器返回的省级数据。 23 | */ 24 | public static boolean handleProvinceResponse(String response) { 25 | if (!TextUtils.isEmpty(response)) { 26 | try { 27 | JSONArray jsonArray = new JSONArray(response); 28 | for (int i = 0; i < jsonArray.length(); i++) { 29 | JSONObject jsonObject = jsonArray.getJSONObject(i); 30 | Province province = new Province(); 31 | province.setProvinceName(jsonObject.getString("name")); 32 | province.setProvinceCode(jsonObject.getInt("id")); 33 | province.save(); 34 | } 35 | return true; 36 | } catch (JSONException e) { 37 | e.printStackTrace(); 38 | } 39 | } 40 | return false; 41 | } 42 | 43 | /** 44 | * 解析和处理服务器返回的市级数据。 45 | */ 46 | public static boolean handleCityResponse(String response, int provinceId) { 47 | if (!TextUtils.isEmpty(response)) { 48 | try { 49 | JSONArray jsonArray = new JSONArray(response); 50 | for (int i = 0; i < jsonArray.length(); i++) { 51 | JSONObject jsonObject = jsonArray.getJSONObject(i); 52 | City city = new City(); 53 | city.setCityName(jsonObject.getString("name")); 54 | city.setCityCode(jsonObject.getInt("id")); 55 | city.setProvinceId(provinceId); 56 | city.save(); 57 | } 58 | return true; 59 | } catch (JSONException e) { 60 | e.printStackTrace(); 61 | } 62 | } 63 | return false; 64 | } 65 | 66 | /** 67 | * 解析和处理服务器返回的县级数据。 68 | */ 69 | public static boolean handleCountyResponse(String response, int cityId) { 70 | if (!TextUtils.isEmpty(response)) { 71 | try { 72 | JSONArray jsonArray = new JSONArray(response); 73 | for (int i = 0; i < jsonArray.length(); i++) { 74 | JSONObject jsonObject = jsonArray.getJSONObject(i); 75 | County county = new County(); 76 | county.setCountyName(jsonObject.getString("name")); 77 | county.setWeatherId(jsonObject.getString("weather_id")); 78 | county.setCityId(cityId); 79 | county.save(); 80 | } 81 | return true; 82 | } catch (JSONException e) { 83 | e.printStackTrace(); 84 | } 85 | } 86 | return false; 87 | } 88 | 89 | /** 90 | * 将返回的JSON数据解析成Weather实体类 91 | * 92 | * @param response Json数据 93 | * @return Weather实体类 94 | */ 95 | public static Weather handleWeatherResponse(String response) { 96 | try { 97 | JSONObject jsonObject = new JSONObject(response); 98 | JSONArray jsonArray = jsonObject.getJSONArray("HeWeather"); 99 | String weatherContent = jsonArray.getJSONObject(0).toString(); 100 | return new Gson().fromJson(weatherContent, Weather.class); 101 | } catch (JSONException e) { 102 | e.printStackTrace(); 103 | } 104 | return null; 105 | } 106 | 107 | } 108 | -------------------------------------------------------------------------------- /app/src/main/java/com/djzhao/smarttool/view/ruler/RulerView.java: -------------------------------------------------------------------------------- 1 | package com.djzhao.smarttool.view.ruler; 2 | 3 | import android.content.Context; 4 | import android.graphics.Canvas; 5 | import android.graphics.Color; 6 | import android.graphics.Paint; 7 | import android.util.AttributeSet; 8 | import android.view.View; 9 | 10 | /** 11 | * 自定义尺子控件。 12 | * Created by djzhao on 18/05/02. 13 | */ 14 | public class RulerView extends View { 15 | 16 | private int mmx; 17 | private int mmy; 18 | private int pxheight; 19 | private int pxWidth; 20 | private int lineLength = 15; 21 | private Paint mPaint; 22 | 23 | public RulerView(Context context) { 24 | this(context, null); 25 | } 26 | 27 | public RulerView(Context context, AttributeSet attrs) { 28 | super(context, attrs); 29 | mmx = 1; 30 | mmy = 1; 31 | pxheight = 1; 32 | pxWidth = 1; 33 | mPaint = new Paint(); 34 | mPaint.setColor(Color.BLACK); 35 | mPaint.setStyle(Paint.Style.FILL); 36 | mPaint.setStrokeWidth(1); 37 | mPaint.setAntiAlias(true); 38 | } 39 | 40 | @Override 41 | protected void onSizeChanged(int w, int h, int oldw, int oldh) { 42 | super.onSizeChanged(w, h, oldw, oldh); 43 | pxheight = h; 44 | pxWidth = w; 45 | 46 | } 47 | 48 | public RulerView setSize(int x, int y) { 49 | mmx = x; 50 | mmy = y; 51 | return this; 52 | } 53 | 54 | public RulerView setTextSize(float size_px) { 55 | mPaint.setTextSize(size_px); 56 | return this; 57 | } 58 | 59 | public RulerView setLineLength(int length) { 60 | lineLength = length; 61 | return this; 62 | } 63 | 64 | public void build() { 65 | invalidate(); 66 | } 67 | 68 | @Override 69 | protected void onDraw(Canvas canvas) { 70 | super.onDraw(canvas); 71 | drawRuler(canvas); 72 | } 73 | 74 | private void drawRuler(Canvas canvas) { 75 | 76 | for (int i = 0; i < mmy; i++) { 77 | float lengthNow = i * pxheight / mmy; 78 | if (lengthNow < lineLength) { 79 | canvas.drawLine(0, lengthNow, lengthNow, lengthNow, mPaint); 80 | canvas.drawLine(lengthNow, 0, lengthNow, lengthNow, mPaint); 81 | } else { 82 | drawVertical(canvas, i); 83 | drawHorizontal(canvas, i); 84 | } 85 | 86 | } 87 | 88 | } 89 | 90 | private void drawVertical(Canvas canvas, int i) { 91 | int length = lineLength; 92 | if (i % 5 == 0) { 93 | length = lineLength * 15 / 10; 94 | if (i % 10 == 0) { 95 | length = lineLength * 2; 96 | canvas.drawText("" + i / 10, length + lineLength, i * pxheight / mmy + (lineLength / 2), mPaint); 97 | } 98 | } 99 | canvas.drawLine(0, i * pxheight / mmy, length, i * pxheight / mmy, mPaint); 100 | } 101 | 102 | private void drawHorizontal(Canvas canvas, int i) { 103 | 104 | int length = lineLength; 105 | if (i % 5 == 0) { 106 | length = lineLength * 15 / 10; 107 | if (i % 10 == 0) { 108 | length = lineLength * 2; 109 | canvas.drawText("" + i / 10, i * pxWidth / mmx - 3, length + (lineLength * 15 / 10), mPaint); 110 | } 111 | } 112 | canvas.drawLine(i * pxWidth / mmx, 0, i * pxWidth / mmx, length, mPaint); 113 | } 114 | } 115 | -------------------------------------------------------------------------------- /app/src/main/res/anim/anim_down_up_show.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 13 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 12 | 13 | 19 | 22 | 25 | 26 | 27 | 28 | 34 | 35 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/button_off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djzhao627/SmartTool/11c3c44661edf56c7145e730929fb35f74767cd8/app/src/main/res/drawable-xhdpi/button_off.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/button_on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djzhao627/SmartTool/11c3c44661edf56c7145e730929fb35f74767cd8/app/src/main/res/drawable-xhdpi/button_on.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/checkbox_style.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/checked.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djzhao627/SmartTool/11c3c44661edf56c7145e730929fb35f74767cd8/app/src/main/res/drawable-xhdpi/checked.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/dashboard_bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djzhao627/SmartTool/11c3c44661edf56c7145e730929fb35f74767cd8/app/src/main/res/drawable-xhdpi/dashboard_bg.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/dashboard_binary.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djzhao627/SmartTool/11c3c44661edf56c7145e730929fb35f74767cd8/app/src/main/res/drawable-xhdpi/dashboard_binary.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/dashboard_choose.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djzhao627/SmartTool/11c3c44661edf56c7145e730929fb35f74767cd8/app/src/main/res/drawable-xhdpi/dashboard_choose.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/dashboard_github.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djzhao627/SmartTool/11c3c44661edf56c7145e730929fb35f74767cd8/app/src/main/res/drawable-xhdpi/dashboard_github.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/dashboard_html.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djzhao627/SmartTool/11c3c44661edf56c7145e730929fb35f74767cd8/app/src/main/res/drawable-xhdpi/dashboard_html.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/dashboard_hyperlink.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djzhao627/SmartTool/11c3c44661edf56c7145e730929fb35f74767cd8/app/src/main/res/drawable-xhdpi/dashboard_hyperlink.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/dashboard_mecard_qrcode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djzhao627/SmartTool/11c3c44661edf56c7145e730929fb35f74767cd8/app/src/main/res/drawable-xhdpi/dashboard_mecard_qrcode.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/dashboard_morse_code.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djzhao627/SmartTool/11c3c44661edf56c7145e730929fb35f74767cd8/app/src/main/res/drawable-xhdpi/dashboard_morse_code.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/dashboard_nav_about.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djzhao627/SmartTool/11c3c44661edf56c7145e730929fb35f74767cd8/app/src/main/res/drawable-xhdpi/dashboard_nav_about.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/dashboard_nav_exit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djzhao627/SmartTool/11c3c44661edf56c7145e730929fb35f74767cd8/app/src/main/res/drawable-xhdpi/dashboard_nav_exit.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/dashboard_qrcode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djzhao627/SmartTool/11c3c44661edf56c7145e730929fb35f74767cd8/app/src/main/res/drawable-xhdpi/dashboard_qrcode.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/dashboard_random.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djzhao627/SmartTool/11c3c44661edf56c7145e730929fb35f74767cd8/app/src/main/res/drawable-xhdpi/dashboard_random.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/dashboard_ruler.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djzhao627/SmartTool/11c3c44661edf56c7145e730929fb35f74767cd8/app/src/main/res/drawable-xhdpi/dashboard_ruler.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/dashboard_tanscoding.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djzhao627/SmartTool/11c3c44661edf56c7145e730929fb35f74767cd8/app/src/main/res/drawable-xhdpi/dashboard_tanscoding.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/dashboard_torch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djzhao627/SmartTool/11c3c44661edf56c7145e730929fb35f74767cd8/app/src/main/res/drawable-xhdpi/dashboard_torch.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/dashboard_visit_card.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djzhao627/SmartTool/11c3c44661edf56c7145e730929fb35f74767cd8/app/src/main/res/drawable-xhdpi/dashboard_visit_card.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/dashboard_weather.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djzhao627/SmartTool/11c3c44661edf56c7145e730929fb35f74767cd8/app/src/main/res/drawable-xhdpi/dashboard_weather.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/djzhao_header.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djzhao627/SmartTool/11c3c44661edf56c7145e730929fb35f74767cd8/app/src/main/res/drawable-xhdpi/djzhao_header.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/flashlight_dialog_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djzhao627/SmartTool/11c3c44661edf56c7145e730929fb35f74767cd8/app/src/main/res/drawable-xhdpi/ic_back.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_clear.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djzhao627/SmartTool/11c3c44661edf56c7145e730929fb35f74767cd8/app/src/main/res/drawable-xhdpi/ic_clear.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_copy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djzhao627/SmartTool/11c3c44661edf56c7145e730929fb35f74767cd8/app/src/main/res/drawable-xhdpi/ic_copy.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_diy_textarea.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djzhao627/SmartTool/11c3c44661edf56c7145e730929fb35f74767cd8/app/src/main/res/drawable-xhdpi/ic_diy_textarea.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_done.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djzhao627/SmartTool/11c3c44661edf56c7145e730929fb35f74767cd8/app/src/main/res/drawable-xhdpi/ic_done.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djzhao627/SmartTool/11c3c44661edf56c7145e730929fb35f74767cd8/app/src/main/res/drawable-xhdpi/ic_home.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_mail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djzhao627/SmartTool/11c3c44661edf56c7145e730929fb35f74767cd8/app/src/main/res/drawable-xhdpi/ic_mail.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_message.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djzhao627/SmartTool/11c3c44661edf56c7145e730929fb35f74767cd8/app/src/main/res/drawable-xhdpi/ic_message.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_random.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djzhao627/SmartTool/11c3c44661edf56c7145e730929fb35f74767cd8/app/src/main/res/drawable-xhdpi/ic_random.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_visiting_card.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djzhao627/SmartTool/11c3c44661edf56c7145e730929fb35f74767cd8/app/src/main/res/drawable-xhdpi/ic_visiting_card.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djzhao627/SmartTool/11c3c44661edf56c7145e730929fb35f74767cd8/app/src/main/res/drawable-xhdpi/ic_web.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djzhao627/SmartTool/11c3c44661edf56c7145e730929fb35f74767cd8/app/src/main/res/drawable-xhdpi/logo.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/torch_widget.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djzhao627/SmartTool/11c3c44661edf56c7145e730929fb35f74767cd8/app/src/main/res/drawable-xhdpi/torch_widget.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/unchecked.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djzhao627/SmartTool/11c3c44661edf56c7145e730929fb35f74767cd8/app/src/main/res/drawable-xhdpi/unchecked.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/unread.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djzhao627/SmartTool/11c3c44661edf56c7145e730929fb35f74767cd8/app/src/main/res/drawable/unread.png -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_dashboard.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 12 | 13 | 17 | 18 | 24 | 25 | 31 | 32 | 45 | 46 | 57 | 58 | 59 | 64 | 65 | 71 | 72 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 104 | 105 | 106 | 107 | 108 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_splash.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 11 | 12 | 16 | 17 | 25 | 26 | 32 | 33 | 38 | 39 | 44 | 45 | 51 | 52 | 58 | 59 | 60 | 61 | 62 | 63 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /app/src/main/res/layout/choose_problem_activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | 12 | 18 | 19 | 25 | 26 | 32 | 33 | 38 | 39 | 45 | 46 | 54 | 55 |