Skip to content

Instantly share code, notes, and snippets.

View budioktaviyan's full-sized avatar
🎯
Focusing

Budi Oktaviyan budioktaviyan

🎯
Focusing
View GitHub Profile
@budioktaviyan
budioktaviyan / build.gradle
Last active December 26, 2016 01:28
Gradle Build
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.baculsoft.belajarandroid"
minSdkVersion 16
targetSdkVersion 25
versionCode 1
@budioktaviyan
budioktaviyan / styles.xml
Created December 26, 2016 01:29
Android Styles
<resources>
<!-- Base application theme for API < 21 -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<!-- Base application theme for API 21 -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
@budioktaviyan
budioktaviyan / activity_main.xml
Created December 26, 2016 01:34
Main Activity
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout 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"
tools:context="com.baculsoft.belajarandroid.views.activities.MainActivity"
tools:targetApi="LOLLIPOP">
<RelativeLayout
android:layout_width="match_parent"
@budioktaviyan
budioktaviyan / MainActivity.java
Created December 26, 2016 01:38
Main Activity Class
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(@Nullable final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar_main);
toolbar.setTitle(getResources().getString(R.string.app_name));
toolbar.setPadding(0, getStatusBarHeight(), 0, 0);
@budioktaviyan
budioktaviyan / AndroidManifest.xml
Last active December 26, 2016 04:55
Android Manifest
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.baculsoft.belajarandroid">
<application
android:allowBackup="true"
android:fullBackupContent="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
@budioktaviyan
budioktaviyan / fragment_home.xml
Last active December 26, 2016 04:55
Home Fragment
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:gravity="center"
@budioktaviyan
budioktaviyan / fragment_detail.xml
Last active December 26, 2016 04:55
Detail Fragment
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:gravity="center"
@budioktaviyan
budioktaviyan / HomeFragment.java
Created December 26, 2016 04:56
Home Fragment Class
public class HomeFragment extends Fragment {
@Nullable
@Override
public View onCreateView(final LayoutInflater inflater, @Nullable final ViewGroup container, @Nullable final Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_home, container, false);
}
}
@budioktaviyan
budioktaviyan / DetailFragment.java
Created December 26, 2016 04:57
Detail Fragment Class
public class DetailFragment extends Fragment {
@Nullable
@Override
public View onCreateView(final LayoutInflater inflater, @Nullable final ViewGroup container, @Nullable final Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_detail, container, false);
}
}
@budioktaviyan
budioktaviyan / activity_main.xml
Created December 26, 2016 05:09
Main Activity (Cont'd)
<?xml version="1.0" encoding="utf-8"?>
<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"
tools:context="com.baculsoft.belajarandroid.views.activities.MainActivity"
tools:targetApi="LOLLIPOP">
<android.support.v4.widget.DrawerLayout