Skip to content

Commit

Permalink
createlistcard_window
Browse files Browse the repository at this point in the history
  • Loading branch information
gunhappy committed Feb 27, 2016
1 parent 4ae0aea commit 45fda7f
Show file tree
Hide file tree
Showing 15 changed files with 153 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .idea/gradle.xml

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

2 changes: 1 addition & 1 deletion .idea/misc.xml

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

1 change: 1 addition & 0 deletions .idea/modules.xml

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

6 changes: 5 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:name=".activities.MainActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
Expand All @@ -18,6 +18,10 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

<activity android:name=".activities.CreateMenu"
android:theme="@style/AppTheme.CustomTheme"
></activity>
</application>

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.minitrello.minitrello.activities;

import android.app.Activity;
import android.os.Bundle;
import android.util.DisplayMetrics;

import com.minitrello.minitrello.R;

/**
* Created by พศิน on 27/2/2559.
*/
public class CreateMenu extends Activity{
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

setContentView(R.layout.createwindow);

DisplayMetrics dm = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(dm);

int width = dm.widthPixels;
int height = dm.heightPixels;

getWindow().setLayout((int)(width*.8),(int)(height*.6));
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.minitrello.minitrello;
package com.minitrello.minitrello.activities;

import android.content.Intent;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
Expand All @@ -8,22 +9,38 @@
import android.view.View;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.ListView;

import com.minitrello.minitrello.R;

import java.util.List;

import models.ListCard;

public class MainActivity extends AppCompatActivity {

private ListView listcardListView;
private List<ListCard> listcards;


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

private void initComponent(){
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);

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();
startActivity(new Intent(MainActivity.this,CreateMenu.class));
}
});
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.minitrello.minitrello;
package models;



Expand Down
21 changes: 21 additions & 0 deletions app/src/main/java/models/ListCard.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package models;

/**
* Created by พศิน on 27/2/2559.
*/
public class ListCard {
private String title;

public ListCard(String title){
this.title = title;
}

public String getTitle() {
return title;
}

@Override
public String toString() {
return this.title;
}
}
32 changes: 32 additions & 0 deletions app/src/main/java/models/Storage.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package models;

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

/**
* Created by พศิน on 27/2/2559.
*/
public class Storage {

private List<ListCard> savedListCards;

private static Storage instance;

private Storage(){
savedListCards = new ArrayList<ListCard>();
}

public static Storage getInstance(){
if(instance==null)instance = new Storage();
return instance;
}

public void saveListCard(ListCard listCard){
savedListCards.add(listCard);
}

public List<ListCard> loadListCard(){
return savedListCards;
}

}
5 changes: 3 additions & 2 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="com.minitrello.minitrello.MainActivity">
tools:context=".activities.MainActivity">

<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
Expand All @@ -17,6 +17,7 @@
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:title="@string/app_name"
app:popupTheme="@style/AppTheme.PopupOverlay" />

</android.support.design.widget.AppBarLayout>
Expand All @@ -29,6 +30,6 @@
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/fab_margin"
android:src="@android:drawable/ic_dialog_email" />
android:src="@android:drawable/ic_input_add" />

</android.support.design.widget.CoordinatorLayout>
14 changes: 9 additions & 5 deletions app/src/main/res/layout/content_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,15 @@
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="com.minitrello.minitrello.MainActivity"
tools:context=".activities.MainActivity"
tools:showIn="@layout/activity_main">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!" />
<ListView
android:id="@+id/listcard_list_view"
android:layout_width="match_parent"
android:layout_height="match_parent">

</ListView>


</RelativeLayout>
25 changes: 25 additions & 0 deletions app/src/main/res/layout/createwindow.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?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"
android:background="#f00404">

<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/title"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="123dp"
android:hint="Input Title name"
android:textSize="@android:dimen/app_icon_size" />

<Button
android:id="@+id/confirm_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Confirm"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"

/>
</RelativeLayout>
2 changes: 1 addition & 1 deletion app/src/main/res/menu/menu_main.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<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="com.minitrello.minitrello.MainActivity">
tools:context=".activities.MainActivity">
<item
android:id="@+id/action_settings"
android:orderInCategory="100"
Expand Down
5 changes: 5 additions & 0 deletions app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,9 @@

<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />

<style name="AppTheme.CustomTheme" >
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowCloseOnTouchOutside">true</item>
</style>

</resources>
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1 +1 @@
include ':app'
include ':app'

0 comments on commit 45fda7f

Please sign in to comment.