Moved website button from Launcher to Settings, added source code button to Settings as well

This commit is contained in:
2020-11-12 07:47:56 -06:00
parent ca983fadac
commit 2bf8e3b87e
4 changed files with 44 additions and 25 deletions

View File

@@ -37,15 +37,6 @@ public class LauncherActivity extends AppCompatActivity {
getSupportActionBar().hide();
}
Button websiteButton = findViewById(R.id.timecrafters_website_button);
websiteButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://timecrafters.org"));
startActivity(browserIntent);
}
});
if (havePermissions()) {
if (Backend.instance() == null) {
new Backend();

View File

@@ -1,5 +1,7 @@
package org.timecrafters.TimeCraftersConfigurationTool.ui.settings;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
@@ -28,6 +30,8 @@ public class SettingsFragment extends TimeCraftersFragment {
final Switch showNavigationLabels = root.findViewById(R.id.show_navigation_labels);
final Switch disableLauncherDelay = root.findViewById(R.id.disable_launcher_delay);
final Switch startServerAtBoot = root.findViewById(R.id.start_server_at_boot);
final Button websiteButton = root.findViewById(R.id.timecrafters_website_button);
final Button sourceCodeButton = root.findViewById(R.id.timecrafters_configuration_tool_source_code_button);
final BottomNavigationView navView = getActivity().findViewById(R.id.nav_view);
@@ -90,6 +94,22 @@ public class SettingsFragment extends TimeCraftersFragment {
}
});
websiteButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://timecrafters.org"));
startActivity(browserIntent);
}
});
sourceCodeButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/TimeCrafters/TimeCraftersConfigurationTool"));
startActivity(browserIntent);
}
});
return root;
}
}

View File

@@ -27,20 +27,4 @@
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@mipmap/ic_launcher_foreground" />
<Button
android:id="@+id/timecrafters_website_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginLeft="16dp"
android:layout_marginEnd="16dp"
android:layout_marginRight="16dp"
android:layout_marginBottom="16dp"
android:text="TimeCrafters.org"
android:visibility="visible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
tools:visibility="visible" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -74,6 +74,30 @@
android:text="@string/settings_start_server_at_boot" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="36dp"
android:background="@color/list_odd"
android:orientation="horizontal"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<Button
android:id="@+id/timecrafters_website_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="TimeCrafters.org" />
<Button
android:id="@+id/timecrafters_configuration_tool_source_code_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Source Code" />
</LinearLayout>
</LinearLayout>
</ScrollView>