浏览代码

bug修改

huyuguo 4 年之前
父节点
当前提交
da0cd49130

+ 17 - 10
app/src/main/java/com/electric/chargingpile/activity/MainMapActivity.java

1606
    protected void onResume() {
1606
    protected void onResume() {
1607
        super.onResume();
1607
        super.onResume();
1608
1608
1609
        String search_address = ProfileManager.getInstance().getSearchAddress(this);
1610
        if (search_address.equals("")) {
1611
            tv_search.setText("请输入地址/关键字");
1612
            iv_clear_address.setVisibility(View.INVISIBLE);
1613
        } else {
1614
            tv_search.setText(search_address);
1615
            iv_clear_address.setVisibility(View.VISIBLE);
1616
        }
1617
1609
        String from = getIntent().getStringExtra("from");
1618
        String from = getIntent().getStringExtra("from");
1610
        if ("search_from_activity".equals(from)) {
1619
        if ("search_from_activity".equals(from)) {
1611
            searchAll();
1620
            searchAll();
1644
        }
1653
        }
1645
        mapView.onResume();
1654
        mapView.onResume();
1646
1655
1647
1648
        String search_address = ProfileManager.getInstance().getSearchAddress(this);
1649
        if (search_address.equals("")) {
1650
            tv_search.setText("请输入地址/关键字");
1651
            iv_clear_address.setVisibility(View.INVISIBLE);
1652
        } else {
1653
            tv_search.setText(search_address);
1654
            iv_clear_address.setVisibility(View.VISIBLE);
1655
        }
1656
1657
        if (againPoint.equals("1") && back.equals("1")) {
1656
        if (againPoint.equals("1") && back.equals("1")) {
1658
            if (!isFirstLoc) {
1657
            if (!isFirstLoc) {
1659
                isFirstLoc = true;
1658
                isFirstLoc = true;
1674
    }
1673
    }
1675
1674
1676
    private void searchAll() {
1675
    private void searchAll() {
1676
1677
        if ("请输入地址/关键字".equals(tv_search.getText().toString())) {
1678
            if (search_marker != null) {
1679
                search_marker.remove();
1680
            }
1681
            return;
1682
        }
1683
1677
        double jing = Double.valueOf(getIntent().getStringExtra("jing"));
1684
        double jing = Double.valueOf(getIntent().getStringExtra("jing"));
1678
        double wei = Double.valueOf(getIntent().getStringExtra("wei"));
1685
        double wei = Double.valueOf(getIntent().getStringExtra("wei"));
1679
        MainApplication.search_jing = jing;
1686
        MainApplication.search_jing = jing;

+ 3 - 1
app/src/main/java/com/electric/chargingpile/activity/SearchActivity.java

306
                db.del(addressList.get(position).get("name"), addressList.get(position).get("address"));
306
                db.del(addressList.get(position).get("name"), addressList.get(position).get("address"));
307
                db.insert(values);
307
                db.insert(values);
308

308

309

309
                Cursor c = db.query();
310
                Cursor c = db.query();
310
                if (c.getCount() <= 0) {
311
                if (c.getCount() <= 0) {
311
                    return;
312
                    return;
313
                String[] from = {"keyword", "type"};
314
                String[] from = {"keyword", "type"};
314
                int[] to = {R.id.search_name, R.id.search_address};
315
                int[] to = {R.id.search_name, R.id.search_address};
315
                SimpleCursorAdapter historyAdapter = new SimpleCursorAdapter(SearchActivity.this, R.layout.history_item, c, from, to, 0);
316
                SimpleCursorAdapter historyAdapter = new SimpleCursorAdapter(SearchActivity.this, R.layout.history_item, c, from, to, 0);
317

318
                db.close();
316
                historyList.setAdapter(historyAdapter);
319
                historyList.setAdapter(historyAdapter);
317
                Intent intent = new Intent();
320
                Intent intent = new Intent();
318
                intent.putExtra("from", "search_from_activity");
321
                intent.putExtra("from", "search_from_activity");
325
                if (v != null) {
328
                if (v != null) {
326
                    imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
329
                    imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
327
                }
330
                }
328
                db.close();
329
                finish();
331
                finish();
330
            }
332
            }
331
        });
333
        });

+ 13 - 0
app/src/main/java/com/electric/chargingpile/activity/SearchAllActivity.java

2
2
3
import androidx.appcompat.app.AppCompatActivity;
3
import androidx.appcompat.app.AppCompatActivity;
4
4
5
import android.content.ContentValues;
5
import android.content.Context;
6
import android.content.Context;
6
import android.content.Intent;
7
import android.content.Intent;
7
import android.content.pm.PackageInfo;
8
import android.content.pm.PackageInfo;
29
import com.electric.chargingpile.data.PileData;
30
import com.electric.chargingpile.data.PileData;
30
import com.electric.chargingpile.data.RecommendZhan;
31
import com.electric.chargingpile.data.RecommendZhan;
31
import com.electric.chargingpile.manager.ProfileManager;
32
import com.electric.chargingpile.manager.ProfileManager;
33
import com.electric.chargingpile.util.DBOpenHandler;
32
import com.electric.chargingpile.util.JsonUtils;
34
import com.electric.chargingpile.util.JsonUtils;
33
35
34
import java.net.URISyntaxException;
36
import java.net.URISyntaxException;
82
        lv_search_list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
84
        lv_search_list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
83
            @Override
85
            @Override
84
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
86
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
87
                DBOpenHandler db = new DBOpenHandler(SearchAllActivity.this, "");
88
                ContentValues values = new ContentValues();
89
                values.put("time", System.currentTimeMillis());
90
                values.put("keyword", addressAllList.get(position).get("name"));
91
                values.put("type", addressAllList.get(position).get("address"));
92
                values.put("jing", addressAllList.get(position).get("jing"));
93
                values.put("wei", addressAllList.get(position).get("wei"));
94
                db.del(addressAllList.get(position).get("name"), addressAllList.get(position).get("address"));
95
                db.insert(values);
96
97
85
                Intent intent = new Intent();
98
                Intent intent = new Intent();
86
                intent.setClass(getApplicationContext(), MainMapActivity.class);
99
                intent.setClass(getApplicationContext(), MainMapActivity.class);
87
                intent.putExtra("from", "search_from_activity");
100
                intent.putExtra("from", "search_from_activity");