修复若干BUG GH_TEST渠道号自动弄成刷新版
This commit is contained in:
@ -42,7 +42,9 @@ public class BaseDialogWrapperFragment extends BaseDialogFragment {
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
getChildFragmentManager().beginTransaction().replace(R.id.fragment_placeholder, mFragmentToWrap).commitNowAllowingStateLoss();
|
||||
if (mFragmentToWrap != null) {
|
||||
getChildFragmentManager().beginTransaction().replace(R.id.fragment_placeholder, mFragmentToWrap).commitNowAllowingStateLoss();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -4,6 +4,7 @@ import android.support.v4.util.ArrayMap;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.gh.common.constant.Constants;
|
||||
import com.halo.assistant.HaloApp;
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@ -41,39 +42,40 @@ public class TimestampUtils {
|
||||
*/
|
||||
public static String addTimestamp(String url) {
|
||||
|
||||
// // TODO: 22/12/17 刷新版
|
||||
// if (TextUtils.isEmpty(url)) {
|
||||
// return url;
|
||||
// }
|
||||
// if (url.contains("?")) {
|
||||
// String u = url + "×tamp=" + System.currentTimeMillis();
|
||||
// return u;
|
||||
// } else {
|
||||
// String u = url + "?timestamp=" + System.currentTimeMillis();
|
||||
// return u;
|
||||
// }
|
||||
|
||||
if (TextUtils.isEmpty(url)) {
|
||||
return url;
|
||||
}
|
||||
int cd = 0;
|
||||
for (String key : getCdMap().keySet()) {
|
||||
if (Pattern.matches(key, url)) {
|
||||
cd = getCdMap().get(key);
|
||||
break;
|
||||
if ("GH_TEST".equals(HaloApp.getInstance().getChannel())) {
|
||||
if (TextUtils.isEmpty(url)) {
|
||||
return url;
|
||||
}
|
||||
if (url.contains("?")) {
|
||||
String u = url + "×tamp=" + System.currentTimeMillis();
|
||||
return u;
|
||||
} else {
|
||||
String u = url + "?timestamp=" + System.currentTimeMillis();
|
||||
return u;
|
||||
}
|
||||
}
|
||||
if (cd == 0) {
|
||||
return url;
|
||||
}
|
||||
if (url.contains("?")) {
|
||||
String u = url + "×tamp=" + getTimestamp(url, cd);
|
||||
// Utils.log("url = " + u);
|
||||
return u;
|
||||
} else {
|
||||
String u = url + "?timestamp=" + getTimestamp(url, cd);
|
||||
if (TextUtils.isEmpty(url)) {
|
||||
return url;
|
||||
}
|
||||
int cd = 0;
|
||||
for (String key : getCdMap().keySet()) {
|
||||
if (Pattern.matches(key, url)) {
|
||||
cd = getCdMap().get(key);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (cd == 0) {
|
||||
return url;
|
||||
}
|
||||
if (url.contains("?")) {
|
||||
String u = url + "×tamp=" + getTimestamp(url, cd);
|
||||
// Utils.log("url = " + u);
|
||||
return u;
|
||||
return u;
|
||||
} else {
|
||||
String u = url + "?timestamp=" + getTimestamp(url, cd);
|
||||
// Utils.log("url = " + u);
|
||||
return u;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -74,6 +74,7 @@ class QuestionEditActivity : BaseActivity() {
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
setToolbarMenu(R.menu.menu_question_post)
|
||||
mViewModel = ViewModelProviders.of(this).get(QuestionEditViewModel::class.java)
|
||||
mBinding = DataBindingUtil.bind(mContentView)
|
||||
@ -83,14 +84,14 @@ class QuestionEditActivity : BaseActivity() {
|
||||
val detailEntity = intent.getParcelableExtra<QuestionsDetailEntity>(QuestionsDetailEntity.TAG)
|
||||
if (detailEntity != null) { // 问题编辑
|
||||
mViewModel?.questionEntity = detailEntity
|
||||
mViewModel?.title = detailEntity.title
|
||||
mViewModel?.content = detailEntity.description
|
||||
mViewModel?.picList?.postValue(detailEntity.images as MutableList<String>?)
|
||||
if (mViewModel?.title.isNullOrEmpty()) mViewModel?.title = detailEntity.title
|
||||
} else { // 新增问题
|
||||
var searchKey = intent.getStringExtra(EntranceUtils.KEY_QUESTIONS_SEARCH_KEY)
|
||||
if (!searchKey.isNullOrEmpty() && searchKey.length > QuestionEditViewModel.QUESTION_TITLE_MAX_LENGTH)
|
||||
searchKey = searchKey.substring(0, QuestionEditViewModel.QUESTION_TITLE_MAX_LENGTH)
|
||||
mViewModel?.title = searchKey
|
||||
if (mViewModel?.title.isNullOrEmpty()) mViewModel?.title = searchKey
|
||||
}
|
||||
}
|
||||
|
||||
@ -146,8 +147,10 @@ class QuestionEditActivity : BaseActivity() {
|
||||
})
|
||||
|
||||
mViewModel?.titleTags?.observe(this, Observer<List<String>> {
|
||||
val dialog = BaseDialogWrapperFragment.getInstance(TagsSelectFragment.getInstance(), false)
|
||||
dialog.show(supportFragmentManager, null)
|
||||
if (supportFragmentManager.findFragmentByTag(TagsSelectFragment::javaClass.name) == null) {
|
||||
val dialog = BaseDialogWrapperFragment.getInstance(TagsSelectFragment.getInstance(), false)
|
||||
dialog.show(supportFragmentManager, TagsSelectFragment::javaClass.name)
|
||||
}
|
||||
})
|
||||
|
||||
mViewModel?.picList?.observe(this, Observer { it ->
|
||||
|
||||
@ -286,5 +286,6 @@ public class QuestionsDetailAdapter extends ListAdapter<AnswerEntity> {
|
||||
|
||||
void setDataStatus(boolean isNoneData) {
|
||||
mIsNoneData = isNoneData;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@ -172,7 +172,6 @@ public class QuestionsDetailFragment extends ListFragment<AnswerEntity, NormalLi
|
||||
onLoadDone();
|
||||
mAdapter.loadChange(LoadStatus.LIST_OVER);
|
||||
mAdapter.setDataStatus(true);
|
||||
mAdapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user