forked from qinci/MarkdownEditors
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
80 changed files
with
1,622 additions
and
1,288 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,19 @@ | ||
/* | ||
* Copyright 2016. SHENQINCI(沈钦赐)<[email protected]> | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package ren.qinc.markdowneditors.base; | ||
|
||
import android.content.Context; | ||
|
@@ -29,7 +45,6 @@ | |
import java.lang.reflect.Field; | ||
|
||
import butterknife.ButterKnife; | ||
|
||
import ren.qinc.markdowneditors.AppManager; | ||
import ren.qinc.markdowneditors.event.RxEvent; | ||
import ren.qinc.markdowneditors.event.RxEventBus; | ||
|
@@ -60,9 +75,6 @@ protected void onCreate(Bundle savedInstanceState) { | |
// StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder().detectAll().penaltyLog().build()); | ||
// } | ||
if (isNeedLogin()) {//如果子类返回true,代表当前界面需要登录才能进去 | ||
// AppContext.showToast("请先登录"); | ||
//跳到登录界面 | ||
//xxxx | ||
finish(); | ||
} | ||
registerEvent(); | ||
|
@@ -249,55 +261,19 @@ public void dismissInput(EditText editTextTemp) { | |
inputManager.hideSoftInputFromWindow(editTextTemp.getWindowToken(), 0); | ||
} | ||
} | ||
// | ||
// /** | ||
// * 代替findViewById 自动类型转换 | ||
// * | ||
// * @param <T> the type parameter | ||
// * @param id the id | ||
// * @return t | ||
// */ | ||
// @SuppressWarnings("unchecked") | ||
// @Deprecated | ||
// protected final <T extends View> T findView(@IdRes int id) { | ||
// return (T) findViewById(id); | ||
// } | ||
// | ||
// /** | ||
// * 设置view的点击事件 | ||
// * Set view click listener t. | ||
// * | ||
// * @param <T> the type parameter | ||
// * @param v the v | ||
// * @param clickListener the click listener | ||
// * @return the t | ||
// */ | ||
// protected final <T extends View> T setViewClickListener(T v, @NonNull View.OnClickListener clickListener) { | ||
// v.setOnClickListener(clickListener); | ||
// return v; | ||
// } | ||
// | ||
// /** | ||
// * Set view click listener by id t. | ||
// * | ||
// * @param <T> the type parameter | ||
// * @param id the id | ||
// * @param clickListener the click listener | ||
// * @return the t | ||
// */ | ||
// @SuppressWarnings("unchecked") | ||
// protected final <T extends View> T setViewClickListenerById(@IdRes int id, @NonNull View.OnClickListener clickListener) { | ||
// return setViewClickListener((T) findView(id), clickListener); | ||
// } | ||
|
||
|
||
@Override | ||
public void onSupportActionModeStarted(ActionMode mode) { | ||
super.onSupportActionModeStarted(mode); | ||
//Call this method | ||
fixActionModeCallback(this, mode); | ||
} | ||
|
||
/** | ||
* 修复长按文本启动系统的复制粘贴ActionMode的状态栏颜色 | ||
* | ||
* @param activity | ||
* @param mode | ||
*/ | ||
private void fixActionModeCallback(AppCompatActivity activity, ActionMode mode) { | ||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) | ||
return; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,19 @@ | ||
/* | ||
* Copyright 2016. SHENQINCI(沈钦赐)<[email protected]> | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package ren.qinc.markdowneditors.base; | ||
|
||
import android.app.Application; | ||
|
@@ -70,10 +86,6 @@ public void onTerminate() { | |
super.onTerminate(); | ||
AppManager.getAppManager().AppExit(this); | ||
} | ||
//------------SharedPreferences操作封装 | ||
|
||
|
||
// ----------- resource资源操作相关 | ||
|
||
/** | ||
* 根据资源返回String值 | ||
|
@@ -114,6 +126,7 @@ public static Snackbar showSnackbar(@NonNull View view, @NonNull String message, | |
snackbar.show(); | ||
return snackbar; | ||
} | ||
|
||
public static Snackbar showSnackbar(@NonNull View view, @NonNull int messageRes, @Snackbar.Duration int duration, @Nullable View.OnClickListener listener, @Nullable String actionStr) { | ||
Snackbar snackbar = Snackbar.make(view, messageRes, duration); | ||
if (listener != null && Check.isEmpty(actionStr)) { | ||
|
@@ -126,6 +139,7 @@ public static Snackbar showSnackbar(@NonNull View view, @NonNull int messageRes, | |
public static Snackbar showSnackbar(@NonNull View view, @NonNull String message) { | ||
return showSnackbar(view, message, Snackbar.LENGTH_SHORT, null, null); | ||
} | ||
|
||
public static Snackbar showSnackbar(@NonNull View view, @StringRes int messageRes) { | ||
return showSnackbar(view, messageRes, Snackbar.LENGTH_SHORT, null, null); | ||
} | ||
|
@@ -149,6 +163,7 @@ public static Snackbar showSnackbarLong(@NonNull View view, @NonNull String mess | |
public static Snackbar showSnackbarIndefinite(@NonNull View view, @NonNull String message, @Nullable View.OnClickListener listener, @Nullable String actionStr) { | ||
return showSnackbar(view, message, Snackbar.LENGTH_INDEFINITE, listener, actionStr); | ||
} | ||
|
||
public static Snackbar showSnackbar(@NonNull View view, @NonNull String message, @Nullable View.OnClickListener listener) { | ||
return showSnackbar(view, message, Snackbar.LENGTH_SHORT, listener, "确定"); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,19 @@ | ||
/* | ||
* Copyright 2016. SHENQINCI(沈钦赐)<[email protected]> | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package ren.qinc.markdowneditors.base; | ||
|
||
import android.content.res.ColorStateList; | ||
|
@@ -33,16 +49,17 @@ protected NavigationView getNavigationView() { | |
@Override | ||
protected void init() { | ||
super.init(); | ||
if (mDrawerLayout == null || mNavigationView == null) // 如果布局文件没有找到toolbar,则不设置actionbar | ||
{ | ||
// 如果要用这个类,这两个东西不能为空 | ||
if (mDrawerLayout == null || mNavigationView == null) { | ||
throw new IllegalStateException(this.getClass().getSimpleName() + ":要使用BaseDrawerLayoutActivity,必须在布局里面增加id为‘id_drawer’的DrawerLayout"); | ||
} | ||
initDrawer(); | ||
} | ||
|
||
protected void initStatusBar() { | ||
SystemBarUtils.tintStatusBarForDrawer(this,mDrawerLayout, getResources().getColor(R.color.colorPrimary)); | ||
SystemBarUtils.tintStatusBarForDrawer(this, mDrawerLayout, getResources().getColor(R.color.colorPrimary)); | ||
} | ||
|
||
private void initDrawer() { | ||
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( | ||
this, mDrawerLayout, getToolbar(), R.string.navigation_drawer_open, R.string.navigation_drawer_close); | ||
|
Oops, something went wrong.