简报页

chengzhenyu 8 years ago
parent
commit
2d9c9fff75

+ 6 - 0
app/src/main/AndroidManifest.xml

@@ -100,6 +100,12 @@
100 100
             android:screenOrientation="portrait"></activity>
101 101
 
102 102
         <activity
103
+            android:name=".activities.PriceSettingActivity"
104
+            android:configChanges="keyboardHidden|orientation|screenSize"
105
+            android:label="@string/app_name"
106
+            android:screenOrientation="portrait"></activity>
107
+
108
+        <activity
103 109
             android:name=".activities.WebViewActivity"
104 110
             android:configChanges="keyboardHidden|orientation|screenSize"
105 111
             android:label="@string/app_name"

+ 118 - 0
app/src/main/java/ai/pai/lensman/activities/PriceSettingActivity.java

@@ -0,0 +1,118 @@
1
+package ai.pai.lensman.activities;
2
+
3
+import android.os.Bundle;
4
+import android.text.Editable;
5
+import android.text.TextUtils;
6
+import android.text.TextWatcher;
7
+import android.view.View;
8
+import android.widget.Button;
9
+import android.widget.EditText;
10
+import android.widget.TextView;
11
+import android.widget.Toast;
12
+
13
+import com.android.common.executors.ThreadExecutor;
14
+import com.android.common.utils.NetworkUtil;
15
+
16
+import java.util.HashMap;
17
+
18
+import ai.pai.lensman.R;
19
+import ai.pai.lensman.base.BaseActivity;
20
+import ai.pai.lensman.db.Preferences;
21
+import ai.pai.lensman.utils.HttpPostTask;
22
+import ai.pai.lensman.utils.SystemUtils;
23
+import ai.pai.lensman.utils.UrlContainer;
24
+
25
+public class PriceSettingActivity extends BaseActivity implements View.OnClickListener{
26
+
27
+    private Button   sendBtn;
28
+    private EditText originPriceET;
29
+    private EditText noPrintPriceET;
30
+
31
+    @Override
32
+    protected void onCreate(Bundle savedInstanceState) {
33
+        super.onCreate(savedInstanceState);
34
+        setContentView(R.layout.activity_price_setting);
35
+        SystemUtils.setImmerseLayout(this,findViewById(R.id.title_layout));
36
+        TextView title = (TextView)findViewById(R.id.title_bar_middle_txt);
37
+        title.setText(R.string.price_manage);
38
+        originPriceET = (EditText)findViewById(R.id.et_price_origin);
39
+        originPriceET.addTextChangedListener(new TextWatcher() {
40
+            @Override
41
+            public void beforeTextChanged(CharSequence s, int start, int count, int after) {
42
+
43
+            }
44
+
45
+            @Override
46
+            public void onTextChanged(CharSequence s, int start, int before, int count) {
47
+
48
+            }
49
+
50
+            @Override
51
+            public void afterTextChanged(Editable s) {
52
+                sendBtn.setEnabled(s.toString().length()>0);
53
+            }
54
+        });
55
+
56
+        noPrintPriceET = (EditText)findViewById(R.id.et_price_no_waterprint);
57
+        noPrintPriceET.addTextChangedListener(new TextWatcher() {
58
+            @Override
59
+            public void beforeTextChanged(CharSequence s, int start, int count, int after) {
60
+
61
+            }
62
+
63
+            @Override
64
+            public void onTextChanged(CharSequence s, int start, int before, int count) {
65
+
66
+            }
67
+
68
+            @Override
69
+            public void afterTextChanged(Editable s) {
70
+                sendBtn.setEnabled(s.toString().length()>0);
71
+            }
72
+        });
73
+
74
+        sendBtn = (Button) findViewById(R.id.btn_price_setting);
75
+        sendBtn.setOnClickListener(this);
76
+        findViewById(R.id.title_bar_back_layout).setOnClickListener(this);
77
+        findViewById(R.id.title_bar_option_layout).setVisibility(View.INVISIBLE);
78
+    }
79
+
80
+    @Override
81
+    public void onClick(View v) {
82
+        switch (v.getId()){
83
+            case R.id.title_bar_back_layout:
84
+                finish();
85
+                break;
86
+            case R.id.btn_price_setting:
87
+                sendNewPrice();
88
+                break;
89
+            default:
90
+                break;
91
+        }
92
+    }
93
+
94
+    private void sendNewPrice() {
95
+        if(!sendBtn.isEnabled()){
96
+            return;
97
+        }
98
+        if(!NetworkUtil.isNetworkConnected(this)){
99
+            Toast.makeText(this,R.string.network_disconnect,Toast.LENGTH_SHORT).show();
100
+            return;
101
+        }
102
+        String originPrice = originPriceET.getText().toString();
103
+        String noMarkPrice = noPrintPriceET.getText().toString();
104
+        if(TextUtils.isEmpty(originPrice) && TextUtils.isEmpty(noMarkPrice)){
105
+            return;
106
+        }
107
+        HashMap<String,String> params = new HashMap<String,String>();
108
+        String userId = Preferences.getInstance().getLensManId();
109
+        if(userId.length()==0){
110
+            return;
111
+        }
112
+        params.put("user_id",userId);
113
+        params.put("nomark",noMarkPrice);
114
+        params.put("origin",originPrice);
115
+        new HttpPostTask(params).executeOnExecutor(ThreadExecutor.getInstance().getExecutor(), UrlContainer.PRICE_FIX_URL);
116
+        finish();
117
+    }
118
+}

