mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-04 23:02:02 +01:00
add debug menu to copy git info to clipboard
Makes it easier to find out what the diffs were.
This commit is contained in:
parent
096aa3bd0f
commit
fd7f564e11
5 changed files with 48 additions and 3 deletions
|
@ -3,6 +3,7 @@ def VERSION_CODE_BASE = 125
|
|||
def VERSION_NAME = '4.4.129'
|
||||
def FABRIC_API_KEY = System.getenv("FABRIC_API_KEY")
|
||||
def GCM_SENDER_ID = System.getenv("GCM_SENDER_ID")
|
||||
def BUILD_INFO_NAME = "build-info.txt"
|
||||
|
||||
boolean forFDroid = hasProperty('forFDroid')
|
||||
|
||||
|
@ -57,6 +58,10 @@ android {
|
|||
|
||||
flavorDimensions "variant"//, "abi"
|
||||
productFlavors {
|
||||
all {
|
||||
buildConfigField "String", "BUILD_INFO_NAME", "\"${BUILD_INFO_NAME}\""
|
||||
}
|
||||
|
||||
xw4 {
|
||||
dimension "variant"
|
||||
applicationId "org.eehouse.android.xw4"
|
||||
|
@ -254,15 +259,14 @@ afterEvaluate {
|
|||
|
||||
task makeBuildAssets() {
|
||||
def assetsDir = android.sourceSets.main.assets.srcDirs.toArray()[0]
|
||||
String path = new File(assetsDir, 'build-info.txt').getAbsolutePath()
|
||||
File file = new File(path);
|
||||
String path = new File(assetsDir, BUILD_INFO_NAME).getAbsolutePath()
|
||||
String out = "git: ${GITREV}\n"
|
||||
|
||||
String diff = "git diff".execute().text.trim()
|
||||
if (diff) {
|
||||
out += "\n" + diff
|
||||
}
|
||||
file.write(out)
|
||||
new File(path).write(out)
|
||||
}
|
||||
|
||||
gradle.projectsEvaluated {
|
||||
|
|
|
@ -564,6 +564,7 @@ public class GamesListDelegate extends ListDelegateBase
|
|||
private static final int[] DEBUG_ITEMS = {
|
||||
// R.id.games_menu_loaddb,
|
||||
R.id.games_menu_storedb,
|
||||
R.id.games_menu_writegit,
|
||||
};
|
||||
private static final int[] NOSEL_ITEMS = {
|
||||
R.id.games_menu_newgroup,
|
||||
|
@ -1597,6 +1598,10 @@ public class GamesListDelegate extends ListDelegateBase
|
|||
Action.STORAGE_CONFIRMED, itemID );
|
||||
break;
|
||||
|
||||
case R.id.games_menu_writegit:
|
||||
Utils.gitInfoToClip( m_activity );
|
||||
break;
|
||||
|
||||
default:
|
||||
handled = handleSelGamesItem( itemID, selRowIDs )
|
||||
|| handleSelGroupsItem( itemID, getSelGroupIDs() );
|
||||
|
|
|
@ -32,7 +32,9 @@ import android.content.Intent;
|
|||
import android.content.SharedPreferences;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.ResolveInfo;
|
||||
import android.content.res.AssetManager;
|
||||
import android.content.res.Configuration;
|
||||
import android.text.ClipboardManager;
|
||||
|
||||
import android.database.Cursor;
|
||||
import android.media.Ringtone;
|
||||
|
@ -55,9 +57,12 @@ import android.widget.Toast;
|
|||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.io.Serializable;
|
||||
|
@ -187,6 +192,33 @@ public class Utils {
|
|||
context.startActivity( Intent.createChooser( intent, chooserMsg ) );
|
||||
}
|
||||
|
||||
static void gitInfoToClip( Context context )
|
||||
{
|
||||
StringBuilder sb;
|
||||
try {
|
||||
InputStream is = context.getAssets().open( BuildConfig.BUILD_INFO_NAME,
|
||||
AssetManager.ACCESS_BUFFER );
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
|
||||
sb = new StringBuilder();
|
||||
for ( ; ; ) {
|
||||
String line = reader.readLine();
|
||||
if ( null == line ) {
|
||||
break;
|
||||
}
|
||||
sb.append( line ).append( "\n" );
|
||||
}
|
||||
reader.close();
|
||||
} catch ( Exception ex ) {
|
||||
sb = null;
|
||||
}
|
||||
|
||||
if ( null != sb ) {
|
||||
ClipboardManager clipboard = (ClipboardManager)
|
||||
context.getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
clipboard.setText( sb.toString() );
|
||||
}
|
||||
}
|
||||
|
||||
public static void postNotification( Context context, Intent intent,
|
||||
int titleID, int bodyID, int id )
|
||||
{
|
||||
|
|
|
@ -120,5 +120,8 @@
|
|||
<item android:id="@+id/games_menu_loaddb"
|
||||
android:title="@string/gamel_menu_loaddb"
|
||||
/>
|
||||
<item android:id="@+id/games_menu_writegit"
|
||||
android:title="@string/gamel_menu_writegit"
|
||||
/>
|
||||
|
||||
</menu>
|
||||
|
|
|
@ -2491,6 +2491,7 @@
|
|||
<string name="name_dict_fmt">%1$s/%2$s</string>
|
||||
<string name="gamel_menu_storedb">Write games to SD card</string>
|
||||
<string name="gamel_menu_loaddb">Load games from SD card</string>
|
||||
<string name="gamel_menu_writegit">Copy git info to clipboard</string>
|
||||
<string name="enable_dupes_title">Accept duplicate invites</string>
|
||||
<string name="xlations_locale">Fake locale for translation</string>
|
||||
<string name="enable_dupes_summary">Accept invitations more than once</string>
|
||||
|
|
Loading…
Reference in a new issue