Skip to content

Commit

Permalink
some optimized
Browse files Browse the repository at this point in the history
  • Loading branch information
yons authored and yons committed May 8, 2018
1 parent bbc74ca commit 8cd4d51
Show file tree
Hide file tree
Showing 33 changed files with 361 additions and 119 deletions.
60 changes: 36 additions & 24 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,15 @@ apply plugin: 'realm-android'
apply plugin: 'com.bugtags.library.plugin'

android {
compileSdkVersion 26
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "com.dante.diary"
minSdkVersion 19
targetSdkVersion 27
versionCode 40
versionName "1.9.0"
versionCode 46
versionName "1.9.6"
vectorDrawables.useSupportLibrary = true
// ndk {
// abiFilters 'armeabi-v7a', 'x86'
// }
multiDexEnabled true
manifestPlaceholders = [
JPUSH_PKGNAME: applicationId,
Expand All @@ -36,6 +33,7 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

compileOptions {
targetCompatibility 1.8
sourceCompatibility 1.8
Expand All @@ -55,6 +53,20 @@ android {
exclude 'META-INF/NOTICE.txt'
}


flavorDimensions "default"
productFlavors {
yingyongbao {

}
Google {

}
}
}

ext {
supportVersion = "27.1.1"
}

bugtags {
Expand All @@ -75,27 +87,26 @@ dependencies {
implementation 'com.bugtags.library:bugtags-lib:2.3.1'
implementation 'com.github.bumptech.glide:glide:3.8.0'
implementation 'com.jakewharton:butterknife:8.8.1'
implementation 'com.google.code.gson:gson:2.8.0'
implementation 'com.google.code.gson:gson:2.8.2'
implementation 'com.blankj:utilcode:1.3.6'
implementation 'com.hwangjr.proguard:proguardconfig:1.0.1@aar'
implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.17'
implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.34'
implementation 'com.yqritc:recyclerview-flexibledivider:1.4.0'
implementation 'com.hendraanggrian:collapsingtoolbarlayout-subtitle:0.3.1'
implementation 'com.hendraanggrian:collapsingtoolbarlayout-subtitle:27.0.1'
implementation 'com.ncapdevi:frag-nav:1.4.0'
implementation 'com.roughike:bottom-bar:2.1.1'
implementation 'org.greenrobot:eventbus:3.0.0'
implementation 'org.greenrobot:eventbus:3.1.1'

//============== Rxjava ==============
implementation 'com.artemzin.rxjava:proguard-rules:1.1.3.0'
implementation 'com.artemzin.rxjava:proguard-rules:1.3.3.0'
implementation 'io.reactivex:rxandroid:1.2.1'
implementation 'com.squareup.retrofit2:adapter-rxjava:2.1.0'
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.6.0'

implementation 'com.squareup.okhttp3:logging-interceptor:3.9.0'
//============== custom ==============
implementation 'uk.co.samuelwall:material-tap-target-prompt:2.1.0'

implementation 'com.github.deano2390:FlowTextView:2.0.5'
implementation 'com.github.stfalcon:chatkit:0.2.1'
implementation 'com.github.oxoooo:touch-image-view:1.0.1'
implementation 'com.andrognito.patternlockview:patternlockview:1.0.0'
Expand All @@ -105,23 +116,24 @@ dependencies {
implementation 'io.github.yavski:fab-speed-dial:1.0.6'
implementation 'com.classic.common:multiple-status-view:1.2'
implementation 'jp.wasabeef:glide-transformations:2.0.1'
implementation('cn.leancloud.android:avoscloud-sdk:v3.+')
implementation('cn.leancloud.android:avoscloud-push:v3.+@aar') { transitive = true }// 推送与实时聊天需要的包
implementation 'cn.leancloud.android:avoscloud-sdk:v4.6.4'
implementation('cn.leancloud.android:avoscloud-push:v4.6.4@aar') { transitive = true }
// 推送与实时聊天需要的包

//============== official ==============
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:support-v4:26.1.0'
implementation 'com.android.support:cardview-v7:26.1.0'
implementation 'com.android.support:recyclerview-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation "com.android.support:design:$supportVersion"
implementation "com.android.support:appcompat-v7:$supportVersion"
implementation "com.android.support:support-v4:$supportVersion"
implementation "com.android.support:cardview-v7:$supportVersion"
implementation "com.android.support:recyclerview-v7:$supportVersion"
implementation 'com.android.support.constraint:constraint-layout:1.1.0'

//============== debug ==============
// implementation 'cn.jiguang.sdk:jpush:3.0.3'
// implementation 'cn.jiguang.sdk:jcore:1.1.1'
implementation 'com.android.support:support-vector-drawable:26.1.0'
implementation "com.android.support:support-vector-drawable:$supportVersion"
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
// releaseimplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'
// debugimplementation 'com.squareup.leakcanary:leakcanary-android:1.5'
// debugimplementation 'com.squareup.leakcanary:leakcanary-android:1.5'

}
Binary file modified app/release/app-armeabi-v7a-release.apk
Binary file not shown.
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
android:theme="@style/ViewerTheme.TransNav"/>
<activity
android:name=".detail.DiariesViewerActivity"
android:theme="@style/AppTheme.NoActionBar.Default"
android:windowSoftInputMode="adjustResize"/>
<activity
android:name=".edit.EditNotebookActivity"
Expand Down
22 changes: 21 additions & 1 deletion app/src/main/java/com/dante/diary/base/BaseFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import android.support.annotation.Nullable;
import android.support.design.widget.AppBarLayout;
import android.support.v4.app.Fragment;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.transition.Fade;
Expand Down Expand Up @@ -46,6 +47,16 @@ public void onCreate(@Nullable Bundle savedInstanceState) {
}
}

public void setStatusBarColor(int colorRes) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
if (getActivity() != null) {
if (getActivity().getWindow() == null) return;
getActivity().getWindow().setStatusBarColor(
ContextCompat.getColor(getActivity(), colorRes));
}
}
}

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
Expand All @@ -58,6 +69,15 @@ public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
return rootView;
}

