Initial commit

This commit is contained in:
iweizime
2017-09-06 20:50:40 +08:00
commit 56a1285f52
91 changed files with 2399 additions and 0 deletions
+6
View File
@@ -0,0 +1,6 @@
*.iml
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
/build
+22
View File
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<resourceExtensions />
<wildcardResourcePatterns>
<entry name="!?*.java" />
<entry name="!?*.form" />
<entry name="!?*.class" />
<entry name="!?*.groovy" />
<entry name="!?*.scala" />
<entry name="!?*.flex" />
<entry name="!?*.kt" />
<entry name="!?*.clj" />
<entry name="!?*.aj" />
</wildcardResourcePatterns>
<annotationProcessing>
<profile default="true" name="Default" enabled="false">
<processorPath useClasspath="true" />
</profile>
</annotationProcessing>
</component>
</project>
+3
View File
@@ -0,0 +1,3 @@
<component name="CopyrightManager">
<settings default="" />
</component>
+11
View File
@@ -0,0 +1,11 @@
<component name="ProjectDictionaryState">
<dictionary name="iweiz">
<words>
<w>alipay</w>
<w>gphone</w>
<w>pedo</w>
<w>stepchanger</w>
<w>stepinfo</w>
</words>
</dictionary>
</component>
+18
View File
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
</set>
</option>
<option name="resolveModulePerSourceSet" value="false" />
</GradleProjectSettings>
</option>
</component>
</project>
+72
View File
@@ -0,0 +1,72 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="MarkdownProjectSettings">
<PreviewSettings splitEditorLayout="SPLIT" splitEditorPreview="PREVIEW" useGrayscaleRendering="false" zoomFactor="1.0" maxImageWidth="0" showGitHubPageIfSynced="false" allowBrowsingInPreview="false" synchronizePreviewPosition="true" highlightPreviewType="NONE" highlightFadeOut="5" highlightOnTyping="true" synchronizeSourcePosition="true" verticallyAlignSourceAndPreviewSyncPosition="true" showSearchHighlightsInPreview="false" showSelectionInPreview="true">
<PanelProvider>
<provider providerId="com.vladsch.idea.multimarkdown.editor.swing.html.panel" providerName="Default - Swing" />
</PanelProvider>
</PreviewSettings>
<ParserSettings gitHubSyntaxChange="false">
<PegdownExtensions>
<option name="ABBREVIATIONS" value="false" />
<option name="ANCHORLINKS" value="true" />
<option name="ASIDE" value="false" />
<option name="ATXHEADERSPACE" value="true" />
<option name="AUTOLINKS" value="true" />
<option name="DEFINITIONS" value="false" />
<option name="DEFINITION_BREAK_DOUBLE_BLANK_LINE" value="false" />
<option name="FENCED_CODE_BLOCKS" value="true" />
<option name="FOOTNOTES" value="false" />
<option name="HARDWRAPS" value="false" />
<option name="HTML_DEEP_PARSER" value="false" />
<option name="INSERTED" value="false" />
<option name="QUOTES" value="false" />
<option name="RELAXEDHRULES" value="true" />
<option name="SMARTS" value="false" />
<option name="STRIKETHROUGH" value="true" />
<option name="SUBSCRIPT" value="false" />
<option name="SUPERSCRIPT" value="false" />
<option name="SUPPRESS_HTML_BLOCKS" value="false" />
<option name="SUPPRESS_INLINE_HTML" value="false" />
<option name="TABLES" value="true" />
<option name="TASKLISTITEMS" value="true" />
<option name="TOC" value="false" />
<option name="WIKILINKS" value="true" />
</PegdownExtensions>
<ParserOptions>
<option name="COMMONMARK_LISTS" value="true" />
<option name="DUMMY" value="false" />
<option name="EMOJI_SHORTCUTS" value="true" />
<option name="FLEXMARK_FRONT_MATTER" value="false" />
<option name="GFM_LOOSE_BLANK_LINE_AFTER_ITEM_PARA" value="false" />
<option name="GFM_TABLE_RENDERING" value="true" />
<option name="GITBOOK_URL_ENCODING" value="false" />
<option name="GITHUB_EMOJI_URL" value="false" />
<option name="GITHUB_LISTS" value="false" />
<option name="GITHUB_WIKI_LINKS" value="true" />
<option name="JEKYLL_FRONT_MATTER" value="false" />
<option name="SIM_TOC_BLANK_LINE_SPACER" value="true" />
</ParserOptions>
</ParserSettings>
<HtmlSettings headerTopEnabled="false" headerBottomEnabled="false" bodyTopEnabled="false" bodyBottomEnabled="false" embedUrlContent="false" addPageHeader="true">
<GeneratorProvider>
<provider providerId="com.vladsch.idea.multimarkdown.editor.swing.html.generator" providerName="Default Swing HTML Generator" />
</GeneratorProvider>
<headerTop />
<headerBottom />
<bodyTop />
<bodyBottom />
</HtmlSettings>
<CssSettings previewScheme="UI_SCHEME" cssUri="" isCssUriEnabled="false" isCssTextEnabled="false" isDynamicPageWidth="true">
<StylesheetProvider>
<provider providerId="com.vladsch.idea.multimarkdown.editor.swing.html.css" providerName="Default Swing Stylesheet" />
</StylesheetProvider>
<ScriptProviders />
<cssText />
</CssSettings>
<HtmlExportSettings updateOnSave="false" parentDir="$ProjectFileDir$" targetDir="$ProjectFileDir$" cssDir="" scriptDir="" plainHtml="false" imageDir="" copyLinkedImages="false" imageUniquifyType="0" targetExt="" useTargetExt="false" noCssNoScripts="false" linkToExportedHtml="true" exportOnSettingsChange="true" regenerateOnProjectOpen="false" />
<LinkMapSettings>
<textMaps />
</LinkMapSettings>
</component>
</project>
+3
View File
@@ -0,0 +1,3 @@
<component name="MarkdownNavigator.ProfileManager">
<settings default="" pdf-export="" />
</component>
+46
View File
@@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="EntryPointsManager">
<entry_points version="2.0" />
</component>
<component name="NullableNotNullManager">
<option name="myDefaultNullable" value="android.support.annotation.Nullable" />
<option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
<option name="myNullables">
<value>
<list size="4">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
</list>
</value>
</option>
<option name="myNotNulls">
<value>
<list size="4">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" />
</list>
</value>
</option>
</component>
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
<OptionsSetting value="true" id="Add" />
<OptionsSetting value="true" id="Remove" />
<OptionsSetting value="true" id="Checkout" />
<OptionsSetting value="true" id="Update" />
<OptionsSetting value="true" id="Status" />
<OptionsSetting value="true" id="Edit" />
<ConfirmationsSetting value="0" id="Add" />
<ConfirmationsSetting value="0" id="Remove" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
</project>
+9
View File
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/StepChanger.iml" filepath="$PROJECT_DIR$/StepChanger.iml" />
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
</modules>
</component>
</project>
+12
View File
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RunConfigurationProducerService">
<option name="ignoredProducers">
<set>
<option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
</set>
</option>
</component>
</project>
Generated
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>
+24
View File
@@ -0,0 +1,24 @@
# 运动修改器
## 下载
[步数修改器](https://github.com/iweizime/StepChanger/releases)
## 注意
- 需要手机支持`Step Counter Sensor`
- 需要`Root`权限
- 不要一次改的太多,会被检测为异常
支持Android 5.1以上系统,仅在Android 7.x系统上测试过。
## 界面
<div align="center">
<img src="images/wechat_main.png" width="45%" title="微信主界面" alt="微信主界面" />
<img src="images/wechat_details.png" width="45%" title="微信详情界面" alt="微信详情界面" />
<img src="images/alipay_main.png" width="45%" title="支付宝主界面" alt="支付宝主界面" />
<img src="images/alipay_details.png" width="45%" title="支付宝详情界面" alt="支付宝详情界面" />
</div>
+2
View File
@@ -0,0 +1,2 @@
/build
/StepChanger-*-release.apk
+42
View File
@@ -0,0 +1,42 @@
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "me.iweizi.stepchanger"
minSdkVersion 21
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
applicationVariants.all { variant ->
variant.outputs.each { output ->
output.outputFile = new File(
output.outputFile.parent,
"StepChanger-${variant.versionName}-${variant.buildType.name}.apk")
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:recyclerview-v7:26.0.0-alpha1'
compile 'com.android.support:appcompat-v7:26.0.0-alpha1'
compile 'com.android.support:support-v4:26.0.0-alpha1'
compile 'com.android.support:design:26.0.0-alpha1'
compile 'eu.chainfire:libsuperuser:1.0.0.201704021214'
compile 'com.alibaba:fastjson:1.1.63.android'
testCompile 'junit:junit:4.12'
}
+25
View File
@@ -0,0 +1,25 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in C:\Users\iweiz\AppData\Local\Android\Sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
@@ -0,0 +1,26 @@
package me.iweizi.stepchanger;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.assertEquals;
/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("me.iweizi.stepchanger", appContext.getPackageName());
}
}
+34
View File
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="me.iweizi.stepchanger">
<uses-permission android:name="android.permission.KILL_BACKGROUND_PROCESSES"/>
<application
android:allowBackup="false"
android:icon="@mipmap/running"
android:label="@string/app_name"
android:roundIcon="@mipmap/running"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity
android:name=".wechat.WechatDetailsActivity"
android:label="@string/title_activity_wechat_details"
android:theme="@style/AppTheme.NoActionBar">
</activity>
<activity
android:name=".alipay.AlipayDetailsActivity"
android:label="@string/title_activity_alipay_details"
android:theme="@style/AppTheme.NoActionBar">
</activity>
</application>
</manifest>
@@ -0,0 +1,103 @@
package me.iweizi.stepchanger;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
public abstract class BaseDetailsActivity extends AppCompatActivity {
private Button mLoadButton;
private Button mBackButton;
private Button mStoreButton;
private TextView mLastUploadStepTV;
private TextView mLastUploadTimeTV;
private TextView mLastSaveTimeTV;
private TextView mLastSaveSensorStepTV;
protected int mLayoutId;
protected StepData mStepData;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(mLayoutId);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
findView();
setListener();
}
private void findView() {
mLastUploadStepTV = (TextView) findViewById(R.id.last_upload_step_text_view);
mLastUploadTimeTV = (TextView) findViewById(R.id.last_upload_time_text_view);
mLastSaveTimeTV = (TextView) findViewById(R.id.last_save_time_text_view);
mLastSaveSensorStepTV = (TextView) findViewById(R.id.last_save_sensor_step_text_view);
mLoadButton = (Button) findViewById(R.id.details_load_button);
mBackButton = (Button) findViewById(R.id.details_back_button);
mStoreButton = (Button) findViewById(R.id.details_store_button);
}
private void setListener() {
mLoadButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
int result = mStepData.load(BaseDetailsActivity.this);
if (result == StepData.SUCCESS) {
updateUI();
Toast.makeText(BaseDetailsActivity.this, R.string.loaded, Toast.LENGTH_SHORT).show();
}
}
});
mBackButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
finish();
}
});
mStoreButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
int result = mStepData.store(BaseDetailsActivity.this);
if (result == StepData.SUCCESS) {
Toast.makeText(BaseDetailsActivity.this, R.string.stored, Toast.LENGTH_SHORT).show();
} else if (result == StepData.CANCEL) {
Toast.makeText(BaseDetailsActivity.this, R.string.canceled, Toast.LENGTH_SHORT).show();
} else if (result == StepData.NEED_LOAD) {
Toast.makeText(BaseDetailsActivity.this, R.string.need_load, Toast.LENGTH_SHORT).show();
}
}
});
}
@Override
protected void onResume() {
super.onResume();
updateUI();
}
private void updateUI() {
if (mStepData.isLoaded()) {
DateFormat dateFormat = new SimpleDateFormat("yyyy年MM月dd日 HH:mm:ss.SSS", Locale.CHINA);
Date date = new Date();
mLastUploadStepTV.setText(String.valueOf(mStepData.getLastUploadStep()));
date.setTime(mStepData.getLastUploadTime());
mLastUploadTimeTV.setText(dateFormat.format(date));
date.setTime(mStepData.getLastSaveTime());
mLastSaveTimeTV.setText(dateFormat.format(date));
mLastSaveSensorStepTV.setText(String.valueOf(mStepData.getLastSaveSensorStep()));
}
}
}
@@ -0,0 +1,137 @@
package me.iweizi.stepchanger;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.Toast;
/**
* Created by iweiz on 2017/9/5.
* BaseFragment是 WechatFragment和 AlipayFragment的父类
*/
public class BaseFragment extends Fragment {
private static final int COUNTER_DIFF = 1000;
protected Button mLoadButton;
protected Button mStoreButton;
protected Button mDetailsButton;
protected EditText mCurrentTodayStepEditText;
protected ImageButton mStepIncImageButton;
protected ImageButton mStepDecImageButton;
protected int mLayoutId;
protected StepData mStepData;
protected Class mDetailsClass;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(mLayoutId, container, false);
findView(view);
setListener();
return view;
}
private void setListener() {
mStepIncImageButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mStepData.changeStep(COUNTER_DIFF);
updateUI();
}
});
mStepDecImageButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mStepData.changeStep(-COUNTER_DIFF);
updateUI();
}
});
mCurrentTodayStepEditText.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
if (s.length() == 0) {
s = "0";
}
mStepData.setStep(Integer.valueOf(s.toString()));
}
@Override
public void afterTextChanged(Editable s) {
}
});
mLoadButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
int result = mStepData.load(getActivity());
if (result == StepData.SUCCESS) {
updateUI();
Toast.makeText(getActivity(), R.string.loaded, Toast.LENGTH_SHORT).show();
}
}
});
mStoreButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
int result = mStepData.store(getActivity());
if (result == StepData.SUCCESS) {
Toast.makeText(getActivity(), R.string.stored, Toast.LENGTH_SHORT).show();
} else if (result == StepData.CANCEL) {
Toast.makeText(getActivity(), R.string.canceled, Toast.LENGTH_SHORT).show();
} else if (result == StepData.NEED_LOAD) {
Toast.makeText(getContext(), R.string.need_load, Toast.LENGTH_SHORT).show();
}
}
});
mDetailsButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (mDetailsClass != null) {
Intent intent = new Intent(getActivity(), mDetailsClass);
startActivity(intent);
}
}
});
}
// 子类应该实现
protected void findView(View view) {
}
@Override
public void onResume() {
super.onResume();
updateUI();
}
private void updateUI() {
if (mStepData.getStep() >= 0) {
mCurrentTodayStepEditText.setText(String.valueOf(mStepData.getStep()));
}
}
}
@@ -0,0 +1,84 @@
package me.iweizi.stepchanger;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.design.widget.BottomNavigationView;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.view.MenuItem;
import java.util.ArrayList;
import me.iweizi.stepchanger.alipay.AlipayFragment;
import me.iweizi.stepchanger.utils.StepCounterSensorListener;
import me.iweizi.stepchanger.wechat.WechatFragment;
public class MainActivity extends AppCompatActivity implements ViewPager.OnPageChangeListener {
private BottomNavigationView mBottomNavigationView;
private ViewPager mViewPager;
private ArrayList<Fragment> mFragments;
private final BottomNavigationView.OnNavigationItemSelectedListener mOnNavigationItemSelectedListener
= new BottomNavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
mViewPager.setCurrentItem(item.getOrder());
return true;
}
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
StepCounterSensorListener.get(this).register();
mBottomNavigationView = (BottomNavigationView) findViewById(R.id.navigation);
mBottomNavigationView.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener);
// mFragments.add顺序需要和res/menu/navigation.xml中的orderInCategory 0,1保持一致
mFragments = new ArrayList<>();
mFragments.add(WechatFragment.newInstance());
mFragments.add(AlipayFragment.newInstance());
FragmentManager fragmentManager = getSupportFragmentManager();
mViewPager = (ViewPager) findViewById(R.id.view_pager);
mViewPager.setAdapter(new FragmentPagerAdapter(fragmentManager) {
@Override
public Fragment getItem(int position) {
return mFragments.get(position);
}
@Override
public int getCount() {
return mFragments.size();
}
});
mViewPager.addOnPageChangeListener(this);
}
@Override
public void onPageScrollStateChanged(int state) {
}
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
}
@Override
public void onPageSelected(int position) {
mBottomNavigationView.getMenu().getItem(position).setChecked(true);
}
@Override
public void onDestroy() {
StepCounterSensorListener.get(this).unregister();
super.onDestroy();
}
}
@@ -0,0 +1,254 @@
package me.iweizi.stepchanger;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.os.AsyncTask;
import android.support.v7.app.AlertDialog;
import eu.chainfire.libsuperuser.Shell;
/**
* Created by iweiz on 2017/9/5.
* 步数数据父类
*/
public class StepData {
public static final int SUCCESS = 0;
public static final int FAIL = 1;
public static final int ROOTING = 2;
public static final int CANCEL = 3;
public static final int NEED_LOAD = 4;
private static final int TOO_FAST = 5;
private static final int TOO_MANY = 6;
private static final int TOO_MANY_FAST = 7;
private static final double MAX_STEP_PER_SEC = 5.0;
private static final int MAX_STEP = 80000;
private long mStep;
private boolean isChecked;
private boolean isContinue;
protected String[] ROOT_CMD;
protected int mLoadButtonId;
protected int mStoreButtonId;
class RootTask extends AsyncTask<Boolean, Void, Void> {
private Context mContext = null;
private boolean mSuAvailable;
@SuppressWarnings("deprecation")
private ProgressDialog mProgressDialog = null;
private AlertDialog mAlertDialog = null;
private boolean isRead;
public RootTask(Context context) {
mContext = context;
}
@Override
protected void onPreExecute() {
//noinspection deprecation
mProgressDialog = new ProgressDialog(mContext);
mProgressDialog.setTitle(R.string.require_access_title);
mProgressDialog.setMessage(mContext.getString(R.string.require_access_message));
mProgressDialog.setIndeterminate(true);
mProgressDialog.setCancelable(false);
mProgressDialog.show();
}
@Override
protected Void doInBackground(Boolean... booleans) {
isRead = booleans[0];
mSuAvailable = Shell.SU.available();
if (mSuAvailable) {
Shell.SU.run(ROOT_CMD);
}
return null;
}
@Override
protected void onPostExecute(Void results) {
mProgressDialog.dismiss();
if (mSuAvailable) {
if (isRead && canRead()) {
((Activity) mContext).findViewById(mLoadButtonId).performClick();
} else if (canWrite()) {
((Activity) mContext).findViewById(mStoreButtonId).performClick();
}
} else {
AlertDialog.Builder builder = new AlertDialog.Builder(mContext)
.setTitle(R.string.note)
.setMessage(R.string.require_failed_message)
.setCancelable(true);
mAlertDialog = builder.create();
mAlertDialog.show();
}
}
}
protected StepData() {
mStep = -1;
isChecked = false;
isContinue = true;
}
public final long getStep() {
return mStep;
}
public final void setStep(long step) {
mStep = step;
}
public final void changeStep(long diff) {
mStep = mStep + diff;
if (mStep < 0) {
mStep = 0;
}
}
private int check() {
long current = System.currentTimeMillis();
long lastUploadTime = getLastUploadTime();
double timeDiff = (current - lastUploadTime) / 1000;
long step = getStep();
long stepDiff = step - getLastUploadStep();
double stepPerSec = stepDiff / timeDiff;
if (step > MAX_STEP && stepPerSec > MAX_STEP_PER_SEC) {
return TOO_MANY_FAST;
} else if (step > MAX_STEP) {
return TOO_MANY;
} else if (stepPerSec > MAX_STEP_PER_SEC) {
return TOO_FAST;
}
return SUCCESS;
}
public final int load(final Context context) {
int readResult;
if (!canRead()) {
(new RootTask(context)).execute(true);
return ROOTING;
}
readResult = read(context);
mStep = getLastUploadStep();
return readResult;
}
public final int store(final Context context) {
int checkResult;
int writeResult;
if (!isLoaded()) {
return NEED_LOAD;
}
if (!isChecked) {
checkResult = check();
isChecked = true;
if (checkResult != SUCCESS) {
String message;
switch (checkResult) {
case TOO_FAST:
message = context.getString(R.string.too_fast);
break;
case TOO_MANY:
message = context.getString(R.string.too_many);
break;
case TOO_MANY_FAST:
message = context.getString(R.string.too_many_fast);
break;
default:
message = "";
}
AlertDialog.Builder builder = new AlertDialog.Builder(context)
.setTitle(R.string.note)
.setMessage(message + context.getString(R.string.is_continue))
.setCancelable(false)
.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
isContinue = true;
((Activity) context).findViewById(mStoreButtonId).performClick();
}
})
.setNegativeButton(R.string.no, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
isContinue = false;
((Activity) context).findViewById(mStoreButtonId).performClick();
}
});
builder.create().show();
return checkResult;
}
}
if (!isContinue) {
isContinue = true;
isChecked = false;
return CANCEL;
}
if (!canWrite()) {
(new RootTask(context)).execute(false);
return ROOTING;
}
writeResult = write(context);
isChecked = false;
isContinue = true;
return writeResult;
}
// 子类应该实现
protected boolean canRead() {
return false;
}
// 子类应该实现
protected boolean canWrite() {
return false;
}
// 子类应该实现
protected int read(Context context) {
return FAIL;
}
// 子类应该实现
protected int write(Context context) {
return FAIL;
}
// 子类应该实现
public long getLastUploadTime() {
return -1;
}
// 子类应该实现
public long getLastUploadStep() {
return -1;
}
// 子类应该实现
public long getLastSaveTime() {
return -1;
}
// 子类应该实现
public long getLastSaveSensorStep() {
return -1;
}
// 子类应该实现
public boolean isLoaded() {
return false;
}
}
@@ -0,0 +1,43 @@
package me.iweizi.stepchanger.alipay;
/**
* Created by iweiz on 2017/9/5.
* 支付宝步数数据记录
*/
@SuppressWarnings("unused")
class APStepInfo {
private String biz;
private int steps;
private long time;
APStepInfo() {
biz = "";
steps = 0;
time = 0;
}
public String getBiz() {
return biz;
}
public void setBiz(String biz) {
this.biz = biz;
}
public int getSteps() {
return steps;
}
public void setSteps(int steps) {
this.steps = steps;
}
public long getTime() {
return time;
}
public void setTime(long time) {
this.time = time;
}
}
@@ -0,0 +1,16 @@
package me.iweizi.stepchanger.alipay;
import android.os.Bundle;
import me.iweizi.stepchanger.BaseDetailsActivity;
import me.iweizi.stepchanger.R;
public class AlipayDetailsActivity extends BaseDetailsActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
mLayoutId = R.layout.activity_alipay_details;
mStepData = NewPedoMeter.get();
super.onCreate(savedInstanceState);
}
}
@@ -0,0 +1,34 @@
package me.iweizi.stepchanger.alipay;
import android.os.Bundle;
import android.view.View;
import me.iweizi.stepchanger.BaseFragment;
import me.iweizi.stepchanger.R;
public class AlipayFragment extends BaseFragment {
public AlipayFragment() {
mLayoutId = R.layout.fragment_alipay;
mStepData = NewPedoMeter.get();
mDetailsClass = AlipayDetailsActivity.class;
}
public static AlipayFragment newInstance() {
AlipayFragment fragment = new AlipayFragment();
Bundle args = new Bundle();
fragment.setArguments(args);
return fragment;
}
@Override
protected void findView(View view) {
mLoadButton = view.findViewById(R.id.alipay_load_button);
mStoreButton = view.findViewById(R.id.alipay_store_button);
mDetailsButton = view.findViewById(R.id.alipay_details_button);
mStepIncImageButton = view.findViewById(R.id.alipay_add_button);
mStepDecImageButton = view.findViewById(R.id.alipay_sub_button);
mCurrentTodayStepEditText = view.findViewById(R.id.alipay_current_today_step_edit_text);
}
}
@@ -0,0 +1,236 @@
package me.iweizi.stepchanger.alipay;
import android.annotation.SuppressLint;
import android.app.ActivityManager;
import android.content.Context;
import android.content.SharedPreferences;
import com.alibaba.fastjson.JSON;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import eu.chainfire.libsuperuser.Shell;
import me.iweizi.stepchanger.R;
import me.iweizi.stepchanger.StepData;
import me.iweizi.stepchanger.utils.StepCounterSensorListener;
/**
* Created by iweiz on 2017/9/5.
* 支付宝的步数数据类
*/
public class NewPedoMeter extends StepData {
@SuppressLint("SdCardPath")
private static final String ALIPAY_SP_DIR =
"/data/data/com.eg.android.AlipayGphone/shared_prefs/";
@SuppressLint("SdCardPath")
private static final String SP_DIR =
"/data/data/me.iweizi.stepchanger/shared_prefs/";
private static final String NEW_PEDOMETER = "NewPedoMeter.xml";
private static final String NEW_PEDOMETER_PRIVATE = "NewPedoMeter_private.xml";
private static final String ALIPAY = "com.eg.android.AlipayGphone";
private static final String ALIPAY_EXT = "com.eg.android.AlipayGphone:ext";
private static final NewPedoMeter sNewPedoMeter = new NewPedoMeter();
private final String mNewPedometer;
private final String mNewPedometerPrivate;
private final String mAlipayNewPedometer;
private final String mAlipayNewPedometerPrivate;
private SharedPreferences mNewPedometerSP;
private SharedPreferences mNewPedometerPrivateSP;
private final File mAlipayNewPedometerFile;
private final File mAlipayNewPedometerPrivateFile;
private NewPedoMeter() {
super();
mNewPedometer = SP_DIR + NEW_PEDOMETER;
mNewPedometerPrivate = SP_DIR + NEW_PEDOMETER_PRIVATE;
mAlipayNewPedometer = ALIPAY_SP_DIR + NEW_PEDOMETER;
mAlipayNewPedometerPrivate = ALIPAY_SP_DIR + NEW_PEDOMETER_PRIVATE;
mAlipayNewPedometerFile = new File(mAlipayNewPedometer);
mAlipayNewPedometerPrivateFile = new File(mAlipayNewPedometerPrivate);
File sp_dir = new File(SP_DIR);
if (!sp_dir.exists()) {
//noinspection ResultOfMethodCallIgnored
sp_dir.mkdir();
}
ROOT_CMD = new String[]{
"chmod o+rw " + mAlipayNewPedometer,
"chmod o+rw " + mAlipayNewPedometerPrivate,
};
mLoadButtonId = R.id.alipay_load_button;
mStoreButtonId = R.id.alipay_store_button;
}
public static NewPedoMeter get() {
return sNewPedoMeter;
}
@Override
public int read(Context context) {
killAlipayProcess(context);
Shell.SH.run(new String[]{
"cp " + mAlipayNewPedometerPrivate + " " + mNewPedometerPrivate,
"cp " + mAlipayNewPedometer + " " + mNewPedometer
});
mNewPedometerSP = context.getSharedPreferences("NewPedoMeter", Context.MODE_PRIVATE);
mNewPedometerPrivateSP = context.getSharedPreferences("NewPedoMeter_private", Context.MODE_PRIVATE);
return SUCCESS;
}
@Override
public int write(Context context) {
killAlipayProcess(context);
List<APStepInfo> stepRecord = getStepRecord();
APStepInfo lastRecord = getLastRecord();
if (lastRecord == null) {
lastRecord = new APStepInfo();
}
long stepDiff = getStep() - getLastUploadStep();
long sensorStep = StepCounterSensorListener.get(context).getStep();
stepDiff = stepDiff - sensorStep + lastRecord.getSteps();
for (APStepInfo apStepInfo :
stepRecord) {
apStepInfo.setSteps(apStepInfo.getSteps() - (int) stepDiff);
}
saveStepRecord(stepRecord);
Shell.SH.run(new String[]{
"cat " + mNewPedometerPrivate + " > " + mAlipayNewPedometerPrivate
});
return SUCCESS;
}
private APStepInfo getBaseStep() {
if (mNewPedometerSP == null) {
return null;
}
String baseStepStr = mNewPedometerSP.getString("baseStep", null);
if (baseStepStr == null || baseStepStr.isEmpty()) {
return null;
}
return JSON.parseObject(baseStepStr, APStepInfo.class);
}
private APStepInfo getLastStepInfoToday() {
if (mNewPedometerSP == null) {
return null;
}
String lastStepInfoTodayStr = mNewPedometerSP.getString("last_stepinfo_today", null);
if (lastStepInfoTodayStr == null || lastStepInfoTodayStr.isEmpty()) {
return null;
}
return JSON.parseObject(lastStepInfoTodayStr, APStepInfo.class);
}
private List<APStepInfo> getStepRecord() {
if (mNewPedometerPrivateSP == null) {
return new ArrayList<>();
}
String stepRecordStr = mNewPedometerPrivateSP.getString("stepRecord", null);
if (stepRecordStr == null) {
return new ArrayList<>();
}
return JSON.parseArray(stepRecordStr, APStepInfo.class);
}
@SuppressLint("ApplySharedPref")
private void saveStepRecord(List<APStepInfo> stepRecord) {
SharedPreferences.Editor editor = mNewPedometerPrivateSP.edit();
String stepRecordStr = JSON.toJSON(stepRecord).toString();
editor.putString("stepRecord", stepRecordStr);
editor.commit();
}
private void killAlipayProcess(Context context) {
ActivityManager am = (ActivityManager)
context.getSystemService(Context.ACTIVITY_SERVICE);
am.killBackgroundProcesses(ALIPAY);
am.killBackgroundProcesses(ALIPAY_EXT);
}
@Override
protected boolean canRead() {
return mAlipayNewPedometerFile.canRead() && mAlipayNewPedometerPrivateFile.canRead();
}
@Override
protected boolean canWrite() {
return mAlipayNewPedometerFile.canWrite() && mAlipayNewPedometerPrivateFile.canWrite();
}
@Override
public long getLastUploadStep() {
APStepInfo stepInfo = getBaseStep();
if (stepInfo != null) {
return stepInfo.getSteps();
}
stepInfo = getLastStepInfoToday();
if (stepInfo != null) {
return stepInfo.getSteps();
}
return -1;
}
@Override
public long getLastUploadTime() {
APStepInfo stepInfo = getBaseStep();
if (stepInfo != null) {
return stepInfo.getTime();
}
stepInfo = getLastStepInfoToday();
if (stepInfo != null) {
return stepInfo.getTime();
}
return -1;
}
private APStepInfo getLastRecord() {
if (mNewPedometerPrivateSP == null) {
return null;
}
String stepRecordStr = mNewPedometerPrivateSP.getString("stepRecord", null);
if (stepRecordStr == null || stepRecordStr.isEmpty()) {
return null;
}
List<APStepInfo> stepRecord = JSON.parseArray(stepRecordStr, APStepInfo.class);
if (stepRecord == null || stepRecord.isEmpty()) {
return null;
}
return stepRecord.get(stepRecord.size() - 1);
}
@Override
public long getLastSaveTime() {
APStepInfo lastRecord = getLastRecord();
if (lastRecord != null) {
return lastRecord.getTime();
} else {
return -1;
}
}
@Override
public long getLastSaveSensorStep() {
APStepInfo lastRecord = getLastRecord();
if (lastRecord != null) {
return lastRecord.getSteps();
} else {
return -1;
}
}
@Override
public boolean isLoaded() {
return mNewPedometerSP != null && mNewPedometerPrivateSP != null;
}
}
@@ -0,0 +1,59 @@
package me.iweizi.stepchanger.utils;
import android.content.Context;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
/**
* Created by iweiz on 2017/9/5.
* 计步传感器事件监听类,用于获取当前传感器步数
*/
public class StepCounterSensorListener implements SensorEventListener {
private static StepCounterSensorListener sStepCounterSensorListener;
private final SensorManager mSensorManager;
private int mStep;
private StepCounterSensorListener(Context context) {
mStep = -1;
mSensorManager = (SensorManager) context.getSystemService(Context.SENSOR_SERVICE);
}
public static StepCounterSensorListener get(Context context) {
if (sStepCounterSensorListener == null) {
sStepCounterSensorListener = new StepCounterSensorListener(context);
}
return sStepCounterSensorListener;
}
public void register() {
if (mSensorManager == null) {
return;
}
Sensor sensor = mSensorManager.getDefaultSensor(Sensor.TYPE_STEP_COUNTER);
mSensorManager.registerListener(this, sensor, SensorManager.SENSOR_DELAY_NORMAL);
}
public void unregister() {
if (mSensorManager == null) {
return;
}
mSensorManager.unregisterListener(this);
}
@Override
public void onAccuracyChanged(Sensor sensor, int accuracy) {
}
@Override
public void onSensorChanged(SensorEvent event) {
mStep = (int) event.values[0];
}
public int getStep() {
return mStep;
}
}
@@ -0,0 +1,166 @@
package me.iweizi.stepchanger.wechat;
import android.annotation.SuppressLint;
import android.app.ActivityManager;
import android.content.Context;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.HashMap;
import me.iweizi.stepchanger.R;
import me.iweizi.stepchanger.StepData;
/**
* Created by iweiz on 2017/9/4.
* 微信的步数数据类
*/
class StepCounterCfg extends StepData {
private static final int CURRENT_TODAY_STEP = 201;
private static final int PRE_SENSOR_STEP = 203;
private static final int LAST_SAVE_STEP_TIME = 204;
/*
static final int BEGIN_OF_TODAY = 202;
static final int REBOOT_TIME = 205;
static final int SENSOR_TIME_STAMP = 209;
*/
private static final int LAST_UPLOAD_TIME = 3;
private static final int LAST_UPLOAD_STEP = 4;
@SuppressLint("SdCardPath")
private static final String STEP_COUNTER_CFG = "/data/data/com.tencent.mm/MicroMsg/stepcounter.cfg";
@SuppressLint("SdCardPath")
private static final String MM_STEP_COUNTER_CFG = "/data/data/com.tencent.mm/MicroMsg/MM_stepcounter.cfg";
private static final String WECHAT = "com.tencent.mm";
private static final StepCounterCfg sStepCounterCfg = new StepCounterCfg();
private final File mStepCounterCfgFile;
private final File mMMStepCounterCfgFile;
private HashMap<Integer, Long> mStepCounterMap = null;
private HashMap<Integer, ?> mMMStepCounterMap = null;
private StepCounterCfg() {
super();
mStepCounterCfgFile = new File(STEP_COUNTER_CFG);
mMMStepCounterCfgFile = new File(MM_STEP_COUNTER_CFG);
ROOT_CMD = new String[]{
"chmod o+rw " + mStepCounterCfgFile.getAbsolutePath(),
"chmod o+rw " + mMMStepCounterCfgFile.getAbsolutePath(),
"chmod o+x " + mStepCounterCfgFile.getParent(),
"chmod o+x " + mMMStepCounterCfgFile.getParent()
};
mLoadButtonId = R.id.wechat_load_button;
mStoreButtonId = R.id.wechat_store_button;
}
static StepCounterCfg get() {
return sStepCounterCfg;
}
@Override
protected int read(Context context) {
FileInputStream fis;
ObjectInputStream ois;
try {
fis = new FileInputStream(mStepCounterCfgFile);
ois = new ObjectInputStream(fis);
//noinspection unchecked
mStepCounterMap = (HashMap<Integer, Long>) ois.readObject();
ois.close();
fis.close();
fis = new FileInputStream(mMMStepCounterCfgFile);
ois = new ObjectInputStream(fis);
//noinspection unchecked
mMMStepCounterMap = (HashMap<Integer, ?>) ois.readObject();
return SUCCESS;
} catch (Exception e) {
return FAIL;
}
}
@Override
protected int write(Context context) {
FileOutputStream fos;
ObjectOutputStream oos;
if (mStepCounterMap == null) {
return FAIL;
}
try {
ActivityManager am = (ActivityManager)
context.getSystemService(Context.ACTIVITY_SERVICE);
am.killBackgroundProcesses(WECHAT);
fos = new FileOutputStream(STEP_COUNTER_CFG);
oos = new ObjectOutputStream(fos);
mStepCounterMap.put(CURRENT_TODAY_STEP, getStep());
oos.writeObject(mStepCounterMap);
oos.close();
fos.close();
return SUCCESS;
} catch (Exception e) {
return FAIL;
}
}
@Override
protected boolean canRead() {
return mStepCounterCfgFile.canRead() && mMMStepCounterCfgFile.canRead();
}
@Override
protected boolean canWrite() {
return mStepCounterCfgFile.canWrite() && mMMStepCounterCfgFile.canWrite();
}
@Override
public long getLastUploadStep() {
if (mMMStepCounterMap != null) {
//noinspection unchecked
return ((HashMap<Integer, Long>) mMMStepCounterMap).get(LAST_UPLOAD_STEP);
} else {
return -1;
}
}
@Override
public long getLastUploadTime() {
if (mMMStepCounterMap != null) {
//noinspection unchecked
return ((HashMap<Integer, Long>) mMMStepCounterMap).get(LAST_UPLOAD_TIME);
} else {
return -1;
}
}
@Override
public long getLastSaveTime() {
if (mStepCounterMap != null) {
return mStepCounterMap.get(LAST_SAVE_STEP_TIME);
} else {
return -1;
}
}
@Override
public long getLastSaveSensorStep() {
if (mStepCounterMap != null) {
return mStepCounterMap.get(PRE_SENSOR_STEP);
} else {
return -1;
}
}
@Override
public boolean isLoaded() {
return mMMStepCounterMap != null && mStepCounterMap != null;
}
}
@@ -0,0 +1,16 @@
package me.iweizi.stepchanger.wechat;
import android.os.Bundle;
import me.iweizi.stepchanger.BaseDetailsActivity;
import me.iweizi.stepchanger.R;
public class WechatDetailsActivity extends BaseDetailsActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
mLayoutId = R.layout.activity_wechat_details;
mStepData = StepCounterCfg.get();
super.onCreate(savedInstanceState);
}
}
@@ -0,0 +1,33 @@
package me.iweizi.stepchanger.wechat;
import android.os.Bundle;
import android.view.View;
import me.iweizi.stepchanger.BaseFragment;
import me.iweizi.stepchanger.R;
public class WechatFragment extends BaseFragment {
public WechatFragment() {
mLayoutId = R.layout.fragment_wechat;
mStepData = StepCounterCfg.get();
mDetailsClass = WechatDetailsActivity.class;
}
public static WechatFragment newInstance() {
WechatFragment fragment = new WechatFragment();
Bundle args = new Bundle();
fragment.setArguments(args);
return fragment;
}
@Override
protected void findView(View view) {
mLoadButton = view.findViewById(R.id.wechat_load_button);
mStoreButton = view.findViewById(R.id.wechat_store_button);
mDetailsButton = view.findViewById(R.id.wechat_details_button);
mStepIncImageButton = view.findViewById(R.id.wechat_add_button);
mStepDecImageButton = view.findViewById(R.id.wechat_sub_button);
mCurrentTodayStepEditText = view.findViewById(R.id.wechat_current_today_step_edit_text);
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 161 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 756 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 910 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 768 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 176 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 129 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 751 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 912 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 779 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 220 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 148 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 371 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 215 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

+10
View File
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:angle="90"
android:endColor="#0000"
android:startColor="#30000000"
android:type="linear">
</gradient>
</shape>
@@ -0,0 +1,46 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="me.iweizi.stepchanger.alipay.AlipayDetailsActivity">
<android.support.design.widget.AppBarLayout
android:id="@+id/app_bar"
android:layout_width="match_parent"
android:layout_height="@dimen/app_bar_height"
android:fitsSystemWindows="true"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.design.widget.CollapsingToolbarLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:contentScrim="?attr/colorPrimary"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin"
app:popupTheme="@style/AppTheme.PopupOverlay"/>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<include layout="@layout/content_details"/>
<android.support.design.widget.FloatingActionButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/fab_margin"
app:backgroundTint="#fff"
app:layout_anchor="@id/app_bar"
app:layout_anchorGravity="bottom|end"
app:srcCompat="@drawable/alipay_icon_transparent"/>
</android.support.design.widget.CoordinatorLayout>
+32
View File
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="me.iweizi.stepchanger.MainActivity">
<android.support.design.widget.BottomNavigationView
android:id="@+id/navigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="?android:attr/windowBackground"
app:menu="@menu/navigation"/>
<android.support.v4.view.ViewPager
android:id="@+id/view_pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@id/navigation">
</android.support.v4.view.ViewPager>
<!--阴影-->
<View
android:layout_width="match_parent"
android:layout_height="8dp"
android:layout_above="@id/navigation"
android:background="@drawable/shadow"/>
</RelativeLayout>
@@ -0,0 +1,46 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="me.iweizi.stepchanger.wechat.WechatDetailsActivity">
<android.support.design.widget.AppBarLayout
android:id="@+id/app_bar"
android:layout_width="match_parent"
android:layout_height="@dimen/app_bar_height"
android:fitsSystemWindows="true"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.design.widget.CollapsingToolbarLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:contentScrim="?attr/colorPrimary"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin"
app:popupTheme="@style/AppTheme.PopupOverlay"/>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<include layout="@layout/content_details"/>
<android.support.design.widget.FloatingActionButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/fab_margin"
app:backgroundTint="#fff"
app:layout_anchor="@id/app_bar"
app:layout_anchorGravity="bottom|end"
app:srcCompat="@drawable/wechat_icon_transparent"/>
</android.support.design.widget.CoordinatorLayout>
+109
View File
@@ -0,0 +1,109 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.NestedScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="me.iweizi.stepchanger.wechat.WechatDetailsActivity"
tools:showIn="@layout/activity_wechat_details">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical"
android:paddingTop="30dp"
tools:context="me.iweizi.wechatstepchanger.DetailsActivity">
<TextView
style="?android:listSeparatorTextViewStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/last_upload_step"/>
<TextView
android:id="@+id/last_upload_step_text_view"
style="@style/number"
android:hint="@string/last_upload_step"
android:textAlignment="center"/>
<TextView
style="?android:listSeparatorTextViewStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="@string/last_upload_time"/>
<TextView
android:id="@+id/last_upload_time_text_view"
style="@style/number"
android:hint="@string/last_upload_time"
android:textAlignment="center"/>
<TextView
style="?android:listSeparatorTextViewStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="@string/last_save_time"/>
<TextView
android:id="@+id/last_save_time_text_view"
style="@style/number"
android:hint="@string/last_save_time"
android:textAlignment="center"/>
<TextView
style="?android:listSeparatorTextViewStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="@string/last_save_sensor_step"/>
<TextView
android:id="@+id/last_save_sensor_step_text_view"
style="@style/number"
android:hint="@string/last_save_sensor_step"
android:textAlignment="center"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="32dp"
android:gravity="center"
android:orientation="horizontal">
<Button
android:id="@+id/details_load_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/load"
tools:ignore="ButtonStyle"/>
<Button
android:id="@+id/details_back_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/back"
tools:ignore="ButtonStyle"/>
<Button
android:id="@+id/details_store_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/store"
tools:ignore="ButtonStyle"/>
</LinearLayout>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
+104
View File
@@ -0,0 +1,104 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical"
tools:context="me.iweizi.stepchanger.alipay.AlipayFragment">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleX="2"
android:scaleY="2"
android:src="@drawable/alipay_icon_round"
android:contentDescription="@string/alipay"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2"
android:gravity="top"
android:orientation="vertical">
<TextView
style="?android:listSeparatorTextViewStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/current_today_step"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal"
android:padding="24dp">
<ImageButton
android:id="@+id/alipay_sub_button"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:contentDescription="@string/decrease"
android:src="@drawable/ic_action_sub"/>
<EditText
android:id="@+id/alipay_current_today_step_edit_text"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="3"
android:hint="@string/current_today_step"
android:inputType="number"
android:textAlignment="center"/>
<ImageButton
android:id="@+id/alipay_add_button"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:contentDescription="@string/increase"
android:src="@drawable/ic_action_add"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal">
<Button
android:id="@+id/alipay_load_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/load"
tools:ignore="ButtonStyle"/>
<Button
android:id="@+id/alipay_details_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/details"
tools:ignore="ButtonStyle"/>
<Button
android:id="@+id/alipay_store_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/store"
tools:ignore="ButtonStyle"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
+104
View File
@@ -0,0 +1,104 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical"
tools:context="me.iweizi.stepchanger.wechat.WechatFragment">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleX="2"
android:scaleY="2"
android:src="@drawable/wechat_icon_round"
android:contentDescription="@string/wechat"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2"
android:gravity="top"
android:orientation="vertical">
<TextView
style="?android:listSeparatorTextViewStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/current_today_step"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal"
android:padding="24dp">
<ImageButton
android:id="@+id/wechat_sub_button"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:contentDescription="@string/decrease"
android:src="@drawable/ic_action_sub"/>
<EditText
android:id="@+id/wechat_current_today_step_edit_text"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="3"
android:hint="@string/current_today_step"
android:inputType="number"
android:textAlignment="center"/>
<ImageButton
android:id="@+id/wechat_add_button"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:contentDescription="@string/increase"
android:src="@drawable/ic_action_add"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal">
<Button
android:id="@+id/wechat_load_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/load"
tools:ignore="ButtonStyle"/>
<Button
android:id="@+id/wechat_details_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/details"
tools:ignore="ButtonStyle"/>
<Button
android:id="@+id/wechat_store_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/store"
tools:ignore="ButtonStyle"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
+13
View File
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:icon="@drawable/wechat_icon"
android:orderInCategory="0"
android:title="@string/wechat"/>
<item
android:icon="@drawable/alipay_icon"
android:orderInCategory="1"
android:title="@string/alipay"/>
</menu>
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

@@ -0,0 +1,5 @@
<resources>
<!-- Example customization of dimensions originally defined in res/values/dimens.xml
(such as screen margins) for screens with more than 820dp of available width. This
would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). -->
</resources>
+7
View File
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color>
<color name="text">#000</color>
</resources>
+5
View File
@@ -0,0 +1,5 @@
<resources>
<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="fab_margin">16dp</dimen>
<dimen name="app_bar_height">200dp</dimen>
</resources>
+33
View File
@@ -0,0 +1,33 @@
<resources>
<string name="app_name">步数修改器</string>
<string name="wechat">微信</string>
<string name="alipay">支付宝</string>
<string name="current_today_step">当前今日步数</string>
<string name="increase">增加</string>
<string name="decrease">减少</string>
<string name="load">加载</string>
<string name="store">保存</string>
<string name="details">详情</string>
<string name="back">返回</string>
<string name="require_access_title">获取权限</string>
<string name="require_access_message">正在获取读写权限……</string>
<string name="require_failed_message">你的设备没有root</string>
<string name="loaded">已加载</string>
<string name="stored">已保存</string>
<string name="canceled">已取消</string>
<string name="title_activity_wechat_details">微信运动详情</string>
<string name="title_activity_alipay_details">支付宝运动详情</string>
<string name="too_fast">你走的太快了,修改可能会失败!</string>
<string name="too_many">你走的太多了,修改可能会失败!</string>
<string name="too_many_fast">你走的太多太快了,修改可能会失败!</string>
<string name="need_load">请先加载</string>
<string name="yes">是</string>
<string name="no">否</string>
<string name="note">注意</string>
<string name="is_continue">是否继续?</string>
<string name="last_upload_step">最后上传步数</string>
<string name="last_upload_time">最后上传时间</string>
<string name="last_save_time">最后保存时间</string>
<string name="last_save_sensor_step">最后传感器步数</string>
</resources>
+29
View File
@@ -0,0 +1,29 @@
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar"/>
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light"/>
<style name="number">
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_width">match_parent</item>
<item name="android:layout_marginLeft">64dp</item>
<item name="android:layout_marginRight">64dp</item>
<item name="android:textSize">20sp</item>
<item name="android:textColor">@color/text</item>
</style>
</resources>
@@ -0,0 +1,17 @@
package me.iweizi.stepchanger;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
}
+23
View File
@@ -0,0 +1,23 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
+17
View File
@@ -0,0 +1,17 @@
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx1536m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
Binary file not shown.
+6
View File
@@ -0,0 +1,6 @@
#Mon Sep 04 18:39:38 CST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
Vendored
+160
View File
@@ -0,0 +1,160 @@
#!/usr/bin/env bash
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn ( ) {
echo "$*"
}
die ( ) {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
esac
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
Vendored
+90
View File
@@ -0,0 +1,90 @@
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windowz variants
if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
Binary file not shown.

After

Width:  |  Height:  |  Size: 112 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 112 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

+1
View File
@@ -0,0 +1 @@
include ':app'