Compare commits
No commits in common. 'ef78de301c033f62a7a0730736494c9b8d386c98' and '8e5086476523fa853888bbb0e3748a68d167f1c0' have entirely different histories.
ef78de301c
...
8e50864765
21 changed files with 279 additions and 1278 deletions
@ -1,62 +0,0 @@ |
|||||||
package com.bingce.controlnetwork.activity; |
|
||||||
|
|
||||||
import android.annotation.SuppressLint; |
|
||||||
import android.content.Context; |
|
||||||
import android.content.Intent; |
|
||||||
import android.content.pm.ActivityInfo; |
|
||||||
import android.os.Bundle; |
|
||||||
import android.text.TextUtils; |
|
||||||
import android.view.MenuItem; |
|
||||||
import android.view.WindowManager; |
|
||||||
import android.widget.TextView; |
|
||||||
|
|
||||||
import androidx.annotation.Nullable; |
|
||||||
import androidx.appcompat.widget.Toolbar; |
|
||||||
|
|
||||||
import com.bingce.controlnetwork.R; |
|
||||||
import com.bingce.controlnetwork.util.CrashCollectUtils; |
|
||||||
import com.bingce.utils.ThreadPoolUtil; |
|
||||||
|
|
||||||
import org.polaric.colorful.ColorfulActivity; |
|
||||||
|
|
||||||
public class ViewRecentCrashActivity extends ColorfulActivity { |
|
||||||
|
|
||||||
@SuppressLint("SourceLockedOrientationActivity") |
|
||||||
@Override |
|
||||||
protected void onCreate(@Nullable Bundle savedInstanceState) { |
|
||||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); |
|
||||||
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); |
|
||||||
|
|
||||||
super.onCreate(savedInstanceState); |
|
||||||
setContentView(R.layout.activity_view_recent_crash_log); |
|
||||||
Toolbar mToolbar = findViewById(R.id.toolbar); |
|
||||||
setSupportActionBar(mToolbar); |
|
||||||
if (getSupportActionBar() != null) |
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true); |
|
||||||
TextView textView = findViewById(R.id.tv_content); |
|
||||||
if (textView != null) { |
|
||||||
ThreadPoolUtil.execute(() -> { |
|
||||||
CrashCollectUtils.collectCrashLogInWorkerThread((cloudTable, appLabelKey, fileNameKey, contentKey, uuidKey, crashContent) -> { |
|
||||||
if (!TextUtils.isEmpty(crashContent)) { |
|
||||||
runOnUiThread(() -> textView.setText(crashContent)); |
|
||||||
} |
|
||||||
}); |
|
||||||
}); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public boolean onOptionsItemSelected(MenuItem item) { |
|
||||||
switch (item.getItemId()) { |
|
||||||
case android.R.id.home: |
|
||||||
finish(); |
|
||||||
break; |
|
||||||
} |
|
||||||
return super.onOptionsItemSelected(item); |
|
||||||
} |
|
||||||
|
|
||||||
public static void start(Context context) { |
|
||||||
Intent intent = new Intent(context, ViewRecentCrashActivity.class); |
|
||||||
context.startActivity(intent); |
|
||||||
} |
|
||||||
} |
|
@ -1,5 +0,0 @@ |
|||||||
package com.bingce.controlnetwork.newui.stationsettingheighttraverse |
|
||||||
|
|
||||||
interface IStationSettingOperate { |
|
||||||
fun checkSaveNot(): Boolean |
|
||||||
} |
|
@ -1,213 +0,0 @@ |
|||||||
package com.bingce.controlnetwork.newui.stationsettingheighttraverse |
|
||||||
|
|
||||||
import android.text.TextUtils |
|
||||||
import android.view.LayoutInflater |
|
||||||
import android.view.ViewGroup |
|
||||||
import android.widget.EditText |
|
||||||
import androidx.fragment.app.activityViewModels |
|
||||||
import androidx.lifecycle.lifecycleScope |
|
||||||
import blankj.utilcode.util.ToastUtils |
|
||||||
import com.bingce.controlapphelper.datasource.database.SurveyorDatabaseFactory |
|
||||||
import com.bingce.controlapphelper.datasource.database.config.ConfigConstants |
|
||||||
import com.bingce.controlapphelper.datasource.database.heighttraverse.stationsetting.model.StationSettingHeightTraverseRecord |
|
||||||
import com.bingce.controlapphelper.util.Tools |
|
||||||
import com.bingce.controlnetwork.R |
|
||||||
import com.bingce.controlnetwork.databinding.NewFragmentStationSettingEnvironmentHeightTraverseBinding |
|
||||||
import com.bingce.controlnetwork.fragment.stationsetting.BaseStationSettingFragment.Companion.DEFAULT_AIR_PRESSURE |
|
||||||
import com.bingce.controlnetwork.fragment.stationsetting.BaseStationSettingFragment.Companion.DEFAULT_CONSTANT |
|
||||||
import com.bingce.controlnetwork.fragment.stationsetting.BaseStationSettingFragment.Companion.DEFAULT_TEMPERATURE |
|
||||||
import com.bingce.controlnetwork.newui.base.BaseFragmentBinding |
|
||||||
import kotlinx.coroutines.Dispatchers |
|
||||||
import kotlinx.coroutines.launch |
|
||||||
import kotlinx.coroutines.withContext |
|
||||||
|
|
||||||
/** |
|
||||||
* 测站设置-环境信息 |
|
||||||
*/ |
|
||||||
class StationSettingEnvironmentHeightTraverseFragment : |
|
||||||
BaseFragmentBinding<NewFragmentStationSettingEnvironmentHeightTraverseBinding>(), |
|
||||||
IStationSettingOperate { |
|
||||||
|
|
||||||
private val viewModel by activityViewModels<StationSettingHeightTraverseVm>() |
|
||||||
|
|
||||||
override fun getViewBinding( |
|
||||||
inflater: LayoutInflater, |
|
||||||
container: ViewGroup? |
|
||||||
): NewFragmentStationSettingEnvironmentHeightTraverseBinding { |
|
||||||
return NewFragmentStationSettingEnvironmentHeightTraverseBinding.inflate( |
|
||||||
inflater, |
|
||||||
container, |
|
||||||
false |
|
||||||
) |
|
||||||
} |
|
||||||
|
|
||||||
override fun initView() { |
|
||||||
mBinding.ilDryTemperature.tvName.text = getString(R.string.dry_temperature) |
|
||||||
mBinding.ilDryTemperature.etValue.hint = getString(R.string.dry_temperature) |
|
||||||
mBinding.ilDryTemperature.tvUnit.text = "℃" |
|
||||||
|
|
||||||
mBinding.ilHumidityTemperature.tvName.text = getString(R.string.humidity_temperature) |
|
||||||
mBinding.ilHumidityTemperature.etValue.hint = getString(R.string.humidity_temperature) |
|
||||||
mBinding.ilHumidityTemperature.tvUnit.text = "℃" |
|
||||||
|
|
||||||
mBinding.ilAirPressure.tvName.text = getString(R.string.hint_air_pressure) |
|
||||||
mBinding.ilAirPressure.etValue.hint = getString(R.string.hint_air_pressure) |
|
||||||
mBinding.ilAirPressure.tvUnit.text = "hPa" |
|
||||||
|
|
||||||
mBinding.ilAdditionConstant.tvName.text = getString(R.string.addition_constant) |
|
||||||
mBinding.ilAdditionConstant.etValue.hint = getString(R.string.addition_constant) |
|
||||||
mBinding.ilAdditionConstant.tvUnit.text = "mm" |
|
||||||
|
|
||||||
mBinding.ilmultiplicationConstant.tvName.text = getString(R.string.multiplication_constant) |
|
||||||
mBinding.ilmultiplicationConstant.etValue.hint = getString(R.string.multiplication_constant) |
|
||||||
mBinding.ilmultiplicationConstant.tvUnit.text = "ppm" |
|
||||||
|
|
||||||
initListener() |
|
||||||
} |
|
||||||
|
|
||||||
private fun initListener() { |
|
||||||
mBinding.tvLastData.setOnClickListener { |
|
||||||
useLastData() |
|
||||||
} |
|
||||||
mBinding.tvStandardData.setOnClickListener { |
|
||||||
setDataFromRecord(null) |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
private fun useLastData() { |
|
||||||
lifecycleScope.launch { |
|
||||||
val record = withContext(Dispatchers.IO) { |
|
||||||
val dryTemperature = getValueFromLastKey(ConfigConstants.KEY_LAST_DRY_TEMPERATURE) |
|
||||||
val humidityTemperature = |
|
||||||
getValueFromLastKey(ConfigConstants.KEY_LAST_HUMIDITY_TEMPERATURE) |
|
||||||
val airPressure = getValueFromLastKey(ConfigConstants.KEY_LAST_AIR_PRESSURE) |
|
||||||
val additionConstant = |
|
||||||
getValueFromLastKey(ConfigConstants.KEY_LAST_ADDITION_CONSTANT) |
|
||||||
val multiplicationConstant = |
|
||||||
getValueFromLastKey(ConfigConstants.KEY_LAST_MULTIPLICATION_CONSTANT) |
|
||||||
val instrumentHeightBefore = |
|
||||||
getValueFromLastKey(ConfigConstants.KEY_LAST_INSTRUMENT_HEIGHT_BEFORE) |
|
||||||
val instrumentHeightAfter = |
|
||||||
getValueFromLastKey(ConfigConstants.KEY_LAST_INSTRUMENT_HEIGHT_AFTER) |
|
||||||
val backPrismHeightBefore = |
|
||||||
getValueFromLastKey(ConfigConstants.KEY_LAST_BACK_PRISM_HEIGHT_BEFORE) |
|
||||||
val backPrismHeightAfter = |
|
||||||
getValueFromLastKey(ConfigConstants.KEY_LAST_BACK_PRISM_HEIGHT_AFTER) |
|
||||||
val frontPrismHeightBefore = |
|
||||||
getValueFromLastKey(ConfigConstants.KEY_LAST_FRONT_PRISM_HEIGHT_BEFORE) |
|
||||||
val frontPrismHeightAfter = |
|
||||||
getValueFromLastKey(ConfigConstants.KEY_LAST_FRONT_PRISM_HEIGHT_AFTER) |
|
||||||
|
|
||||||
if (dryTemperature == null |
|
||||||
|| humidityTemperature == null |
|
||||||
|| airPressure == null |
|
||||||
|| additionConstant == null |
|
||||||
|| multiplicationConstant == null |
|
||||||
|| instrumentHeightBefore == null |
|
||||||
|| instrumentHeightAfter == null |
|
||||||
|| backPrismHeightBefore == null |
|
||||||
|| backPrismHeightAfter == null |
|
||||||
|| frontPrismHeightBefore == null |
|
||||||
|| frontPrismHeightAfter == null |
|
||||||
) { |
|
||||||
return@withContext null |
|
||||||
} |
|
||||||
|
|
||||||
StationSettingHeightTraverseRecord.newInstance( |
|
||||||
viewModel.stationId, |
|
||||||
dryTemperature, |
|
||||||
humidityTemperature, |
|
||||||
airPressure, |
|
||||||
additionConstant, |
|
||||||
multiplicationConstant, |
|
||||||
instrumentHeightBefore, |
|
||||||
instrumentHeightAfter, |
|
||||||
backPrismHeightBefore, |
|
||||||
backPrismHeightAfter, |
|
||||||
frontPrismHeightBefore, |
|
||||||
frontPrismHeightAfter |
|
||||||
) |
|
||||||
} |
|
||||||
|
|
||||||
setDataFromRecord(record) |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
private fun getValueFromLastKey(key: String): String? { |
|
||||||
val record = |
|
||||||
SurveyorDatabaseFactory.instance.configDataSource.getByKeySync(key) |
|
||||||
return record?.configValue |
|
||||||
} |
|
||||||
|
|
||||||
override fun initData() { |
|
||||||
lifecycleScope.launch { |
|
||||||
val record = withContext(Dispatchers.IO) { |
|
||||||
SurveyorDatabaseFactory.instance.getStationSettingHeightTraverseDataSource() |
|
||||||
.getRecordByStationId(viewModel.stationId) |
|
||||||
} |
|
||||||
setDataFromRecord(record) |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
private fun setDataFromRecord(record: StationSettingHeightTraverseRecord?) { |
|
||||||
mBinding.ilDryTemperature.etValue.setText( |
|
||||||
record?.dryTemperature ?: DEFAULT_TEMPERATURE |
|
||||||
) |
|
||||||
mBinding.ilHumidityTemperature.etValue.setText( |
|
||||||
record?.humidityTemperature ?: DEFAULT_TEMPERATURE |
|
||||||
) |
|
||||||
mBinding.ilAirPressure.etValue.setText(record?.airPressure ?: DEFAULT_AIR_PRESSURE) |
|
||||||
mBinding.ilAdditionConstant.etValue.setText( |
|
||||||
record?.additionConstant ?: DEFAULT_CONSTANT |
|
||||||
) |
|
||||||
mBinding.ilmultiplicationConstant.etValue.setText( |
|
||||||
record?.multiplicationConstant ?: DEFAULT_CONSTANT |
|
||||||
) |
|
||||||
} |
|
||||||
|
|
||||||
override fun checkSaveNot(): Boolean { |
|
||||||
if (editTextEmpty(mBinding.ilDryTemperature.etValue)) { |
|
||||||
ToastUtils.showShort(R.string.please_enter_dry_temperature) |
|
||||||
return true |
|
||||||
} |
|
||||||
if (editTextEmpty(mBinding.ilHumidityTemperature.etValue)) { |
|
||||||
ToastUtils.showShort(R.string.please_enter_humidity_temperature) |
|
||||||
return true |
|
||||||
} |
|
||||||
if (editTextEmpty(mBinding.ilAirPressure.etValue)) { |
|
||||||
ToastUtils.showShort(Tools.getString(R.string.please_enter_air_pressure)) |
|
||||||
return true |
|
||||||
} |
|
||||||
if (editTextEmpty(mBinding.ilAdditionConstant.etValue)) { |
|
||||||
ToastUtils.showShort(R.string.please_enter_addition_constant) |
|
||||||
return true |
|
||||||
} |
|
||||||
if (editTextEmpty(mBinding.ilmultiplicationConstant.etValue)) { |
|
||||||
ToastUtils.showShort(R.string.please_enter_multiplication_constant) |
|
||||||
return true |
|
||||||
} |
|
||||||
setDataToViewModel() |
|
||||||
return false |
|
||||||
} |
|
||||||
|
|
||||||
private fun setDataToViewModel() { |
|
||||||
val dryTemperature = getEtText(mBinding.ilDryTemperature.etValue) |
|
||||||
val humidityTemperature = getEtText(mBinding.ilHumidityTemperature.etValue) |
|
||||||
val airPressure = getEtText(mBinding.ilAirPressure.etValue) |
|
||||||
val additionConstant = getEtText(mBinding.ilAdditionConstant.etValue) |
|
||||||
val multiplicationConstant = getEtText(mBinding.ilmultiplicationConstant.etValue) |
|
||||||
|
|
||||||
viewModel.dryTemperature = dryTemperature |
|
||||||
viewModel.humidityTemperature = humidityTemperature |
|
||||||
viewModel.airPressure = airPressure |
|
||||||
viewModel.additionConstant = additionConstant |
|
||||||
viewModel.multiplicationConstant = multiplicationConstant |
|
||||||
} |
|
||||||
|
|
||||||
private fun editTextEmpty(et: EditText): Boolean { |
|
||||||
return TextUtils.isEmpty(getEtText(et)) |
|
||||||
} |
|
||||||
|
|
||||||
private fun getEtText(et: EditText) = et.text.toString().trim() |
|
||||||
|
|
||||||
} |
|
@ -1,151 +0,0 @@ |
|||||||
package com.bingce.controlnetwork.newui.stationsettingheighttraverse |
|
||||||
|
|
||||||
import android.text.TextUtils |
|
||||||
import android.view.LayoutInflater |
|
||||||
import android.view.ViewGroup |
|
||||||
import android.widget.EditText |
|
||||||
import androidx.fragment.app.activityViewModels |
|
||||||
import androidx.lifecycle.lifecycleScope |
|
||||||
import blankj.utilcode.util.ToastUtils |
|
||||||
import com.bingce.controlapphelper.datasource.database.SurveyorDatabaseFactory |
|
||||||
import com.bingce.controlapphelper.datasource.database.heighttraverse.stationsetting.model.StationSettingHeightTraverseRecord |
|
||||||
import com.bingce.controlnetwork.R |
|
||||||
import com.bingce.controlnetwork.databinding.NewFragmentStationSettingHeightHeightTraverseBinding |
|
||||||
import com.bingce.controlnetwork.fragment.stationsetting.BaseStationSettingFragment.Companion.DEFAULT_INSTRUMEN_HEIGHT |
|
||||||
import com.bingce.controlnetwork.newui.base.BaseFragmentBinding |
|
||||||
import kotlinx.coroutines.Dispatchers |
|
||||||
import kotlinx.coroutines.launch |
|
||||||
import kotlinx.coroutines.withContext |
|
||||||
|
|
||||||
/** |
|
||||||
* 高程导线-仪高镜高 |
|
||||||
*/ |
|
||||||
class StationSettingHeightHeightTraverseFragment : |
|
||||||
BaseFragmentBinding<NewFragmentStationSettingHeightHeightTraverseBinding>(), |
|
||||||
IStationSettingOperate { |
|
||||||
|
|
||||||
private val viewModel by activityViewModels<StationSettingHeightTraverseVm>() |
|
||||||
|
|
||||||
|
|
||||||
override fun getViewBinding( |
|
||||||
inflater: LayoutInflater, |
|
||||||
container: ViewGroup? |
|
||||||
): NewFragmentStationSettingHeightHeightTraverseBinding { |
|
||||||
return NewFragmentStationSettingHeightHeightTraverseBinding.inflate( |
|
||||||
inflater, |
|
||||||
container, |
|
||||||
false |
|
||||||
) |
|
||||||
} |
|
||||||
|
|
||||||
override fun initView() { |
|
||||||
mBinding.ilInstrumentHeight.tvName.text = getString(R.string.instrument_height) |
|
||||||
mBinding.ilBackPrismHeight.tvName.text = getString(R.string.back_prism_height) |
|
||||||
mBinding.ilFrontPrismHeight.tvName.text = getString(R.string.front_prism_height) |
|
||||||
|
|
||||||
//仪器高,棱镜高 |
|
||||||
mBinding.ilInstrumentHeight.button1.setOnClickListener { |
|
||||||
mBinding.ilInstrumentHeight.etValueAfter.setText( |
|
||||||
getEtText(mBinding.ilInstrumentHeight.etValueBefore) |
|
||||||
) |
|
||||||
} |
|
||||||
mBinding.ilBackPrismHeight.button1.setOnClickListener { |
|
||||||
mBinding.ilBackPrismHeight.etValueAfter.setText( |
|
||||||
getEtText(mBinding.ilBackPrismHeight.etValueBefore) |
|
||||||
) |
|
||||||
} |
|
||||||
mBinding.ilFrontPrismHeight.button1.setOnClickListener { |
|
||||||
mBinding.ilFrontPrismHeight.etValueAfter.setText( |
|
||||||
getEtText(mBinding.ilFrontPrismHeight.etValueBefore) |
|
||||||
) |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
private fun getEtText(et: EditText) = et.text.toString().trim() |
|
||||||
|
|
||||||
|
|
||||||
override fun initData() { |
|
||||||
lifecycleScope.launch { |
|
||||||
val record = withContext(Dispatchers.IO) { |
|
||||||
SurveyorDatabaseFactory.instance.getStationSettingHeightTraverseDataSource() |
|
||||||
.getRecordByStationId(viewModel.stationId) |
|
||||||
} |
|
||||||
setDataFromRecord(record) |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
private fun setDataFromRecord(record: StationSettingHeightTraverseRecord?) { |
|
||||||
mBinding.ilInstrumentHeight.etValueBefore.setText( |
|
||||||
record?.instrumentHeightBefore ?: DEFAULT_INSTRUMEN_HEIGHT |
|
||||||
) |
|
||||||
mBinding.ilInstrumentHeight.etValueAfter.setText( |
|
||||||
record?.instrumentHeightAfter ?: DEFAULT_INSTRUMEN_HEIGHT |
|
||||||
) |
|
||||||
mBinding.ilBackPrismHeight.etValueBefore.setText( |
|
||||||
record?.backPrismHeightBefore ?: DEFAULT_INSTRUMEN_HEIGHT |
|
||||||
) |
|
||||||
mBinding.ilBackPrismHeight.etValueAfter.setText( |
|
||||||
record?.backPrismHeightAfter ?: DEFAULT_INSTRUMEN_HEIGHT |
|
||||||
) |
|
||||||
mBinding.ilFrontPrismHeight.etValueBefore.setText( |
|
||||||
record?.frontPrismHeightBefore ?: DEFAULT_INSTRUMEN_HEIGHT |
|
||||||
) |
|
||||||
mBinding.ilFrontPrismHeight.etValueAfter.setText( |
|
||||||
record?.frontPrismHeightAfter ?: DEFAULT_INSTRUMEN_HEIGHT |
|
||||||
) |
|
||||||
} |
|
||||||
|
|
||||||
override fun checkSaveNot(): Boolean { |
|
||||||
if (editTextEmpty(mBinding.ilInstrumentHeight.etValueBefore)) { |
|
||||||
ToastUtils.showShort(R.string.please_enter_instrument_height_before) |
|
||||||
return true |
|
||||||
} |
|
||||||
if (editTextEmpty(mBinding.ilInstrumentHeight.etValueAfter)) { |
|
||||||
ToastUtils.showShort(R.string.please_enter_instrument_height_after) |
|
||||||
return true |
|
||||||
} |
|
||||||
if (editTextEmpty(mBinding.ilBackPrismHeight.etValueBefore)) { |
|
||||||
ToastUtils.showShort(R.string.please_enter_back_prism_height_before) |
|
||||||
return true |
|
||||||
} |
|
||||||
if (editTextEmpty(mBinding.ilBackPrismHeight.etValueAfter)) { |
|
||||||
ToastUtils.showShort(R.string.please_enter_back_prism_height_after) |
|
||||||
return true |
|
||||||
} |
|
||||||
if (editTextEmpty(mBinding.ilFrontPrismHeight.etValueBefore)) { |
|
||||||
ToastUtils.showShort(R.string.please_enter_front_prism_height_before) |
|
||||||
return true |
|
||||||
} |
|
||||||
if (editTextEmpty(mBinding.ilFrontPrismHeight.etValueAfter)) { |
|
||||||
ToastUtils.showShort(R.string.please_enter_front_prism_height_after) |
|
||||||
return true |
|
||||||
} |
|
||||||
|
|
||||||
setDataToViewModel() |
|
||||||
|
|
||||||
return false |
|
||||||
} |
|
||||||
|
|
||||||
private fun setDataToViewModel() { |
|
||||||
val instrumentHeightBefore = getEtText(mBinding.ilInstrumentHeight.etValueBefore) |
|
||||||
val instrumentHeightAfter = getEtText(mBinding.ilInstrumentHeight.etValueAfter) |
|
||||||
val backPrismHeightBefore = getEtText(mBinding.ilBackPrismHeight.etValueBefore) |
|
||||||
val backPrismHeightAfter = getEtText(mBinding.ilBackPrismHeight.etValueAfter) |
|
||||||
val frontPrismHeightBefore = getEtText(mBinding.ilFrontPrismHeight.etValueBefore) |
|
||||||
val frontPrismHeightAfter = getEtText(mBinding.ilFrontPrismHeight.etValueAfter) |
|
||||||
|
|
||||||
viewModel.instrumentHeightBefore = instrumentHeightBefore |
|
||||||
viewModel.instrumentHeightAfter = instrumentHeightAfter |
|
||||||
viewModel.backPrismHeightBefore = backPrismHeightBefore |
|
||||||
viewModel.backPrismHeightAfter = backPrismHeightAfter |
|
||||||
viewModel.frontPrismHeightBefore = frontPrismHeightBefore |
|
||||||
viewModel.frontPrismHeightAfter = frontPrismHeightAfter |
|
||||||
} |
|
||||||
|
|
||||||
private fun editTextEmpty(et: EditText): Boolean { |
|
||||||
return TextUtils.isEmpty(getEtText(et)) |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
} |
|
@ -1,21 +0,0 @@ |
|||||||
package com.bingce.controlnetwork.newui.stationsettingheighttraverse |
|
||||||
|
|
||||||
import androidx.lifecycle.ViewModel |
|
||||||
|
|
||||||
class StationSettingHeightTraverseVm : ViewModel() { |
|
||||||
lateinit var stationId: String |
|
||||||
|
|
||||||
var instrumentHeightBefore: String? = null |
|
||||||
var instrumentHeightAfter: String? = null |
|
||||||
var backPrismHeightBefore: String? = null |
|
||||||
var backPrismHeightAfter: String? = null |
|
||||||
var frontPrismHeightBefore: String? = null |
|
||||||
var frontPrismHeightAfter: String? = null |
|
||||||
|
|
||||||
var dryTemperature: String? = null |
|
||||||
var humidityTemperature: String? = null |
|
||||||
var airPressure: String? = null |
|
||||||
var additionConstant: String? = null |
|
||||||
var multiplicationConstant: String? = null |
|
||||||
|
|
||||||
} |
|
@ -1,317 +0,0 @@ |
|||||||
package com.bingce.controlnetwork.newui.stationsettingheighttraverse |
|
||||||
|
|
||||||
import android.content.Context |
|
||||||
import android.content.Intent |
|
||||||
import android.view.Menu |
|
||||||
import android.view.MenuItem |
|
||||||
import androidx.activity.viewModels |
|
||||||
import androidx.annotation.WorkerThread |
|
||||||
import androidx.fragment.app.Fragment |
|
||||||
import androidx.fragment.app.FragmentManager |
|
||||||
import androidx.fragment.app.FragmentStatePagerAdapter |
|
||||||
import androidx.lifecycle.lifecycleScope |
|
||||||
import androidx.viewpager.widget.ViewPager.OnPageChangeListener |
|
||||||
import blankj.utilcode.util.ToastUtils |
|
||||||
import com.bingce.controlapphelper.datasource.database.SurveyorDatabaseFactory |
|
||||||
import com.bingce.controlapphelper.datasource.database.config.ConfigConstants |
|
||||||
import com.bingce.controlapphelper.datasource.database.config.ConfigRecord |
|
||||||
import com.bingce.controlapphelper.datasource.database.heighttraverse.stationsetting.model.StationSettingHeightTraverseRecord |
|
||||||
import com.bingce.controlapphelper.model.BundleConstants |
|
||||||
import com.bingce.controlapphelper.util.FastClickUtil |
|
||||||
import com.bingce.controlnetwork.R |
|
||||||
import com.bingce.controlnetwork.databinding.NewActivityStationSettingBinding |
|
||||||
import com.bingce.controlnetwork.newui.base.BaseBindingActivity |
|
||||||
import com.bingce.controlnetwork.util.KeyboardUtil |
|
||||||
import kotlinx.coroutines.Dispatchers |
|
||||||
import kotlinx.coroutines.launch |
|
||||||
|
|
||||||
class StationSettingsHeightTraverseActivity : |
|
||||||
BaseBindingActivity<NewActivityStationSettingBinding>() { |
|
||||||
|
|
||||||
private val viewModel by viewModels<StationSettingHeightTraverseVm>() |
|
||||||
|
|
||||||
private val fragments = mutableListOf<Fragment>() |
|
||||||
private val fragmentTitleList = listOf("仪高镜高", "环境信息") |
|
||||||
|
|
||||||
companion object { |
|
||||||
@JvmStatic |
|
||||||
fun start(context: Context, stationId: String?) { |
|
||||||
if (stationId == null) { |
|
||||||
return |
|
||||||
} |
|
||||||
context.startActivity( |
|
||||||
Intent( |
|
||||||
context, |
|
||||||
StationSettingsHeightTraverseActivity::class.java |
|
||||||
).apply { |
|
||||||
putExtra(BundleConstants.KEY_SURVEYOR_STATION_ID, stationId) |
|
||||||
}) |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
override fun getBinding(): NewActivityStationSettingBinding { |
|
||||||
return NewActivityStationSettingBinding.inflate(layoutInflater) |
|
||||||
} |
|
||||||
|
|
||||||
override fun initView() { |
|
||||||
viewModel.stationId = getStationId() |
|
||||||
initViewPager() |
|
||||||
} |
|
||||||
|
|
||||||
override fun initData() { |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
private fun initViewPager() { |
|
||||||
fragments.add(StationSettingHeightHeightTraverseFragment()) |
|
||||||
fragments.add(StationSettingEnvironmentHeightTraverseFragment()) |
|
||||||
|
|
||||||
mBinding.vp.offscreenPageLimit = 3 |
|
||||||
mBinding.vp.adapter = MyPagerAdapter(supportFragmentManager) |
|
||||||
mBinding.tabLayout.setViewPager(mBinding.vp) |
|
||||||
mBinding.vp.addOnPageChangeListener(object : OnPageChangeListener { |
|
||||||
override fun onPageScrolled( |
|
||||||
position: Int, |
|
||||||
positionOffset: Float, |
|
||||||
positionOffsetPixels: Int |
|
||||||
) { |
|
||||||
} |
|
||||||
|
|
||||||
override fun onPageSelected(position: Int) { |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
override fun onPageScrollStateChanged(state: Int) { |
|
||||||
|
|
||||||
} |
|
||||||
}) |
|
||||||
|
|
||||||
// //设置当前tab为仪高镜高 |
|
||||||
// mBinding.vp.currentItem = 1 |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
private inner class MyPagerAdapter(fm: FragmentManager) : FragmentStatePagerAdapter(fm) { |
|
||||||
override fun getCount(): Int { |
|
||||||
return fragments.size |
|
||||||
} |
|
||||||
|
|
||||||
override fun getPageTitle(position: Int): CharSequence { |
|
||||||
return fragmentTitleList[position] |
|
||||||
} |
|
||||||
|
|
||||||
override fun getItem(position: Int): Fragment { |
|
||||||
return fragments[position] |
|
||||||
} |
|
||||||
|
|
||||||
override fun getItemPosition(`object`: Any): Int { |
|
||||||
return POSITION_NONE |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
private fun getStationId(): String { |
|
||||||
return intent.getStringExtra(BundleConstants.KEY_SURVEYOR_STATION_ID)!! |
|
||||||
} |
|
||||||
|
|
||||||
override fun onCreateOptionsMenu(menu: Menu?): Boolean { |
|
||||||
menuInflater.inflate(R.menu.menu_save, menu) |
|
||||||
return super.onCreateOptionsMenu(menu) |
|
||||||
} |
|
||||||
|
|
||||||
override fun onOptionsItemSelected(item: MenuItem): Boolean { |
|
||||||
if (item.itemId == R.id.menuSave) { |
|
||||||
FastClickUtil.click { |
|
||||||
KeyboardUtil.hideSoftInput() |
|
||||||
startSave() |
|
||||||
} |
|
||||||
} |
|
||||||
return super.onOptionsItemSelected(item) |
|
||||||
} |
|
||||||
|
|
||||||
private fun startSave() { |
|
||||||
//检查未完成的选项 |
|
||||||
for (fragment in fragments) { |
|
||||||
val operate = fragment as IStationSettingOperate |
|
||||||
if (operate.checkSaveNot()) { |
|
||||||
val fragmentNotFinishPos = fragments.indexOf(fragment) |
|
||||||
if (mBinding.vp.currentItem != fragmentNotFinishPos) { |
|
||||||
mBinding.tabLayout.currentTab = fragmentNotFinishPos |
|
||||||
} |
|
||||||
return |
|
||||||
} |
|
||||||
} |
|
||||||
//保存到数据库 |
|
||||||
saveData() |
|
||||||
} |
|
||||||
|
|
||||||
private fun saveData() { |
|
||||||
lifecycleScope.launch(Dispatchers.IO) { |
|
||||||
val stationId = getStationId() |
|
||||||
|
|
||||||
val stationSettingHeightTraverseRecord = |
|
||||||
SurveyorDatabaseFactory.instance.getStationSettingHeightTraverseDataSource() |
|
||||||
.getRecordByStationId(stationId) |
|
||||||
|
|
||||||
if (stationSettingHeightTraverseRecord == null) { |
|
||||||
val stationSettingHeightTraverseRecordNew = |
|
||||||
StationSettingHeightTraverseRecord.newInstance( |
|
||||||
stationId, |
|
||||||
viewModel.dryTemperature!!, |
|
||||||
viewModel.humidityTemperature!!, |
|
||||||
viewModel.airPressure!!, |
|
||||||
viewModel.additionConstant!!, |
|
||||||
viewModel.multiplicationConstant!!, |
|
||||||
viewModel.instrumentHeightBefore!!, |
|
||||||
viewModel.instrumentHeightAfter!!, |
|
||||||
viewModel.backPrismHeightBefore!!, |
|
||||||
viewModel.backPrismHeightAfter!!, |
|
||||||
viewModel.frontPrismHeightBefore!!, |
|
||||||
viewModel.frontPrismHeightAfter!! |
|
||||||
) |
|
||||||
SurveyorDatabaseFactory.instance.getStationSettingHeightTraverseDataSource() |
|
||||||
.saveRecord(stationSettingHeightTraverseRecordNew) |
|
||||||
} else { |
|
||||||
stationSettingHeightTraverseRecord.dryTemperature = viewModel.dryTemperature!! |
|
||||||
stationSettingHeightTraverseRecord.humidityTemperature = |
|
||||||
viewModel.humidityTemperature!! |
|
||||||
stationSettingHeightTraverseRecord.airPressure = viewModel.airPressure!! |
|
||||||
stationSettingHeightTraverseRecord.additionConstant = viewModel.additionConstant!! |
|
||||||
stationSettingHeightTraverseRecord.multiplicationConstant = |
|
||||||
viewModel.multiplicationConstant!! |
|
||||||
stationSettingHeightTraverseRecord.instrumentHeightBefore = |
|
||||||
viewModel.instrumentHeightBefore!! |
|
||||||
stationSettingHeightTraverseRecord.instrumentHeightAfter = |
|
||||||
viewModel.instrumentHeightAfter!! |
|
||||||
stationSettingHeightTraverseRecord.backPrismHeightBefore = |
|
||||||
viewModel.backPrismHeightBefore!! |
|
||||||
stationSettingHeightTraverseRecord.backPrismHeightAfter = |
|
||||||
viewModel.backPrismHeightAfter!! |
|
||||||
stationSettingHeightTraverseRecord.frontPrismHeightBefore = |
|
||||||
viewModel.frontPrismHeightBefore!! |
|
||||||
stationSettingHeightTraverseRecord.frontPrismHeightAfter = |
|
||||||
viewModel.frontPrismHeightAfter!! |
|
||||||
SurveyorDatabaseFactory.instance.getStationSettingHeightTraverseDataSource() |
|
||||||
.updateRecord(stationSettingHeightTraverseRecord) |
|
||||||
} |
|
||||||
|
|
||||||
val stationRecord = |
|
||||||
SurveyorDatabaseFactory.instance.surveyorStation.getRecordSync(stationId) |
|
||||||
if (stationRecord != null) { |
|
||||||
stationRecord.instrumentHeight = viewModel.instrumentHeightBefore |
|
||||||
if (!stationRecord.items.isNullOrEmpty()) { |
|
||||||
stationRecord.items.last().prismHeight = viewModel.frontPrismHeightBefore |
|
||||||
if (stationRecord.items.size > 2) { |
|
||||||
stationRecord.items[1].prismHeight = viewModel.backPrismHeightBefore |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
SurveyorDatabaseFactory.instance.surveyorStation.update(stationRecord) |
|
||||||
|
|
||||||
saveLastData( |
|
||||||
viewModel.dryTemperature!!, |
|
||||||
viewModel.humidityTemperature!!, |
|
||||||
viewModel.airPressure!!, |
|
||||||
viewModel.additionConstant!!, |
|
||||||
viewModel.multiplicationConstant!!, |
|
||||||
viewModel.instrumentHeightBefore!!, |
|
||||||
viewModel.instrumentHeightAfter!!, |
|
||||||
viewModel.backPrismHeightBefore!!, |
|
||||||
viewModel.backPrismHeightAfter!!, |
|
||||||
viewModel.frontPrismHeightBefore!!, |
|
||||||
viewModel.frontPrismHeightAfter!! |
|
||||||
) |
|
||||||
|
|
||||||
ToastUtils.showShort(R.string.save_success) |
|
||||||
|
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
@WorkerThread |
|
||||||
private fun saveLastData( |
|
||||||
dryTemperature: String, |
|
||||||
humidityTemperature: String, |
|
||||||
airPressure: String, |
|
||||||
additionConstant: String, |
|
||||||
multiplicationConstant: String, |
|
||||||
instrumentHeightBefore: String, |
|
||||||
instrumentHeightAfter: String, |
|
||||||
backPrismHeightBefore: String, |
|
||||||
backPrismHeightAfter: String, |
|
||||||
frontPrismHeightBefore: String, |
|
||||||
frontPrismHeightAfter: String |
|
||||||
) { |
|
||||||
SurveyorDatabaseFactory.instance.configDataSource.recordSync( |
|
||||||
ConfigRecord( |
|
||||||
ConfigConstants.KEY_LAST_DRY_TEMPERATURE, |
|
||||||
dryTemperature |
|
||||||
) |
|
||||||
) |
|
||||||
SurveyorDatabaseFactory.instance.configDataSource.recordSync( |
|
||||||
ConfigRecord( |
|
||||||
ConfigConstants.KEY_LAST_HUMIDITY_TEMPERATURE, |
|
||||||
humidityTemperature |
|
||||||
) |
|
||||||
) |
|
||||||
SurveyorDatabaseFactory.instance.configDataSource.recordSync( |
|
||||||
ConfigRecord( |
|
||||||
ConfigConstants.KEY_LAST_AIR_PRESSURE, |
|
||||||
airPressure |
|
||||||
) |
|
||||||
) |
|
||||||
SurveyorDatabaseFactory.instance.configDataSource.recordSync( |
|
||||||
ConfigRecord( |
|
||||||
ConfigConstants.KEY_LAST_ADDITION_CONSTANT, |
|
||||||
additionConstant |
|
||||||
) |
|
||||||
) |
|
||||||
SurveyorDatabaseFactory.instance.configDataSource.recordSync( |
|
||||||
ConfigRecord( |
|
||||||
ConfigConstants.KEY_LAST_MULTIPLICATION_CONSTANT, |
|
||||||
multiplicationConstant |
|
||||||
) |
|
||||||
) |
|
||||||
SurveyorDatabaseFactory.instance.configDataSource.recordSync( |
|
||||||
ConfigRecord( |
|
||||||
ConfigConstants.KEY_LAST_INSTRUMENT_HEIGHT_BEFORE, |
|
||||||
instrumentHeightBefore |
|
||||||
) |
|
||||||
) |
|
||||||
SurveyorDatabaseFactory.instance.configDataSource.recordSync( |
|
||||||
ConfigRecord( |
|
||||||
ConfigConstants.KEY_LAST_INSTRUMENT_HEIGHT_AFTER, |
|
||||||
instrumentHeightAfter |
|
||||||
) |
|
||||||
) |
|
||||||
SurveyorDatabaseFactory.instance.configDataSource.recordSync( |
|
||||||
ConfigRecord( |
|
||||||
ConfigConstants.KEY_LAST_BACK_PRISM_HEIGHT_BEFORE, |
|
||||||
backPrismHeightBefore |
|
||||||
) |
|
||||||
) |
|
||||||
SurveyorDatabaseFactory.instance.configDataSource.recordSync( |
|
||||||
ConfigRecord( |
|
||||||
ConfigConstants.KEY_LAST_BACK_PRISM_HEIGHT_AFTER, |
|
||||||
backPrismHeightAfter |
|
||||||
) |
|
||||||
) |
|
||||||
SurveyorDatabaseFactory.instance.configDataSource.recordSync( |
|
||||||
ConfigRecord( |
|
||||||
ConfigConstants.KEY_LAST_FRONT_PRISM_HEIGHT_BEFORE, |
|
||||||
frontPrismHeightBefore |
|
||||||
) |
|
||||||
) |
|
||||||
SurveyorDatabaseFactory.instance.configDataSource.recordSync( |
|
||||||
ConfigRecord( |
|
||||||
ConfigConstants.KEY_LAST_FRONT_PRISM_HEIGHT_AFTER, |
|
||||||
frontPrismHeightAfter |
|
||||||
) |
|
||||||
) |
|
||||||
} |
|
||||||
|
|
||||||
override fun onBackPressed() { |
|
||||||
if (isFinishAtOnce()) { |
|
||||||
super.onBackPressed() |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
@ -1,38 +0,0 @@ |
|||||||
package com.bingce.controlnetwork.newui.stationsettingheighttraverse.model |
|
||||||
|
|
||||||
import androidx.annotation.WorkerThread |
|
||||||
import com.bingce.controlapphelper.datasource.database.SurveyorDatabaseFactory |
|
||||||
import com.bingce.controlapphelper.datasource.database.config.ConfigConstants |
|
||||||
import com.bingce.controlapphelper.surveyor.method.model.MeasureConstant |
|
||||||
|
|
||||||
class StationSettingEnvironmentData { |
|
||||||
var temperature: String? = null |
|
||||||
var humidity: String? = null |
|
||||||
var airPress: String? = null |
|
||||||
|
|
||||||
|
|
||||||
/** |
|
||||||
* 获取上次数据 |
|
||||||
*/ |
|
||||||
@WorkerThread |
|
||||||
fun getLastData() { |
|
||||||
val configDataSource = SurveyorDatabaseFactory.instance.getConfigDataSource() |
|
||||||
val temperature = configDataSource.getByKeySync(ConfigConstants.KEY_LAST_TEMPERATURE) |
|
||||||
val humidity = configDataSource.getByKeySync(ConfigConstants.KEY_LAST_HUMIDITY) |
|
||||||
val airPress = configDataSource.getByKeySync(ConfigConstants.KEY_LAST_AIR_PRESSURE) |
|
||||||
|
|
||||||
this.temperature = temperature?.configValue |
|
||||||
this.humidity = humidity?.configValue |
|
||||||
this.airPress = airPress?.configValue |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* 获取标准气象数据 |
|
||||||
*/ |
|
||||||
fun getStandardData() { |
|
||||||
this.temperature = MeasureConstant.DEFAULT_TEMPERATURE |
|
||||||
this.humidity = MeasureConstant.DEFAULT_HUMIDITY |
|
||||||
this.airPress = MeasureConstant.DEFAULT_AIR_PRESSURE |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
@ -1,58 +0,0 @@ |
|||||||
package com.bingce.controlnetwork.newui.stationsettingheighttraverse.model |
|
||||||
|
|
||||||
import androidx.annotation.WorkerThread |
|
||||||
import com.bingce.controlapphelper.datasource.database.SurveyorDatabaseFactory |
|
||||||
import com.bingce.controlapphelper.datasource.database.surveyorstation.SurveyorStationRecord |
|
||||||
import com.bingce.controlapphelper.datasource.database.surveyorstation.model.SurveyorPoint |
|
||||||
|
|
||||||
|
|
||||||
/** |
|
||||||
* 高度tab相关数据 |
|
||||||
*/ |
|
||||||
class StationSettingHeightData { |
|
||||||
|
|
||||||
private var instrumentHeight: String? = null |
|
||||||
val pointList = mutableListOf<SurveyorPoint>() |
|
||||||
|
|
||||||
private val pointNameMap = hashMapOf<String, String>() |
|
||||||
private val pointHeightMap = hashMapOf<String, String?>() |
|
||||||
|
|
||||||
@WorkerThread |
|
||||||
fun initData(stationRecord: SurveyorStationRecord?) { |
|
||||||
if (stationRecord?.items == null) return |
|
||||||
instrumentHeight = stationRecord.instrumentHeight |
|
||||||
|
|
||||||
for (point in stationRecord.items) { |
|
||||||
if (point.type == SurveyorPoint.TYPE_STATION || point.isWellSteel) { |
|
||||||
//忽略站点和钢丝点 |
|
||||||
continue |
|
||||||
} |
|
||||||
pointList.add(point) |
|
||||||
val pointRecord = |
|
||||||
SurveyorDatabaseFactory.instance.getPointDataSource().findByIdSync(point.originalPointId) |
|
||||||
pointNameMap[point.originalPointId] = pointRecord.name |
|
||||||
pointHeightMap[point.originalPointId] = point.prismHeight |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
fun getPointName(pointId: String) = pointNameMap[pointId] |
|
||||||
fun getPointHeight(pointId: String): String { |
|
||||||
return pointHeightMap[pointId] ?: "0" |
|
||||||
} |
|
||||||
|
|
||||||
fun getInstrumentHeight(): String { |
|
||||||
return instrumentHeight ?: "0" |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* 保存时 |
|
||||||
*/ |
|
||||||
fun updatePointData(pointIndex: Int, pointHeight: String) { |
|
||||||
val surveyorPoint = pointList[pointIndex] |
|
||||||
//点高 |
|
||||||
surveyorPoint.prismHeight = pointHeight |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
|
|
@ -1,101 +0,0 @@ |
|||||||
package com.bingce.controlnetwork.util; |
|
||||||
|
|
||||||
import android.content.Context; |
|
||||||
|
|
||||||
import com.bingce.utils.FileUtil; |
|
||||||
|
|
||||||
import java.io.File; |
|
||||||
import java.util.ArrayList; |
|
||||||
import java.util.List; |
|
||||||
|
|
||||||
import blankj.utilcode.util.FileUtils; |
|
||||||
import blankj.utilcode.util.Utils; |
|
||||||
|
|
||||||
public class CrashCollectUtils { |
|
||||||
public static File crashLogFolder(Context context) { |
|
||||||
File cacheFolder = context.getExternalCacheDir(); |
|
||||||
if (!cacheFolder.exists() || cacheFolder.isFile()) { |
|
||||||
cacheFolder.mkdir(); |
|
||||||
} |
|
||||||
File dir = new File(cacheFolder, "crash"); |
|
||||||
if (!dir.exists() || dir.isFile()) { |
|
||||||
dir.mkdir(); |
|
||||||
} |
|
||||||
return dir; |
|
||||||
} |
|
||||||
|
|
||||||
//收集崩溃日志,在处理完成后根据结果删除
|
|
||||||
public static void collectCrashLogInWorkerThread(ICrashLogCollectListener listener) { |
|
||||||
File dir = crashLogFolder(Utils.getApp().getApplicationContext()); |
|
||||||
//读取其下面的数据
|
|
||||||
if (!dir.exists() || dir.isFile()) { |
|
||||||
return; |
|
||||||
} |
|
||||||
|
|
||||||
StringBuilder sb = new StringBuilder(); |
|
||||||
|
|
||||||
File[] files = dir.listFiles(); |
|
||||||
|
|
||||||
if (files != null) { |
|
||||||
List<File> needMoveFileList = new ArrayList<>(); |
|
||||||
File lastFile = null; |
|
||||||
for (File file : files) { |
|
||||||
if (file == null || !file.isFile()) { |
|
||||||
continue; |
|
||||||
} |
|
||||||
|
|
||||||
if (lastFile == null) { |
|
||||||
lastFile = file; |
|
||||||
} else { |
|
||||||
if (file.lastModified() > lastFile.lastModified()) { |
|
||||||
lastFile = file; |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
needMoveFileList.add(file); |
|
||||||
} |
|
||||||
needMoveFileList.remove(lastFile); |
|
||||||
|
|
||||||
for (File file : needMoveFileList) { |
|
||||||
moveToBackedUpFolder(dir, file); |
|
||||||
} |
|
||||||
|
|
||||||
if (lastFile != null) { |
|
||||||
FileUtil.ReadFileResult readFileResult = FileUtil.readStringFrom(lastFile); |
|
||||||
if (readFileResult.success) { |
|
||||||
sb.append(readFileResult.string).append("\n"); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
String CRASH_LOG_TABLE = "CloudCrashLog"; |
|
||||||
final String contentKey = "crash_content"; |
|
||||||
final String fileNameKey = "file_name"; |
|
||||||
final String appLabelKey = "app"; |
|
||||||
final String uuidKey = "UUID"; |
|
||||||
listener.onCollected(CRASH_LOG_TABLE, appLabelKey, fileNameKey, contentKey, uuidKey, sb.toString()); |
|
||||||
} |
|
||||||
|
|
||||||
private static void moveToBackedUpFolder(File dir, File targetLogFile) { |
|
||||||
File repeatedFolder = new File(dir, "BACKED_UP"); |
|
||||||
if (!repeatedFolder.exists()) { |
|
||||||
repeatedFolder.mkdirs(); |
|
||||||
} |
|
||||||
FileUtils.move(targetLogFile, new File(repeatedFolder, targetLogFile.getName())); |
|
||||||
} |
|
||||||
|
|
||||||
public interface ICrashLogCollectListener { |
|
||||||
void onCollected(String cloudTable, String appLabelKey, String fileNameKey, String contentKey, String uuidKey, |
|
||||||
String content); |
|
||||||
} |
|
||||||
|
|
||||||
public static class CrashItem { |
|
||||||
public final File file; |
|
||||||
public final String content; |
|
||||||
|
|
||||||
CrashItem(File file, String content) { |
|
||||||
this.file = file; |
|
||||||
this.content = content; |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
@ -1,21 +0,0 @@ |
|||||||
<?xml version="1.0" encoding="utf-8"?> |
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
|
||||||
android:layout_width="match_parent" |
|
||||||
android:layout_height="match_parent" |
|
||||||
android:orientation="vertical"> |
|
||||||
|
|
||||||
<include layout="@layout/toolbar" /> |
|
||||||
|
|
||||||
<ScrollView |
|
||||||
android:layout_width="match_parent" |
|
||||||
android:layout_height="match_parent" |
|
||||||
android:layout_marginStart="16dp" |
|
||||||
android:layout_marginEnd="16dp"> |
|
||||||
|
|
||||||
<TextView |
|
||||||
android:id="@+id/tv_content" |
|
||||||
android:layout_width="match_parent" |
|
||||||
android:layout_height="wrap_content" |
|
||||||
android:textSize="16sp" /> |
|
||||||
</ScrollView> |
|
||||||
</LinearLayout> |
|
@ -1,88 +0,0 @@ |
|||||||
<?xml version="1.0" encoding="utf-8"?> |
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
|
||||||
android:layout_width="match_parent" |
|
||||||
android:layout_height="match_parent" |
|
||||||
android:orientation="vertical"> |
|
||||||
|
|
||||||
<ScrollView |
|
||||||
android:layout_width="match_parent" |
|
||||||
android:layout_height="0dp" |
|
||||||
android:layout_weight="1"> |
|
||||||
|
|
||||||
<LinearLayout |
|
||||||
android:layout_width="match_parent" |
|
||||||
android:layout_height="wrap_content" |
|
||||||
android:orientation="vertical"> |
|
||||||
|
|
||||||
<LinearLayout |
|
||||||
android:layout_width="match_parent" |
|
||||||
android:layout_height="wrap_content" |
|
||||||
android:layout_margin="12dp" |
|
||||||
android:background="@drawable/round_white_16" |
|
||||||
android:orientation="vertical" |
|
||||||
android:showDividers="middle"> |
|
||||||
|
|
||||||
<include |
|
||||||
android:id="@+id/ilDryTemperature" |
|
||||||
layout="@layout/item_station_setting_1_edittext" /> |
|
||||||
|
|
||||||
<include |
|
||||||
android:id="@+id/ilHumidityTemperature" |
|
||||||
layout="@layout/item_station_setting_1_edittext" /> |
|
||||||
|
|
||||||
<include |
|
||||||
android:id="@+id/ilAirPressure" |
|
||||||
layout="@layout/item_station_setting_1_edittext" /> |
|
||||||
|
|
||||||
<include |
|
||||||
android:id="@+id/ilAdditionConstant" |
|
||||||
layout="@layout/item_station_setting_1_edittext" /> |
|
||||||
|
|
||||||
<include |
|
||||||
android:id="@+id/ilmultiplicationConstant" |
|
||||||
layout="@layout/item_station_setting_1_edittext" /> |
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout> |
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout> |
|
||||||
|
|
||||||
</ScrollView> |
|
||||||
|
|
||||||
<LinearLayout |
|
||||||
android:layout_width="match_parent" |
|
||||||
android:layout_height="wrap_content" |
|
||||||
android:gravity="bottom" |
|
||||||
android:orientation="horizontal" |
|
||||||
android:padding="12dp" |
|
||||||
android:visibility="visible"> |
|
||||||
|
|
||||||
<TextView |
|
||||||
android:id="@+id/tvLastData" |
|
||||||
android:layout_width="0dp" |
|
||||||
android:layout_height="40dp" |
|
||||||
android:layout_weight="1" |
|
||||||
android:background="@drawable/round_btn_bg_gray_3" |
|
||||||
android:gravity="center" |
|
||||||
android:text="使用上次数据" |
|
||||||
android:textColor="@color/colorPrimary" |
|
||||||
android:textSize="@dimen/edit_text" /> |
|
||||||
|
|
||||||
<TextView |
|
||||||
android:id="@+id/tvStandardData" |
|
||||||
android:layout_width="0dp" |
|
||||||
android:layout_height="40dp" |
|
||||||
android:layout_marginStart="15dp" |
|
||||||
android:layout_weight="1" |
|
||||||
android:background="@drawable/round_btn_bg_colormay_3" |
|
||||||
android:gravity="center" |
|
||||||
android:text="使用标准气象" |
|
||||||
android:textColor="@color/white" |
|
||||||
android:textSize="@dimen/edit_text" /> |
|
||||||
|
|
||||||
</LinearLayout> |
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout> |
|
||||||
|
|
@ -1,91 +0,0 @@ |
|||||||
<?xml version="1.0" encoding="utf-8"?> |
|
||||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" |
|
||||||
android:layout_width="match_parent" |
|
||||||
android:layout_height="match_parent"> |
|
||||||
|
|
||||||
<LinearLayout |
|
||||||
android:layout_width="match_parent" |
|
||||||
android:layout_height="wrap_content" |
|
||||||
android:orientation="vertical" |
|
||||||
android:padding="12dp"> |
|
||||||
|
|
||||||
<LinearLayout |
|
||||||
android:layout_width="match_parent" |
|
||||||
android:layout_height="wrap_content" |
|
||||||
android:background="@drawable/round_white_16" |
|
||||||
android:orientation="vertical" |
|
||||||
android:showDividers="middle"> |
|
||||||
|
|
||||||
<LinearLayout |
|
||||||
android:layout_width="match_parent" |
|
||||||
android:layout_height="wrap_content" |
|
||||||
android:layout_marginHorizontal="10dp" |
|
||||||
android:gravity="center_vertical" |
|
||||||
android:orientation="horizontal"> |
|
||||||
|
|
||||||
<TextView |
|
||||||
android:layout_width="0dp" |
|
||||||
android:layout_height="wrap_content" |
|
||||||
android:layout_weight="2.6" |
|
||||||
android:padding="10dp" |
|
||||||
android:text="@string/category" |
|
||||||
android:textAppearance="?attr/textAppearanceListItem" /> |
|
||||||
|
|
||||||
<TextView |
|
||||||
android:layout_width="0dp" |
|
||||||
android:layout_height="wrap_content" |
|
||||||
android:layout_weight="3" |
|
||||||
android:gravity="center" |
|
||||||
android:padding="10dp" |
|
||||||
android:text="@string/pre_test" |
|
||||||
android:textAppearance="?attr/textAppearanceListItem" /> |
|
||||||
|
|
||||||
<TextView |
|
||||||
android:layout_width="0dp" |
|
||||||
android:layout_height="wrap_content" |
|
||||||
android:layout_weight="3" |
|
||||||
android:gravity="center" |
|
||||||
android:padding="10dp" |
|
||||||
android:text="@string/post_test" |
|
||||||
android:textAppearance="?attr/textAppearanceListItem" /> |
|
||||||
|
|
||||||
<Button |
|
||||||
android:id="@+id/button1" |
|
||||||
style="@style/alert_dialog_button_normal" |
|
||||||
android:layout_width="wrap_content" |
|
||||||
android:layout_height="wrap_content" |
|
||||||
android:layout_marginStart="9dp" |
|
||||||
android:textColor="?colorPrimary" |
|
||||||
android:textSize="15sp" |
|
||||||
android:visibility="invisible" /> |
|
||||||
|
|
||||||
</LinearLayout> |
|
||||||
|
|
||||||
<View |
|
||||||
android:layout_width="match_parent" |
|
||||||
android:layout_height="0.5dp" |
|
||||||
android:background="@color/color_cccccc" /> |
|
||||||
|
|
||||||
<include |
|
||||||
android:id="@+id/ilInstrumentHeight" |
|
||||||
layout="@layout/item_station_setting_2_edit_text_height_traverse" /> |
|
||||||
|
|
||||||
<include |
|
||||||
android:id="@+id/ilBackPrismHeight" |
|
||||||
layout="@layout/item_station_setting_2_edit_text_height_traverse" /> |
|
||||||
|
|
||||||
<include |
|
||||||
android:id="@+id/ilFrontPrismHeight" |
|
||||||
layout="@layout/item_station_setting_2_edit_text_height_traverse" /> |
|
||||||
</LinearLayout> |
|
||||||
|
|
||||||
<TextView |
|
||||||
android:layout_marginTop="12dp" |
|
||||||
android:layout_width="match_parent" |
|
||||||
android:layout_height="wrap_content" |
|
||||||
android:text="@string/staton_setting_height_traverse_hint" |
|
||||||
android:textColor="@color/nliveo_red_colorPrimary" /> |
|
||||||
|
|
||||||
</LinearLayout> |
|
||||||
|
|
||||||
</ScrollView> |
|
Before Width: | Height: | Size: 1.7 KiB |
Loading…
Reference in new issue