protected int initStatusBarColor() {
return R.color.colorPrimaryDark;
}

@Override
public void onStart() {
super.onStart();
setStatusBarColor(initStatusBarColor());
}

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
protected void setAnimations() {
Expand Down Expand Up @@ -118,7 +138,7 @@ protected void onCreateView() {
}

public void initAppBar() {
toolbar = (Toolbar) getView().findViewById(R.id.toolbar);
toolbar = getView().findViewById(R.id.toolbar);
log("initAppBar");
if (getActivity() != null && null != toolbar) {
log("initAppBar set");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ private void initBottomBar() {
}
});
bottomBar.setOnTabReselectListener(tabId -> {
controller.clearStack();
// controller.clearStack();
// scrollToTop();
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public abstract class RecyclerFragment extends BaseFragment implements SwipeRefr
@BindView(R.id.fab)
public FloatingActionButton fab;


@Override
protected int initLayoutId() {
return R.layout.fragment_recycler;
Expand Down
10 changes: 6 additions & 4 deletions app/src/main/java/com/dante/diary/custom/NotificationUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import android.app.TaskStackBuilder;
import android.content.Context;
import android.content.Intent;
import android.support.v4.app.NotificationCompat;

import com.avos.avospush.notification.NotificationCompat;
import com.dante.diary.R;
import com.dante.diary.chat.ConversationActivity;
import com.dante.diary.utils.SpUtil;
Expand All @@ -22,6 +22,7 @@
*/
public class NotificationUtils {

private static final String CHANNEL_ID = "CHANNEL_ID";
/**
* tag list,用来标记是否应该展示 Notification
* 比如已经在聊天页面了,实际就不应该再弹出 notification
Expand Down Expand Up @@ -54,10 +55,9 @@ public static boolean isShowNotification(String tag) {

public static void showNotification(int mId, String title, String content, Intent intent) {
NotificationCompat.Builder mBuilder =
new NotificationCompat.Builder(context)
new NotificationCompat.Builder(context, CHANNEL_ID)
.setSmallIcon(R.drawable.notification_icon)
.setAutoCancel(true)

.setContentTitle(title)
.setContentText(content);

Expand All @@ -78,6 +78,8 @@ public static void showNotification(int mId, String title, String content, Inten
NotificationManager mNotificationManager =
(NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
// mId allows you to update the notification later on.
mNotificationManager.notify(mId, mBuilder.build());
if (mNotificationManager != null) {
mNotificationManager.notify(mId, mBuilder.build());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ protected void initData() {
toolbar.inflateMenu(R.menu.menu_detail);
toolbar.setOnClickListener(v -> scrollView.smoothScrollTo(0, 0));
fetch();

log("initdata" + getActivity().getLocalClassName());
}

@Override
Expand Down Expand Up @@ -408,6 +408,8 @@ private void inflateDiary() {
}
getActivity().supportPostponeEnterTransition();
diaryDate.setText(DateUtil.getDisplayDay(diary.getCreated()));
// content.setColor(ContextCompat.getColor(getActivity(), R.color.primaryText));
// content.setTextSize(ConvertUtils.sp2px(16));
content.setText(diary.getContent());
diaryLayout.setOnLongClickListener(this);
content.setOnLongClickListener(this);
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/java/com/dante/diary/detail/PictureFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ public static PictureFragment newInstance(String url, boolean isGif) {
return fragment;
}

@Override
protected int initStatusBarColor() {
return android.R.color.transparent;
}

@Override
protected int initLayoutId() {
Expand Down
Loading

0 comments on commit 8cd4d51

Please sign in to comment.