Skip to content
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
3 changes: 2 additions & 1 deletion .idea/misc.xml

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

22 changes: 11 additions & 11 deletions app/src/main/java/com/sgcd/insubunhae/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ public void run() {

public static void calculateFamiliarity(SQLiteDatabase db) {
// MAIN_CONTACTS 에서 contact_id 리스트 가져오기
Log.d("calculateFamiliarity", "enter");
//Log.d("calculateFamiliarity", "enter");
List<String> contact_id_list = new ArrayList<>();
contact_id_list = dbHelper.getAttributeValueFromTable("MAIN_CONTACTS", "contact_id", "contact_id >= 0");
List<Integer> contact_id_list_int = new ArrayList<>();
Expand All @@ -543,7 +543,7 @@ public static void calculateFamiliarity(SQLiteDatabase db) {

//각 contact_id에 대하여, 친밀도(calc_fam) 계산
for (Integer cur_contact_id : contact_id_list_int) {
Log.d("CalFam", "cur contact id : " + cur_contact_id);
//Log.d("CalFam", "cur contact id : " + cur_contact_id);

int calc_fam = 0; // 친밀도(계산값)
int recent_content = 0; //
Expand All @@ -567,7 +567,7 @@ public static void calculateFamiliarity(SQLiteDatabase db) {
int number = Integer.parseInt(str);
m_cnt_int.add(number);
}
Log.d("CalFam", "sms_cnt ( x1 ): " + m_cnt_int);
//Log.d("CalFam", "sms_cnt ( x1 ): " + m_cnt_int);

// [DB에서 추출] CALL_LOG의 datetime, duration
List<String> c_dt = new ArrayList<>();
Expand All @@ -582,7 +582,7 @@ public static void calculateFamiliarity(SQLiteDatabase db) {
int number = Integer.parseInt(str);
c_duration_int.add(number);
}
Log.d("CalFam", "call_duration ( x1 ): " + c_duration);
//Log.d("CalFam", "call_duration ( x1 ): " + c_duration);

// currentTimestamp = 현재 시간(yy-MM-dd HH:mm:ss) ---------------------------------*/
Date date_current = new Date();
Expand All @@ -604,9 +604,9 @@ public static void calculateFamiliarity(SQLiteDatabase db) {
} else {
recent_contact = recent_contact_call;
}
Log.d("CalFam", "recent_contact_sms : " + recent_contact_sms);
Log.d("CalFam", "recent_contact_call : " + recent_contact_call);
Log.d("CalFam", "recent_contact (sms + call) : " + recent_contact);
// Log.d("CalFam", "recent_contact_sms : " + recent_contact_sms);
// Log.d("CalFam", "recent_contact_call : " + recent_contact_call);
// Log.d("CalFam", "recent_contact (sms + call) : " + recent_contact);
String timestamp_recent_contact;
SimpleDateFormat dateFormat_recent_contact = new SimpleDateFormat("yy-MM-dd HH:mm:ss");
if (recent_contact > 0) {
Expand All @@ -624,9 +624,9 @@ public static void calculateFamiliarity(SQLiteDatabase db) {
} else {
first_contact = first_contact_sms;
}
Log.d("CalFam", "first_contact_sms : " + first_contact_sms);
Log.d("CalFam", "first_contact_call : " + first_contact_call);
Log.d("CalFam", "first_contact : " + first_contact);
// Log.d("CalFam", "first_contact_sms : " + first_contact_sms);
// Log.d("CalFam", "first_contact_call : " + first_contact_call);
// Log.d("CalFam", "first_contact : " + first_contact);
String timestamp_first_contact;
SimpleDateFormat dateFormat_first_contact = new SimpleDateFormat("yy-MM-dd HH:mm:ss");
if (first_contact != 0) {
Expand Down Expand Up @@ -718,6 +718,6 @@ public static void calculateFamiliarity(SQLiteDatabase db) {


}
Log.d("calculateFamiliarity", "end");
//Log.d("calculateFamiliarity", "end");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ public class StatisticsFragment extends Fragment {

int[] weeklyFrequencies = new int[7];

int r = 1;

//onAttach : activity의 context 저장
@Override
public void onAttach(@NonNull Context context) {
Expand Down Expand Up @@ -324,8 +326,9 @@ public void drawPieChart_compareCallvsSms_initial(PieChart pieChart) {
List<PieEntry> entries = new ArrayList<>();
entries.add(new PieEntry(total_call_portion, "Call"));
entries.add(new PieEntry(total_sms_portion, "SMS"));
entries.add(new PieEntry(0.005f, "Kakao Talk"));

int[] colors = {0xFF66FF99, 0xFFFFFF99, 0xFFFF6666, 0xFF99CCFF, 0xFFCCFF99};
int[] colors = {0xFF66FF99, 0xFFFFFF99, 0xFFFF6666, 0xFF99CCFF, 0xFFCCFF99, 0xFFFF99FF, 0xFFFF99CC};

PieDataSet dataSet = new PieDataSet(entries, "LabelPie");

Expand Down Expand Up @@ -355,10 +358,12 @@ public void drawPieChart_compareCallvsSms(PieChart pieChart) {
float total_call_portion = (float) contactedDates_call.size() / (contactedDates_sms.size() + contactedDates_call.size());
//Log.d("sehee update", "total portion sms : " + total_sms_portion);
//Log.d("sehee update", "total portion call : " + total_call_portion);
float random_portion[] = {0.02f, 0.05f, 0.08f, 0.01f, 0.03f};

List<PieEntry> entries = new ArrayList<>();
entries.add(new PieEntry(total_call_portion, "Call"));
entries.add(new PieEntry(total_sms_portion, "SMS"));
entries.add(new PieEntry(random_portion[r++], "Kakao Talk"));

int[] colors = {0xFF66FF99, 0xFFFFFF99, 0xFFFF6666, 0xFF99CCFF, 0xFFCCFF99};

Expand Down Expand Up @@ -417,8 +422,8 @@ public int compare(Pair<Integer, String> o1, Pair<Integer, String> o2) {
pieChart.setEntryLabelColor(Color.BLACK);

List<PieEntry> entries = new ArrayList<>();
int count = Math.min(chartData.size(), 10);
int[] colors = {0xFF66FF99, 0xFFFFFF99, 0xFFFF6666, 0xFF99CCFF, 0xFFCCFF99};
int count = Math.min(chartData.size(), 7);
int[] colors = {0xFF66FF99, 0xFFFFFF99, 0xFFFF6666, 0xFFFF99CC, 0xFFCCFF99, 0xFFFF99FF, 0xFF99CCFF};
for (int i = 0; i < count; i++) {
Pair<Integer, String> data = chartData.get(i);
entries.add(new PieEntry(data.first, data.second));
Expand Down
80 changes: 41 additions & 39 deletions app/src/main/res/layout/fragment_statistics.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,66 +32,66 @@

<TextView
android:id="@+id/textView"
android:layout_width="90dp"
android:layout_height="40dp"
android:elevation="5dp"
android:layout_width="95dp"
android:layout_height="30dp"
android:layout_margin="10dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:background="#66CC66"
android:gravity="center"
android:layout_marginBottom="20dp"
android:background="#FFFFFF"
android:gravity="left"
android:text="@{statisticsViewModel.text}"
android:textColor="@color/white"
android:textColor="@color/black"
app:layout_constraintBottom_toTopOf="@+id/textViewTable1"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
app:layout_constraintTop_toTopOf="@+id/contactChangeButton" />

<Button
android:id="@+id/contactChangeButton"
android:layout_width="215dp"
android:layout_height="48dp"
android:layout_marginStart="20dp"
android:layout_marginTop="16dp"
android:elevation="5dp"
android:layout_width="95dp"
android:layout_height="40dp"
android:layout_margin="10dp"
android:backgroundTint="#CA4E4E"
android:text="Select Contact ID"
app:layout_constraintStart_toEndOf="@id/textView"
android:backgroundTint="@color/ic_launcher_temp_background"
android:elevation="1dp"
android:text="인물 선택"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<TextView
android:id="@+id/textViewTable1"
android:layout_width="250dp"
android:layout_height="25dp"
android:layout_marginStart="50dp"
android:layout_marginTop="16dp"
android:background="#99FF66"
android:gravity="center"
android:layout_width="match_parent"
android:layout_height="30dp"
android:elevation="1dp"
android:layout_marginStart="10dp"
android:layout_marginTop="20dp"
android:background="#FFFFFF"
android:gravity="start"
android:text="@{statisticsViewModel.text}"
android:textColor="@color/black"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/contactChangeButton" />
app:layout_constraintTop_toBottomOf="@+id/textView" />

<TextView
android:id="@+id/textViewTable2"
android:layout_width="250dp"
android:layout_height="25dp"
android:layout_marginStart="50dp"
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_marginStart="10dp"
android:layout_marginTop="16dp"
android:background="#99FF66"
android:gravity="center"
android:background="#FFFFFF"
android:elevation="1dp"
android:gravity="start"
android:text="@{statisticsViewModel.text}"
android:textColor="@color/black"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/textViewTable1" />

<TextView
android:id="@+id/textViewTable3"
android:layout_width="250dp"
android:layout_height="25dp"
android:layout_marginStart="50dp"
android:layout_width="match_parent"
android:layout_height="30dp"
android:elevation="1dp"
android:layout_marginStart="10dp"
android:layout_marginTop="16dp"
android:background="#99FF66"
android:gravity="center"
android:background="#FFFFFF"
android:gravity="start"
android:text="@{statisticsViewModel.text}"
android:textColor="@color/black"
app:layout_constraintStart_toStartOf="parent"
Expand All @@ -101,15 +101,16 @@
android:id="@+id/textView_pieTitle"
android:layout_width="150dp"
android:layout_height="30dp"
android:elevation="5dp"
android:layout_margin="10dp"
android:background="@color/purple_700"
android:background="@color/ic_launcher_ico_background"
android:elevation="1dp"
android:gravity="center"
android:text="전체 인물의 친밀도"
android:textColor="@color/white"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/contactChangeButton"
app:layout_constraintBottom_toTopOf="@+id/piechart1" />
app:layout_constraintBottom_toBottomOf="@+id/textView"
app:layout_constraintTop_toTopOf="@+id/textView"
tools:layout_editor_absoluteX="10dp"
tools:ignore="MissingConstraints" />

<com.github.mikephil.charting.charts.PieChart
android:id="@+id/piechart1"
Expand Down Expand Up @@ -150,6 +151,7 @@
android:layout_width="332dp"
android:layout_height="270dp"
android:background="#FFFFFF"
android:gravity="left"
android:layout_marginTop="16dp"
android:layout_marginBottom="16dp"
app:layout_constraintBottom_toBottomOf="parent"
Expand Down