Skip to content

Commit 162d222

Browse files
committed
Remove useless settings
1 parent f5afc9b commit 162d222

File tree

15 files changed

+179
-290
lines changed

15 files changed

+179
-290
lines changed

MobileOrg/src/main/java/com/matburt/mobileorg/EditNodeActivity.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ public boolean onOptionsItemSelected(MenuItem item) {
7373

7474
case R.id.edit_menu_ok:
7575

76-
((EditNodeFragment)(getSupportFragmentManager().findFragmentByTag(EDIT_NODE_FRAGMENT))).onOKPressed();
77-
finish();
76+
boolean shouldFinish = ((EditNodeFragment)(getSupportFragmentManager().findFragmentByTag(EDIT_NODE_FRAGMENT))).onOKPressed();
77+
if(shouldFinish) finish();
7878
// Intent intent = new Intent(this, OrgNodeListActivity.class);
7979
// startActivity(intent);
8080
return true;

MobileOrg/src/main/java/com/matburt/mobileorg/EditNodeFragment.java

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import android.widget.EditText;
2222
import android.widget.LinearLayout;
2323
import android.widget.TimePicker;
24+
import android.widget.Toast;
2425

2526
import com.matburt.mobileorg.orgdata.OrgContract;
2627
import com.matburt.mobileorg.orgdata.OrgFile;
@@ -30,7 +31,9 @@
3031
import com.matburt.mobileorg.util.TodoDialog;
3132

3233
import java.util.ArrayList;
34+
import java.util.Arrays;
3335
import java.util.Calendar;
36+
import java.util.List;
3437

3538
public class EditNodeFragment extends Fragment {
3639
public static String NODE_ID = "node_id";
@@ -248,8 +251,18 @@ public void onSaveInstanceState(Bundle outState) {
248251
* Triggers the update mechanism
249252
* First the new node is written to the DB
250253
* Then the file is written to disk
254+
* @return : whether or not, the fragment must finish
251255
*/
252-
public void onOKPressed(){
256+
public boolean onOKPressed(){
257+
List<OrgNodeTimeDate> timedates = Arrays.asList(node.getDeadline(), node.getScheduled());
258+
for(OrgNodeTimeDate timedate: timedates){
259+
if( (timedate.startMinute >= 0 || timedate.startTimeOfDay >= 0) &&
260+
(timedate.dayOfMonth < 0 || timedate.monthOfYear < 0 || timedate.year < 0)){
261+
Toast.makeText(context,R.string.pick_a_date,Toast.LENGTH_LONG).show();
262+
return false;
263+
}
264+
}
265+
253266
ContentResolver resolver = getContext().getContentResolver();
254267
String payload = "";
255268

@@ -262,7 +275,7 @@ public void onOKPressed(){
262275

263276
node.write(getContext());
264277
OrgFile.updateFile(node, context);
265-
278+
return true;
266279
}
267280

268281
/**
@@ -304,7 +317,6 @@ public void onClick(DialogInterface dialog,
304317

305318
public static class TimePickerFragment extends DialogFragment
306319
implements TimePickerDialog.OnTimeSetListener {
307-
static private int day = -1, month = -1, year = -1;
308320

309321
@Override
310322
public Dialog onCreateDialog(Bundle savedInstanceState) {
@@ -319,7 +331,6 @@ public Dialog onCreateDialog(Bundle savedInstanceState) {
319331
}
320332

321333
public void onTimeSet(TimePicker view, int hourOfDay, int minuteOfDay) {
322-
ContentResolver resolver = getActivity().getContentResolver();
323334
timeDate.startTimeOfDay = hourOfDay;
324335
timeDate.startMinute = minuteOfDay;
325336
setupTimeStampButtons();
@@ -351,15 +362,7 @@ public void onDateSet(DatePicker view, int year, int month, int day) {
351362
timeDate.year = year;
352363
timeDate.monthOfYear = month;
353364
timeDate.dayOfMonth = day;
354-
355365
setupTimeStampButtons();
356-
// Bundle bundle = new Bundle();
357-
// bundle.putInt("year",year);
358-
// bundle.putInt("month",month);
359-
// bundle.putInt("day",day);
360-
// TimePickerFragment newFragment = new TimePickerFragment();
361-
// newFragment.setArguments(bundle);
362-
// newFragment.show(getActivity().getSupportFragmentManager(), "timePicker");
363366
}
364367
}
365368
}

MobileOrg/src/main/java/com/matburt/mobileorg/OrgNodeListActivity.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import android.support.v7.widget.SearchView;
1919
import android.support.v7.widget.Toolbar;
2020
import android.text.InputType;
21+
import android.util.Log;
2122
import android.view.Menu;
2223
import android.view.MenuInflater;
2324
import android.view.MenuItem;

MobileOrg/src/main/java/com/matburt/mobileorg/orgdata/OrgContract.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import android.net.Uri;
44

55
public class OrgContract {
6-
public static final String CONTENT_AUTHORITY = "com.matburt.mobileorg.OrgData.OrgProvider";
6+
public static final String CONTENT_AUTHORITY = "com.matburt.mobileorg.orgdata.OrgProvider";
77
private static final Uri BASE_CONTENT_URI = Uri.parse("content://" + CONTENT_AUTHORITY);
88
private static final String PATH_ORGDATA = OrgDatabase.Tables.ORGDATA;
99
private static final String PATH_TIMESTAMPS = OrgDatabase.Tables.TIMESTAMPS;

MobileOrg/src/main/java/com/matburt/mobileorg/orgdata/OrgProviderUtils.java

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -184,14 +184,9 @@ public static ArrayList<OrgNode> getOrgNodePathFromTopLevel(long node_id, Conten
184184

185185

186186
public static void clearDB(ContentResolver resolver) {
187-
try {
188-
resolver.delete(OrgData.CONTENT_URI, null, null);
189-
resolver.delete(Files.CONTENT_URI, null, null);
190-
resolver.delete(Timestamps.CONTENT_URI, null, null);
191-
} catch( IllegalArgumentException e){
192-
e.printStackTrace();
193-
}
194-
187+
resolver.delete(OrgData.CONTENT_URI, null, null);
188+
resolver.delete(Files.CONTENT_URI, null, null);
189+
resolver.delete(Timestamps.CONTENT_URI, null, null);
195190
}
196191

197192
public static boolean isTodoActive(String todo, ContentResolver resolver) {

MobileOrg/src/main/java/com/matburt/mobileorg/services/SyncService.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ public void onCreate() {
4747
this.appSettings.registerOnSharedPreferenceChangeListener(this);
4848
this.appInst = (MobileOrgApplication) this.getApplication();
4949
this.alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
50-
51-
// Log.v("trace", "sync service");
5250
}
5351

5452
@Override

MobileOrg/src/main/java/com/matburt/mobileorg/settings/SettingsActivity.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@ public boolean onPreferenceClick(Preference preference) {
5353
@Override
5454
public void onClick(DialogInterface dialog,
5555
int which) {
56-
57-
56+
OrgProviderUtils.clearDB(getContentResolver());
5857
}
5958

6059
}).setNegativeButton(R.string.no, null).show();
@@ -83,10 +82,10 @@ protected void onCreate(Bundle savedInstanceState) {
8382
addPreferencesFromResource(R.xml.preferences);
8483

8584
init();
86-
populateSyncSources();
87-
populateTodoKeywords();
85+
// populateSyncSources();
86+
// populateTodoKeywords();
8887
populateVersionName();
89-
findPreference("clearDB").setOnPreferenceClickListener(onClearDBClick);
88+
// findPreference("clearDB").setOnPreferenceClickListener(onClearDBClick);
9089
}
9190

9291
private void init() {

MobileOrg/src/main/java/com/matburt/mobileorg/synchronizers/SSHSynchronizer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public SyncResult synchronize(){
7575
* @return
7676
*/
7777
public boolean isCredentialsRequired() {
78-
return AuthData.getPublicKey(context).equals("") && authData.getPassword().equals("");
78+
return false;
7979
}
8080

8181
@Override

MobileOrg/src/main/java/com/matburt/mobileorg/synchronizers/Synchronizer.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ public HashSet<String> runSynchronizer() {
117117
return pulledFiles.changedFiles;
118118
} catch (Exception e) {
119119
showErrorNotification(e);
120+
e.printStackTrace();
120121
}
121122
return result;
122123
}

MobileOrg/src/main/java/com/matburt/mobileorg/util/FileUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public static String read(Context context, String filename){
5656
BufferedReader br = new BufferedReader(new FileReader(file));
5757
return FileUtils.read(br);
5858
} catch (IOException e) {
59-
Toast.makeText(context, e.toString(), Toast.LENGTH_LONG).show();
59+
e.printStackTrace();
6060
}
6161
return "";
6262
}

MobileOrg/src/main/res/layout/edit_node_entry.xml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -108,16 +108,6 @@
108108
android:padding="20dp"
109109
/>
110110
</LinearLayout>
111-
112-
<Button
113-
android:id="@+id/delete_node"
114-
android:layout_width="wrap_content"
115-
android:layout_height="wrap_content"
116-
android:drawableStart="@drawable/ic_menu_delete"
117-
android:padding="20dp"
118-
/>
119-
120-
121111
</LinearLayout>
122112
</LinearLayout>
123113
</LinearLayout>

MobileOrg/src/main/res/menu/outline_menu.xml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,13 @@
1515
android:title="@string/menu_sync"
1616
app:showAsAction="ifRoom" />
1717

18-
<item
19-
android:id="@+id/menu_agenda"
20-
android:icon="@drawable/ic_menu_agenda"
21-
android:title="@string/menu_agenda"/>
2218

2319
<item
2420
android:id="@+id/menu_help"
2521
android:icon="@drawable/ic_menu_help"
26-
android:title="@string/menu_help"/>
22+
android:title="@string/menu_help"
23+
/>
24+
2725
<item
2826
android:id="@+id/menu_settings"
2927
android:icon="@drawable/ic_menu_preferences"

MobileOrg/src/main/res/values-es/arrays.xml

Lines changed: 0 additions & 63 deletions
This file was deleted.

MobileOrg/src/main/res/values/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@
150150
<string name="wizard_ubuntu_email_hint">[email protected]</string>
151151
<string name="generate_dsa_keys">Generate DSA keys</string>
152152
<string name="pubkey_copied">Public key copied to clipboard !</string>
153+
<string name="pick_a_date">If you select a time, you must also select a date.</string>
153154

154155
<!-- preference strings -->
155156
<string name="preferences">Preferences</string>

0 commit comments

Comments
 (0)