// 查看 sqlite 数据库表中内容方法

参考:Android Studio查看SQLite数据库方法大全

使用 Stetho

// Stetho是一个可以在线调试数据库的方法,这种方法是最方便和简单
implementation 'com.facebook.stetho:stetho:1.5.1'

Stetho.initializeWithDefaults(this);

如果打开空白页,在hosts中加入代码。关闭浏览器,然后重试
61.91.161.217 chrome-devtools-frontend.appspot.com
61.91.161.217 chrometophone.appspot.com

// 修改手机设置导航栏和状态栏的颜色的。

 @TargetApi(Build.VERSION_CODES.LOLLIPOP)
    private void setSystemBar(@ColorRes int statusBar) {
        if (statusBar == 0) {
            StatusBarUtil.setDarkMode(this);
            StatusBarUtil.setColor(this, getResources().getColor(R.color.colorPrimary), 0);
            setLightStatusBar(getWindow(),false);
        } else if (statusBar == R.color.transparent) {
            StatusBarUtil.setDarkMode(this);
            StatusBarUtil.setColor(this, getResources().getColor(statusBar), 0);
            setLightStatusBar(getWindow(),false);
        } else {
            StatusBarUtil.setLightMode(this);
            StatusBarUtil.setColor(this, getResources().getColor(statusBar), 0);
            setLightStatusBar(getWindow(),true);
        }
        if (ActivityCollector.getCurrentActivity() instanceof ChatActivity) {
            getWindow().setNavigationBarColor(getResources().getColor(R.color.white));
        } else if (ActivityCollector.getCurrentActivity() instanceof MainActivity) {
            getWindow().setNavigationBarColor(getResources().getColor(R.color.color_f8f8f8));
        } else {
            getWindow().setNavigationBarColor(getResources().getColor(R.color.transparent));
        }
        setLightNavigationBar(getWindow(),true);
    }

    /**
     * 状态栏显示
     * */
    public static void setLightStatusBar(Window window, boolean enable) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
            final View decorView = window.getDecorView();
            int flags = decorView.getSystemUiVisibility();
            if (enable) {
                if ((flags & View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR) == 0) {
                    flags |= View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
                    decorView.setSystemUiVisibility(flags);
                }
            } else {
                if ((flags & View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR) != 0) {
                    flags &= ~View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
                    decorView.setSystemUiVisibility(flags);
                }
            }
        }
    }

    /**
     * 导航栏显示
     * */
    public static void setLightNavigationBar(Window window, boolean enable) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
            final View decorView = window.getDecorView();
            int flags = decorView.getSystemUiVisibility();
            if (enable) {
                flags |= View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR;
            } else {
                flags &= ~View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR;
            }
            decorView.setSystemUiVisibility(flags);
        }
    }

// java 批量重命名文件名

import java.io.File;
import java.io.*;

public class ReFilesName {
	public static void main(String[] args) {
		  // String filePath = "D:\\WorkSpace\\CampusMeal\\app\\src\\main\\res\\mipmap-xhdpi2"; // set path
		  String filePath = ".\\"; // current path
		  File[] fileList = ReFilesName.getCurFilesList(filePath);
		// File[] fileList = ReFilesName.getProperty("user.dir");
		for (File file : fileList) {
			 File nf = new File("icon_"+file.getName()); // rename file name
			 file.renameTo(nf); // rename file name
			System.out.println(nf.getName());
		}
	}
			
	public static File[] getCurFilesList(String filePath) {
		File path = new File(filePath);
		File[] listFiles = path.listFiles(new java.io.FileFilter() {
			
			@Override
			public boolean accept(File pathname) {
				if (pathname.isFile())
					return true;
				else
					return false;
			}
		});

		return listFiles;
	}
}

// github 访问慢,无法访问

#github
140.82.113.4 github.com
199.232.5.194 github.global.ssl.fastly.net

// 生成apk自定义名称,打包自定义apk名称

参考:(1条消息) android studio 打包自动生成版本号与日期,apk输入路径_Swer-CSDN博客

参考:(1条消息) Error:(46, 0) Could not get unknown property ‘outputFile’ for object of type com.android.build.gr…_小码农大理想-CSDN博客

参考:Android Studio打包全攻略

// build.gradle app
// 适用于 classpath 'com.android.tools.build:gradle:4.0.0'
android {
    applicationVariants.all {
    variant ->
        variant.outputs.all {
            //只处理生产版本
            if (buildType.name == 'release') {
                  def createTime = new Date().format("YYYY-MM-dd-hh-mm-ss", TimeZone.getTimeZone("GMT+08:00"))
                def createTime = new Date().format("YYYY-MM-dd-hhmmss", TimeZone.getTimeZone("GMT+08:00"))
                // app包名称
                it.outputFileName = "xxxxxxx" + "-" + createTime + "-" + buildType.name + defaultConfig.versionName + ".apk"
                // 指定release输出到指定文件夹
                  variant.getPackageApplication().outputDirectory = new File(config.appReleaseDir + "/${createTime}")
            }
        }
    }
}

 

作者 wanglei

发表评论