Skip to content

Commit

Permalink
setup actionbar
Browse files Browse the repository at this point in the history
  • Loading branch information
awidiyadew committed Feb 19, 2018
1 parent a0977e6 commit 75d73c5
Show file tree
Hide file tree
Showing 9 changed files with 260 additions and 90 deletions.
4 changes: 3 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,18 @@ android {
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
implementation 'com.android.support:design:26.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.google.firebase:firebase-firestore:11.8.0'
implementation 'com.android.support:recyclerview-v7:26.1.0'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation ('com.github.bumptech.glide:glide:4.6.1', {
implementation('com.github.bumptech.glide:glide:4.6.1', {
exclude group: 'com.android.support'
})
}


apply plugin: 'com.google.gms.google-services'
11 changes: 9 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="id.balistream.leaderboard">

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.INTERNET" />

<application
android:allowBackup="true"
Expand All @@ -11,12 +11,19 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".LeaderBoardActivity">
<activity android:name=".LeaderBoardActivity"
android:label=""
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".ScrollingActivity"
android:label="@string/title_activity_scrolling"
android:theme="@style/AppTheme.NoActionBar"></activity>
</application>

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import android.support.v7.widget.LinearLayoutManager
import android.util.Log
import com.bumptech.glide.Glide
import com.google.firebase.firestore.FirebaseFirestore
import com.google.firebase.firestore.Query
import kotlinx.android.synthetic.main.activity_learder_board.*
import kotlinx.android.synthetic.main.item_player.view.*
import kotlinx.android.synthetic.main.content_scrolling.*

class LeaderBoardActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_learder_board)
setSupportActionBar(toolbar)
setupRecyclerView()
loadPlayers()
}
Expand Down
108 changes: 23 additions & 85 deletions app/src/main/res/layout/activity_learder_board.xml
Original file line number Diff line number Diff line change
@@ -1,99 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/gradient"
tools:context="id.balistream.leaderboard.LeaderBoardActivity">
tools:context="id.balistream.leaderboard.ScrollingActivity">

<LinearLayout
android:id="@+id/layout_champion"
<android.support.design.widget.AppBarLayout
android:id="@+id/app_bar"
android:layout_width="match_parent"
android:minHeight="150dp"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="3"
android:layout_marginBottom="16dp">
android:layout_height="wrap_content">

<RelativeLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1">
<de.hdodenhof.circleimageview.CircleImageView
android:id="@+id/iv_champion2"
android:layout_width="90dp"
android:layout_height="90dp"
android:layout_marginTop="16dp"
android:scaleType="centerCrop"
android:layout_centerHorizontal="true"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="16sp"
android:textStyle="bold"
android:textColor="@color/colorBtpn"
android:layout_below="@id/iv_champion2"
android:layout_centerHorizontal="true"
android:layout_marginTop="8dp"
android:text="2ND"/>
</RelativeLayout>
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="parallax"
android:textAlignment="center"
app:popupTheme="@style/AppTheme.PopupOverlay">

<RelativeLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1">
<de.hdodenhof.circleimageview.CircleImageView
android:id="@+id/iv_champion1"
android:layout_width="110dp"
android:layout_height="110dp"
android:layout_marginTop="16dp"
android:scaleType="centerCrop"
android:layout_centerHorizontal="true"/>
<TextView
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="16sp"
android:textStyle="bold"
android:textColor="@color/colorBtpn"
android:layout_below="@id/iv_champion1"
android:layout_centerHorizontal="true"
android:layout_marginTop="8dp"
android:text="1ST"/>
</RelativeLayout>
android:textAlignment="center"
android:text="L E A D E R B O A R D"
android:textColor="#ffffff"
android:textSize="18sp"
android:textStyle="bold" />

<RelativeLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1">
<de.hdodenhof.circleimageview.CircleImageView
android:id="@+id/iv_champion3"
android:layout_width="90dp"
android:layout_height="90dp"
android:layout_marginTop="16dp"
android:scaleType="centerCrop"
android:layout_centerHorizontal="true"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="16sp"
android:textStyle="bold"
android:textColor="@color/colorBtpn"
android:layout_below="@id/iv_champion3"
android:layout_centerHorizontal="true"
android:layout_marginTop="8dp"
android:text="3RD"/>
</RelativeLayout>
</android.support.v7.widget.Toolbar>

</LinearLayout>
</android.support.design.widget.AppBarLayout>

<android.support.v7.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_below="@id/layout_champion"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="none"/>
<include layout="@layout/content_scrolling" />

</RelativeLayout>
</android.support.design.widget.CoordinatorLayout>
108 changes: 108 additions & 0 deletions app/src/main/res/layout/content_scrolling.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/gradient"
tools:context="id.balistream.leaderboard.LeaderBoardActivity">

<LinearLayout
android:id="@+id/layout_champion"
android:layout_width="match_parent"
android:minHeight="150dp"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="3"
android:layout_marginBottom="16dp">

<RelativeLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1">
<de.hdodenhof.circleimageview.CircleImageView
android:id="@+id/iv_champion2"
android:layout_width="90dp"
android:layout_height="90dp"
android:layout_marginTop="16dp"
android:scaleType="centerCrop"
android:layout_centerHorizontal="true"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="16sp"
android:textStyle="bold"
android:textColor="@color/colorBtpn"
android:layout_below="@id/iv_champion2"
android:layout_centerHorizontal="true"
android:layout_marginTop="8dp"
android:text="2ND"/>
</RelativeLayout>

<RelativeLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1">
<de.hdodenhof.circleimageview.CircleImageView
android:id="@+id/iv_champion1"
android:layout_width="110dp"
android:layout_height="110dp"
android:layout_marginTop="16dp"
android:scaleType="centerCrop"
android:layout_centerHorizontal="true"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="16sp"
android:textStyle="bold"
android:textColor="@color/colorBtpn"
android:layout_below="@id/iv_champion1"
android:layout_centerHorizontal="true"
android:layout_marginTop="8dp"
android:text="1ST"/>
</RelativeLayout>

<RelativeLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1">
<de.hdodenhof.circleimageview.CircleImageView
android:id="@+id/iv_champion3"
android:layout_width="90dp"
android:layout_height="90dp"
android:layout_marginTop="16dp"
android:scaleType="centerCrop"
android:layout_centerHorizontal="true"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="16sp"
android:textStyle="bold"
android:textColor="@color/colorBtpn"
android:layout_below="@id/iv_champion3"
android:layout_centerHorizontal="true"
android:layout_marginTop="8dp"
android:text="3RD"/>
</RelativeLayout>

</LinearLayout>

<android.support.v7.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_below="@id/layout_champion"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="none"/>

</RelativeLayout>

</android.support.v4.widget.NestedScrollView>
10 changes: 10 additions & 0 deletions app/src/main/res/menu/menu_scrolling.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context="id.balistream.leaderboard.ScrollingActivity">
<item
android:id="@+id/action_settings"
android:orderInCategory="100"
android:title="@string/action_settings"
app:showAsAction="never" />
</menu>
5 changes: 5 additions & 0 deletions app/src/main/res/values/dimens.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<resources>
<dimen name="app_bar_height">180dp</dimen>
<dimen name="fab_margin">16dp</dimen>
<dimen name="text_margin">16dp</dimen>
</resources>
Loading

0 comments on commit 75d73c5

Please sign in to comment.