Skip to content

Commit

Permalink
v1.64 云同步:在任意一台设备上查看结果
Browse files Browse the repository at this point in the history
  • Loading branch information
njzjz committed Oct 5, 2016
1 parent 2373c4c commit 30834d4
Show file tree
Hide file tree
Showing 23 changed files with 1,292 additions and 352 deletions.
9 changes: 9 additions & 0 deletions .idea/libraries/avoscloud_sdk_v3_14_4.xml

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

11 changes: 11 additions & 0 deletions .idea/libraries/fastjson_1_1_39_leancloud.xml

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

11 changes: 11 additions & 0 deletions .idea/libraries/okhttp_2_6_0_leancloud.xml

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

11 changes: 11 additions & 0 deletions .idea/libraries/okio_1_6_0_leancloud.xml

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

563 changes: 260 additions & 303 deletions .idea/workspace.xml

Large diffs are not rendered by default.

21 changes: 12 additions & 9 deletions app/app.iml
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,6 @@
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
Expand All @@ -82,9 +74,16 @@
<sourceFolder url="file://$MODULE_DIR$/src/test/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/builds" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/animated-vector-drawable/23.4.0/jars" />
Expand Down Expand Up @@ -125,6 +124,7 @@
<orderEntry type="library" exported="" name="okio-1.6.0" level="project" />
<orderEntry type="library" exported="" name="mid-sdk-2.3" level="project" />
<orderEntry type="library" exported="" name="SocialSDK_umengsina" level="project" />
<orderEntry type="library" exported="" name="fastjson-1.1.39-leancloud" level="project" />
<orderEntry type="library" exported="" name="animated-vector-drawable-23.4.0" level="project" />
<orderEntry type="library" exported="" name="umeng_social_netv6.0.0" level="project" />
<orderEntry type="library" exported="" name="support-v4-23.4.0" level="project" />
Expand All @@ -133,11 +133,14 @@
<orderEntry type="library" exported="" name="SocialSDK_WeiXin_2" level="project" />
<orderEntry type="library" exported="" name="SocialSDK_QQZone_3" level="project" />
<orderEntry type="library" exported="" name="support-vector-drawable-23.4.0" level="project" />
<orderEntry type="library" exported="" name="okhttp-2.6.0-leancloud" level="project" />
<orderEntry type="library" exported="" name="appcompat-v7-23.4.0" level="project" />
<orderEntry type="library" exported="" name="design-23.4.0" level="project" />
<orderEntry type="library" exported="" name="umeng_social_apiv6.0.0" level="project" />
<orderEntry type="library" exported="" name="avoscloud-sdk-v3.14.4" level="project" />
<orderEntry type="library" exported="" name="SocialSDK_umengwx" level="project" />
<orderEntry type="library" exported="" name="SocialSDK_umengqq" level="project" />
<orderEntry type="library" exported="" name="okio-1.6.0-leancloud" level="project" />
<orderEntry type="library" exported="" name="ldrawer-0.1" level="project" />
<orderEntry type="library" exported="" name="umeng_social_viewv6.0.0" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="hamcrest-core-1.3" level="project" />
Expand Down
14 changes: 12 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,22 @@ android {
applicationId "com.njzjz.chemicaltools"
minSdkVersion 15
targetSdkVersion 23
versionCode 21
versionName "1.63"
versionCode 22
versionName "1.64"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions{
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
lintOptions {
abortOnError false
}
}

dependencies {
Expand All @@ -42,5 +49,8 @@ dependencies {
compile files('libs/umeng_social_apiv6.0.0.jar')
compile files('libs/umeng_social_netv6.0.0.jar')
compile files('libs/umeng_social_viewv6.0.0.jar')
compile ('com.android.support:support-v4:21.0.3')
// LeanCloud 基础包
compile ('cn.leancloud.android:avoscloud-sdk:v3.+')

}
49 changes: 29 additions & 20 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,34 +22,40 @@
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.USE_CREDENTIALS" />
<uses-permission android:name="android.permission.MANAGE_ACCOUNTS" />
<uses-permission android:name="android.permission.READ_PROFILE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />

<application
android:name=".App"
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:versionCode="4"
android:versionName="1.3"
android:name=".App"
>
android:versionName="1.3">
<activity android:name=".TitleActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".MainActivity"
android:label="@string/button_element"/>
<activity android:name=".MassActivity"
android:label="@string/button_mass"/>
<activity android:name=".AcidActivity"
android:label="@string/button_acid"/>
<activity android:name=".ExamActivity"
android:label="@string/button_exam"/>
<activity android:name=".SettingsActivity"
android:label="@string/button_Settings"/>
<activity
android:name=".MainActivity"
android:label="@string/button_element" />
<activity
android:name=".MassActivity"
android:label="@string/button_mass" />
<activity
android:name=".AcidActivity"
android:label="@string/button_acid" />
<activity
android:name=".ExamActivity"
android:label="@string/button_exam" />
<activity
android:name=".SettingsActivity"
android:label="@string/button_Settings" />
<!-- 请将value改为MTA分配的appkey < -->
<meta-data
android:name="TA_APPKEY"
Expand All @@ -69,7 +75,7 @@
<activity
android:name="com.tencent.tauth.AuthActivity"
android:launchMode="singleTask"
android:noHistory="true" >
android:noHistory="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />

Expand All @@ -81,18 +87,21 @@
</activity>
<activity
android:name="com.tencent.connect.common.AssistActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.Translucent.NoTitleBar"
android:configChanges="orientation|keyboardHidden|screenSize"/>
android:theme="@android:style/Theme.Translucent.NoTitleBar" />
<activity
android:name="com.umeng.socialize.editorpage.ShareActivity"
android:theme="@style/Theme.UMDefault"
android:excludeFromRecents="true"
/>
android:theme="@style/Theme.UMDefault" />

<meta-data
android:name="UMENG_APPKEY"
android:value="57f39f45e0f55a55be0043f3" >
</meta-data>
android:value="57f39f45e0f55a55be0043f3"></meta-data>

<activity
android:name=".LoginActivity"
android:label="@string/title_activity_login"></activity>
</application>

</manifest>
24 changes: 23 additions & 1 deletion app/src/main/java/com/njzjz/chemicaltools/AcidActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@
import android.widget.Switch;
import android.widget.TextView;

import com.avos.avoscloud.AVException;
import com.avos.avoscloud.AVObject;
import com.avos.avoscloud.AVUser;
import com.avos.avoscloud.GetCallback;
import com.mikepenz.aboutlibraries.Libs;
import com.tencent.stat.StatService;
import com.umeng.socialize.ShareAction;
Expand Down Expand Up @@ -155,13 +159,31 @@ public void onClick(View v) {
TextView acidTextview = (TextView) findViewById(R.id.acidTextview);
acidTextview.setText(Html.fromHtml(parseContent(acidOutput)));
PreferenceUtils.setPrefString(getApplicationContext(),"historyAcidOutput",acidOutput);
AVUser currentUser = AVUser.getCurrentUser();
if (currentUser != null) {
AVUser.getCurrentUser().put("historyAcidOutput", acidOutput);
AVUser.getCurrentUser().saveInBackground();
}
}else Snackbar.make(v, getResources().getString(R.string.error_name), Snackbar.LENGTH_LONG)
.setAction("Error", null).show();
}else Snackbar.make(v, getResources().getString(R.string.error_name), Snackbar.LENGTH_LONG)
.setAction("Error", null).show();
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(AcidActivity.this.getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
}});
AVUser currentUser = AVUser.getCurrentUser();
if (currentUser != null) {
// 有
AVUser.getCurrentUser().fetchIfNeededInBackground(new GetCallback<AVObject>() {
@Override
public void done(AVObject avObject, AVException e) {
// 调用 fetchIfNeededInBackground 和 refreshInBackground 效果是一样的。
String historyAcidOutput=avObject.getString("historyAcidOutput");
String pKw=avObject.getString("pKw");
PreferenceUtils.setPrefString(getApplicationContext(),"historyAcidOutput",historyAcidOutput);
PreferenceUtils.setPrefString(getApplicationContext(),"pKw",pKw);
}});
}
final EditText acidText_c = (EditText) findViewById(R.id.acidText_c);
final TextView acidTextview=(TextView) findViewById(R.id.acidTextview);
acidText_c.setOnEditorActionListener(new TextView.OnEditorActionListener() {
Expand Down Expand Up @@ -323,7 +345,7 @@ public boolean onOptionsItemSelected(MenuItem item) {
// startActivity(Intent.createChooser(share,
// getString(R.string.app_name)));
new ShareAction(this).withText(acidTextview.getText().toString())
.setDisplayList(/*SHARE_MEDIA.QQ,*/SHARE_MEDIA.QZONE,SHARE_MEDIA.WEIXIN,SHARE_MEDIA.WEIXIN_CIRCLE,/*SHARE_MEDIA.SINA,*/SHARE_MEDIA.SMS,SHARE_MEDIA.EMAIL,SHARE_MEDIA.MORE)
.setDisplayList(/*SHARE_MEDIA.QQ,*/SHARE_MEDIA.QZONE,SHARE_MEDIA.WEIXIN,SHARE_MEDIA.WEIXIN_CIRCLE,SHARE_MEDIA.WEIXIN_FAVORITE,/*SHARE_MEDIA.SINA,*/SHARE_MEDIA.SMS,SHARE_MEDIA.EMAIL,SHARE_MEDIA.MORE)
.open();
return true;
case R.id.action_settings:
Expand Down
7 changes: 6 additions & 1 deletion app/src/main/java/com/njzjz/chemicaltools/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import android.app.Application;

import com.avos.avoscloud.AVOSCloud;
import com.sangbo.autoupdate.CheckVersion;
import com.tencent.stat.MtaSDkException;
import com.tencent.stat.StatService;
Expand All @@ -18,14 +19,18 @@ public class App extends Application {

PlatformConfig.setWeixin("wxce20db4ddce39c01", "7f42598bfdbfb74be4eaa121baef6746");
PlatformConfig.setSinaWeibo("3921700954", "04b48b094faeb16683c32669824ebdad");
PlatformConfig.setQQZone("100424468", "c7394704798a158208a74ab60104f0ba");
PlatformConfig.setQQZone("1105651247", "P4CtQZJ1Sb5wRKus");
}
@Override
public void onCreate() {
super.onCreate();
UMShareAPI.get(this);
Config.REDIRECT_URL = "http://sns.whalecloud.com/sina2/callback";
String appkey = "A55JRMC53SPT";

// 初始化参数依次为 this, AppId, AppKey
AVOSCloud.initialize(this,"wUzGKF5dp34OqCeaI0VwVG8E-gzGzoHsz","QiyXtJjBHFJCIVYQRbrKFiB7");

// 在startStatService之前调用StatConfig配置类接口,使得MTA配置及时生效
// 初始化并启动MTA
// 第三方SDK必须按以下代码初始化MTA,其中appkey为规定的格式或MTA分配的代码。
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public void onClick(View v) {
if(!historyElementOutput.equals(getResources().getString(R.string.button_notUsed))){
x=itemText.getText().toString();
}else{
x=getString(R.string.app_name)+"\nhttps://github.com/njzjz/Chemical-Tools-for-Android";
x=getString(R.string.app_name)+"\nhttps://chem.njzjz.win/";
}
break;
case 4:
Expand All @@ -123,7 +123,7 @@ public void onClick(View v) {
double examCorrectPercent=(double)examCorrectNumber/sum*100;
x=String.format(getResources().getString(R.string.examScoreOutput_name),sum,examCorrectNumber,examCorrectPercent);
}else {
x=getString(R.string.app_name)+"\nhttps://github.com/njzjz/Chemical-Tools-for-Android";
x=getString(R.string.app_name)+"\nhttps://chem.njzjz.win/";
}
break;
}
Expand All @@ -136,7 +136,7 @@ public void onClick(View v) {
// startActivity(Intent.createChooser(share,
// getString(R.string.app_name)));
new ShareAction(getActivity()).withText(x)
.setDisplayList(/*SHARE_MEDIA.QQ,*/SHARE_MEDIA.QZONE,SHARE_MEDIA.WEIXIN,SHARE_MEDIA.WEIXIN_CIRCLE,/*SHARE_MEDIA.SINA,*/SHARE_MEDIA.SMS,SHARE_MEDIA.EMAIL,SHARE_MEDIA.MORE)
.setDisplayList(/*SHARE_MEDIA.QQ,*/SHARE_MEDIA.QZONE,SHARE_MEDIA.WEIXIN,SHARE_MEDIA.WEIXIN_CIRCLE,SHARE_MEDIA.WEIXIN_FAVORITE,/*SHARE_MEDIA.SINA,*/SHARE_MEDIA.SMS,SHARE_MEDIA.EMAIL,SHARE_MEDIA.MORE)
.open();
} else if (v == cardsList.getChildAt(i - cardsList.getFirstVisiblePosition()).findViewById(R.id.list_item_card_button_2)) {
// PERFORM ANOTHER ACTION WITH THE ITEM AT POSITION i
Expand Down
Loading

0 comments on commit 30834d4

Please sign in to comment.