mirror of
https://github.com/nextcloud/android.git
synced 2024-12-19 23:42:03 +03:00
Merge remote-tracking branch 'origin/master' into dev
This commit is contained in:
commit
49d4a3d8a3
3 changed files with 179 additions and 163 deletions
|
@ -1,159 +0,0 @@
|
|||
/*
|
||||
* Nextcloud Android client application
|
||||
*
|
||||
* @author Bartosz Przybylski
|
||||
* @author Chris Narkiewicz
|
||||
* Copyright (C) 2015 Bartosz Przybylski
|
||||
* Copyright (C) 2015 ownCloud Inc.
|
||||
* Copyright (C) 2016 Nextcloud.
|
||||
* Copyright (C) 2019 Chris Narkiewicz <hello@ezaquarii.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public
|
||||
* License along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.nextcloud.client.onboarding;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.google.android.material.button.MaterialButton;
|
||||
import com.nextcloud.android.common.ui.theme.utils.ColorRole;
|
||||
import com.nextcloud.client.appinfo.AppInfo;
|
||||
import com.nextcloud.client.di.Injectable;
|
||||
import com.nextcloud.client.preferences.AppPreferences;
|
||||
import com.owncloud.android.BuildConfig;
|
||||
import com.owncloud.android.R;
|
||||
import com.owncloud.android.databinding.WhatsNewActivityBinding;
|
||||
import com.owncloud.android.ui.adapter.FeaturesViewAdapter;
|
||||
import com.owncloud.android.ui.adapter.FeaturesWebViewAdapter;
|
||||
import com.owncloud.android.ui.whatsnew.ProgressIndicator;
|
||||
import com.owncloud.android.utils.theme.ViewThemeUtils;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
|
||||
/**
|
||||
* Activity displaying new features after an update.
|
||||
*/
|
||||
public class WhatsNewActivity extends FragmentActivity implements ViewPager.OnPageChangeListener, Injectable {
|
||||
|
||||
@Inject AppPreferences preferences;
|
||||
@Inject AppInfo appInfo;
|
||||
@Inject OnboardingService onboarding;
|
||||
@Inject ViewThemeUtils.Factory viewThemeUtilsFactory;
|
||||
private ViewThemeUtils viewThemeUtils;
|
||||
|
||||
private WhatsNewActivityBinding binding;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
binding = WhatsNewActivityBinding.inflate(getLayoutInflater());
|
||||
setContentView(binding.getRoot());
|
||||
|
||||
viewThemeUtils = viewThemeUtilsFactory.withPrimaryAsBackground();
|
||||
viewThemeUtils.platform.themeStatusBar(this, ColorRole.PRIMARY);
|
||||
|
||||
|
||||
String[] urls = getResources().getStringArray(R.array.whatsnew_urls);
|
||||
|
||||
boolean showWebView = urls.length > 0;
|
||||
|
||||
if (showWebView) {
|
||||
FeaturesWebViewAdapter featuresWebViewAdapter = new FeaturesWebViewAdapter(getSupportFragmentManager(),
|
||||
urls);
|
||||
binding.progressIndicator.setNumberOfSteps(featuresWebViewAdapter.getCount());
|
||||
binding.contentPanel.setAdapter(featuresWebViewAdapter);
|
||||
} else {
|
||||
FeaturesViewAdapter featuresViewAdapter = new FeaturesViewAdapter(getSupportFragmentManager(),
|
||||
onboarding.getWhatsNew());
|
||||
binding.progressIndicator.setNumberOfSteps(featuresViewAdapter.getCount());
|
||||
binding.contentPanel.setAdapter(featuresViewAdapter);
|
||||
}
|
||||
|
||||
binding.contentPanel.addOnPageChangeListener(this);
|
||||
|
||||
viewThemeUtils.platform.colorImageView(binding.forward, ColorRole.ON_PRIMARY);
|
||||
|
||||
binding.forward.setOnClickListener(view -> {
|
||||
if (binding.progressIndicator.hasNextStep()) {
|
||||
binding.contentPanel.setCurrentItem(binding.contentPanel.getCurrentItem() + 1, true);
|
||||
binding.progressIndicator.animateToStep(binding.contentPanel.getCurrentItem() + 1);
|
||||
} else {
|
||||
onFinish();
|
||||
finish();
|
||||
}
|
||||
updateNextButtonIfNeeded();
|
||||
});
|
||||
|
||||
binding.forward.setBackground(null);
|
||||
|
||||
viewThemeUtils.platform.colorTextView(binding.skip, ColorRole.ON_PRIMARY);
|
||||
binding.skip.setOnClickListener(view -> {
|
||||
onFinish();
|
||||
finish();
|
||||
});
|
||||
|
||||
viewThemeUtils.platform.colorTextView(binding.welcomeText, ColorRole.ON_PRIMARY);
|
||||
|
||||
if (showWebView) {
|
||||
binding.welcomeText.setText(R.string.app_name);
|
||||
} else {
|
||||
binding.welcomeText.setText(String.format(getString(R.string.whats_new_title), appInfo.getVersionName()));
|
||||
}
|
||||
|
||||
updateNextButtonIfNeeded();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
onFinish();
|
||||
super.onBackPressed();
|
||||
}
|
||||
|
||||
private void updateNextButtonIfNeeded() {
|
||||
if (!binding.progressIndicator.hasNextStep()) {
|
||||
binding.forward.setImageResource(R.drawable.ic_ok);
|
||||
binding.skip.setVisibility(View.INVISIBLE);
|
||||
} else {
|
||||
binding.forward.setImageResource(R.drawable.arrow_right);
|
||||
binding.skip.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
private void onFinish() {
|
||||
preferences.setLastSeenVersionCode(BuildConfig.VERSION_CODE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
||||
// unused but to be implemented due to abstract parent
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageSelected(int position) {
|
||||
binding.progressIndicator.animateToStep(position + 1);
|
||||
updateNextButtonIfNeeded();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageScrollStateChanged(int state) {
|
||||
// unused but to be implemented due to abstract parent
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,169 @@
|
|||
/*
|
||||
* Nextcloud Android client application
|
||||
*
|
||||
* @author Bartosz Przybylski
|
||||
* @author Chris Narkiewicz
|
||||
* Copyright (C) 2015 Bartosz Przybylski
|
||||
* Copyright (C) 2015 ownCloud Inc.
|
||||
* Copyright (C) 2016 Nextcloud.
|
||||
* Copyright (C) 2019 Chris Narkiewicz <hello@ezaquarii.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public
|
||||
* License along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.nextcloud.client.onboarding
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.activity.OnBackPressedCallback
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import androidx.viewpager.widget.ViewPager
|
||||
import com.nextcloud.android.common.ui.theme.utils.ColorRole
|
||||
import com.nextcloud.client.appinfo.AppInfo
|
||||
import com.nextcloud.client.di.Injectable
|
||||
import com.nextcloud.client.preferences.AppPreferences
|
||||
import com.owncloud.android.BuildConfig
|
||||
import com.owncloud.android.R
|
||||
import com.owncloud.android.databinding.WhatsNewActivityBinding
|
||||
import com.owncloud.android.ui.adapter.FeaturesViewAdapter
|
||||
import com.owncloud.android.ui.adapter.FeaturesWebViewAdapter
|
||||
import com.owncloud.android.utils.theme.ViewThemeUtils
|
||||
import javax.inject.Inject
|
||||
|
||||
/**
|
||||
* Activity displaying new features after an update.
|
||||
*/
|
||||
class WhatsNewActivity : FragmentActivity(), ViewPager.OnPageChangeListener, Injectable {
|
||||
|
||||
@JvmField
|
||||
@Inject
|
||||
var preferences: AppPreferences? = null
|
||||
|
||||
@JvmField
|
||||
@Inject
|
||||
var appInfo: AppInfo? = null
|
||||
|
||||
@JvmField
|
||||
@Inject
|
||||
var onboarding: OnboardingService? = null
|
||||
|
||||
@JvmField
|
||||
@Inject
|
||||
var viewThemeUtilsFactory: ViewThemeUtils.Factory? = null
|
||||
|
||||
private var viewThemeUtils: ViewThemeUtils? = null
|
||||
|
||||
private lateinit var binding: WhatsNewActivityBinding
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
binding = WhatsNewActivityBinding.inflate(layoutInflater)
|
||||
setContentView(binding.root)
|
||||
|
||||
viewThemeUtils = viewThemeUtilsFactory?.withPrimaryAsBackground()
|
||||
viewThemeUtils?.platform?.themeStatusBar(this, ColorRole.PRIMARY)
|
||||
|
||||
val urls = resources.getStringArray(R.array.whatsnew_urls)
|
||||
val showWebView = urls.isNotEmpty()
|
||||
|
||||
setupFeatureViewAdapter(showWebView, urls)
|
||||
binding.contentPanel.addOnPageChangeListener(this)
|
||||
setupForwardImageButton()
|
||||
setupSkipImageButton()
|
||||
setupWelcomeText(showWebView)
|
||||
updateNextButtonIfNeeded()
|
||||
handleOnBackPressed()
|
||||
}
|
||||
|
||||
@Suppress("SpreadOperator")
|
||||
private fun setupFeatureViewAdapter(showWebView: Boolean, urls: Array<String>) {
|
||||
val adapter = if (showWebView) {
|
||||
FeaturesWebViewAdapter(supportFragmentManager, *urls)
|
||||
} else {
|
||||
onboarding?.let {
|
||||
FeaturesViewAdapter(supportFragmentManager, *it.whatsNew)
|
||||
}
|
||||
}
|
||||
|
||||
adapter?.let {
|
||||
binding.progressIndicator.setNumberOfSteps(it.count)
|
||||
binding.contentPanel.adapter = it
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupForwardImageButton() {
|
||||
viewThemeUtils?.platform?.colorImageView(binding.forward, ColorRole.ON_PRIMARY)
|
||||
binding.forward.setOnClickListener {
|
||||
if (binding.progressIndicator.hasNextStep()) {
|
||||
binding.contentPanel.setCurrentItem(binding.contentPanel.currentItem + 1, true)
|
||||
binding.progressIndicator.animateToStep(binding.contentPanel.currentItem + 1)
|
||||
} else {
|
||||
onFinish()
|
||||
finish()
|
||||
}
|
||||
updateNextButtonIfNeeded()
|
||||
}
|
||||
binding.forward.background = null
|
||||
}
|
||||
|
||||
private fun setupSkipImageButton() {
|
||||
viewThemeUtils?.platform?.colorTextView(binding.skip, ColorRole.ON_PRIMARY)
|
||||
binding.skip.setOnClickListener {
|
||||
onFinish()
|
||||
finish()
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupWelcomeText(showWebView: Boolean) {
|
||||
viewThemeUtils?.platform?.colorTextView(binding.welcomeText, ColorRole.ON_PRIMARY)
|
||||
binding.welcomeText.text = if (showWebView) {
|
||||
getString(R.string.app_name)
|
||||
} else {
|
||||
String.format(getString(R.string.whats_new_title), appInfo?.versionName)
|
||||
}
|
||||
}
|
||||
|
||||
private fun handleOnBackPressed() {
|
||||
onBackPressedDispatcher.addCallback(
|
||||
this,
|
||||
object : OnBackPressedCallback(true) {
|
||||
override fun handleOnBackPressed() {
|
||||
onFinish()
|
||||
onBackPressedDispatcher.onBackPressed()
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
private fun updateNextButtonIfNeeded() {
|
||||
val hasNextStep = binding.progressIndicator.hasNextStep()
|
||||
binding.forward.setImageResource(if (hasNextStep) R.drawable.arrow_right else R.drawable.ic_ok)
|
||||
binding.skip.visibility = if (hasNextStep) View.VISIBLE else View.INVISIBLE
|
||||
}
|
||||
|
||||
private fun onFinish() {
|
||||
preferences?.lastSeenVersionCode = BuildConfig.VERSION_CODE
|
||||
}
|
||||
|
||||
override fun onPageSelected(position: Int) {
|
||||
binding.progressIndicator.animateToStep(position + 1)
|
||||
updateNextButtonIfNeeded()
|
||||
}
|
||||
|
||||
@Suppress("EmptyFunctionBlock")
|
||||
override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) {}
|
||||
|
||||
@Suppress("EmptyFunctionBlock")
|
||||
override fun onPageScrollStateChanged(state: Int) {}
|
||||
}
|
|
@ -14,10 +14,11 @@
|
|||
<string name="action_send_share">送信/共有</string>
|
||||
<string name="action_switch_grid_view">グリッド表示</string>
|
||||
<string name="action_switch_list_view">リスト表示</string>
|
||||
<string name="actionbar_calendar_contacts_restore">連絡先とカレンダーを復元する</string>
|
||||
<string name="actionbar_calendar_contacts_restore">連絡先とカレンダーを復元</string>
|
||||
<string name="actionbar_copy">コピー</string>
|
||||
<string name="actionbar_mkdir">新しいフォルダー</string>
|
||||
<string name="actionbar_move">移動</string>
|
||||
<string name="actionbar_move_or_copy">移動またはコピー</string>
|
||||
<string name="actionbar_open_with">次で開く</string>
|
||||
<string name="actionbar_search">検索</string>
|
||||
<string name="actionbar_see_details">詳細</string>
|
||||
|
@ -30,12 +31,12 @@
|
|||
<string name="activity_chooser_send_file_title">送信</string>
|
||||
<string name="activity_chooser_title">リンク送信…</string>
|
||||
<string name="activity_icon">アクティビティ</string>
|
||||
<string name="add_another_public_share_link">別のリンクを作成</string>
|
||||
<string name="add_another_public_share_link">別のリンクを追加</string>
|
||||
<string name="add_new_public_share">新規公開共有リンクを追加</string>
|
||||
<string name="add_new_secure_file_drop">新しいセキュアなファイルドロップを追加</string>
|
||||
<string name="add_to_cloud">%1$s に追加</string>
|
||||
<string name="advanced_settings">高度な設定</string>
|
||||
<string name="allow_resharing">再共有を許可</string>
|
||||
<string name="allow_resharing">再共有を許可する</string>
|
||||
<string name="app_widget_description">ダッシュボードから一つのウィジェットを表示</string>
|
||||
<string name="appbar_search_in">%s の中を検索</string>
|
||||
<string name="associated_account_not_found">関連付けられたアカウントが見つかりません!</string>
|
||||
|
@ -45,7 +46,7 @@
|
|||
<string name="auth_account_not_the_same">入力されたユーザーはこのアカウントのユーザーと一致しません</string>
|
||||
<string name="auth_bad_oc_version_title">認識できないサーバーのバージョンです</string>
|
||||
<string name="auth_connection_established">接続が確立しました</string>
|
||||
<string name="auth_fail_get_user_name">サーバーが正しいユーザーIDを返していない場合、管理者に連絡してください。</string>
|
||||
<string name="auth_fail_get_user_name">サーバーが正しいユーザーIDを返していません。管理者に連絡してください。</string>
|
||||
<string name="auth_host_url">サーバーアドレス https://…</string>
|
||||
<string name="auth_incorrect_address_title">サーバーアドレスの書式が違います</string>
|
||||
<string name="auth_incorrect_path_title">サーバーが見つかりません</string>
|
||||
|
@ -550,6 +551,7 @@
|
|||
<string name="permission_storage_access">ファイルをダウンロードとアップロードする追加の権限が必要です。</string>
|
||||
<string name="picture_set_as_no_app">画像を設定するアプリが見つかりませんでした</string>
|
||||
<string name="pin_home">ホームスクリーンにピン留めする</string>
|
||||
<string name="pin_shortcut_label">%1$sを開く</string>
|
||||
<string name="placeholder_fileSize">389 KB</string>
|
||||
<string name="placeholder_filename">placeholder.txt</string>
|
||||
<string name="placeholder_media_time">12:23:45</string>
|
||||
|
@ -591,6 +593,7 @@
|
|||
<string name="prefs_instant_behaviour_title">元のファイルになります…</string>
|
||||
<string name="prefs_instant_upload_path_use_date_subfolders_summary">日付を基にしたサブフォルダーに保存</string>
|
||||
<string name="prefs_instant_upload_path_use_subfolders_title">サブフォルダーを利用</string>
|
||||
<string name="prefs_instant_upload_subfolder_rule_title">サブフォルダーのオプション</string>
|
||||
<string name="prefs_keys_exist">このクライアントに End-to-End 暗号化を追加</string>
|
||||
<string name="prefs_license">ライセンス</string>
|
||||
<string name="prefs_lock">アプリパスコード</string>
|
||||
|
@ -603,6 +606,7 @@
|
|||
<string name="prefs_manage_accounts">アカウント管理</string>
|
||||
<string name="prefs_recommend">友達にすすめる</string>
|
||||
<string name="prefs_setup_e2e">end-to-end 暗号化を設定</string>
|
||||
<string name="prefs_show_ecosystem_apps">アップスイッチャーを表示</string>
|
||||
<string name="prefs_show_hidden_files">隠しファイルを表示</string>
|
||||
<string name="prefs_sourcecode">ソースコードを入手</string>
|
||||
<string name="prefs_storage_path">データ保存フォルダー</string>
|
||||
|
@ -925,7 +929,9 @@
|
|||
<string name="wait_a_moment">少々お待ちください…</string>
|
||||
<string name="wait_checking_credentials">保存された資格情報をチェック</string>
|
||||
<string name="wait_for_tmp_copy_from_private_storage">プライベートストレージからファイルをコピー中</string>
|
||||
<string name="webview_version_check_alert_dialog_message">ログインするにはAndroidシステムのWebViewを更新してください</string>
|
||||
<string name="webview_version_check_alert_dialog_positive_button_title">更新</string>
|
||||
<string name="webview_version_check_alert_dialog_title">AndroidシステムのWebViewをアップデート</string>
|
||||
<string name="what_s_new_image">新しいイメージとは</string>
|
||||
<string name="whats_new_skip">スキップ</string>
|
||||
<string name="whats_new_title">%1$sの新機能</string>
|
||||
|
|
Loading…
Reference in a new issue