Skip to content

Commit 825ee5a

Browse files
committed
修改图标
1 parent a3cc2d8 commit 825ee5a

File tree

6 files changed

+74
-38
lines changed

6 files changed

+74
-38
lines changed

app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -572,9 +572,7 @@
572572
android:name=".search.SearchProjectActivity_"
573573
android:icon="@drawable/ic_lancher"
574574
android:label="@string/title_activity_search_project"
575-
android:screenOrientation="portrait"
576-
android:theme="@style/Theme.AppCompat.NoActionBar"
577-
android:windowSoftInputMode="stateAlwaysHidden" />
575+
android:screenOrientation="portrait" />
578576

579577
<service android:name=".UpdateService" />
580578

app/src/main/java/net/coding/program/search/SearchProjectActivity.java

Lines changed: 51 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,14 @@
1414
import android.view.inputmethod.EditorInfo;
1515
import android.view.inputmethod.InputMethodManager;
1616
import android.widget.AdapterView;
17-
import android.widget.Button;
1817
import android.widget.EditText;
1918
import android.widget.ListView;
2019
import android.widget.TextView;
2120

2221
import net.coding.program.R;
23-
import net.coding.program.common.Global;
2422
import net.coding.program.common.SearchProjectCache;
2523
import net.coding.program.common.adapter.SearchHistoryListAdapter;
26-
import net.coding.program.common.ui.BaseActivity;
24+
import net.coding.program.common.ui.BackActivity;
2725
import net.coding.program.common.util.DensityUtil;
2826
import net.coding.program.third.PagerSlidingTabStrip;
2927

@@ -35,7 +33,7 @@
3533
import java.util.List;
3634

