Browse Source

增加极光推送,先注释启动页

master
lh 8 years ago
parent
commit
2fb9292874
10 changed files with 467 additions and 19 deletions
  1. +25
    -11
      app/build.gradle
  2. +159
    -5
      app/src/main/AndroidManifest.xml
  3. +10
    -0
      app/src/main/java/com/qhclh/ytzh/home/MyApplication.java
  4. +2
    -0
      app/src/main/java/com/qhclh/ytzh/home/RpcUrl.java
  5. +124
    -0
      app/src/main/java/com/qhclh/ytzh/index/MyBoradCReceiver.java
  6. +10
    -0
      app/src/main/java/com/qhclh/ytzh/index/MyJPReceiver.java
  7. +32
    -0
      app/src/main/java/com/qhclh/ytzh/index/TestActivity.java
  8. +2
    -2
      app/src/main/java/com/qhclh/ytzh/splash/SplashActivity.java
  9. +102
    -1
      app/src/main/java/com/qhclh/ytzh/work/productiondaily/ProductiondailyActivity.java
  10. +1
    -0
      gradle.properties

+ 25
- 11
app/build.gradle View File

@ -12,6 +12,18 @@ android {
versionCode 1 versionCode 1
versionName "1.0" versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
ndk {
//cpu类型的.so库
abiFilters 'armeabi', 'armeabi-v7a', 'arm64-v8a'
// 'x86', 'x86_64', 'mips', 'mips64'
}
manifestPlaceholders = [
JPUSH_PKGNAME : applicationId,
JPUSH_APPKEY : "53d7a345ed1d408462447820", //JPush上注册的包名对应的appkey.
JPUSH_CHANNEL : "developer-default", //.
]
} }
aaptOptions.cruncherEnabled = false // aaptOptions.cruncherEnabled = false //
aaptOptions.useNewCruncher = false aaptOptions.useNewCruncher = false
@ -28,37 +40,39 @@ dependencies {
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations' exclude group: 'com.android.support', module: 'support-annotations'
}) })
///<
///<
///< 广
///<
///<
///<
///<
///<
compile project(':jsonrpc') compile project(':jsonrpc')
///<
///<
compile 'com.android.support:appcompat-v7:26.+' compile 'com.android.support:appcompat-v7:26.+'
///<
compile 'com.github.bumptech.glide:glide:3.7.0' compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.android.support:support-v4:26.0.0-alpha1' compile 'com.android.support:support-v4:26.0.0-alpha1'
compile 'com.android.support:design:26.0.0-alpha1' compile 'com.android.support:design:26.0.0-alpha1'
///< 广
compile 'org.greenrobot:eventbus:3.0.0' compile 'org.greenrobot:eventbus:3.0.0'
///<
compile 'com.umeng.analytics:analytics:latest.integration' compile 'com.umeng.analytics:analytics:latest.integration'
///<
compile 'pub.devrel:easypermissions:0.2.1' compile 'pub.devrel:easypermissions:0.2.1'
compile 'com.google.code.gson:gson:2.8.1' compile 'com.google.code.gson:gson:2.8.1'
///<
compile 'org.litepal.android:core:1.3.0' compile 'org.litepal.android:core:1.3.0'
///<
compile 'com.journeyapps:zxing-android-embedded:3.5.0' compile 'com.journeyapps:zxing-android-embedded:3.5.0'
compile 'com.google.zxing:core:3.3.0' compile 'com.google.zxing:core:3.3.0'
///<
compile 'com.youth.banner:banner:1.4.10' compile 'com.youth.banner:banner:1.4.10'
compile 'com.android.support:cardview-v7:26.0.0-alpha1' compile 'com.android.support:cardview-v7:26.0.0-alpha1'
///<
compile 'com.github.lecho:hellocharts-library:1.5.8@aar' compile 'com.github.lecho:hellocharts-library:1.5.8@aar'
///<
compile 'com.prolificinteractive:material-calendarview:1.4.0' compile 'com.prolificinteractive:material-calendarview:1.4.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2' compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12' testCompile 'junit:junit:4.12'
// //
compile 'com.github.YancyYe:GalleryPick:1.2.1' compile 'com.github.YancyYe:GalleryPick:1.2.1'
///<
compile 'com.jakewharton:butterknife:8.5.1' compile 'com.jakewharton:butterknife:8.5.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1' annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
compile 'cn.jiguang.sdk:jpush:3.0.9' // JPush 3.0.9
compile 'cn.jiguang.sdk:jcore:1.1.7' // JCore 1.1.7
} }

