forked from 2dust/v2rayNG
-
Notifications
You must be signed in to change notification settings - Fork 243
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cf93700
commit b623da9
Showing
2 changed files
with
155 additions
and
0 deletions.
There are no files selected for viewing
76 changes: 76 additions & 0 deletions
76
V2rayNG/app/src/main/java/com/v2ray/ang/helper/GFW_privacy_policy_Activity.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,76 @@ | ||
package com.v2ray.ang.helper; | ||
|
||
import androidx.annotation.NonNull; | ||
import androidx.appcompat.app.ActionBar; | ||
import androidx.appcompat.app.AppCompatActivity; | ||
|
||
import android.content.Context; | ||
import android.os.Bundle; | ||
import android.view.MenuItem; | ||
import android.widget.TextView; | ||
|
||
import com.v2ray.ang.R; | ||
|
||
import java.io.InputStreamReader; | ||
import java.io.Reader; | ||
|
||
public class GFW_privacy_policy_Activity extends AppCompatActivity { | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_gfw_privacy_policy); | ||
|
||
|
||
ActionBar actionBar = getSupportActionBar(); | ||
if(actionBar!=null) { | ||
actionBar.setDisplayHomeAsUpEnabled(true); | ||
} | ||
|
||
|
||
TextView tv = (TextView) findViewById(R.id.textView_privacy_policy); | ||
|
||
String tmp = fetch_text_file_from_asset(GFW_privacy_policy_Activity.this); | ||
tv.setText(tmp); | ||
|
||
|
||
} | ||
|
||
|
||
|
||
|
||
|
||
// read text file from asset | ||
private String fetch_text_file_from_asset(Context ctx){ | ||
try { | ||
|
||
int bufferSize = 4096; | ||
char[] buffer = new char[bufferSize]; | ||
StringBuilder sb = new StringBuilder(); | ||
Reader in = new InputStreamReader(ctx.getAssets().open("privacy_policy.txt")); | ||
for (int numRead; (numRead = in.read(buffer, 0, buffer.length)) > 0; ) { | ||
sb.append(buffer, 0, numRead); | ||
} | ||
in.close(); | ||
return sb.toString(); | ||
|
||
}catch(Exception e){ | ||
System.out.println("file reading ERR: "+e.getMessage()); | ||
return ""; | ||
} | ||
} | ||
|
||
|
||
@Override | ||
public boolean onOptionsItemSelected(@NonNull MenuItem item){ | ||
if (item.getItemId() == android.R.id.home) { | ||
this.finish(); | ||
return true; | ||
} | ||
return super.onOptionsItemSelected(item); | ||
} | ||
|
||
|
||
|
||
|
||
} |
79 changes: 79 additions & 0 deletions
79
V2rayNG/app/src/main/java/com/v2ray/ang/helper/GFW_terms_service_Activity.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,79 @@ | ||
package com.v2ray.ang.helper; | ||
|
||
import androidx.annotation.NonNull; | ||
import androidx.appcompat.app.ActionBar; | ||
import androidx.appcompat.app.AppCompatActivity; | ||
|
||
import android.content.Context; | ||
import android.os.Bundle; | ||
import android.os.TestLooperManager; | ||
import android.view.MenuItem; | ||
import android.widget.TextView; | ||
|
||
import com.v2ray.ang.R; | ||
|
||
import java.io.BufferedReader; | ||
import java.io.InputStream; | ||
import java.io.InputStreamReader; | ||
import java.io.Reader; | ||
import java.nio.charset.StandardCharsets; | ||
|
||
public class GFW_terms_service_Activity extends AppCompatActivity { | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_gfw_terms_service); | ||
|
||
|
||
ActionBar actionBar = getSupportActionBar(); | ||
if(actionBar!=null) { | ||
actionBar.setDisplayHomeAsUpEnabled(true); | ||
} | ||
|
||
|
||
TextView tv = (TextView) findViewById(R.id.textView_terms_service); | ||
|
||
String tmp = fetch_text_file_from_asset(GFW_terms_service_Activity.this); | ||
tv.setText(tmp); | ||
|
||
|
||
} | ||
|
||
|
||
|
||
|
||
|
||
|
||
// read text file from asset | ||
private String fetch_text_file_from_asset(Context ctx){ | ||
try { | ||
|
||
int bufferSize = 4096; | ||
char[] buffer = new char[bufferSize]; | ||
StringBuilder sb = new StringBuilder(); | ||
Reader in = new InputStreamReader(ctx.getAssets().open("terms_of_service.txt")); | ||
for (int numRead; (numRead = in.read(buffer, 0, buffer.length)) > 0; ) { | ||
sb.append(buffer, 0, numRead); | ||
} | ||
in.close(); | ||
return sb.toString(); | ||
|
||
}catch(Exception e){ | ||
System.out.println("file reading ERR: "+e.getMessage()); | ||
return ""; | ||
} | ||
} | ||
|
||
|
||
@Override | ||
public boolean onOptionsItemSelected(@NonNull MenuItem item){ | ||
if (item.getItemId() == android.R.id.home) { | ||
this.finish(); | ||
return true; | ||
} | ||
return super.onOptionsItemSelected(item); | ||
} | ||
|
||
|
||
} |