3735
@EActivity(R.layout.activity_search_project)
38-
public class SearchProjectActivity extends BaseActivity implements TextView.OnEditorActionListener, TextWatcher, AdapterView.OnItemClickListener {
36+
public class SearchProjectActivity extends BackActivity implements TextView.OnEditorActionListener, TextWatcher, AdapterView.OnItemClickListener {
3937

4038
private static final String TAG = SearchProjectActivity.class.getSimpleName();
4139
@ViewById
@@ -60,19 +58,22 @@ public class SearchProjectActivity extends BaseActivity implements TextView.OnEd
6058
// 历史搜索的记录
6159
private List<String> mSearchHistoryList = new ArrayList<String>();
6260
private String mSearchData = "";
63-
private Button btnCancel;
6461
private EditText editText;
62+
private View btnCancel;
6563

6664
@AfterViews
6765
void init() {
66+
View actionBar = getLayoutInflater().inflate(R.layout.activity_search_project_actionbar, null);
67+
getSupportActionBar().setCustomView(actionBar);
68+
getSupportActionBar().setDisplayShowCustomEnabled(true);
69+
6870
imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
69-
btnCancel = (Button) this.findViewById(R.id.btnCancel);
71+
btnCancel = actionBar.findViewById(R.id.btnCancel);
7072
btnCancel.setOnClickListener(v -> {
71-
Global.popSoftkeyboard(this, editText, false);
72-
onBackPressed();
73+
editText.setText("");
7374
});
7475

75-
editText = (EditText) this.findViewById(R.id.editText);
76+
editText = (EditText) actionBar.findViewById(R.id.editText);
7677
final int pageMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 4, getResources()
7778
.getDisplayMetrics());
7879
pager.setPageMargin(pageMargin);
@@ -96,6 +97,46 @@ void init() {
9697

9798
}
9899

100+
// @Override
101+
// public boolean onCreateOptionsMenu(Menu menu) {
102+
// MenuInflater menuInflater = getMenuInflater();
103+
// menuInflater.inflate(R.menu.add_follow_activity, menu);
104+
//
105+
// MenuItem menuItem = menu.findItem(R.id.action_search);
106+
// menuItem.expandActionView();
107+
// SearchView searchView = (SearchView) menuItem.getActionView();
108+
// searchView.onActionViewExpanded();
109+
// searchView.setIconified(false);
110+
// searchView.setQueryHint("用户名,邮箱,昵称");
111+
// searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
112+
// @Override
113+
// public boolean onQueryTextSubmit(String s) {
114+
// return true;
115+
// }
116+
//
117+
// @Override
118+
// public boolean onQueryTextChange(String s) {
119+
// search(s);
120+
// return true;
121+
// }
122+
// });
123+
//
124+
// MenuItemCompat.setOnActionExpandListener(menuItem, new MenuItemCompat.OnActionExpandListener() {
125+
// @Override
126+
// public boolean onMenuItemActionExpand(MenuItem item) {
127+
// return true;
128+
// }
129+
//
130+
// @Override
131+
// public boolean onMenuItemActionCollapse(MenuItem item) {
132+
// onBackPressed();
133+
// return false;
134+
// }
135+
// });
136+
//
137+
// return true;
138+
// }
139+
99140
private void setTabsValue() {
100141
DisplayMetrics dm = getResources().getDisplayMetrics();
101142
// 设置Tab是自动填充满屏幕的
@@ -187,7 +228,7 @@ public void onItemClick(AdapterView<?> parent, View view, int position, long id)
187228
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
188229
if (actionId == EditorInfo.IME_ACTION_SEARCH) {
189230
String tmp = editText.getText().toString();
190-
if (tmp == null || TextUtils.isEmpty(tmp)) {
231+
if (TextUtils.isEmpty(tmp)) {
191232
emptyListView.setVisibility(View.VISIBLE);
192233
pager.setVisibility(View.GONE);
193234
tabs.setVisibility(View.GONE);
Loading
Loading

app/src/main/res/layout/activity_search_project.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
android:background="@color/color_EEEEEE"
55
android:orientation="vertical">
66

7-
<include layout="@layout/activity_search_project_actionbar" />
7+
<!--<include layout="@layout/activity_search_project_actionbar" />-->
88

99
<net.coding.program.third.PagerSlidingTabStrip
1010
android:id="@+id/tabs"

app/src/main/res/layout/activity_search_project_actionbar.xml

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -16,38 +16,35 @@
1616
android:background="@color/transparent"
1717
android:hint="项目、任务、讨论、冒泡"
1818
android:imeOptions="actionSearch"
19-
android:paddingLeft="45dp"
2019
android:singleLine="true"
2120
android:textColor="@color/font_2"
2221
android:textColorHint="@color/color_hint"
2322
android:textSize="15sp" />
2423

25-
<View
26-
android:layout_width="match_parent"
27-
android:layout_height="1dp"
28-
android:layout_alignParentBottom="true"
29-
android:layout_marginBottom="12dp"
30-
android:layout_marginLeft="20dp"
31-
android:layout_marginRight="66dp"
32-
android:background="@color/color_3BBD79" />
24+
<!--<View-->
25+
<!--android:layout_width="match_parent"-->
26+
<!--android:layout_height="1dp"-->
27+
<!--android:layout_alignParentBottom="true"-->
28+
<!--android:layout_marginBottom="12dp"-->
29+
<!--android:layout_marginLeft="20dp"-->
30+
<!--android:layout_marginRight="66dp"-->
31+
<!--android:background="@color/color_3BBD79" />-->
3332

34-
<ImageView
35-
android:layout_width="16dp"
36-
android:layout_height="16dp"
37-
android:layout_alignLeft="@id/editText"
38-
android:layout_marginLeft="20dp"
39-
android:layout_marginTop="18dp"
40-
android:scaleType="centerInside"
41-
android:src="@drawable/ic_search" />
33+
<!--<ImageView-->
34+
<!--android:layout_width="16dp"-->
35+
<!--android:layout_height="16dp"-->
36+
<!--android:layout_alignLeft="@id/editText"-->
37+
<!--android:layout_marginLeft="20dp"-->
38+
<!--android:layout_marginTop="18dp"-->
39+
<!--android:scaleType="centerInside"-->
40+
<!--android:src="@drawable/ic_search" />-->
4241

43-
<Button
42+
<ImageView
4443
android:id="@+id/btnCancel"
45-
android:layout_width="56dp"
46-
android:layout_height="40dp"
44+
android:layout_width="96dp"
45+
android:layout_height="96dp"
4746
android:layout_alignParentRight="true"
4847
android:layout_centerVertical="true"
49-
android:background="@null"
50-
android:text="取消"
51-
android:textColor="@color/font_2"
52-
android:textSize="15sp" />
48+
android:src="@drawable/ic_actionbar_cancel"
49+
android:scaleType="center" />
5350
</RelativeLayout>

0 commit comments

Comments
 (0)