+ 159
- 5
app/src/main/AndroidManifest.xml View File

@ -2,14 +2,35 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.qhclh.ytzh"> package="com.qhclh.ytzh">
<!-- Required -->
<permission
android:name="com.qhclh.ytzh.permission.JPUSH_MESSAGE"
android:protectionLevel="signature" />
<!-- 网络权限 --> <!-- 网络权限 -->
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CAMERA" />
<!-- Required -->
<uses-permission android:name="com.qhclh.ytzh.permission.JPUSH_MESSAGE" />
<uses-permission android:name="android.permission.RECEIVE_USER_PRESENT" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" /> <uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
<!-- Optional. Required for location feature -->
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" /> <!-- 用于开启 debug 版本的应用在6.0 系统上 层叠窗口权限 -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
<uses-permission android:name="android.permission.GET_TASKS" />
<application <application
android:name=".home.MyApplication" android:name=".home.MyApplication"
@ -31,7 +52,7 @@
</provider> </provider>
<activity <activity
android:name=".splash.SplashActivity"
android:name=".login.LoginActivity"
android:screenOrientation="portrait"> android:screenOrientation="portrait">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
@ -42,9 +63,9 @@
<activity <activity
android:name=".home.MainActivity" android:name=".home.MainActivity"
android:screenOrientation="portrait" /> android:screenOrientation="portrait" />
<activity
android:name=".login.LoginActivity"
android:screenOrientation="portrait" />
<!--<activity-->
<!--android:name=".login.LoginActivity"-->
<!--android:screenOrientation="portrait" />-->
<activity <activity
android:name=".index.planorder.OrderActivity" android:name=".index.planorder.OrderActivity"
android:screenOrientation="portrait" /> android:screenOrientation="portrait" />
@ -102,6 +123,139 @@
android:label="@string/title_activity_mine_info" android:label="@string/title_activity_mine_info"
android:theme="@style/AppTheme" /> android:theme="@style/AppTheme" />
<activity android:name=".me.SettingActivity"></activity> <activity android:name=".me.SettingActivity"></activity>
<!-- Required SDK 核心功能-->
<!-- 可配置android:process参数将PushService放在其他进程中 -->
<service
android:name="cn.jpush.android.service.PushService"
android:enabled="true"
android:exported="false" >
<intent-filter>
<action android:name="cn.jpush.android.intent.REGISTER" />
<action android:name="cn.jpush.android.intent.REPORT" />
<action android:name="cn.jpush.android.intent.PushService" />
<action android:name="cn.jpush.android.intent.PUSH_TIME" />
</intent-filter>
</service>
<!-- since 3.0.9 Required SDK 核心功能-->
<provider
android:authorities="com.qhclh.ytzh.DataProvider"
android:name="cn.jpush.android.service.DataProvider"
android:exported="true"
/>
<!-- since 1.8.0 option 可选项。用于同一设备中不同应用的JPush服务相互拉起的功能。 -->
<!-- 若不启用该功能可删除该组件,将不拉起其他应用也不能被其他应用拉起 -->
<service
android:name="cn.jpush.android.service.DaemonService"
android:enabled="true"
android:exported="true">
<intent-filter >
<action android:name="cn.jpush.android.intent.DaemonService" />
<category android:name="com.qhclh.ytzh"/>
</intent-filter>
</service>
<!-- Required SDK核心功能-->
<receiver
android:name="cn.jpush.android.service.PushReceiver"
android:enabled="true" >
<intent-filter android:priority="1000">
<action android:name="cn.jpush.android.intent.NOTIFICATION_RECEIVED_PROXY" />
<category android:name="com.qhclh.ytzh"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.USER_PRESENT" />
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
</intent-filter>
<!-- Optional -->
<intent-filter>
<action android:name="android.intent.action.PACKAGE_ADDED" />
<action android:name="android.intent.action.PACKAGE_REMOVED" />
<data android:scheme="package" />
</intent-filter>
</receiver>
<!-- Required SDK核心功能-->
<activity
android:name="cn.jpush.android.ui.PushActivity"
android:configChanges="orientation|keyboardHidden"
android:theme="@android:style/Theme.NoTitleBar"
android:exported="false" >
<intent-filter>
<action android:name="cn.jpush.android.ui.PushActivity" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="com.qhclh.ytzh" />
</intent-filter>
</activity>
<!-- SDK核心功能-->
<activity
android:name="cn.jpush.android.ui.PopWinActivity"
android:configChanges="orientation|keyboardHidden"
android:exported="false"
android:theme="@style/MyDialogStyle">
<intent-filter>
<category android:name="android.intent.category.DEFAULT" />
<category android:name="com.qhclh.ytzh" />
</intent-filter>
</activity>
<!-- Required SDK核心功能-->
<service
android:name="cn.jpush.android.service.DownloadService"
android:enabled="true"
android:exported="false" >
</service>
<!-- Required SDK核心功能-->
<receiver android:name="cn.jpush.android.service.AlarmReceiver" />
<!-- Required since 3.0.7 -->
<!-- 新的tag/alias接口结果返回需要开发者配置一个自定的广播 -->
<!-- 该广播需要继承JPush提供的JPushMessageReceiver类, 并如下新增一个 Intent-Filter -->
<receiver
android:name=".index.MyJPReceiver"
android:enabled="true" >
<intent-filter>
<action android:name="cn.jpush.android.intent.RECEIVE_MESSAGE" />
<category android:name="com.qhclh.ytzh" />
</intent-filter>
</receiver>
<!-- User defined. 用户自定义的广播接收器-->
<receiver
android:name=".index.MyBoradCReceiver"
android:enabled="true">
<intent-filter>
<!--Required 用户注册SDK的intent-->
<action android:name="cn.jpush.android.intent.REGISTRATION" />
<!--Required 用户接收SDK消息的intent-->
<action android:name="cn.jpush.android.intent.MESSAGE_RECEIVED" />
<!--Required 用户接收SDK通知栏信息的intent-->
<action android:name="cn.jpush.android.intent.NOTIFICATION_RECEIVED" />
<!--Required 用户打开自定义通知栏的intent-->
<action android:name="cn.jpush.android.intent.NOTIFICATION_OPENED" />
<!-- 接收网络变化 连接/断开 since 1.6.3 -->
<action android:name="cn.jpush.android.intent.CONNECTION" />
<category android:name="com.qhclh.ytzh" />
</intent-filter>
</receiver>
<!-- Required. For publish channel feature -->
<!-- JPUSH_CHANNEL 是为了方便开发者统计APK分发渠道。-->
<!-- 例如: -->
<!-- 发到 Google Play 的APK可以设置为 google-play; -->
<!-- 发到其他市场的 APK 可以设置为 xxx-market。 -->
<meta-data android:name="JPUSH_CHANNEL" android:value="developer-default"/>
<!-- Required. AppKey copied from Portal -->
<meta-data android:name="JPUSH_APPKEY" android:value="53d7a345ed1d408462447820"/>
<activity android:name=".index.TestActivity"/>
</application> </application>
</manifest> </manifest>

