Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
hds
flexin
android-app
Commits
22d671f7
Commit
22d671f7
authored
Oct 28, 2017
by
Nastuzzi Samy
Browse files
Creation of ArticleCategory view
Create XML Test and prepare future views
parent
682e29d9
Changes
9
Hide whitespace changes
Inline
Side-by-side
app/src/main/AndroidManifest.xml
View file @
22d671f7
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android=
"http://schemas.android.com/apk/res/android"
package=
"fr.utc.simde.payutc"
>
<uses-permission
android:name=
"android.permission.NFC"
/>
<uses-permission
android:name=
"android.permission.INTERNET"
/>
...
...
@@ -20,6 +21,7 @@
</activity>
<activity
android:name=
".BaseActivity"
/>
<activity
android:name=
".FoundationListActivity"
/>
<activity
android:name=
".ArticleCategoryActivity"
/>
</application>
</manifest>
\ No newline at end of file
app/src/main/java/fr/utc/simde/payutc/ArticleCategoryActivity.java
0 → 100644
View file @
22d671f7
package
fr.utc.simde.payutc
;
import
android.os.Bundle
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.widget.ImageView
;
import
android.widget.LinearLayout
;
import
android.widget.TabHost
;
import
android.widget.TextView
;
import
fr.utc.simde.payutc.fragments.ArticleGroupFragment
;
/**
* Created by Samy on 27/10/2017.
*/
public
class
ArticleCategoryActivity
extends
BaseActivity
{
@Override
public
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_articles_category
);
TabHost
host
=
findViewById
(
R
.
id
.
tab_categories
);
host
.
setup
();
//Tab 1
TabHost
.
TabSpec
spec
=
host
.
newTabSpec
(
"Softs"
);
spec
.
setIndicator
(
"Softs"
);
spec
.
setContent
(
new
ArticleGroupFragment
(
ArticleCategoryActivity
.
this
));
host
.
addTab
(
spec
);
//Tab 1
TabHost
.
TabSpec
spec2
=
host
.
newTabSpec
(
"Bières"
);
spec2
.
setIndicator
(
"Bières"
);
spec2
.
setContent
(
new
ArticleGroupFragment
(
ArticleCategoryActivity
.
this
));
host
.
addTab
(
spec2
);
}
@Override
protected
void
onIdentification
(
String
idBadge
)
{
}
}
app/src/main/java/fr/utc/simde/payutc/BaseActivity.java
View file @
22d671f7
...
...
@@ -77,8 +77,8 @@ public abstract class BaseActivity extends NFCActivity {
if
(
foundationList
.
size
()
==
0
)
{
dialog
.
stopLoading
();
fatal
(
activity
,
getString
(
R
.
string
.
information_collection
),
nemopaySession
.
getUsername
()
+
" "
+
getString
(
R
.
string
.
user_no_rights
));
fatal
(
activity
,
getString
(
R
.
string
.
information_collection
),
nemopaySession
.
getUsername
()
+
" "
+
getString
(
R
.
string
.
user_no_rights
));
return
;
}
...
...
@@ -89,8 +89,8 @@ public abstract class BaseActivity extends NFCActivity {
if
(
foundationList
.
size
()
==
1
)
{
dialog
.
stopLoading
();
nemopaySession
.
setFoundation
(
foundationList
.
get
(
0
).
get
(
"fun_id"
).
intValue
());
Log
.
d
(
LOG_TAG
,
String
.
valueOf
(
foundationList
.
get
(
0
).
get
(
"fun_id"
).
intValue
())
)
;
startArticlesActivity
(
activity
,
foundationList
.
get
(
0
).
get
(
"fun_id"
).
intValue
());
return
;
}
...
...
@@ -107,4 +107,17 @@ public abstract class BaseActivity extends NFCActivity {
}
}.
start
();
}
protected
void
startCategoryArticlesActivity
(
final
Activity
activity
)
{
Intent
intent
=
new
Intent
(
activity
,
ArticleCategoryActivity
.
class
);
activity
.
startActivity
(
intent
);
}
protected
void
startArticlesActivity
(
final
Activity
activity
,
final
int
idFoundation
)
{
nemopaySession
.
setFoundation
(
idFoundation
);
Log
.
d
(
LOG_TAG
,
String
.
valueOf
(
idFoundation
));
// Plus tard, on pourra choisir quelle activité lancer
startCategoryArticlesActivity
(
activity
);
}
}
app/src/main/java/fr/utc/simde/payutc/FoundationListActivity.java
View file @
22d671f7
...
...
@@ -24,11 +24,15 @@ import fr.utc.simde.payutc.tools.HTTPRequest;
public
class
FoundationListActivity
extends
BaseActivity
{
private
static
final
String
LOG_TAG
=
"_FoundationListActivity"
;
LinearLayout
listLayout
;
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_foundation_list
);
listLayout
=
findViewById
(
R
.
id
.
foundationList
);
try
{
setFoundationList
(
new
ObjectMapper
().
readTree
(
getIntent
().
getExtras
().
getString
(
"foundationList"
)));
}
catch
(
Exception
e
)
{
...
...
@@ -53,8 +57,6 @@ public class FoundationListActivity extends BaseActivity {
}
protected
void
setFoundationList
(
final
JsonNode
foundationList
)
throws
Exception
{
LinearLayout
linearLayout
=
findViewById
(
R
.
id
.
foundationList
);
for
(
final
JsonNode
foundation
:
foundationList
)
{
Button
foundationButton
=
new
Button
(
this
);
...
...
@@ -64,7 +66,7 @@ public class FoundationListActivity extends BaseActivity {
foundationButton
.
setText
(
foundation
.
get
(
"name"
).
textValue
());
foundationButton
.
setOnClickListener
(
new
onClickFoundation
(
foundation
.
get
(
"fun_id"
).
intValue
()));
linear
Layout
.
addView
(
foundationButton
);
this
.
list
Layout
.
addView
(
foundationButton
);
}
}
...
...
@@ -77,8 +79,7 @@ public class FoundationListActivity extends BaseActivity {
@Override
public
void
onClick
(
View
view
)
{
nemopaySession
.
setFoundation
(
this
.
idFoundation
);
Log
.
d
(
LOG_TAG
,
String
.
valueOf
(
this
.
idFoundation
));
startArticlesActivity
(
FoundationListActivity
.
this
,
this
.
idFoundation
);
}
};
...
...
app/src/main/java/fr/utc/simde/payutc/fragments/ArticleGroupFragment.java
0 → 100644
View file @
22d671f7
package
fr.utc.simde.payutc.fragments
;
import
android.app.Activity
;
import
android.view.View
;
import
android.widget.TabHost
;
import
android.widget.TextView
;
import
fr.utc.simde.payutc.ArticleCategoryActivity
;
/**
* Created by Samy on 27/10/2017.
*/
public
class
ArticleGroupFragment
implements
TabHost
.
TabContentFactory
{
private
TextView
nameText
;
public
ArticleGroupFragment
(
Activity
activity
)
{
nameText
=
new
TextView
(
activity
);
}
@Override
public
View
createTabContent
(
String
tag
)
{
nameText
.
setText
(
tag
);
return
nameText
;
}
}
app/src/main/res/layout/activity_articles_category.xml
0 → 100644
View file @
22d671f7
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:orientation=
"vertical"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<TabHost
android:id=
"@+id/tab_categories"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"vertical"
>
<TabWidget
android:id=
"@android:id/tabs"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
/>
<FrameLayout
android:id=
"@android:id/tabcontent"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
</FrameLayout>
</LinearLayout>
</TabHost>
</LinearLayout>
app/src/main/res/layout/fragment_article.xml
0 → 100644
View file @
22d671f7
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:orientation=
"vertical"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
>
<ImageView
android:id=
"@+id/imageView"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
app:srcCompat=
"@mipmap/ic_launcher"
/>
<TextView
android:id=
"@+id/textView"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"TextView"
/>
</RelativeLayout>
app/src/main/res/layout/fragment_article_group.xml
0 → 100644
View file @
22d671f7
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:orientation=
"vertical"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<GridView
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
/>
</LinearLayout>
app/src/main/res/values/strings.xml
View file @
22d671f7
...
...
@@ -66,7 +66,8 @@
<string
name=
"no_right"
>
Il est nécessaire d\'avoir au moins le droit suivant:
</string>
<string
name=
"no_rights"
>
Il est nécessaire d\'avoir au moins les droits suivants:
</string>
<string
name=
"no_need_rights"
>
Aucun droit spécifique n\'est nécessaire
</string>
<string-array
name=
"rights_keys"
><item>
Accès en lecture seule sur les paramètres
</item>
<string-array
name=
"rights_keys"
>
<item>
Accès en lecture seule sur les paramètres
</item>
<item>
add_free
</item>
<item>
offline_app
</item>
<item>
delegated_auth
</item>
...
...
@@ -140,7 +141,8 @@
<item>
sale_visualisation
</item>
</string-array>
<string-array
name=
"rights_values"
><item>
Accès en lecture seule sur les paramètres
</item>
<string-array
name=
"rights_values"
>
<item>
Accès en lecture seule sur les paramètres
</item>
<item>
Ajout de gratuités
</item>
<item>
Application hors ligne
</item>
<item>
Authentification déléguée
</item>
...
...
@@ -213,4 +215,7 @@
<item>
Visualisation des sessions de recharge
</item>
<item>
Visualisation des sessions de vente
</item>
</string-array>
<!-- TODO: Remove or change this placeholder text -->
<string
name=
"hello_blank_fragment"
>
Hello blank fragment
</string>
</resources>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment