-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from omnt/feature/config_file
Add Config Exporter/Importer
- Loading branch information
Showing
34 changed files
with
1,180 additions
and
207 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
app/src/main/java/de/fraunhofer/fokus/OpenMobileNetworkToolkit/ClearPreferencesFragment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package de.fraunhofer.fokus.OpenMobileNetworkToolkit; | ||
|
||
import android.app.Dialog; | ||
import android.content.DialogInterface; | ||
import android.os.Bundle; | ||
import android.widget.Toast; | ||
|
||
import androidx.appcompat.app.AlertDialog; | ||
import androidx.fragment.app.DialogFragment; | ||
|
||
import de.fraunhofer.fokus.OpenMobileNetworkToolkit.Preferences.SharedPreferencesGrouper; | ||
import de.fraunhofer.fokus.OpenMobileNetworkToolkit.SettingPreferences.ClearPreferencesListener; | ||
|
||
public class ClearPreferencesFragment extends DialogFragment { | ||
private ClearPreferencesListener listener; | ||
|
||
public void setClearPreferencesListener(ClearPreferencesListener listener) { | ||
this.listener = listener; | ||
} | ||
public Dialog onCreateDialog(Bundle savedInstanceState) { | ||
// Use the Builder class for convenient dialog construction. | ||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); | ||
builder.setMessage(R.string.clear_preferences_message) | ||
.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() { | ||
public void onClick(DialogInterface dialog, int id) { | ||
SharedPreferencesGrouper.getInstance(getContext()).clearConfig(); | ||
listener.onPreferenceChanged(); | ||
Toast.makeText(getContext(), "All Config Cleared!", Toast.LENGTH_SHORT).show(); | ||
} | ||
}) | ||
.setNegativeButton(R.string.no, new DialogInterface.OnClickListener() { | ||
public void onClick(DialogInterface dialog, int id) { | ||
Toast.makeText(getContext(), "Canceled", Toast.LENGTH_SHORT).show(); | ||
} | ||
}); | ||
// Create the AlertDialog object and return it. | ||
return builder.create(); | ||
} | ||
|
||
} |
44 changes: 44 additions & 0 deletions
44
...main/java/de/fraunhofer/fokus/OpenMobileNetworkToolkit/DataProvider/BuildInformation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package de.fraunhofer.fokus.OpenMobileNetworkToolkit.DataProvider; | ||
|
||
import org.json.JSONObject; | ||
|
||
import de.fraunhofer.fokus.OpenMobileNetworkToolkit.BuildConfig; | ||
|
||
public class BuildInformation { | ||
|
||
public String getBuildType() { | ||
return BuildConfig.BUILD_TYPE; | ||
} | ||
|
||
public int getVersionCode() { | ||
return BuildConfig.VERSION_CODE; | ||
} | ||
|
||
public String getVersionName() { | ||
return BuildConfig.VERSION_NAME; | ||
} | ||
|
||
public String getApplicationId() { | ||
return BuildConfig.APPLICATION_ID; | ||
} | ||
|
||
public boolean isDebug() { | ||
return BuildConfig.DEBUG; | ||
} | ||
|
||
public JSONObject toJSON(){ | ||
|
||
JSONObject json = new JSONObject(); | ||
try { | ||
json.put("BuildType", getBuildType()); | ||
json.put("VersionCode", getVersionCode()); | ||
json.put("VersionName", getVersionName()); | ||
json.put("ApplicationId", getApplicationId()); | ||
json.put("Debug", isDebug()); | ||
} catch (Exception e) { | ||
e.printStackTrace(); | ||
} | ||
|
||
return json; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.