Hide the "merge old activity database" elements when there is no old db
This commit is contained in:
parent
9928ad80c4
commit
afef50dfab
|
@ -68,7 +68,16 @@ public class DbManagementActivity extends GBActivity {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
boolean hasOldDB = hasOldActivityDatabase();
|
||||||
|
int oldDBVisibility = hasOldDB ? View.VISIBLE : View.GONE;
|
||||||
|
|
||||||
|
View oldDBTitle = findViewById(R.id.mergeOldActivityDataTitle);
|
||||||
|
oldDBTitle.setVisibility(oldDBVisibility);
|
||||||
|
View oldDBText = findViewById(R.id.mergeOldActivityDataText);
|
||||||
|
oldDBText.setVisibility(oldDBVisibility);
|
||||||
|
|
||||||
importOldActivityDataButton = (Button) findViewById(R.id.mergeOldActivityData);
|
importOldActivityDataButton = (Button) findViewById(R.id.mergeOldActivityData);
|
||||||
|
importOldActivityDataButton.setVisibility(oldDBVisibility);
|
||||||
importOldActivityDataButton.setOnClickListener(new View.OnClickListener() {
|
importOldActivityDataButton.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
@ -77,6 +86,7 @@ public class DbManagementActivity extends GBActivity {
|
||||||
});
|
});
|
||||||
|
|
||||||
deleteOldActivityDBButton = (Button) findViewById(R.id.deleteOldActivityDB);
|
deleteOldActivityDBButton = (Button) findViewById(R.id.deleteOldActivityDB);
|
||||||
|
deleteOldActivityDBButton.setVisibility(oldDBVisibility);
|
||||||
deleteOldActivityDBButton.setOnClickListener(new View.OnClickListener() {
|
deleteOldActivityDBButton.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
@ -93,6 +103,10 @@ public class DbManagementActivity extends GBActivity {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean hasOldActivityDatabase() {
|
||||||
|
return new DBHelper(this).getOldActivityDatabaseHandler() != null;
|
||||||
|
}
|
||||||
|
|
||||||
private String getExternalPath() {
|
private String getExternalPath() {
|
||||||
try {
|
try {
|
||||||
return FileUtils.getExternalFilesDir().getAbsolutePath();
|
return FileUtils.getExternalFilesDir().getAbsolutePath();
|
||||||
|
|
Loading…
Reference in New Issue