In the next few sections,
we'll look at how to track the way your
users view products and buy things.
This course does not teach how to
implement the shopping
cart functionality.
What it does teach is how to add
Analytics code to report data
about the different steps
in the shopping process.
However, our dinner app needs
a bit more functionality
to be useful as a learning tool,
in this case.
You'll add an activity to the app
to display all the dinners.
This list will let your users
see all the dinner choices and
pick which ones they want to view.
The dinner class already has a method,
getAllDinners,
that returns a list of all the dinners.
So now we need to add an activity.
To display all the dinners
as a scrolling list.
We also need to add
a button on the home screen
that starts the activity
to display all the dinners.
So you're going to need to
add some code to your app.
To start with, you're going to need to
add the ShowAllDinnersActivity class.
And then you'll need to add the method
showDinnerList in the Main Activity.
And the onClick action
of the items in the list
will be to go to
the Order Dinner screen.
So, currently the Order Dinner
screen just displays an info
box about ordering the dinner.
But as you work through the next few
sections, you'll be adding buttons to
this screen to simulate steps
in the purchase process.
So you'll need to add the Show all
the Dinners button to activity_main.xml.
And then you're going to need the layout
files for the scrolling list of dinners.
So you'll add list_all_dinners.xml for
the scrolling list itself.
Then show_dinner_in_row.xml for
each row in the list.
If you're up for the challenge,
write the code yourself, or
if you want, you can just get the
predefined code from GitHub, up to you.
في الأقسام القليلة التالية،
سنتعرف على كيفية تتبع طريقة عرض المستخدمين للمنتجات وشراء الأشياء.
لا تُعلم هذه الدورة التدريبية كيفية
تطبيق وظيفة
عربة التسوق.
ما تُعلمه هو كيفية إضافة تعليمة
برمجية للتحليلات للإبلاغ عن بيانات
بشأن الخطوات المختلفة
في عملية التسوق.
لكن، يحتاج تطبيق العشاء إلى القليل
من الوظائف الإضافية
ليكون مفيدًا كأداة تعليمية،
في هذه الحالة.
ستضيف وظيفة إلى التطبيق
لعرض جميع وجبات العشاء.
ستيتح هذه القائمة للمستخدمين
رؤية جميع خيارات العشاء
واختيار الوجبات المطلوب عرضها.
تتضمن فئة العشاء أسلوبًا بالفعل،
getAllDinners،
من شأنه إرجاع قائمة بجميع وجبات العشاء.
لذلك نحتاج الآن إلى إضافة نشاط.
لعرض جميع وجبات العشاء
على هيئة قائمة تمرير.
كما نحتاج إلى إضافة
زر على الشاشة الرئيسية
من شأنه بدء النشاط
لعرض جميع وجبات العشاء.
لذلك ستحتاج إلى
إضافة بعض الرموز إلى التطبيق.
للبدء في ذلك، ستحتاج إلى
إضافة الفئة ShowAllDinnersActivity.
ثم ستحتاج إلى إضافة الأسلوب
showDinnerList في Main Activity.
وسينتقل الإجراء onClick
الخاص بالعناصر الموجودة في القائمة
إلى الشاشة
Order Dinner.
لذلك، لا تعرض الشاشة
Order Dinner حاليًا سوى مربع
معلومات عن طلب العشاء.
لكن خلال عملك عبر الأقسام القليلة
التالية، ستضيف أزرارًا إلى
هذه الشاشة لمحاكاة الخطوات
المتبعة في عملية الشراء.
لذلك ستحتاج إلى إضافة الزر
Show all the Dinners إلى activity_main.xml.
ثم ستحتاج إلى ملفات
التخطيط لقائمة وجبات العشاء التمريرية.
ومن ثم ستضيف list_all_dinners.xml
لقائمة التمرير نفسها.
ثم show_dinner_in_row.xml
لكل صف في القائمة.
إذا كنت ترغب في خوض التحدي،
فاكتب التعليمة البرمجية بنفسك، أو
يمكنك الحصول على تعليمة برمجية معرفة مسبقًا
إذا أردت ذلك من GitHub، حسب رغبتك.
Nas próximas seções,
veremos como rastrear o modo como os usuários
visualizam produtos e compram mercadorias.
Este curso não ensina a
implementar
a funcionalidade do carrinho de compras.
Ele ensina a adicionar o
código de análise para informar dados
das diferentes etapas
do processo de compra.
Entretanto, nosso aplicativo de jantar precisa de
um pouco mais de funcionalidade
para ser útil como ferramenta de aprendizado,
neste caso.
Você adicionará uma atividade ao aplicativo
para exibir todos os jantares.
Esta lista permitirá que seus usuários
vejam todas as opções de jantar
e selecionem quais delas
desejam visualizar.
A classe dinner já tem um método,
getAllDinners,
que retorna uma lista com todos os jantares.
Portanto, agora precisamos adicionar uma atividade.
Para exibir todos os jantares
como uma lista de rolagem.
Também precisamos adicionar
um botão à tela inicial
que iniciará a atividade
para exibir todos os jantares.
Portanto, você precisará
adicionar um código ao seu aplicativo.
Para começar, você precisará
adicionar a classe ShowAllDinnersActivity.
E, depois, você precisará adicionar o método
showDinnerList na MainActivity.
E a ação onClick
dos itens da lista
deverá ir para a
tela Order Dinner.
Portanto, no momento, a tela Order Dinner
exibe apenas
uma caixa de informações
sobre como pedir o jantar.
Mas, durante o trabalho nas próximas
seções, você adicionará botões
a essa tela para simular etapas
no processo de compra.
Então, você precisará adicionar o botão Show all
the Dinners a activity_main.xml.
E, depois, precisará dos arquivos de layout
para a lista de rolagem dos jantares.
Portanto, você adicionará list_all_dinners.xml
para a lista de rolagem.
Em seguida, show_dinner_in_row.xml
para cada linha da lista.
Se aceitar o desafio ,
escreva o código por conta própria
ou, se desejar, você poderá simplesmente obter o
código predefinido de GitHub,
você decide.
在接下来的几节课程中
我们将了解如何跟踪用户查看产品并购买商品的方式
本节课程不会讲授
如何执行购物车功能
而是讲授如何将 Analytics 代码添加到
有关购物流程内不同步骤的报告数据中
但是在这个示例中 我们的晚餐应用
还需要更多功能 以便用作学习工具
你需要将 activity 添加到应用 以显示所有晚餐
通过这个列表 用户可以查看所有晚餐选择
并点选他们最想查看的晚餐
dinner 类已经采用 getAllDinners 方法
可返回包含所有晚餐的列表
现在我们需要添加 activity
要以滚动列表的形式显示所有晚餐
我们还需要在启动 activity 的主画面上
添加显示所有晚餐的按钮
因此你需要在应用中添加一些代码
首先 你需要添加 ShowAllDinnersActivity 类
然后 需要在 MainActivity 中添加 showDinnerList 方法
列表中商品的 onClick 行为
是前往 Order Dinner 页面
当前 Order Dinner 页面只显示有关订餐的
信息框
但是在你学习接下来的几节课程时 你将在该画面中
添加按钮 模拟购买流程中的步骤
你需要在 activity_main.xml 中添加 Show all the Dinners 按钮
然后你需要使用晚餐滚动列表的布局文件
因此你要为滚动列表本身添加 list_all_dinners.xml
然后为列表中的每行添加 show_dinner_in_row.xml
如果你想接受挑战 可以独立编写代码
或者如果你愿意 可以从 GitHub 获得预先定义的代码 这个你自己决定