+ 53 - 0
app/src/main/res/layout/activity_price_setting.xml

@@ -0,0 +1,53 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
+    android:layout_width="match_parent"
4
+    android:layout_height="match_parent"
5
+    android:background="@color/background_light_grey_color"
6
+    android:orientation="vertical">
7
+
8
+    <RelativeLayout
9
+        android:id="@+id/title_layout"
10
+        android:layout_width="match_parent"
11
+        android:layout_height="wrap_content"
12
+        android:background="@color/colorPrimaryDark">
13
+        <include layout="@layout/title_bar_with_back_and_option" />
14
+    </RelativeLayout>
15
+
16
+    <EditText
17
+        android:id="@+id/et_price_origin"
18
+        android:layout_width="match_parent"
19
+        android:textSize="14sp"
20
+        android:textColorHint="@color/grey"
21
+        android:background="@color/white"
22
+        android:textColor="@color/dark_grey"
23
+        android:hint="@string/input_origin_price"
24
+        android:paddingLeft="12dp"
25
+        android:gravity="center_vertical"
26
+        android:layout_height="44dp" />
27
+
28
+    <EditText
29
+        android:id="@+id/et_price_no_waterprint"
30
+        android:layout_width="match_parent"
31
+        android:textSize="14sp"
32
+        android:textColorHint="@color/grey"
33
+        android:background="@color/white"
34
+        android:textColor="@color/dark_grey"
35
+        android:hint="@string/input_no_water_print_price"
36
+        android:layout_marginTop="8dp"
37
+        android:paddingLeft="12dp"
38
+        android:gravity="center_vertical"
39
+        android:layout_height="44dp" />
40
+
41
+    <Button
42
+        android:id="@+id/btn_price_setting"
43
+        android:layout_width="match_parent"
44
+        android:layout_height="48dp"
45
+        android:layout_marginTop="30dp"
46
+        android:textColor="@color/white"
47
+        android:textSize="20sp"
48
+        android:enabled="false"
49
+        android:background="@drawable/send_btn_bg_selector"
50
+        android:text="@string/ok"/>
51
+
52
+
53
+</LinearLayout>

+ 5 - 0
app/src/main/res/values/strings.xml

@@ -144,4 +144,9 @@
144 144
 
145 145
     <string name="customer_bought_photo_money">用户 ¥%s 购买了高清图</string>
146 146
 
147
+    <string name="input_origin_price">请设定高清照片价格(单位 分)</string>
148
+
149
+    <string name="input_no_water_print_price">请设定去水印照片价格(单位 分)</string>
150
+
151
+
147 152
 </resources>