forked from upstream-mirrors/OpenTracks
Cleanup: inline TrackEdit UI into one file.
This commit is contained in:
Generated
+35
@@ -1,5 +1,40 @@
|
|||||||
<component name="ProjectCodeStyleConfiguration">
|
<component name="ProjectCodeStyleConfiguration">
|
||||||
<code_scheme name="Project" version="173">
|
<code_scheme name="Project" version="173">
|
||||||
|
<JavaCodeStyleSettings>
|
||||||
|
<option name="IMPORT_LAYOUT_TABLE">
|
||||||
|
<value>
|
||||||
|
<package name="" withSubpackages="true" static="false" module="true" />
|
||||||
|
<package name="android" withSubpackages="true" static="true" />
|
||||||
|
<package name="androidx" withSubpackages="true" static="true" />
|
||||||
|
<package name="com" withSubpackages="true" static="true" />
|
||||||
|
<package name="junit" withSubpackages="true" static="true" />
|
||||||
|
<package name="net" withSubpackages="true" static="true" />
|
||||||
|
<package name="org" withSubpackages="true" static="true" />
|
||||||
|
<package name="java" withSubpackages="true" static="true" />
|
||||||
|
<package name="javax" withSubpackages="true" static="true" />
|
||||||
|
<package name="" withSubpackages="true" static="true" />
|
||||||
|
<emptyLine />
|
||||||
|
<package name="android" withSubpackages="true" static="false" />
|
||||||
|
<emptyLine />
|
||||||
|
<package name="androidx" withSubpackages="true" static="false" />
|
||||||
|
<emptyLine />
|
||||||
|
<package name="com" withSubpackages="true" static="false" />
|
||||||
|
<emptyLine />
|
||||||
|
<package name="junit" withSubpackages="true" static="false" />
|
||||||
|
<emptyLine />
|
||||||
|
<package name="net" withSubpackages="true" static="false" />
|
||||||
|
<emptyLine />
|
||||||
|
<package name="org" withSubpackages="true" static="false" />
|
||||||
|
<emptyLine />
|
||||||
|
<package name="java" withSubpackages="true" static="false" />
|
||||||
|
<emptyLine />
|
||||||
|
<package name="javax" withSubpackages="true" static="false" />
|
||||||
|
<emptyLine />
|
||||||
|
<package name="" withSubpackages="true" static="false" />
|
||||||
|
<emptyLine />
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
</JavaCodeStyleSettings>
|
||||||
<JetCodeStyleSettings>
|
<JetCodeStyleSettings>
|
||||||
<option name="PACKAGES_TO_USE_STAR_IMPORTS">
|
<option name="PACKAGES_TO_USE_STAR_IMPORTS">
|
||||||
<value>
|
<value>
|
||||||
|
|||||||
@@ -68,19 +68,19 @@ public class TrackEditActivity extends AbstractActivity implements ChooseActivit
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
viewBinding.fields.trackEditName.setText(track.getName());
|
viewBinding.trackEditName.setText(track.getName());
|
||||||
|
|
||||||
viewBinding.fields.trackEditActivityType.setText(track.getActivityTypeLocalized());
|
viewBinding.trackEditActivityType.setText(track.getActivityTypeLocalized());
|
||||||
|
|
||||||
ArrayAdapter<String> adapter = new ArrayAdapter<>(this, android.R.layout.simple_dropdown_item_1line, ActivityType.getLocalizedStrings(this));
|
ArrayAdapter<String> adapter = new ArrayAdapter<>(this, android.R.layout.simple_dropdown_item_1line, ActivityType.getLocalizedStrings(this));
|
||||||
viewBinding.fields.trackEditActivityType.setAdapter(adapter);
|
viewBinding.trackEditActivityType.setAdapter(adapter);
|
||||||
viewBinding.fields.trackEditActivityType.setOnItemClickListener((parent, view, position, id) -> {
|
viewBinding.trackEditActivityType.setOnItemClickListener((parent, view, position, id) -> {
|
||||||
String localizedActivityType = (String) viewBinding.fields.trackEditActivityType.getAdapter().getItem(position);
|
String localizedActivityType = (String) viewBinding.trackEditActivityType.getAdapter().getItem(position);
|
||||||
setActivityTypeIcon(ActivityType.findByLocalizedString(this, localizedActivityType));
|
setActivityTypeIcon(ActivityType.findByLocalizedString(this, localizedActivityType));
|
||||||
});
|
});
|
||||||
viewBinding.fields.trackEditActivityType.setOnFocusChangeListener((v, hasFocus) -> {
|
viewBinding.trackEditActivityType.setOnFocusChangeListener((v, hasFocus) -> {
|
||||||
if (!hasFocus) {
|
if (!hasFocus) {
|
||||||
String localizedActivityType = viewBinding.fields.trackEditActivityType.getText().toString();
|
String localizedActivityType = viewBinding.trackEditActivityType.getText().toString();
|
||||||
setActivityTypeIcon(ActivityType.findByLocalizedString(this, localizedActivityType));
|
setActivityTypeIcon(ActivityType.findByLocalizedString(this, localizedActivityType));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -94,13 +94,13 @@ public class TrackEditActivity extends AbstractActivity implements ChooseActivit
|
|||||||
}
|
}
|
||||||
|
|
||||||
setActivityTypeIcon(activityType);
|
setActivityTypeIcon(activityType);
|
||||||
viewBinding.fields.trackEditActivityTypeIcon.setOnClickListener(v -> ChooseActivityTypeDialogFragment.showDialog(getSupportFragmentManager(), this, viewBinding.fields.trackEditActivityType.getText().toString()));
|
viewBinding.trackEditActivityTypeIcon.setOnClickListener(v -> ChooseActivityTypeDialogFragment.showDialog(getSupportFragmentManager(), this, viewBinding.trackEditActivityType.getText().toString()));
|
||||||
|
|
||||||
viewBinding.fields.trackEditDescription.setText(track.getDescription());
|
viewBinding.trackEditDescription.setText(track.getDescription());
|
||||||
|
|
||||||
viewBinding.trackEditSave.setOnClickListener(v -> {
|
viewBinding.trackEditSave.setOnClickListener(v -> {
|
||||||
TrackUtils.updateTrack(TrackEditActivity.this, track, viewBinding.fields.trackEditName.getText().toString(),
|
TrackUtils.updateTrack(TrackEditActivity.this, track, viewBinding.trackEditName.getText().toString(),
|
||||||
viewBinding.fields.trackEditActivityType.getText().toString(), viewBinding.fields.trackEditDescription.getText().toString(),
|
viewBinding.trackEditActivityType.getText().toString(), viewBinding.trackEditDescription.getText().toString(),
|
||||||
contentProviderUtils);
|
contentProviderUtils);
|
||||||
finish();
|
finish();
|
||||||
});
|
});
|
||||||
@@ -124,12 +124,12 @@ public class TrackEditActivity extends AbstractActivity implements ChooseActivit
|
|||||||
|
|
||||||
private void setActivityTypeIcon(ActivityType activityType) {
|
private void setActivityTypeIcon(ActivityType activityType) {
|
||||||
this.activityType = activityType;
|
this.activityType = activityType;
|
||||||
viewBinding.fields.trackEditActivityTypeIcon.setImageResource(activityType.getIconDrawableId());
|
viewBinding.trackEditActivityTypeIcon.setImageResource(activityType.getIconDrawableId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onChooseActivityTypeDone(ActivityType activityType) {
|
public void onChooseActivityTypeDone(ActivityType activityType) {
|
||||||
setActivityTypeIcon(activityType);
|
setActivityTypeIcon(activityType);
|
||||||
viewBinding.fields.trackEditActivityType.setText(getString(activityType.getLocalizedStringId()));
|
viewBinding.trackEditActivityType.setText(getString(activityType.getLocalizedStringId()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,8 +34,6 @@ public class TrackStoppedActivity extends AbstractTrackDeleteActivity implements
|
|||||||
|
|
||||||
private Track.Id trackId;
|
private Track.Id trackId;
|
||||||
|
|
||||||
private boolean isDiscarding = false;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@@ -144,7 +142,6 @@ public class TrackStoppedActivity extends AbstractTrackDeleteActivity implements
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDeleteConfirmed() {
|
protected void onDeleteConfirmed() {
|
||||||
isDiscarding = true;
|
|
||||||
viewBinding.loadingLayout.loadingText.setText(getString(R.string.track_discarding));
|
viewBinding.loadingLayout.loadingText.setText(getString(R.string.track_discarding));
|
||||||
viewBinding.contentLinearLayout.setVisibility(View.GONE);
|
viewBinding.contentLinearLayout.setVisibility(View.GONE);
|
||||||
viewBinding.loadingLayout.loadingIndeterminate.setVisibility(View.VISIBLE);
|
viewBinding.loadingLayout.loadingIndeterminate.setVisibility(View.VISIBLE);
|
||||||
|
|||||||
@@ -14,18 +14,89 @@ See the License for the specific language governing permissions and
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
-->
|
-->
|
||||||
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical"
|
android:fitsSystemWindows="true"
|
||||||
android:fitsSystemWindows="true">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<include
|
<ScrollView style="@style/ScrollView.WithBottomButtons">
|
||||||
android:id="@+id/fields"
|
|
||||||
layout="@layout/track_edit_fields" />
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:padding="8dp">
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
|
style="?attr/textInputOutlinedStyle"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="16dp"
|
||||||
|
android:hint="@string/generic_name"
|
||||||
|
android:imeOptions="actionNext"
|
||||||
|
android:importantForAutofill="no">
|
||||||
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
|
android:id="@+id/track_edit_name"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:inputType="textCapSentences"
|
||||||
|
android:selectAllOnFocus="true" />
|
||||||
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
|
style="?attr/textInputOutlinedExposedDropdownMenuStyle"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="16dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:imeOptions="actionNext"
|
||||||
|
android:importantForAutofill="no">
|
||||||
|
<com.google.android.material.textfield.MaterialAutoCompleteTextView
|
||||||
|
android:id="@+id/track_edit_activity_type"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginEnd="8dp"
|
||||||
|
android:hint="@string/track_edit_activity_type_hint"
|
||||||
|
android:imeOptions="actionNext"
|
||||||
|
android:selectAllOnFocus="true" />
|
||||||
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/track_edit_activity_type_icon"
|
||||||
|
tools:src="@drawable/ic_activity_bike_24dp"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_gravity="bottom" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
|
style="?attr/textInputOutlinedStyle"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="16dp"
|
||||||
|
android:hint="@string/generic_description"
|
||||||
|
android:imeOptions="actionNext"
|
||||||
|
android:importantForAutofill="no">
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
|
android:id="@+id/track_edit_description"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:inputType="textMultiLine"
|
||||||
|
android:selectAllOnFocus="true" />
|
||||||
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
</ScrollView>
|
||||||
|
|
||||||
<View style="@style/BottomButtonDivider" />
|
<View style="@style/BottomButtonDivider" />
|
||||||
|
|
||||||
|
|||||||
@@ -1,84 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
|
|
||||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
style="@style/ScrollView.WithBottomButtons">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:padding="8dp">
|
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
style="?attr/textInputOutlinedStyle"
|
|
||||||
android:hint="@string/generic_name"
|
|
||||||
android:imeOptions="actionNext"
|
|
||||||
android:importantForAutofill="no"
|
|
||||||
android:layout_marginBottom="16dp">
|
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputEditText
|
|
||||||
android:id="@+id/track_edit_name"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:inputType="textCapSentences"
|
|
||||||
android:selectAllOnFocus="true" />
|
|
||||||
|
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputLayout
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
style="?attr/textInputOutlinedExposedDropdownMenuStyle"
|
|
||||||
android:imeOptions="actionNext"
|
|
||||||
android:importantForAutofill="no"
|
|
||||||
android:layout_marginBottom="16dp">
|
|
||||||
|
|
||||||
<com.google.android.material.textfield.MaterialAutoCompleteTextView
|
|
||||||
android:id="@+id/track_edit_activity_type"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginEnd="8dp"
|
|
||||||
android:hint="@string/track_edit_activity_type_hint"
|
|
||||||
android:imeOptions="actionNext"
|
|
||||||
android:selectAllOnFocus="true" />
|
|
||||||
|
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/track_edit_activity_type_icon"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_gravity="bottom"
|
|
||||||
tools:src="@drawable/ic_activity_bike_24dp"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
style="?attr/textInputOutlinedStyle"
|
|
||||||
android:hint="@string/generic_description"
|
|
||||||
android:imeOptions="actionNext"
|
|
||||||
android:importantForAutofill="no"
|
|
||||||
android:layout_marginBottom="16dp">
|
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputEditText
|
|
||||||
android:id="@+id/track_edit_description"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:inputType="textMultiLine"
|
|
||||||
android:selectAllOnFocus="true" />
|
|
||||||
|
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
</ScrollView>
|
|
||||||
Reference in New Issue
Block a user