Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Усачева Юлия, 2536 #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added app-debug.apk
Binary file not shown.
13 changes: 9 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,20 @@ apply plugin: 'com.android.application'

android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
buildToolsVersion "21.0.2"

defaultConfig {
applicationId "ru.ifmo.md.exam1"
minSdkVersion 15
applicationId "year2013.ifmo.exam1"
minSdkVersion 14
targetSdkVersion 21
versionCode 1
versionName "1.0"
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
buildTypes {
release {
minifyEnabled false
Expand All @@ -21,5 +26,5 @@ android {

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.android.support:appcompat-v7:21.0.2'
}
2 changes: 1 addition & 1 deletion app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /usr/local/opt/android-sdk/tools/proguard/proguard-android.txt
# in C:\sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ru.ifmo.md.exam1;
package year2013.ifmo.exam1;

import android.app.Application;
import android.test.ApplicationTestCase;
Expand Down
22 changes: 19 additions & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,21 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="ru.ifmo.md.exam1" >
package="year2013.ifmo.exam1" >

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:name="year2013.ifmo.exam1.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="year2013.ifmo.exam1.ViewActivity"
android:label="@string/title_activity_view" >
</activity>

<provider
android:name="year2013.ifmo.exam1.ItemsContentProvider"
android:authorities="year2013.ifmo.exam1.provider.item"
android:enabled="true"
android:exported="false" >
</provider>

<activity
android:name="year2013.ifmo.exam1.LabelsActivity"
android:label="@string/title_activity_labels" >
</activity>
</application>

</manifest>
39 changes: 0 additions & 39 deletions app/src/main/java/ru/ifmo/md/exam1/MainActivity.java

This file was deleted.

59 changes: 59 additions & 0 deletions app/src/main/java/year2013/ifmo/exam1/AddDialogFragment.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
package year2013.ifmo.exam1;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.widget.EditText;

/**
* Created by Юлия on 21.01.2015.
*/
public class AddDialogFragment extends DialogFragment {

public interface NoticeDialogListener {
public void onDialogPositiveClick(String title, String desc);
}

NoticeDialogListener mListener;

@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
try {
mListener = (NoticeDialogListener) activity;
} catch (ClassCastException e) {
throw new ClassCastException(activity.toString()
+ " must implement NoticeDialogListener");
}
}

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
LayoutInflater inflater = getActivity().getLayoutInflater();

builder.setView(inflater.inflate(R.layout.add_dialog, null))
.setTitle(R.string.dialog_title2)
.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
EditText titleEdit = (EditText) AddDialogFragment.this.getDialog().findViewById(R.id.add_title);
//EditText labEdit = (EditText) AddDialogFragment.this.getDialog().findViewById(R.id.add_labels);
EditText descEdit = (EditText) AddDialogFragment.this.getDialog().findViewById(R.id.add_desc);
String title = titleEdit.getText().toString();
String desc = descEdit.getText().toString();
mListener.onDialogPositiveClick(title, desc);
}
})
.setNegativeButton(R.string.no, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
AddDialogFragment.this.getDialog().cancel();
}
});
return builder.create();
}
}

51 changes: 51 additions & 0 deletions app/src/main/java/year2013/ifmo/exam1/DeleteDialogFragment.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package year2013.ifmo.exam1;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.content.DialogInterface;
import android.os.Bundle;

/**
* Created by Юлия on 21.01.2015.
*/
public class DeleteDialogFragment extends DialogFragment {

public interface NoticeDialogListener {
public void onDialogPositiveClick();
}

NoticeDialogListener mListener;

@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
try {
mListener = (NoticeDialogListener) activity;
} catch (ClassCastException e) {
throw new ClassCastException(activity.toString()
+ " must implement NoticeDialogListener");
}
}

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());

builder.setTitle(R.string.dialog_title)
.setPositiveButton(R.string.positive, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {

mListener.onDialogPositiveClick();
}
})
.setNegativeButton(R.string.negative, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
DeleteDialogFragment.this.getDialog().cancel();
}
});
return builder.create();
}

}
74 changes: 74 additions & 0 deletions app/src/main/java/year2013/ifmo/exam1/Item.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
package year2013.ifmo.exam1;

import android.net.Uri;
import android.provider.BaseColumns;

/**
* Created by Юлия on 21.01.2015.
*/
public class Item {

public static final String AUTHORITY =
"year2013.ifmo.exam1.provider.item";

public static class Expression implements BaseColumns{

public static final int ID_COLUMN = 0;
public static final int TITLE_COLUMN = 1;
public static final int DATE_COLUMN = 2;
public static final int LABEL_COLUMN = 3;
public static final int DESCRIPTION_COLUMN = 4;

private Expression() {}

public static final String EXPRESSION_NAME = "expression";

public static final Uri EXPRESSION_URI = Uri.parse("content://" +
AUTHORITY + "/" + Expression.EXPRESSION_NAME);

public static final Uri CONTENT_URI = EXPRESSION_URI;

public static final String CONTENT_TYPE =
"vnd.android.cursor.dir/vnd.expression.data";

public static final String CONTENT_ITEM_TYPE =
"vnd.android.cursor.item/vnd.expression.data";

public static final String TITLE_NAME = "title";

public static final String LABEL_NAME = "label";

public static final String DESCRIPTION_NAME = "description";

public static final String DATE_NAME = "date";

}

public static class Label implements BaseColumns{

public static final int ID_COLUMN = 0;
public static final int TITLE_COLUMN = 1;
public static final int NUMBER_COLUMN = 2;

private Label() {}

public static final String LABEL_NAME = "label";

public static final Uri LABEL_URI = Uri.parse("content://" +
AUTHORITY + "/" + Label.LABEL_NAME);

public static final Uri CONTENT_URI = LABEL_URI;

public static final String CONTENT_TYPE =
"vnd.android.cursor.dir/vnd.label.data";

public static final String CONTENT_ITEM_TYPE =
"vnd.android.cursor.item/vnd.label.data";

public static final String TITLE_NAME = "title";

public static final String NUMBER_NAME = "number";

}

}
Loading