mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-21 12:39:58 +01:00
Add providers
Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
parent
ce895d9662
commit
b47a736763
@ -20,7 +20,9 @@
|
|||||||
|
|
||||||
package com.nextcloud.talk.controllers;
|
package com.nextcloud.talk.controllers;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
import android.content.pm.ActivityInfo;
|
import android.content.pm.ActivityInfo;
|
||||||
|
import android.net.Uri;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
@ -30,6 +32,7 @@ import android.view.View;
|
|||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.view.inputmethod.EditorInfo;
|
import android.view.inputmethod.EditorInfo;
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.bluelinelabs.conductor.RouterTransaction;
|
import com.bluelinelabs.conductor.RouterTransaction;
|
||||||
import com.bluelinelabs.conductor.changehandler.HorizontalChangeHandler;
|
import com.bluelinelabs.conductor.changehandler.HorizontalChangeHandler;
|
||||||
@ -63,6 +66,8 @@ public class ServerSelectionController extends BaseController {
|
|||||||
TextFieldBoxes textFieldBoxes;
|
TextFieldBoxes textFieldBoxes;
|
||||||
@BindView(R.id.progress_bar)
|
@BindView(R.id.progress_bar)
|
||||||
ProgressBar progressBar;
|
ProgressBar progressBar;
|
||||||
|
@BindView(R.id.providers_text_view)
|
||||||
|
TextView providersTextView;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
NcApi ncApi;
|
NcApi ncApi;
|
||||||
@ -94,6 +99,16 @@ public class ServerSelectionController extends BaseController {
|
|||||||
textFieldBoxes.getEndIconImageButton().setVisibility(View.VISIBLE);
|
textFieldBoxes.getEndIconImageButton().setVisibility(View.VISIBLE);
|
||||||
textFieldBoxes.getEndIconImageButton().setOnClickListener(view1 -> checkServerAndProceed());
|
textFieldBoxes.getEndIconImageButton().setOnClickListener(view1 -> checkServerAndProceed());
|
||||||
|
|
||||||
|
if (TextUtils.isEmpty(getResources().getString(R.string.nc_providers_url))) {
|
||||||
|
providersTextView.setVisibility(View.GONE);
|
||||||
|
} else {
|
||||||
|
providersTextView.setOnClickListener(view12 -> {
|
||||||
|
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(getResources()
|
||||||
|
.getString(R.string.nc_providers_url)));
|
||||||
|
startActivity(browserIntent);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
serverEntry.requestFocus();
|
serverEntry.requestFocus();
|
||||||
|
|
||||||
serverEntry.addTextChangedListener(new TextWatcher() {
|
serverEntry.addTextChangedListener(new TextWatcher() {
|
||||||
@ -142,6 +157,7 @@ public class ServerSelectionController extends BaseController {
|
|||||||
|
|
||||||
serverEntry.setEnabled(false);
|
serverEntry.setEnabled(false);
|
||||||
progressBar.setVisibility(View.VISIBLE);
|
progressBar.setVisibility(View.VISIBLE);
|
||||||
|
providersTextView.setVisibility(View.INVISIBLE);
|
||||||
|
|
||||||
if (url.endsWith("/")) {
|
if (url.endsWith("/")) {
|
||||||
url = url.substring(0, url.length() - 1);
|
url = url.substring(0, url.length() - 1);
|
||||||
@ -176,20 +192,24 @@ public class ServerSelectionController extends BaseController {
|
|||||||
textFieldBoxes.setError(String.format(
|
textFieldBoxes.setError(String.format(
|
||||||
getResources().getString(R.string.nc_server_not_installed), productName),
|
getResources().getString(R.string.nc_server_not_installed), productName),
|
||||||
true);
|
true);
|
||||||
|
toggleProceedButton(false);
|
||||||
} else if (status.isNeedsUpgrade()) {
|
} else if (status.isNeedsUpgrade()) {
|
||||||
textFieldBoxes.setError(String.format(getResources().
|
textFieldBoxes.setError(String.format(getResources().
|
||||||
getString(R.string.nc_server_db_upgrade_needed),
|
getString(R.string.nc_server_db_upgrade_needed),
|
||||||
productName), true);
|
productName), true);
|
||||||
|
toggleProceedButton(false);
|
||||||
} else if (status.isMaintenance()) {
|
} else if (status.isMaintenance()) {
|
||||||
textFieldBoxes.setError(String.format(getResources().
|
textFieldBoxes.setError(String.format(getResources().
|
||||||
getString(R.string.nc_server_maintenance),
|
getString(R.string.nc_server_maintenance),
|
||||||
productName),
|
productName),
|
||||||
true);
|
true);
|
||||||
|
toggleProceedButton(false);
|
||||||
} else if (!status.getVersion().startsWith("13.")) {
|
} else if (!status.getVersion().startsWith("13.")) {
|
||||||
textFieldBoxes.setError(String.format(getResources().
|
textFieldBoxes.setError(String.format(getResources().
|
||||||
getString(R.string.nc_server_version),
|
getString(R.string.nc_server_version),
|
||||||
getResources().getString(R.string.nc_app_name)
|
getResources().getString(R.string.nc_app_name)
|
||||||
, productName), true);
|
, productName), true);
|
||||||
|
toggleProceedButton(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
}, throwable -> {
|
}, throwable -> {
|
||||||
@ -208,12 +228,14 @@ public class ServerSelectionController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
progressBar.setVisibility(View.GONE);
|
progressBar.setVisibility(View.GONE);
|
||||||
|
providersTextView.setVisibility(View.VISIBLE);
|
||||||
toggleProceedButton(false);
|
toggleProceedButton(false);
|
||||||
|
|
||||||
dispose();
|
dispose();
|
||||||
}
|
}
|
||||||
}, () -> {
|
}, () -> {
|
||||||
progressBar.setVisibility(View.GONE);
|
progressBar.setVisibility(View.GONE);
|
||||||
|
providersTextView.setVisibility(View.VISIBLE);
|
||||||
dispose();
|
dispose();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -45,9 +45,9 @@
|
|||||||
android:layout_marginLeft="@dimen/activity_horizontal_margin"
|
android:layout_marginLeft="@dimen/activity_horizontal_margin"
|
||||||
android:layout_marginRight="@dimen/activity_horizontal_margin"
|
android:layout_marginRight="@dimen/activity_horizontal_margin"
|
||||||
android:layout_marginStart="@dimen/activity_horizontal_margin"
|
android:layout_marginStart="@dimen/activity_horizontal_margin"
|
||||||
app:labelText="@string/nc_server_url"
|
|
||||||
app:errorColor="@color/nc_white_color_complete"
|
app:errorColor="@color/nc_white_color_complete"
|
||||||
app:helperText=" "
|
app:helperText=" "
|
||||||
|
app:labelText="@string/nc_server_url"
|
||||||
app:panelBackgroundColor="@color/colorPrimary"
|
app:panelBackgroundColor="@color/colorPrimary"
|
||||||
app:primaryColor="@color/nc_white_color_complete">
|
app:primaryColor="@color/nc_white_color_complete">
|
||||||
|
|
||||||
@ -75,8 +75,21 @@
|
|||||||
android:layout_marginStart="@dimen/activity_horizontal_margin"
|
android:layout_marginStart="@dimen/activity_horizontal_margin"
|
||||||
android:layout_marginTop="24dp"
|
android:layout_marginTop="24dp"
|
||||||
android:indeterminate="true"
|
android:indeterminate="true"
|
||||||
android:indeterminateTintMode="src_in"
|
|
||||||
android:indeterminateTint="@color/nc_white_color_complete"
|
android:indeterminateTint="@color/nc_white_color_complete"
|
||||||
|
android:indeterminateTintMode="src_in"
|
||||||
android:visibility="invisible"/>
|
android:visibility="invisible"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/providers_text_view"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@id/progress_bar"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
android:layout_marginTop="56dp"
|
||||||
|
android:lines="2"
|
||||||
|
android:text="@string/nc_get_from_provider"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:textAllCaps="true"
|
||||||
|
android:textColor="@color/nc_white_color_complete"/>
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
@ -13,4 +13,5 @@
|
|||||||
<string name="nc_privacy_url">https://nextcloud.com/privacy/</string>
|
<string name="nc_privacy_url">https://nextcloud.com/privacy/</string>
|
||||||
<string name="nc_gpl3_url">https://www.gnu.org/licenses/gpl-3.0.en.html</string>
|
<string name="nc_gpl3_url">https://www.gnu.org/licenses/gpl-3.0.en.html</string>
|
||||||
<string name="nc_source_code_url">https://github.com/nextcloud/talk-android</string>
|
<string name="nc_source_code_url">https://github.com/nextcloud/talk-android</string>
|
||||||
|
<string name="nc_providers_url">https://nextcloud.com/providers</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
<string name="nc_server_db_upgrade_needed">Please upgrade your %1$s database</string>
|
<string name="nc_server_db_upgrade_needed">Please upgrade your %1$s database</string>
|
||||||
<string name="nc_server_maintenance">Please bring your %1$s out of maintenance</string>
|
<string name="nc_server_maintenance">Please bring your %1$s out of maintenance</string>
|
||||||
<string name="nc_server_version">%1$s only works with %2$s 13 and up</string>
|
<string name="nc_server_version">%1$s only works with %2$s 13 and up</string>
|
||||||
|
<string name="nc_get_from_provider">Do you not have a server yet?\nClick here to get one from a provider</string>
|
||||||
|
|
||||||
<!-- Account verification -->
|
<!-- Account verification -->
|
||||||
<string name="nc_display_name_fetched">Display name fetched</string>
|
<string name="nc_display_name_fetched">Display name fetched</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user