+ 10
- 0
app/src/main/java/com/qhclh/ytzh/home/MyApplication.java View File

@ -9,8 +9,12 @@ import com.qhclh.ytzh.configs.ServerConfig;
import org.forks.jsonrpc.RpcFacade; import org.forks.jsonrpc.RpcFacade;
import org.litepal.LitePalApplication; import org.litepal.LitePalApplication;
import java.util.LinkedHashSet;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Set;
import cn.jpush.android.api.JPushInterface;
/** /**
* Created by 青花瓷 on 2017/11/23. * Created by 青花瓷 on 2017/11/23.
@ -45,6 +49,12 @@ public class MyApplication extends LitePalApplication {
ConfigUtil.Save(config); ConfigUtil.Save(config);
RpcFacade.init(this.getApplicationContext(),NAME); RpcFacade.init(this.getApplicationContext(),NAME);
JPushInterface.setDebugMode(true);
JPushInterface.init(this);
Set<String> setTags = new LinkedHashSet<>();
setTags.add("aaa");
JPushInterface.setTags(this,0,setTags);
} }
public void exit() { public void exit() {


+ 2
- 0
app/src/main/java/com/qhclh/ytzh/home/RpcUrl.java View File

@ -10,6 +10,8 @@ public class RpcUrl {
public static String BaseAppUrl = "http://221.1.97.114:86/B3/"; public static String BaseAppUrl = "http://221.1.97.114:86/B3/";
public static String DayProductRpc_Query = "/MainSystem/B3_ZhongHui/Rpcs/DayProductRpc/Query"; public static String DayProductRpc_Query = "/MainSystem/B3_ZhongHui/Rpcs/DayProductRpc/Query";
public static String DayProductRpc_Query_canshu = "/MainSystem/B3_ZhongHui/Rpcs/DayProductRpc/Query";
public static String DayProductRpc_Query_fanhui = "/MainSystem/B3_ZhongHui/Rpcs/DayProductRpc/Query";
public static String DayProductRpc_New = "/MainSystem/B3_ZhongHui/Rpcs/DayProductRpc/New"; public static String DayProductRpc_New = "/MainSystem/B3_ZhongHui/Rpcs/DayProductRpc/New";
public static String DayProductRpc_Insert = "/MainSystem/B3_ZhongHui/Rpcs/DayProductRpc/Insert"; public static String DayProductRpc_Insert = "/MainSystem/B3_ZhongHui/Rpcs/DayProductRpc/Insert";


+ 124
- 0
app/src/main/java/com/qhclh/ytzh/index/MyBoradCReceiver.java View File

@ -0,0 +1,124 @@
package com.qhclh.ytzh.index;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.Iterator;
import cn.jpush.android.api.JPushInterface;
/**
* Created by 青花瓷 on 2017/11/27.
*/
public class MyBoradCReceiver extends BroadcastReceiver {
private static final String TAG = "ytzh";
@Override
public void onReceive(Context context, Intent intent) {
try {
Bundle bundle = intent.getExtras();
// Logger.d(TAG, "[MyReceiver] onReceive - " + intent.getAction() + ", extras: " + printBundle(bundle));
if (JPushInterface.ACTION_REGISTRATION_ID.equals(intent.getAction())) {
String regId = bundle.getString(JPushInterface.EXTRA_REGISTRATION_ID);
// Logger.d(TAG, "[MyReceiver] 接收Registration Id : " + regId);
//send the Registration Id to your server...
} else if (JPushInterface.ACTION_MESSAGE_RECEIVED.equals(intent.getAction())) {
// Logger.d(TAG, "[MyReceiver] 接收到推送下来的自定义消息: " + bundle.getString(JPushInterface.EXTRA_MESSAGE));
// processCustomMessage(context, bundle);
} else if (JPushInterface.ACTION_NOTIFICATION_RECEIVED.equals(intent.getAction())) {
// Logger.d(TAG, "[MyReceiver] 接收到推送下来的通知");
int notifactionId = bundle.getInt(JPushInterface.EXTRA_NOTIFICATION_ID);
// Logger.d(TAG, "[MyReceiver] 接收到推送下来的通知的ID: " + notifactionId);
} else if (JPushInterface.ACTION_NOTIFICATION_OPENED.equals(intent.getAction())) {
// Logger.d(TAG, "[MyReceiver] 用户点击打开了通知");
//打开自定义的Activity
Intent i = new Intent(context, TestActivity.class);
i.putExtras(bundle);
//i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP );
context.startActivity(i);
} else if (JPushInterface.ACTION_RICHPUSH_CALLBACK.equals(intent.getAction())) {
// Logger.d(TAG, "[MyReceiver] 用户收到到RICH PUSH CALLBACK: " + bundle.getString(JPushInterface.EXTRA_EXTRA));
//在这里根据 JPushInterface.EXTRA_EXTRA 的内容处理代码比如打开新的Activity 打开一个网页等..
} else if(JPushInterface.ACTION_CONNECTION_CHANGE.equals(intent.getAction())) {
boolean connected = intent.getBooleanExtra(JPushInterface.EXTRA_CONNECTION_CHANGE, false);
// Logger.w(TAG, "[MyReceiver]" + intent.getAction() +" connected state change to "+connected);
} else {
// Logger.d(TAG, "[MyReceiver] Unhandled intent - " + intent.getAction());
}
} catch (Exception e){
}
}
// 打印所有的 intent extra 数据
private static String printBundle(Bundle bundle) {
StringBuilder sb = new StringBuilder();
for (String key : bundle.keySet()) {
if (key.equals(JPushInterface.EXTRA_NOTIFICATION_ID)) {
sb.append("\nkey:" + key + ", value:" + bundle.getInt(key));
}else if(key.equals(JPushInterface.EXTRA_CONNECTION_CHANGE)){
sb.append("\nkey:" + key + ", value:" + bundle.getBoolean(key));
} else if (key.equals(JPushInterface.EXTRA_EXTRA)) {
if (TextUtils.isEmpty(bundle.getString(JPushInterface.EXTRA_EXTRA))) {
// Logger.i(TAG, "This message has no Extra data");
continue;
}
try {
JSONObject json = new JSONObject(bundle.getString(JPushInterface.EXTRA_EXTRA));
Iterator<String> it = json.keys();
while (it.hasNext()) {
String myKey = it.next();
sb.append("\nkey:" + key + ", value: [" +
myKey + " - " +json.optString(myKey) + "]");
}
} catch (JSONException e) {
// Logger.e(TAG, "Get message extra JSON error!");
}
} else {
sb.append("\nkey:" + key + ", value:" + bundle.getString(key));
}
}
return sb.toString();
}
//send msg to MainActivity
// private void processCustomMessage(Context context, Bundle bundle) {
// if (MainActivity.isForeground) {
// String message = bundle.getString(JPushInterface.EXTRA_MESSAGE);
// String extras = bundle.getString(JPushInterface.EXTRA_EXTRA);
// Intent msgIntent = new Intent(MainActivity.MESSAGE_RECEIVED_ACTION);
// msgIntent.putExtra(MainActivity.KEY_MESSAGE, message);
// if (!ExampleUtil.isEmpty(extras)) {
// try {
// JSONObject extraJson = new JSONObject(extras);
// if (extraJson.length() > 0) {
// msgIntent.putExtra(MainActivity.KEY_EXTRAS, extras);
// }
// } catch (JSONException e) {
//
// }
//
// }
// LocalBroadcastManager.getInstance(context).sendBroadcast(msgIntent);
// }
// }
}

