You are on page 1of 8

LAPORAN TUGAS PRAKTIKUM

APLIKASI MOBILE
“ Style Dan Theme “

Disusun oleh:

Rakhmilawati Faznur A1316096

TEKNIK INFORMATIKA
POLITEKNIK NEGERI TANAH LAUT
2018
1. Source Code :
Activity main.xml

<?xml version="1.0" encoding="utf-8"?>


<ScrollView 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"
tools:context="com.example.emiliyana.myviewandviewsmila.MainActivity">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:src="@drawable/pixel_google"
android:scaleType="fitXY"/>
<TextView
style="@style/TextContent.Small.White"
android:padding="8dp"
android:text="@string/_6_photos"
android:gravity="center_vertical"
android:drawableLeft="@drawable/ic_collections_white_18dp"
android:drawablePadding="4dp"

android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:background="#4D000000"

android:layout_marginLeft="@dimen/activity_horizontal_margin"

android:layout_marginBottom="@dimen/ctivity_vertical_margin"
android:layout_gravity="bottom" />
</FrameLayout>
<TextView
style="@style/TextContent.Black"
android:textSize="32sp"
android:text="@string/_735"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:layout_marginBottom="8dp"/>
<TextView
style="@style/TextContent.Subtitle"
android:text="@string/stock_hanya_5_buah"
android:layout_marginBottom="@dimen/activity_vertical_margin"/>
<TextView
style="@style/TextContent"
android:text="@string/content_text"
android:layout_marginBottom="@dimen/activity_vertical_margin"
android:lineSpacingMultiplier="1"
android:textColor="@android:color/black"/>
<TextView
style="@style/TextContent.Subtitle"
android:text="@string/spesifikasi"
android:layout_marginBottom="8dp"/>
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/activity_horizontal_margin"
android:layout_marginRight="@dimen/activity_horizontal_margin"
android:layout_marginBottom="@dimen/activity_vertical_margin">
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp">
<TextView
style="@style/TextSpec.Field"
android:text="@string/display"/>
<TextView
style="@style/TextSpec.Value"
android:text="@string/content_specs_display"/>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp">
<TextView
style="@style/TextSpec.Field"
android:text="@string/size"/>
<TextView
style="@style/TextSpec.Value"
android:text="@string/content_specs_size"/>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp">
<TextView
style="@style/TextSpec.Field"
android:text="@string/battery"/>
<TextView
style="@style/TextSpec.Value"
android:text="@string/content_specs_battery"/>
</TableRow>
</TableLayout>
<TextView
style="@style/TextContent.Subtitle"
android:text="@string/dijual_oleh"
android:layout_marginBottom="8dp"/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/activity_horizontal_margin"
android:layout_marginRight="@dimen/activity_horizontal_margin"
android:layout_marginBottom="@dimen/activity_vertical_margin">
<de.hdodenhof.circleimageview.CircleImageView
android:layout_width="56dp"
android:layout_height="56dp"
android:src="@drawable/photo_2"
android:layout_centerVertical="true"
android:id="@+id/profile_image"

android:layout_marginRight="@dimen/activity_horizontal_margin"/>
<TextView
style="@style/TextContent"
android:layout_toRightOf="@id/profile_image"
android:text="@string/narenda_wicaksono"
android:layout_centerVertical="true"/>
</RelativeLayout>
<Button
style="@style/ButtonGeneral"
android:text="Beli"/>
</LinearLayout>

</ScrollView>

MainActivity.Java

package com.example.emiliyana.myviewandviewsmila;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

getSupportActionBar().setTitle("Google Pixel");
}
}

Styles.xml

<resources>

<!-- Base application theme. -->


<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>

<style name="TextContent" parent="@style/TextAppearance.AppCompat">


