-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
290 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
102 changes: 102 additions & 0 deletions
102
app/src/main/java/com/example/quan/quanstudy/ucar/usercenter/FeedBackActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
package com.example.quan.quanstudy.ucar.usercenter; | ||
|
||
import android.os.Bundle; | ||
import android.text.Editable; | ||
import android.text.TextUtils; | ||
import android.text.TextWatcher; | ||
import android.view.View; | ||
import android.widget.EditText; | ||
import android.widget.TextView; | ||
import android.widget.Toast; | ||
|
||
import com.example.quan.quanstudy.R; | ||
import com.example.quan.quanstudy.base.BaseActivity; | ||
import com.example.quan.quanstudy.util.Utils; | ||
|
||
/** | ||
* Created by xingquan.he on 2017/6/2. | ||
* 意见反馈 | ||
*/ | ||
|
||
public class FeedBackActivity extends BaseActivity { | ||
private EditText mContentEt; | ||
private TextView mWatchWordsTv; | ||
private static final String DEFAULTNUM = "200"; | ||
private static final int MAXNUM = 200; | ||
private TextView mCommitTv; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
|
||
initOnClickListener(); | ||
} | ||
|
||
@Override | ||
public int getLayoutId() { | ||
return R.layout.activity_ucar_feedback; | ||
} | ||
|
||
@Override | ||
public void initView() { | ||
mCommitTv = (TextView) findViewById(R.id.commit_tv_feedback); | ||
mCommitTv.setEnabled(false); | ||
mContentEt = (EditText) findViewById(R.id.content_et_feedback); | ||
mContentEt.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 (TextUtils.isEmpty(mContentEt.getText().toString())) { | ||
mCommitTv.setEnabled(false); | ||
} else { | ||
mCommitTv.setEnabled(true); | ||
} | ||
} | ||
|
||
@Override | ||
public void afterTextChanged(Editable s) { | ||
int length = mContentEt.getText().length(); | ||
if (length > MAXNUM) { | ||
Toast.makeText(mContext, getString(R.string.input_feedback_content_long), Toast.LENGTH_SHORT).show(); | ||
String text = mContentEt.getText().toString() | ||
.substring(0, MAXNUM - 1); | ||
mContentEt.setText(text); | ||
length = MAXNUM; | ||
} | ||
int left = MAXNUM - length; | ||
mWatchWordsTv.setText(String.format(getResources().getString(R.string.default_feedback_words), Integer.toString(left))); | ||
} | ||
}); | ||
mWatchWordsTv = (TextView) findViewById(R.id.watchWords_tv_feedback); | ||
mWatchWordsTv.setText(String.format(getResources().getString(R.string.default_feedback_words), DEFAULTNUM)); | ||
initTitle(R.string.feedback); | ||
findViewById(R.id.back_title).setOnClickListener(this); | ||
} | ||
|
||
private void initOnClickListener() { | ||
mCommitTv.setOnClickListener(this); | ||
} | ||
|
||
@Override | ||
public void onClick(View v) { | ||
super.onClick(v); | ||
switch (v.getId()) { | ||
case R.id.commit_tv_feedback: | ||
Utils.stringFilter(mContentEt.getText().toString()); | ||
//网络请求,成功后往下走;若失败,提示并留在当前页面 | ||
Toast.makeText(mContext, getString(R.string.feedback_success), Toast.LENGTH_SHORT).show(); | ||
hideInputMethod(); | ||
finish(); | ||
break; | ||
case R.id.back_title: | ||
finish(); | ||
default: | ||
break; | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
<RelativeLayout 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:background="@color/color_f5f4f2" > | ||
|
||
<!-- Title layout --> | ||
|
||
<include | ||
android:id="@+id/base_title_layout" | ||
layout="@layout/base_title_layout" /> | ||
|
||
<!-- Content layout --> | ||
|
||
<LinearLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:layout_below="@+id/base_title_layout" | ||
android:gravity="center_horizontal" | ||
android:orientation="vertical" > | ||
|
||
<LinearLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="@dimen/dd_dimen_230px" | ||
android:layout_marginTop="@dimen/dd_dimen_30px" | ||
android:layout_marginRight="@dimen/dd_dimen_30px" | ||
android:layout_marginLeft="@dimen/dd_dimen_30px" | ||
android:background="@drawable/common_radius_rectangle" | ||
android:orientation="vertical" > | ||
|
||
<EditText | ||
android:id="@+id/content_et_feedback" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:background="@android:color/transparent" | ||
android:gravity="left" | ||
android:hint="@string/input_feedback_hint" | ||
android:layout_weight="1" | ||
android:maxLength="200" | ||
android:minHeight="@dimen/dd_dimen_300px" | ||
android:paddingBottom="@dimen/dd_dimen_20px" | ||
android:paddingLeft="@dimen/dd_dimen_20px" | ||
android:paddingRight="@dimen/dd_dimen_20px" | ||
android:paddingTop="@dimen/dd_dimen_20px" | ||
android:textColor="@color/color_333333" | ||
android:textColorHint="@color/color_999999" | ||
android:textSize="@dimen/dd_dimen_28px" /> | ||
|
||
<TextView | ||
android:id="@+id/watchWords_tv_feedback" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_gravity="right" | ||
android:gravity="center_vertical|right" | ||
android:paddingBottom="@dimen/dd_dimen_12px" | ||
android:paddingRight="@dimen/dd_dimen_12px" | ||
android:textColor="@color/color_999999" | ||
android:textSize="@dimen/dd_dimen_24px" /> | ||
</LinearLayout> | ||
|
||
<TextView | ||
android:id="@+id/commit_tv_feedback" | ||
android:layout_width="match_parent" | ||
android:layout_height="@dimen/dd_dimen_87px" | ||
android:layout_marginBottom="@dimen/dd_dimen_30px" | ||
android:layout_marginLeft="@dimen/dd_dimen_30px" | ||
android:layout_marginRight="@dimen/dd_dimen_30px" | ||
android:layout_marginTop="@dimen/dd_dimen_30px" | ||
android:background="@drawable/common_button_enable" | ||
android:gravity="center" | ||
android:text="提交" | ||
android:textColor="@color/white" | ||
android:textSize="@dimen/dd_dimen_30px" /> | ||
</LinearLayout> | ||
|
||
</RelativeLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.