第一次項(xiàng)目總結(jié)
android 倒計(jì)時(shí)日歷
1.使用系統(tǒng)日歷綁定提醒
采用第三方的SDK調(diào)用系統(tǒng)日歷
本次項(xiàng)目對(duì)于插入系統(tǒng)日歷使用了增加時(shí)間和刪除事件粟按,對(duì)于修改的方式使用了刪除之后在寫(xiě)入的實(shí)現(xiàn)方法
調(diào)用系統(tǒng)日歷中對(duì)實(shí)現(xiàn)事件重復(fù)的實(shí)現(xiàn)方法漂彤,構(gòu)建RRule類(lèi)中各個(gè)參數(shù)的實(shí)現(xiàn)意義
2.對(duì)輸入框判斷是否為空以及對(duì)需要設(shè)置單行輸入的部分記得設(shè)置單行輸入。
3.從系統(tǒng)相冊(cè)調(diào)用圖片設(shè)置背景
調(diào)用系統(tǒng)相冊(cè)存儲(chǔ)圖片路徑坊饶,使用時(shí)根據(jù)圖片路徑載入圖片泄伪,記得判斷圖片是否為空
4.自定義的listview和dialog,toolbar實(shí)現(xiàn)
對(duì)于各種adapter的實(shí)現(xiàn)和構(gòu)造方法
5.友盟埋點(diǎn)統(tǒng)計(jì)的實(shí)現(xiàn)
導(dǎo)入友盟第三方SDK包匿级,按照事件文檔創(chuàng)建計(jì)數(shù)類(lèi)蟋滴,在application中初始化,在每個(gè)activity中重寫(xiě)onResume()痘绎,onPause()方法津函,最后在需要埋點(diǎn)的地點(diǎn)使用MobclickAgent.onEvent()計(jì)數(shù)
7.開(kāi)屏廣告以及banner廣告的加載實(shí)現(xiàn)
測(cè)試廣告類(lèi)時(shí)需要更改APPID并且導(dǎo)入簽名文件并在APP build中修改
導(dǎo)入第三方類(lèi)庫(kù)是注意包與包之前可能的重復(fù)問(wèn)題,導(dǎo)入后對(duì)權(quán)限要及時(shí)增加修改并且在簽名文件application中加入android:networkSecurityConfig="@xml/network_security_config"
8.LitePal數(shù)據(jù)庫(kù)框架增刪改查的實(shí)現(xiàn)
LitePal創(chuàng)建數(shù)據(jù)庫(kù)需要新建assets目錄并且在目錄下創(chuàng)建litepal.xml文件同時(shí)在存儲(chǔ)的類(lèi)中繼承LitePalSupport方法
使用數(shù)據(jù)庫(kù)操作時(shí)可以使用debugImplementation 'com.amitshekhar.android:debug-db:1.0.4'對(duì)數(shù)據(jù)庫(kù)信息進(jìn)行實(shí)時(shí)更新與查看
對(duì)LitePal實(shí)現(xiàn)修改數(shù)據(jù)庫(kù)中Boolean值為default是需要使用setToDefault()方法
if (ischeck==true) {
Event events1 = new Event();
events1.setToDefault("top");
events1.updateAll();
}
9.對(duì)時(shí)間進(jìn)行排序調(diào)用 Collections.sort(list, new Comparator<Event>()方法實(shí)現(xiàn)孤页、
Collections.sort(list, new Comparator<Event>() {
/**
* @param lhs
* @param rhs
* @return an integer < 0 if lhs is less than rhs, 0 if they are
* equal, and > 0 if lhs is greater than rhs,比較數(shù)據(jù)大小時(shí),這里比的是時(shí)間
*/
@Override
public int compare(Event lhs, Event rhs) {
Date date1 = lhs.getDate();
Date date2 = rhs.getDate();
// 對(duì)日期字段進(jìn)行升序尔苦,如果欲降序可采用after方法
if (date1.before(date2)) {
return 1;
}
return -1;
}
});
return list;
10.對(duì)overridePendingTransition activity切換動(dòng)畫(huà)的使用,避免使用 Transition時(shí)activity的重復(fù)啟動(dòng)
對(duì)參數(shù)的理解已經(jīng)對(duì)于MainActivity的移動(dòng)
11.返回按鈕之后對(duì)activity進(jìn)行及時(shí)銷(xiāo)毀
12.(今日頭條屏幕適配方案)屏幕適配使用implementation 'me.jessyan:autosize:0.9.5',只需在清單文件輸入設(shè)計(jì)圖尺寸 <meta-data
android:name="design_width_in_dp"
android:value="360" />
<meta-data
android:name="design_height_in_dp"
android:value="684" />蕉堰,
即可按照設(shè)計(jì)圖適配屏幕,對(duì)UI設(shè)計(jì)時(shí)盡量使用dp進(jìn)行設(shè)計(jì)悲龟。
13UI設(shè)計(jì)過(guò)程中 LinearLayout當(dāng) android:orientation="vertical" 時(shí)屋讶, 只有水平方向的設(shè)置才起作用,垂直方向的設(shè)置不起作用须教。即:left皿渗,right,center_horizontal 是生效的轻腺。
當(dāng) android:orientation="horizontal" 時(shí)乐疆, 只有垂直方向的設(shè)置才起作用,水平方向的設(shè)置不起作用贬养。即:top挤土,bottom,center_vertical 是生效的误算。
14.關(guān)于多渠道打包以及產(chǎn)品簽名 簽名也自動(dòng)導(dǎo)入簽名文件生成簽名的包仰美,然后使用360加固寶對(duì)簽名包進(jìn)行加固并且自動(dòng)再簽名,之后再buildAPP界面和buildproject界面導(dǎo)入第三方渠道包和導(dǎo)入升級(jí)arr文件 api
'com.leon.channel:helper:2.0.3' classpath 'com.leon.channel:plugin:2.0.3' 之后在工程目錄下導(dǎo)入渠道TXT
渠道包規(guī)則
rebuildChannel{
def apkName ="app-release_10_jiagu_sign.apk"
//指定渠道文件
channelFile = file("C:/Users/mayn/Desktop/date/channel.txt")
//多渠道包的輸出目錄儿礼,默認(rèn)為new File(project.buildDir,"channel")
//baseOutputDir = new File(project.buildDir,"/Users/mayn/Desktop/release")
baseReleaseApk = file("C:/Users/mayn/Desktop/release/app-release_10_jiagu_sign.apk")
//多渠道包的命名規(guī)則咖杂,默認(rèn)為:{versionName}-
{flavorName}-
{appName}-
{versionCode}-
{buildType}'
//指定生成的渠道包路徑
releaseOutputDir = new File(project.buildDir, "rebuildChannel")
isFastMode = true
}
15.對(duì)于一個(gè)頁(yè)面數(shù)據(jù)更改另一頁(yè)面數(shù)據(jù)刷新的情況可以使用startactivityforResult方法和setResult finsh頁(yè)面并且刷新主界面
避免重復(fù)啟動(dòng)和無(wú)法刷新,規(guī)避在onresume方法中調(diào)用數(shù)據(jù)庫(kù)方法蚊夫。