+ 10
- 0
app/src/main/java/com/qhclh/ytzh/index/MyJPReceiver.java View File

@ -0,0 +1,10 @@
package com.qhclh.ytzh.index;
import cn.jpush.android.service.JPushMessageReceiver;
/**
* Created by 青花瓷 on 2017/12/5.
*/
public class MyJPReceiver extends JPushMessageReceiver {
}

+ 32
- 0
app/src/main/java/com/qhclh/ytzh/index/TestActivity.java View File

@ -0,0 +1,32 @@
package com.qhclh.ytzh.index;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.ViewGroup.LayoutParams;
import android.widget.TextView;
import cn.jpush.android.api.JPushInterface;
public class TestActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TextView tv = new TextView(this);
tv.setText("用户自定义打开的Activity");
Intent intent = getIntent();
if (null != intent) {
Bundle bundle = getIntent().getExtras();
String title = null;
String content = null;
if(bundle!=null){
title = bundle.getString(JPushInterface.EXTRA_NOTIFICATION_TITLE);
content = bundle.getString(JPushInterface.EXTRA_ALERT);
}
tv.setText("Title : " + title + " " + "Content : " + content);
}
addContentView(tv, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
}
}

+ 2
- 2
app/src/main/java/com/qhclh/ytzh/splash/SplashActivity.java View File

