• 大小: 594KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-05-07
  • 语言: 其他
  • 标签:

资源简介

仿京东商城地址选择

资源截图

代码片段和文件信息

package chihane.jdaddressselector.demo;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.frameLayout;

import chihane.jdaddressselector.AddressSelector;
import chihane.jdaddressselector.BottomDialog;
import chihane.jdaddressselector.OnAddressSelectedListener;
import chihane.jdaddressselector.model.City;
import chihane.jdaddressselector.model.County;
import chihane.jdaddressselector.model.Province;
import chihane.jdaddressselector.model.Street;
import mlxy.utils.T;

public class MainActivity extends AppCompatActivity implements OnAddressSelectedListener {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        frameLayout frameLayout = (frameLayout) findViewById(R.id.frameLayout);

        AddressSelector selector = new AddressSelector(this);
        selector.setOnAddressSelectedListener(this);
//        selector.setAddressProvider(new DefaultAddressProvider());

        assert frameLayout != null;
        frameLayout.addView(selector.getView());

        Button buttonBottomDialog = (Button) findViewById(R.id.buttonBottomDialog);
        assert buttonBottomDialog != null;
        buttonBottomDialog.setonclickListener(new View.onclickListener() {
            @Override
            public void onclick(View v) {
//                BottomDialog.show(MainActivity.this MainActivity.this);
                BottomDialog dialog = new BottomDialog(MainActivity.this);
                dialog.setOnAddressSelectedListener(MainActivity.this);
                dialog.show();
            }
        });
    }

    @Override
    public void onAddressSelected(Province province City city County county Street street) {
        String s =
                (province == null ? ““ : province.name) +
                (city == null ? ““ : “\n“ + city.name) +
                (county == null ? ““ : “\n“ + county.name) +
                (street == null ? ““ : “\n“ + street.name);

        T.showShort(this s);
    }
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2016-08-19 07:40  JDAddressSelector-master\
     文件        1404  2016-08-19 07:40  JDAddressSelector-master\.gitignore
     文件        1105  2016-08-19 07:40  JDAddressSelector-master\LICENSE
     文件        2930  2016-08-19 07:40  JDAddressSelector-master\README.md
     目录           0  2016-08-19 07:40  JDAddressSelector-master\app\
     文件           7  2016-08-19 07:40  JDAddressSelector-master\app\.gitignore
     文件         628  2016-08-19 07:40  JDAddressSelector-master\app\build.gradle
     文件         679  2016-08-19 07:40  JDAddressSelector-master\app\proguard-rules.pro
     目录           0  2016-08-19 07:40  JDAddressSelector-master\app\src\
     目录           0  2016-08-19 07:40  JDAddressSelector-master\app\src\main\
     文件         670  2016-08-19 07:40  JDAddressSelector-master\app\src\main\AndroidManifest.xml
     目录           0  2016-08-19 07:40  JDAddressSelector-master\app\src\main\java\
     目录           0  2016-08-19 07:40  JDAddressSelector-master\app\src\main\java\chihane\
     目录           0  2016-08-19 07:40  JDAddressSelector-master\app\src\main\java\chihane\jdaddressselector\
     目录           0  2016-08-19 07:40  JDAddressSelector-master\app\src\main\java\chihane\jdaddressselector\demo\
     文件        2139  2016-08-19 07:40  JDAddressSelector-master\app\src\main\java\chihane\jdaddressselector\demo\MainActivity.java
     目录           0  2016-08-19 07:40  JDAddressSelector-master\app\src\main\res\
     目录           0  2016-08-19 07:40  JDAddressSelector-master\app\src\main\res\layout\
     文件         641  2016-08-19 07:40  JDAddressSelector-master\app\src\main\res\layout\activity_main.xml
     目录           0  2016-08-19 07:40  JDAddressSelector-master\app\src\main\res\mipmap-hdpi\
     文件        3418  2016-08-19 07:40  JDAddressSelector-master\app\src\main\res\mipmap-hdpi\ic_launcher.png
     目录           0  2016-08-19 07:40  JDAddressSelector-master\app\src\main\res\mipmap-mdpi\
     文件        2206  2016-08-19 07:40  JDAddressSelector-master\app\src\main\res\mipmap-mdpi\ic_launcher.png
     目录           0  2016-08-19 07:40  JDAddressSelector-master\app\src\main\res\mipmap-xhdpi\
     文件        4842  2016-08-19 07:40  JDAddressSelector-master\app\src\main\res\mipmap-xhdpi\ic_launcher.png
     目录           0  2016-08-19 07:40  JDAddressSelector-master\app\src\main\res\mipmap-xxhdpi\
     文件        7718  2016-08-19 07:40  JDAddressSelector-master\app\src\main\res\mipmap-xxhdpi\ic_launcher.png
     目录           0  2016-08-19 07:40  JDAddressSelector-master\app\src\main\res\mipmap-xxxhdpi\
     文件       10486  2016-08-19 07:40  JDAddressSelector-master\app\src\main\res\mipmap-xxxhdpi\ic_launcher.png
     目录           0  2016-08-19 07:40  JDAddressSelector-master\app\src\main\res\values-w820dp\
     文件         358  2016-08-19 07:40  JDAddressSelector-master\app\src\main\res\values-w820dp\dimens.xml
............此处省略64个文件信息

评论

共有 条评论

相关资源