├── .gitignore
├── .idea
├── .name
├── compiler.xml
├── copyright
│ └── profiles_settings.xml
├── encodings.xml
├── gradle.xml
├── inspectionProfiles
│ ├── Project_Default.xml
│ └── profiles_settings.xml
├── misc.xml
├── modules.xml
├── runConfigurations.xml
└── vcs.xml
├── Clean.iml
├── README.md
├── app
├── .gitignore
├── app.iml
├── build.gradle
├── libs
│ └── eventbus.jar
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── zx
│ │ └── clean
│ │ └── ApplicationTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── aidl
│ │ └── android
│ │ │ └── content
│ │ │ └── pm
│ │ │ ├── IPackageDataObserver.aidl
│ │ │ ├── IPackageStatsObserver.aidl
│ │ │ └── PackageStats.aidl
│ ├── java
│ │ └── com
│ │ │ └── zx
│ │ │ └── clean
│ │ │ ├── MyApplication.java
│ │ │ ├── activity
│ │ │ ├── AboutActivity.java
│ │ │ ├── AppManagerActivity.java
│ │ │ ├── BaseActivity.java
│ │ │ ├── ChangThemeActivity.java
│ │ │ ├── CleanCompletedActivity.java
│ │ │ ├── LoginActivity.java
│ │ │ ├── MainActivity.java
│ │ │ ├── MemoryCleanActivity.java
│ │ │ ├── RubbishCleanActivity.java
│ │ │ └── SplashActivity.java
│ │ │ ├── adapter
│ │ │ ├── AppManagerItemAdapter.java
│ │ │ ├── MemoryInfoPagerAdapter.java
│ │ │ ├── MemoryItemAdapter.java
│ │ │ ├── RubbishItemAdapter.java
│ │ │ ├── ThemeRecycleViewAdapter.java
│ │ │ └── ViewPagerAdapter.java
│ │ │ ├── bean
│ │ │ ├── AppInfo.java
│ │ │ ├── AppProcessInfo.java
│ │ │ ├── ItemTheme.java
│ │ │ ├── RubbishItemBean.java
│ │ │ └── SDCardInfo.java
│ │ │ ├── fragment
│ │ │ └── AppManagerFragment.java
│ │ │ ├── service
│ │ │ ├── CleanerService.java
│ │ │ └── CoreService.java
│ │ │ ├── utils
│ │ │ ├── AppUtil.java
│ │ │ ├── DrawerNavigationItemListener.java
│ │ │ ├── MyActivityManager.java
│ │ │ ├── PreferenceManager.java
│ │ │ ├── StorageUtil.java
│ │ │ ├── Theme.java
│ │ │ ├── ThemeSet.java
│ │ │ └── Utils.java
│ │ │ └── views
│ │ │ ├── ArcProgress.java
│ │ │ ├── ItemCardView.java
│ │ │ ├── ItemCardViewMini.java
│ │ │ └── MemoryInfoView.java
│ └── res
│ │ ├── drawable-v21
│ │ ├── selector_text_ripple.xml
│ │ └── selector_toolbar_right_corner_ripple.xml
│ │ ├── drawable-xhdpi
│ │ ├── bdcx.png
│ │ ├── bg_qq.png
│ │ ├── bg_wechat.png
│ │ ├── bg_weibo.png
│ │ ├── card_icon_autorun.png
│ │ ├── card_icon_media.png
│ │ ├── card_icon_speedup.png
│ │ ├── card_icon_trash.png
│ │ ├── default_avator.png
│ │ ├── ic_lock.png
│ │ ├── ic_login_user.png
│ │ ├── list_icn_slt.png
│ │ ├── login_bg.jpg
│ │ ├── radio_checkbox.png
│ │ ├── small_icon.png
│ │ └── tp.png
│ │ ├── drawable-xxhdpi
│ │ ├── S51208-114446.jpg
│ │ ├── S51208-114510.jpg
│ │ ├── S51208-114521.jpg
│ │ ├── S51208-114535.jpg
│ │ ├── ce.png
│ │ ├── entrance2.png
│ │ ├── entrance3.png
│ │ ├── ng.png
│ │ ├── s51208114446.jpg
│ │ ├── s51208114510.jpg
│ │ ├── s51208114521.jpg
│ │ └── s51208114535.jpg
│ │ ├── drawable
│ │ ├── button_bg.xml
│ │ ├── circle.xml
│ │ ├── clean_already_circle.xml
│ │ ├── ic_account_circle_24dp.xml
│ │ ├── ic_arrow_back_24dp.xml
│ │ ├── ic_battery_60_24dp.xml
│ │ ├── ic_check_24dp.xml
│ │ ├── ic_home_24dp.xml
│ │ ├── ic_menu_24dp.xml
│ │ ├── ic_perm_contact_cal_24dp.xml
│ │ ├── ic_security_24dp.xml
│ │ ├── ic_settings_applications_24dp.xml
│ │ ├── ic_signal_cellular_1_bar_24dp.xml
│ │ ├── ic_signal_wifi_3_bar_24dp.xml
│ │ ├── ic_verified_user_24dp.xml
│ │ ├── ic_wallet_travel_24dp.xml
│ │ ├── selector_text_ripple.xml
│ │ ├── selector_toolbar_right_corner_ripple.xml
│ │ └── side_nav_bar.xml
│ │ ├── layout
│ │ ├── activity_about.xml
│ │ ├── activity_app_manager.xml
│ │ ├── activity_app_manager_pre.xml
│ │ ├── activity_chang_theme.xml
│ │ ├── activity_clean_completed.xml
│ │ ├── activity_login.xml
│ │ ├── activity_main.xml
│ │ ├── activity_memory_clean.xml
│ │ ├── activity_memory_clean_pre.xml
│ │ ├── activity_rubbish_clean.xml
│ │ ├── activity_rubbish_clean_pre.xml
│ │ ├── activity_splash.xml
│ │ ├── app_bar_main.xml
│ │ ├── card_item.xml
│ │ ├── card_item_mini.xml
│ │ ├── content_main.xml
│ │ ├── content_main_mini.xml
│ │ ├── content_rubbish_clean.xml
│ │ ├── fragment_app_manager.xml
│ │ ├── fragment_rv_item.xml
│ │ ├── item_theme.xml
│ │ ├── memory_item.xml
│ │ ├── nav_header_main.xml
│ │ └── view_memory_info.xml
│ │ ├── menu
│ │ ├── activity_main_drawer.xml
│ │ ├── main.xml
│ │ └── menu_rubbish_clean.xml
│ │ ├── mipmap-hdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-mdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xhdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xxhdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xxxhdpi
│ │ └── ic_launcher.png
│ │ ├── values-v21
│ │ └── styles.xml
│ │ ├── values-w820dp
│ │ └── dimens.xml
│ │ └── values
│ │ ├── attrs.xml
│ │ ├── colors.xml
│ │ ├── dimens.xml
│ │ ├── strings.xml
│ │ ├── styles.xml
│ │ └── themes.xml
│ └── test
│ └── java
│ └── com
│ └── zx
│ └── clean
│ └── ExampleUnitTest.java
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── library
├── .gitignore
├── build.gradle
├── gradle.properties
├── library.iml
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── github
│ │ └── OrangeGangsters
│ │ └── circularbarpager
│ │ └── library
│ │ └── ApplicationTest.java
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── com
│ │ └── github
│ │ └── OrangeGangsters
│ │ └── circularbarpager
│ │ └── library
│ │ ├── CircularBar.java
│ │ ├── CircularBarPager.java
│ │ └── viewpager
│ │ ├── FadeViewPagerTransformer.java
│ │ └── WrapContentViewPager.java
│ └── res
│ ├── layout
│ └── circularbar_view_pager.xml
│ └── values
│ ├── attrs.xml
│ ├── strings.xml
│ └── styles.xml
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | .gradle
2 | /local.properties
3 | /.idea/workspace.xml
4 | /.idea/libraries
5 | .DS_Store
6 | /build
7 | /captures
8 |
--------------------------------------------------------------------------------
/.idea/.name:
--------------------------------------------------------------------------------
1 | Clean
--------------------------------------------------------------------------------
/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/.idea/copyright/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
18 |
19 |
--------------------------------------------------------------------------------
/.idea/inspectionProfiles/Project_Default.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/.idea/inspectionProfiles/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 | 1.7
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Clean.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Clean
2 | 手机安全中心
3 | 包含内存加速,垃圾清理,应用管理,权限管理,病毒查杀,同时嵌入主题换肤等功能,目前功能还不够完善,后续会一一添加!
4 |
5 |
6 |
7 |
8 | 
9 | 
10 |
11 |
12 |
13 | 
14 | 
15 |
16 |
17 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 23
5 | buildToolsVersion "23.0.2"
6 |
7 | defaultConfig {
8 | applicationId "com.zx.clean"
9 | minSdkVersion 14
10 | targetSdkVersion 23
11 | versionCode 1
12 | versionName "1.0"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | dependencies {
23 | compile fileTree(dir: 'libs', include: ['*.jar'])
24 | testCompile 'junit:junit:4.12'
25 | compile 'com.android.support:appcompat-v7:23.1.1'
26 | compile 'com.android.support:design:23.1.1'
27 | compile 'com.android.support:support-v13:23.+'
28 | compile 'com.android.support:support-v4:23.+'
29 | compile 'com.android.support:palette-v7:+'
30 | compile 'com.android.support:recyclerview-v7:+'
31 | compile 'com.android.support:cardview-v7:23.0.+'
32 | compile 'com.squareup.picasso:picasso:2.5.0'
33 | compile 'com.jakewharton:butterknife:5.1.2'
34 | compile 'com.zhy:percent-support-extends:1.0.5'
35 | compile 'com.balysv:material-ripple:1.0.2'
36 | compile files('libs/eventbus.jar')
37 | compile project(':library')
38 | }
39 |
--------------------------------------------------------------------------------
/app/libs/eventbus.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xunzzz/Clean/58d872c151a702439ee347710e746e40ee213e80/app/libs/eventbus.jar
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in D:\Android\programFiles\sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/zx/clean/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package com.zx.clean;
2 |
3 | import android.app.Application;
4 | import android.test.ApplicationTestCase;
5 |
6 | /**
7 | * Testing Fundamentals
8 | */
9 | public class ApplicationTest extends ApplicationTestCase {
10 | public ApplicationTest() {
11 | super(Application.class);
12 | }
13 | }
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
34 |
38 |
39 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
55 |
56 |
60 |
61 |
62 |
66 |
67 |
68 |
71 |
72 |
73 |
77 |
78 |
79 |
83 |
84 |
85 |
86 |
89 |
90 |
91 |
92 |
93 |
--------------------------------------------------------------------------------
/app/src/main/aidl/android/content/pm/IPackageDataObserver.aidl:
--------------------------------------------------------------------------------
1 | /*
2 | **
3 | ** Copyright 2007, The Android Open Source Project
4 | **
5 | ** Licensed under the Apache License, Version 2.0 (the "License");
6 | ** you may not use this file except in compliance with the License.
7 | ** You may obtain a copy of the License at
8 | **
9 | ** http://www.apache.org/licenses/LICENSE-2.0
10 | **
11 | ** Unless required by applicable law or agreed to in writing, software
12 | ** distributed under the License is distributed on an "AS IS" BASIS,
13 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | ** See the License for the specific language governing permissions and
15 | ** limitations under the License.
16 | */
17 |
18 | package android.content.pm;
19 |
20 | /**
21 | * API for package data change related callbacks from the Package Manager.
22 | * Some usage scenarios include deletion of cache directory, generate
23 | * statistics related to code, data, cache usage(TODO)
24 | * {@hide}
25 | */
26 | oneway interface IPackageDataObserver {
27 | void onRemoveCompleted(in String packageName, boolean succeeded);
28 | }
--------------------------------------------------------------------------------
/app/src/main/aidl/android/content/pm/IPackageStatsObserver.aidl:
--------------------------------------------------------------------------------
1 | /*
2 | **
3 | ** Copyright 2007, The Android Open Source Project
4 | **
5 | ** Licensed under the Apache License, Version 2.0 (the "License");
6 | ** you may not use this file except in compliance with the License.
7 | ** You may obtain a copy of the License at
8 | **
9 | ** http://www.apache.org/licenses/LICENSE-2.0
10 | **
11 | ** Unless required by applicable law or agreed to in writing, software
12 | ** distributed under the License is distributed on an "AS IS" BASIS,
13 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | ** See the License for the specific language governing permissions and
15 | ** limitations under the License.
16 | */
17 |
18 | package android.content.pm;
19 |
20 | import android.content.pm.PackageStats;
21 | /**
22 | * API for package data change related callbacks from the Package Manager.
23 | * Some usage scenarios include deletion of cache directory, generate
24 | * statistics related to code, data, cache usage(TODO)
25 | * {@hide}
26 | */
27 | oneway interface IPackageStatsObserver {
28 |
29 | void onGetStatsCompleted(in PackageStats pStats, boolean succeeded);
30 | }
31 |
--------------------------------------------------------------------------------
/app/src/main/aidl/android/content/pm/PackageStats.aidl:
--------------------------------------------------------------------------------
1 | /* //device/java/android/android/view/WindowManager.aidl
2 | **
3 | ** Copyright 2007, The Android Open Source Project
4 | **
5 | ** Licensed under the Apache License, Version 2.0 (the "License");
6 | ** you may not use this file except in compliance with the License.
7 | ** You may obtain a copy of the License at
8 | **
9 | ** http://www.apache.org/licenses/LICENSE-2.0
10 | **
11 | ** Unless required by applicable law or agreed to in writing, software
12 | ** distributed under the License is distributed on an "AS IS" BASIS,
13 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | ** See the License for the specific language governing permissions and
15 | ** limitations under the License.
16 | */
17 |
18 | package android.content.pm;
19 |
20 | parcelable PackageStats;
21 |
--------------------------------------------------------------------------------
/app/src/main/java/com/zx/clean/MyApplication.java:
--------------------------------------------------------------------------------
1 | package com.zx.clean;
2 |
3 | import android.app.Application;
4 |
5 | /**
6 | * Created by zhangxun on 2015/11/19.
7 | */
8 | public class MyApplication extends Application{
9 |
10 | }
11 |
--------------------------------------------------------------------------------
/app/src/main/java/com/zx/clean/activity/AboutActivity.java:
--------------------------------------------------------------------------------
1 | package com.zx.clean.activity;
2 |
3 | import android.os.Bundle;
4 | import android.support.v7.app.AppCompatActivity;
5 | import android.support.v7.widget.RecyclerView;
6 |
7 | import com.zx.clean.R;
8 |
9 | public class AboutActivity extends AppCompatActivity {
10 |
11 | private RecyclerView Nm;
12 | private RecyclerView m1;
13 |
14 | private String a;
15 |
16 | @Override
17 | protected void onCreate(Bundle savedInstanceState) {
18 | super.onCreate(savedInstanceState);
19 | setContentView(R.layout.activity_about);
20 |
21 |
22 |
23 | initView(a);
24 | initView2();
25 |
26 |
27 | }
28 |
29 |
30 |
31 | private void initView2() {
32 |
33 |
34 | }
35 |
36 | private void initView(String aaa) {
37 |
38 | initView2();
39 | initView2();
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/app/src/main/java/com/zx/clean/activity/AppManagerActivity.java:
--------------------------------------------------------------------------------
1 | package com.zx.clean.activity;
2 |
3 | import android.os.Bundle;
4 | import android.support.design.widget.TabLayout;
5 | import android.support.v4.view.ViewPager;
6 | import android.support.v7.widget.Toolbar;
7 |
8 | import com.zx.clean.R;
9 | import com.zx.clean.adapter.ViewPagerAdapter;
10 | import com.zx.clean.bean.AppInfo;
11 | import com.zx.clean.fragment.AppManagerFragment;
12 | import com.zx.clean.utils.ThemeSet;
13 |
14 | import java.util.ArrayList;
15 |
16 | import butterknife.InjectView;
17 | import butterknife.OnClick;
18 |
19 | public class AppManagerActivity extends BaseActivity {
20 |
21 | @InjectView(R.id.toolbar)
22 | Toolbar toolbar;
23 | @InjectView(R.id.tabLayout)
24 | TabLayout tabLayout;
25 | @InjectView(R.id.viewpager)
26 | ViewPager viewpager;
27 |
28 | private ViewPagerAdapter mAdapter;
29 |
30 | @Override
31 | protected void onCreate(Bundle savedInstanceState) {
32 | ThemeSet.onPreCreate(this);
33 | super.onCreate(savedInstanceState);
34 | setContentView(R.layout.activity_app_manager);
35 | setupViewPager();
36 |
37 | }
38 |
39 | private void setupViewPager() {
40 | mAdapter = new ViewPagerAdapter(getSupportFragmentManager());
41 | mAdapter.addFragment(new AppManagerFragment(AppManagerActivity.this, 0), "用户应用");
42 | mAdapter.addFragment(new AppManagerFragment(AppManagerActivity.this, 1), "系统应用");
43 | viewpager.setAdapter(mAdapter);
44 | tabLayout.setupWithViewPager(viewpager);
45 | }
46 |
47 | @OnClick(R.id.back)
48 | public void onBack(){
49 | finish();
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/app/src/main/java/com/zx/clean/activity/BaseActivity.java:
--------------------------------------------------------------------------------
1 | package com.zx.clean.activity;
2 |
3 | import android.support.v7.app.AppCompatActivity;
4 |
5 | import com.zx.clean.utils.MyActivityManager;
6 |
7 | import butterknife.ButterKnife;
8 |
9 | /**
10 | * Created by zhangxun on 2015/11/20.
11 | */
12 | public class BaseActivity extends AppCompatActivity{
13 |
14 | @Override
15 | public void setContentView(int layoutResID) {
16 | super.setContentView(layoutResID);
17 | MyActivityManager.getInstance().addActivity(this);
18 | injectViews();
19 | }
20 | protected void injectViews() {
21 | ButterKnife.inject(this);
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/app/src/main/java/com/zx/clean/activity/ChangThemeActivity.java:
--------------------------------------------------------------------------------
1 | package com.zx.clean.activity;
2 |
3 | import android.content.Intent;
4 | import android.os.Bundle;
5 | import android.support.v7.widget.LinearLayoutManager;
6 | import android.support.v7.widget.RecyclerView;
7 | import android.support.v7.widget.Toolbar;
8 | import android.view.View;
9 | import android.widget.ImageButton;
10 | import android.widget.RelativeLayout;
11 | import android.widget.TextView;
12 | import android.widget.Toast;
13 |
14 | import com.zx.clean.R;
15 | import com.zx.clean.adapter.ThemeRecycleViewAdapter;
16 | import com.zx.clean.bean.ItemTheme;
17 | import com.zx.clean.utils.PreferenceManager;
18 | import com.zx.clean.utils.ThemeSet;
19 | import com.zx.clean.views.ArcProgress;
20 |
21 | import java.util.ArrayList;
22 | import java.util.List;
23 |
24 | import butterknife.InjectView;
25 | import butterknife.OnClick;
26 | import de.greenrobot.event.EventBus;
27 |
28 | public class ChangThemeActivity extends BaseActivity implements ThemeRecycleViewAdapter.OnItemClickListener{
29 |
30 | @InjectView(R.id.recycleView)
31 | RecyclerView recycleView;
32 | @InjectView(R.id.top_rl)
33 | RelativeLayout top_rl;
34 | @InjectView(R.id.toolbar_rl)
35 | RelativeLayout toolbar_rl;
36 | @InjectView(R.id.circle_rl)
37 | RelativeLayout circle_rl;
38 | @InjectView(R.id.arc_store)
39 | ArcProgress arc_store;
40 | @InjectView(R.id.arc_process)
41 | ArcProgress arc_process;
42 | @InjectView(R.id.consume)
43 | TextView consume;
44 | @InjectView(R.id.back)
45 | ImageButton back;
46 |
47 |
48 |
49 |
50 | private ThemeRecycleViewAdapter adapter;
51 | private LinearLayoutManager manager;
52 |
53 |
54 | @Override
55 | protected void onCreate(Bundle savedInstanceState) {
56 | ThemeSet.onPreCreate(this);
57 | super.onCreate(savedInstanceState);
58 | setContentView(R.layout.activity_chang_theme);
59 | setupRecycleView();
60 | }
61 |
62 |
63 | private void setupRecycleView() {
64 | adapter = new ThemeRecycleViewAdapter(ChangThemeActivity.this);
65 | adapter.setItemClickListener(this);
66 | manager = new LinearLayoutManager(ChangThemeActivity.this);
67 | manager.setOrientation(LinearLayoutManager.HORIZONTAL);
68 | recycleView.setLayoutManager(manager);
69 | recycleView.setAdapter(adapter);
70 | }
71 |
72 |
73 | @Override
74 | public void onItemClick(View v, int position) {
75 | if (adapter != null){
76 | freshColor(adapter.getCheckedItem());
77 | }
78 | }
79 |
80 | private void freshColor(ItemTheme checkedItem) {
81 | top_rl.setBackgroundColor(getResources().getColor(checkedItem.getColor()));
82 | toolbar_rl.setBackgroundColor(getResources().getColor(checkedItem.getColor()));
83 | circle_rl.setBackgroundColor(getResources().getColor(checkedItem.getColor()));
84 | arc_store.setUnfinishedStrokeColor(getResources().getColor(checkedItem.getColorDark()));
85 | arc_process.setUnfinishedStrokeColor(getResources().getColor(checkedItem.getColorDark()));
86 | }
87 | @OnClick(R.id.consume)
88 | public void onConsume(){
89 | if (adapter != null && adapter.getCheckedItem() != null){
90 | PreferenceManager.setCurrentTheme(ChangThemeActivity.this, adapter.getCheckedItem().getTheme());
91 | // Intent intent = new Intent(ChangThemeActivity.this, MainActivity.class);
92 | // startActivity(intent);
93 | EventBus.getDefault().post(adapter.getCheckedItem());
94 | finish();
95 | }else {
96 | finish();
97 | }
98 | }
99 | @OnClick(R.id.back)
100 | public void onBack(){
101 | finish();
102 | }
103 |
104 |
105 |
106 | }
107 |
--------------------------------------------------------------------------------
/app/src/main/java/com/zx/clean/activity/CleanCompletedActivity.java:
--------------------------------------------------------------------------------
1 | package com.zx.clean.activity;
2 |
3 | import android.os.Build;
4 | import android.os.Bundle;
5 | import android.util.Log;
6 | import android.widget.TextView;
7 |
8 | import com.zx.clean.R;
9 | import com.zx.clean.utils.ThemeSet;
10 |
11 | import butterknife.InjectView;
12 | import butterknife.OnClick;
13 |
14 | public class CleanCompletedActivity extends BaseActivity {
15 | @InjectView(R.id.clean_size)
16 | TextView clean_size;
17 | @InjectView(R.id.clean_app_size)
18 | TextView clean_app_size;
19 |
20 | String cleanSize;
21 | String appSize;
22 |
23 | @Override
24 | protected void onCreate(Bundle savedInstanceState) {
25 | ThemeSet.onPreCreate(this);
26 | super.onCreate(savedInstanceState);
27 | setContentView(R.layout.activity_clean_completed);
28 | setStatusBarColor();
29 | getBundle();
30 | initView();
31 | }
32 | private void setStatusBarColor() {
33 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){
34 | CleanCompletedActivity.this.getWindow().setStatusBarColor(getResources().getColor(R.color.white_light));
35 | }
36 | }
37 | private void initView() {
38 | clean_size.setText("共清理"+cleanSize+"垃圾");
39 | clean_app_size.setText("共清理"+appSize+"款应用垃圾");
40 | }
41 |
42 | private void getBundle() {
43 | Bundle bundle = getIntent().getExtras();
44 | if (bundle == null){
45 | return;
46 | }
47 | cleanSize = bundle.getString("cleanSize", "0");
48 | appSize = bundle.getString("appSize", "0");
49 | }
50 |
51 | @OnClick(R.id.consume)
52 | public void OnConsume(){
53 | finish();
54 | }
55 |
56 | }
57 |
--------------------------------------------------------------------------------
/app/src/main/java/com/zx/clean/activity/LoginActivity.java:
--------------------------------------------------------------------------------
1 | package com.zx.clean.activity;
2 |
3 | import android.os.Bundle;
4 |
5 | import com.zx.clean.R;
6 |
7 | /**
8 | * A login screen that offers login via email/password.
9 | */
10 | public class LoginActivity extends BaseActivity{
11 |
12 |
13 | @Override
14 | protected void onCreate(Bundle savedInstanceState) {
15 | super.onCreate(savedInstanceState);
16 | setContentView(R.layout.activity_login);
17 | }
18 |
19 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/zx/clean/activity/RubbishCleanActivity.java:
--------------------------------------------------------------------------------
1 | package com.zx.clean.activity;
2 |
3 | import android.content.ComponentName;
4 | import android.content.Context;
5 | import android.content.Intent;
6 | import android.content.ServiceConnection;
7 | import android.os.Bundle;
8 | import android.os.IBinder;
9 | import android.support.v7.widget.LinearLayoutManager;
10 | import android.support.v7.widget.RecyclerView;
11 | import android.util.Log;
12 | import android.view.View;
13 | import android.widget.ImageButton;
14 | import android.widget.TextView;
15 |
16 | import com.zx.clean.R;
17 | import com.zx.clean.adapter.RubbishItemAdapter;
18 | import com.zx.clean.bean.RubbishItemBean;
19 | import com.zx.clean.service.CleanerService;
20 | import com.zx.clean.utils.StorageUtil;
21 | import com.zx.clean.utils.ThemeSet;
22 | import com.zx.clean.views.ArcProgress;
23 |
24 | import java.math.BigDecimal;
25 | import java.text.DecimalFormat;
26 | import java.util.ArrayList;
27 | import java.util.List;
28 | import java.util.Timer;
29 | import java.util.TimerTask;
30 |
31 | import butterknife.InjectView;
32 | import butterknife.OnClick;
33 |
34 | public class RubbishCleanActivity extends BaseActivity implements CleanerService.OnCleanActionListener {
35 | @InjectView(R.id.recyclerview)
36 | RecyclerView recyclerview;
37 | @InjectView(R.id.progress)
38 | ArcProgress progress;
39 | @InjectView(R.id.back)
40 | ImageButton back;
41 | @InjectView(R.id.advice)
42 | TextView advice;
43 | @InjectView(R.id.scan_completed)
44 | TextView scan_completed;
45 | @InjectView(R.id.rubbish_clear)
46 | TextView rubbish_clear;
47 |
48 | RubbishItemAdapter mAdapter;
49 | LinearLayoutManager manager;
50 |
51 |
52 | private List list = new ArrayList<>();
53 |
54 | private CleanerService mCleanerService;
55 | private boolean mAlreadyScanned = false;
56 | private boolean mAlreadyCleaned = true;
57 |
58 | private ServiceConnection mServiceConnection = new ServiceConnection() {
59 | @Override
60 | public void onServiceConnected(ComponentName name, IBinder service) {
61 | mCleanerService = ((CleanerService.CleanerServiceBinder) service).getService();
62 | mCleanerService.setmCleanListener(RubbishCleanActivity.this);
63 |
64 | if (!mCleanerService.isScanning() && !mAlreadyScanned) {
65 | mCleanerService.scanRubbish();
66 | }
67 | }
68 |
69 | @Override
70 | public void onServiceDisconnected(ComponentName name) {
71 | mCleanerService.setmCleanListener(null);
72 | mCleanerService = null;
73 | }
74 | };
75 |
76 | @Override
77 | protected void onCreate(Bundle savedInstanceState) {
78 | ThemeSet.onPreCreate(this);
79 | super.onCreate(savedInstanceState);
80 | setContentView(R.layout.activity_rubbish_clean_pre);
81 | setupRecyclerView();
82 | bindService(new Intent(RubbishCleanActivity.this, CleanerService.class), mServiceConnection
83 | , BIND_AUTO_CREATE);
84 | }
85 |
86 | @Override
87 | protected void onDestroy() {
88 | unbindService(mServiceConnection);
89 | super.onDestroy();
90 | }
91 |
92 | private void setupRecyclerView() {
93 | manager = new LinearLayoutManager(RubbishCleanActivity.this);
94 | recyclerview.setLayoutManager(manager);
95 | }
96 |
97 | @OnClick(R.id.back)
98 | public void Onback() {
99 | finish();
100 | }
101 | @OnClick(R.id.rubbish_clear)
102 | public void OnClear(){
103 | if (!mCleanerService.isCleaning() && !mAlreadyCleaned){
104 | mCleanerService.cleanRubbish();
105 | }
106 | }
107 |
108 | @Override
109 | public void onScanStarted(Context context) {
110 | progress.setProgress(0);
111 | advice.setVisibility(View.GONE);
112 | progress.setBottomText("正在扫描");
113 | }
114 |
115 | @Override
116 | public void onScanProgressUpdated(Context context, int current, int max, int size) {
117 | BigDecimal b1 = new BigDecimal(current);
118 | BigDecimal b2 = new BigDecimal(max);
119 | double value = b1.divide(b2, 2, BigDecimal.ROUND_HALF_UP).doubleValue();
120 | int currentProgress = (int) (value*100);
121 | progress.setProgress(currentProgress);
122 | scan_completed.setText(StorageUtil.convertStorage(size));
123 | }
124 |
125 | @Override
126 | public void onScanCompleted(Context context, List apps) {
127 | list = apps;
128 | advice.setVisibility(View.VISIBLE);
129 | progress.setBottomText("扫描完成");
130 | scan_completed.setText(StorageUtil.convertStorage(mCleanerService.getmCleanSize()));
131 | mAdapter = new RubbishItemAdapter(this, list);
132 | recyclerview.setAdapter(mAdapter);
133 | mAlreadyScanned = true;
134 | mAlreadyCleaned = false;
135 | }
136 |
137 | @Override
138 | public void onCleanStarted(Context context) {
139 | timer = null;
140 | timer = new Timer();
141 | progress.setProgress(100);
142 | advice.setVisibility(View.GONE);
143 | progress.setBottomText("正在清理");
144 | }
145 | private Timer timer;
146 | @Override
147 | public void onCleanProgressUpdated(Context context, int current) {
148 |
149 | }
150 | long size;
151 | @Override
152 | public void onCleanCompleted(Context context, final long cleanSize) {
153 |
154 |
155 | size = cleanSize;
156 |
157 | timer.schedule(new TimerTask() {
158 | @Override
159 | public void run() {
160 | runOnUiThread(new Runnable() {
161 | @Override
162 | public void run() {
163 | if (progress.getProgress() > 0) {
164 | progress.setProgress(progress.getProgress() - 1);
165 | if (size > (cleanSize / 100)) {
166 | size = size - cleanSize / 100;
167 | }
168 | scan_completed.setText(StorageUtil.convertStorage(size));
169 | } else {
170 | timer.cancel();
171 | progress.setBottomText("清理完成");
172 | scan_completed.setText("0MB");
173 | mAdapter.updateAdapter(null);
174 | Intent intent = new Intent(RubbishCleanActivity.this, CleanCompletedActivity.class);
175 | intent.putExtra("cleanSize", StorageUtil.convertStorage(cleanSize));
176 | intent.putExtra("appSize", list.size() + "");
177 | startActivity(intent);
178 | finish();
179 | }
180 | }
181 | });
182 | }
183 | }, 0, 30);
184 | mAlreadyCleaned = true;
185 | }
186 | }
187 |
--------------------------------------------------------------------------------
/app/src/main/java/com/zx/clean/activity/SplashActivity.java:
--------------------------------------------------------------------------------
1 | package com.zx.clean.activity;
2 |
3 | import android.animation.Animator;
4 | import android.animation.AnimatorListenerAdapter;
5 | import android.animation.AnimatorSet;
6 | import android.animation.ObjectAnimator;
7 | import android.content.Intent;
8 | import android.support.v7.app.AppCompatActivity;
9 | import android.os.Bundle;
10 | import android.view.animation.DecelerateInterpolator;
11 | import android.widget.ImageView;
12 |
13 | import com.zx.clean.R;
14 |
15 | import java.util.Random;
16 |
17 | public class SplashActivity extends AppCompatActivity {
18 |
19 | ImageView mImageView;
20 |
21 | @Override
22 | protected void onCreate(Bundle savedInstanceState) {
23 | super.onCreate(savedInstanceState);
24 | setContentView(R.layout.activity_splash);
25 |
26 | mImageView = (ImageView) findViewById(R.id.image);
27 |
28 | initAnimation();
29 |
30 | }
31 |
32 | private void initAnimation() {
33 | int index = new Random().nextInt(2);
34 | if (index == 1){
35 | mImageView.setImageResource(R.drawable.entrance3);
36 | }else {
37 | mImageView.setImageResource(R.drawable.entrance2);
38 | }
39 | AnimatorSet set = new AnimatorSet();
40 | ObjectAnimator alpha = new ObjectAnimator().ofFloat(mImageView, "alpha", 0.5f, 1f);
41 | alpha.setDuration(700);
42 |
43 | ObjectAnimator scaleX = new ObjectAnimator().ofFloat(mImageView, "scaleX", 1f, 1.1f);
44 | scaleX.setDuration(2000);
45 | scaleX.setInterpolator(new DecelerateInterpolator());
46 |
47 | ObjectAnimator scaleY= new ObjectAnimator().ofFloat(mImageView, "scaleY", 1f, 1.1f);
48 | scaleY.setDuration(2000);
49 | scaleY.setInterpolator(new DecelerateInterpolator());
50 |
51 | set.play(scaleX).with(scaleY).after(alpha);
52 | set.addListener(new AnimatorListenerAdapter() {
53 | @Override
54 | public void onAnimationEnd(Animator animation) {
55 | Intent intent = new Intent(SplashActivity.this, MainActivity.class);
56 | startActivity(intent);
57 | finish();
58 | }
59 | });
60 | set.start();
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/app/src/main/java/com/zx/clean/adapter/AppManagerItemAdapter.java:
--------------------------------------------------------------------------------
1 | package com.zx.clean.adapter;
2 |
3 | import android.animation.Animator;
4 | import android.animation.AnimatorListenerAdapter;
5 | import android.content.Context;
6 | import android.content.Intent;
7 | import android.net.Uri;
8 | import android.support.v7.widget.RecyclerView;
9 | import android.view.LayoutInflater;
10 | import android.view.View;
11 | import android.view.ViewGroup;
12 | import android.view.animation.DecelerateInterpolator;
13 | import android.widget.ImageView;
14 | import android.widget.TextView;
15 |
16 | import com.zx.clean.R;
17 | import com.zx.clean.bean.AppInfo;
18 | import com.zx.clean.utils.StorageUtil;
19 |
20 | import java.util.ArrayList;
21 | import java.util.List;
22 |
23 | import butterknife.ButterKnife;
24 | import butterknife.InjectView;
25 |
26 | /**
27 | * Created by zhangxun on 2015/11/24.
28 | */
29 | public class AppManagerItemAdapter extends RecyclerView.Adapter {
30 |
31 | private Context mContext;
32 | private ArrayList list = new ArrayList<>();
33 | private List checkedPositionList;//选中的位置
34 | private List checkedData = new ArrayList<>();//选中的数据
35 |
36 | private boolean animationsLocked = false;
37 | private int lastAnimatedPosition = -1;
38 | private boolean delayEnterAnimation = true;
39 |
40 | public AppManagerItemAdapter(Context mContext, ArrayList list) {
41 | this.mContext = mContext;
42 | this.list = list;
43 | checkedPositionList = new ArrayList<>();
44 | }
45 |
46 | @Override
47 | public AppManagerItemAdapter.AppManagerItemViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
48 | View view = LayoutInflater.from(mContext).inflate(R.layout.fragment_rv_item, parent, false);
49 | return new AppManagerItemViewHolder(view);
50 | }
51 |
52 | @Override
53 | public void onBindViewHolder(AppManagerItemAdapter.AppManagerItemViewHolder holder, int position) {
54 | final AppInfo appInfo = list.get(position);
55 | runEnterAnimation(holder.itemView, position);
56 | holder.app_icon.setImageDrawable(appInfo.getAppIcon());
57 | holder.app_name.setText(appInfo.getAppName());
58 | holder.app_use_size.setText("占用" + StorageUtil.convertStorage(appInfo.getPkgSize()));
59 | holder.uninstall.setOnClickListener(new View.OnClickListener() {
60 | @Override
61 | public void onClick(View v) {
62 | Intent intent = new Intent();
63 | intent.setAction("android.intent.action.VIEW");
64 | intent.setAction("android.intent.action.DELETE");
65 | intent.addCategory("android.intent.category.DEFAULT");
66 | intent.setData(Uri.parse("package:" + appInfo.getPackName()));
67 | mContext.startActivity(intent);
68 | }
69 | });
70 | }
71 |
72 | @Override
73 | public int getItemCount() {
74 | if (list != null) {
75 | return list.size();
76 | }
77 | return 0;
78 | }
79 | private void runEnterAnimation(View view, int position) {
80 | if (animationsLocked){
81 | return;
82 | }
83 |
84 | if (position > lastAnimatedPosition){
85 | lastAnimatedPosition = position;
86 | view.setTranslationY(140);
87 | view.setAlpha(0.f);
88 | view.animate().translationY(0).alpha(1.f)
89 | .setStartDelay(delayEnterAnimation ? list.size()*(position) : 0)
90 | .setInterpolator(new DecelerateInterpolator(2.f))
91 | .setDuration(200)
92 | .setListener(new AnimatorListenerAdapter() {
93 | @Override
94 | public void onAnimationEnd(Animator animation) {
95 | animationsLocked = true;
96 | }
97 | }).start();
98 | }
99 | }
100 | public class AppManagerItemViewHolder extends RecyclerView.ViewHolder {
101 | @InjectView(R.id.app_icon)
102 | ImageView app_icon;
103 | @InjectView(R.id.app_name)
104 | TextView app_name;
105 | @InjectView(R.id.app_use_size)
106 | TextView app_use_size;
107 | @InjectView(R.id.uninstall)
108 | TextView uninstall;
109 |
110 | public AppManagerItemViewHolder(View itemView) {
111 | super(itemView);
112 | ButterKnife.inject(this, itemView);
113 | }
114 | }
115 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/zx/clean/adapter/MemoryInfoPagerAdapter.java:
--------------------------------------------------------------------------------
1 | package com.zx.clean.adapter;
2 |
3 | import android.content.Context;
4 | import android.support.v4.view.PagerAdapter;
5 | import android.support.v4.view.ViewPager;
6 | import android.view.View;
7 | import android.view.ViewGroup;
8 |
9 | /**
10 | * Created by zhangxun on 2015/11/30.
11 | */
12 | public class MemoryInfoPagerAdapter extends PagerAdapter{
13 |
14 | private Context mContext;
15 | private View[] mViews;
16 |
17 | public MemoryInfoPagerAdapter(Context mContext, View[] mViews) {
18 | this.mContext = mContext;
19 | this.mViews = mViews;
20 | }
21 |
22 | @Override
23 | public int getCount() {
24 | return mViews.length;
25 | }
26 |
27 | @Override
28 | public Object instantiateItem(ViewGroup container, int position) {
29 | View currentView = mViews[position];
30 | ((ViewPager) container).addView(currentView);
31 | return currentView;
32 | }
33 |
34 | @Override
35 | public void destroyItem(ViewGroup container, int position, Object object) {
36 | ((ViewPager) container).removeView((View) object);
37 | }
38 |
39 | @Override
40 | public boolean isViewFromObject(View view, Object object) {
41 | return false;
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/app/src/main/java/com/zx/clean/adapter/RubbishItemAdapter.java:
--------------------------------------------------------------------------------
1 | package com.zx.clean.adapter;
2 |
3 | import android.animation.Animator;
4 | import android.animation.AnimatorListenerAdapter;
5 | import android.content.Context;
6 | import android.content.Intent;
7 | import android.net.Uri;
8 | import android.provider.Settings;
9 | import android.support.v7.widget.RecyclerView;
10 | import android.view.LayoutInflater;
11 | import android.view.View;
12 | import android.view.ViewAnimationUtils;
13 | import android.view.ViewGroup;
14 | import android.view.animation.DecelerateInterpolator;
15 | import android.view.animation.LinearInterpolator;
16 | import android.widget.ImageView;
17 | import android.widget.RelativeLayout;
18 | import android.widget.TextView;
19 |
20 | import com.zx.clean.R;
21 | import com.zx.clean.bean.RubbishItemBean;
22 | import com.zx.clean.utils.StorageUtil;
23 |
24 | import java.util.ArrayList;
25 | import java.util.List;
26 |
27 | import butterknife.ButterKnife;
28 | import butterknife.InjectView;
29 |
30 | /**
31 | * Created by zhangxun on 2015/11/26.
32 | */
33 | public class RubbishItemAdapter extends RecyclerView.Adapter implements View.OnClickListener{
34 |
35 | private Context mContext;
36 | private List list = new ArrayList<>();
37 | private int size = 0;
38 | private boolean animationsLocked = false;
39 | private int lastAnimatedPosition = -1;
40 | private boolean delayEnterAnimation = true;
41 |
42 | public RubbishItemAdapter(Context mContext, List list) {
43 | this.mContext = mContext;
44 | this.list = list;
45 | if (list != null && list.size() > 0){
46 | this.size = list.size();
47 | }
48 |
49 | }
50 |
51 | @Override
52 | public RubbishItemAdapter.ItemViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
53 | View view = LayoutInflater.from(mContext).inflate(R.layout.fragment_rv_item, parent, false);
54 | return new ItemViewHolder(view);
55 | }
56 |
57 | @Override
58 | public void onBindViewHolder(RubbishItemAdapter.ItemViewHolder holder, int position) {
59 | final RubbishItemBean itemBean = list.get(position);
60 | runEnterAnimation(holder.itemView, position);
61 | holder.uninstall.setVisibility(View.INVISIBLE);
62 | holder.app_icon.setImageDrawable(itemBean.getmIcon());
63 | holder.app_name.setText(itemBean.getmApplicationName());
64 | holder.app_use_size.setText(StorageUtil.convertStorage(itemBean.getmCacheSize()));
65 | holder.item_rl.setOnClickListener(this);
66 | holder.item_rl.setTag(position);
67 | }
68 |
69 | @Override
70 | public int getItemCount() {
71 | if (list != null && list.size() > 0){
72 | return list.size();
73 | }
74 | return 0;
75 | }
76 | private void runEnterAnimation(View view, int position) {
77 | if (animationsLocked){
78 | return;
79 | }
80 |
81 | if (position > lastAnimatedPosition){
82 | lastAnimatedPosition = position;
83 | view.setTranslationY(140);
84 | view.setAlpha(0.f);
85 | view.animate().translationY(0).alpha(1.f)
86 | .setStartDelay(delayEnterAnimation ? list.size()*(position) : 0)
87 | .setInterpolator(new DecelerateInterpolator(2.f))
88 | .setDuration(200)
89 | .setListener(new AnimatorListenerAdapter() {
90 | @Override
91 | public void onAnimationEnd(Animator animation) {
92 | animationsLocked = true;
93 | }
94 | }).start();
95 | }
96 | }
97 | public void updateAdapter(List list){
98 | this.list = list;
99 | notifyDataSetChanged();
100 | }
101 |
102 | @Override
103 | public void onClick(View v) {
104 | switch (v.getId()){
105 | case R.id.item_rl :
106 | int position = (int) v.getTag();
107 | Intent intent = new Intent();
108 | intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
109 | intent.setAction(android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
110 | intent.setData(Uri.parse("package:" + list.get(position).getmPackageName()));
111 | mContext.startActivity(intent);
112 | break;
113 | }
114 | }
115 |
116 |
117 | public class ItemViewHolder extends RecyclerView.ViewHolder{
118 | @InjectView(R.id.app_icon)
119 | ImageView app_icon;
120 | @InjectView(R.id.app_name)
121 | TextView app_name;
122 | @InjectView(R.id.app_use_size)
123 | TextView app_use_size;
124 | @InjectView(R.id.uninstall)
125 | TextView uninstall;
126 | @InjectView(R.id.item_rl)
127 | RelativeLayout item_rl;
128 |
129 | public ItemViewHolder(View itemView) {
130 | super(itemView);
131 | ButterKnife.inject(this, itemView);
132 | }
133 | }
134 | }
135 |
--------------------------------------------------------------------------------
/app/src/main/java/com/zx/clean/adapter/ThemeRecycleViewAdapter.java:
--------------------------------------------------------------------------------
1 | package com.zx.clean.adapter;
2 |
3 | import android.content.Context;
4 | import android.content.res.Resources;
5 | import android.graphics.Color;
6 | import android.support.v7.widget.CardView;
7 | import android.support.v7.widget.RecyclerView;
8 | import android.util.TypedValue;
9 | import android.view.LayoutInflater;
10 | import android.view.View;
11 | import android.view.ViewGroup;
12 | import android.widget.ImageView;
13 | import android.widget.RelativeLayout;
14 | import android.widget.TextView;
15 |
16 | import com.zx.clean.R;
17 | import com.zx.clean.bean.ItemTheme;
18 | import com.zx.clean.utils.Theme;
19 | import com.zx.clean.utils.ThemeSet;
20 |
21 | import org.w3c.dom.Attr;
22 |
23 | import java.util.ArrayList;
24 | import java.util.List;
25 |
26 | import butterknife.ButterKnife;
27 | import butterknife.InjectView;
28 |
29 | /**
30 | * Created by zhangxun on 2015/11/20.
31 | */
32 | public class ThemeRecycleViewAdapter extends RecyclerView.Adapter implements View.OnClickListener{
33 |
34 | private Context context;
35 | private int count = 9;
36 | private OnItemClickListener itemClickListener;
37 |
38 | private List list = new ArrayList<>();
39 | // private int checkedColor;
40 | // private int checkedColorDark;
41 | // private Theme theme;
42 | private ItemTheme checkedItem;
43 |
44 |
45 |
46 | public ThemeRecycleViewAdapter(Context context) {
47 | this.context = context;
48 | this.list = ThemeSet.initThemeData(context);
49 | }
50 |
51 | @Override
52 | public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
53 | View view = LayoutInflater.from(context).inflate(R.layout.item_theme, parent, false);
54 | ViewHolder holder = new ViewHolder(view);
55 | holder.item_theme_cd.setOnClickListener(this);
56 | return holder;
57 | }
58 |
59 | @Override
60 | public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
61 | ViewHolder itemHolder = (ViewHolder) holder;
62 | ItemTheme itemTheme = list.get(position);
63 | itemHolder.item_theme_text.setText(itemTheme.getCardName());
64 | itemHolder.item_theme_cd.setCardBackgroundColor(context.getResources().getColor(itemTheme.getColor()));
65 | if (itemTheme.isChecked()){
66 | itemHolder.check_iv.setVisibility(View.VISIBLE);
67 | }else {
68 | itemHolder.check_iv.setVisibility(View.GONE);
69 | }
70 | itemHolder.item_theme_cd.setTag(holder);
71 | }
72 |
73 | @Override
74 | public int getItemCount() {
75 | return list.size();
76 | }
77 |
78 | public void updateChecked(ViewHolder holder){
79 | for (ItemTheme item : list){
80 | item.setIsChecked(false);
81 | }
82 | int position = holder.getPosition();
83 | ItemTheme itemTheme = list.get(position);
84 | itemTheme.setIsChecked(true);
85 | checkedItem = itemTheme;
86 | // checkedColor = itemTheme.getColor();
87 | // checkedColorDark = itemTheme.getColorDark();
88 | // theme = itemTheme.getTheme();
89 | list.set(position, itemTheme);
90 | notifyDataSetChanged();
91 | }
92 |
93 | @Override
94 | public void onClick(View v) {
95 | switch (v.getId()){
96 | case R.id.item_theme_cd :
97 | if (itemClickListener !=null){
98 | ViewHolder holder = (ViewHolder) v.getTag();
99 | updateChecked(holder);
100 | itemClickListener.onItemClick(v, holder.getPosition());
101 | }
102 | break;
103 | }
104 | }
105 |
106 | public List getThemeData() {
107 | return list;
108 | }
109 |
110 | public ItemTheme getCheckedItem() {
111 | return checkedItem;
112 | }
113 |
114 | // public int getCheckedColor() {
115 | // return checkedColor;
116 | // }
117 | //
118 | // public int getCheckedColorDark() {TypedValue typedValue = new TypedValue();
119 | // return checkedColorDark;
120 | // }
121 | //
122 | // public Theme getTheme() {
123 | // return theme;
124 | // }
125 |
126 | public interface OnItemClickListener{
127 | void onItemClick(View v, int position);
128 | }
129 |
130 | public void setItemClickListener(OnItemClickListener itemClickListener) {
131 | this.itemClickListener = itemClickListener;
132 | }
133 |
134 | class ViewHolder extends RecyclerView.ViewHolder {
135 | @InjectView(R.id.item_theme_cd)
136 | CardView item_theme_cd;
137 | @InjectView(R.id.item_theme_text)
138 | TextView item_theme_text;
139 | @InjectView(R.id.check_iv)
140 | ImageView check_iv;
141 | @InjectView(R.id.item_rl)
142 | RelativeLayout item_rl;
143 |
144 | public ViewHolder(View itemView) {
145 | super(itemView);
146 | ButterKnife.inject(this, itemView);
147 | }
148 | }
149 |
150 | }
151 |
--------------------------------------------------------------------------------
/app/src/main/java/com/zx/clean/adapter/ViewPagerAdapter.java:
--------------------------------------------------------------------------------
1 | package com.zx.clean.adapter;
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.ArrayList;
8 | import java.util.List;
9 |
10 | /**
11 | * Created by zhangxun on 2015/11/24.
12 | */
13 | public class ViewPagerAdapter extends FragmentStatePagerAdapter{
14 |
15 | private final List mFragments = new ArrayList<>();
16 | private final List mFragmentTitles = new ArrayList<>();
17 |
18 | public ViewPagerAdapter(FragmentManager fm) {
19 | super(fm);
20 | }
21 |
22 | public void addFragment(Fragment fragment, String title){
23 | mFragments.add(fragment);
24 | mFragmentTitles.add(title);
25 | }
26 |
27 | @Override
28 | public Fragment getItem(int position) {
29 | if (mFragments != null && mFragments.size() > 0){
30 | return mFragments.get(position);
31 | }
32 | return null;
33 | }
34 |
35 | @Override
36 | public int getCount() {
37 | if (mFragments != null && mFragments.size() > 0){
38 | return mFragments.size();
39 | }
40 | return 0;
41 | }
42 |
43 | @Override
44 | public CharSequence getPageTitle(int position) {
45 | if (mFragmentTitles != null && mFragmentTitles.size() > 0){
46 | return mFragmentTitles.get(position);
47 | }
48 | return super.getPageTitle(position);
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/app/src/main/java/com/zx/clean/bean/AppInfo.java:
--------------------------------------------------------------------------------
1 | package com.zx.clean.bean;
2 |
3 | import android.graphics.drawable.Drawable;
4 |
5 | /**
6 | * Created by zhangxun on 2015/11/24.
7 | */
8 | public class AppInfo {
9 | private int app_icon;
10 | private String app_name;
11 | private String app_use_size;
12 |
13 | private Drawable appIcon;
14 | private String appName;
15 | private String packName;
16 | private String version;
17 | private int uid;
18 | private long pkgSize;
19 |
20 | /**
21 | * 应用程序可以被安装到不同的位置 , 手机内存 外部存储sd卡
22 | */
23 |
24 |
25 | private boolean inRom;
26 |
27 | private boolean userApp;
28 |
29 |
30 | public AppInfo(int app_icon, String app_name, String app_use_size) {
31 | this.app_icon = app_icon;
32 | this.app_name = app_name;
33 | this.app_use_size = app_use_size;
34 | }
35 |
36 | public AppInfo() {
37 | }
38 |
39 |
40 | public boolean isInRom() {
41 | return inRom;
42 | }
43 |
44 | public void setInRom(boolean inRom) {
45 | this.inRom = inRom;
46 | }
47 |
48 | public boolean isUserApp() {
49 | return userApp;
50 | }
51 |
52 | public void setUserApp(boolean userApp) {
53 | this.userApp = userApp;
54 | }
55 |
56 | public Drawable getAppIcon() {
57 | return appIcon;
58 | }
59 |
60 | public void setAppIcon(Drawable appIcon) {
61 | this.appIcon = appIcon;
62 | }
63 |
64 | public String getAppName() {
65 | return appName;
66 | }
67 |
68 | public void setAppName(String appName) {
69 | this.appName = appName;
70 | }
71 |
72 | public String getPackName() {
73 | return packName;
74 | }
75 |
76 | public void setPackName(String packName) {
77 | this.packName = packName;
78 | }
79 |
80 | public String getVersion() {
81 | return version;
82 | }
83 |
84 | public void setVersion(String version) {
85 | this.version = version;
86 | }
87 |
88 | public int getUid() {
89 | return uid;
90 | }
91 |
92 | public void setUid(int uid) {
93 | this.uid = uid;
94 | }
95 |
96 | public long getPkgSize() {
97 | return pkgSize;
98 | }
99 |
100 | public void setPkgSize(long pkgSize) {
101 | this.pkgSize = pkgSize;
102 | }
103 |
104 | public int getApp_icon() {
105 | return app_icon;
106 | }
107 |
108 | public void setApp_icon(int app_icon) {
109 | this.app_icon = app_icon;
110 | }
111 |
112 | public String getApp_name() {
113 | return app_name;
114 | }
115 |
116 | public void setApp_name(String app_name) {
117 | this.app_name = app_name;
118 | }
119 |
120 | public String getApp_use_size() {
121 | return app_use_size;
122 | }
123 |
124 | public void setApp_use_size(String app_use_size) {
125 | this.app_use_size = app_use_size;
126 | }
127 | }
128 |
--------------------------------------------------------------------------------
/app/src/main/java/com/zx/clean/bean/AppProcessInfo.java:
--------------------------------------------------------------------------------
1 | package com.zx.clean.bean;
2 |
3 | import android.graphics.drawable.Drawable;
4 |
5 | /**
6 | * Created by zhangxun on 2015/11/27.
7 | */
8 | public class AppProcessInfo implements Comparable{
9 | public String appName;
10 | public String processName;
11 | /**
12 | * 用户进程的id
13 | */
14 | public int uid;
15 | /**
16 | * 进程pid,0代表无
17 | */
18 | public int pid;
19 | public Drawable icon;
20 | /**
21 | * 占用的内存
22 | */
23 | public long memory;
24 | /**
25 | * 占用的内存
26 | */
27 | public String cpu;
28 | /**
29 | * 进程的状态,其中S表示休眠,R表示正在运行,Z表示僵死状态,N表示该进程优先值是负数.
30 | */
31 | public String status;
32 | /**
33 | * 当前使用的线程数.
34 | */
35 | public String threadsCount;
36 | public boolean checked = true;
37 | /**
38 | * 是否是系统进程.
39 | */
40 | public boolean isSystem;
41 |
42 | // public AppProcessInfo(int uid, int pid, String appName) {
43 | // this.uid = uid;
44 | // this.pid = pid;
45 | // this.appName = appName;
46 | // }
47 |
48 | @Override
49 | public int compareTo(AppProcessInfo another) {
50 | if (this.processName.compareTo(another.processName) == 0) {
51 | if (this.memory < another.memory) {
52 | return 1;
53 | } else if (this.memory == another.memory) {
54 | return 0;
55 | } else {
56 | return -1;
57 | }
58 | } else {
59 | return this.processName.compareTo(another.processName);
60 | }
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/app/src/main/java/com/zx/clean/bean/ItemTheme.java:
--------------------------------------------------------------------------------
1 | package com.zx.clean.bean;
2 |
3 | import com.zx.clean.utils.Theme;
4 |
5 | /**
6 | * Created by zhangxun on 2015/11/20.
7 | */
8 | public class ItemTheme {
9 | private boolean isChecked;
10 | private String cardName;
11 | private int color;
12 | private int colorDark;
13 | private Theme theme;
14 |
15 | public ItemTheme(boolean isChecked, String cardName, int color, int colorDark, Theme theme) {
16 | this.isChecked = isChecked;
17 | this.cardName = cardName;
18 | this.color = color;
19 | this.colorDark = colorDark;
20 | this.theme = theme;
21 | }
22 |
23 | public int getColorDark() {
24 | return colorDark;
25 | }
26 |
27 | public void setColorDark(int colorDark) {
28 | this.colorDark = colorDark;
29 | }
30 |
31 | public boolean isChecked() {
32 | return isChecked;
33 | }
34 |
35 | public void setIsChecked(boolean isChecked) {
36 | this.isChecked = isChecked;
37 | }
38 |
39 | public String getCardName() {
40 | return cardName;
41 | }
42 |
43 | public void setCardName(String cardName) {
44 | this.cardName = cardName;
45 | }
46 |
47 | public int getColor() {
48 | return color;
49 | }
50 |
51 | public void setColor(int color) {
52 | this.color = color;
53 | }
54 |
55 | public Theme getTheme() {
56 | return theme;
57 | }
58 |
59 | public void setTheme(Theme theme) {
60 | this.theme = theme;
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/app/src/main/java/com/zx/clean/bean/RubbishItemBean.java:
--------------------------------------------------------------------------------
1 | package com.zx.clean.bean;
2 |
3 | import android.graphics.drawable.Drawable;
4 |
5 | /**
6 | * Created by zhangxun on 2015/11/26.
7 | */
8 | public class RubbishItemBean {
9 | private long mCacheSize;
10 | private String mPackageName, mApplicationName;
11 | private Drawable mIcon;
12 |
13 | public RubbishItemBean(long mCacheSize, String mPackageName, String mApplicationName, Drawable mIcon) {
14 | this.mCacheSize = mCacheSize;
15 | this.mPackageName = mPackageName;
16 | this.mApplicationName = mApplicationName;
17 | this.mIcon = mIcon;
18 | }
19 |
20 | public long getmCacheSize() {
21 | return mCacheSize;
22 | }
23 |
24 | public String getmPackageName() {
25 | return mPackageName;
26 | }
27 |
28 | public String getmApplicationName() {
29 | return mApplicationName;
30 | }
31 |
32 | public Drawable getmIcon() {
33 | return mIcon;
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/app/src/main/java/com/zx/clean/bean/SDCardInfo.java:
--------------------------------------------------------------------------------
1 | package com.zx.clean.bean;
2 |
3 | /**
4 | * Created by zhangxun on 2015/11/24.
5 | */
6 | public class SDCardInfo {
7 |
8 | public long total;
9 |
10 | public long free;
11 |
12 | }
13 |
--------------------------------------------------------------------------------
/app/src/main/java/com/zx/clean/utils/AppUtil.java:
--------------------------------------------------------------------------------
1 | package com.zx.clean.utils;
2 |
3 | import android.app.ActivityManager;
4 | import android.content.Context;
5 | import android.util.Log;
6 |
7 | import java.io.BufferedReader;
8 | import java.io.FileNotFoundException;
9 | import java.io.FileReader;
10 |
11 | /**
12 | * Created by zhangxun on 2015/11/24.
13 | */
14 | public class AppUtil {
15 |
16 | /**
17 | * 获取可用内存
18 | * @param context
19 | * @return
20 | */
21 | public static long getAvailMemory(Context context){
22 | //获取android当前可用内存大小
23 | ActivityManager activityManager = (ActivityManager) context
24 | .getSystemService(Context.ACTIVITY_SERVICE);
25 | ActivityManager.MemoryInfo memoryInfo = new ActivityManager.MemoryInfo();
26 | activityManager.getMemoryInfo(memoryInfo);
27 | return memoryInfo.availMem;
28 | }
29 |
30 | public static long getTotalMemory(Context context){
31 | //系统内存信息文件
32 | String file = "/proc/meminfo";
33 | String memInfo;
34 | String[] strs;
35 | long memory = 0;
36 |
37 | try {
38 | FileReader fileReader = new FileReader(file);
39 | BufferedReader bufferedReader = new BufferedReader(fileReader, 8192);
40 | //读取meminfo第一行,系统内存大小
41 | memInfo = bufferedReader.readLine();
42 | strs = memInfo.split("\\s+");
43 | for (String str : strs){
44 | Log.d("AppUtil", str + "\t");
45 | }
46 | //获取系统总内存,单位KB
47 | memory = Integer.valueOf(strs[1]).intValue();
48 | bufferedReader.close();
49 | } catch (Exception e) {
50 | e.printStackTrace();
51 | }
52 |
53 |
54 | return memory * 1024;
55 | }
56 |
57 | }
58 |
--------------------------------------------------------------------------------
/app/src/main/java/com/zx/clean/utils/DrawerNavigationItemListener.java:
--------------------------------------------------------------------------------
1 | package com.zx.clean.utils;
2 |
3 | import android.view.View;
4 |
5 | /**
6 | * Created by zhangxun on 2015/11/23.
7 | */
8 | public interface DrawerNavigationItemListener {
9 |
10 | void drawerColse(int id);
11 |
12 | }
13 |
--------------------------------------------------------------------------------
/app/src/main/java/com/zx/clean/utils/MyActivityManager.java:
--------------------------------------------------------------------------------
1 | package com.zx.clean.utils;
2 |
3 | import android.app.Activity;
4 | import android.content.Context;
5 |
6 | import java.util.ArrayList;
7 | import java.util.List;
8 |
9 | /**
10 | * Created by zhangxun on 2015/11/23.
11 | */
12 | public class MyActivityManager {
13 |
14 | public List activityList = new ArrayList<>();
15 |
16 | public static MyActivityManager activityManager;
17 |
18 | private MyActivityManager() {
19 | }
20 |
21 | public static MyActivityManager getInstance(){
22 | if (activityManager == null){
23 | activityManager = new MyActivityManager();
24 | }
25 | return activityManager;
26 | }
27 |
28 | public void addActivity(Activity activity){
29 | activityList.add(activity);
30 | }
31 |
32 | public void removeActivity(Activity activity){
33 | activityList.remove(activity);
34 | }
35 |
36 | public void finishAllActivity(){
37 | if (activityList != null && activityList.size() > 0){
38 | for (Activity activity : activityList){
39 | activity.finish();
40 | }
41 | }
42 | }
43 |
44 | public void exit(Context context){
45 | finishAllActivity();
46 | System.exit(0);
47 | }
48 |
49 |
50 | }
51 |
--------------------------------------------------------------------------------
/app/src/main/java/com/zx/clean/utils/PreferenceManager.java:
--------------------------------------------------------------------------------
1 | package com.zx.clean.utils;
2 |
3 |
4 | import android.content.Context;
5 | import android.content.SharedPreferences;
6 |
7 |
8 | public class PreferenceManager {
9 |
10 |
11 | private static SharedPreferences getSharedPreferences(final Context context) {
12 | return android.preference.PreferenceManager.getDefaultSharedPreferences(context);
13 | }
14 |
15 |
16 | public static boolean isFirstTime(Context context, String key) {
17 | if (getBoolean(context, key, false)) {
18 | return false;
19 | } else {
20 | putBoolean(context, key, true);
21 | return true;
22 | }
23 | }
24 |
25 |
26 | public static boolean contains(Context context, String key) {
27 | return PreferenceManager.getSharedPreferences(context).contains(key);
28 | }
29 |
30 | public static int getInt(final Context context, final String key, final int defaultValue) {
31 | return PreferenceManager.getSharedPreferences(context).getInt(key, defaultValue);
32 | }
33 |
34 | public static boolean putInt(final Context context, final String key, final int pValue) {
35 | final SharedPreferences.Editor editor = PreferenceManager.getSharedPreferences(context).edit();
36 |
37 | editor.putInt(key, pValue);
38 |
39 | return editor.commit();
40 | }
41 |
42 | public static long getLong(final Context context, final String key, final long defaultValue) {
43 | return PreferenceManager.getSharedPreferences(context).getLong(key, defaultValue);
44 | }
45 |
46 | public static Long getLong(final Context context, final String key, final Long defaultValue) {
47 | if (PreferenceManager.getSharedPreferences(context).contains(key)) {
48 | return PreferenceManager.getSharedPreferences(context).getLong(key, 0);
49 | } else {
50 | return null;
51 | }
52 | }
53 |
54 |
55 | public static boolean putLong(final Context context, final String key, final long pValue) {
56 | final SharedPreferences.Editor editor = PreferenceManager.getSharedPreferences(context).edit();
57 |
58 | editor.putLong(key, pValue);
59 |
60 | return editor.commit();
61 | }
62 |
63 | public static boolean getBoolean(final Context context, final String key, final boolean defaultValue) {
64 | return PreferenceManager.getSharedPreferences(context).getBoolean(key, defaultValue);
65 | }
66 |
67 | public static boolean putBoolean(final Context context, final String key, final boolean pValue) {
68 | final SharedPreferences.Editor editor = PreferenceManager.getSharedPreferences(context).edit();
69 |
70 | editor.putBoolean(key, pValue);
71 |
72 | return editor.commit();
73 | }
74 |
75 | public static String getString(final Context context, final String key, final String defaultValue) {
76 | return PreferenceManager.getSharedPreferences(context).getString(key, defaultValue);
77 | }
78 |
79 | public static boolean putString(final Context context, final String key, final String pValue) {
80 | final SharedPreferences.Editor editor = PreferenceManager.getSharedPreferences(context).edit();
81 |
82 | editor.putString(key, pValue);
83 |
84 | return editor.commit();
85 | }
86 |
87 |
88 | public static boolean remove(final Context context, final String key) {
89 | final SharedPreferences.Editor editor = PreferenceManager.getSharedPreferences(context).edit();
90 |
91 | editor.remove(key);
92 |
93 | return editor.commit();
94 | }
95 |
96 | public static Theme getCurrentTheme(Context context) {
97 | return Theme.valueOf(PreferenceManager.getString(context, "app_theme", Theme.Blue.name()));
98 | }
99 |
100 | public static void setCurrentTheme(Context context, Theme currentTheme) {
101 | PreferenceManager.putString(context, "app_theme", currentTheme.name());
102 | }
103 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/zx/clean/utils/StorageUtil.java:
--------------------------------------------------------------------------------
1 | package com.zx.clean.utils;
2 |
3 | import android.content.Context;
4 | import android.os.Environment;
5 | import android.os.StatFs;
6 |
7 | import com.zx.clean.bean.SDCardInfo;
8 |
9 | import java.io.File;
10 |
11 | /**
12 | * Created by zhangxun on 2015/11/24.
13 | */
14 | public class StorageUtil {
15 |
16 | /**
17 | * 获取SDCard的总计大小于剩余大小
18 | * @return
19 | */
20 | public static SDCardInfo getSDCardInfo(){
21 | if (Environment.isExternalStorageRemovable()){
22 | String sDcString = Environment.getExternalStorageState();
23 | if (sDcString.equals(Environment.MEDIA_MOUNTED)){
24 | File pathFile = Environment.getExternalStorageDirectory();
25 |
26 | try {
27 | StatFs statFs = new StatFs(pathFile.getPath());
28 |
29 | //获取SDCard上BLOCK总数
30 | long nToalBlocks = statFs.getBlockCount();
31 |
32 | //获取SDCard上每个BLOCK的SIZE
33 | long nBlockSize = statFs.getBlockSize();
34 |
35 | //获取可供程序使用BLOCK的数量
36 | long nAvailaBlock = statFs.getAvailableBlocks();
37 |
38 | //获取剩下的所有BLOCK的数量(包括预留的一般程序无法使用的块)
39 | long nFreeBlock = statFs.getFreeBlocks();
40 |
41 | SDCardInfo info = new SDCardInfo();
42 | //计算SDCard总容量大小MB
43 | info.total = nToalBlocks * nBlockSize;
44 |
45 | //计算SDCard剩余大小MB
46 | info.free = nAvailaBlock * nBlockSize;
47 |
48 | return info;
49 | } catch (Exception e) {
50 | e.printStackTrace();
51 | }
52 | }
53 | }
54 | return null;
55 | }
56 |
57 | /**
58 | * 获取系统总共存储信息
59 | * @param context
60 | * @return
61 | */
62 | public static SDCardInfo getSystemSpaceInfo(Context context){
63 | File path = Environment.getDataDirectory();
64 |
65 | SDCardInfo info = null;
66 | try {
67 | StatFs statFs = new StatFs(path.getPath());
68 | long blockSize = statFs.getBlockSize();
69 | long totalBlocks = statFs.getBlockCount();
70 | long availableBlocks = statFs.getAvailableBlocks();
71 |
72 | info = new SDCardInfo();
73 | info.total = totalBlocks * blockSize;
74 | info.free = availableBlocks * blockSize;
75 | } catch (Exception e) {
76 | e.printStackTrace();
77 | }
78 | return info;
79 | }
80 |
81 | /**
82 | * 转换 G M K B
83 | * @param size
84 | * @return
85 | */
86 | public static String convertStorage(long size){
87 | long kb = 1024;
88 | long mb = kb * 1024;
89 | long gb = mb * 1024;
90 |
91 | if (size >= gb){
92 | return String.format("%.1f GB", (float)size / gb);
93 | }else if (size >= mb){
94 | float f = (float) size / mb;
95 | return String.format( f > 100 ? "%.0f MB" : "%.1f MB", f);
96 | }else if (size >= kb){
97 | float f = (float) size / kb;
98 | return String.format( f > 100 ? "%.0f KB" : "%.1f KB", f);
99 | }else {
100 | return String.format("%df B", size);
101 | }
102 | }
103 |
104 | }
105 |
--------------------------------------------------------------------------------
/app/src/main/java/com/zx/clean/utils/Theme.java:
--------------------------------------------------------------------------------
1 | package com.zx.clean.utils;
2 |
3 | /**
4 | */
5 | public enum Theme {
6 | Blue,
7 |
8 | Indigo,
9 |
10 | Green,
11 |
12 | Red,
13 |
14 | BlueGrey,
15 |
16 | Black,
17 |
18 | Purple,
19 |
20 | Orange,
21 |
22 | Pink
23 | }
24 |
--------------------------------------------------------------------------------
/app/src/main/java/com/zx/clean/utils/ThemeSet.java:
--------------------------------------------------------------------------------
1 | package com.zx.clean.utils;
2 |
3 | import android.content.Context;
4 |
5 | import com.zx.clean.R;
6 | import com.zx.clean.bean.ItemTheme;
7 |
8 | import java.util.ArrayList;
9 |
10 |
11 | /**
12 | * Created by zhangxun on 2015/11/19.
13 | */
14 | public class ThemeSet {
15 |
16 | public static void onPreCreate(Context context) {
17 | final Theme currentTheme = PreferenceManager.getCurrentTheme(context);
18 |
19 | switch (currentTheme) {
20 | case Blue:
21 | context.setTheme(R.style.BlueTheme);
22 | break;
23 | case Green:
24 | context.setTheme(R.style.GreenTheme);
25 | break;
26 | case Red:
27 | context.setTheme(R.style.RedTheme);
28 | break;
29 | case Indigo:
30 | context.setTheme(R.style.IndigoTheme);
31 | break;
32 | case BlueGrey:
33 | context.setTheme(R.style.BlueGreyTheme);
34 | break;
35 | case Black:
36 | context.setTheme(R.style.BlackTheme);
37 | break;
38 | case Orange:
39 | context.setTheme(R.style.OrangeTheme);
40 | break;
41 | case Purple:
42 | context.setTheme(R.style.PurpleTheme);
43 | break;
44 | case Pink:
45 | context.setTheme(R.style.PinkTheme);
46 | break;
47 | default:
48 | context.setTheme(R.style.BlueTheme);
49 | break;
50 | }
51 | }
52 |
53 | public static ArrayList initThemeData(Context context) {
54 | ArrayList themeList = new ArrayList<>();
55 |
56 | ItemTheme t1 = new ItemTheme(false, "Blue", R.color.blue_primary, R.color.blue_primary_dark, Theme.Blue);
57 | ItemTheme t2 = new ItemTheme(false, "Green", R.color.green_primary, R.color.green_primary_dark, Theme.Green);
58 | ItemTheme t3 = new ItemTheme(false, "Red", R.color.red_primary, R.color.red_primary_dark, Theme.Red);
59 | ItemTheme t4 = new ItemTheme(false, "Indigo", R.color.indigo_primary, R.color.indigo_primary_dark, Theme.Indigo);
60 | ItemTheme t5 = new ItemTheme(false, "Black", R.color.black_primary, R.color.black_primary_dark, Theme.Black);
61 | ItemTheme t6 = new ItemTheme(false, "BlueGrey", R.color.blue_grey_primary, R.color.blue_grey_primary_dark, Theme.BlueGrey);
62 | ItemTheme t7 = new ItemTheme(false, "Orange", R.color.orange_primary, R.color.orange_primary_dark, Theme.Orange);
63 | ItemTheme t8 = new ItemTheme(false, "Purple", R.color.purple_primary, R.color.purple_primary_dark, Theme.Purple);
64 | ItemTheme t9 = new ItemTheme(false, "Pink", R.color.pink_primary, R.color.pink_primary_dark, Theme.Pink);
65 |
66 | themeList.add(t1);
67 | themeList.add(t2);
68 | themeList.add(t3);
69 | themeList.add(t4);
70 | themeList.add(t5);
71 | themeList.add(t6);
72 | themeList.add(t7);
73 | themeList.add(t8);
74 | themeList.add(t9);
75 |
76 |
77 | return themeList;
78 | }
79 |
80 |
81 | }
82 |
--------------------------------------------------------------------------------
/app/src/main/java/com/zx/clean/utils/Utils.java:
--------------------------------------------------------------------------------
1 | package com.zx.clean.utils;
2 |
3 | import android.content.res.Resources;
4 |
5 | /**
6 | */
7 | public class Utils {
8 | public static float dp2px(Resources resources, float dp) {
9 | final float scale = resources.getDisplayMetrics().density;
10 | return dp * scale + 0.5f;
11 | }
12 |
13 | public static float sp2px(Resources resources, float sp){
14 | final float scale = resources.getDisplayMetrics().scaledDensity;
15 | return sp * scale;
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/app/src/main/java/com/zx/clean/views/ItemCardView.java:
--------------------------------------------------------------------------------
1 | package com.zx.clean.views;
2 |
3 | import android.content.Context;
4 | import android.content.res.TypedArray;
5 | import android.util.AttributeSet;
6 | import android.view.View;
7 | import android.widget.ImageView;
8 | import android.widget.RelativeLayout;
9 | import android.widget.TextView;
10 |
11 | import com.zx.clean.R;
12 | import com.zx.clean.utils.Utils;
13 |
14 | /**
15 | * Created by zhangxun on 2015/11/20.
16 | */
17 | public class ItemCardView extends RelativeLayout{
18 |
19 | private ImageView cardImage;
20 | private TextView cardName;
21 | private Context mContext;
22 |
23 | public ItemCardView(Context context) {
24 | super(context);
25 | init(context);
26 | }
27 |
28 | public ItemCardView(Context context, AttributeSet attrs) {
29 | super(context, attrs);
30 | init(context);
31 | mContext = context;
32 | TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.ItemCardView);
33 | cardName.setText(typedArray.getString(R.styleable.ItemCardView_card_name));
34 | cardImage.setImageDrawable(typedArray.getDrawable(R.styleable.ItemCardView_card_image));
35 | typedArray.recycle();
36 | }
37 |
38 | private void init(Context context) {
39 | View view = View.inflate(context, R.layout.card_item, this);
40 | cardName = (TextView) view.findViewById(R.id.card_name);
41 | cardImage = (ImageView) view.findViewById(R.id.card_image);
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/app/src/main/java/com/zx/clean/views/ItemCardViewMini.java:
--------------------------------------------------------------------------------
1 | package com.zx.clean.views;
2 |
3 | import android.content.Context;
4 | import android.content.res.TypedArray;
5 | import android.util.AttributeSet;
6 | import android.view.View;
7 | import android.widget.ImageView;
8 | import android.widget.RelativeLayout;
9 | import android.widget.TextView;
10 |
11 | import com.zx.clean.R;
12 |
13 | /**
14 | * Created by zhangxun on 2015/11/20.
15 | */
16 | public class ItemCardViewMini extends RelativeLayout{
17 |
18 | private ImageView cardImage;
19 | private TextView cardName;
20 | private Context mContext;
21 |
22 | public ItemCardViewMini(Context context) {
23 | super(context);
24 | init(context);
25 | }
26 |
27 | public ItemCardViewMini(Context context, AttributeSet attrs) {
28 | super(context, attrs);
29 | init(context);
30 | mContext = context;
31 | TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.ItemCardView);
32 | cardName.setText(typedArray.getString(R.styleable.ItemCardView_card_name));
33 | cardImage.setImageDrawable(typedArray.getDrawable(R.styleable.ItemCardView_card_image));
34 | typedArray.recycle();
35 | }
36 |
37 | private void init(Context context) {
38 | View view = View.inflate(context, R.layout.card_item_mini, this);
39 | cardName = (TextView) view.findViewById(R.id.card_name);
40 | cardImage = (ImageView) view.findViewById(R.id.card_image);
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/app/src/main/java/com/zx/clean/views/MemoryInfoView.java:
--------------------------------------------------------------------------------
1 | package com.zx.clean.views;
2 |
3 | import android.content.Context;
4 | import android.util.AttributeSet;
5 | import android.view.LayoutInflater;
6 | import android.widget.LinearLayout;
7 | import android.widget.TextView;
8 |
9 | import com.zx.clean.R;
10 |
11 | import butterknife.ButterKnife;
12 | import butterknife.InjectView;
13 |
14 | /**
15 | * Created by zhangxun on 2015/11/30.
16 | */
17 | public class MemoryInfoView extends LinearLayout{
18 |
19 | @InjectView(R.id.advice)
20 | TextView advice;
21 | @InjectView(R.id.scan_completed)
22 | TextView scan_completed;
23 | @InjectView(R.id.action)
24 | TextView action;
25 |
26 | public MemoryInfoView(Context context) {
27 | super(context);
28 | ButterKnife.inject(context, MemoryInfoView.this);
29 | initView();
30 | }
31 |
32 | private void initView() {
33 | LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
34 | final LinearLayout mainV = (LinearLayout) inflater.inflate(R.layout.view_memory_info, this);
35 | }
36 |
37 | public void setTextValues(String action_tv, String scan_completed_tv, boolean show){
38 | action.setText(action_tv);
39 | scan_completed.setText(scan_completed_tv);
40 | if (show){
41 | action.setVisibility(VISIBLE);
42 | }else {
43 | action.setVisibility(GONE);
44 | }
45 | }
46 |
47 | public void setScanText(String scan_completed_tv){
48 | scan_completed.setText(scan_completed_tv);
49 | }
50 |
51 | public String getScanText(){
52 | return scan_completed.getText().toString();
53 | }
54 |
55 |
56 | }
57 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/selector_text_ripple.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/selector_toolbar_right_corner_ripple.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/bdcx.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xunzzz/Clean/58d872c151a702439ee347710e746e40ee213e80/app/src/main/res/drawable-xhdpi/bdcx.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/bg_qq.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xunzzz/Clean/58d872c151a702439ee347710e746e40ee213e80/app/src/main/res/drawable-xhdpi/bg_qq.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/bg_wechat.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xunzzz/Clean/58d872c151a702439ee347710e746e40ee213e80/app/src/main/res/drawable-xhdpi/bg_wechat.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/bg_weibo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xunzzz/Clean/58d872c151a702439ee347710e746e40ee213e80/app/src/main/res/drawable-xhdpi/bg_weibo.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/card_icon_autorun.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xunzzz/Clean/58d872c151a702439ee347710e746e40ee213e80/app/src/main/res/drawable-xhdpi/card_icon_autorun.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/card_icon_media.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xunzzz/Clean/58d872c151a702439ee347710e746e40ee213e80/app/src/main/res/drawable-xhdpi/card_icon_media.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/card_icon_speedup.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xunzzz/Clean/58d872c151a702439ee347710e746e40ee213e80/app/src/main/res/drawable-xhdpi/card_icon_speedup.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/card_icon_trash.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xunzzz/Clean/58d872c151a702439ee347710e746e40ee213e80/app/src/main/res/drawable-xhdpi/card_icon_trash.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/default_avator.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xunzzz/Clean/58d872c151a702439ee347710e746e40ee213e80/app/src/main/res/drawable-xhdpi/default_avator.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_lock.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xunzzz/Clean/58d872c151a702439ee347710e746e40ee213e80/app/src/main/res/drawable-xhdpi/ic_lock.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_login_user.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xunzzz/Clean/58d872c151a702439ee347710e746e40ee213e80/app/src/main/res/drawable-xhdpi/ic_login_user.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/list_icn_slt.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xunzzz/Clean/58d872c151a702439ee347710e746e40ee213e80/app/src/main/res/drawable-xhdpi/list_icn_slt.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/login_bg.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xunzzz/Clean/58d872c151a702439ee347710e746e40ee213e80/app/src/main/res/drawable-xhdpi/login_bg.jpg
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/radio_checkbox.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xunzzz/Clean/58d872c151a702439ee347710e746e40ee213e80/app/src/main/res/drawable-xhdpi/radio_checkbox.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/small_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xunzzz/Clean/58d872c151a702439ee347710e746e40ee213e80/app/src/main/res/drawable-xhdpi/small_icon.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/tp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xunzzz/Clean/58d872c151a702439ee347710e746e40ee213e80/app/src/main/res/drawable-xhdpi/tp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/S51208-114446.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xunzzz/Clean/58d872c151a702439ee347710e746e40ee213e80/app/src/main/res/drawable-xxhdpi/S51208-114446.jpg
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/S51208-114510.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xunzzz/Clean/58d872c151a702439ee347710e746e40ee213e80/app/src/main/res/drawable-xxhdpi/S51208-114510.jpg
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/S51208-114521.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xunzzz/Clean/58d872c151a702439ee347710e746e40ee213e80/app/src/main/res/drawable-xxhdpi/S51208-114521.jpg
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/S51208-114535.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xunzzz/Clean/58d872c151a702439ee347710e746e40ee213e80/app/src/main/res/drawable-xxhdpi/S51208-114535.jpg
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ce.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xunzzz/Clean/58d872c151a702439ee347710e746e40ee213e80/app/src/main/res/drawable-xxhdpi/ce.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/entrance2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xunzzz/Clean/58d872c151a702439ee347710e746e40ee213e80/app/src/main/res/drawable-xxhdpi/entrance2.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/entrance3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xunzzz/Clean/58d872c151a702439ee347710e746e40ee213e80/app/src/main/res/drawable-xxhdpi/entrance3.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ng.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xunzzz/Clean/58d872c151a702439ee347710e746e40ee213e80/app/src/main/res/drawable-xxhdpi/ng.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/s51208114446.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xunzzz/Clean/58d872c151a702439ee347710e746e40ee213e80/app/src/main/res/drawable-xxhdpi/s51208114446.jpg
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/s51208114510.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xunzzz/Clean/58d872c151a702439ee347710e746e40ee213e80/app/src/main/res/drawable-xxhdpi/s51208114510.jpg
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/s51208114521.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xunzzz/Clean/58d872c151a702439ee347710e746e40ee213e80/app/src/main/res/drawable-xxhdpi/s51208114521.jpg
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/s51208114535.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xunzzz/Clean/58d872c151a702439ee347710e746e40ee213e80/app/src/main/res/drawable-xxhdpi/s51208114535.jpg
--------------------------------------------------------------------------------
/app/src/main/res/drawable/button_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | -
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/circle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/clean_already_circle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_account_circle_24dp.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_arrow_back_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_battery_60_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
10 |
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_check_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_home_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_menu_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_perm_contact_cal_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_security_24dp.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_settings_applications_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_signal_cellular_1_bar_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
10 |
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_signal_wifi_3_bar_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
10 |
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_verified_user_24dp.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_wallet_travel_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/selector_text_ripple.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
4 |
5 |
6 |
7 |
8 | -
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/selector_toolbar_right_corner_ripple.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/side_nav_bar.xml:
--------------------------------------------------------------------------------
1 |
3 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_about.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
15 |
16 |
19 |
20 |
23 |
24 |
27 |
28 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_app_manager.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
15 |
16 |
24 |
25 |
34 |
35 |
46 |
47 |
59 |
60 |
61 |
62 |
67 |
68 |
69 |
70 |
75 |
76 |
77 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_app_manager_pre.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 |
14 |
15 |
20 |
21 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_chang_theme.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
17 |
27 |
28 |
42 |
43 |
44 |
45 |
46 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
64 |
65 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_clean_completed.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
17 |
18 |
22 |
23 |
28 |
29 |
34 |
35 |
36 |
40 |
41 |
49 |
50 |
60 |
61 |
66 |
67 |
76 |
77 |
87 |
88 |
89 |
90 |
91 |
96 |
97 |
106 |
107 |
116 |
117 |
118 |
119 |
120 |
125 |
126 |
135 |
136 |
145 |
146 |
147 |
148 |
149 |
150 |
155 |
156 |
161 |
162 |
173 |
174 |
175 |
176 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_login.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
15 |
16 |
17 |
25 |
32 |
33 |
43 |
44 |
45 |
46 |
47 |
54 |
55 |
65 |
66 |
67 |
68 |
79 |
80 |
91 |
92 |
93 |
102 |
103 |
111 |
112 |
116 |
117 |
122 |
123 |
128 |
129 |
130 |
131 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
15 |
16 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_memory_clean_pre.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
13 |
14 |
19 |
20 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_rubbish_clean.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
18 |
19 |
26 |
27 |
33 |
34 |
44 |
45 |
55 |
56 |
66 |
67 |
68 |
69 |
77 |
78 |
87 |
88 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
114 |
115 |
140 |
141 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_rubbish_clean_pre.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
13 |
14 |
19 |
20 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_splash.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
12 |
13 |
14 |
21 |
22 |
27 |
28 |
35 |
36 |
37 |
47 |
48 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/app_bar_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
16 |
17 |
18 |
19 |
20 |
27 |
28 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/card_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
12 |
13 |
23 |
24 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/card_item_mini.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
12 |
13 |
23 |
24 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/content_rubbish_clean.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_app_manager.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
11 |
12 |
20 |
21 |
31 |
32 |
37 |
38 |
39 |
45 |
50 |
51 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_rv_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
14 |
15 |
22 |
23 |
35 |
36 |
47 |
48 |
62 |
63 |
64 |
65 |
66 |
67 |
74 |
75 |
76 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_theme.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
21 |
22 |
30 |
31 |
32 |
33 |
42 |
43 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/memory_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
14 |
15 |
22 |
23 |
35 |
36 |
37 |
50 |
57 |
58 |
59 |
60 |
61 |
68 |
69 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/nav_header_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
18 |
19 |
27 |
28 |
36 |
37 |
44 |
45 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/view_memory_info.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
17 |
18 |
28 |
29 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/activity_main_drawer.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/main.xml:
--------------------------------------------------------------------------------
1 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_rubbish_clean.xml:
--------------------------------------------------------------------------------
1 |
8 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xunzzz/Clean/58d872c151a702439ee347710e746e40ee213e80/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xunzzz/Clean/58d872c151a702439ee347710e746e40ee213e80/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xunzzz/Clean/58d872c151a702439ee347710e746e40ee213e80/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xunzzz/Clean/58d872c151a702439ee347710e746e40ee213e80/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xunzzz/Clean/58d872c151a702439ee347710e746e40ee213e80/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/values-v21/styles.xml:
--------------------------------------------------------------------------------
1 | >
2 |
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #ffffff
4 | #08ffffff
5 | #00000000
6 | #40ffffff
7 | #30333333
8 |
9 | #35B558
10 |
11 | #999999
12 |
13 | #333333
14 | #e5e5e5
15 | #f6f6f6
16 |
17 | #3F51B5
18 | #303F9F
19 | #FF4081
20 |
21 |
22 | #2196F3
23 | #1976D2
24 | #90CAF9
25 | #2196F3
26 |
27 |
28 | #3F51B5
29 | #303F9F
30 | #C5CAE9
31 | #3F51B5
32 |
33 |
34 | #4CAF50
35 | #388E3C
36 | #C8E6C9
37 | #4CAF50
38 |
39 |
40 | #f44336
41 | #d32f2f
42 | #ef9a9a
43 | #f44336
44 |
45 |
46 | #607D8B
47 | #455A64
48 | #B0BEC5
49 | #607D8B
50 |
51 | #000
52 | #000
53 | #666
54 | #000
55 |
56 | #9C27B0
57 | #7B1FA2
58 | #CE93D8
59 | #9C27B0
60 |
61 |
62 | #FF9800
63 | #F57C00
64 | #FFCC80
65 | #FF9800
66 |
67 |
68 | #E91E63
69 | #C2185B
70 | #F48FB1
71 | #E91E63
72 |
73 |
74 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 160dp
5 |
6 | 16dp
7 | 16dp
8 | 16dp
9 | 180dp
10 | 16dp
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | 安全中心
3 |
4 | Open navigation drawer
5 | Close navigation drawer
6 |
7 | Settings
8 | AppManagerActivity
9 | RubbishCleanActivity
10 |
11 | "Material is the metaphor.\n\n"
12 |
13 | "A material metaphor is the unifying theory of a rationalized space and a system of motion."
14 | "The material is grounded in tactile reality, inspired by the study of paper and ink, yet "
15 | "technologically advanced and open to imagination and magic.\n"
16 | "Surfaces and edges of the material provide visual cues that are grounded in reality. The "
17 | "use of familiar tactile attributes helps users quickly understand affordances. Yet the "
18 | "flexibility of the material creates new affordances that supercede those in the physical "
19 | "world, without breaking the rules of physics.\n"
20 | "The fundamentals of light, surface, and movement are key to conveying how objects move, "
21 | "interact, and exist in space and in relation to each other. Realistic lighting shows "
22 | "seams, divides space, and indicates moving parts.\n\n"
23 |
24 | "Bold, graphic, intentional.\n\n"
25 |
26 | "The foundational elements of print based design typography, grids, space, scale, color, "
27 | "and use of imagery guide visual treatments. These elements do far more than please the "
28 | "eye. They create hierarchy, meaning, and focus. Deliberate color choices, edge to edge "
29 | "imagery, large scale typography, and intentional white space create a bold and graphic "
30 | "interface that immerse the user in the experience.\n"
31 | "An emphasis on user actions makes core functionality immediately apparent and provides "
32 | "waypoints for the user.\n\n"
33 |
34 | "Motion provides meaning.\n\n"
35 |
36 | "Motion respects and reinforces the user as the prime mover. Primary user actions are "
37 | "inflection points that initiate motion, transforming the whole design.\n"
38 | "All action takes place in a single environment. Objects are presented to the user without "
39 | "breaking the continuity of experience even as they transform and reorganize.\n"
40 | "Motion is meaningful and appropriate, serving to focus attention and maintain continuity. "
41 | "Feedback is subtle yet clear. Transitions are efficient yet coherent.\n\n"
42 |
43 | "3D world.\n\n"
44 |
45 | "The material environment is a 3D space, which means all objects have x, y, and z "
46 | "dimensions. The z-axis is perpendicularly aligned to the plane of the display, with the "
47 | "positive z-axis extending towards the viewer. Every sheet of material occupies a single "
48 | "position along the z-axis and has a standard 1dp thickness.\n"
49 | "On the web, the z-axis is used for layering and not for perspective. The 3D world is "
50 | "emulated by manipulating the y-axis.\n\n"
51 |
52 | "Light and shadow.\n\n"
53 |
54 | "Within the material environment, virtual lights illuminate the scene. Key lights create "
55 | "directional shadows, while ambient light creates soft shadows from all angles.\n"
56 | "Shadows in the material environment are cast by these two light sources. In Android "
57 | "development, shadows occur when light sources are blocked by sheets of material at "
58 | "various positions along the z-axis. On the web, shadows are depicted by manipulating the "
59 | "y-axis only. The following example shows the card with a height of 6dp.\n\n"
60 |
61 | "Resting elevation.\n\n"
62 |
63 | "All material objects, regardless of size, have a resting elevation, or default elevation "
64 | "that does not change. If an object changes elevation, it should return to its resting "
65 | "elevation as soon as possible.\n\n"
66 |
67 | "Component elevations.\n\n"
68 |
69 | "The resting elevation for a component type is consistent across apps (e.g., FAB elevation "
70 | "does not vary from 6dp in one app to 16dp in another app).\n"
71 | "Components may have different resting elevations across platforms, depending on the depth "
72 | "of the environment (e.g., TV has a greater depth than mobile or desktop).\n\n"
73 |
74 | "Responsive elevation and dynamic elevation offsets.\n\n"
75 |
76 | "Some component types have responsive elevation, meaning they change elevation in response "
77 | "to user input (e.g., normal, focused, and pressed) or system events. These elevation "
78 | "changes are consistently implemented using dynamic elevation offsets.\n"
79 | "Dynamic elevation offsets are the goal elevation that a component moves towards, relative "
80 | "to the component’s resting state. They ensure that elevation changes are consistent "
81 | "across actions and component types. For example, all components that lift on press have "
82 | "the same elevation change relative to their resting elevation.\n"
83 | "Once the input event is completed or cancelled, the component will return to its resting "
84 | "elevation.\n\n"
85 |
86 | "Avoiding elevation interference.\n\n"
87 |
88 | "Components with responsive elevations may encounter other components as they move between "
89 | "their resting elevations and dynamic elevation offsets. Because material cannot pass "
90 | "through other material, components avoid interfering with one another any number of ways, "
91 | "whether on a per component basis or using the entire app layout.\n"
92 | "On a component level, components can move or be removed before they cause interference. "
93 | "For example, a floating action button (FAB) can disappear or move off screen before a "
94 | "user picks up a card, or it can move if a snackbar appears.\n"
95 | "On the layout level, design your app layout to minimize opportunities for interference. "
96 | "For example, position the FAB to one side of stream of a cards so the FAB won’t interfere "
97 | "when a user tries to pick up one of cards.\n\n"
98 |
99 |
100 | CleanCompletedActivity
101 | Dummy Button
102 | DUMMY\nCONTENT
103 | Sign in
104 |
105 |
106 | Email
107 | Password (optional)
108 | Sign in or register
109 | Sign in
110 | This email address is invalid
111 | This password is too short
112 | This password is incorrect
113 | This field is required
114 | "Contacts permissions are needed for providing email
115 | completions."
116 |
117 |
118 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
12 |
13 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
27 |
28 |
31 |
32 |
36 |
37 |
38 |
39 |
40 |
41 |
51 |
57 |
58 |
77 |
78 |
--------------------------------------------------------------------------------
/app/src/main/res/values/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
19 |
20 |
21 |
26 |
27 |
28 |
33 |
34 |
35 |
40 |
41 |
42 |
47 |
48 |
53 |
54 |
55 |
60 |
61 |
66 |
67 |
72 |
73 |
--------------------------------------------------------------------------------
/app/src/test/java/com/zx/clean/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.zx.clean;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * To work on unit tests, switch the Test Artifact in the Build Variants view.
9 | */
10 | public class ExampleUnitTest {
11 | @Test
12 | public void addition_isCorrect() throws Exception {
13 | assertEquals(4, 2 + 2);
14 | }
15 | }
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:1.5.0'
9 |
10 | // NOTE: Do not place your application dependencies here; they belong
11 | // in the individual module build.gradle files
12 | }
13 | }
14 |
15 | def isReleaseBuild() {
16 | return version.contains("SNAPSHOT") == false
17 | }
18 |
19 | allprojects {
20 | repositories {
21 | maven { url 'http://dl.bintray.com/populov/maven/' }
22 | jcenter()
23 | }
24 | }
25 |
26 | task clean(type: Delete) {
27 | delete rootProject.buildDir
28 | }
29 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xunzzz/Clean/58d872c151a702439ee347710e746e40ee213e80/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Thu Nov 19 17:33:02 CST 2015
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # For Cygwin, ensure paths are in UNIX format before anything is touched.
46 | if $cygwin ; then
47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
48 | fi
49 |
50 | # Attempt to set APP_HOME
51 | # Resolve links: $0 may be a link
52 | PRG="$0"
53 | # Need this for relative symlinks.
54 | while [ -h "$PRG" ] ; do
55 | ls=`ls -ld "$PRG"`
56 | link=`expr "$ls" : '.*-> \(.*\)$'`
57 | if expr "$link" : '/.*' > /dev/null; then
58 | PRG="$link"
59 | else
60 | PRG=`dirname "$PRG"`"/$link"
61 | fi
62 | done
63 | SAVED="`pwd`"
64 | cd "`dirname \"$PRG\"`/" >&-
65 | APP_HOME="`pwd -P`"
66 | cd "$SAVED" >&-
67 |
68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
69 |
70 | # Determine the Java command to use to start the JVM.
71 | if [ -n "$JAVA_HOME" ] ; then
72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
73 | # IBM's JDK on AIX uses strange locations for the executables
74 | JAVACMD="$JAVA_HOME/jre/sh/java"
75 | else
76 | JAVACMD="$JAVA_HOME/bin/java"
77 | fi
78 | if [ ! -x "$JAVACMD" ] ; then
79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
80 |
81 | Please set the JAVA_HOME variable in your environment to match the
82 | location of your Java installation."
83 | fi
84 | else
85 | JAVACMD="java"
86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
87 |
88 | Please set the JAVA_HOME variable in your environment to match the
89 | location of your Java installation."
90 | fi
91 |
92 | # Increase the maximum file descriptors if we can.
93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
94 | MAX_FD_LIMIT=`ulimit -H -n`
95 | if [ $? -eq 0 ] ; then
96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
97 | MAX_FD="$MAX_FD_LIMIT"
98 | fi
99 | ulimit -n $MAX_FD
100 | if [ $? -ne 0 ] ; then
101 | warn "Could not set maximum file descriptor limit: $MAX_FD"
102 | fi
103 | else
104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
105 | fi
106 | fi
107 |
108 | # For Darwin, add options to specify how the application appears in the dock
109 | if $darwin; then
110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
111 | fi
112 |
113 | # For Cygwin, switch paths to Windows format before running java
114 | if $cygwin ; then
115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
158 | function splitJvmOpts() {
159 | JVM_OPTS=("$@")
160 | }
161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
163 |
164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
165 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/library/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/library/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 | apply plugin: 'maven-publish'
3 |
4 | android {
5 | compileSdkVersion 23
6 | buildToolsVersion "23.0.2"
7 |
8 | defaultConfig {
9 | minSdkVersion 10
10 | targetSdkVersion 23
11 | versionCode 9
12 | versionName "1.2.6"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | compileOptions {
21 | sourceCompatibility JavaVersion.VERSION_1_7
22 | targetCompatibility JavaVersion.VERSION_1_7
23 | }
24 | }
25 |
26 | dependencies {
27 | compile fileTree(dir: 'libs', include: ['*.jar'])
28 | compile 'com.android.support:appcompat-v7:23.1.1'
29 | //CirclePageIndicator
30 | compile 'com.viewpagerindicator:library:2.4.1@aar'
31 | //Animations and progress value easing
32 | compile 'com.nineoldandroids:library:2.4.0'
33 | compile 'com.daimajia.easing:library:1.0.1@aar'
34 | }
35 |
36 | //gradle clean build uploadArchives
37 | //apply from: 'https://raw.github.com/chrisbanes/gradle-mvn-push/master/gradle-mvn-push.gradle'
38 | //apply from: 'https://raw.github.com/omadahealth/omada-nexus/master/gradle-mvn-push/gradle-mvn-push.gradle'
39 |
40 | //task androidSourcesJar(type: Jar) {
41 | // classifier = 'sources'
42 | // from android.sourceSets.main.java.sourceFiles
43 | //}
44 | //artifacts {
45 | // archives androidSourcesJar
46 | //}
47 | //
48 | //apply plugin: 'maven'
49 | //uploadArchives {
50 | // repositories {
51 | // mavenDeployer {
52 | // repository(url: uri("../../omada-nexus/release"))
53 | // snapshotRepository(url: uri("../../omada-nexus/release"))
54 | // pom.groupId = GROUP
55 | // pom.artifactId = POM_ARTIFACT_ID
56 | // pom.version = VERSION_NAME
57 | // }
58 | // }
59 | //}
--------------------------------------------------------------------------------
/library/gradle.properties:
--------------------------------------------------------------------------------
1 | POM_NAME=CircularBarPager Library
2 | POM_ARTIFACT_ID=library
3 | POM_PACKAGING=aar
--------------------------------------------------------------------------------
/library/library.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 | generateDebugAndroidTestSources
19 | generateDebugSources
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
--------------------------------------------------------------------------------
/library/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/stoyan/android_sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/library/src/androidTest/java/com/github/OrangeGangsters/circularbarpager/library/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package com.github.OrangeGangsters.circularbarpager.library;
2 |
3 | import android.app.Application;
4 | import android.test.ApplicationTestCase;
5 |
6 | /**
7 | * Testing Fundamentals
8 | */
9 | public class ApplicationTest extends ApplicationTestCase {
10 | public ApplicationTest() {
11 | super(Application.class);
12 | }
13 |
14 | public void testModulo(){
15 | assertEquals(-3, -3%5);
16 | }
17 | }
--------------------------------------------------------------------------------
/library/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/library/src/main/java/com/github/OrangeGangsters/circularbarpager/library/viewpager/FadeViewPagerTransformer.java:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2015 Omada Health, Inc
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 | package com.github.OrangeGangsters.circularbarpager.library.viewpager;
25 |
26 | import android.annotation.TargetApi;
27 | import android.os.Build;
28 | import android.support.v4.view.ViewPager;
29 | import android.view.View;
30 |
31 | /**
32 | * Created by oliviergoutay on 12/9/14.
33 | */
34 | public class FadeViewPagerTransformer implements ViewPager.PageTransformer {
35 |
36 | /**
37 | * Used for adding a fadein/fadeout animation in the ViewPager transition.
38 | * Must be used with {@link android.support.v4.view.ViewPager#setPageTransformer(boolean, android.support.v4.view.ViewPager.PageTransformer)}
39 | */
40 | @TargetApi(Build.VERSION_CODES.HONEYCOMB)
41 | public void transformPage(View view, float position) {
42 | //Calculate real position (with padding)
43 | position -= (float) ((ViewPager) view.getParent()).getPaddingRight() / (float) view.getWidth();
44 | if (position <= -1.0f || position >= 1.0f) {
45 | view.setAlpha(0);
46 | view.setTranslationX(0);
47 | } else if (position < 0.0001f && position > -0.0001f) {
48 | view.setAlpha(1);
49 | view.setTranslationX(1);
50 | } else if (position <= 0.0f || position <= 1.0f) {
51 | //Get the page margin to calculate the alpha relatively to it
52 | float pageMargin = -(float) ((ViewPager) view.getParent()).getPageMargin() / (float) view.getWidth();
53 | float alpha = position / (1.0f - pageMargin);
54 | alpha = (alpha <= 0) ? alpha + 1 : 1 - alpha;
55 | view.setAlpha(alpha);
56 | //Reduce the translation by factor 2
57 | view.setTranslationX(-position * ((float) view.getWidth() / 1.5f));
58 | }
59 | }
60 |
61 | }
62 |
--------------------------------------------------------------------------------
/library/src/main/java/com/github/OrangeGangsters/circularbarpager/library/viewpager/WrapContentViewPager.java:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2015 Omada Health, Inc
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 | package com.github.OrangeGangsters.circularbarpager.library.viewpager;
25 |
26 | import android.content.Context;
27 | import android.support.v4.view.ViewPager;
28 | import android.util.AttributeSet;
29 | import android.util.Log;
30 | import android.view.MotionEvent;
31 | import android.view.View;
32 |
33 | /**
34 | * Created by oliviergoutay on 12/9/14.
35 | */
36 | public class WrapContentViewPager extends ViewPager {
37 |
38 | private static final String TAG = "WrapContentViewPager";
39 |
40 | public WrapContentViewPager(Context context) {
41 | super(context);
42 | }
43 |
44 | public WrapContentViewPager(Context context, AttributeSet attrs) {
45 | super(context, attrs);
46 | }
47 |
48 | /**
49 | * Fixes for "java.lang.IndexOutOfBoundsException Invalid index 0, size is 0"
50 | * on "android.support.v4.view.ViewPager.performDrag"
51 | */
52 | @Override
53 | public boolean onInterceptTouchEvent(MotionEvent event) {
54 | try {
55 | if (event == null || getAdapter() == null || getAdapter().getCount() == 0) {
56 | return false;
57 | }
58 | return super.onInterceptTouchEvent(event);
59 | } catch (RuntimeException e) {
60 | Log.e(TAG, "Exception during WrapContentViewPager onTouchEvent: " +
61 | "index out of bound, or nullpointer even if we check the adapter before " + e.toString());
62 | return false;
63 | }
64 | }
65 |
66 | /**
67 | * Fixes for "java.lang.IndexOutOfBoundsException Invalid index 0, size is 0"
68 | * on "android.support.v4.view.ViewPager.performDrag"
69 | */
70 | @Override
71 | public boolean onTouchEvent(MotionEvent ev) {
72 | try {
73 | if (ev == null || getAdapter() == null || getAdapter().getCount() == 0) {
74 | return false;
75 | }
76 | return super.onTouchEvent(ev);
77 | } catch (RuntimeException e) {
78 | Log.e(TAG, "Exception during WrapContentViewPager onTouchEvent: " +
79 | "index out of bound, or nullpointer even if we check the adapter before " + e.toString());
80 | return false;
81 | }
82 | }
83 |
84 | /**
85 | * Allows to redraw the view size to wrap the content of the bigger child.
86 | *
87 | * @param widthMeasureSpec with measured
88 | * @param heightMeasureSpec height measured
89 | */
90 | @Override
91 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
92 | try {
93 | int mode = MeasureSpec.getMode(heightMeasureSpec);
94 |
95 | if (mode == MeasureSpec.UNSPECIFIED || mode == MeasureSpec.AT_MOST) {
96 | super.onMeasure(widthMeasureSpec, heightMeasureSpec);
97 | int height = 0;
98 | for (int i = 0; i < getChildCount(); i++) {
99 | View child = getChildAt(i);
100 | if (child != null) {
101 | child.measure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
102 | int h = child.getMeasuredHeight();
103 | if (h > height) {
104 | height = h;
105 | }
106 | }
107 | }
108 | heightMeasureSpec = MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY);
109 | }
110 |
111 | super.onMeasure(widthMeasureSpec, heightMeasureSpec);
112 | } catch (RuntimeException e) {
113 | Log.e(TAG, "Exception during WrapContentViewPager onMeasure " + e.toString());
114 | }
115 | }
116 |
117 | @Override
118 | protected int getChildDrawingOrder(int childCount, int i) {
119 | return i;
120 | }
121 | }
122 |
--------------------------------------------------------------------------------
/library/src/main/res/layout/circularbar_view_pager.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
15 |
16 |
23 |
24 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/library/src/main/res/values/attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/library/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | library
3 |
4 |
--------------------------------------------------------------------------------
/library/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
22 |
23 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':library'
2 |
--------------------------------------------------------------------------------