@ -7,7 +7,7 @@ import android.widget.LinearLayout;
import com.qhclh.ytzh.R; import com.qhclh.ytzh.R;
import com.qhclh.ytzh.base.BaseActivity; import com.qhclh.ytzh.base.BaseActivity;
import com.qhclh.ytzh.home.MainActivity;
import com.qhclh.ytzh.login.LoginActivity;
import butterknife.BindView; import butterknife.BindView;
@ -60,7 +60,7 @@ public class SplashActivity extends BaseActivity {
} }
private void redirectTo() { private void redirectTo() {
startActivity(new Intent(this, MainActivity.class));
startActivity(new Intent(this, LoginActivity.class));
finish(); finish();
} }
} }

+ 102
- 1
app/src/main/java/com/qhclh/ytzh/work/productiondaily/ProductiondailyActivity.java View File

@ -1,6 +1,7 @@
package com.qhclh.ytzh.work.productiondaily; package com.qhclh.ytzh.work.productiondaily;
import android.content.Intent; import android.content.Intent;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.widget.Toolbar; import android.support.v7.widget.Toolbar;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
@ -11,12 +12,20 @@ import android.widget.ListView;
import com.qhclh.ytzh.R; import com.qhclh.ytzh.R;
import com.qhclh.ytzh.base.BaseActivity; import com.qhclh.ytzh.base.BaseActivity;
import com.qhclh.ytzh.bean.ProductionDailyBean; import com.qhclh.ytzh.bean.ProductionDailyBean;
import com.qhclh.ytzh.home.RpcUrl;
import com.qhclh.ytzh.tasks.ViewOnClickTask;
import com.qhclh.ytzh.ui.CalendarDialogFragment; import com.qhclh.ytzh.ui.CalendarDialogFragment;
import com.qhclh.ytzh.ui.RefreshLayout;
import com.qhclh.ytzh.utils.DateTimeUtil; import com.qhclh.ytzh.utils.DateTimeUtil;
import org.forks.jsonrpc.JsonRpcResult;
import org.forks.jsonrpc.RpcFacade;
import org.forks.jsonrpc.RpcObject;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map;
import butterknife.BindView; import butterknife.BindView;
@ -24,11 +33,14 @@ import butterknife.BindView;
* Created by 青花瓷 on 2017/12/4. * Created by 青花瓷 on 2017/12/4.
*/ */
///< 生产日报 ///< 生产日报
public class ProductiondailyActivity extends BaseActivity implements CalendarDialogFragment.CalendarClickListener{
public class ProductiondailyActivity extends BaseActivity implements CalendarDialogFragment.CalendarClickListener, RefreshLayout.OnLoadListener, SwipeRefreshLayout.OnRefreshListener {
@BindView(R.id.toolbar) @BindView(R.id.toolbar)
Toolbar mToolbar; Toolbar mToolbar;
@BindView(R.id.lv_productiondaily) @BindView(R.id.lv_productiondaily)
ListView lv_productiondaily; ListView lv_productiondaily;
@BindView(R.id.rfl_productiondaily)
RefreshLayout rfl_productiondaily;
private int page =0;
private List<ProductionDailyBean> productionDailyBeanList; private List<ProductionDailyBean> productionDailyBeanList;
private ProductiondailyAdapter productiondailyAdapter; private ProductiondailyAdapter productiondailyAdapter;
@Override @Override
@ -44,6 +56,7 @@ public class ProductiondailyActivity extends BaseActivity implements CalendarDia
finish(); finish();
} }
}); });
rfl_productiondaily.setEnabled(false);
} }
@Override @Override
@ -64,6 +77,78 @@ public class ProductiondailyActivity extends BaseActivity implements CalendarDia
startActivity(new Intent(ProductiondailyActivity.this,ProductiondailyInfoActivity.class)); startActivity(new Intent(ProductiondailyActivity.this,ProductiondailyInfoActivity.class));
} }
}); });
rfl_productiondaily.setOnLoadListener(this);
rfl_productiondaily.setOnRefreshListener(this);
}
@Override
protected void onResume() {
super.onResume();
DayProductRpcNew();
DayProductRpcQuery();
}
private void DayProductRpcNew() {
ViewOnClickTask DayProductRpcNewTask = new ViewOnClickTask(this,"加载中...") {
RpcObject rpcobj;
@Override
protected void successUI() {
}
@Override
public Object call() throws Exception {
JsonRpcResult result = RpcFacade.rpcCall(RpcUrl.DayProductRpc_New);
rpcobj = result.getRpcObject(RpcUrl.DayProductRpc_Query_fanhui);
return null;
}
};
DayProductRpcNewTask.execute();
}
private void DayProductRpcQuery() {
ViewOnClickTask DayProductRpcQueryTask = new ViewOnClickTask(this,"加载中...") {
List<RpcObject> rpcobj;
@Override
protected void successUI() {
}
@Override
public Object call() throws Exception {
RpcObject queryObj = RpcObject.create(RpcUrl.DayProductRpc_Query_canshu);
queryObj.setInt("PageSize",10);
queryObj.setInt("CurrentPageIndex",page);
List<Object> select = queryObj.getList("Select");
select.add("ID");
// select.add("CreateTime");
// select.add("CreateUser_Name");
select.add("Batch_ID");
select.add("Batch_Name");
select.add("BreedFactory_ID");
select.add("BreedFactory_Name");
select.add("Date");
// select.add("Remark");
// select.add("AccountingUnit_ID");
// select.add("AccountingUnit_Name");
// Map<Object, Object> where = queryObj.getMap("Where");
// where.put("MobileToDo",true);
// List<Object> orderList = queryObj.getList("OrderBy");
// RpcObject orderBy1 = RpcObject.create(RpcUrl.paixu);
// orderBy1.setString("Name", "CreateTime");
// orderBy1.setBoolean("Desc", true);
// orderList.add(orderBy1);
JsonRpcResult result = RpcFacade.rpcCall(RpcUrl.DayProductRpc_Query);
rpcobj = result.getRpcObjectList(RpcUrl.DayProductRpc_Query_fanhui);
return null;
}
};
DayProductRpcQueryTask.execute();
} }
@Override @Override
@ -92,4 +177,20 @@ public class ProductiondailyActivity extends BaseActivity implements CalendarDia
public void onEndCalendarClick(Date date) { public void onEndCalendarClick(Date date) {
showToast(DateTimeUtil.FormatDate(date)); showToast(DateTimeUtil.FormatDate(date));
} }
@Override
public void onLoad() {
rfl_productiondaily.postDelayed(new Runnable() {
@Override
public void run() {
rfl_productiondaily.setLoading(false);
}
},1000);
}
@Override
public void onRefresh() {
rfl_productiondaily.setRefreshing(false);
}
} }

+ 1
- 0
gradle.properties View File

@ -15,3 +15,4 @@ org.gradle.jvmargs=-Xmx1536m
# This option should only be used with decoupled projects. More details, visit # 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 # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true # org.gradle.parallel=true
android.useDeprecatedNdk=true

Loading…
Cancel
Save