63 lines
1.9 KiB
Java
63 lines
1.9 KiB
Java
/*
|
|
* Copyright 2018 whb
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
package dk.network42.osmfocus;
|
|
|
|
import android.app.Activity;
|
|
import android.os.Bundle;
|
|
import android.widget.TextView;
|
|
import android.widget.Toast;
|
|
|
|
import java.io.BufferedReader;
|
|
import java.io.IOException;
|
|
import java.io.InputStreamReader;
|
|
|
|
public class LicenseActivity extends Activity {
|
|
|
|
@Override
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
super.onCreate(savedInstanceState);
|
|
setContentView(R.layout.activity_license);
|
|
|
|
BufferedReader reader = null;
|
|
|
|
StringBuilder text = new StringBuilder();
|
|
|
|
try {
|
|
reader = new BufferedReader(new InputStreamReader(getAssets().open("LICENSE")));
|
|
|
|
String mLine;
|
|
while ((mLine = reader.readLine()) != null) {
|
|
text.append(mLine);
|
|
text.append('\n');
|
|
}
|
|
} catch (IOException e) {
|
|
Toast.makeText(getApplicationContext(), "Error reading file!", Toast.LENGTH_LONG).show();
|
|
e.printStackTrace();
|
|
} finally {
|
|
if (reader != null) {
|
|
try {
|
|
reader.close();
|
|
} catch (IOException e) {
|
|
}
|
|
}
|
|
|
|
TextView textView = (TextView) findViewById(R.id.license_text_view);
|
|
textView.setText((CharSequence) text);
|
|
}
|
|
}
|
|
}
|