Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
wirasetiawan29 committed Jan 20, 2016
1 parent 321983f commit 0d1da52
Show file tree
Hide file tree
Showing 15 changed files with 135 additions and 8 deletions.
2 changes: 1 addition & 1 deletion ExpandListView/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public Object getItem(int position){
public long getItemId(int position){
return position;
}

@Override
public View getView(int position, View convertView, ViewGroup parent){
Row row;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
package com.wirasetiawan.expandlistview;

import android.app.AlertDialog;
import android.content.ContentValues;
import android.content.DialogInterface;
import android.content.Intent;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
Expand All @@ -9,12 +14,17 @@
import android.view.Menu;
import android.view.MenuItem;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;

import java.util.ArrayList;
import java.util.List;

public class MainActivity extends AppCompatActivity {
View expenseAdd;

@Override
protected void onCreate(Bundle savedInstanceState) {
Expand Down Expand Up @@ -46,14 +56,20 @@ public void onItemClick(AdapterView<?> parent, View view, int position, long id)





FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
// Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
// .setAction("Action", null).show();

addtask();
}
});


}

private ExpandableAdapter getAdapter(){
Expand All @@ -72,6 +88,24 @@ private ExpandableAdapter getAdapter(){
return new ExpandableAdapter(this, items);
}

public void addtask () {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Add a task");
builder.setMessage("What do you want to do?");
final EditText inputField = new EditText(this);
builder.setView(inputField);
builder.setPositiveButton("Add", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
finish();
}
});

builder.setNegativeButton("Cancel", null);

builder.create().show();
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 26 additions & 0 deletions ExpandListView/app/src/main/res/layout/add.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal" android:layout_width="match_parent"
android:padding="10dp"

android:layout_height="wrap_content">

<ImageView
android:layout_gravity="center"
android:src="@drawable/ic_add"
android:layout_width="25dp"
android:layout_height="25dp" />

<TextView
android:textColor="#337CC6"
android:text="Tambah data"
android:layout_gravity="center"
android:id="@+id/titleTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:layout_weight="1">
</TextView>


</LinearLayout>
54 changes: 52 additions & 2 deletions ExpandListView/app/src/main/res/layout/row_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
android:layout_centerInParent="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />


</RelativeLayout>

<FrameLayout
Expand All @@ -30,10 +32,58 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content">

<android.support.v7.widget.AppCompatTextView
<!--<android.support.v7.widget.AppCompatTextView-->
<!--android:id="@+id/deskripsi"-->
<!--android:padding="16dp"-->
<!--android:layout_width="fill_parent"-->
<!--android:layout_height="wrap_content"/>-->

<!--<RelativeLayout-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="match_parent">-->

<!--<TextView-->
<!--android:id="@+id/deskripsi"-->
<!--android:padding="16dp"-->
<!--android:layout_width="fill_parent"-->
<!--android:layout_height="wrap_content"-->
<!--android:text="test"/>-->

<!--<include android:id="@+id/expenseAdd" layout="@layout/add"/>-->

<!--&lt;!&ndash;<Button&ndash;&gt;-->
<!--&lt;!&ndash;android:layout_below="@+id/deskripsi"&ndash;&gt;-->
<!--&lt;!&ndash;android:layout_alignParentBottom="true"&ndash;&gt;-->
<!--&lt;!&ndash;android:layout_width="100dp"&ndash;&gt;-->
<!--&lt;!&ndash;android:layout_height="wrap_content"&ndash;&gt;-->
<!--&lt;!&ndash;android:text="test"/>&ndash;&gt;-->

<!--</RelativeLayout>-->


<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:id="@+id/container"
android:paddingLeft="10dp"
android:layout_height="match_parent">

<TextView
android:id="@+id/deskripsi"
android:padding="16dp"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
android:layout_height="wrap_content"
android:text="test"/>

<include
android:id="@+id/expenseAdd"
layout="@layout/add"/>

</LinearLayout>






</FrameLayout>
</RelativeLayout>
2 changes: 1 addition & 1 deletion ToDoList/.idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 17 additions & 1 deletion ToDoList/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ToDoList/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 0d1da52

Please sign in to comment.