+添加活动的界面除了成员控制
This commit is contained in:
+2
-2
@@ -1,6 +1,6 @@
|
||||
[Dolphin]
|
||||
Timestamp=2017,4,18,16,56,55
|
||||
Version=3
|
||||
Timestamp=2017,4,29,15,41,58
|
||||
Version=4
|
||||
|
||||
[Settings]
|
||||
HiddenFilesShown=true
|
||||
|
||||
Generated
+1
-1
@@ -37,7 +37,7 @@
|
||||
<ConfirmationsSetting value="0" id="Add" />
|
||||
<ConfirmationsSetting value="0" id="Remove" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8 (3)" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8 (3)" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
|
||||
@@ -40,6 +40,7 @@ dependencies {
|
||||
compile 'com.android.support:appcompat-v7:25.3.1'
|
||||
compile 'com.github.lzyzsd.randomcolor:library:1.0.0'
|
||||
compile 'com.android.support:design:25.3.1'
|
||||
compile 'com.android.support:percent:25.3.1'
|
||||
//compile 'com.android.support.constraint:constraint-layout:1.0.2'
|
||||
//testCompile 'junit:junit:4.12'
|
||||
//compile 'com.google.code.findbugs:jsr305:2.0.1'
|
||||
|
||||
@@ -2,6 +2,9 @@ package wesayallright.timemanager.InnerLayer;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.util.Calendar;
|
||||
|
||||
/**
|
||||
* Created by mj on 17-4-19.
|
||||
* 全局变量类
|
||||
@@ -12,4 +15,8 @@ public class Package {
|
||||
//public static GroupList groups;
|
||||
public static User currentUser;
|
||||
public static boolean debug;
|
||||
public static DateFormat dateFormatter;
|
||||
public static DateFormat timeFormatter;
|
||||
public static DateFormat dateTimeFormatter;
|
||||
public static Calendar today;
|
||||
}
|
||||
|
||||
@@ -12,8 +12,12 @@ import android.view.MenuItem;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Locale;
|
||||
|
||||
import wesayallright.timemanager.InnerLayer.LocalFile.LocalFile;
|
||||
import wesayallright.timemanager.InnerLayer.Package;
|
||||
import wesayallright.timemanager.InnerLayer.User;
|
||||
import wesayallright.timemanager.R;
|
||||
import wesayallright.timemanager.surface.activitiesFragment.Activities;
|
||||
@@ -75,6 +79,11 @@ public class MainActivity extends AppCompatActivity implements
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
Package.dateFormatter = new SimpleDateFormat("yyyy-MM-dd", Locale.CHINA);
|
||||
Package.timeFormatter = new SimpleDateFormat("hh:mm", Locale.CHINA);
|
||||
Package.dateTimeFormatter = SimpleDateFormat.getDateTimeInstance();
|
||||
Package.today = Calendar.getInstance();
|
||||
|
||||
|
||||
BottomNavigationView navigation = (BottomNavigationView) findViewById(R.id.navigation);
|
||||
navigation.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener);
|
||||
|
||||
+12
@@ -2,6 +2,7 @@ package wesayallright.timemanager.surface.activitiesFragment;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Paint;
|
||||
import android.media.Image;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
@@ -10,6 +11,7 @@ import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ListView;
|
||||
import android.widget.Toast;
|
||||
|
||||
@@ -83,6 +85,14 @@ public class Activities extends Fragment {
|
||||
JoinDialog.show(getActivity(), activitiesData.get(position));
|
||||
}
|
||||
});
|
||||
|
||||
ImageView plus = (ImageView)v.findViewById(R.id.nad_plus);
|
||||
plus.setOnClickListener(new ImageView.OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
NewActivityDialog.NewActivity(getActivity());
|
||||
}
|
||||
|
||||
});
|
||||
return v;
|
||||
}
|
||||
|
||||
@@ -125,4 +135,6 @@ public class Activities extends Fragment {
|
||||
void onFragmentInteraction(Uri uri);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
+113
@@ -0,0 +1,113 @@
|
||||
package wesayallright.timemanager.surface.activitiesFragment;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.DatePickerDialog;
|
||||
import android.app.Dialog;
|
||||
import android.app.TimePickerDialog;
|
||||
import android.os.Build;
|
||||
import android.support.annotation.RequiresApi;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.DatePicker;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
import android.widget.TimePicker;
|
||||
import android.widget.Toast;
|
||||
|
||||
import org.w3c.dom.Text;
|
||||
|
||||
import wesayallright.timemanager.InnerLayer.Package;
|
||||
import wesayallright.timemanager.R;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
import java.util.zip.Inflater;
|
||||
|
||||
/**
|
||||
* Created by mj on 17-4-29.
|
||||
* 添加新活动
|
||||
*/
|
||||
|
||||
|
||||
abstract public class NewActivityDialog{
|
||||
static public void NewActivity(final Activity a) {
|
||||
AlertDialog.Builder dialog = new AlertDialog.Builder(a);
|
||||
View v = View.inflate(a, R.layout.new_activity_dialog, null);
|
||||
TextView title = (TextView)v.findViewById(R.id.nad_top);
|
||||
final TextView date = (TextView)v.findViewById(R.id.nad_date);
|
||||
final TextView time = (TextView)v.findViewById(R.id.nad_time);
|
||||
TextView limit = (TextView)v.findViewById(R.id.nad_limit);
|
||||
EditText place = (EditText)v.findViewById(R.id.nad_placeBox);
|
||||
EditText detail = (EditText)v.findViewById(R.id.nad_detail);
|
||||
|
||||
dialog.setTitle("发起一个活动");
|
||||
// title.setText("添加新活动");
|
||||
final Date today = (Calendar.getInstance()).getTime();
|
||||
date.setText(Package.dateFormatter.format(today));
|
||||
time.setText(Package.timeFormatter.format(today));
|
||||
limit.setText("无限");
|
||||
final int[] chosenTime = new int[5]; // 神TM指针 厉害了我的Java
|
||||
final Calendar c = Package.today;// 获取今天的日期
|
||||
chosenTime[0] = c.get(Calendar.YEAR);
|
||||
chosenTime[1] = c.get(Calendar.MONTH);
|
||||
chosenTime[2] = c.get(Calendar.DAY_OF_MONTH);
|
||||
chosenTime[3] = c.get(Calendar.HOUR_OF_DAY);
|
||||
chosenTime[4] = c.get(Calendar.MINUTE);
|
||||
|
||||
date.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
// 直接创建一个DatePickerDialog对话框实例,并将它显示出来
|
||||
DatePickerDialog datePicker = new DatePickerDialog(a,
|
||||
// 绑定监听器
|
||||
new DatePickerDialog.OnDateSetListener() {
|
||||
|
||||
@Override
|
||||
public void onDateSet(DatePicker view, int year,
|
||||
int monthOfYear, int dayOfMonth) {
|
||||
// 选择的日期
|
||||
chosenTime[0] = year;
|
||||
chosenTime[1] = monthOfYear + 1;
|
||||
chosenTime[2] = dayOfMonth;
|
||||
date.setText(String.format(Locale.CHINA, "%04d-%02d-%02d",
|
||||
chosenTime[0], chosenTime[1], chosenTime[2]));
|
||||
}
|
||||
}
|
||||
// 设置初始日期
|
||||
, c.get(Calendar.YEAR), c.get(Calendar.MONTH), c
|
||||
.get(Calendar.DAY_OF_MONTH));
|
||||
datePicker.getDatePicker().setMinDate(System.currentTimeMillis() - 1000);
|
||||
datePicker.show();
|
||||
}
|
||||
});
|
||||
|
||||
time.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
TimePickerDialog timePicker = new TimePickerDialog(a,
|
||||
new TimePickerDialog.OnTimeSetListener() {
|
||||
@Override
|
||||
public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
|
||||
chosenTime[3] = hourOfDay;
|
||||
chosenTime[4] = minute;
|
||||
chosenTime[5] = 2;
|
||||
time.setText(String.format(Locale.CHINA, "%02d:%02d",
|
||||
chosenTime[3], chosenTime[4]));
|
||||
}
|
||||
}, c.get(Calendar.HOUR), c.get(Calendar.MINUTE), true);
|
||||
timePicker.show();
|
||||
}
|
||||
});
|
||||
|
||||
dialog.setView(v);
|
||||
dialog.setNegativeButton("取消", null);
|
||||
dialog.setPositiveButton("确定", null);
|
||||
|
||||
dialog.show();
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,35 @@
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<LinearLayout 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:id="@+id/fa"
|
||||
android:orientation="vertical"
|
||||
|
||||
tools:context="wesayallright.timemanager.surface.activitiesFragment.Activities">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/STrelative"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="40dp"
|
||||
android:orientation="horizontal"
|
||||
android:background="#FFFFFF">
|
||||
<ImageView
|
||||
android:id="@+id/nad_icon"
|
||||
android:layout_gravity="start"
|
||||
android:paddingTop="3dp"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/default_head"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/nad_plus"
|
||||
android:layout_width="33dp"
|
||||
android:layout_height="33dp"
|
||||
android:layout_gravity="end"
|
||||
android:background="@drawable/plus"/>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<ListView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
@@ -14,4 +38,4 @@
|
||||
|
||||
</ListView>
|
||||
|
||||
</FrameLayout>
|
||||
</LinearLayout>
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:orientation="vertical" android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:weightSum="1">
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/nad_top"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<android.support.percent.PercentRelativeLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/nad_date"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_widthPercent="50%" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/nad_time"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_widthPercent="50%"
|
||||
android:layout_toEndOf="@id/nad_date" />
|
||||
|
||||
</android.support.percent.PercentRelativeLayout>
|
||||
|
||||
<TextView android:id="@+id/nad_limit"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
/>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView5"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:textSize="20sp"
|
||||
android:text="@string/nad_place"
|
||||
android:visibility="visible"
|
||||
android:paddingTop="8dp"/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/nad_placeBox"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/nad_place"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
<TextView
|
||||
android:id="@+id/textView6"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:textSize="20sp"
|
||||
android:text="@string/nad_commit"
|
||||
/>
|
||||
<EditText
|
||||
android:id="@+id/nad_detail"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:hint="@string/nad_commit"/>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
</resources>
|
||||
@@ -15,4 +15,6 @@
|
||||
|
||||
<string name="joinDialogTitle"> 加入</string>
|
||||
<string name="jd_zzzjhd">组织者将获得您的:</string>
|
||||
<string name="nad_place">地点: </string>
|
||||
<string name="nad_commit">请输入活动描述: </string>
|
||||
</resources>
|
||||
|
||||
@@ -14,6 +14,8 @@ buildscript {
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
|
||||
maven{url 'http://maven.aliyun.com/nexus/content/groups/public/'}
|
||||
jcenter()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user