<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item
name="android:layout_marginLeft">@dimen/activity_horizontal_margin</item>
<item
name="android:layout_marginRight">@dimen/activity_horizontal_margin</item>
</style>
<style name="TextContent.Small">
<item
name="android:textAppearance">@style/TextAppearance.AppCompat.Small</item>
</style>
<style name="TextContent.Small.White">
<item name="android:textColor">@android:color/white</item>
</style>
<style name="TextContent.Subtitle">
<item name="android:textColor">@color/colorSubTitle</item>
<item name="android:textSize">12sp</item>
</style>
<style name="TextContent.Black">
<item name="android:textColor">@android:color/black</item>
</style>
<style name="TextSpec">
<item name="android:textSize">14sp</item>
</style>
<style name="TextSpec.Field">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_marginRight">16dp</item>
<item name="android:textColor">@color/colorSubTitle</item>
</style>
<style name="TextSpec.Value">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_weight">1</item>
<item name="android:textColor">@android:color/black</item>
</style>
<style name="ButtonGeneral"
parent="@style/Widget.AppCompat.Button.Colored">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
<item
name="android:layout_marginRight">@dimen/activity_horizontal_margin</item>
<item
name="android:layout_marginLeft">@dimen/activity_horizontal_margin</item>
<item
name="android:layout_marginBottom">@dimen/activity_vertical_margin</item>
</style>
</resources>

Strings.xml

<resources>
<string name="app_name">MyViewAndViews</string>
<string name="content_text">Google officially announced its much-
anticipated Pixel phones; the Pixel and Pixel XL, on October 4. We attended
Google’s London UK event, mirroring the main one taking place in San
Francisco, US, where the firm unwrapped the new Android 7.1 Nougat devices
which will apparently usurp Google’s long-standing Nexus series.</string>
<string name="content_specs_display">5.0 inches\n
FHD AMOLED at 441ppi\n
2.5D Corning® Gorilla® Glass 4</string>
<string name="content_specs_size">5.6 x 2.7 x 0.2 ~ 0.3 inches 143.8 x
69.5 x 7.3 ~ 8.5 mm</string>
<string name="content_specs_battery">2,770 mAh battery\n
Standby time (LTE): up to 19 days\n
Talk time (3g/WCDMA): up to 26 hours\n
Internet use time (Wi-Fi): up to 13 hours\n
Internet use time (LTE): up to 13 hours\n
Video playback: up to 13 hours\n
Audio playback (via headset): up to 110 hours\n
Fast charging: up to 7 hours of use from only 15 minutes of
charging</string>
<string name="stock_hanya_5_buah">Stock hanya 5 buah</string>
<string name="spesifikasi">Spesifikasi</string>
<string name="display">Display</string>
<string name="size">Size</string>
<string name="battery">Battery</string>
<string name="dijual_oleh">Dijual oleh</string>
<string name="narenda_wicaksono">Narenda Wicaksono</string>
<string name="beli">Beli</string>
<string name="_735">$735</string>
<string name="_6_photos">6 photos</string>
</resources>

Colors.xml

<?xml version="1.0" encoding="utf-8"?>


<resources>
<color name="colorPrimary">#607D8B</color>
<color name="colorPrimaryDark">#455A64</color>
<color name="colorAccent">#FF5722</color>
<color name="colorSubTitle">#757575</color>
</resources>

Dimens.xml

<?xml version="1.0" encoding="utf-8"?>


<resources>
<dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="ctivity_vertical_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>
</resources>

Build.Gradle (Module : app)

apply plugin: 'com.android.application'

android {
compileSdkVersion 25
buildToolsVersion "27.0.3"
defaultConfig {
applicationId "com.example.emiliyana.myviewandviewsmila"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-
core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile 'de.hdodenhof:circleimageview:2.1.0'
}

2. Hasil :
3. Kesimpulan :
Dari latihan diatas dapat disimpulkan bahwa untuk belajar prinsip desain yang ada di
android dan implementasinya harus mematuhi kaidah yang di tetapkan oleh Design
Guideline yang dibuat oleh tim android di google. Untuk mengembangkan android harus
memperhatikan langkah-langkah seperti desain yang baik untuk interface, responsif, sesuai
dengan kebutuhan pengguna, optimasi menggunakan baterai dan koneksi jaringan yang
efisien.

4. QUIZ :

You might also like